4#ifndef lethe_physics_solver_strategy_h
5#define lethe_physics_solver_strategy_h
9#include <deal.II/base/exceptions.h>
11template <
typename VectorType>
18template <
typename VectorType>
100 const bool rhs_was_assembled_this_iteration,
101 const double rescale_metric,
125template <
typename VectorType>
134template <
typename VectorType>
140template <
typename VectorType>
144 const bool rhs_was_assembled_this_iteration,
145 const double rescale_metric,
155 if (!rhs_was_assembled_this_iteration)
158 const double assembled_res =
160 if (assembled_res > this->
params.tolerance)
164 this->
params.force_rhs_calculation || this->outer_iteration == 0,
166 "Skipping the linear solve based on the assembled RHS residual requires "
167 "either Newton iteration 0, where the RHS is always freshly assembled, "
168 "or 'force rhs calculation = true' on later Newton iterations."));
170 current_res = assembled_res;
174 last_res = current_res;
unsigned int outer_iteration
Number of current Newton iteration.
PhysicsSolver< GlobalVectorType > * physics_solver
unsigned int get_current_newton_iteration() const
Get the current newton iteration.
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)
Skip the inner linear solve when the current Newton evaluation already produced a freshly assembled R...
PhysicsSolverStrategy(PhysicsSolver< VectorType > *physics_solver, const Parameters::NonLinearSolver ¶ms)
Constructor for the non-linear solver strategies.
virtual ~PhysicsSolverStrategy()=default
Destructor.
Parameters::NonLinearSolver params
virtual void solve()=0
Solve the system of equations.
Contain all the common elements of a physics solver. It creates the non-linear solver as specified by...
virtual VectorType & get_present_solution()=0
virtual double get_current_residual()
Default way to evaluate the residual for the nonlinear solver, which is simply the norm of the RHS ve...
virtual VectorType & get_system_rhs()=0
virtual bool allow_skip_linear_solve_when_residual_is_below_tolerance() const
Return whether this solver may skip the inner linear solve when the freshly assembled residual is alr...
virtual VectorType & get_evaluation_point()=0
Getter methods that give access to the private attributes of the physics being solved....
virtual VectorType & get_newton_update()=0
NonLinearSolver - Parameter that controls the solution of the non-linear problems.