WarpX
Loading...
Searching...
No Matches
WarpXSolverVec Class Reference

This is a wrapper class around a Vector of pointers to MultiFabs that contains basic math operators and functionality needed to interact with nonlinear solvers in WarpX and linear solvers in AMReX, such as GMRES. The size of the Vector is the number of amr levels. Hardcoded for 1 right now. More...

#include <WarpXSolverVec.H>

Public Types

using value_type = amrex::Real
 
using RT = value_type
 

Public Member Functions

 WarpXSolverVec ()=default
 
 WarpXSolverVec (const WarpXSolverVec &)=delete
 
 ~WarpXSolverVec ()
 
bool IsDefined () const
 
void Define (WarpX *a_WarpX, const std::string &a_vector_type_name, const std::string &a_scalar_type_name="none")
 
void Define (const WarpXSolverVec &a_solver_vec)
 
RT dotProduct (const WarpXSolverVec &a_X) const
 
void Copy (FieldType a_array_type, FieldType a_scalar_type=FieldType::None, bool allow_type_mismatch=false)
 
void Copy (const WarpXSolverVec &a_solver_vec)
 
WarpXSolverVecoperator= (const WarpXSolverVec &a_solver_vec)=delete
 
 WarpXSolverVec (WarpXSolverVec &&) noexcept=default
 
WarpXSolverVecoperator= (WarpXSolverVec &&a_solver_vec) noexcept
 
void operator+= (const WarpXSolverVec &a_solver_vec)
 
void operator-= (const WarpXSolverVec &a_solver_vec)
 
void linComb (const RT a, const WarpXSolverVec &X, const RT b, const WarpXSolverVec &Y)
 Y = a*X + b*Y.
 
void increment (const WarpXSolverVec &X, const RT a)
 Increment Y by a*X (Y += a*X)
 
void scale (RT a_a)
 Scale Y by a (Y *= a)
 
void zero ()
 
void setVal (const RT a_val)
 
void assertIsDefined (const WarpXSolverVec &a_solver_vec) const
 
void assertSameType (const WarpXSolverVec &a_solver_vec) const
 
RT norm2 () const
 
const ablastr::fields::MultiLevelVectorFieldgetArrayVec () const
 
ablastr::fields::MultiLevelVectorFieldgetArrayVec ()
 
const ablastr::fields::MultiLevelScalarFieldgetScalarVec () const
 
ablastr::fields::MultiLevelScalarFieldgetScalarVec ()
 
warpx::fields::FieldType getArrayVecType () const
 
warpx::fields::FieldType getScalarVecType () const
 
std::string getVectorType () const
 
std::string getScalarType () const
 
amrex::Long nDOF_local () const
 
amrex::Long nDOF_global () const
 
void copyFrom (const amrex::Real *const)
 
void copyTo (amrex::Real *const) const
 
auto getWarpX () const
 
auto numAMRLevels () const
 
const auto & getDOFsObject () const
 

Private Attributes

bool m_is_defined = false
 
ablastr::fields::MultiLevelVectorField m_array_vec
 
ablastr::fields::MultiLevelScalarField m_scalar_vec
 
warpx::fields::FieldType m_array_type = warpx::fields::FieldType::None
 
warpx::fields::FieldType m_scalar_type = warpx::fields::FieldType::None
 
std::string m_vector_type_name = "none"
 
std::string m_scalar_type_name = "none"
 
int m_num_amr_levels = 1
 

Static Private Attributes

static constexpr int m_ncomp = 1
 
static bool m_warpx_ptr_defined = false
 
static WarpXm_WarpX = nullptr
 
static std::unique_ptr< WarpXSolverDOFm_dofs = nullptr
 

Detailed Description

This is a wrapper class around a Vector of pointers to MultiFabs that contains basic math operators and functionality needed to interact with nonlinear solvers in WarpX and linear solvers in AMReX, such as GMRES. The size of the Vector is the number of amr levels. Hardcoded for 1 right now.

A WarpXSolverVec can consist of an array size 3 of MultiFabs (for vector fields such as E, B, and A) or of a single MultiFab for scalar fields. Both the array size 3 and scalar fields must be of type warpx::fields::FieldType. Additionally, a WarpXSolverVec can in general contain both an array size 3 field and a scalar field. For example, the array size 3 field can be used for the vector potential A and the scalar field can be used for the scalar potential phi, which is the full state of unknowns for a Darwin electromagnetic model.

Member Typedef Documentation

◆ RT

◆ value_type

using WarpXSolverVec::value_type = amrex::Real

Constructor & Destructor Documentation

◆ WarpXSolverVec() [1/3]

WarpXSolverVec::WarpXSolverVec ( )
default

◆ WarpXSolverVec() [2/3]

WarpXSolverVec::WarpXSolverVec ( const WarpXSolverVec & )
delete

◆ ~WarpXSolverVec()

WarpXSolverVec::~WarpXSolverVec ( )

◆ WarpXSolverVec() [3/3]

WarpXSolverVec::WarpXSolverVec ( WarpXSolverVec && )
defaultnoexcept

Member Function Documentation

◆ assertIsDefined()

void WarpXSolverVec::assertIsDefined ( const WarpXSolverVec & a_solver_vec) const
inline

◆ assertSameType()

void WarpXSolverVec::assertSameType ( const WarpXSolverVec & a_solver_vec) const
inline

◆ Copy() [1/2]

void WarpXSolverVec::Copy ( const WarpXSolverVec & a_solver_vec)
inline

◆ Copy() [2/2]

void WarpXSolverVec::Copy ( FieldType a_array_type,
FieldType a_scalar_type = FieldType::None,
bool allow_type_mismatch = false )

◆ copyFrom()

void WarpXSolverVec::copyFrom ( const amrex::Real * const a_arr)

◆ copyTo()

void WarpXSolverVec::copyTo ( amrex::Real * const a_arr) const

◆ Define() [1/2]

void WarpXSolverVec::Define ( const WarpXSolverVec & a_solver_vec)
inline

◆ Define() [2/2]

void WarpXSolverVec::Define ( WarpX * a_WarpX,
const std::string & a_vector_type_name,
const std::string & a_scalar_type_name = "none" )

◆ dotProduct()

amrex::Real WarpXSolverVec::dotProduct ( const WarpXSolverVec & a_X) const
nodiscard

◆ getArrayVec() [1/2]

ablastr::fields::MultiLevelVectorField & WarpXSolverVec::getArrayVec ( )
inline

◆ getArrayVec() [2/2]

const ablastr::fields::MultiLevelVectorField & WarpXSolverVec::getArrayVec ( ) const
inlinenodiscard

◆ getArrayVecType()

warpx::fields::FieldType WarpXSolverVec::getArrayVecType ( ) const
inlinenodiscard

◆ getDOFsObject()

const auto & WarpXSolverVec::getDOFsObject ( ) const
inline

◆ getScalarType()

std::string WarpXSolverVec::getScalarType ( ) const
inlinenodiscard

◆ getScalarVec() [1/2]

ablastr::fields::MultiLevelScalarField & WarpXSolverVec::getScalarVec ( )
inline

◆ getScalarVec() [2/2]

const ablastr::fields::MultiLevelScalarField & WarpXSolverVec::getScalarVec ( ) const
inlinenodiscard

◆ getScalarVecType()

warpx::fields::FieldType WarpXSolverVec::getScalarVecType ( ) const
inlinenodiscard

◆ getVectorType()

std::string WarpXSolverVec::getVectorType ( ) const
inlinenodiscard

◆ getWarpX()

auto WarpXSolverVec::getWarpX ( ) const
inlinenodiscard

◆ increment()

void WarpXSolverVec::increment ( const WarpXSolverVec & X,
const RT a )
inline

Increment Y by a*X (Y += a*X)

◆ IsDefined()

bool WarpXSolverVec::IsDefined ( ) const
inlinenodiscard

◆ linComb()

void WarpXSolverVec::linComb ( const RT a,
const WarpXSolverVec & X,
const RT b,
const WarpXSolverVec & Y )
inline

Y = a*X + b*Y.

◆ nDOF_global()

amrex::Long WarpXSolverVec::nDOF_global ( ) const
inlinenodiscard

◆ nDOF_local()

amrex::Long WarpXSolverVec::nDOF_local ( ) const
inlinenodiscard

◆ norm2()

RT WarpXSolverVec::norm2 ( ) const
inlinenodiscard

◆ numAMRLevels()

auto WarpXSolverVec::numAMRLevels ( ) const
inlinenodiscard

◆ operator+=()

void WarpXSolverVec::operator+= ( const WarpXSolverVec & a_solver_vec)
inline

◆ operator-=()

void WarpXSolverVec::operator-= ( const WarpXSolverVec & a_solver_vec)
inline

◆ operator=() [1/2]

WarpXSolverVec & WarpXSolverVec::operator= ( const WarpXSolverVec & a_solver_vec)
delete

◆ operator=() [2/2]

WarpXSolverVec & WarpXSolverVec::operator= ( WarpXSolverVec && a_solver_vec)
inlinenoexcept

◆ scale()

void WarpXSolverVec::scale ( RT a_a)
inline

Scale Y by a (Y *= a)

◆ setVal()

void WarpXSolverVec::setVal ( const RT a_val)
inline

◆ zero()

void WarpXSolverVec::zero ( )
inline

Member Data Documentation

◆ m_array_type

warpx::fields::FieldType WarpXSolverVec::m_array_type = warpx::fields::FieldType::None
private

◆ m_array_vec

ablastr::fields::MultiLevelVectorField WarpXSolverVec::m_array_vec
private

◆ m_dofs

std::unique_ptr< WarpXSolverDOF > WarpXSolverVec::m_dofs = nullptr
staticprivate

◆ m_is_defined

bool WarpXSolverVec::m_is_defined = false
private

◆ m_ncomp

int WarpXSolverVec::m_ncomp = 1
staticconstexprprivate

◆ m_num_amr_levels

int WarpXSolverVec::m_num_amr_levels = 1
private

◆ m_scalar_type

warpx::fields::FieldType WarpXSolverVec::m_scalar_type = warpx::fields::FieldType::None
private

◆ m_scalar_type_name

std::string WarpXSolverVec::m_scalar_type_name = "none"
private

◆ m_scalar_vec

ablastr::fields::MultiLevelScalarField WarpXSolverVec::m_scalar_vec
private

◆ m_vector_type_name

std::string WarpXSolverVec::m_vector_type_name = "none"
private

◆ m_WarpX

WarpX* WarpXSolverVec::m_WarpX = nullptr
inlinestaticprivate

◆ m_warpx_ptr_defined

bool WarpXSolverVec::m_warpx_ptr_defined = false
inlinestaticprivate

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