![]() |
OGS
|
|
Find a solution to a nonlinear equation using the Picard fixpoint iteration method.
Notation used throughout this class and its documentation: \( x_k \) is the current iterate and \( g \) is the Picard fixpoint map, i.e. \( g(x_k) \) is the solution of the linearized system \( A(x_k)\,x = b(x_k) \) (the result of one linear solve). A converged iteration is a fixpoint \( x = g(x) \), and one iteration reads \( x_{k+1} = g(x_k) \).
With an under-relaxation (damping) coefficient \( \beta \in (0, 1] \) the iteration becomes \( x_{k+1} = (1-\beta)\,x_k + \beta\,g(x_k) \); the value \( \beta = 1 \) recovers the plain Picard update above.
Definition at line 186 of file NonlinearSolver.h.
#include <NonlinearSolver.h>
Public Types | |
| using | System = NonlinearSystem<NonlinearSolverTag::Picard> |
| Type of the nonlinear equation system to be solved. | |
Public Member Functions | |
| NonlinearSolver (GlobalLinearSolver &linear_solver, const int maxiter, const double damping) | |
| ~NonlinearSolver () | |
| void | setEquationSystem (System &eq, ConvergenceCriterion &conv_crit) |
| void | calculateNonEquilibriumInitialResiduum (std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id) override |
| NonlinearSolverStatus | solve (std::vector< GlobalVector * > &x, std::vector< GlobalVector * > const &x_prev, std::function< void(int, bool, std::vector< GlobalVector * > const &)> const &postIterationCallback, int const process_id) override |
| void | compensateNonEquilibriumInitialResiduum (bool const value) |
| Public Member Functions inherited from NumLib::NonlinearSolverBase | |
| virtual | ~NonlinearSolverBase ()=default |
Private Attributes | |
| GlobalLinearSolver & | _linear_solver |
| System * | _equation_system = nullptr |
| ConvergenceCriterion * | _convergence_criterion = nullptr |
| double const | _damping |
| const int | _maxiter |
| maximum number of iterations | |
| GlobalVector * | _r_neq = nullptr |
| non-equilibrium initial residuum. | |
| std::size_t | _A_id = 0u |
| ID of the \( A \) matrix. | |
| std::size_t | _rhs_id = 0u |
| ID of the right-hand side vector. | |
| std::size_t | _x_new_id = 0u |
| std::size_t | _r_neq_id = 0u |
| bool | _compensate_non_equilibrium_initial_residuum = false |
| using NumLib::NonlinearSolver< NonlinearSolverTag::Picard >::System = NonlinearSystem<NonlinearSolverTag::Picard> |
Type of the nonlinear equation system to be solved.
Definition at line 191 of file NonlinearSolver.h.
|
inlineexplicit |
Constructs a new instance.
| linear_solver | the linear solver used by this nonlinear solver. |
| maxiter | the maximum number of iterations used to solve the equation. |
| damping | under-relaxation coefficient \( \beta \in (0, 1] \) applied to the Picard update (see class description); \( \beta = 1 \) disables damping. |
Definition at line 202 of file NonlinearSolver.h.
References _damping, _linear_solver, and _maxiter.
Referenced by ~NonlinearSolver(), calculateNonEquilibriumInitialResiduum(), and solve().
Definition at line 632 of file NonlinearSolver.cpp.
References NonlinearSolver(), _r_neq, and NumLib::GlobalVectorProvider::provider.
|
overridevirtual |
Implements NumLib::NonlinearSolverBase.
Definition at line 81 of file NonlinearSolver.cpp.
References NonlinearSolver(), _A_id, _compensate_non_equilibrium_initial_residuum, _equation_system, _r_neq, _r_neq_id, _rhs_id, MathLib::LinAlg::axpy(), MathLib::LinAlg::finalizeAssembly(), INFO(), MathLib::LinAlg::matMult(), NumLib::GlobalMatrixProvider::provider, and NumLib::GlobalVectorProvider::provider.
|
inline |
Definition at line 230 of file NonlinearSolver.h.
References _compensate_non_equilibrium_initial_residuum.
|
inline |
Set the nonlinear equation system that will be solved. TODO doc
Definition at line 212 of file NonlinearSolver.h.
References _convergence_criterion, and _equation_system.
|
overridevirtual |
Assemble and solve the equation system.
| x | in: the initial guess, out: the solution. |
| x_prev | previous time step solution. |
| postIterationCallback | called after each iteration if set. |
| process_id | usually used in staggered schemes. |
| true | if the equation system could be solved |
| false | otherwise |
Implements NumLib::NonlinearSolverBase.
Definition at line 133 of file NonlinearSolver.cpp.
References NonlinearSolver(), _A_id, _convergence_criterion, _damping, _equation_system, _linear_solver, _maxiter, _r_neq, _rhs_id, _x_new_id, MathLib::LinAlg::axpy(), MathLib::COMPLETE_MATRIX_UPDATE, MathLib::LinAlg::copy(), BaseLib::RunTime::elapsed(), ERR(), NumLib::FAILURE, INFO(), MathLib::LinAlg::matMult(), OGS_FATAL, NumLib::GlobalMatrixProvider::provider, NumLib::GlobalVectorProvider::provider, NumLib::REPEAT_ITERATION, MathLib::LinAlg::scale(), MathLib::LinAlg::setLocalAccessibleVector(), NumLib::detail::solvePicard(), BaseLib::RunTime::start(), NumLib::SUCCESS, and WARN().
|
private |
ID of the \( A \) matrix.
Definition at line 250 of file NonlinearSolver.h.
Referenced by calculateNonEquilibriumInitialResiduum(), and solve().
|
private |
Enables computation of the non-equilibrium initial residuum \( r_{\rm neq} \) before the first time step. The forces are zero if the external forces are in equilibrium with the initial state/initial conditions. During the simulation the new residuum reads \( \tilde r = r - r_{\rm neq} \).
Definition at line 259 of file NonlinearSolver.h.
Referenced by calculateNonEquilibriumInitialResiduum(), and compensateNonEquilibriumInitialResiduum().
|
private |
Definition at line 240 of file NonlinearSolver.h.
Referenced by setEquationSystem(), and solve().
|
private |
Under-relaxation (damping) coefficient beta in (0, 1] applied to the Picard update x_{k+1} = (1-beta)*x_k + beta*g(x_k); 1.0 disables damping.
Definition at line 245 of file NonlinearSolver.h.
Referenced by NonlinearSolver(), and solve().
|
private |
Definition at line 237 of file NonlinearSolver.h.
Referenced by calculateNonEquilibriumInitialResiduum(), setEquationSystem(), and solve().
|
private |
Definition at line 236 of file NonlinearSolver.h.
Referenced by NonlinearSolver(), and solve().
|
private |
maximum number of iterations
Definition at line 247 of file NonlinearSolver.h.
Referenced by NonlinearSolver(), and solve().
|
private |
non-equilibrium initial residuum.
Definition at line 249 of file NonlinearSolver.h.
Referenced by ~NonlinearSolver(), calculateNonEquilibriumInitialResiduum(), and solve().
|
private |
ID of the non-equilibrium initial residuum vector.
Definition at line 254 of file NonlinearSolver.h.
Referenced by calculateNonEquilibriumInitialResiduum().
|
private |
ID of the right-hand side vector.
Definition at line 251 of file NonlinearSolver.h.
Referenced by calculateNonEquilibriumInitialResiduum(), and solve().
|
private |
ID of the vector storing the solution of the linearized equation.
Definition at line 252 of file NonlinearSolver.h.
Referenced by solve().