WarpX
Loading...
Searching...
No Matches
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.
 
bool IsDefined () const
 Check if the nonlinear solver has been defined.
 
virtual void Solve (Vec &, const Vec &, amrex::Real, amrex::Real, int) const =0
 Solve the specified nonlinear equation for U. Picard: U = b + R(U). Newton: F(U) = U - b - R(U) = 0.
 
virtual void PrintParams () const =0
 Print parameters used by the nonlinear solver.
 
virtual void GetSolverParams (amrex::Real &, amrex::Real &, int &)=0
 Return the convergence parameters used by the nonlinear solver.
 
virtual bool UsePreconditioner ()
 Whether a preconditioner is used by the nonlinear solver.
 
virtual 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.
 

Protected Attributes

bool m_is_defined = false
 
bool m_verbose = true
 
std::string m_diagnostic_file
 
int m_diagnostic_interval = 1
 
bool m_usePC = false
 

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, 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 NewtonSolver< Vec, Ops >, and PicardSolver< 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 NewtonSolver< Vec, Ops >, and PicardSolver< Vec, Ops >.

◆ IsDefined()

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

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 NewtonSolver< Vec, Ops >, and PicardSolver< Vec, Ops >.

◆ Solve()

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

◆ UsePreconditioner()

template<class Vec, class Ops>
virtual bool NonlinearSolver< Vec, Ops >::UsePreconditioner ( )
inlinevirtual

Whether a preconditioner is used by the nonlinear solver.

◆ Verbose()

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

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_diagnostic_file

template<class Vec, class Ops>
std::string NonlinearSolver< Vec, Ops >::m_diagnostic_file
protected

◆ m_diagnostic_interval

template<class Vec, class Ops>
int NonlinearSolver< Vec, Ops >::m_diagnostic_interval = 1
protected

◆ m_is_defined

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

◆ m_usePC

template<class Vec, class Ops>
bool NonlinearSolver< Vec, Ops >::m_usePC = 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: