WarpX
Public Member Functions | Protected Attributes | List of all members
NonlinearSolver< Vec, Ops > Class Template Referenceabstract

Top-level class for the nonlinear solver. More...

#include <NonlinearSolver.H>

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

Public Member Functions

 NonlinearSolver ()=default
 
virtual ~NonlinearSolver ()=default
 
 NonlinearSolver (const NonlinearSolver &)=delete
 
NonlinearSolveroperator= (const NonlinearSolver &)=delete
 
 NonlinearSolver (NonlinearSolver &&) noexcept=delete
 
NonlinearSolveroperator= (NonlinearSolver &&) noexcept=delete
 
virtual void Define (const Vec &, Ops *)=0
 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...
 
bool IsDefined () const
 Check if the nonlinear solver has been defined. More...
 
virtual void Solve (Vec &, const Vec &, amrex::Real, amrex::Real) const =0
 Solve the specified nonlinear equation for U. Picard: U = b + R(U). Newton: F(U) = U - b - R(U) = 0. More...
 
virtual void PrintParams () const =0
 Print parameters used by the nonlinear solver. More...
 
virtual void GetSolverParams (amrex::Real &, amrex::Real &, int &)=0
 Return the convergence parameters used by the nonlinear solver. 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...
 

Protected Attributes

bool m_is_defined = false
 
bool m_verbose = true
 

Detailed Description

template<class Vec, class Ops>
class NonlinearSolver< Vec, Ops >

Top-level class for the nonlinear solver.

This class is templated on a vector class Vec, and an operator class Ops.

The Ops class must have the following function: ComputeRHS( R_vec, U_vec, time, dt, nl_iter, from_jacobian ), where U_vec and R_vec are of type Vec.

The Vec class must have basic math operators, such as Copy, +=, -=, increment(), linComb(), scale(), etc.. See WarpXSolverVec.H for an example.

Constructor & Destructor Documentation

◆ NonlinearSolver() [1/3]

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

◆ ~NonlinearSolver()

template<class Vec , class Ops >
virtual NonlinearSolver< Vec, Ops >::~NonlinearSolver ( )
virtualdefault

◆ NonlinearSolver() [2/3]

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

◆ NonlinearSolver() [3/3]

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

Member Function Documentation

◆ Define()

template<class Vec , class Ops >
virtual void NonlinearSolver< Vec, Ops >::Define ( const Vec &  ,
Ops *   
)
pure virtual

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.

Implemented in PicardSolver< Vec, Ops >, and NewtonSolver< Vec, Ops >.

◆ GetSolverParams()

template<class Vec , class Ops >
virtual void NonlinearSolver< Vec, Ops >::GetSolverParams ( amrex::Real &  ,
amrex::Real &  ,
int  
)
pure virtual

Return the convergence parameters used by the nonlinear solver.

Implemented in PicardSolver< Vec, Ops >, and NewtonSolver< Vec, Ops >.

◆ IsDefined()

template<class Vec , class Ops >
bool NonlinearSolver< Vec, Ops >::IsDefined ( ) const
inline

Check if the nonlinear solver has been defined.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ PrintParams()

template<class Vec , class Ops >
virtual void NonlinearSolver< Vec, Ops >::PrintParams ( ) const
pure virtual

Print parameters used by the nonlinear solver.

Implemented in PicardSolver< Vec, Ops >, and NewtonSolver< Vec, Ops >.

◆ Solve()

template<class Vec , class Ops >
virtual void NonlinearSolver< Vec, Ops >::Solve ( Vec &  ,
const Vec &  ,
amrex::Real  ,
amrex::Real   
) const
pure virtual

Solve the specified nonlinear equation for U. Picard: U = b + R(U). Newton: F(U) = U - b - R(U) = 0.

Implemented in PicardSolver< Vec, Ops >, and NewtonSolver< Vec, Ops >.

◆ Verbose()

template<class Vec , class Ops >
void NonlinearSolver< Vec, Ops >::Verbose ( bool  a_verbose)
inline

Allow caller to dynamically change the verbosity flag. For example, one may want to only print solver information every 100 steps.

Member Data Documentation

◆ m_is_defined

template<class Vec , class Ops >
bool NonlinearSolver< Vec, Ops >::m_is_defined = false
protected

◆ m_verbose

template<class Vec , class Ops >
bool NonlinearSolver< Vec, Ops >::m_verbose = true
mutableprotected

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