Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
Public Types | Public Member Functions | List of all members
smith::DifferentiableBlockSolver Class Referenceabstract

Abstract interface to DifferentiableBlockSolver interface. Each differentiable block solve should provide both its forward solve and an adjoint solve. More...

#include <differentiable_solver.hpp>

Public Types

using FieldT = FiniteElementState
 using
 
using FieldPtr = std::shared_ptr< FieldT >
 using
 
using FieldD = FiniteElementDual
 using
 
using DualPtr = std::shared_ptr< FieldD >
 using
 
using MatrixPtr = std::unique_ptr< mfem::HypreParMatrix >
 using
 

Public Member Functions

virtual ~DifferentiableBlockSolver ()
 destructor
 
virtual void completeSetup (const std::vector< FieldT > &us)=0
 Required for certain solvers/preconditions, e.g. when multigrid algorithms want a near null-space For these cases, it should be called before solve.
 
virtual std::vector< FieldPtrsolve (const std::vector< FieldPtr > &u_guesses, std::function< std::vector< mfem::Vector >(const std::vector< FieldPtr > &)> residuals, std::function< std::vector< std::vector< MatrixPtr >>(const std::vector< FieldPtr > &)> jacobians) const =0
 Solve a set of equations with a vector of FiniteElementState as unknown. More...
 
virtual std::vector< FieldPtrsolveAdjoint (const std::vector< DualPtr > &u_bars, std::vector< std::vector< MatrixPtr >> &jacobian_transposed) const =0
 Solve the (linear) adjoint set of equations with a vector of FiniteElementState as unknown. More...
 
virtual void clearMemory () const
 Interface option to clear memory between solves to avoid high-water mark memory usage.
 

Detailed Description

Abstract interface to DifferentiableBlockSolver interface. Each differentiable block solve should provide both its forward solve and an adjoint solve.

Definition at line 118 of file differentiable_solver.hpp.

Member Function Documentation

◆ solve()

virtual std::vector<FieldPtr> smith::DifferentiableBlockSolver::solve ( const std::vector< FieldPtr > &  u_guesses,
std::function< std::vector< mfem::Vector >(const std::vector< FieldPtr > &)>  residuals,
std::function< std::vector< std::vector< MatrixPtr >>(const std::vector< FieldPtr > &)>  jacobians 
) const
pure virtual

Solve a set of equations with a vector of FiniteElementState as unknown.

Parameters
u_guessesinitial guess for solver
residualsstd::vector<std::function> for equations to be solved
jacobiansstd::vector<std::vector>> of std::function for evaluating the linearized Jacobians about the current solution
Returns
std::vector of solution vectors (FiniteElementState)

Implemented in smith::NonlinearDifferentiableBlockSolver, and smith::LinearDifferentiableBlockSolver.

◆ solveAdjoint()

virtual std::vector<FieldPtr> smith::DifferentiableBlockSolver::solveAdjoint ( const std::vector< DualPtr > &  u_bars,
std::vector< std::vector< MatrixPtr >> &  jacobian_transposed 
) const
pure virtual

Solve the (linear) adjoint set of equations with a vector of FiniteElementState as unknown.

Parameters
u_barsstd::vector of right hand sides (rhs) for the solve
jacobian_transposedstd::vector<std::vector>> of evaluated linearized adjoint space matrices
Returns
The adjoint vector of solution field

Implemented in smith::NonlinearDifferentiableBlockSolver, and smith::LinearDifferentiableBlockSolver.


The documentation for this class was generated from the following file: