OGS
|
Definition at line 24 of file PETScNonlinearSolver.h.
#include <PETScNonlinearSolver.h>
Public Types | |
using | System = NonlinearSystem<NonlinearSolverTag::Newton> |
Type of the nonlinear equation system to be solved. | |
Public Member Functions | |
PETScNonlinearSolver (GlobalLinearSolver &linear_solver, int maxiter, std::string prefix) | |
void | setEquationSystem (System &eq, ConvergenceCriterion &conv_crit) |
Set the nonlinear equation system that will be solved. | |
void | compensateNonEquilibriumInitialResiduum (bool const value) |
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, std::vector< GlobalVector * > const &)> const &postIterationCallback, int const process_id) override |
Public Member Functions inherited from NumLib::NonlinearSolverBase | |
virtual | ~NonlinearSolverBase ()=default |
Private Attributes | |
SNES | _snes_solver |
System * | _equation_system = nullptr |
ConvergenceCriterion * | _convergence_criterion = nullptr |
std::size_t | _residual_id = 0u |
ID of the residual vector. | |
std::size_t | _jacobian_id = 0u |
ID of the Jacobian matrix. | |
std::size_t | _petsc_x_id = 0u |
std::size_t | _petsc_jacobian_id = 0u |
std::size_t | _petsc_residual_id = 0u |
bool | _compensate_non_equilibrium_initial_residuum = false |
Type of the nonlinear equation system to be solved.
Definition at line 28 of file PETScNonlinearSolver.h.
NumLib::PETScNonlinearSolver::PETScNonlinearSolver | ( | GlobalLinearSolver & | linear_solver, |
int | maxiter, | ||
std::string | prefix ) |
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. |
prefix | used to set the SNES options. |
Definition at line 95 of file PETScNonlinearSolver.cpp.
References _snes_solver.
|
overridevirtual |
Implements NumLib::NonlinearSolverBase.
Definition at line 134 of file PETScNonlinearSolver.cpp.
References _compensate_non_equilibrium_initial_residuum, and OGS_FATAL.
void NumLib::PETScNonlinearSolver::compensateNonEquilibriumInitialResiduum | ( | bool const | value | ) |
Definition at line 128 of file PETScNonlinearSolver.cpp.
References _compensate_non_equilibrium_initial_residuum.
void NumLib::PETScNonlinearSolver::setEquationSystem | ( | System & | eq, |
ConvergenceCriterion & | conv_crit ) |
Set the nonlinear equation system that will be solved.
Definition at line 121 of file PETScNonlinearSolver.cpp.
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 148 of file PETScNonlinearSolver.cpp.
References _equation_system, _jacobian_id, _petsc_jacobian_id, _petsc_residual_id, _petsc_x_id, _residual_id, _snes_solver, MathLib::LinAlg::copy(), DBUG(), BaseLib::RunTime::elapsed(), MathLib::finalizeVectorAssembly(), NumLib::FirstOrderImplicitQuasilinear, NumLib::MatrixProvider::getMatrix(), NumLib::VectorProvider::getVector(), INFO(), NumLib::Newton, NumLib::GlobalMatrixProvider::provider, NumLib::GlobalVectorProvider::provider, NumLib::MatrixProvider::releaseMatrix(), NumLib::VectorProvider::releaseVector(), and BaseLib::RunTime::start().
|
private |
Definition at line 73 of file PETScNonlinearSolver.h.
Referenced by calculateNonEquilibriumInitialResiduum(), and compensateNonEquilibriumInitialResiduum().
|
private |
Definition at line 62 of file PETScNonlinearSolver.h.
Referenced by setEquationSystem().
|
private |
Definition at line 61 of file PETScNonlinearSolver.h.
Referenced by setEquationSystem(), and solve().
|
private |
ID of the Jacobian matrix.
Definition at line 65 of file PETScNonlinearSolver.h.
Referenced by solve().
|
private |
Definition at line 68 of file PETScNonlinearSolver.h.
Referenced by solve().
|
private |
Definition at line 69 of file PETScNonlinearSolver.h.
Referenced by solve().
|
private |
Definition at line 67 of file PETScNonlinearSolver.h.
Referenced by solve().
|
private |
ID of the residual vector.
Definition at line 64 of file PETScNonlinearSolver.h.
Referenced by solve().
|
private |
Definition at line 59 of file PETScNonlinearSolver.h.
Referenced by PETScNonlinearSolver(), and solve().