|
WarpX
|
Newton method to solve nonlinear equation of form: F(U) = U - b - R(U) = 0. U is the solution vector, b is a constant, and R(U) is some nonlinear function of U, which is computed in the ComputeRHS() Ops function. More...
#include <NewtonSolver.H>
Public Member Functions | |
| NewtonSolver ()=default | |
| ~NewtonSolver () override=default | |
| NewtonSolver (const NewtonSolver &)=delete | |
| NewtonSolver & | operator= (const NewtonSolver &)=delete |
| NewtonSolver (NewtonSolver &&) noexcept=delete | |
| NewtonSolver & | operator= (NewtonSolver &&) noexcept=delete |
| void | Define (const Vec &a_U, Ops *a_ops) override |
| Read user-provided parameters that control the nonlinear solver. Allocate intermediate data containers needed by the solver. For Newton, setup the linear solver for computing the Newton step. | |
| void | Solve (Vec &a_U, const Vec &a_b, amrex::Real a_time, amrex::Real a_dt, int a_step) const override |
| Solve the specified nonlinear equation for U. Picard: U = b + R(U). Newton: F(U) = U - b - R(U) = 0. | |
| void | GetSolverParams (amrex::Real &a_rtol, amrex::Real &a_atol, int &a_maxits) override |
| Return the convergence parameters used by the nonlinear solver. | |
| void | CurTime (amrex::Real a_time) const |
| void | CurTimeStep (amrex::Real a_dt) const |
| void | PrintParams () const override |
| Print parameters used by the nonlinear solver. | |
Public Member Functions inherited from NonlinearSolver< Vec, Ops > | |
| NonlinearSolver ()=default | |
| virtual | ~NonlinearSolver ()=default |
| NonlinearSolver (const NonlinearSolver &)=delete | |
| NonlinearSolver & | operator= (const NonlinearSolver &)=delete |
| NonlinearSolver (NonlinearSolver &&) noexcept=delete | |
| NonlinearSolver & | operator= (NonlinearSolver &&) noexcept=delete |
| bool | IsDefined () const |
| Check if the nonlinear solver has been defined. | |
| virtual bool | UsePreconditioner () |
| Whether a preconditioner is used by the nonlinear solver. | |
| void | Verbose (bool a_verbose) |
| Allow caller to dynamically change the verbosity flag. For example, one may want to only print solver information every 100 steps. | |
Private Member Functions | |
| void | ParseParameters () |
| void | EvalResidual (Vec &a_F, const Vec &a_U, const Vec &a_b, amrex::Real a_time, int a_iter) const |
| Compute the nonlinear residual: F(U) = U - b - R(U). | |
Private Attributes | |
| Vec | m_dU |
| Intermediate Vec containers used by the solver. | |
| Vec | m_F |
| Vec | m_R |
| Ops * | m_ops = nullptr |
| Pointer to Ops class. | |
| bool | m_require_convergence = true |
| Flag to determine whether convergence is required. | |
| amrex::Real | m_rtol = 1.0e-6 |
| Relative tolerance for the Newton solver. | |
| amrex::Real | m_atol = 0. |
| Absolute tolerance for the Newton solver. | |
| int | m_maxits = 100 |
| Maximum iterations for the Newton solver. | |
| int | m_total_iters = 0 |
| Total nonlinear iterations for the diagnostic file. | |
| amrex::Real | m_linsol_rtol = 1.0e-4 |
| Relative tolerance for linear solver. | |
| amrex::Real | m_linsol_atol = 0. |
| Absolute tolerance for linear solver. | |
| int | m_linsol_maxits = 1000 |
| Maximum iterations for linear solver. | |
| int | m_total_linsol_iters = 0 |
| Total linear iterations for the diagnostic file. | |
| int | m_linsol_verbose_int = 2 |
| Verbosity flag for linear solver. | |
| int | m_linsol_restart_length = 30 |
| Restart iteration for linear solver. | |
| PreconditionerType | m_pc_type = PreconditionerType::none |
| Preconditioner type. | |
| amrex::Real | m_cur_time |
| amrex::Real | m_dt |
| std::unique_ptr< JacobianFunctionMF< Vec, Ops > > | m_linear_function |
| The linear function used by linear solver to compute A*v. In the contect of JFNK, A = dF/dU (i.e., system Jacobian) | |
| LinearSolverType | m_linear_solver_type = LinearSolverType::amrex_gmres |
| Choice of linear solver. | |
| std::unique_ptr< LinearSolver< Vec, JacobianFunctionMF< Vec, Ops > > > | m_linear_solver |
| The linear solver object. | |
Additional Inherited Members | |
Protected Attributes inherited from NonlinearSolver< Vec, Ops > | |
| bool | m_is_defined = false |
| bool | m_verbose = true |
| std::string | m_diagnostic_file |
| int | m_diagnostic_interval = 1 |
| bool | m_usePC = false |
Newton method to solve nonlinear equation of form: F(U) = U - b - R(U) = 0. U is the solution vector, b is a constant, and R(U) is some nonlinear function of U, which is computed in the ComputeRHS() Ops function.
|
default |
|
overridedefault |
|
delete |
|
deletenoexcept |
|
inline |
|
inline |
|
overridevirtual |
Read user-provided parameters that control the nonlinear solver. Allocate intermediate data containers needed by the solver. For Newton, setup the linear solver for computing the Newton step.
Implements NonlinearSolver< Vec, Ops >.
|
private |
Compute the nonlinear residual: F(U) = U - b - R(U).
|
inlineoverridevirtual |
Return the convergence parameters used by the nonlinear solver.
Implements NonlinearSolver< Vec, Ops >.
|
delete |
|
deletenoexcept |
|
private |
|
inlineoverridevirtual |
Print parameters used by the nonlinear solver.
Implements NonlinearSolver< Vec, Ops >.
|
overridevirtual |
Solve the specified nonlinear equation for U. Picard: U = b + R(U). Newton: F(U) = U - b - R(U) = 0.
Implements NonlinearSolver< Vec, Ops >.
|
private |
Absolute tolerance for the Newton solver.
|
mutableprivate |
|
private |
|
mutableprivate |
Intermediate Vec containers used by the solver.
|
private |
|
private |
The linear function used by linear solver to compute A*v. In the contect of JFNK, A = dF/dU (i.e., system Jacobian)
|
private |
The linear solver object.
|
private |
Choice of linear solver.
|
private |
Absolute tolerance for linear solver.
|
private |
Maximum iterations for linear solver.
|
private |
Restart iteration for linear solver.
|
private |
Relative tolerance for linear solver.
|
private |
Verbosity flag for linear solver.
|
private |
Maximum iterations for the Newton solver.
|
private |
Pointer to Ops class.
|
private |
Preconditioner type.
|
private |
|
private |
Flag to determine whether convergence is required.
|
private |
Relative tolerance for the Newton solver.
|
mutableprivate |
Total nonlinear iterations for the diagnostic file.
|
mutableprivate |
Total linear iterations for the diagnostic file.