Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::MLCurlCurl Class Reference

curl (alpha curl E) + beta E = rhs More...

#include <AMReX_MLCurlCurl.H>

Inheritance diagram for amrex::MLCurlCurl:
amrex::MLLinOpT< Array< MultiFab, 3 > >

Public Types

using MF = Array< MultiFab, 3 >
 
using RT = typename MLLinOpT< MF >::RT
 
using BCType = typename MLLinOpT< MF >::BCType
 
using BCMode = typename MLLinOpT< MF >::BCMode
 
using StateMode = typename MLLinOpT< MF >::StateMode
 
using Location = typename MLLinOpT< MF >::Location
 
- Public Types inherited from amrex::MLLinOpT< Array< MultiFab, 3 > >
using MFType = Array< MultiFab, 3 >
 
using FAB = typename FabDataType< Array< MultiFab, 3 > >::fab_type
 
using RT = typename FabDataType< Array< MultiFab, 3 > >::value_type
 
using BCType = LinOpBCType
 
using BCMode = LinOpEnumType::BCMode
 
using StateMode = LinOpEnumType::StateMode
 
using Location = LinOpEnumType::Location
 

Public Member Functions

 MLCurlCurl ()=default
 Construct an empty operator; call define() before solving.
 
 MLCurlCurl (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const LPInfo &a_info=LPInfo(), int a_coord=0)
 Convenience constructor forwarding to define().
 
void define (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const LPInfo &a_info=LPInfo(), int a_coord=0)
 Bind the operator to the AMR hierarchy.
 
void setScalars (RT a_alpha, RT a_beta) noexcept
 
void setBeta (const Vector< Array< MultiFab const *, 3 > > &a_bcoefs)
 
void setAlpha (const Vector< MultiFab const * > &a_acoeffs)
 
void prepareRHS (Vector< MF * > const &rhs) const
 
void setDirichletNodesToZero (int amrlev, int mglev, MF &a_mf) const override
 Zero out Dirichlet nodes on (amrlev,mglev) (useful for GMRES).
 
std::string name () const override
 
bool setUsePCG (bool flag)
 Toggle the PCG smoother; returns the previous value.
 
void setLevelBC (int amrlev, const MF *levelbcdata, const MF *robinbc_a=nullptr, const MF *robinbc_b=nullptr, const MF *robinbc_f=nullptr) override
 Provide level-specific BC data (compatible with MLLinOp interface).
 
void restriction (int amrlev, int cmglev, MF &crse, MF &fine) const override
 Restrict edge-centered fields from fine to coarse MG level.
 
void interpolation (int amrlev, int fmglev, MF &fine, const MF &crse) const override
 Add the prolongation of coarse data onto the fine grid (fine += prolong(crse)).
 
void apply (int amrlev, int mglev, MF &out, MF &in, BCMode bc_mode, StateMode s_mode, const MLMGBndryT< MF > *bndry=nullptr) const override
 Apply the curl-curl operator with boundary conditions.
 
void smooth (int amrlev, int mglev, MF &sol, const MF &rhs, bool skip_fillboundary, int niter) const override
 Run the Gauss-Seidel / PCG smoother for niter sweeps.
 
void solutionResidual (int amrlev, MF &resid, MF &x, const MF &b, const MF *crse_bcdata=nullptr) override
 Compute residuals using solution BCs.
 
void correctionResidual (int amrlev, int mglev, MF &resid, MF &x, const MF &b, BCMode bc_mode, const MF *crse_bcdata=nullptr) override
 Compute residuals for correction solves.
 
bool needsUpdate () const override
 Does it need update if it's reused?
 
void update () override
 Update for reuse.
 
void prepareForSolve () override
 Finish BC caches, mask updates, and metric setup prior to solves.
 
void preparePrecond () override
 Prepare auxiliary data used by the multigrid preconditioner.
 
bool isSingular (int) const override
 Is it singular on AMR level amrlev?
 
bool isBottomSingular () const override
 Is the bottom of the multigrid hierarchy singular?
 
RT xdoty (int amrlev, int mglev, const MF &x, const MF &y, bool local) const override
 Dot-product helper.
 
RT normInf (int amrlev, MF const &mf, bool local) const override
 Infinity norm helper for vector-valued MultiFabs.
 
void averageDownAndSync (Vector< MF > &sol) const override
 Average vector fields down the AMR hierarchy and synchronize interfaces using sol.
 
IntVect getNGrowVectRestriction () const override
 
void make (Vector< Vector< MF > > &mf, IntVect const &ng) const override
 Allocate a hierarchy of MF s stored in mf with grow cells ng.
 
MF make (int amrlev, int mglev, IntVect const &ng) const override
 Allocate an MF on (amrlev,mglev) with grow cells ng.
 
MF makeAlias (MF const &mf) const override
 Create a shallow alias of mf (no allocation).
 
MF makeCoarseMG (int amrlev, int mglev, IntVect const &ng) const override
 
MF makeCoarseAmr (int famrlev, IntVect const &ng) const override
 
void smooth4 (int amrlev, int mglev, MF &sol, MF const &rhs, int color) const
 One color sweep of the 4-color smoother (2D/3D).
 
void compresid (int amrlev, int mglev, MF &resid, MF const &b) const
 Residual computation helper on (amrlev,mglev).
 
void applyPhysBC (int amrlev, int mglev, MultiFab &mf, CurlCurlStateType type) const
 Apply physical BCs to mf for the chosen state type.
 
- Public Member Functions inherited from amrex::MLLinOpT< Array< MultiFab, 3 > >
 MLLinOpT ()=default
 
 MLLinOpT (const MLLinOpT< Array< MultiFab, 3 > > &)=delete
 
 MLLinOpT (MLLinOpT< Array< MultiFab, 3 > > &&)=delete
 
virtual ~MLLinOpT ()=default
 
MLLinOpT< Array< MultiFab, 3 > > & operator= (const MLLinOpT< Array< MultiFab, 3 > > &)=delete
 
MLLinOpT< Array< MultiFab, 3 > > & operator= (MLLinOpT< Array< MultiFab, 3 > > &&)=delete
 
void define (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const LPInfo &a_info, const Vector< FabFactory< FAB > const * > &a_factory, bool eb_limit_coarsening=true)
 Initialize the operator hierarchy on a set of AMR levels.
 
void setDomainBC (const Array< BCType, 3 > &lobc, const Array< BCType, 3 > &hibc) noexcept
 Boundary of the whole domain.
 
void setDomainBC (const Vector< Array< BCType, 3 > > &lobc, const Vector< Array< BCType, 3 > > &hibc)
 Boundary of the whole domain.
 
void setDomainBCLoc (const Array< Real, 3 > &lo_bcloc, const Array< Real, 3 > &hi_bcloc) noexcept
 Set location offsets for the physical domain boundaries.
 
bool needsCoarseDataForBC () const noexcept
 Needs coarse data for bc?
 
void setCoarseFineBC (const Array< MultiFab, 3 > *crse, int crse_ratio, LinOpBCType bc_type=LinOpBCType::Dirichlet) noexcept
 Set coarse/fine boundary conditions. For cell-centered solves only.
 
void setCoarseFineBC (const Array< MultiFab, 3 > *crse, IntVect const &crse_ratio, LinOpBCType bc_type=LinOpBCType::Dirichlet) noexcept
 
void setCoarseFineBC (const AMF *crse, int crse_ratio, LinOpBCType bc_type=LinOpBCType::Dirichlet) noexcept
 
void setCoarseFineBC (const AMF *crse, IntVect const &crse_ratio, LinOpBCType bc_type=LinOpBCType::Dirichlet) noexcept
 
virtual void setLevelBC (int, const Array< MultiFab, 3 > *, const Array< MultiFab, 3 > *=nullptr, const Array< MultiFab, 3 > *=nullptr, const Array< MultiFab, 3 > *=nullptr)=0
 Set boundary conditions for given level. For cell-centered solves only.
 
void setLevelBC (int amrlev, const AMF *levelbcdata, const AMF *robinbc_a=nullptr, const AMF *robinbc_b=nullptr, const AMF *robinbc_f=nullptr)
 
void setVerbose (int v) noexcept
 Set verbosity.
 
void setMaxOrder (int o) noexcept
 Set order of interpolation at coarse/fine boundary.
 
int getMaxOrder () const noexcept
 Get order of interpolation at coarse/fine boundary.
 
void setEnforceSingularSolvable (bool o) noexcept
 Control whether the solver should try to make singular problems solvable.
 
bool getEnforceSingularSolvable () const noexcept
 
virtual BottomSolver getDefaultBottomSolver () const
 
virtual int getNComp () const
 Return number of components.
 
virtual int getNGrow (int=0, int=0) const
 
virtual void restriction (int amrlev, int cmglev, Array< MultiFab, 3 > &crse, Array< MultiFab, 3 > &fine) const=0
 Restriction onto coarse MG level.
 
virtual void interpolation (int amrlev, int fmglev, Array< MultiFab, 3 > &fine, const Array< MultiFab, 3 > &crse) const=0
 Add interpolated coarse MG level data to fine MG level data.
 
virtual void interpAssign (int amrlev, int fmglev, Array< MultiFab, 3 > &fine, Array< MultiFab, 3 > &crse) const
 Overwrite fine MG level data with interpolated coarse data.
 
virtual void interpolationAmr (int famrlev, Array< MultiFab, 3 > &fine, const Array< MultiFab, 3 > &crse, IntVect const &nghost) const
 Interpolation between AMR levels.
 
virtual void averageDownSolutionRHS (int camrlev, Array< MultiFab, 3 > &crse_sol, Array< MultiFab, 3 > &crse_rhs, const Array< MultiFab, 3 > &fine_sol, const Array< MultiFab, 3 > &fine_rhs)
 Average-down data from fine AMR level to coarse AMR level.
 
virtual void apply (int amrlev, int mglev, Array< MultiFab, 3 > &out, Array< MultiFab, 3 > &in, BCMode bc_mode, StateMode s_mode, const MLMGBndryT< Array< MultiFab, 3 > > *bndry=nullptr) const=0
 Apply the linear operator, out = L(in)
 
virtual void smooth (int amrlev, int mglev, Array< MultiFab, 3 > &sol, const Array< MultiFab, 3 > &rhs, bool skip_fillboundary, int niter) const=0
 Smooth.
 
virtual void normalize (int amrlev, int mglev, Array< MultiFab, 3 > &mf) const
 Divide mf by the diagonal component of the operator. Used by the bottom solvers.
 
virtual void solutionResidual (int amrlev, Array< MultiFab, 3 > &resid, Array< MultiFab, 3 > &x, const Array< MultiFab, 3 > &b, const Array< MultiFab, 3 > *crse_bcdata=nullptr)=0
 Compute residual for solution.
 
virtual void prepareForFluxes (int amrlev, const Array< MultiFab, 3 > *crse_bcdata=nullptr)
 Ensure BC caches are populated before flux extraction.
 
virtual void correctionResidual (int amrlev, int mglev, Array< MultiFab, 3 > &resid, Array< MultiFab, 3 > &x, const Array< MultiFab, 3 > &b, BCMode bc_mode, const Array< MultiFab, 3 > *crse_bcdata=nullptr)=0
 Compute residual for the residual-correction form, resid = b - L(x)
 
virtual void reflux (int crse_amrlev, Array< MultiFab, 3 > &res, const Array< MultiFab, 3 > &crse_sol, const Array< MultiFab, 3 > &crse_rhs, Array< MultiFab, 3 > &fine_res, Array< MultiFab, 3 > &fine_sol, const Array< MultiFab, 3 > &fine_rhs) const
 Reflux at AMR coarse/fine boundary.
 
virtual void compFlux (int amrlev, const Array< Array< MultiFab, 3 > *, 3 > &fluxes, Array< MultiFab, 3 > &sol, Location loc) const
 Compute fluxes.
 
virtual void compGrad (int amrlev, const Array< Array< MultiFab, 3 > *, 3 > &grad, Array< MultiFab, 3 > &sol, Location loc) const
 Compute gradients of the solution.
 
virtual void applyMetricTerm (int amrlev, int mglev, Array< MultiFab, 3 > &rhs) const
 Apply metric scaling to the RHS on (amrlev,mglev).
 
virtual void unapplyMetricTerm (int amrlev, int mglev, Array< MultiFab, 3 > &rhs) const
 Remove metric scaling previously applied via applyMetricTerm().
 
virtual void unimposeNeumannBC (int amrlev, Array< MultiFab, 3 > &rhs) const
 Undo Neumann contributions stored on the RHS.
 
virtual void applyInhomogNeumannTerm (int amrlev, Array< MultiFab, 3 > &rhs) const
 Add extra terms introduced when treating inhomogeneous Neumann BC as homogeneous.
 
virtual void applyOverset (int amrlev, Array< MultiFab, 3 > &rhs) const
 Overset-only hook for zeroing regions covered by masks.
 
virtual bool scaleRHS (int amrlev, Array< MultiFab, 3 > *rhs) const
 Optionally scale the RHS to fix solvability.
 
virtual Vector< RTgetSolvabilityOffset (int amrlev, int mglev, Array< MultiFab, 3 > const &rhs) const
 Compute offsets used to enforce solvability (per component).
 
virtual void fixSolvabilityByOffset (int amrlev, int mglev, Array< MultiFab, 3 > &rhs, Vector< RT > const &offset) const
 Subtract previously computed offsets from the RHS.
 
virtual void setDirichletNodesToZero (int amrlev, int mglev, Array< MultiFab, 3 > &mf) const
 Optional hook for masking out Dirichlet nodes or cells prior to GMRES solves; the default is a no-op with a warning.
 
virtual RT xdoty (int amrlev, int mglev, const Array< MultiFab, 3 > &x, const Array< MultiFab, 3 > &y, bool local) const=0
 Dot-product helper used by bottom solvers.
 
virtual RT dotProductPrecond (Vector< Array< MultiFab, 3 > const * > const &x, Vector< Array< MultiFab, 3 > const * > const &y) const
 Dot product over the composite AMR hierarchy, excluding cells covered by finer levels. Used when the operator acts as a preconditioner.
 
virtual RT norm2Precond (Vector< Array< MultiFab, 3 > const * > const &x) const
 L2 norm over the composite AMR hierarchy, excluding cells covered by finer levels. Used when the operator acts as a preconditioner.
 
virtual std::unique_ptr< MLLinOpT< Array< MultiFab, 3 > > > makeNLinOp (int grid_size) const
 Create the NSolve counterpart of this operator with the requested grid size.
 
virtual void getFluxes (const Vector< Array< Array< MultiFab, 3 > *, 3 > > &a_flux, const Vector< Array< MultiFab, 3 > * > &a_sol, Location a_loc) const
 Extract per-direction fluxes for each AMR level.
 
virtual void getFluxes (const Vector< Array< MultiFab, 3 > * > &a_flux, const Vector< Array< MultiFab, 3 > * > &a_sol) const
 Extract fluxes when the operator stores them in single MultiFabs per level.
 
virtual void getEBFluxes (const Vector< Array< MultiFab, 3 > * > &a_flux, const Vector< Array< MultiFab, 3 > * > &a_sol) const
 Extract embedded-boundary fluxes.
 
virtual bool supportNSolve () const
 Whether this operator supports NSolve.
 
virtual void copyNSolveSolution (Array< MultiFab, 3 > &dst, Array< MultiFab, 3 > const &src) const
 Copy an NSolve solution from src to dst.
 
virtual void postSolve (Vector< Array< MultiFab, 3 > * > const &sol) const
 Optional hook invoked after the main solve completes.
 
virtual RT normInf (int amrlev, Array< MultiFab, 3 > const &mf, bool local) const=0
 Infinity norm helper used by residual reductions.
 
virtual void averageDownAndSync (Vector< Array< MultiFab, 3 > > &sol) const=0
 Average the solution hierarchy down (fine to coarse) and synchronize interfaces.
 
virtual void avgDownResAmr (int clev, Array< MultiFab, 3 > &cres, Array< MultiFab, 3 > const &fres) const
 
virtual void avgDownResMG (int clev, Array< MultiFab, 3 > &cres, Array< MultiFab, 3 > const &fres) const
 Average residuals from fine to coarse MG levels (FMG helper).
 
virtual void beginPrecondBC ()
 Called when the operator starts being used as a preconditioner.
 
virtual void endPrecondBC ()
 Called when the operator stops being used as a preconditioner.
 
bool isMFIterSafe (int amrlev, int mglev1, int mglev2) const
 Check whether mixing MFIter loops for different MG levels is safe.
 
int NAMRLevels () const noexcept
 Return the number of AMR levels.
 
int NMGLevels (int amrlev) const noexcept
 Return the number of MG levels at given AMR level.
 
const GeometryGeom (int amr_lev, int mglev=0) const noexcept
 Geometry accessor for (amr_lev,mglev).
 

Additional Inherited Members

- Public Attributes inherited from amrex::MLLinOpT< Array< MultiFab, 3 > >
Vector< Array< BCType, 3 > > m_lobc
 
Vector< Array< BCType, 3 > > m_hibc
 
Vector< Array< BCType, 3 > > m_lobc_orig
 
Vector< Array< BCType, 3 > > m_hibc_orig
 
- Protected Member Functions inherited from amrex::MLLinOpT< Array< MultiFab, 3 > >
const Vector< int > & AMRRefRatio () const noexcept
 Return AMR refinement ratios.
 
int AMRRefRatio (int amr_lev) const noexcept
 Return AMR refinement ratio at given AMR level.
 
IntVect AMRRefRatioVect (int amr_lev) const noexcept
 Return AMR refinement ratio as IntVect (1 in hidden direction)
 
FabFactory< FAB > const * Factory (int amr_lev, int mglev=0) const noexcept
 
GpuArray< BCType, 3 > LoBC (int icomp=0) const noexcept
 
GpuArray< BCType, 3 > HiBC (int icomp=0) const noexcept
 
bool hasBC (BCType bct) const noexcept
 
bool hasInhomogNeumannBC () const noexcept
 
bool hasRobinBC () const noexcept
 
virtual bool supportRobinBC () const noexcept
 
virtual bool supportInhomogNeumannBC () const noexcept
 
bool isBottomActive () const noexcept
 
MPI_Comm BottomCommunicator () const noexcept
 
MPI_Comm Communicator () const noexcept
 
void setCoarseFineBCLocation (const RealVect &cloc) noexcept
 
bool doAgglomeration () const noexcept
 
bool doConsolidation () const noexcept
 
bool doSemicoarsening () const noexcept
 
bool isCellCentered () const noexcept
 
virtual void make (Vector< Vector< Array< MultiFab, 3 > > > &mf, IntVect const &ng) const
 
virtual Array< MultiFab, 3 > makeAlias (Array< MultiFab, 3 > const &mf) const
 
virtual std::unique_ptr< FabFactory< FAB > > makeFactory (int, int) const
 
virtual void resizeMultiGrid (int new_size)
 
bool hasHiddenDimension () const noexcept
 
int hiddenDirection () const noexcept
 
Box compactify (Box const &b) const noexcept
 
Array4< T > compactify (Array4< T > const &a) const noexcept
 
get_d0 (T const &dx, T const &dy, T const &) const noexcept
 
get_d1 (T const &, T const &dy, T const &dz) const noexcept
 
- Protected Attributes inherited from amrex::MLLinOpT< Array< MultiFab, 3 > >
int mg_domain_min_width
 
LPInfo info
 
int verbose
 
int maxorder
 
bool enforceSingularSolvable
 
int m_num_amr_levels
 
Vector< int > m_amr_ref_ratio
 
Vector< int > m_num_mg_levels
 
const MLLinOpT< Array< MultiFab, 3 > > * m_parent
 
IntVect m_ixtype
 
bool m_do_agglomeration
 
bool m_do_consolidation
 
bool m_do_semicoarsening
 
Vector< IntVectmg_coarsen_ratio_vec
 
Vector< Vector< Geometry > > m_geom
 first Vector is for amr level and second is mg level
 
Vector< Vector< BoxArray > > m_grids
 
Vector< Vector< DistributionMapping > > m_dmap
 
Vector< Vector< std::unique_ptr< FabFactory< FAB > > > > m_factory
 
Vector< int > m_domain_covered
 
MPI_Comm m_default_comm
 
MPI_Comm m_bottom_comm
 
std::unique_ptr< CommContainer > m_raii_comm
 
Array< Real, 3 > m_domain_bloc_lo
 
Array< Real, 3 > m_domain_bloc_hi
 
bool m_needs_coarse_data_for_bc
 
LinOpBCType m_coarse_fine_bc_type
 
IntVect m_coarse_data_crse_ratio
 
RealVect m_coarse_bc_loc
 
const Array< MultiFab, 3 > * m_coarse_data_for_bc
 
Array< MultiFab, 3 > m_coarse_data_for_bc_raii
 
bool m_precond_mode
 
- Static Protected Attributes inherited from amrex::MLLinOpT< Array< MultiFab, 3 > >
static constexpr int mg_coarsen_ratio
 
static constexpr int mg_box_min_width
 

Detailed Description

curl (alpha curl E) + beta E = rhs

Here E is an Array of 3 MultiFabs on the staggered grid. The coefficient alpha can be supplied either as a positive scalar (via setScalars) or as a nodal MultiFab (via setAlpha), and beta can be either a non-negative scalar or an edge-centered MultiFab (via setBeta).

It's the caller's responsibility to make sure rhs has consistent nodal data. If needed, one could call prepareRHS for this.

The smoother is based on the 4-color Gauss-Seidel smoother of Li et. al. 2020. "An Efficient Preconditioner for 3-D Finite Difference Modeling of the Electromagnetic Diffusion Process in the Frequency Domain", IEEE Transactions on Geoscience and Remote Sensing, 58, 500-509.

Member Typedef Documentation

◆ BCMode

using amrex::MLCurlCurl::BCMode = typename MLLinOpT<MF>::BCMode

◆ BCType

using amrex::MLCurlCurl::BCType = typename MLLinOpT<MF>::BCType

◆ Location

using amrex::MLCurlCurl::Location = typename MLLinOpT<MF>::Location

◆ MF

◆ RT

using amrex::MLCurlCurl::RT = typename MLLinOpT<MF>::RT

◆ StateMode

using amrex::MLCurlCurl::StateMode = typename MLLinOpT<MF>::StateMode

Constructor & Destructor Documentation

◆ MLCurlCurl() [1/2]

amrex::MLCurlCurl::MLCurlCurl ( )
default

Construct an empty operator; call define() before solving.

◆ MLCurlCurl() [2/2]

amrex::MLCurlCurl::MLCurlCurl ( const Vector< Geometry > &  a_geom,
const Vector< BoxArray > &  a_grids,
const Vector< DistributionMapping > &  a_dmap,
const LPInfo a_info = LPInfo(),
int  a_coord = 0 
)

Convenience constructor forwarding to define().

Parameters
a_geomPer-level geometries.
a_gridsPer-level grids.
a_dmapDistribution mappings.
a_infoLPInfo overrides (e.g., agglomeration).
a_coordCoordinate-system index (0 = Cartesian).

Member Function Documentation

◆ apply()

void amrex::MLCurlCurl::apply ( int  amrlev,
int  mglev,
MF out,
MF in,
BCMode  bc_mode,
StateMode  s_mode,
const MLMGBndryT< MF > *  bndry = nullptr 
) const
override

Apply the curl-curl operator with boundary conditions.

Parameters
amrlevAMR level index.
mglevMultigrid level index.
outDestination field updated with L(in).
inInput field for the apply.
bc_modeBoundary-condition interpretation (solution vs correction).
s_modeState interpretation (solution or correction).
bndryOptional cached boundary metadata.

◆ applyPhysBC()

void amrex::MLCurlCurl::applyPhysBC ( int  amrlev,
int  mglev,
MultiFab mf,
CurlCurlStateType  type 
) const

Apply physical BCs to mf for the chosen state type.

Parameters
amrlevAMR level index.
mglevMultigrid level index.
mfField updated in place.
typeState interpretation (solution vs correction).

◆ averageDownAndSync()

void amrex::MLCurlCurl::averageDownAndSync ( Vector< MF > &  sol) const
override

Average vector fields down the AMR hierarchy and synchronize interfaces using sol.

◆ compresid()

void amrex::MLCurlCurl::compresid ( int  amrlev,
int  mglev,
MF resid,
MF const &  b 
) const

Residual computation helper on (amrlev,mglev).

Parameters
amrlevAMR level index.
mglevMultigrid level index.
residDestination residual.
bRight-hand side.

◆ correctionResidual()

void amrex::MLCurlCurl::correctionResidual ( int  amrlev,
int  mglev,
MF resid,
MF x,
const MF b,
BCMode  bc_mode,
const MF crse_bcdata = nullptr 
)
override

Compute residuals for correction solves.

Parameters
amrlevAMR level index.
mglevMultigrid level index.
residDestination residual.
xCurrent correction.
bRight-hand side.
bc_modeBoundary-condition mode (usually homogeneous).
crse_bcdataOptional coarse data to inform BCs.

◆ define()

void amrex::MLCurlCurl::define ( const Vector< Geometry > &  a_geom,
const Vector< BoxArray > &  a_grids,
const Vector< DistributionMapping > &  a_dmap,
const LPInfo a_info = LPInfo(),
int  a_coord = 0 
)

Bind the operator to the AMR hierarchy.

Parameters
a_geomPer-level geometries.
a_gridsPer-level grids.
a_dmapDistribution mappings.
a_infoLPInfo overrides.
a_coordCoordinate-system index (0 Cartesian, 1 RZ, etc.).

◆ getNGrowVectRestriction()

IntVect amrex::MLCurlCurl::getNGrowVectRestriction ( ) const
inlineoverridevirtual

◆ interpolation()

void amrex::MLCurlCurl::interpolation ( int  amrlev,
int  fmglev,
MF fine,
const MF crse 
) const
override

Add the prolongation of coarse data onto the fine grid (fine += prolong(crse)).

Parameters
amrlevAMR level index.
fmglevFine multigrid level to populate.
fineDestination MultiFab on (amrlev,fmglev).
crseSource MultiFab on the next coarser MG level.

◆ isBottomSingular()

bool amrex::MLCurlCurl::isBottomSingular ( ) const
inlineoverridevirtual

Is the bottom of the multigrid hierarchy singular?

Implements amrex::MLLinOpT< Array< MultiFab, 3 > >.

◆ isSingular()

bool amrex::MLCurlCurl::isSingular ( int  amrlev) const
inlineoverridevirtual

Is it singular on AMR level amrlev?

Implements amrex::MLLinOpT< Array< MultiFab, 3 > >.

◆ make() [1/2]

Array< MultiFab, 3 > amrex::MLCurlCurl::make ( int  amrlev,
int  mglev,
IntVect const &  ng 
) const
overridevirtual

Allocate an MF on (amrlev,mglev) with grow cells ng.

Reimplemented from amrex::MLLinOpT< Array< MultiFab, 3 > >.

◆ make() [2/2]

void amrex::MLCurlCurl::make ( Vector< Vector< MF > > &  mf,
IntVect const &  ng 
) const
override

Allocate a hierarchy of MF s stored in mf with grow cells ng.

◆ makeAlias()

Array< MultiFab, 3 > amrex::MLCurlCurl::makeAlias ( MF const &  mf) const
override

Create a shallow alias of mf (no allocation).

◆ makeCoarseAmr()

Array< MultiFab, 3 > amrex::MLCurlCurl::makeCoarseAmr ( int  famrlev,
IntVect const &  ng 
) const
overridevirtual

Allocate an MF on the next coarser AMR level (famrlev-1) with grow cells ng.

Reimplemented from amrex::MLLinOpT< Array< MultiFab, 3 > >.

◆ makeCoarseMG()

Array< MultiFab, 3 > amrex::MLCurlCurl::makeCoarseMG ( int  amrlev,
int  mglev,
IntVect const &  ng 
) const
overridevirtual

Allocate an MF on the next coarser MG level (mglev+1) of AMR level amrlev with grow cells ng.

Reimplemented from amrex::MLLinOpT< Array< MultiFab, 3 > >.

◆ name()

std::string amrex::MLCurlCurl::name ( ) const
inlineoverridevirtual

◆ needsUpdate()

bool amrex::MLCurlCurl::needsUpdate ( ) const
inlineoverridevirtual

Does it need update if it's reused?

Reimplemented from amrex::MLLinOpT< Array< MultiFab, 3 > >.

◆ normInf()

Real amrex::MLCurlCurl::normInf ( int  amrlev,
MF const &  mf,
bool  local 
) const
override

Infinity norm helper for vector-valued MultiFabs.

Parameters
amrlevAMR level index.
mfField whose infinity norm is computed.
localTrue to avoid an MPI reduction.

◆ prepareForSolve()

void amrex::MLCurlCurl::prepareForSolve ( )
overridevirtual

Finish BC caches, mask updates, and metric setup prior to solves.

Implements amrex::MLLinOpT< Array< MultiFab, 3 > >.

◆ preparePrecond()

void amrex::MLCurlCurl::preparePrecond ( )
overridevirtual

Prepare auxiliary data used by the multigrid preconditioner.

Reimplemented from amrex::MLLinOpT< Array< MultiFab, 3 > >.

◆ prepareRHS()

void amrex::MLCurlCurl::prepareRHS ( Vector< MF * > const &  rhs) const

Synchronize RHS on nodal points. If the user can guarantee it, this function does not need to be called.

◆ restriction()

void amrex::MLCurlCurl::restriction ( int  amrlev,
int  cmglev,
MF crse,
MF fine 
) const
override

Restrict edge-centered fields from fine to coarse MG level.

Parameters
amrlevAMR level index.
cmglevCoarse multigrid level receiving the data.
crseDestination staggered field (3-component MF) on (amrlev,cmglev).
fineSource staggered field on the next finer MG level.

◆ setAlpha()

void amrex::MLCurlCurl::setAlpha ( const Vector< MultiFab const * > &  a_acoeffs)

Set variable alpha defined on nodal MultiFab. Call this after setScalars if both APIs are used, because setScalars clears the cached nodal alpha fields.

◆ setBeta()

void amrex::MLCurlCurl::setBeta ( const Vector< Array< MultiFab const *, 3 > > &  a_bcoefs)

This is needed only if there is variable beta coefficient. Call this after setScalars if both APIs are used, because setScalars clears the cached beta MultiFabs.

◆ setDirichletNodesToZero()

void amrex::MLCurlCurl::setDirichletNodesToZero ( int  amrlev,
int  mglev,
MF a_mf 
) const
override

Zero out Dirichlet nodes on (amrlev,mglev) (useful for GMRES).

◆ setLevelBC()

void amrex::MLCurlCurl::setLevelBC ( int  amrlev,
const MF levelbcdata,
const MF robinbc_a = nullptr,
const MF robinbc_b = nullptr,
const MF robinbc_f = nullptr 
)
override

Provide level-specific BC data (compatible with MLLinOp interface).

Parameters
amrlevAMR level index.
levelbcdataOptional BC data for this level.
robinbc_aOptional Robin a coefficients defined on nodes.
robinbc_bOptional Robin b coefficients defined on nodes.
robinbc_fOptional Robin f coefficients defined on nodes.

◆ setScalars()

void amrex::MLCurlCurl::setScalars ( RT  a_alpha,
RT  a_beta 
)
noexcept

Set scalar coefficients. This clears any previously supplied nodal alpha or edge-centered beta MultiFabs, so call setAlpha/setBeta afterwards if you still need spatially varying coefficients.

◆ setUsePCG()

bool amrex::MLCurlCurl::setUsePCG ( bool  flag)
inline

Toggle the PCG smoother; returns the previous value.

Parameters
flagTrue to enable the PCG smoother.
Returns
Previous state (true = PCG was enabled).

◆ smooth()

void amrex::MLCurlCurl::smooth ( int  amrlev,
int  mglev,
MF sol,
const MF rhs,
bool  skip_fillboundary,
int  niter 
) const
override

Run the Gauss-Seidel / PCG smoother for niter sweeps.

Parameters
amrlevAMR level index.
mglevMultigrid level index.
solcorrection vector updated in place.
rhsRight-hand side.
skip_fillboundaryTrue if ghost nodes are already valid.
niterNumber of smoothing passes to execute.

◆ smooth4()

void amrex::MLCurlCurl::smooth4 ( int  amrlev,
int  mglev,
MF sol,
MF const &  rhs,
int  color 
) const

One color sweep of the 4-color smoother (2D/3D).

Parameters
amrlevAMR level index.
mglevMultigrid level index.
solCorrection updated in place.
rhsRight-hand side for the sweep.
colorColor index (0-3) selecting the sub-lattice.

◆ solutionResidual()

void amrex::MLCurlCurl::solutionResidual ( int  amrlev,
MF resid,
MF x,
const MF b,
const MF crse_bcdata = nullptr 
)
override

Compute residuals using solution BCs.

Parameters
amrlevAMR level index.
residDestination residual.
xCurrent solution.
bRight-hand side.
crse_bcdataOptional coarse data to seed BCs.

◆ update()

void amrex::MLCurlCurl::update ( )
overridevirtual

Update for reuse.

Reimplemented from amrex::MLLinOpT< Array< MultiFab, 3 > >.

◆ xdoty()

Real amrex::MLCurlCurl::xdoty ( int  amrlev,
int  mglev,
const MF x,
const MF y,
bool  local 
) const
override

Dot-product helper.

Parameters
amrlevAMR level index.
mglevMultigrid level index.
xFirst vector.
ySecond vector.
localTrue to limit the calculation to local data (skip MPI reduction).

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