Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::MLCellLinOpT< MF > Class Template Referenceabstract

#include <AMReX_MLCellLinOp.H>

Inheritance diagram for amrex::MLCellLinOpT< MF >:
amrex::MLLinOpT< MF > amrex::MLCellABecLapT< MF > amrex::MLABecLaplacianT< MF > amrex::MLALaplacianT< MF > amrex::MLEBABecLap amrex::MLPoissonT< MF > amrex::MLTensorOp amrex::MLEBTensorOp

Public Types

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

Public Member Functions

 MLCellLinOpT ()
 
 ~MLCellLinOpT () override=default
 
 MLCellLinOpT (const MLCellLinOpT< MF > &)=delete
 
 MLCellLinOpT (MLCellLinOpT< MF > &&)=delete
 
MLCellLinOpT< MF > & operator= (const MLCellLinOpT< MF > &)=delete
 
MLCellLinOpT< MF > & operator= (MLCellLinOpT< MF > &&)=delete
 
void define (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const LPInfo &a_info=LPInfo(), const Vector< FabFactory< FAB > const * > &a_factory={})
 Bind the operator to an AMR hierarchy.
 
void setLevelBC (int amrlev, const MF *levelbcdata, const MF *robinbc_a=nullptr, const MF *robinbc_b=nullptr, const MF *robinbc_f=nullptr) final
 Provide per-level inhomogeneous boundary data.
 
template<MultiFabLike AMF>
requires (!std::same_as<MF,AMF>)
void setLevelBC (int amrlev, const AMF *levelbcdata, const AMF *robinbc_a=nullptr, const AMF *robinbc_b=nullptr, const AMF *robinbc_f=nullptr)
 
bool needsUpdate () const override
 Does it need update if it's reused?
 
void update () override
 Update for reuse.
 
void setGaussSeidel (bool flag) noexcept
 Toggle Gauss–Seidel smoothing in place of Jacobi relaxation.
 
virtual bool isCrossStencil () const
 Whether the stencil is the cross shape.
 
virtual bool isTensorOp () const
 Whether this operator is a tensor solve.
 
void updateSolBC (int amrlev, const MF &crse_bcdata) const
 Refresh stored solution BC data from coarse inputs.
 
void updateCorBC (int amrlev, const MF &crse_bcdata) const
 Refresh stored correction BC data from coarse inputs.
 
virtual void applyBC (int amrlev, int mglev, MF &in, BCMode bc_mode, StateMode s_mode, const MLMGBndryT< MF > *bndry=nullptr, bool skip_fillboundary=false) const
 Apply physical BCs (optionally skipping FillBoundary).
 
BoxArray makeNGrids (int grid_size) const
 Helper that builds a BoxArray for NSolve with boxes no larger than the requested grid_size.
 
void restriction (int amrlev, int cmglev, MF &crse, MF &fine) const override
 Restrict a fine-grid field onto its coarse counterpart.
 
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 interpAssign (int amrlev, int fmglev, MF &fine, MF &crse) const override
 Overwrite fine data with the prolongation of coarse data (fine = prolong(crse)).
 
void interpolationAmr (int famrlev, MF &fine, const MF &crse, IntVect const &nghost) const override
 Prolong AMR-level data during FMG initialization.
 
void averageDownSolutionRHS (int camrlev, MF &crse_sol, MF &crse_rhs, const MF &fine_sol, const MF &fine_rhs) override
 Average fine solution/RHS onto the next coarser AMR level.
 
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 linear operator with boundary conditions.
 
void smooth (int amrlev, int mglev, MF &sol, const MF &rhs, bool skip_fillboundary, int niter) const final
 Perform niter smoothing iterations on the supplied residual equation.
 
void solutionResidual (int amrlev, MF &resid, MF &x, const MF &b, const MF *crse_bcdata=nullptr) override
 Compute the residual resid = b - A(x) using solution boundary data.
 
void prepareForFluxes (int amrlev, const MF *crse_bcdata=nullptr) override
 Ensure BC caches are ready for flux computations (e.g., getFluxes).
 
void correctionResidual (int amrlev, int mglev, MF &resid, MF &x, const MF &b, BCMode bc_mode, const MF *crse_bcdata=nullptr) final
 Compute the correction residual with optional coarse data.
 
void reflux (int crse_amrlev, MF &res, const MF &crse_sol, const MF &, MF &, MF &fine_sol, const MF &) const final
 Reflux fine-level fluxes into the coarse residual.
 
void compFlux (int amrlev, const Array< MF *, 3 > &fluxes, MF &sol, Location loc) const override
 Compute face-centered fluxes from the supplied solution.
 
void compGrad (int amrlev, const Array< MF *, 3 > &grad, MF &sol, Location loc) const override
 Compute directional gradients of the solution.
 
void applyMetricTerm (int amrlev, int mglev, MF &rhs) const final
 Multiply the RHS by metric terms appropriate for curvilinear coordinates.
 
void unapplyMetricTerm (int amrlev, int mglev, MF &rhs) const final
 Remove metric scaling previously applied to the RHS.
 
Vector< RTgetSolvabilityOffset (int amrlev, int mglev, MF const &rhs) const override
 Compute the average offset needed to enforce solvability constraints.
 
void fixSolvabilityByOffset (int amrlev, int mglev, MF &rhs, Vector< RT > const &offset) const override
 Apply solvability offsets to the RHS (subtracting the average).
 
void prepareForSolve () override
 Prepare multilevel metadata before MLMG iterates (coefficients, BC caches, etc.).
 
RT xdoty (int amrlev, int mglev, const MF &x, const MF &y, bool local) const final
 Dot product helper.
 
RT dotProductPrecond (Vector< MF const * > const &x, Vector< MF const * > const &y) const final
 Dot product over the composite AMR hierarchy, excluding cells covered by finer levels (used when the operator is a preconditioner).
 
RT norm2Precond (Vector< MF const * > const &x) const final
 L2 norm over the composite AMR hierarchy, excluding cells covered by finer levels (used when the operator is a preconditioner).
 
virtual void Fapply (int amrlev, int mglev, MF &out, const MF &in) const =0
 
virtual void Fsmooth (int amrlev, int mglev, MF &sol, const MF &rhs, int redblack) const =0
 
virtual void FFlux (int amrlev, const MFIter &mfi, const Array< FAB *, 3 > &flux, const FAB &sol, Location loc, int face_only=0) const =0
 
virtual void addInhomogNeumannFlux (int, const Array< MF *, 3 > &, MF const &, bool) const
 Optional hook for adding inhomogeneous Neumann contributions.
 
RT normInf (int amrlev, MF const &mf, bool local) const override
 Infinity norm helper used by solvers and diagnostics.
 
void averageDownAndSync (Vector< MF > &sol) const override
 Average the solution hierarchy down (fine-to-coarse) and sync.
 
void avgDownResAmr (int clev, MF &cres, MF const &fres) const override
 Average a residual from a fine AMR level to its coarse parent.
 
void beginPrecondBC () override
 Called when the operator starts being used as a preconditioner.
 
void endPrecondBC () override
 Called when the operator stops being used as a preconditioner.
 
void setInterpBndryHalfWidth (int w)
 Control how many cells the interpolation boundary stencil spans.
 
- Public Member Functions inherited from amrex::MLLinOpT< MF >
 MLLinOpT ()=default
 
virtual ~MLLinOpT ()=default
 
 MLLinOpT (const MLLinOpT< MF > &)=delete
 
 MLLinOpT (MLLinOpT< MF > &&)=delete
 
MLLinOpT< MF > & operator= (const MLLinOpT< MF > &)=delete
 
MLLinOpT< MF > & operator= (MLLinOpT< MF > &&)=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.
 
virtual std::string name () const
 
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 MF *crse, int crse_ratio, LinOpBCType bc_type=LinOpBCType::Dirichlet) noexcept
 Set coarse/fine boundary conditions. For cell-centered solves only.
 
void setCoarseFineBC (const MF *crse, IntVect const &crse_ratio, LinOpBCType bc_type=LinOpBCType::Dirichlet) noexcept
 
template<typename AMF >
requires (!std::same_as<MF,AMF>)
void setCoarseFineBC (const AMF *crse, int crse_ratio, LinOpBCType bc_type=LinOpBCType::Dirichlet) noexcept
 
template<typename AMF >
requires (!std::same_as<MF,AMF>)
void setCoarseFineBC (const AMF *crse, IntVect const &crse_ratio, LinOpBCType bc_type=LinOpBCType::Dirichlet) noexcept
 
template<MultiFabLike AMF>
requires (!std::same_as<MF,AMF>)
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 normalize (int amrlev, int mglev, MF &mf) const
 Divide mf by the diagonal component of the operator. Used by the bottom solvers.
 
virtual void unimposeNeumannBC (int amrlev, MF &rhs) const
 Undo Neumann contributions stored on the RHS.
 
virtual void applyInhomogNeumannTerm (int amrlev, MF &rhs) const
 Add extra terms introduced when treating inhomogeneous Neumann BC as homogeneous.
 
virtual void applyOverset (int amrlev, MF &rhs) const
 Overset-only hook for zeroing regions covered by masks.
 
virtual bool scaleRHS (int amrlev, MF *rhs) const
 Optionally scale the RHS to fix solvability.
 
virtual void preparePrecond ()
 Prepare auxiliary data used when the operator acts as a preconditioner.
 
virtual void setDirichletNodesToZero (int amrlev, int mglev, MF &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 bool isSingular (int amrlev) const =0
 Is it singular on AMR level amrlev?
 
virtual bool isBottomSingular () const =0
 Is the bottom of the multigrid hierarchy singular?
 
virtual std::unique_ptr< MLLinOpT< MF > > makeNLinOp (int grid_size) const
 Create the NSolve counterpart of this operator with the requested grid size.
 
virtual void getFluxes (const Vector< Array< MF *, 3 > > &a_flux, const Vector< MF * > &a_sol, Location a_loc) const
 Extract per-direction fluxes for each AMR level.
 
virtual void getFluxes (const Vector< MF * > &a_flux, const Vector< MF * > &a_sol) const
 Extract fluxes when the operator stores them in single MultiFabs per level.
 
virtual void getEBFluxes (const Vector< MF * > &a_flux, const Vector< MF * > &a_sol) const
 Extract embedded-boundary fluxes.
 
virtual bool supportNSolve () const
 Whether this operator supports NSolve.
 
virtual void copyNSolveSolution (MF &dst, MF const &src) const
 Copy an NSolve solution from src to dst.
 
virtual void postSolve (Vector< MF * > const &sol) const
 Optional hook invoked after the main solve completes.
 
virtual void avgDownResMG (int clev, MF &cres, MF const &fres) const
 Average residuals from fine to coarse MG levels (FMG helper).
 
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).
 

Public Attributes

Vector< std::unique_ptr< MF > > m_robin_bcval
 
- Public Attributes inherited from amrex::MLLinOpT< MF >
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 Types

using RealTuple = Array< RT, 2 *3 >
 
using BCTuple = Array< BoundCond, 2 *3 >
 

Protected Attributes

bool m_has_metric_term = false
 
Vector< std::unique_ptr< MLMGBndryT< MF > > > m_bndry_sol
 
Vector< std::unique_ptr< BndryRegisterT< MF > > > m_crse_sol_br
 
Vector< std::unique_ptr< MLMGBndryT< MF > > > m_bndry_cor
 
Vector< std::unique_ptr< BndryRegisterT< MF > > > m_crse_cor_br
 
Vector< std::unique_ptr< MLMGBndryT< MF > > > m_bndry_sol_zero
 
Vector< Vector< std::unique_ptr< BndryCondLoc > > > m_bcondloc
 
Vector< Vector< BndryRegisterT< MF > > > m_undrrelxr
 
Vector< Vector< Array< MultiMask, 2 *3 > > > m_maskvals
 
Vector< std::unique_ptr< iMultiFab > > m_norm_fine_mask
 
Vector< YAFluxRegisterT< MF > > m_fluxreg
 
bool m_use_gauss_seidel = true
 
- Protected Attributes inherited from amrex::MLLinOpT< MF >
int mg_domain_min_width = 2
 
LPInfo info
 
int verbose = 0
 
int maxorder = 3
 
bool enforceSingularSolvable = true
 
int m_num_amr_levels = 0
 
Vector< intm_amr_ref_ratio
 
Vector< intm_num_mg_levels
 
const MLLinOpT< MF > * m_parent = nullptr
 
IntVect m_ixtype
 
bool m_do_agglomeration = false
 
bool m_do_consolidation = false
 
bool m_do_semicoarsening = false
 
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< intm_domain_covered
 
MPI_Comm m_default_comm = MPI_COMM_NULL
 
MPI_Comm m_bottom_comm = MPI_COMM_NULL
 
std::unique_ptr< CommContainer > m_raii_comm
 
Array< Real, 3 > m_domain_bloc_lo {{ 0._rt , 0._rt , 0._rt }}
 
Array< Real, 3 > m_domain_bloc_hi {{ 0._rt , 0._rt , 0._rt }}
 
bool m_needs_coarse_data_for_bc = false
 
LinOpBCType m_coarse_fine_bc_type = LinOpBCType::Dirichlet
 
IntVect m_coarse_data_crse_ratio = IntVect(-1)
 
RealVect m_coarse_bc_loc
 
const MF * m_coarse_data_for_bc = nullptr
 
MF m_coarse_data_for_bc_raii
 
bool m_precond_mode = false
 

Additional Inherited Members

- Protected Member Functions inherited from amrex::MLLinOpT< MF >
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 IntVect getNGrowVectRestriction () const
 
virtual void make (Vector< Vector< MF > > &mf, IntVect const &ng) const
 
virtual MF make (int amrlev, int mglev, IntVect const &ng) const
 
virtual MF makeAlias (MF const &mf) const
 
virtual MF makeCoarseMG (int amrlev, int mglev, IntVect const &ng) const
 Allocate an MF on the next coarser MG level (mglev+1) with grow cells ng.
 
virtual MF makeCoarseAmr (int famrlev, IntVect const &ng) const
 Allocate an MF on the next coarser AMR level (famrlev-1) with grow cells ng.
 
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
 
template<typename T >
Array4< T > compactify (Array4< T > const &a) const noexcept
 
template<typename T >
get_d0 (T const &dx, T const &dy, T const &) const noexcept
 
template<typename T >
get_d1 (T const &, T const &dy, T const &dz) const noexcept
 
- Static Protected Attributes inherited from amrex::MLLinOpT< MF >
static constexpr int mg_coarsen_ratio = 2
 
static constexpr int mg_box_min_width = 2
 

Member Typedef Documentation

◆ BCMode

template<typename MF >
using amrex::MLCellLinOpT< MF >::BCMode = typename MLLinOpT<MF>::BCMode

◆ BCTuple

template<typename MF >
using amrex::MLCellLinOpT< MF >::BCTuple = Array<BoundCond,2* 3 >
protected

◆ BCType

template<typename MF >
using amrex::MLCellLinOpT< MF >::BCType = LinOpBCType

◆ FAB

template<typename MF >
using amrex::MLCellLinOpT< MF >::FAB = typename FabDataType<MF>::fab_type

◆ Location

template<typename MF >
using amrex::MLCellLinOpT< MF >::Location = typename MLLinOpT<MF>::Location

◆ RealTuple

template<typename MF >
using amrex::MLCellLinOpT< MF >::RealTuple = Array<RT,2* 3 >
protected

◆ RT

template<typename MF >
using amrex::MLCellLinOpT< MF >::RT = typename FabDataType<MF>::value_type

◆ StateMode

template<typename MF >
using amrex::MLCellLinOpT< MF >::StateMode = typename MLLinOpT<MF>::StateMode

Constructor & Destructor Documentation

◆ MLCellLinOpT() [1/3]

template<typename MF >
amrex::MLCellLinOpT< MF >::MLCellLinOpT ( )

◆ ~MLCellLinOpT()

template<typename MF >
amrex::MLCellLinOpT< MF >::~MLCellLinOpT ( )
overridedefault

◆ MLCellLinOpT() [2/3]

template<typename MF >
amrex::MLCellLinOpT< MF >::MLCellLinOpT ( const MLCellLinOpT< MF > &  )
delete

◆ MLCellLinOpT() [3/3]

template<typename MF >
amrex::MLCellLinOpT< MF >::MLCellLinOpT ( MLCellLinOpT< MF > &&  )
delete

Member Function Documentation

◆ addInhomogNeumannFlux()

template<typename MF >
virtual void amrex::MLCellLinOpT< MF >::addInhomogNeumannFlux ( int  ,
const Array< MF *, 3 > &  ,
MF const &  ,
bool   
) const
inlinevirtual

Optional hook for adding inhomogeneous Neumann contributions.

Default implementation is a no-op; derived classes override if needed. The interface receives the AMR level, the face-centered gradient arrays, the solution MultiFab, and a flag indicating whether beta coefficients have already been applied to those gradients.

Reimplemented in amrex::MLCellABecLapT< MF >.

◆ apply()

template<typename MF >
void amrex::MLCellLinOpT< MF >::apply ( int  amrlev,
int  mglev,
MF &  out,
MF &  in,
BCMode  bc_mode,
StateMode  s_mode,
const MLMGBndryT< MF > *  bndry = nullptr 
) const
overridevirtual

Apply the linear operator with boundary conditions.

Parameters
amrlevAMR level index.
mglevMultigrid level index.
outDestination array for A(in).
inInput state.
bc_modeBoundary-condition mode (solution vs correction).
s_modeState interpretation (solution or correction).
bndryOptional cached BC data (nullptr rebuilds on the fly).

Implements amrex::MLLinOpT< MF >.

◆ applyBC()

template<typename MF >
void amrex::MLCellLinOpT< MF >::applyBC ( int  amrlev,
int  mglev,
MF &  in,
BCMode  bc_mode,
StateMode  s_mode,
const MLMGBndryT< MF > *  bndry = nullptr,
bool  skip_fillboundary = false 
) const
virtual

Apply physical BCs (optionally skipping FillBoundary).

Parameters
amrlevAMR level index.
mglevMultigrid level index.
inMultiFab whose boundary values are updated.
bc_modeBoundary-condition interpretation (solution vs correction).
s_modeState interpretation (solution or correction).
bndryOptional cached boundary data.
skip_fillboundaryTrue to assume ghost cells already filled.

◆ applyMetricTerm()

template<typename MF >
void amrex::MLCellLinOpT< MF >::applyMetricTerm ( int  amrlev,
int  mglev,
MF &  rhs 
) const
finalvirtual

Multiply the RHS by metric terms appropriate for curvilinear coordinates.

Parameters
amrlevAMR level index.
mglevMultigrid level index.
rhsRight-hand side updated in place.

Reimplemented from amrex::MLLinOpT< MF >.

◆ averageDownAndSync()

template<typename MF >
void amrex::MLCellLinOpT< MF >::averageDownAndSync ( Vector< MF > &  sol) const
overridevirtual

Average the solution hierarchy down (fine-to-coarse) and sync.

Parameters
solVector of MultiFabs spanning all AMR levels.

Implements amrex::MLLinOpT< MF >.

◆ averageDownSolutionRHS()

template<typename MF >
void amrex::MLCellLinOpT< MF >::averageDownSolutionRHS ( int  camrlev,
MF &  crse_sol,
MF &  crse_rhs,
const MF &  fine_sol,
const MF &  fine_rhs 
)
overridevirtual

Average fine solution/RHS onto the next coarser AMR level.

Parameters
camrlevCoarse AMR level to update.
crse_solDestination coarse solution.
crse_rhsDestination coarse RHS.
fine_solSource fine solution.
fine_rhsSource fine RHS.

Reimplemented from amrex::MLLinOpT< MF >.

◆ avgDownResAmr()

template<typename MF >
void amrex::MLCellLinOpT< MF >::avgDownResAmr ( int  clev,
MF &  cres,
MF const &  fres 
) const
overridevirtual

Average a residual from a fine AMR level to its coarse parent.

Parameters
clevCoarse level index to update.
cresDestination coarse residual.
fresSource fine residual.

Reimplemented from amrex::MLLinOpT< MF >.

◆ beginPrecondBC()

template<typename MF >
void amrex::MLCellLinOpT< MF >::beginPrecondBC ( )
overridevirtual

Called when the operator starts being used as a preconditioner.

Reimplemented from amrex::MLLinOpT< MF >.

◆ compFlux()

template<typename MF >
void amrex::MLCellLinOpT< MF >::compFlux ( int  amrlev,
const Array< MF *, 3 > &  fluxes,
MF &  sol,
Location  loc 
) const
overridevirtual

Compute face-centered fluxes from the supplied solution.

Parameters
amrlevAMR level index.
fluxesDestination arrays for each spatial direction.
solSolution whose gradient forms the flux.
locGeometric location (face centers or centroids).

Reimplemented from amrex::MLLinOpT< MF >.

◆ compGrad()

template<typename MF >
void amrex::MLCellLinOpT< MF >::compGrad ( int  amrlev,
const Array< MF *, 3 > &  grad,
MF &  sol,
Location  loc 
) const
overridevirtual

Compute directional gradients of the solution.

Parameters
amrlevAMR level index.
gradDestination gradient arrays per direction.
solSource solution.
locLocation where gradients are evaluated.

Reimplemented from amrex::MLLinOpT< MF >.

◆ correctionResidual()

template<typename MF >
void amrex::MLCellLinOpT< MF >::correctionResidual ( int  amrlev,
int  mglev,
MF &  resid,
MF &  x,
const MF &  b,
BCMode  bc_mode,
const MF *  crse_bcdata = nullptr 
)
finalvirtual

Compute the correction residual with optional coarse data.

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

Implements amrex::MLLinOpT< MF >.

◆ define()

template<typename MF >
void amrex::MLCellLinOpT< MF >::define ( const Vector< Geometry > &  a_geom,
const Vector< BoxArray > &  a_grids,
const Vector< DistributionMapping > &  a_dmap,
const LPInfo a_info = LPInfo(),
const Vector< FabFactory< FAB > const * > &  a_factory = {} 
)

Bind the operator to an AMR hierarchy.

Parameters
a_geomGeometries per level (fine to coarse).
a_gridsGrid arrays.
a_dmapDistribution mappings.
a_infoOptional operator configuration overrides.
a_factoryOptional FAB factories (defaults to FArrayBox).

◆ dotProductPrecond()

template<typename MF >
auto amrex::MLCellLinOpT< MF >::dotProductPrecond ( Vector< MF const * > const &  x,
Vector< MF const * > const &  y 
) const
finalvirtual

Dot product over the composite AMR hierarchy, excluding cells covered by finer levels (used when the operator is a preconditioner).

Parameters
xVector of MultiFabs (one per AMR level).
yVector of MultiFabs (one per AMR level).
Returns
Dot product sum.

Reimplemented from amrex::MLLinOpT< MF >.

◆ endPrecondBC()

template<typename MF >
void amrex::MLCellLinOpT< MF >::endPrecondBC ( )
overridevirtual

Called when the operator stops being used as a preconditioner.

Reimplemented from amrex::MLLinOpT< MF >.

◆ Fapply()

template<typename MF >
virtual void amrex::MLCellLinOpT< MF >::Fapply ( int  amrlev,
int  mglev,
MF &  out,
const MF &  in 
) const
pure virtual

◆ FFlux()

template<typename MF >
virtual void amrex::MLCellLinOpT< MF >::FFlux ( int  amrlev,
const MFIter mfi,
const Array< FAB *, 3 > &  flux,
const FAB sol,
Location  loc,
int  face_only = 0 
) const
pure virtual

◆ fixSolvabilityByOffset()

template<typename MF >
void amrex::MLCellLinOpT< MF >::fixSolvabilityByOffset ( int  amrlev,
int  mglev,
MF &  rhs,
Vector< RT > const &  offset 
) const
overridevirtual

Apply solvability offsets to the RHS (subtracting the average).

Parameters
amrlevAMR level index.
mglevMultigrid level index.
rhsRight-hand side updated in place.
offsetOffsets returned by getSolvabilityOffset().

Reimplemented from amrex::MLLinOpT< MF >.

◆ Fsmooth()

template<typename MF >
virtual void amrex::MLCellLinOpT< MF >::Fsmooth ( int  amrlev,
int  mglev,
MF &  sol,
const MF &  rhs,
int  redblack 
) const
pure virtual

◆ getSolvabilityOffset()

template<typename MF >
auto amrex::MLCellLinOpT< MF >::getSolvabilityOffset ( int  amrlev,
int  mglev,
MF const &  rhs 
) const
overridevirtual

Compute the average offset needed to enforce solvability constraints.

Parameters
amrlevAMR level index.
mglevMultigrid level index.
rhsRight-hand side used to evaluate the offset.
Returns
Per-component offsets.

Reimplemented from amrex::MLLinOpT< MF >.

◆ interpAssign()

template<typename MF >
void amrex::MLCellLinOpT< MF >::interpAssign ( int  amrlev,
int  fmglev,
MF &  fine,
MF &  crse 
) const
overridevirtual

Overwrite fine data with the prolongation of coarse data (fine = prolong(crse)).

Parameters
amrlevAMR level index.
fmglevMultigrid level index within that AMR level.
fineDestination fine-grid data (overwritten in place).
crseSource coarse-grid data (its ghost cells may be modified).

Reimplemented from amrex::MLLinOpT< MF >.

◆ interpolation()

template<typename MF >
void amrex::MLCellLinOpT< MF >::interpolation ( int  amrlev,
int  fmglev,
MF &  fine,
const MF &  crse 
) const
overridevirtual

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

Parameters
amrlevAMR level index.
fmglevMultigrid level index within that AMR level.
fineDestination fine-grid data (updated in place).
crseSource coarse-grid data.

Implements amrex::MLLinOpT< MF >.

◆ interpolationAmr()

template<typename MF >
void amrex::MLCellLinOpT< MF >::interpolationAmr ( int  famrlev,
MF &  fine,
const MF &  crse,
IntVect const &  nghost 
) const
overridevirtual

Prolong AMR-level data during FMG initialization.

Parameters
famrlevFine AMR level receiving the data.
fineDestination fine data.
crseSource coarse data.
nghostRequested grow cells (currently unused in this base implementation; overrides may use it).

Reimplemented from amrex::MLLinOpT< MF >.

◆ isCrossStencil()

template<typename MF >
virtual bool amrex::MLCellLinOpT< MF >::isCrossStencil ( ) const
inlinevirtual

Whether the stencil is the cross shape.

Reimplemented in amrex::MLEBTensorOp, amrex::MLTensorOp, and amrex::MLEBABecLap.

◆ isTensorOp()

template<typename MF >
virtual bool amrex::MLCellLinOpT< MF >::isTensorOp ( ) const
inlinevirtual

Whether this operator is a tensor solve.

Reimplemented in amrex::MLEBTensorOp, and amrex::MLTensorOp.

◆ makeNGrids()

template<typename MF >
BoxArray amrex::MLCellLinOpT< MF >::makeNGrids ( int  grid_size) const

Helper that builds a BoxArray for NSolve with boxes no larger than the requested grid_size.

◆ needsUpdate()

template<typename MF >
bool amrex::MLCellLinOpT< MF >::needsUpdate ( ) const
inlineoverridevirtual

Does it need update if it's reused?

Reimplemented from amrex::MLLinOpT< MF >.

Reimplemented in amrex::MLEBTensorOp, amrex::MLTensorOp, and amrex::MLEBABecLap.

◆ norm2Precond()

template<typename MF >
auto amrex::MLCellLinOpT< MF >::norm2Precond ( Vector< MF const * > const &  x) const
finalvirtual

L2 norm over the composite AMR hierarchy, excluding cells covered by finer levels (used when the operator is a preconditioner).

Parameters
xVector of MultiFabs (one per AMR level).
Returns
Resulting norm.

Reimplemented from amrex::MLLinOpT< MF >.

◆ normInf()

template<typename MF >
auto amrex::MLCellLinOpT< MF >::normInf ( int  amrlev,
MF const &  mf,
bool  local 
) const
overridevirtual

Infinity norm helper used by solvers and diagnostics.

Parameters
amrlevAMR level index.
mfMultiFab to measure.
localTrue to skip parallel reduction.

Implements amrex::MLLinOpT< MF >.

◆ operator=() [1/2]

template<typename MF >
MLCellLinOpT< MF > & amrex::MLCellLinOpT< MF >::operator= ( const MLCellLinOpT< MF > &  )
delete

◆ operator=() [2/2]

template<typename MF >
MLCellLinOpT< MF > & amrex::MLCellLinOpT< MF >::operator= ( MLCellLinOpT< MF > &&  )
delete

◆ prepareForFluxes()

template<typename MF >
void amrex::MLCellLinOpT< MF >::prepareForFluxes ( int  amrlev,
const MF *  crse_bcdata = nullptr 
)
overridevirtual

Ensure BC caches are ready for flux computations (e.g., getFluxes).

Parameters
amrlevAMR level index.
crse_bcdataOptional coarse BC data applied during setup.

Reimplemented from amrex::MLLinOpT< MF >.

◆ prepareForSolve()

template<typename MF >
void amrex::MLCellLinOpT< MF >::prepareForSolve ( )
overridevirtual

Prepare multilevel metadata before MLMG iterates (coefficients, BC caches, etc.).

Implements amrex::MLLinOpT< MF >.

Reimplemented in amrex::MLEBTensorOp, amrex::MLPoissonT< MF >, amrex::MLTensorOp, and amrex::MLEBABecLap.

◆ reflux()

template<typename MF >
void amrex::MLCellLinOpT< MF >::reflux ( int  crse_amrlev,
MF &  res,
const MF &  crse_sol,
const MF &  ,
MF &  ,
MF &  fine_sol,
const MF &   
) const
finalvirtual

Reflux fine-level fluxes into the coarse residual.

The unnamed arguments are the coarse RHS, fine residual, and fine RHS required by the MLLinOp interface; they are unused for cell-centered ABec ops. Assumes coarse solutions already have valid ghost cells while fine solutions do not.

Parameters
crse_amrlevCoarse AMR level receiving refluxed updates.
resResidual updated in place on the coarse level.
crse_solCoarse solution whose fluxes enter the reflux.
fine_solFine solution that supplies the opposing fluxes.

Reimplemented from amrex::MLLinOpT< MF >.

◆ restriction()

template<typename MF >
void amrex::MLCellLinOpT< MF >::restriction ( int  amrlev,
int  cmglev,
MF &  crse,
MF &  fine 
) const
overridevirtual

Restrict a fine-grid field onto its coarse counterpart.

Parameters
amrlevAMR level whose data are being restricted.
cmglevMultigrid level index on that AMR level.
crseDestination MultiFab on the coarse level.
fineSource MultiFab on the fine level.

Implements amrex::MLLinOpT< MF >.

◆ setGaussSeidel()

template<typename MF >
void amrex::MLCellLinOpT< MF >::setGaussSeidel ( bool  flag)
inlinenoexcept

Toggle Gauss–Seidel smoothing in place of Jacobi relaxation.

Parameters
flagTrue selects Gauss–Seidel; false selects Jacobi. (Gauss–Seidel is the default.)

◆ setInterpBndryHalfWidth()

template<typename MF >
void amrex::MLCellLinOpT< MF >::setInterpBndryHalfWidth ( int  w)
inline

Control how many cells the interpolation boundary stencil spans.

Parameters
wHalf-width (in cells) for the interpolation boundary stencil.

◆ setLevelBC() [1/2]

template<typename MF >
template<MultiFabLike AMF>
requires (!std::same_as<MF,AMF>)
void amrex::MLCellLinOpT< MF >::setLevelBC ( int  amrlev,
const AMF *  levelbcdata,
const AMF *  robinbc_a = nullptr,
const AMF *  robinbc_b = nullptr,
const AMF *  robinbc_f = nullptr 
)
inline

◆ setLevelBC() [2/2]

template<typename MF >
void amrex::MLCellLinOpT< MF >::setLevelBC ( int  amrlev,
const MF *  levelbcdata,
const MF *  robinbc_a = nullptr,
const MF *  robinbc_b = nullptr,
const MF *  robinbc_f = nullptr 
)
finalvirtual

Provide per-level inhomogeneous boundary data.

Robin coefficients are required (non-null) when the operator has active Robin BCs; otherwise they are optional and passing nullptr keeps any previously stored values.

Parameters
amrlevTarget AMR level.
levelbcdataInhomogeneous BC data (nullptr uses homogeneous BCs).
robinbc_aRobin a coefficient MultiFab.
robinbc_bRobin b coefficient MultiFab.
robinbc_fRobin f coefficient MultiFab.

Implements amrex::MLLinOpT< MF >.

◆ smooth()

template<typename MF >
void amrex::MLCellLinOpT< MF >::smooth ( int  amrlev,
int  mglev,
MF &  sol,
const MF &  rhs,
bool  skip_fillboundary,
int  niter 
) const
finalvirtual

Perform niter smoothing iterations on the supplied residual equation.

Parameters
amrlevAMR level index.
mglevMultigrid level index.
solCorrection updated in place.
rhsRight-hand side for the current level.
skip_fillboundaryTrue to assume ghost cells are already filled.
niterNumber of smoothing passes to execute.

Implements amrex::MLLinOpT< MF >.

◆ solutionResidual()

template<typename MF >
void amrex::MLCellLinOpT< MF >::solutionResidual ( int  amrlev,
MF &  resid,
MF &  x,
const MF &  b,
const MF *  crse_bcdata = nullptr 
)
overridevirtual

Compute the residual resid = b - A(x) using solution boundary data.

Parameters
amrlevAMR level index.
residResidual MultiFab (output).
xSolution MultiFab.
bRight-hand side MultiFab.
crse_bcdataOptional coarse data used to populate coarse/fine BCs.

Implements amrex::MLLinOpT< MF >.

◆ unapplyMetricTerm()

template<typename MF >
void amrex::MLCellLinOpT< MF >::unapplyMetricTerm ( int  amrlev,
int  mglev,
MF &  rhs 
) const
finalvirtual

Remove metric scaling previously applied to the RHS.

Parameters
amrlevAMR level index.
mglevMultigrid level index.
rhsRight-hand side updated in place.

Reimplemented from amrex::MLLinOpT< MF >.

◆ update()

template<typename MF >
void amrex::MLCellLinOpT< MF >::update ( )
overridevirtual

Update for reuse.

Reimplemented from amrex::MLLinOpT< MF >.

Reimplemented in amrex::MLEBTensorOp, amrex::MLTensorOp, and amrex::MLEBABecLap.

◆ updateCorBC()

template<typename MF >
void amrex::MLCellLinOpT< MF >::updateCorBC ( int  amrlev,
const MF &  crse_bcdata 
) const

Refresh stored correction BC data from coarse inputs.

Parameters
amrlevAMR level index being refreshed.
crse_bcdataCoarse BC MultiFab copied into the correction cache.

◆ updateSolBC()

template<typename MF >
void amrex::MLCellLinOpT< MF >::updateSolBC ( int  amrlev,
const MF &  crse_bcdata 
) const

Refresh stored solution BC data from coarse inputs.

Parameters
amrlevAMR level index being refreshed.
crse_bcdataCoarse BC MultiFab copied into the cache.

◆ xdoty()

template<typename MF >
auto amrex::MLCellLinOpT< MF >::xdoty ( int  amrlev,
int  mglev,
const MF &  x,
const MF &  y,
bool  local 
) const
finalvirtual

Dot product helper.

Parameters
amrlevAMR level index.
mglevMultigrid level index.
xFirst field.
ySecond field.
localTrue to skip the MPI reduction.
Returns
Dot product.

Implements amrex::MLLinOpT< MF >.

Member Data Documentation

◆ m_bcondloc

template<typename MF >
Vector<Vector<std::unique_ptr<BndryCondLoc> > > amrex::MLCellLinOpT< MF >::m_bcondloc
protected

◆ m_bndry_cor

template<typename MF >
Vector<std::unique_ptr<MLMGBndryT<MF> > > amrex::MLCellLinOpT< MF >::m_bndry_cor
protected

◆ m_bndry_sol

template<typename MF >
Vector<std::unique_ptr<MLMGBndryT<MF> > > amrex::MLCellLinOpT< MF >::m_bndry_sol
protected

◆ m_bndry_sol_zero

template<typename MF >
Vector<std::unique_ptr<MLMGBndryT<MF> > > amrex::MLCellLinOpT< MF >::m_bndry_sol_zero
protected

◆ m_crse_cor_br

template<typename MF >
Vector<std::unique_ptr<BndryRegisterT<MF> > > amrex::MLCellLinOpT< MF >::m_crse_cor_br
protected

◆ m_crse_sol_br

template<typename MF >
Vector<std::unique_ptr<BndryRegisterT<MF> > > amrex::MLCellLinOpT< MF >::m_crse_sol_br
protected

◆ m_fluxreg

template<typename MF >
Vector<YAFluxRegisterT<MF> > amrex::MLCellLinOpT< MF >::m_fluxreg
mutableprotected

◆ m_has_metric_term

template<typename MF >
bool amrex::MLCellLinOpT< MF >::m_has_metric_term = false
protected

◆ m_maskvals

template<typename MF >
Vector<Vector<Array<MultiMask,2*3> > > amrex::MLCellLinOpT< MF >::m_maskvals
protected

◆ m_norm_fine_mask

template<typename MF >
Vector<std::unique_ptr<iMultiFab> > amrex::MLCellLinOpT< MF >::m_norm_fine_mask
protected

◆ m_robin_bcval

template<typename MF >
Vector<std::unique_ptr<MF> > amrex::MLCellLinOpT< MF >::m_robin_bcval

◆ m_undrrelxr

template<typename MF >
Vector<Vector<BndryRegisterT<MF> > > amrex::MLCellLinOpT< MF >::m_undrrelxr
mutableprotected

◆ m_use_gauss_seidel

template<typename MF >
bool amrex::MLCellLinOpT< MF >::m_use_gauss_seidel = true
protected

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