![]() |
Lethe Open-Source Library version 1.2.0
Developer Guide
|
#include <physics_solver_strategy.h>
Public Member Functions | |
| PhysicsSolverStrategy (PhysicsSolver< VectorType > *physics_solver, const Parameters::NonLinearSolver ¶ms) | |
| PhysicsSolverStrategy (PhysicsSolver< VectorType > *physics_solver) | |
| virtual | ~PhysicsSolverStrategy ()=default |
| virtual void | solve ()=0 |
| unsigned int | get_current_newton_iteration () const |
Protected Member Functions | |
| bool | skip_linear_solve_if_fresh_rhs_is_already_converged (const bool rhs_was_assembled_this_iteration, const double rescale_metric, double ¤t_res, double &last_res, double &global_res) |
Protected Attributes | |
| PhysicsSolver< VectorType > * | physics_solver |
| Parameters::NonLinearSolver | params |
| unsigned int | outer_iteration |
Base class that works as an interface for all solver strategies (either non-linear or linear) for all systems of equations.
Definition at line 19 of file physics_solver_strategy.h.
| PhysicsSolverStrategy< VectorType >::PhysicsSolverStrategy | ( | PhysicsSolver< VectorType > * | physics_solver, |
| const Parameters::NonLinearSolver & | params ) |
Constructor for the non-linear solver strategies.
| [in] | physics_solver | A pointer to the physics solver to which the solving strategy is attached. |
| [in] | param | Non-linear solver parameters as specified in the simulation parameter file. |
Definition at line 126 of file physics_solver_strategy.h.
References outer_iteration, params, and physics_solver.
| PhysicsSolverStrategy< VectorType >::PhysicsSolverStrategy | ( | PhysicsSolver< VectorType > * | physics_solver | ) |
Constructor for the linear solver strategy.
| [in] | physics_solver | A pointer to the physics solver to which the solving strategy is attached. |
Definition at line 135 of file physics_solver_strategy.h.
References physics_solver.
|
virtualdefault |
Destructor.
|
inline |
Get the current newton iteration.
Definition at line 65 of file physics_solver_strategy.h.
References outer_iteration.
|
protected |
Skip the inner linear solve when the current Newton evaluation already produced a freshly assembled RHS whose residual is below the nonlinear tolerance.
This shortcut is only valid when the RHS was assembled for the current evaluation point. Otherwise the residual may still correspond to an older state and skipping the solve would incorrectly reuse stale information.
Solvers must opt into this behavior explicitly through allow_skip_linear_solve_when_residual_is_below_tolerance(). The shortcut is always safe on Newton iteration 0 because the RHS is assembled unconditionally there. On later Newton iterations, it requires force_rhs_calculation so that the converged residual comes from a fresh RHS assembled at the current Newton evaluation point.
| [in] | rhs_was_assembled_this_iteration | Whether the current Newton iteration assembled the RHS at the current evaluation point. |
| [in] | rescale_metric | Residual rescaling factor used by the nonlinear solver strategy. |
| [in,out] | current_res | Current matrix residual norm. |
| [in,out] | last_res | Last accepted matrix residual norm. |
| [in,out] | global_res | Current nonlinear residual reported by the physics solver. |
Definition at line 142 of file physics_solver_strategy.h.
References PhysicsSolver< VectorType >::allow_skip_linear_solve_when_residual_is_below_tolerance(), PhysicsSolver< VectorType >::get_current_residual(), PhysicsSolver< VectorType >::get_evaluation_point(), PhysicsSolver< VectorType >::get_newton_update(), PhysicsSolver< VectorType >::get_present_solution(), PhysicsSolver< VectorType >::get_system_rhs(), outer_iteration, params, and physics_solver.
|
pure virtual |
Solve the system of equations.
Implemented in InexactNewtonNonLinearSolverStrategy< VectorType >, KinsolNewtonNonLinearSolverStrategy< VectorType >, LinearSolverStrategy< VectorType >, and NewtonNonLinearSolverStrategy< VectorType >.
|
protected |
Number of current Newton iteration.
Definition at line 122 of file physics_solver_strategy.h.
|
protected |
Non linear solver parameters.
Definition at line 116 of file physics_solver_strategy.h.
|
protected |
Physics solver for which we need a non-linear solver.
Definition at line 110 of file physics_solver_strategy.h.