WarpX
Loading...
Searching...
No Matches
JacobianFunctionMF< T, Ops > Class Template Reference

This is a linear function class for computing the action of a Jacobian on a vector using a matrix-free finite-difference method. This class has all of the required functions to be used as the linear operator template parameter in AMReX_GMRES. More...

#include <JacobianFunctionMF.H>

Inheritance diagram for JacobianFunctionMF< T, Ops >:
LinearFunction< T, Ops >

Public Types

using RT = typename T::value_type
Public Types inherited from LinearFunction< T, Ops >
using RT = typename T::value_type

Public Member Functions

 JacobianFunctionMF ()=default
 ~JacobianFunctionMF () override=default
 JacobianFunctionMF (const JacobianFunctionMF &)=default
JacobianFunctionMFoperator= (const JacobianFunctionMF &)=default
 JacobianFunctionMF (JacobianFunctionMF &&) noexcept=default
JacobianFunctionMFoperator= (JacobianFunctionMF &&) noexcept=default
void apply (T &a_dF, const T &a_dU) override
 apply the linear function on a given vector of type T
void precond (T &a_U, const T &a_X) override
 apply the preconditioner on a given vector of type T
void updatePreCondMat (const T &a_X) override
 update preconditioner
void getPCMatrix (amrex::Gpu::DeviceVector< int > &a_ridx_g, amrex::Gpu::DeviceVector< int > &a_nnz, amrex::Gpu::DeviceVector< int > &a_cidx_g, amrex::Gpu::DeviceVector< RT > &a_aij, int &a_n, int &a_ncols_max) override
 get sparse matrix representation of preconditioner
makeVecLHS () const override
 make LHS vector
makeVecRHS () const override
 make RHS vector
bool isDefined () const
bool usePreconditioner () const
void setBaseSolution (const T &a_U)
void setBaseRHS (const T &a_R)
void setJFNKEps (RT a_eps)
void setIsLinear (bool a_isLinear)
void curTime (RT a_time)
void curTimeStep (RT a_dt)
void printParams () const
void define (const T &, Ops *, const PreconditionerType &) override
 define the linear function object
PreconditionerType pcType () const override
 returns the preconditioner type
Public Member Functions inherited from LinearFunction< T, Ops >
 LinearFunction ()=default
 default constructor
virtual ~LinearFunction ()=default
 default destructore
 LinearFunction (const LinearFunction &)=default
LinearFunctionoperator= (const LinearFunction &)=default
 LinearFunction (LinearFunction &&) noexcept=default
LinearFunctionoperator= (LinearFunction &&) noexcept=default
void create (T &a_Z, const T &a_U)
 create a new vector given a defined vector
void assign (T &a_Z, const T &a_U)
 vector copy operation
void increment (T &a_Z, const T &a_U, RT a_scale)
 vector scaled-increment operation
void scale (T &a_U, RT a_scale)
 vector scaled operation
void linComb (T &a_U, RT a, const T &X, RT b, const T &Y)
 compute linear combination
void setToZero (T &a_U)
 set vector to zero
void setVal (T &a_U, RT a_val)
 set vector to a scalar value
RT dotProduct (const T &a_X, const T &a_Y)
 compute dot product of two vectors
RT norm2 (const T &a_U)
 compute 2-norm of a vector

Private Attributes

bool m_is_defined = false
bool m_is_linear = false
bool m_usePreCond = false
RT m_epsJFNK = RT(1.0e-6)
RT m_normY0
RT m_cur_time
RT m_dt
PreconditionerType m_pc_type = PreconditionerType::none
m_Z
m_Y0
m_R0
m_R
Ops * m_ops = nullptr
std::unique_ptr< Preconditioner< T, Ops > > m_preCond = nullptr

Detailed Description

template<class T, class Ops>
class JacobianFunctionMF< T, Ops >

This is a linear function class for computing the action of a Jacobian on a vector using a matrix-free finite-difference method. This class has all of the required functions to be used as the linear operator template parameter in AMReX_GMRES.

Member Typedef Documentation

◆ RT

template<class T, class Ops>
using JacobianFunctionMF< T, Ops >::RT = typename T::value_type

Constructor & Destructor Documentation

◆ JacobianFunctionMF() [1/3]

template<class T, class Ops>
JacobianFunctionMF< T, Ops >::JacobianFunctionMF ( )
default

◆ ~JacobianFunctionMF()

template<class T, class Ops>
JacobianFunctionMF< T, Ops >::~JacobianFunctionMF ( )
overridedefault

◆ JacobianFunctionMF() [2/3]

template<class T, class Ops>
JacobianFunctionMF< T, Ops >::JacobianFunctionMF ( const JacobianFunctionMF< T, Ops > & )
default

◆ JacobianFunctionMF() [3/3]

template<class T, class Ops>
JacobianFunctionMF< T, Ops >::JacobianFunctionMF ( JacobianFunctionMF< T, Ops > && )
defaultnoexcept

Member Function Documentation

◆ apply()

template<class T, class Ops>
void JacobianFunctionMF< T, Ops >::apply ( T & a_dF,
const T & a_dU )
overridevirtual

apply the linear function on a given vector of type T

Implements LinearFunction< T, Ops >.

◆ curTime()

template<class T, class Ops>
void JacobianFunctionMF< T, Ops >::curTime ( RT a_time)
inline

◆ curTimeStep()

template<class T, class Ops>
void JacobianFunctionMF< T, Ops >::curTimeStep ( RT a_dt)
inline

◆ define()

template<class T, class Ops>
void JacobianFunctionMF< T, Ops >::define ( const T & ,
Ops * ,
const PreconditionerType &  )
overridevirtual

define the linear function object

Implements LinearFunction< T, Ops >.

◆ getPCMatrix()

template<class T, class Ops>
void JacobianFunctionMF< T, Ops >::getPCMatrix ( amrex::Gpu::DeviceVector< int > & a_ridx_g,
amrex::Gpu::DeviceVector< int > & a_nnz,
amrex::Gpu::DeviceVector< int > & a_cidx_g,
amrex::Gpu::DeviceVector< RT > & a_aij,
int & a_n,
int & a_ncols_max )
inlineoverridevirtual

get sparse matrix representation of preconditioner

Implements LinearFunction< T, Ops >.

◆ isDefined()

template<class T, class Ops>
bool JacobianFunctionMF< T, Ops >::isDefined ( ) const
inlinenodiscard

◆ makeVecLHS()

template<class T, class Ops>
auto JacobianFunctionMF< T, Ops >::makeVecLHS ( ) const
overridevirtual

make LHS vector

Implements LinearFunction< T, Ops >.

◆ makeVecRHS()

template<class T, class Ops>
auto JacobianFunctionMF< T, Ops >::makeVecRHS ( ) const
overridevirtual

make RHS vector

Implements LinearFunction< T, Ops >.

◆ operator=() [1/2]

template<class T, class Ops>
JacobianFunctionMF & JacobianFunctionMF< T, Ops >::operator= ( const JacobianFunctionMF< T, Ops > & )
default

◆ operator=() [2/2]

template<class T, class Ops>
JacobianFunctionMF & JacobianFunctionMF< T, Ops >::operator= ( JacobianFunctionMF< T, Ops > && )
defaultnoexcept

◆ pcType()

template<class T, class Ops>
PreconditionerType JacobianFunctionMF< T, Ops >::pcType ( ) const
inlinenodiscardoverridevirtual

returns the preconditioner type

Implements LinearFunction< T, Ops >.

◆ precond()

template<class T, class Ops>
void JacobianFunctionMF< T, Ops >::precond ( T & a_U,
const T & a_X )
inlineoverridevirtual

apply the preconditioner on a given vector of type T

Implements LinearFunction< T, Ops >.

◆ printParams()

template<class T, class Ops>
void JacobianFunctionMF< T, Ops >::printParams ( ) const
inline

◆ setBaseRHS()

template<class T, class Ops>
void JacobianFunctionMF< T, Ops >::setBaseRHS ( const T & a_R)
inline

◆ setBaseSolution()

template<class T, class Ops>
void JacobianFunctionMF< T, Ops >::setBaseSolution ( const T & a_U)
inline

◆ setIsLinear()

template<class T, class Ops>
void JacobianFunctionMF< T, Ops >::setIsLinear ( bool a_isLinear)
inline

◆ setJFNKEps()

template<class T, class Ops>
void JacobianFunctionMF< T, Ops >::setJFNKEps ( RT a_eps)
inline

◆ updatePreCondMat()

template<class T, class Ops>
void JacobianFunctionMF< T, Ops >::updatePreCondMat ( const T & a_X)
inlineoverridevirtual

update preconditioner

Implements LinearFunction< T, Ops >.

◆ usePreconditioner()

template<class T, class Ops>
bool JacobianFunctionMF< T, Ops >::usePreconditioner ( ) const
inlinenodiscard

Member Data Documentation

◆ m_cur_time

template<class T, class Ops>
RT JacobianFunctionMF< T, Ops >::m_cur_time
private

◆ m_dt

template<class T, class Ops>
RT JacobianFunctionMF< T, Ops >::m_dt
private

◆ m_epsJFNK

template<class T, class Ops>
RT JacobianFunctionMF< T, Ops >::m_epsJFNK = RT(1.0e-6)
private

◆ m_is_defined

template<class T, class Ops>
bool JacobianFunctionMF< T, Ops >::m_is_defined = false
private

◆ m_is_linear

template<class T, class Ops>
bool JacobianFunctionMF< T, Ops >::m_is_linear = false
private

◆ m_normY0

template<class T, class Ops>
RT JacobianFunctionMF< T, Ops >::m_normY0
private

◆ m_ops

template<class T, class Ops>
Ops* JacobianFunctionMF< T, Ops >::m_ops = nullptr
private

◆ m_pc_type

template<class T, class Ops>
PreconditionerType JacobianFunctionMF< T, Ops >::m_pc_type = PreconditionerType::none
private

◆ m_preCond

template<class T, class Ops>
std::unique_ptr<Preconditioner<T,Ops> > JacobianFunctionMF< T, Ops >::m_preCond = nullptr
private

◆ m_R

template<class T, class Ops>
T JacobianFunctionMF< T, Ops >::m_R
private

◆ m_R0

template<class T, class Ops>
T JacobianFunctionMF< T, Ops >::m_R0
private

◆ m_usePreCond

template<class T, class Ops>
bool JacobianFunctionMF< T, Ops >::m_usePreCond = false
private

◆ m_Y0

template<class T, class Ops>
T JacobianFunctionMF< T, Ops >::m_Y0
private

◆ m_Z

template<class T, class Ops>
T JacobianFunctionMF< T, Ops >::m_Z
private

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