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

Tensor solver with shear/bulk viscosity inputs for high-Reynolds flows. More...

#include <AMReX_MLTensorOp.H>

Inheritance diagram for amrex::MLTensorOp:
amrex::MLABecLaplacianT< MultiFab > amrex::MLCellABecLapT< MultiFab > amrex::MLCellLinOpT< MultiFab > amrex::MLLinOpT< MultiFab >

Public Member Functions

 MLTensorOp ()
 Construct an empty tensor operator; call define() before solving.
 MLTensorOp (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={})
 Convenience constructor without overset masks (for cell-only domains).
 MLTensorOp (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const Vector< iMultiFab const * > &a_overset_mask, const LPInfo &a_info=LPInfo(), const Vector< FabFactory< FArrayBox > const * > &a_factory={})
 Convenience constructor that includes overset-mask support (1 = unknown, 0 = known).
 ~MLTensorOp () override=default
 MLTensorOp (const MLTensorOp &)=delete
 MLTensorOp (MLTensorOp &&)=delete
MLTensorOp & operator= (const MLTensorOp &)=delete
MLTensorOp & operator= (MLTensorOp &&)=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={})
 Define the hierarchy for standard tensor solves.
void define (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const Vector< iMultiFab const * > &a_overset_mask, const LPInfo &a_info=LPInfo(), const Vector< FabFactory< FArrayBox > const * > &a_factory={})
 Define the hierarchy with overset masks (1 = unknown, 0 = known).
void setShearViscosity (int amrlev, const Array< MultiFab const *, 3 > &eta)
 Provide shear viscosity eta as face-centered MultiFabs.
void setShearViscosity (int amrlev, Real eta)
 Populate eta with a constant scalar.
void setBulkViscosity (int amrlev, const Array< MultiFab const *, 3 > &kappa)
 Provide bulk viscosity kappa as face-centered MultiFabs.
void setBulkViscosity (int amrlev, Real kappa)
 Populate kappa with a constant scalar.
int getNComp () const final
 Return number of components.
bool isCrossStencil () const final
 Whether the stencil is the cross shape.
bool isTensorOp () const final
 Whether this operator is a tensor solve.
bool needsUpdate () const final
 True if coefficients have changed since the last prepareForSolve().
void update () final
 Not implemented for tensor operators.
void prepareForSolve () final
 Assemble viscosity data/BC caches before solving.
bool isSingular (int) const final
 Query whether AMR level amrlev is singular (null space present).
bool isBottomSingular () const final
 Convenience helper for the coarsest level singularity flag.
void apply (int amrlev, int mglev, MultiFab &out, MultiFab &in, BCMode bc_mode, StateMode s_mode, const MLMGBndry *bndry=nullptr) const final
 Apply the tensor operator on AMR level amrlev / MG level mglev.
void compFlux (int amrlev, const Array< MultiFab *, 3 > &fluxes, MultiFab &sol, Location loc) const override
 Assemble viscous fluxes on AMR level amrlev.
void compVelGrad (int amrlev, const Array< MultiFab *, 3 > &fluxes, MultiFab &sol, Location loc) const
 Compute velocity gradients (symmetrized) at the requested location.
void setBCoeffs (int amrlev, const Array< MultiFab const *, 3 > &beta)=delete
void setMappingFactors (int amrlev, const Array< MultiFab const *, 3 > &fac)
 Declare a diagonal mesh mapping and supply its face factors.
bool isMapped () const noexcept
 True if setMappingFactors has been called for any AMR level.
bool hasMappingFactors (int amrlev) const noexcept
void applyBCTensor (int amrlev, int mglev, MultiFab &vel, BCMode bc_mode, StateMode s_mode, const MLMGBndry *bndry) const
 Apply tensor-specific boundary conditions on (amrlev,mglev).
Public Member Functions inherited from amrex::MLABecLaplacianT< MultiFab >
 MLABecLaplacianT ()=default
 Construct an empty operator; call define() before solving.
 MLABecLaplacianT (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={}, int a_ncomp=1)
 Convenience constructor for cell-based solves without overset regions.
 MLABecLaplacianT (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const Vector< iMultiFab const * > &a_overset_mask, const LPInfo &a_info=LPInfo(), const Vector< FabFactory< FAB > const * > &a_factory={}, int a_ncomp=1)
 Convenience constructor that includes overset-mask handling (1 = unknown, 0 = known).
 ~MLABecLaplacianT () override
 MLABecLaplacianT (const MLABecLaplacianT< MultiFab > &)=delete
 MLABecLaplacianT (MLABecLaplacianT< MultiFab > &&)=delete
MLABecLaplacianT< MultiFab > & operator= (const MLABecLaplacianT< MultiFab > &)=delete
MLABecLaplacianT< MultiFab > & operator= (MLABecLaplacianT< 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={}, int a_ncomp=1)
 Define coefficients/layouts for a standard cell-centered solve.
void define (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const Vector< iMultiFab const * > &a_overset_mask, const LPInfo &a_info=LPInfo(), const Vector< FabFactory< FAB > const * > &a_factory={}, int a_ncomp=1)
 Define coefficients/layouts plus overset-mask information.
void setScalars (T1 a, T2 b) noexcept
void setACoeffs (int amrlev, const AMF &alpha)
void setACoeffs (int amrlev, T alpha)
void setBCoeffs (int amrlev, const Array< AMF const *, 3 > &beta)
void setBCoeffs (int amrlev, T beta)
void setBCoeffs (int amrlev, Vector< T > const &beta)
void Fapply (int amrlev, int mglev, MultiFab &out, const MultiFab &in) const override
 Apply the operator on (amrlev,mglev), storing L(in) in out.
void Fsmooth (int amrlev, int mglev, MultiFab &sol, const MultiFab &rhs, int redblack) const override
 Perform one smoothing pass on (amrlev,mglev) updating sol against rhs. redblack selects the red (0) or black (1) half of the grid.
void FFlux (int amrlev, const MFIter &mfi, const Array< FAB *, 3 > &flux, const FAB &sol, Location, int face_only=0) const override
 Compute fluxes on AMR level amrlev for the tilebox described by mfi using sol, writing to flux and honoring face_only.
void normalize (int amrlev, int mglev, MultiFab &mf) const override
 Divide mf by the diagonal of the operator (used by CG-family bottom solvers).
RT getAScalar () const final
 Scalar alpha applied to the a-coefficient term.
RT getBScalar () const final
 Scalar beta applied to the b-coefficient term.
MultiFab const * getACoeffs (int amrlev, int mglev) const final
 Access the stored a coefficient on AMR level amrlev and MG level mglev.
Array< MultiFab const *, 3 > getBCoeffs (int amrlev, int mglev) const final
 Access the stored b coefficients on AMR level amrlev and MG level mglev.
std::unique_ptr< MLLinOpT< MultiFab > > makeNLinOp (int) const final
 Build the NSolve counterpart of this operator.
bool supportNSolve () const override
 Whether this operator supports NSolve.
void copyNSolveSolution (MultiFab &dst, MultiFab const &src) const final
 Copy an NSolve solution from src to dst.
void averageDownCoeffsSameAmrLevel (int amrlev, Vector< MultiFab > &a, Vector< Array< MultiFab, 3 > > &b)
 Average coefficients down within AMR level amrlev (fine-to-coarse multigrid) updating a and b.
void averageDownCoeffs ()
 Average a and b coefficients down across all AMR and MG levels.
void averageDownCoeffsToCoarseAmrLevel (int flev)
 Average coefficients from fine AMR level flev to coarse AMR level flev-1.
void applyMetricTermsCoeffs ()
 Apply metric factors to the stored coefficients when solving in mapped space.
void applyRobinBCTermsCoeffs ()
 Modify coefficients to honor Robin BC terms introduced at level boundaries.
Public Member Functions inherited from amrex::MLCellABecLapT< MultiFab >
 MLCellABecLapT ()=default
 ~MLCellABecLapT () override=default
 MLCellABecLapT (const MLCellABecLapT< MultiFab > &)=delete
 MLCellABecLapT (MLCellABecLapT< MultiFab > &&)=delete
MLCellABecLapT< MultiFab > & operator= (const MLCellABecLapT< MultiFab > &)=delete
MLCellABecLapT< MultiFab > & operator= (MLCellABecLapT< 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={})
 Describe the AMR hierarchy when overset masks are not required.
void define (const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const Vector< iMultiFab const * > &a_overset_mask, const LPInfo &a_info=LPInfo(), const Vector< FabFactory< FAB > const * > &a_factory={})
 Describe the AMR hierarchy when overset masks participate.
iMultiFab const * getOversetMask (int amrlev, int mglev) const
 Overset mask for (amrlev,mglev); returns nullptr when not defined.
void setDirichletNodesToZero (int amrlev, int mglev, MultiFab &mf) const override
 Zero out Dirichlet nodes on (amrlev,mglev) so that GMRES can treat them as known.
void getFluxes (const Vector< Array< MultiFab *, 3 > > &a_flux, const Vector< MultiFab * > &a_sol, Location a_loc) const final
 Fill per-face fluxes using the supplied solution hierarchy.
void getFluxes (const Vector< MultiFab * > &a_flux, const Vector< MultiFab * > &a_sol) const final
 Guard overload that aborts if called (cell-centered flux extraction requires per-direction face arrays).
void applyInhomogNeumannTerm (int amrlev, MultiFab &rhs) const final
 Apply stored Neumann data to the RHS rhs on AMR level amrlev.
void addInhomogNeumannFlux (int amrlev, const Array< MultiFab *, 3 > &grad, MultiFab const &sol, bool mult_bcoef) const final
 Add inhomogeneous Neumann/Robin flux contributions into grad from sol (include b when mult_bcoef is true).
void applyOverset (int amrlev, MultiFab &rhs) const override
 Zero RHS entries in rhs that are covered by overset masks on level amrlev.
virtual MultiFab const * getEBBCoeffs (int, int) const
 EB Dirichlet b coefficient for the matrix assembly (nullptr without EB).
std::unique_ptr< MLAlgMG > makeAlgMG (int mglev) const override
 Build the algebraic system of MG level mglev of AMR level 0 for the AlgMG solver. Operators that hypre supports implement this.
bool supportsAlgMG () const override
 True if makeAlgMG is implemented for this operator.
Array< MultiFab, 3 > makeDefaultBCoeffs (int mglev) const
Public Member Functions inherited from amrex::MLCellLinOpT< MultiFab >
 MLCellLinOpT ()
 ~MLCellLinOpT () override=default
 MLCellLinOpT (const MLCellLinOpT< MultiFab > &)=delete
 MLCellLinOpT (MLCellLinOpT< MultiFab > &&)=delete
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.
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
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< MultiFab >
 MLLinOpT ()=default
virtual ~MLLinOpT ()=default
 MLLinOpT (const MLLinOpT< MultiFab > &)=delete
 MLLinOpT (MLLinOpT< MultiFab > &&)=delete
MLLinOpT< MultiFab > & operator= (const MLLinOpT< MultiFab > &)=delete
MLLinOpT< MultiFab > & operator= (MLLinOpT< MultiFab > &&)=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 MultiFab *crse, int crse_ratio, LinOpBCType bc_type=LinOpBCType::Dirichlet) noexcept
 Set coarse/fine boundary conditions. For cell-centered solves only.
void setCoarseFineBC (const MultiFab *crse, IntVect const &crse_ratio, LinOpBCType bc_type=LinOpBCType::Dirichlet) noexcept
void setCoarseFineBC (const AMF *crse, int crse_ratio, LinOpBCType bc_type=LinOpBCType::Dirichlet) noexcept
void setCoarseFineBC (const AMF *crse, IntVect const &crse_ratio, LinOpBCType bc_type=LinOpBCType::Dirichlet) noexcept
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 BottomSolver getDefaultBottomSolver () const
virtual bool supportCustomBottomSolver () const
 Does this operator provide its own bottom solver (BottomSolver::custom)?
virtual void customBottomSolve (MLMGT< MultiFab > *mlmg, MultiFab &x, const MultiFab &b, RT eps_rel, RT eps_abs, int maxiter)
 Bottom solve provided by the operator itself.
virtual int getNGrow (int=0, int=0) const
virtual void interpCoarseFineSolution (int famrlev, MultiFab &fine_sol, const MultiFab &crse_sol) const
 Before a composite solve, set the solution at the nodes that fine AMR level famrlev takes from the coarse level (the coarse/fine nodes of MLNodeLaplacian) to the interpolated coarse solution. The solve only adds interpolated corrections there, so the result would otherwise depend on the initial guess. The default does nothing.
virtual void unimposeNeumannBC (int amrlev, MultiFab &rhs) const
 Undo Neumann contributions stored on the RHS.
virtual bool scaleRHS (int amrlev, MultiFab *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 getEBFluxes (const Vector< MultiFab * > &a_flux, const Vector< MultiFab * > &a_sol) const
 Extract embedded-boundary fluxes.
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 void postSolve (Vector< MultiFab * > const &sol) const
 Optional hook invoked after the main solve completes.
virtual void avgDownResMG (int clev, MultiFab &cres, MultiFab 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).

Protected Attributes

bool m_has_kappa = false
Vector< Vector< Array< MultiFab, 3 > > > m_kappa
bool m_use_mapped = false
Vector< Array< MultiFab, 3 > > m_mapfac
Protected Attributes inherited from amrex::MLABecLaplacianT< MultiFab >
Vector< int > m_is_singular
Protected Attributes inherited from amrex::MLCellABecLapT< MultiFab >
Vector< Vector< std::unique_ptr< iMultiFab > > > m_overset_mask
LPInfo m_lpinfo_arg
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< MultiFab >
int mg_box_min_width
int mg_domain_min_width
int mg_agg_no_split_direction
bool mg_odd_coarsening
bool mg_independent_coarsening
LPInfo info
int verbose
std::string print_ident
int maxorder
bool enforceSingularSolvable
bool m_mg_deferred
 MG levels of AMR level 0 built at first solve.
bool m_mg_built
int m_num_amr_levels
Vector< int > m_amr_ref_ratio
Vector< int > m_num_mg_levels
const MLLinOpT< MultiFab > * m_parent
IntVect m_ixtype
bool m_do_agglomeration
bool m_do_consolidation
bool m_do_semicoarsening
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 m_bottom_comm
std::unique_ptr< CommContainer > m_raii_comm
Array< Real, 3 > m_domain_bloc_lo
Array< Real, 3 > m_domain_bloc_hi
bool m_needs_coarse_data_for_bc
LinOpBCType m_coarse_fine_bc_type
IntVect m_coarse_data_crse_ratio
RealVect m_coarse_bc_loc
const MultiFab * m_coarse_data_for_bc
MultiFab m_coarse_data_for_bc_raii
bool m_precond_mode

Additional Inherited Members

Public Types inherited from amrex::MLABecLaplacianT< MultiFab >
using FAB
using RT
using BCType
using Location
Public Types inherited from amrex::MLCellABecLapT< MultiFab >
using FAB
using RT
using Location
Public Types inherited from amrex::MLCellLinOpT< MultiFab >
using FAB
using RT
using BCType
using BCMode
using StateMode
using Location
Public Types inherited from amrex::MLLinOpT< MultiFab >
using MFType
using FAB
using RT
using BCType
using BCMode
using StateMode
using Location
Static Public Member Functions inherited from amrex::MLABecLaplacianT< MultiFab >
static void FFlux (Box const &box, Real const *dxinv, RT bscalar, Array< FAB const *, 3 > const &bcoef, Array< FAB *, 3 > const &flux, FAB const &sol, int face_only, int ncomp)
 Helper that computes face fluxes for a single tilebox.
Public Attributes inherited from amrex::MLABecLaplacianT< MultiFab >
RT m_a_scalar
RT m_b_scalar
Vector< Vector< MultiFab > > m_a_coeffs
Vector< Vector< Array< MultiFab, 3 > > > m_b_coeffs
bool m_scalars_set
bool m_acoef_set
Public Attributes inherited from amrex::MLCellLinOpT< MultiFab >
Vector< std::unique_ptr< MultiFab > > m_robin_bcval
Public Attributes inherited from amrex::MLLinOpT< MultiFab >
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
using BCTuple
Protected Member Functions inherited from amrex::MLABecLaplacianT< MultiFab >
bool supportRobinBC () const noexcept override
Protected Member Functions inherited from amrex::MLCellABecLapT< MultiFab >
bool supportInhomogNeumannBC () const noexcept override
Protected Member Functions inherited from amrex::MLLinOpT< MultiFab >
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
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< MultiFab > > &mf, IntVect const &ng) const
virtual MultiFab make (int amrlev, int mglev, IntVect const &ng) const
virtual MultiFab make (int amrlev, int mglev, IntVect const &ng, MFInfo const &mf_info) const
 As above, with caller-selected allocation metadata for temporary storage.
virtual MultiFab makeAlias (MultiFab const &mf) const
virtual MultiFab 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 MultiFab makeCoarseMG (int amrlev, int mglev, IntVect const &ng, MFInfo const &mf_info) const
 As above, with caller-selected allocation metadata for temporary storage.
virtual MultiFab makeCoarseAmr (int famrlev, IntVect const &ng) const
 Allocate an MF on the next coarser AMR level (famrlev-1) with grow cells ng.
virtual MultiFab 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
Array4< T > compactify (Array4< T > const &a) const noexcept
T get_d0 (T const &dx, T const &dy, T const &) const noexcept
T get_d1 (T const &, T const &dy, T const &dz) const noexcept
Static Protected Attributes inherited from amrex::MLLinOpT< MultiFab >
static constexpr int mg_coarsen_ratio

Detailed Description

Tensor solver with shear/bulk viscosity inputs for high-Reynolds flows.

Constructor & Destructor Documentation

◆ MLTensorOp() [1/5]

amrex::MLTensorOp::MLTensorOp ( )

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

◆ MLTensorOp() [2/5]

amrex::MLTensorOp::MLTensorOp ( 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 = {} )

Convenience constructor without overset masks (for cell-only domains).

Internally calls define() with the provided metadata.

◆ MLTensorOp() [3/5]

amrex::MLTensorOp::MLTensorOp ( const Vector< Geometry > & a_geom,
const Vector< BoxArray > & a_grids,
const Vector< DistributionMapping > & a_dmap,
const Vector< iMultiFab const * > & a_overset_mask,
const LPInfo & a_info = LPInfo(),
const Vector< FabFactory< FArrayBox > const * > & a_factory = {} )

Convenience constructor that includes overset-mask support (1 = unknown, 0 = known).

◆ ~MLTensorOp()

amrex::MLTensorOp::~MLTensorOp ( )
overridedefault

◆ MLTensorOp() [4/5]

amrex::MLTensorOp::MLTensorOp ( const MLTensorOp & )
delete

◆ MLTensorOp() [5/5]

amrex::MLTensorOp::MLTensorOp ( MLTensorOp && )
delete

Member Function Documentation

◆ apply()

void amrex::MLTensorOp::apply ( int amrlev,
int mglev,
MultiFab & out,
MultiFab & in,
BCMode bc_mode,
StateMode s_mode,
const MLMGBndry * bndry = nullptr ) const
final

Apply the tensor operator on AMR level amrlev / MG level mglev.

Parameters
amrlevAMR level targeted by the smoothing/apply stage.
mglevMultigrid level within that AMR level.
outDestination MultiFab receiving L(in).
inSource MultiFab holding the field being operated on.
bc_modeBoundary-condition mode (homogeneous vs inhomogeneous).
s_modeState mode (solution vs correction).
bndryOptional boundary metadata supplied by MLMG.

◆ applyBCTensor()

void amrex::MLTensorOp::applyBCTensor ( int amrlev,
int mglev,
MultiFab & vel,
BCMode bc_mode,
StateMode s_mode,
const MLMGBndry * bndry ) const

Apply tensor-specific boundary conditions on (amrlev,mglev).

Parameters
amrlevAMR level index.
mglevMultigrid level index.
velMultiFab updated in place with boundary values.
bc_modeBoundary-condition mode requested by MLMG.
s_modeState mode (solution/correction).
bndryBoundary metadata supplied by MLMG (may be null).

◆ compFlux()

void amrex::MLTensorOp::compFlux ( int amrlev,
const Array< MultiFab *, 3 > & fluxes,
MultiFab & sol,
Location loc ) const
override

Assemble viscous fluxes on AMR level amrlev.

Parameters
amrlevLevel whose fluxes are built.
fluxesDestination arrays (one per direction).
solSolution values defining the flux.
locSampling location for the stencil (faces, centroids, etc.).

◆ compVelGrad()

void amrex::MLTensorOp::compVelGrad ( int amrlev,
const Array< MultiFab *, 3 > & fluxes,
MultiFab & sol,
Location loc ) const

Compute velocity gradients (symmetrized) at the requested location.

Not available with mapping factors (setMappingFactors): the gradients would be plain Xi-derivatives with no factor applied, so the call asserts. Divide the Xi-derivatives by the factors in the caller.

Parameters
amrlevAMR level index.
fluxesDestination gradient MultiFabs per direction.
solSolution whose gradients are computed.
locSampling location (cell/face center, centroid, etc.).

◆ define() [1/2]

void amrex::MLTensorOp::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 = {} )

Define the hierarchy for standard tensor solves.

Parameters
a_geomPer-level geometries (fine to coarse).
a_gridsPer-level grids.
a_dmapDistribution mappings.
a_infoOptional LPInfo overrides.
a_factoryOptional FAB factories.

◆ define() [2/2]

void amrex::MLTensorOp::define ( const Vector< Geometry > & a_geom,
const Vector< BoxArray > & a_grids,
const Vector< DistributionMapping > & a_dmap,
const Vector< iMultiFab const * > & a_overset_mask,
const LPInfo & a_info = LPInfo(),
const Vector< FabFactory< FArrayBox > const * > & a_factory = {} )

Define the hierarchy with overset masks (1 = unknown, 0 = known).

Parameters
a_geomPer-level geometries.
a_gridsPer-level grids.
a_dmapDistribution mappings.
a_overset_maskOverset masks per AMR level.
a_infoOptional LPInfo overrides.
a_factoryOptional FAB factories.

◆ getNComp()

int amrex::MLTensorOp::getNComp ( ) const
inlinenodiscardfinalvirtual

Return number of components.

Reimplemented from amrex::MLABecLaplacianT< MultiFab >.

◆ hasMappingFactors()

bool amrex::MLTensorOp::hasMappingFactors ( int amrlev) const
inlinenodiscardnoexcept

True if setMappingFactors has been called for AMR level amrlev. The factors are per level: a level without them uses the unmapped kernels.

◆ isBottomSingular()

bool amrex::MLTensorOp::isBottomSingular ( ) const
inlinenodiscardfinalvirtual

Convenience helper for the coarsest level singularity flag.

Reimplemented from amrex::MLABecLaplacianT< MultiFab >.

◆ isCrossStencil()

bool amrex::MLTensorOp::isCrossStencil ( ) const
inlinenodiscardfinalvirtual

Whether the stencil is the cross shape.

Reimplemented from amrex::MLCellLinOpT< MultiFab >.

◆ isMapped()

bool amrex::MLTensorOp::isMapped ( ) const
inlinenodiscardnoexcept

True if setMappingFactors has been called for any AMR level.

◆ isSingular()

bool amrex::MLTensorOp::isSingular ( int amrlev) const
inlinenodiscardfinalvirtual

Query whether AMR level amrlev is singular (null space present).

Reimplemented from amrex::MLABecLaplacianT< MultiFab >.

◆ isTensorOp()

bool amrex::MLTensorOp::isTensorOp ( ) const
inlinenodiscardfinalvirtual

Whether this operator is a tensor solve.

Reimplemented from amrex::MLCellLinOpT< MultiFab >.

◆ needsUpdate()

bool amrex::MLTensorOp::needsUpdate ( ) const
inlinenodiscardfinalvirtual

True if coefficients have changed since the last prepareForSolve().

The operator may be reused for any number of solves as long as its coefficients are left untouched.

Reimplemented from amrex::MLABecLaplacianT< MultiFab >.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ prepareForSolve()

void amrex::MLTensorOp::prepareForSolve ( )
finalvirtual

Assemble viscosity data/BC caches before solving.

Reimplemented from amrex::MLABecLaplacianT< MultiFab >.

◆ setBCoeffs()

void amrex::MLTensorOp::setBCoeffs ( int amrlev,
const Array< MultiFab const *, 3 > & beta )
delete

◆ setBulkViscosity() [1/2]

void amrex::MLTensorOp::setBulkViscosity ( int amrlev,
const Array< MultiFab const *, 3 > & kappa )

Provide bulk viscosity kappa as face-centered MultiFabs.

Parameters
amrlevAMR level receiving the data.
kappaArray of MultiFabs, one per spatial direction.

◆ setBulkViscosity() [2/2]

void amrex::MLTensorOp::setBulkViscosity ( int amrlev,
Real kappa )

Populate kappa with a constant scalar.

Parameters
amrlevAMR level receiving the value.
kappaScalar bulk viscosity.

◆ setMappingFactors()

void amrex::MLTensorOp::setMappingFactors ( int amrlev,
const Array< MultiFab const *, 3 > & fac )

Declare a diagonal mesh mapping and supply its face factors.

For a solver on a uniform computational grid carrying a diagonal, axis-aligned mapping x_d = x_d(xi_d), the tensor operator is applied in xi space. The caller scales the face viscosity on face d by J/fac_d^2 (and any bulk viscosity likewise), which makes the normal-derivative part of the operator exact; the transpose and bulk terms, which differentiate in the other directions, additionally need the ratio fac_d/fac_j on face d for a derivative in direction j. This call supplies fac_j, j = 0..AMREX_SPACEDIM-1, as the components of face-centred MultiFabs, one per face direction, evaluated at the faces; the cross-term kernels then apply the ratios. The returned L(u) is J times the physical tensor divergence. Cross terms are only evaluated on the finest MG level, so factors are needed per AMR level only.

Parameters
amrlevAMR level.
facArray of face-centred MultiFabs (one per face direction), each with AMREX_SPACEDIM components holding the mapping factors dx_j/dxi_j at that face.

◆ setShearViscosity() [1/2]

void amrex::MLTensorOp::setShearViscosity ( int amrlev,
const Array< MultiFab const *, 3 > & eta )

Provide shear viscosity eta as face-centered MultiFabs.

Parameters
amrlevAMR level receiving the data.
etaArray of MultiFabs, one per spatial direction.

◆ setShearViscosity() [2/2]

void amrex::MLTensorOp::setShearViscosity ( int amrlev,
Real eta )

Populate eta with a constant scalar.

Parameters
amrlevAMR level receiving the value.
etaScalar shear viscosity.

◆ update()

void amrex::MLTensorOp::update ( )
inlinefinalvirtual

Not implemented for tensor operators.

Changing viscosity or a coefficients after prepareForSolve() is not supported; build a new operator instead.

Reimplemented from amrex::MLABecLaplacianT< MultiFab >.

Member Data Documentation

◆ m_has_kappa

bool amrex::MLTensorOp::m_has_kappa = false
protected

◆ m_kappa

Vector<Vector<Array<MultiFab,3> > > amrex::MLTensorOp::m_kappa
protected

◆ m_mapfac

Vector<Array<MultiFab,3> > amrex::MLTensorOp::m_mapfac
protected

◆ m_use_mapped

bool amrex::MLTensorOp::m_use_mapped = false
protected

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