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

Multilevel HYPRE solver that mirrors MLMG's ABecLaplacian structure. More...

#include <AMReX_HypreMLABecLap.H>

Classes

struct  Triplets
 Per-box (row, column, value) triplets of the IJ assembly. More...

Public Member Functions

 HypreMLABecLap (HypreMLABecLap const &)=delete
 HypreMLABecLap (HypreMLABecLap &&)=delete
HypreMLABecLap & operator= (HypreMLABecLap const &)=delete
HypreMLABecLap & operator= (HypreMLABecLap &&)=delete
 HypreMLABecLap (Vector< Geometry > a_geom, Vector< BoxArray > a_grids, Vector< DistributionMapping > a_dmap, HypreSolverID a_hypre_solver_id, std::string a_parmparse_prefix="hypre_mlabeclap")
 Construct the multilevel HYPRE wrapper and copy the hierarchy metadata.
 HypreMLABecLap (Vector< Geometry > a_geom, Vector< BoxArray > a_grids, Vector< DistributionMapping > a_dmap, HypreSolverID a_hypre_solver_id, Vector< FabFactory< FArrayBox > const * > a_factory, std::string a_parmparse_prefix="hypre_mlabeclap")
 As above, with per-level factories: EB factories with cut cells select the EB operator (IJ mode only).
 ~HypreMLABecLap ()
void setVerbose (int v)
 Set HYPRE's logging verbosity (v).
void setMaxIter (int v)
 Override the maximum number of HYPRE iterations (v).
void setIsSingular (bool v)
 Flag whether the assembled operator is singular (v).
void setEBDirichlet (Vector< MultiFab const * > const &a_phi, Vector< MultiFab const * > const &a_beta)
 EB operator: Dirichlet boundary condition on the EB for the following setups (the data are copied; the argument order is MLEBABecLap::setEBDirichlet's).
void setEBHomogDirichlet (Vector< MultiFab const * > const &a_beta)
 EB operator: homogeneous Dirichlet boundary condition on the EB.
void setBCoeffsOnCentroids (bool v) noexcept
 EB operator: the b coefficients of the following setups are at the face centroids, as with MLEBABecLap::setBCoeffs and Location::FaceCentroid (the gradient at a cut face is interpolated toward the face centroid and multiplied by that face's b), instead of at the face centers (v false, the default, where b times the gradient is interpolated). Without cut cells the two are the same.
void setReuseSolverSetup (bool v)
 IJ mode only: let setup() be called again with new coefficients (same grids), updating the matrix values in place and keeping the solver/preconditioner setup, which then only approximates the new operator (see resetSolverSetup()). With EB, the boundary condition types and whether setEBDirichlet() was called must not change.
Real getMatrixScale () const noexcept
void setReuseSetupMaxIter (int n) noexcept
void setReuseSetupMaxChange (Real f)
void resetSolverSetup ()
 IJ mode only: redo the solver/preconditioner setup at the next solve.
void setThrowException (bool t) noexcept
 Throw std::runtime_error instead of aborting when the solve fails.
int getNumIters () const noexcept
 Iterations and final relative residual of the last solve.
Real getFinalResidualNorm () const noexcept
void setup (Real a_ascalar, Real a_bscalar, Vector< MultiFab const * > const &a_acoefs, Vector< Array< MultiFab const *, 3 > > const &a_bcoefs, Array< LinOpBCType, 3 > const &a_lobc, Array< LinOpBCType, 3 > const &a_hibc, Vector< MultiFab const * > const &a_levelbcdata, std::pair< MultiFab const *, IntVect > const &a_coarse_bc={nullptr, IntVect(0)})
 Assemble the HYPRE operators/storage for the provided coefficients.
void solve (Vector< MultiFab * > const &a_sol, Vector< MultiFab const * > const &a_rhs, Real a_reltol, Real a_abstol)
 Solve the assembled system with HYPRE (single-component).
void commBCoefs (int flev, Array< MultiFab const *, 3 > const &a_bcoefs)
 Communicate b coefficients needed by level flev at coarse/fine interfaces.
void commBCoefs_local (int flev, Array< MultiFab const *, 3 > const &a_bcoefs, Vector< FabArrayBase::CopyComTag > const &tags)
 Local portion of commBCoefs used to issue device-friendly copies.
void buildIJMaps ()
 Build the device maps of the IJ assembly; public for cuda.
void solveIJ (Vector< MultiFab * > const &a_sol, Vector< MultiFab const * > const &a_rhs, Real a_reltol, Real a_abstol)
 Solve with the IJ system (see m_use_ij); public for cuda.
void buildEBTriplets (int ilev, Real a_ascalar, Real a_bscalar, MultiFab const *a_acoef, Array< MultiFab, 3 > const &a_bcoef, Vector< Triplets > &chunks)

Detailed Description

Multilevel HYPRE solver that mirrors MLMG's ABecLaplacian structure.

Constructor & Destructor Documentation

◆ HypreMLABecLap() [1/4]

amrex::HypreMLABecLap::HypreMLABecLap ( HypreMLABecLap const & )
delete

◆ HypreMLABecLap() [2/4]

amrex::HypreMLABecLap::HypreMLABecLap ( HypreMLABecLap && )
delete

◆ HypreMLABecLap() [3/4]

amrex::HypreMLABecLap::HypreMLABecLap ( Vector< Geometry > a_geom,
Vector< BoxArray > a_grids,
Vector< DistributionMapping > a_dmap,
HypreSolverID a_hypre_solver_id,
std::string a_parmparse_prefix = "hypre_mlabeclap" )

Construct the multilevel HYPRE wrapper and copy the hierarchy metadata.

Parameters
a_geomPer-level geometries (fine to coarse).
a_gridsPer-level BoxArrays.
a_dmapPer-level DistributionMappings.
a_hypre_solver_idSolver type (BoomerAMG or SSAMG).
a_parmparse_prefixParmParse prefix for runtime options.

◆ HypreMLABecLap() [4/4]

amrex::HypreMLABecLap::HypreMLABecLap ( Vector< Geometry > a_geom,
Vector< BoxArray > a_grids,
Vector< DistributionMapping > a_dmap,
HypreSolverID a_hypre_solver_id,
Vector< FabFactory< FArrayBox > const * > a_factory,
std::string a_parmparse_prefix = "hypre_mlabeclap" )

As above, with per-level factories: EB factories with cut cells select the EB operator (IJ mode only).

◆ ~HypreMLABecLap()

amrex::HypreMLABecLap::~HypreMLABecLap ( )

Member Function Documentation

◆ buildEBTriplets()

void amrex::HypreMLABecLap::buildEBTriplets ( int ilev,
Real a_ascalar,
Real a_bscalar,
MultiFab const * a_acoef,
Array< MultiFab, 3 > const & a_bcoef,
Vector< Triplets > & chunks )

EB operator: the triplets of level ilev's cells (see hypmlabeclap_eb_row), with b from ebBCoefs; public for cuda

◆ buildIJMaps()

void amrex::HypreMLABecLap::buildIJMaps ( )

Build the device maps of the IJ assembly; public for cuda.

◆ commBCoefs()

void amrex::HypreMLABecLap::commBCoefs ( int flev,
Array< MultiFab const *, 3 > const & a_bcoefs )

Communicate b coefficients needed by level flev at coarse/fine interfaces.

Parameters
flevFinest AMR level whose coarse/fine stencils are being prepared.
a_bcoefsFace-centered coefficients for that level (per direction).

◆ commBCoefs_local()

void amrex::HypreMLABecLap::commBCoefs_local ( int flev,
Array< MultiFab const *, 3 > const & a_bcoefs,
Vector< FabArrayBase::CopyComTag > const & tags )

Local portion of commBCoefs used to issue device-friendly copies.

Parameters
flevAMR level whose coarse/fine data are exchanged.
a_bcoefsFace arrays for that level.
tagsCached copy tags extracted from FabArray communications.

◆ getFinalResidualNorm()

Real amrex::HypreMLABecLap::getFinalResidualNorm ( ) const
inlinenodiscardnoexcept

◆ getMatrixScale()

Real amrex::HypreMLABecLap::getMatrixScale ( ) const
inlinenodiscardnoexcept

With setup reuse, the matrix of a later setup() is scaled to the 2-norm of the one the kept setup was done for, and the right-hand side with it: a uniform change of the coefficients (by a time step, say) leaves the kept setup exact. The factor of the last setup.

◆ getNumIters()

int amrex::HypreMLABecLap::getNumIters ( ) const
inlinenodiscardnoexcept

Iterations and final relative residual of the last solve.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ resetSolverSetup()

void amrex::HypreMLABecLap::resetSolverSetup ( )
inline

IJ mode only: redo the solver/preconditioner setup at the next solve.

◆ setBCoeffsOnCentroids()

void amrex::HypreMLABecLap::setBCoeffsOnCentroids ( bool v)
inlinenoexcept

EB operator: the b coefficients of the following setups are at the face centroids, as with MLEBABecLap::setBCoeffs and Location::FaceCentroid (the gradient at a cut face is interpolated toward the face centroid and multiplied by that face's b), instead of at the face centers (v false, the default, where b times the gradient is interpolated). Without cut cells the two are the same.

◆ setEBDirichlet()

void amrex::HypreMLABecLap::setEBDirichlet ( Vector< MultiFab const * > const & a_phi,
Vector< MultiFab const * > const & a_beta )

EB operator: Dirichlet boundary condition on the EB for the following setups (the data are copied; the argument order is MLEBABecLap::setEBDirichlet's).

Parameters
a_phiPer-level EB values; missing or null entries mean zero.
a_betaPer-level b coefficient on the EB (cell-centered).

◆ setEBHomogDirichlet()

void amrex::HypreMLABecLap::setEBHomogDirichlet ( Vector< MultiFab const * > const & a_beta)

EB operator: homogeneous Dirichlet boundary condition on the EB.

◆ setIsSingular()

void amrex::HypreMLABecLap::setIsSingular ( bool v)
inline

Flag whether the assembled operator is singular (v).

◆ setMaxIter()

void amrex::HypreMLABecLap::setMaxIter ( int v)
inline

Override the maximum number of HYPRE iterations (v).

◆ setReuseSetupMaxChange()

void amrex::HypreMLABecLap::setReuseSetupMaxChange ( Real f)
inline

IJ mode with setup reuse: redo the setup at the next solve when the matrix, scaled to the kept setup's, has changed by more than this fraction (2-norm) since that setup (0: never; this is also <prefix>.reuse_setup_max_change). Keeps a copy of the values of every matrix built while it is set. Set after the matrix was built (before or after its solver setup), or after a solve redid the setup, the reference is the matrix of the next setup().

◆ setReuseSetupMaxIter()

void amrex::HypreMLABecLap::setReuseSetupMaxIter ( int n)
inlinenoexcept

IJ mode with setup reuse (hypre or AlgMG backend): redo the setup at the next solve when a solve with a reused setup needs more than n iterations (0: never; this is also <prefix>.reuse_setup_max_iter)

◆ setReuseSolverSetup()

void amrex::HypreMLABecLap::setReuseSolverSetup ( bool v)
inline

IJ mode only: let setup() be called again with new coefficients (same grids), updating the matrix values in place and keeping the solver/preconditioner setup, which then only approximates the new operator (see resetSolverSetup()). With EB, the boundary condition types and whether setEBDirichlet() was called must not change.

◆ setThrowException()

void amrex::HypreMLABecLap::setThrowException ( bool t)
inlinenoexcept

Throw std::runtime_error instead of aborting when the solve fails.

◆ setup()

void amrex::HypreMLABecLap::setup ( Real a_ascalar,
Real a_bscalar,
Vector< MultiFab const * > const & a_acoefs,
Vector< Array< MultiFab const *, 3 > > const & a_bcoefs,
Array< LinOpBCType, 3 > const & a_lobc,
Array< LinOpBCType, 3 > const & a_hibc,
Vector< MultiFab const * > const & a_levelbcdata,
std::pair< MultiFab const *, IntVect > const & a_coarse_bc = {nullptr, IntVect(0)} )

Assemble the HYPRE operators/storage for the provided coefficients.

Parameters
a_ascalarScalar applied to the diagonal term.
a_bscalarScalar applied to the diffusive term.
a_acoefsLevel-by-level a coefficients.
a_bcoefsLevel-by-level arrays of face-based b coefficients (at the face centers, or with EB and setBCoeffsOnCentroids at the face centroids); a missing or null entry means 1 on that level (with EB, the coarse faces under a finer level then hold 1 too).
a_levelbcdataBC data per level; a missing or null entry means zero. On a level with a physical boundary the data must have a ghost cell (the boundary values are read from it).
a_lobcLow-side boundary-condition types.
a_hibcHigh-side boundary-condition types.
a_coarse_bcOptional BC data from even coarser AMR level.

◆ setVerbose()

void amrex::HypreMLABecLap::setVerbose ( int v)
inline

Set HYPRE's logging verbosity (v).

◆ solve()

void amrex::HypreMLABecLap::solve ( Vector< MultiFab * > const & a_sol,
Vector< MultiFab const * > const & a_rhs,
Real a_reltol,
Real a_abstol )

Solve the assembled system with HYPRE (single-component).

Parameters
a_solVector of level solution MultiFabs (filled on return).
a_rhsVector of level right-hand sides.
a_reltolRelative tolerance.
a_abstolAbsolute tolerance.

◆ solveIJ()

void amrex::HypreMLABecLap::solveIJ ( Vector< MultiFab * > const & a_sol,
Vector< MultiFab const * > const & a_rhs,
Real a_reltol,
Real a_abstol )

Solve with the IJ system (see m_use_ij); public for cuda.


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