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

Abstract interface for nonlinear block solvers that provide both forward and adjoint solves. More...

#include <nonlinear_block_solver.hpp>

Collaboration diagram for smith::NonlinearBlockSolverBase:
Collaboration graph
[legend]

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 ~NonlinearBlockSolverBase ()
 destructor
 
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...
 
ConvergenceStatus convergenceStatus (double tolerance_multiplier, const std::vector< mfem::Vector > &residuals) const
 Evaluate convergence for this solver's configured tolerance using solver-owned convergence state.
 
virtual ConvergenceStatus convergenceStatus (double tolerance_multiplier, const std::vector< mfem::Vector > &residuals, NonlinearConvergenceContext &context) const =0
 Evaluate convergence with externally owned convergence state.
 
virtual void primeConvergenceContext (const std::vector< mfem::Vector > &residuals, NonlinearConvergenceContext &context) const =0
 Initialize a convergence context from a residual snapshot without relying on a fake convergence test.
 
bool checkConvergence (double tolerance_multiplier, const std::vector< mfem::Vector > &residuals) const
 Check whether the current residuals satisfy the convergence criterion.
 
virtual void resetConvergenceState () const
 Reset internal convergence tracking state (e.g. the stored initial residual norm used for relative tolerance). Call this at the start of each new solve sequence.
 
virtual void clearMemory () const
 Interface option to clear memory between solves to avoid high-water mark memory usage.
 
virtual void setInnerToleranceMultiplier (double multiplier)=0
 Set an inner-solve tolerance multiplier, e.g. for staggered solves.
 

Protected Attributes

bool is_setup_ = false
 Records if this block solver has its preconditioner initialized.
 
NonlinearConvergenceContext convergence_context_ = {}
 Solver-owned convergence state for one solve.
 

Detailed Description

Abstract interface for nonlinear block solvers that provide both forward and adjoint solves.

Definition at line 42 of file nonlinear_block_solver.hpp.

Member Function Documentation

◆ solve()

virtual std::vector<FieldPtr> smith::NonlinearBlockSolverBase::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::NonlinearBlockSolver.

◆ solveAdjoint()

virtual std::vector<FieldPtr> smith::NonlinearBlockSolverBase::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::NonlinearBlockSolver.


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