WarpX
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PicardSolver< Vec, Ops > Class Template Reference

Picard fixed-point iteration method to solve nonlinear equation of form: U = b + R(U). U is the solution vector. b is a constant. R(U) is some nonlinear function of U, which is computed in the Ops function ComputeRHS(). More...

#include <PicardSolver.H>

Inheritance diagram for PicardSolver< Vec, Ops >:
NonlinearSolver< Vec, Ops >

Public Member Functions

 PicardSolver ()=default
 
 ~PicardSolver () override=default
 
 PicardSolver (const PicardSolver &)=delete
 
PicardSolveroperator= (const PicardSolver &)=delete
 
 PicardSolver (PicardSolver &&) noexcept=delete
 
PicardSolveroperator= (PicardSolver &&) 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. More...
 
void Solve (Vec &a_U, const Vec &a_b, amrex::Real a_time, amrex::Real a_dt) const override
 Solve the specified nonlinear equation for U. Picard: U = b + R(U). Newton: F(U) = U - b - R(U) = 0. More...
 
void GetSolverParams (amrex::Real &a_rtol, amrex::Real &a_atol, int &a_maxits) override
 Return the convergence parameters used by the nonlinear solver. More...
 
void PrintParams () const override
 Print parameters used by the nonlinear solver. More...
 
- Public Member Functions inherited from NonlinearSolver< Vec, Ops >
 NonlinearSolver ()=default
 
virtual ~NonlinearSolver ()=default
 
 NonlinearSolver (const NonlinearSolver &)=delete
 
NonlinearSolveroperator= (const NonlinearSolver &)=delete
 
 NonlinearSolver (NonlinearSolver &&) noexcept=delete
 
NonlinearSolveroperator= (NonlinearSolver &&) noexcept=delete
 
bool IsDefined () const
 Check if the nonlinear solver has been defined. More...
 
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. More...
 

Private Member Functions

void ParseParameters ()
 

Private Attributes

Vec m_Usave
 Intermediate Vec containers used by the solver. More...
 
Vec m_R
 
Ops * m_ops = nullptr
 Pointer to Ops class. More...
 
bool m_require_convergence = true
 Flag to determine whether convergence is required. More...
 
amrex::Real m_rtol = 1.0e-6
 Relative tolerance for the Picard nonlinear solver. More...
 
amrex::Real m_atol = 0.
 Absolute tolerance for the Picard nonlinear solver. More...
 
int m_maxits = 100
 Maximum iterations for the Picard nonlinear solver. More...
 

Additional Inherited Members

- Protected Attributes inherited from NonlinearSolver< Vec, Ops >
bool m_is_defined = false
 
bool m_verbose = true
 

Detailed Description

template<class Vec, class Ops>
class PicardSolver< Vec, Ops >

Picard fixed-point iteration method to solve nonlinear equation of form: U = b + R(U). U is the solution vector. b is a constant. R(U) is some nonlinear function of U, which is computed in the Ops function ComputeRHS().

Constructor & Destructor Documentation

◆ PicardSolver() [1/3]

template<class Vec , class Ops >
PicardSolver< Vec, Ops >::PicardSolver ( )
default

◆ ~PicardSolver()

template<class Vec , class Ops >
PicardSolver< Vec, Ops >::~PicardSolver ( )
overridedefault

◆ PicardSolver() [2/3]

template<class Vec , class Ops >
PicardSolver< Vec, Ops >::PicardSolver ( const PicardSolver< Vec, Ops > &  )
delete

◆ PicardSolver() [3/3]

template<class Vec , class Ops >
PicardSolver< Vec, Ops >::PicardSolver ( PicardSolver< Vec, Ops > &&  )
deletenoexcept

Member Function Documentation

◆ Define()

template<class Vec , class Ops >
void PicardSolver< Vec, Ops >::Define ( const Vec &  ,
Ops *   
)
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 >.

◆ GetSolverParams()

template<class Vec , class Ops >
void PicardSolver< Vec, Ops >::GetSolverParams ( amrex::Real &  ,
amrex::Real &  ,
int  
)
inlineoverridevirtual

Return the convergence parameters used by the nonlinear solver.

Implements NonlinearSolver< Vec, Ops >.

◆ operator=() [1/2]

template<class Vec , class Ops >
PicardSolver& PicardSolver< Vec, Ops >::operator= ( const PicardSolver< Vec, Ops > &  )
delete

◆ operator=() [2/2]

template<class Vec , class Ops >
PicardSolver& PicardSolver< Vec, Ops >::operator= ( PicardSolver< Vec, Ops > &&  )
deletenoexcept

◆ ParseParameters()

template<class Vec , class Ops >
void PicardSolver< Vec, Ops >::ParseParameters
private

◆ PrintParams()

template<class Vec , class Ops >
void PicardSolver< Vec, Ops >::PrintParams ( ) const
inlineoverridevirtual

Print parameters used by the nonlinear solver.

Implements NonlinearSolver< Vec, Ops >.

◆ Solve()

template<class Vec , class Ops >
void PicardSolver< Vec, Ops >::Solve ( Vec &  ,
const Vec &  ,
amrex::Real  ,
amrex::Real   
) const
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 >.

Member Data Documentation

◆ m_atol

template<class Vec , class Ops >
amrex::Real PicardSolver< Vec, Ops >::m_atol = 0.
private

Absolute tolerance for the Picard nonlinear solver.

◆ m_maxits

template<class Vec , class Ops >
int PicardSolver< Vec, Ops >::m_maxits = 100
private

Maximum iterations for the Picard nonlinear solver.

◆ m_ops

template<class Vec , class Ops >
Ops* PicardSolver< Vec, Ops >::m_ops = nullptr
private

Pointer to Ops class.

◆ m_R

template<class Vec , class Ops >
Vec PicardSolver< Vec, Ops >::m_R
private

◆ m_require_convergence

template<class Vec , class Ops >
bool PicardSolver< Vec, Ops >::m_require_convergence = true
private

Flag to determine whether convergence is required.

◆ m_rtol

template<class Vec , class Ops >
amrex::Real PicardSolver< Vec, Ops >::m_rtol = 1.0e-6
private

Relative tolerance for the Picard nonlinear solver.

◆ m_Usave

template<class Vec , class Ops >
Vec PicardSolver< Vec, Ops >::m_Usave
mutableprivate

Intermediate Vec containers used by the solver.


The documentation for this class was generated from the following file: