4#ifndef lethe_physics_solver_h
5#define lethe_physics_solver_h
15#include <deal.II/lac/affine_constraints.h>
26template <
typename VectorType>
95 nonzero_constraints.distribute(local_evaluation_point);
113 virtual AffineConstraints<double> &
143 return system_rhs.l2_norm();
179template <
typename VectorType>
182 :
pcout(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
184 switch (non_linear_solver_parameters.
solver)
186 case Parameters::NonLinearSolver::SolverType::newton:
187 physics_solving_strategy =
188 new NewtonNonLinearSolverStrategy<VectorType>(
189 this, non_linear_solver_parameters);
191 case Parameters::NonLinearSolver::SolverType::kinsol_newton:
192 physics_solving_strategy =
193 new KinsolNewtonNonLinearSolverStrategy<VectorType>(
194 this, non_linear_solver_parameters);
196 case Parameters::NonLinearSolver::SolverType::inexact_newton:
197 physics_solving_strategy =
198 new InexactNewtonNonLinearSolverStrategy<VectorType>(
199 this, non_linear_solver_parameters);
206template <
typename VectorType>
208 :
pcout(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
214template <
typename VectorType>
The linear solver strategy class is used to solve the physics as a linear problem.
Base class that works as an interface for all solver strategies (either non-linear or linear) for all...
virtual VectorType & get_present_solution()=0
Parameters::SimulationControl::TimeSteppingMethod time_stepping_method
PhysicsSolver(const Parameters::NonLinearSolver non_linear_solver_parameters)
Constructor for the non-linear physics.
virtual double get_residual_rescale_metric() const =0
Return the metric for residual rescaling. By default, should return 1. If the rescale_residual_by_vol...
PhysicsSolver()
Constructor for the linear physics. Since the Physics is linear, a LinearSolutionStrategy is automati...
virtual void solve_linear_system()=0
Solve the linear system of equations.
void solve_governing_system()
Solve the global system of equations according to a given strategy, either linear or not.
unsigned int get_current_newton_iteration() const
Return the current newton iteration of this physics solver.
virtual void setup_preconditioner()=0
Set up the preconditioner.
virtual void assemble_system_matrix()=0
Assemble the matrix.
virtual void assemble_system_rhs()=0
Assemble the right-hand side (rhs).
PhysicsSolverStrategy< VectorType > * physics_solving_strategy
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 AffineConstraints< double > & get_nonzero_constraints()=0
virtual void output_newton_update_norms()=0
Output the L2 and Linfty norms of the correction vector.
virtual VectorType & get_local_evaluation_point()=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 ~PhysicsSolver()
Destructor.
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
virtual void apply_constraints()
Applies constraints to a local_evaluation_point.
NonLinearSolver - Parameter that controls the solution of the non-linear problems.
GlobalVectorType VectorType