![]() |
OGS
|
|
Find a solution to a nonlinear equation using the Newton-Raphson method.
Definition at line 70 of file NonlinearSolver.h.
#include <NonlinearSolver.h>
Public Types | |
| using | System = NonlinearSystem<NonlinearSolverTag::Newton> |
| Type of the nonlinear equation system to be solved. | |
Public Member Functions | |
| NonlinearSolver (GlobalLinearSolver &linear_solver, int const maxiter, std::unique_ptr< NewtonStepStrategy > newton_strategy, int const recompute_jacobian=1) | |
| ~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) |
| void | setTikhonovLambda (double const lambda, int const starting_iteration) |
| Public Member Functions inherited from NumLib::NonlinearSolverBase | |
| virtual | ~NonlinearSolverBase ()=default |
Private Attributes | |
| GlobalLinearSolver & | _linear_solver |
| System * | _equation_system = nullptr |
| int const | _maxiter |
| maximum number of iterations | |
| std::unique_ptr< NewtonStepStrategy > | _step_strategy |
| Globalization / step-acceptance strategy (e.g. fixed damping). | |
| ConvergenceCriterion * | _convergence_criterion = nullptr |
| Convergence criterion used to terminate the Newton iteration. | |
| int const | _recompute_jacobian |
| Recompute Jacobian every this many steps. | |
| GlobalVector * | _r_neq = nullptr |
| non-equilibrium initial residuum. | |
| std::size_t | _res_id = 0u |
| ID of the residual vector. | |
| std::size_t | _J_id = 0u |
| ID of the Jacobian matrix. | |
| std::size_t | _minus_delta_x_id = 0u |
| ID of the \( -\Delta x\) vector. | |
| std::size_t | _x_new_id |
| ID of the vector storing \( x - (-\Delta x) \). | |
| std::size_t | _r_neq_id = 0u |
| bool | _compensate_non_equilibrium_initial_residuum = false |
| double | _tikhonov_lambda = 0.0 |
| Tikhonov regularization parameter. | |
| int | _tikhonov_starting_iteration |
| Starting iteration for Tikhonov regularization. | |
| using NumLib::NonlinearSolver< NonlinearSolverTag::Newton >::System = NonlinearSystem<NonlinearSolverTag::Newton> |
Type of the nonlinear equation system to be solved.
Definition at line 75 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. |
| newton_strategy | globalization / step-acceptance strategy (e.g. fixed damping, line search). Ownership is transferred to the solver. |
| recompute_jacobian | recompute the Jacobian every this many steps. |
Definition at line 87 of file NonlinearSolver.h.
References _linear_solver, _maxiter, _recompute_jacobian, and _step_strategy.
Referenced by ~NonlinearSolver(), calculateNonEquilibriumInitialResiduum(), and solve().
Definition at line 640 of file NonlinearSolver.cpp.
References NonlinearSolver(), _r_neq, and NumLib::GlobalVectorProvider::provider.
|
overridevirtual |
Implements NumLib::NonlinearSolverBase.
Definition at line 349 of file NonlinearSolver.cpp.
References NonlinearSolver(), _compensate_non_equilibrium_initial_residuum, _equation_system, _r_neq, _r_neq_id, MathLib::LinAlg::finalizeAssembly(), INFO(), and NumLib::GlobalVectorProvider::provider.
|
inline |
Definition at line 125 of file NonlinearSolver.h.
References _compensate_non_equilibrium_initial_residuum.
|
inline |
Set the nonlinear equation system that will be solved and the convergence criterion used to terminate the iteration. Also forwards the criterion to the step strategy so that strategies that depend on residual or delta-x information (e.g. non-negative damping) can use it.
Definition at line 105 of file NonlinearSolver.h.
References _convergence_criterion, _equation_system, and _step_strategy.
|
inline |
Definition at line 130 of file NonlinearSolver.h.
References _tikhonov_lambda, and _tikhonov_starting_iteration.
|
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 391 of file NonlinearSolver.cpp.
References NonlinearSolver(), _convergence_criterion, _equation_system, _J_id, _linear_solver, _maxiter, _minus_delta_x_id, _r_neq, _recompute_jacobian, _res_id, _step_strategy, _tikhonov_lambda, _tikhonov_starting_iteration, _x_new_id, BaseLib::MPI::anyOf(), MathLib::LinAlg::axpy(), MathLib::LinAlg::copy(), BaseLib::RunTime::elapsed(), ERR(), NumLib::FAILURE, INFO(), NumLib::GlobalMatrixProvider::provider, NumLib::GlobalVectorProvider::provider, MathLib::RECOMPUTE_AND_STORE, NumLib::REPEAT_ITERATION, MathLib::REUSE, BaseLib::RunTime::start(), and NumLib::SUCCESS.
|
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 165 of file NonlinearSolver.h.
Referenced by calculateNonEquilibriumInitialResiduum(), and compensateNonEquilibriumInitialResiduum().
|
private |
Convergence criterion used to terminate the Newton iteration.
Definition at line 146 of file NonlinearSolver.h.
Referenced by setEquationSystem(), and solve().
|
private |
Definition at line 138 of file NonlinearSolver.h.
Referenced by calculateNonEquilibriumInitialResiduum(), setEquationSystem(), and solve().
|
private |
|
private |
Definition at line 137 of file NonlinearSolver.h.
Referenced by NonlinearSolver(), and solve().
|
private |
maximum number of iterations
Definition at line 140 of file NonlinearSolver.h.
Referenced by NonlinearSolver(), and solve().
|
private |
ID of the \( -\Delta x\) vector.
Definition at line 154 of file NonlinearSolver.h.
Referenced by solve().
|
private |
non-equilibrium initial residuum.
Definition at line 151 of file NonlinearSolver.h.
Referenced by ~NonlinearSolver(), calculateNonEquilibriumInitialResiduum(), and solve().
|
private |
ID of the non-equilibrium initial residuum vector.
Definition at line 157 of file NonlinearSolver.h.
Referenced by calculateNonEquilibriumInitialResiduum().
|
private |
Recompute Jacobian every this many steps.
Definition at line 148 of file NonlinearSolver.h.
Referenced by NonlinearSolver(), and solve().
|
private |
|
private |
Globalization / step-acceptance strategy (e.g. fixed damping).
Definition at line 143 of file NonlinearSolver.h.
Referenced by NonlinearSolver(), setEquationSystem(), and solve().
|
private |
Tikhonov regularization parameter.
Definition at line 166 of file NonlinearSolver.h.
Referenced by setTikhonovLambda(), and solve().
|
private |
Starting iteration for Tikhonov regularization.
Definition at line 167 of file NonlinearSolver.h.
Referenced by setTikhonovLambda(), and solve().
|
private |
ID of the vector storing \( x - (-\Delta x) \).
Definition at line 155 of file NonlinearSolver.h.
Referenced by solve().