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

Cell-centered Poisson operator on a terrain-following mesh. More...

#include <AMReX_MLTerrainPoisson.H>

Inheritance diagram for amrex::MLTerrainPoisson:
amrex::MLCellLinOpT< MultiFab > amrex::MLLinOpT< MF >

Classes

struct  BCTag
 

Public Types

enum struct  ZSplitSolver { Spike , Column }
 Line solver for levels whose boxes do not span z. More...
 
using MF = MultiFab
 
using RT = Real
 
using FAB = FArrayBox
 
using BCMode = MLCellLinOpT< MF >::BCMode
 
using StateMode = MLCellLinOpT< MF >::StateMode
 
using Location = MLCellLinOpT< MF >::Location
 
- Public Types inherited from amrex::MLCellLinOpT< MultiFab >
using FAB = typename FabDataType< MultiFab >::fab_type
 
using RT = typename FabDataType< MultiFab >::value_type
 
using BCType = LinOpBCType
 
using BCMode = typename MLLinOpT< MultiFab >::BCMode
 
using StateMode = typename MLLinOpT< MultiFab >::StateMode
 
using Location = typename MLLinOpT< MultiFab >::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

 MLTerrainPoisson ()=default
 
 MLTerrainPoisson (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const LPInfo &a_info=LPInfo())
 Construct the operator. See define().
 
 ~MLTerrainPoisson () override=default
 
 MLTerrainPoisson (const MLTerrainPoisson &)=delete
 
 MLTerrainPoisson (MLTerrainPoisson &&)=delete
 
MLTerrainPoisson & operator= (const MLTerrainPoisson &)=delete
 
MLTerrainPoisson & operator= (MLTerrainPoisson &&)=delete
 
void define (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const LPInfo &a_info=LPInfo())
 Define the operator.
 
void setZPhys (int amrlev, MultiFab const &z_phys_nd)
 Set the physical height of the cell corners.
 
void setAreas (int amrlev, Array< MultiFab const *, 3 > const &area)
 Set the face area factors (required).
 
void setDetJ (int amrlev, MultiFab const &detJ)
 Set the cell volume factor J. If not set, J = 1.
 
void setZSplitSolver (ZSplitSolver a_solver)
 Choose the solver used when boxes are split in z: Spike (the default) or Column.
 
std::string name () const override
 
bool isCrossStencil () const override
 Whether the stencil is the cross shape.
 
BottomSolver getDefaultBottomSolver () const override
 
void prepareForSolve () override
 Prepare multilevel metadata before MLMG iterates (coefficients, BC caches, etc.).
 
bool needsUpdate () const override
 Does it need update if it's reused?
 
void update () override
 Update for reuse.
 
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?
 
bool scaleRHS (int amrlev, MultiFab *rhs) const override
 
void setDirichletNodesToZero (int, int, MultiFab &) const override
 No-op: cell-centered unknowns are never on a Dirichlet boundary.
 
void applyBC (int amrlev, int mglev, MultiFab &in, BCMode bc_mode, StateMode s_mode, const MLMGBndryT< MultiFab > *bndry=nullptr, bool skip_fillboundary=false) const override
 
void interpolation (int amrlev, int fmglev, MultiFab &fine, const MultiFab &crse) const override
 
void Fapply (int amrlev, int mglev, MultiFab &out, const MultiFab &in) const override
 
void Fsmooth (int amrlev, int mglev, MultiFab &sol, const MultiFab &rhs, int redblack) const override
 
void FFlux (int amrlev, const MFIter &mfi, const Array< FAB *, 3 > &flux, const FAB &sol, Location loc, int face_only=0) const override
 
void compGrad (int amrlev, const Array< MultiFab *, 3 > &grad, MultiFab &sol, Location loc) const override
 Compute the terrain-following gradient, i.e., the negative of the flux.
 
mlterrain::BCInfo bcInfo (int mglev) const
 
IntVect coarsenRatio (int mglev) const
 
void fillZPhysGhost (MultiFab &zp, int mglev) const
 
void updateCoefs ()
 
- Public Member Functions inherited from amrex::MLCellLinOpT< MultiFab >
 MLCellLinOpT ()
 
 MLCellLinOpT (const MLCellLinOpT< MultiFab > &)=delete
 
 MLCellLinOpT (MLCellLinOpT< MultiFab > &&)=delete
 
 ~MLCellLinOpT () override=default
 
MLCellLinOpT< MultiFab > & operator= (const MLCellLinOpT< MultiFab > &)=delete
 
MLCellLinOpT< MultiFab > & operator= (MLCellLinOpT< MultiFab > &&)=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 MultiFab *levelbcdata, const MultiFab *robinbc_a=nullptr, const MultiFab *robinbc_b=nullptr, const MultiFab *robinbc_f=nullptr) final
 Provide per-level inhomogeneous boundary data.
 
void setLevelBC (int amrlev, const AMF *levelbcdata, const AMF *robinbc_a=nullptr, const AMF *robinbc_b=nullptr, const AMF *robinbc_f=nullptr)
 
void setGaussSeidel (bool flag) noexcept
 Toggle Gauss–Seidel smoothing in place of Jacobi relaxation.
 
virtual bool isTensorOp () const
 Whether this operator is a tensor solve.
 
void updateSolBC (int amrlev, const MultiFab &crse_bcdata) const
 Refresh stored solution BC data from coarse inputs.
 
void updateCorBC (int amrlev, const MultiFab &crse_bcdata) const
 Refresh stored correction BC data from coarse inputs.
 
virtual void applyBC (int amrlev, int mglev, MultiFab &in, BCMode bc_mode, StateMode s_mode, const MLMGBndryT< MultiFab > *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, MultiFab &crse, MultiFab &fine) const override
 Restrict a fine-grid field onto its coarse counterpart.
 
void interpolation (int amrlev, int fmglev, MultiFab &fine, const MultiFab &crse) const override
 Add the prolongation of coarse data onto the fine grid (fine += prolong(crse)).
 
void interpAssign (int amrlev, int fmglev, MultiFab &fine, MultiFab &crse) const override
 Overwrite fine data with the prolongation of coarse data (fine = prolong(crse)).
 
void interpolationAmr (int famrlev, MultiFab &fine, const MultiFab &crse, IntVect const &nghost) const override
 Prolong AMR-level data during FMG initialization.
 
void averageDownSolutionRHS (int camrlev, MultiFab &crse_sol, MultiFab &crse_rhs, const MultiFab &fine_sol, const MultiFab &fine_rhs) override
 Average fine solution/RHS onto the next coarser AMR level.
 
void apply (int amrlev, int mglev, MultiFab &out, MultiFab &in, BCMode bc_mode, StateMode s_mode, const MLMGBndryT< MultiFab > *bndry=nullptr) const override
 Apply the linear operator with boundary conditions.
 
void smooth (int amrlev, int mglev, MultiFab &sol, const MultiFab &rhs, bool skip_fillboundary, int niter) const override
 Perform niter smoothing iterations on the supplied residual equation.
 
void solutionResidual (int amrlev, MultiFab &resid, MultiFab &x, const MultiFab &b, const MultiFab *crse_bcdata=nullptr) override
 Compute the residual resid = b - A(x) using solution boundary data.
 
void prepareForFluxes (int amrlev, const MultiFab *crse_bcdata=nullptr) override
 Ensure BC caches are ready for flux computations (e.g., getFluxes).
 
void correctionResidual (int amrlev, int mglev, MultiFab &resid, MultiFab &x, const MultiFab &b, BCMode bc_mode, const MultiFab *crse_bcdata=nullptr) final
 Compute the correction residual with optional coarse data.
 
void reflux (int crse_amrlev, MultiFab &res, const MultiFab &crse_sol, const MultiFab &, MultiFab &, MultiFab &fine_sol, const MultiFab &) const final
 Reflux fine-level fluxes into the coarse residual.
 
void compFlux (int amrlev, const Array< MultiFab *, 3 > &fluxes, MultiFab &sol, Location loc) const override
 Compute face-centered fluxes from the supplied solution.
 
void compGrad (int amrlev, const Array< MultiFab *, 3 > &grad, MultiFab &sol, Location loc) const override
 Compute directional gradients of the solution.
 
void applyMetricTerm (int amrlev, int mglev, MultiFab &rhs) const final
 Multiply the RHS by metric terms appropriate for curvilinear coordinates.
 
void unapplyMetricTerm (int amrlev, int mglev, MultiFab &rhs) const final
 Remove metric scaling previously applied to the RHS.
 
Vector< RT > getSolvabilityOffset (int amrlev, int mglev, MultiFab const &rhs) const override
 Compute the average offset needed to enforce solvability constraints.
 
void fixSolvabilityByOffset (int amrlev, int mglev, MultiFab &rhs, Vector< RT > const &offset) const override
 Apply solvability offsets to the RHS (subtracting the average).
 
RT xdoty (int amrlev, int mglev, const MultiFab &x, const MultiFab &y, bool local) const final
 Dot product helper.
 
RT dotProductPrecond (Vector< MultiFab const * > const &x, Vector< MultiFab 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< MultiFab 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 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< MultiFab *, 3 > &, MultiFab const &, bool) const
 Optional hook for adding inhomogeneous Neumann contributions.
 
RT normInf (int amrlev, MultiFab const &mf, bool local) const override
 Infinity norm helper used by solvers and diagnostics.
 
void averageDownAndSync (Vector< MultiFab > &sol) const override
 Average the solution hierarchy down (fine-to-coarse) and sync.
 
void avgDownResAmr (int clev, MultiFab &cres, MultiFab 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.
 
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 setPrintIndentation (std::string s)
 Prefix printed messages (e.g., to indent per level).
 
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 bool supportCustomBottomSolver () const
 Does this operator provide its own bottom solver (BottomSolver::custom)?
 
virtual void customBottomSolve (MLMGT< MF > *mlmg, MF &x, const MF &b, RT eps_rel, RT eps_abs, int maxiter)
 Bottom solve provided by the operator itself.
 
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 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 std::unique_ptr< MLAlgMG > makeAlgMG (int mglev) const
 Build the algebraic system of MG level mglev of AMR level 0 for the AlgMG solver. Operators that hypre supports implement this.
 
virtual bool supportsAlgMG () const
 True if makeAlgMG is implemented for this operator.
 
virtual bool supportsAnisotropicCoarsening () const
 True if the operator supports MG levels coarsened in any subset of directions. Then MLMG coarsens stretched cells only in their short directions until they are nearly cubic.
 
virtual GpuArray< Real, 3 > anisotropicCoarseningCellSize (Geometry const &geom) const
 Cell size used to pick the directions to coarsen when supportsAnisotropicCoarsening() is true. A direction with weaker coupling counts as having longer cells.
 
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 Geometry & Geom (int amr_lev, int mglev=0) const noexcept
 Geometry accessor for (amr_lev,mglev).
 

Additional Inherited Members

- Public Attributes inherited from amrex::MLCellLinOpT< MultiFab >
Vector< std::unique_ptr< MultiFab > > 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 inherited from amrex::MLCellLinOpT< MultiFab >
using RealTuple = Array< RT, 2 *3 >
 
using BCTuple = Array< BoundCond, 2 *3 >
 
- 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 make (int amrlev, int mglev, IntVect const &ng, MFInfo const &mf_info) const
 As above, with caller-selected allocation metadata for temporary storage.
 
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 makeCoarseMG (int amrlev, int mglev, IntVect const &ng, MFInfo const &mf_info) const
 As above, with caller-selected allocation metadata for temporary storage.
 
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 MF makeCoarseAmr (int famrlev, IntVect const &ng, MFInfo const &mf_info) const
 As above, with caller-selected allocation metadata for temporary storage.
 
virtual std::unique_ptr< FabFactory< FAB > > makeFactory (int, int) const
 
virtual void resizeMultiGrid (int new_size)
 
void prepareMGHierarchy ()
 Build the deferred MG levels of AMR level 0 once. See supportsAnisotropicCoarsening.
 
virtual void buildMGHierarchy ()
 Build the MG levels of AMR level 0 below the finest one.
 
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 >
T get_d0 (T const &dx, T const &dy, T const &) const noexcept
 
template<typename T >
T get_d1 (T const &, T const &dy, T const &dz) const noexcept
 
- Protected Attributes inherited from amrex::MLCellLinOpT< MultiFab >
bool m_has_metric_term
 
Vector< std::unique_ptr< MLMGBndryT< MultiFab > > > m_bndry_sol
 
Vector< std::unique_ptr< BndryRegisterT< MultiFab > > > m_crse_sol_br
 
Vector< std::unique_ptr< MLMGBndryT< MultiFab > > > m_bndry_cor
 
Vector< std::unique_ptr< BndryRegisterT< MultiFab > > > m_crse_cor_br
 
Vector< std::unique_ptr< MLMGBndryT< MultiFab > > > m_bndry_sol_zero
 
Vector< Vector< std::unique_ptr< BndryCondLoc > > > m_bcondloc
 
Vector< Vector< BndryRegisterT< MultiFab > > > m_undrrelxr
 
Vector< Vector< Array< MultiMask, 2 *3 > > > m_maskvals
 
Vector< std::unique_ptr< iMultiFab > > m_norm_fine_mask
 
Vector< YAFluxRegisterT< MultiFab > > m_fluxreg
 
bool m_use_gauss_seidel
 
- Protected Attributes inherited from amrex::MLLinOpT< MF >
int mg_box_min_width = 2
 
int mg_domain_min_width = 2
 
int mg_agg_no_split_direction = -1
 
bool mg_odd_coarsening = false
 
bool mg_independent_coarsening = false
 
LPInfo info
 
int verbose = 0
 
std::string print_ident
 
int maxorder = 3
 
bool enforceSingularSolvable = true
 
bool m_mg_deferred = false
 MG levels of AMR level 0 built at first solve.
 
bool m_mg_built = false
 
int m_num_amr_levels = 0
 
Vector< int > m_amr_ref_ratio
 
Vector< int > m_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< IntVect > mg_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_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
 

Detailed Description

Cell-centered Poisson operator on a terrain-following mesh.

The mesh is uniform in computational space, and the physical height of each cell corner is given by a nodal MultiFab (setZPhys). The operator is

L(phi) = div(A grad phi) / J,

where grad is the physical gradient in terrain-following form, A holds the face area factors (setAreas) and J is the cell volume factor (setDetJ). The flux on a Neumann domain face is zero. MLMG solves the J-scaled system div(A grad phi) = J rhs, so apply and the residuals compute div(A grad phi), without the division by J.

Only 3D, a single AMR level whose grids cover the domain, and homogeneous boundary conditions are supported. The level BC must be set with setLevelBC(0, nullptr). The operator is not symmetric; use BiCGStab or the smoother as the bottom solver. It can be used with MLMG or with GMRESMLMG, which always uses the smoother as the bottom solver. The semicoarsening settings in LPInfo are ignored.

Boxes that span the whole domain in z are fastest, but boxes split in z are also supported.

Member Typedef Documentation

◆ BCMode

◆ FAB

◆ Location

◆ MF

◆ RT

◆ StateMode

Member Enumeration Documentation

◆ ZSplitSolver

Line solver for levels whose boxes do not span z.

Enumerator
Spike 
Column 

Constructor & Destructor Documentation

◆ MLTerrainPoisson() [1/4]

amrex::MLTerrainPoisson::MLTerrainPoisson ( )
default

◆ MLTerrainPoisson() [2/4]

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

Construct the operator. See define().

◆ ~MLTerrainPoisson()

amrex::MLTerrainPoisson::~MLTerrainPoisson ( )
overridedefault

◆ MLTerrainPoisson() [3/4]

amrex::MLTerrainPoisson::MLTerrainPoisson ( const MLTerrainPoisson &  )
delete

◆ MLTerrainPoisson() [4/4]

amrex::MLTerrainPoisson::MLTerrainPoisson ( MLTerrainPoisson &&  )
delete

Member Function Documentation

◆ applyBC()

void amrex::MLTerrainPoisson::applyBC ( int  amrlev,
int  mglev,
MultiFab &  in,
BCMode  bc_mode,
StateMode  s_mode,
const MLMGBndryT< MultiFab > *  bndry = nullptr,
bool  skip_fillboundary = false 
) const
override

◆ bcInfo()

mlterrain::BCInfo amrex::MLTerrainPoisson::bcInfo ( int  mglev) const

◆ coarsenRatio()

IntVect amrex::MLTerrainPoisson::coarsenRatio ( int  mglev) const

◆ compGrad()

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

Compute the terrain-following gradient, i.e., the negative of the flux.

◆ define()

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

Define the operator.

Parameters
a_geomGeometry. Only one AMR level is supported.
a_gridsBoxArray, which must cover the domain.
a_dmapDistributionMapping.
a_infoLPInfo.

◆ Fapply()

void amrex::MLTerrainPoisson::Fapply ( int  amrlev,
int  mglev,
MultiFab &  out,
const MultiFab &  in 
) const
overridevirtual

◆ FFlux()

void amrex::MLTerrainPoisson::FFlux ( int  amrlev,
const MFIter &  mfi,
const Array< FAB *, 3 > &  flux,
const FAB &  sol,
Location  loc,
int  face_only = 0 
) const
override

◆ fillZPhysGhost()

void amrex::MLTerrainPoisson::fillZPhysGhost ( MultiFab &  zp,
int  mglev 
) const

◆ Fsmooth()

void amrex::MLTerrainPoisson::Fsmooth ( int  amrlev,
int  mglev,
MultiFab &  sol,
const MultiFab &  rhs,
int  redblack 
) const
overridevirtual

◆ getDefaultBottomSolver()

BottomSolver amrex::MLTerrainPoisson::getDefaultBottomSolver ( ) const
inlineoverridevirtual

The smoother if the coarsest level covers the domain with at most 5x5 columns, else BiCGStab.

Reimplemented from amrex::MLLinOpT< MF >.

◆ interpolation()

void amrex::MLTerrainPoisson::interpolation ( int  amrlev,
int  fmglev,
MultiFab &  fine,
const MultiFab &  crse 
) const
override

◆ isBottomSingular()

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

Is the bottom of the multigrid hierarchy singular?

Implements amrex::MLLinOpT< MF >.

◆ isCrossStencil()

bool amrex::MLTerrainPoisson::isCrossStencil ( ) const
inlineoverridevirtual

Whether the stencil is the cross shape.

Reimplemented from amrex::MLCellLinOpT< MultiFab >.

◆ isSingular()

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

Is it singular on AMR level amrlev?

Implements amrex::MLLinOpT< MF >.

◆ name()

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

Reimplemented from amrex::MLLinOpT< MF >.

◆ needsUpdate()

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

Does it need update if it's reused?

Reimplemented from amrex::MLCellLinOpT< MultiFab >.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ prepareForSolve()

void amrex::MLTerrainPoisson::prepareForSolve ( )
overridevirtual

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

Reimplemented from amrex::MLCellLinOpT< MultiFab >.

◆ scaleRHS()

bool amrex::MLTerrainPoisson::scaleRHS ( int  amrlev,
MultiFab *  rhs 
) const
override

◆ setAreas()

void amrex::MLTerrainPoisson::setAreas ( int  amrlev,
Array< MultiFab const *, 3 > const &  area 
)

Set the face area factors (required).

Parameters
amrlevAMR level (must be 0).
areaFace MultiFabs in x, y and z.

◆ setDetJ()

void amrex::MLTerrainPoisson::setDetJ ( int  amrlev,
MultiFab const &  detJ 
)

Set the cell volume factor J. If not set, J = 1.

Parameters
amrlevAMR level (must be 0).
detJCell-centered MultiFab.

◆ setDirichletNodesToZero()

void amrex::MLTerrainPoisson::setDirichletNodesToZero ( int  ,
int  ,
MultiFab &   
) const
inlineoverride

No-op: cell-centered unknowns are never on a Dirichlet boundary.

◆ setZPhys()

void amrex::MLTerrainPoisson::setZPhys ( int  amrlev,
MultiFab const &  z_phys_nd 
)

Set the physical height of the cell corners.

Parameters
amrlevAMR level (must be 0).
z_phys_ndNodal MultiFab with at least one ghost node filled.

◆ setZSplitSolver()

void amrex::MLTerrainPoisson::setZSplitSolver ( ZSplitSolver  a_solver)

Choose the solver used when boxes are split in z: Spike (the default) or Column.

◆ update()

void amrex::MLTerrainPoisson::update ( )
overridevirtual

Update for reuse.

Reimplemented from amrex::MLCellLinOpT< MultiFab >.

◆ updateCoefs()

void amrex::MLTerrainPoisson::updateCoefs ( )

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