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

Nodal finite-difference Laplacian with optional embedded boundaries. More...

#include <AMReX_MLEBNodeFDLaplacian.H>

Inheritance diagram for amrex::MLEBNodeFDLaplacian:
amrex::MLNodeLinOp amrex::MLLinOpT< MF >

Public Member Functions

 MLEBNodeFDLaplacian ()=default
 
 MLEBNodeFDLaplacian (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const LPInfo &a_info, const Vector< EBFArrayBoxFactory const * > &a_factory)
 Construct directly from EB-aware factories.
 
 MLEBNodeFDLaplacian (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const LPInfo &a_info)
 Construct without EB data (works in non-EB builds as well).
 
 ~MLEBNodeFDLaplacian () override=default
 
 MLEBNodeFDLaplacian (const MLEBNodeFDLaplacian &)=delete
 
 MLEBNodeFDLaplacian (MLEBNodeFDLaplacian &&)=delete
 
MLEBNodeFDLaplacianoperator= (const MLEBNodeFDLaplacian &)=delete
 
MLEBNodeFDLaplacianoperator= (MLEBNodeFDLaplacian &&)=delete
 
void setSigma (Array< Real, 3 > const &a_sigma) noexcept
 Assign constant diagonal conductivity tensor sigma.
 
void setSigma (int amrlev, MultiFab const &a_sigma)
 Provide conductivity as a cell-centered MultiFab on AMR level amrlev.
 
void setRZ (bool flag)
 Enable/disable RZ corrections (radial metrics).
 
void setAlpha (Real a_alpha)
 Set the radial alpha/r^2 term used when RZ is enabled.
 
void setEBDirichlet (Real a_phi_eb)
 Override phi on embedded boundaries (constant value).
 
template<typename F >
requires (IsCallableR<Real,F, Real , Real , Real >::value)
void setEBDirichlet (F const &f)
 Override EB Dirichlet values using a coordinate-dependent callable.
 
void define (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const LPInfo &a_info, const Vector< EBFArrayBoxFactory const * > &a_factory)
 Define the hierarchy using EB factories (captures cut-cell layout).
 
std::unique_ptr< FabFactory< FArrayBox > > makeFactory (int amrlev, int mglev) const final
 EB-aware factory allocator for (amrlev,mglev).
 
bool scaleRHS (int amrlev, MultiFab *rhs) const final
 
void define (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const LPInfo &a_info)
 Define the hierarchy when embedded boundaries are absent.
 
std::string name () const override
 
void restriction (int amrlev, int cmglev, MultiFab &crse, MultiFab &fine) const final
 Restrict nodal data from fine to coarse MG levels.
 
void interpolation (int amrlev, int fmglev, MultiFab &fine, const MultiFab &crse) const final
 Add the prolongation of coarse data onto the fine grid (fine += prolong(crse)).
 
bool needsUpdate () const override
 Does it need update if it's reused?
 
void update () override
 Update for reuse.
 
void prepareForSolve () final
 Finalize sigma/alpha/EB data prior to invoking MLMG.
 
void Fapply (int amrlev, int mglev, MultiFab &out, const MultiFab &in) const final
 Apply the nodal operator to in and write to out.
 
void Fsmooth (int amrlev, int mglev, MultiFab &sol, const MultiFab &rhs) const final
 Perform the nodal smoother on (amrlev,mglev).
 
void normalize (int amrlev, int mglev, MultiFab &mf) const final
 Divide mf by the diagonal of the operator (used by CG-family bottom solvers).
 
void fixUpResidualMask (int amrlev, iMultiFab &resmsk) final
 Adjust the residual mask resmsk to honor EB Dirichlet nodes (not yet implemented).
 
bool isSingular (int) const final
 Is it singular on AMR level amrlev?
 
bool isBottomSingular () const final
 Is the bottom of the multigrid hierarchy singular?
 
void compGrad (int amrlev, const Array< MultiFab *, 3 > &grad, MultiFab &sol, Location) const override
 Compute gradients of sol into grad.
 
void postSolve (Vector< MultiFab * > const &sol) const override
 Post-process the solution hierarchy.
 
- Public Member Functions inherited from amrex::MLNodeLinOp
 MLNodeLinOp ()
 
 ~MLNodeLinOp () override=default
 
 MLNodeLinOp (const MLNodeLinOp &)=delete
 
 MLNodeLinOp (MLNodeLinOp &&)=delete
 
MLNodeLinOpoperator= (const MLNodeLinOp &)=delete
 
MLNodeLinOpoperator= (MLNodeLinOp &&)=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< FArrayBox > const * > &a_factory={}, int a_eb_limit_coarsening=-1)
 Bind the nodal operator to an AMR hierarchy.
 
void setSmoothNumSweeps (int nsweeps) noexcept
 Control how many smoother passes are executed inside each Fsmooth call.
 
void setLevelBC (int, const MultiFab *, const MultiFab *=nullptr, const MultiFab *=nullptr, const MultiFab *=nullptr) final
 
void apply (int amrlev, int mglev, MultiFab &out, MultiFab &in, BCMode bc_mode, StateMode s_mode, const MLMGBndry *bndry=nullptr) const final
 Apply the nodal operator with the requested BC/state modes.
 
void smooth (int amrlev, int mglev, MultiFab &sol, const MultiFab &rhs, bool skip_fillboundary, int niter) const override
 Invoke the nodal smoother on (amrlev,mglev).
 
void solutionResidual (int amrlev, MultiFab &resid, MultiFab &x, const MultiFab &b, const MultiFab *crse_bcdata=nullptr) override
 Residual helper that uses solution BCs and optional coarse data (operates on AMR level amrlev).
 
void correctionResidual (int amrlev, int mglev, MultiFab &resid, MultiFab &x, const MultiFab &b, BCMode bc_mode, const MultiFab *crse_bcdata=nullptr) override
 Residual helper for correction solves (optionally homogeneous BCs) on (amrlev,mglev).
 
Vector< RealgetSolvabilityOffset (int amrlev, int mglev, MultiFab const &rhs) const override
 Return component-wise solvability offsets for (amrlev,mglev, rhs).
 
void fixSolvabilityByOffset (int amrlev, int mglev, MultiFab &rhs, Vector< Real > const &offset) const override
 Subtract offsets produced by getSolvabilityOffset() from rhs.
 
void prepareForSolve () override
 Prepare BC caches, masks, and metadata prior to solving.
 
void preparePrecond () override
 Prepare auxiliary data used when the operator acts as a preconditioner.
 
void setDirichletNodesToZero (int amrlev, int mglev, MultiFab &mf) const override
 Zero Dirichlet nodes in mf before a correction or residual pass.
 
bool isSingular (int amrlev) const override
 Is it singular on AMR level amrlev?
 
bool isBottomSingular () const override
 Is the bottom of the multigrid hierarchy singular?
 
Real xdoty (int amrlev, int mglev, const MultiFab &x, const MultiFab &y, bool local) const final
 Dot-product helper.
 
Real dotProductPrecond (Vector< MultiFab const * > const &x, Vector< MultiFab const * > const &y) const final
 Dot product used when the operator acts as a preconditioner.
 
Real norm2Precond (Vector< MultiFab const * > const &x) const final
 L2 norm used when the operator acts as a preconditioner.
 
virtual void applyBC (int amrlev, int mglev, MultiFab &phi, BCMode bc_mode, StateMode state_mode, bool skip_fillboundary=false) const
 Apply physical BCs prior to smoothing/apply.
 
void nodalSync (int amrlev, int mglev, MultiFab &mf) const
 Synchronize nodal values across box/partition boundaries on (amrlev,mglev).
 
void buildMasks ()
 Build Dirichlet/dot-product masks and determine bottom singularity.
 
void setOversetMask (int amrlev, const iMultiFab &a_dmask)
 Mark nodes that belong to overset (known) regions.
 
Real normInf (int amrlev, MultiFab const &mf, bool local) const override
 Infinity norm helper operating on level amrlev (set local to true to skip MPI reduction).
 
void avgDownResAmr (int, MultiFab &, MultiFab const &) const final
 Nodal average-down for residuals between AMR levels (no-op here).
 
void interpolationAmr (int famrlev, MultiFab &fine, const MultiFab &crse, IntVect const &nghost) const override
 Prolong AMR-level data during FMG initialization.
 
void averageDownAndSync (Vector< MultiFab > &sol) const override
 Average nodal solutions down the AMR hierarchy and synchronize overlaps.
 
void interpAssign (int amrlev, int fmglev, MultiFab &fine, MultiFab &crse) const override
 Overwrite fine data with the prolongation of coarse data (fine = prolong(crse)).
 
- 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.
 
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
 
virtual void setLevelBC (int, const MF *, const MF *=nullptr, const MF *=nullptr, const MF *=nullptr)=0
 Set boundary conditions for given level. For cell-centered solves only.
 
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 restriction (int amrlev, int cmglev, MF &crse, MF &fine) const =0
 Restriction onto coarse MG level.
 
virtual void interpolation (int amrlev, int fmglev, MF &fine, const MF &crse) const =0
 Add interpolated coarse MG level data to fine MG level data.
 
virtual void interpAssign (int amrlev, int fmglev, MF &fine, MF &crse) const
 Overwrite fine MG level data with interpolated coarse data.
 
virtual void interpolationAmr (int famrlev, MF &fine, const MF &crse, IntVect const &nghost) const
 Interpolation between AMR levels.
 
virtual void averageDownSolutionRHS (int camrlev, MF &crse_sol, MF &crse_rhs, const MF &fine_sol, const MF &fine_rhs)
 Average-down data from fine AMR level to coarse AMR level.
 
virtual void apply (int amrlev, int mglev, MF &out, MF &in, BCMode bc_mode, StateMode s_mode, const MLMGBndryT< MF > *bndry=nullptr) const =0
 Apply the linear operator, out = L(in)
 
virtual void smooth (int amrlev, int mglev, MF &sol, const MF &rhs, bool skip_fillboundary, int niter) const =0
 Smooth.
 
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 solutionResidual (int amrlev, MF &resid, MF &x, const MF &b, const MF *crse_bcdata=nullptr)=0
 Compute residual for solution.
 
virtual void prepareForFluxes (int amrlev, const MF *crse_bcdata=nullptr)
 Ensure BC caches are populated before flux extraction.
 
virtual void correctionResidual (int amrlev, int mglev, MF &resid, MF &x, const MF &b, BCMode bc_mode, const MF *crse_bcdata=nullptr)=0
 Compute residual for the residual-correction form, resid = b - L(x)
 
virtual void reflux (int crse_amrlev, MF &res, const MF &crse_sol, const MF &crse_rhs, MF &fine_res, MF &fine_sol, const MF &fine_rhs) const
 Reflux at AMR coarse/fine boundary.
 
virtual void compFlux (int amrlev, const Array< MF *, 3 > &fluxes, MF &sol, Location loc) const
 Compute fluxes.
 
virtual void compGrad (int amrlev, const Array< MF *, 3 > &grad, MF &sol, Location loc) const
 Compute gradients of the solution.
 
virtual void applyMetricTerm (int amrlev, int mglev, MF &rhs) const
 Apply metric scaling to the RHS on (amrlev,mglev).
 
virtual void unapplyMetricTerm (int amrlev, int mglev, MF &rhs) const
 Remove metric scaling previously applied via applyMetricTerm().
 
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 Vector< RTgetSolvabilityOffset (int amrlev, int mglev, MF const &rhs) const
 Compute offsets used to enforce solvability (per component).
 
virtual void fixSolvabilityByOffset (int amrlev, int mglev, MF &rhs, Vector< RT > const &offset) const
 Subtract previously computed offsets from the RHS.
 
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 RT xdoty (int amrlev, int mglev, const MF &x, const MF &y, bool local) const =0
 Dot-product helper used by bottom solvers.
 
virtual RT dotProductPrecond (Vector< MF const * > const &x, Vector< MF 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< MF 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< 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 RT normInf (int amrlev, MF const &mf, bool local) const =0
 Infinity norm helper used by residual reductions.
 
virtual void averageDownAndSync (Vector< MF > &sol) const =0
 Average the solution hierarchy down (fine to coarse) and synchronize interfaces.
 
virtual void avgDownResAmr (int clev, MF &cres, MF const &fres) const
 
virtual void avgDownResMG (int clev, MF &cres, MF 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 Types inherited from amrex::MLNodeLinOp
enum struct  CoarseningStrategy : int { Sigma , RAP }
 
- 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
 
- Static Public Member Functions inherited from amrex::MLNodeLinOp
static std::unique_ptr< iMultiFabmakeOwnerMask (const BoxArray &ba, const DistributionMapping &dm, const Geometry &geom)
 Build a nodal mask that marks points owned by this rank (used for sync).
 
- 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 Member Functions inherited from amrex::MLNodeLinOp
void resizeMultiGrid (int new_size) override
 
- 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.
 
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
 
- Protected Attributes inherited from amrex::MLNodeLinOp
std::unique_ptr< iMultiFabm_owner_mask_top
 
std::unique_ptr< iMultiFabm_owner_mask_bottom
 
Vector< Vector< std::unique_ptr< iMultiFab > > > m_dirichlet_mask
 
Vector< std::unique_ptr< iMultiFab > > m_cc_fine_mask
 
Vector< std::unique_ptr< iMultiFab > > m_nd_fine_mask
 
Vector< std::unique_ptr< LayoutData< int > > > m_has_fine_bndry
 
MultiFab m_bottom_dot_mask
 
MultiFab m_coarse_dot_mask
 
Vector< MultiFabm_precond_weight_mask
 
Vector< std::unique_ptr< iMultiFab > > m_norm_fine_mask
 
CoarseningStrategy m_coarsening_strategy = CoarseningStrategy::RAP
 
bool m_masks_built = false
 
bool m_overset_dirichlet_mask = false
 
int m_smooth_num_sweeps = 4
 
bool m_in_solution_mode = 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
 
- Static Protected Attributes inherited from amrex::MLLinOpT< MF >
static constexpr int mg_coarsen_ratio = 2
 
static constexpr int mg_box_min_width = 2
 

Detailed Description

Nodal finite-difference Laplacian with optional embedded boundaries.

Handles both Cartesian and RZ geometries, supports tensor-diagonal conductivity (sigma) provided either as scalars or MultiFabs, and enforces Dirichlet EB values when factories expose geometry information.

Constructor & Destructor Documentation

◆ MLEBNodeFDLaplacian() [1/5]

amrex::MLEBNodeFDLaplacian::MLEBNodeFDLaplacian ( )
default

◆ MLEBNodeFDLaplacian() [2/5]

amrex::MLEBNodeFDLaplacian::MLEBNodeFDLaplacian ( const Vector< Geometry > &  a_geom,
const Vector< BoxArray > &  a_grids,
const Vector< DistributionMapping > &  a_dmap,
const LPInfo a_info,
const Vector< EBFArrayBoxFactory const * > &  a_factory 
)

Construct directly from EB-aware factories.

◆ MLEBNodeFDLaplacian() [3/5]

amrex::MLEBNodeFDLaplacian::MLEBNodeFDLaplacian ( const Vector< Geometry > &  a_geom,
const Vector< BoxArray > &  a_grids,
const Vector< DistributionMapping > &  a_dmap,
const LPInfo a_info 
)

Construct without EB data (works in non-EB builds as well).

◆ ~MLEBNodeFDLaplacian()

amrex::MLEBNodeFDLaplacian::~MLEBNodeFDLaplacian ( )
overridedefault

◆ MLEBNodeFDLaplacian() [4/5]

amrex::MLEBNodeFDLaplacian::MLEBNodeFDLaplacian ( const MLEBNodeFDLaplacian )
delete

◆ MLEBNodeFDLaplacian() [5/5]

amrex::MLEBNodeFDLaplacian::MLEBNodeFDLaplacian ( MLEBNodeFDLaplacian &&  )
delete

Member Function Documentation

◆ compGrad()

void amrex::MLEBNodeFDLaplacian::compGrad ( int  amrlev,
const Array< MultiFab *, 3 > &  grad,
MultiFab sol,
Location   
) const
override

Compute gradients of sol into grad.

Parameters
amrlevAMR level index.
gradDestination gradients per direction.
solSolution supplying nodal values.

◆ define() [1/2]

void amrex::MLEBNodeFDLaplacian::define ( const Vector< Geometry > &  a_geom,
const Vector< BoxArray > &  a_grids,
const Vector< DistributionMapping > &  a_dmap,
const LPInfo a_info 
)

Define the hierarchy when embedded boundaries are absent.

Parameters
a_geomPer-level geometries.
a_gridsPer-level grids.
a_dmapDistribution mappings.
a_infoOptional LPInfo overrides.

◆ define() [2/2]

void amrex::MLEBNodeFDLaplacian::define ( const Vector< Geometry > &  a_geom,
const Vector< BoxArray > &  a_grids,
const Vector< DistributionMapping > &  a_dmap,
const LPInfo a_info,
const Vector< EBFArrayBoxFactory const * > &  a_factory 
)

Define the hierarchy using EB factories (captures cut-cell layout).

Parameters
a_geomPer-level geometries.
a_gridsPer-level grids.
a_dmapDistribution mappings.
a_infoLPInfo overrides.
a_factoryEB factories per level.

◆ Fapply()

void amrex::MLEBNodeFDLaplacian::Fapply ( int  amrlev,
int  mglev,
MultiFab out,
const MultiFab in 
) const
finalvirtual

Apply the nodal operator to in and write to out.

Implements amrex::MLNodeLinOp.

◆ fixUpResidualMask()

void amrex::MLEBNodeFDLaplacian::fixUpResidualMask ( int  amrlev,
iMultiFab resmsk 
)
finalvirtual

Adjust the residual mask resmsk to honor EB Dirichlet nodes (not yet implemented).

Reimplemented from amrex::MLNodeLinOp.

◆ Fsmooth()

void amrex::MLEBNodeFDLaplacian::Fsmooth ( int  amrlev,
int  mglev,
MultiFab sol,
const MultiFab rhs 
) const
finalvirtual

Perform the nodal smoother on (amrlev,mglev).

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

Implements amrex::MLNodeLinOp.

◆ interpolation()

void amrex::MLEBNodeFDLaplacian::interpolation ( int  amrlev,
int  fmglev,
MultiFab fine,
const MultiFab crse 
) const
final

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

Parameters
amrlevAMR level index.
fmglevFine MG level index.
fineDestination fine MultiFab (updated in place).
crseSource coarse MultiFab.

◆ isBottomSingular()

bool amrex::MLEBNodeFDLaplacian::isBottomSingular ( ) const
inlinefinalvirtual

Is the bottom of the multigrid hierarchy singular?

Implements amrex::MLLinOpT< MF >.

◆ isSingular()

bool amrex::MLEBNodeFDLaplacian::isSingular ( int  amrlev) const
inlinefinalvirtual

Is it singular on AMR level amrlev?

Implements amrex::MLLinOpT< MF >.

◆ makeFactory()

std::unique_ptr< FabFactory< FArrayBox > > amrex::MLEBNodeFDLaplacian::makeFactory ( int  amrlev,
int  mglev 
) const
finalvirtual

EB-aware factory allocator for (amrlev,mglev).

Reimplemented from amrex::MLLinOpT< MF >.

◆ name()

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

Reimplemented from amrex::MLLinOpT< MF >.

◆ needsUpdate()

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

Does it need update if it's reused?

Reimplemented from amrex::MLLinOpT< MF >.

◆ normalize()

void amrex::MLEBNodeFDLaplacian::normalize ( int  amrlev,
int  mglev,
MultiFab mf 
) const
final

Divide mf by the diagonal of the operator (used by CG-family bottom solvers).

◆ operator=() [1/2]

MLEBNodeFDLaplacian & amrex::MLEBNodeFDLaplacian::operator= ( const MLEBNodeFDLaplacian )
delete

◆ operator=() [2/2]

MLEBNodeFDLaplacian & amrex::MLEBNodeFDLaplacian::operator= ( MLEBNodeFDLaplacian &&  )
delete

◆ postSolve()

void amrex::MLEBNodeFDLaplacian::postSolve ( Vector< MultiFab * > const &  sol) const
override

Post-process the solution hierarchy.

◆ prepareForSolve()

void amrex::MLEBNodeFDLaplacian::prepareForSolve ( )
finalvirtual

Finalize sigma/alpha/EB data prior to invoking MLMG.

Implements amrex::MLLinOpT< MF >.

◆ restriction()

void amrex::MLEBNodeFDLaplacian::restriction ( int  amrlev,
int  cmglev,
MultiFab crse,
MultiFab fine 
) const
final

Restrict nodal data from fine to coarse MG levels.

Parameters
amrlevAMR level index.
cmglevCoarse MG level receiving the restricted data.
crseDestination MultiFab on (amrlev,cmglev).
fineSource MultiFab on the next finer MG level.

◆ scaleRHS()

bool amrex::MLEBNodeFDLaplacian::scaleRHS ( int  amrlev,
MultiFab rhs 
) const
final

◆ setAlpha()

void amrex::MLEBNodeFDLaplacian::setAlpha ( Real  a_alpha)

Set the radial alpha/r^2 term used when RZ is enabled.

◆ setEBDirichlet() [1/2]

template<typename F >
requires (IsCallableR<Real,F, Real , Real , Real >::value)
void amrex::MLEBNodeFDLaplacian::setEBDirichlet ( F const &  f)

Override EB Dirichlet values using a coordinate-dependent callable.

The callable must provide Real operator()(Real x, Real y, Real z) (with unused coordinates ignored in lower dimensions) and returns the desired Dirichlet value.

◆ setEBDirichlet() [2/2]

void amrex::MLEBNodeFDLaplacian::setEBDirichlet ( Real  a_phi_eb)

Override phi on embedded boundaries (constant value).

◆ setRZ()

void amrex::MLEBNodeFDLaplacian::setRZ ( bool  flag)

Enable/disable RZ corrections (radial metrics).

◆ setSigma() [1/2]

void amrex::MLEBNodeFDLaplacian::setSigma ( Array< Real, 3 > const &  a_sigma)
noexcept

Assign constant diagonal conductivity tensor sigma.

◆ setSigma() [2/2]

void amrex::MLEBNodeFDLaplacian::setSigma ( int  amrlev,
MultiFab const &  a_sigma 
)

Provide conductivity as a cell-centered MultiFab on AMR level amrlev.

◆ update()

void amrex::MLEBNodeFDLaplacian::update ( )
overridevirtual

Update for reuse.

Reimplemented from amrex::MLLinOpT< MF >.


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