|
Smith
0.1
Smith is an implicit thermal structural mechanics simulation code.
|
Nonlinear block solver backed by an EquationSolver forward solve and linear adjoint solves. More...
#include <nonlinear_block_solver.hpp>

Public Member Functions | |
| NonlinearBlockSolver (std::unique_ptr< EquationSolver > s, MPI_Comm comm, double abs_tol=1e-12, double rel_tol=1e-8, std::optional< NonlinearSolverOptions > retained_nonlinear_options=std::nullopt, std::optional< LinearSolverOptions > retained_linear_options=std::nullopt) | |
| Construct from a nonlinear equation solver. More... | |
| ConvergenceStatus | convergenceStatus (double tolerance_multiplier, const std::vector< mfem::Vector > &residuals, NonlinearConvergenceContext &context) const override |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| void | primeConvergenceContext (const std::vector< mfem::Vector > &residuals, NonlinearConvergenceContext &context) const override |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| std::vector< FieldPtr > | 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 override |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| std::vector< FieldPtr > | solveAdjoint (const std::vector< DualPtr > &u_bars, std::vector< std::vector< MatrixPtr >> &jacobian_transposed) const override |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| void | completeSetup (const std::vector< FieldPtr > &us) const |
| Initialize the preconditioner in case of vector problems. | |
| void | setInnerToleranceMultiplier (double multiplier) override |
| Set the inner tolerance multiplier. | |
| std::shared_ptr< NonlinearBlockSolver > | cloneFresh () const |
| Build a fresh solver instance from retained config. | |
| 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. | |
Public Member Functions inherited from smith::NonlinearBlockSolverBase | |
| virtual | ~NonlinearBlockSolverBase () |
| destructor | |
| 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. | |
| 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. | |
Public Attributes | |
| std::unique_ptr< mfem::BlockOperator > | block_jac_ |
| Need to hold an instance of a block operator to work with the mfem solver interface. | |
| std::vector< std::vector< MatrixPtr > > | matrix_of_jacs_ |
| std::unique_ptr< EquationSolver > | nonlinear_solver_ |
| the nonlinear equation solver used for the forward pass | |
| MPI_Comm | comm_ |
| MPI communicator for parallel norm computation. | |
| double | abs_tol_ |
| absolute residual tolerance for convergence check | |
| double | rel_tol_ |
| relative residual tolerance for convergence check | |
| double | inner_tol_multiplier_ = 1.0 |
| multiplier for tolerances during inner solves | |
| std::optional< NonlinearSolverOptions > | retained_nonlinear_options_ = std::nullopt |
| retained nonlinear config | |
| std::optional< LinearSolverOptions > | retained_linear_options_ = std::nullopt |
| retained linear config | |
Additional Inherited Members | |
Public Types inherited from smith::NonlinearBlockSolverBase | |
| 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 | |
Protected Attributes inherited from smith::NonlinearBlockSolverBase | |
| bool | is_setup_ = false |
| Records if this block solver has its preconditioner initialized. | |
| NonlinearConvergenceContext | convergence_context_ = {} |
| Solver-owned convergence state for one solve. | |
Nonlinear block solver backed by an EquationSolver forward solve and linear adjoint solves.
Definition at line 107 of file nonlinear_block_solver.hpp.
| smith::NonlinearBlockSolver::NonlinearBlockSolver | ( | std::unique_ptr< EquationSolver > | s, |
| MPI_Comm | comm, | ||
| double | abs_tol = 1e-12, |
||
| double | rel_tol = 1e-8, |
||
| std::optional< NonlinearSolverOptions > | retained_nonlinear_options = std::nullopt, |
||
| std::optional< LinearSolverOptions > | retained_linear_options = std::nullopt |
||
| ) |
Construct from a nonlinear equation solver.
Definition at line 44 of file nonlinear_block_solver.cpp.
|
mutable |
Holding vectors of block matrices to that do not going out of scope before the mfem solver is done with using them in the block_jac_
Definition at line 149 of file nonlinear_block_solver.hpp.