Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::Hypre Class Referenceabstract

Lightweight base class shared by HYPRE-backed linear solvers, HypreABecLap, HypreABecLap2, and HypreABecLap3. More...

#include <AMReX_Hypre.H>

Inheritance diagram for amrex::Hypre:
amrex::HypreABecLap amrex::HypreABecLap2 amrex::HypreABecLap3

Public Types

enum class  Interface : int { structed , semi_structed , ij }
 HYPRE interface modes supported. More...
 

Public Member Functions

 Hypre (const BoxArray &grids, const DistributionMapping &dmap, const Geometry &geom, MPI_Comm comm_)
 Construct a HYPRE wrapper bound to the supplied grids.
 
virtual ~Hypre ()
 
 Hypre (Hypre &&) noexcept=default
 
Hypreoperator= (Hypre &&) noexcept=default
 
 Hypre (Hypre const &)=delete
 
Hypreoperator= (Hypre const &)=delete
 
void setScalars (Real sa, Real sb)
 Store constant scalars applied to the a (diagonal) and b (Laplacian) terms.
 
void setACoeffs (const MultiFab &alpha)
 Install per-cell a coefficients.
 
void setBCoeffs (const Array< const MultiFab *, 3 > &beta)
 Install per-face b coefficients for each spatial direction.
 
void setVerbose (int _verbose)
 Set HYPRE verbosity level (_verbose).
 
void setIsMatrixSingular (bool flag)
 Flag a singular operator (enables null-space handling in derived classes).
 
virtual void solve (MultiFab &soln, const MultiFab &rhs, Real rel_tol, Real abs_tol, int max_iter, const BndryData &bndry, int max_bndry_order)=0
 Solve the linear system using the concrete interface implementation.
 
void setHypreOptionsNamespace (const std::string &ns) noexcept
 Override the ParmParse namespace consulted for HYPRE runtime options (ns).
 
void setHypreOldDefault (bool l) noexcept
 Toggle HYPRE's "old default" AMG setup (Falgout + modified classical interpolation) via l.
 
void setHypreRelaxType (int n) noexcept
 Choose the relaxation type handed to HYPRE (see HYPRE docs for valid codes) via n.
 
void setHypreRelaxOrder (int n) noexcept
 Choose the relaxation ordering (C/F, lexicographic, etc.) via n.
 
void setHypreNumSweeps (int n) noexcept
 Set the number of pre/post smoothing sweeps HYPRE executes on each level via n.
 
void setHypreStrongThreshold (Real t) noexcept
 Adjust HYPRE's AMG strong-connection threshold used during coarsening via t.
 

Static Public Member Functions

static HYPRE_Int ispow2 (HYPRE_Int i)
 Return 1 if i is a power of two, otherwise 0.
 
static Array< HYPRE_Int, 3 > loV (const Box &b)
 Convenience helper that casts a box's low corner to HYPRE_Int.
 
static Array< HYPRE_Int, 3 > hiV (const Box &b)
 Convenience helper that casts a box's high corner to HYPRE_Int.
 

Static Public Attributes

static constexpr HYPRE_Int regular_stencil_size = 2*3 + 1
 Stencil size used on regular cells.
 
static constexpr HYPRE_Int eb_stencil_size = 3 *3 *3
 Stencil size used on EB cells (3^D).
 

Protected Attributes

MPI_Comm comm = MPI_COMM_NULL
 
Geometry geom
 
int verbose = 0
 
bool old_default = true
 
int relax_type = 6
 
int relax_order = 1
 
int num_sweeps = 2
 
Real strong_threshold = Real(0.25)
 
std::string options_namespace {"hypre"}
 
MultiFab acoefs
 
Array< MultiFab, 3 > bcoefs
 
Real scalar_a
 
Real scalar_b
 
MultiFab diaginv
 
FabFactory< FArrayBox > const * m_factory = nullptr
 
BndryData const * m_bndry = nullptr
 
int m_maxorder = -1
 
bool is_matrix_singular { false }
 

Detailed Description

Lightweight base class shared by HYPRE-backed linear solvers, HypreABecLap, HypreABecLap2, and HypreABecLap3.

Stores geometry, coefficients, and solver-wide options that concrete implementations (Struct, SStruct, IJ) consume in their respective solve() routines.

Member Enumeration Documentation

◆ Interface

enum class amrex::Hypre::Interface : int
strong

HYPRE interface modes supported.

Enumerator
structed 
semi_structed 
ij 

Constructor & Destructor Documentation

◆ Hypre() [1/3]

amrex::Hypre::Hypre ( const BoxArray grids,
const DistributionMapping dmap,
const Geometry geom,
MPI_Comm  comm_ 
)

Construct a HYPRE wrapper bound to the supplied grids.

Parameters
gridsGrid layout on the AMR level being solved.
dmapDistribution map for grids.
geomGeometry describing the domain.
comm_MPI communicator handed to HYPRE.

◆ ~Hypre()

amrex::Hypre::~Hypre ( )
virtualdefault

◆ Hypre() [2/3]

amrex::Hypre::Hypre ( Hypre &&  )
defaultnoexcept

◆ Hypre() [3/3]

amrex::Hypre::Hypre ( Hypre const &  )
delete

Member Function Documentation

◆ hiV()

static Array< HYPRE_Int, 3 > amrex::Hypre::hiV ( const Box b)
inlinestatic

Convenience helper that casts a box's high corner to HYPRE_Int.

◆ ispow2()

static HYPRE_Int amrex::Hypre::ispow2 ( HYPRE_Int  i)
inlinestatic

Return 1 if i is a power of two, otherwise 0.

◆ loV()

static Array< HYPRE_Int, 3 > amrex::Hypre::loV ( const Box b)
inlinestatic

Convenience helper that casts a box's low corner to HYPRE_Int.

◆ operator=() [1/2]

Hypre & amrex::Hypre::operator= ( Hypre &&  )
defaultnoexcept

◆ operator=() [2/2]

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

◆ setACoeffs()

void amrex::Hypre::setACoeffs ( const MultiFab alpha)

Install per-cell a coefficients.

◆ setBCoeffs()

void amrex::Hypre::setBCoeffs ( const Array< const MultiFab *, 3 > &  beta)

Install per-face b coefficients for each spatial direction.

◆ setHypreNumSweeps()

void amrex::Hypre::setHypreNumSweeps ( int  n)
inlinenoexcept

Set the number of pre/post smoothing sweeps HYPRE executes on each level via n.

◆ setHypreOldDefault()

void amrex::Hypre::setHypreOldDefault ( bool  l)
inlinenoexcept

Toggle HYPRE's "old default" AMG setup (Falgout + modified classical interpolation) via l.

◆ setHypreOptionsNamespace()

void amrex::Hypre::setHypreOptionsNamespace ( const std::string &  ns)
inlinenoexcept

Override the ParmParse namespace consulted for HYPRE runtime options (ns).

◆ setHypreRelaxOrder()

void amrex::Hypre::setHypreRelaxOrder ( int  n)
inlinenoexcept

Choose the relaxation ordering (C/F, lexicographic, etc.) via n.

◆ setHypreRelaxType()

void amrex::Hypre::setHypreRelaxType ( int  n)
inlinenoexcept

Choose the relaxation type handed to HYPRE (see HYPRE docs for valid codes) via n.

◆ setHypreStrongThreshold()

void amrex::Hypre::setHypreStrongThreshold ( Real  t)
inlinenoexcept

Adjust HYPRE's AMG strong-connection threshold used during coarsening via t.

◆ setIsMatrixSingular()

void amrex::Hypre::setIsMatrixSingular ( bool  flag)
inline

Flag a singular operator (enables null-space handling in derived classes).

◆ setScalars()

void amrex::Hypre::setScalars ( Real  sa,
Real  sb 
)

Store constant scalars applied to the a (diagonal) and b (Laplacian) terms.

◆ setVerbose()

void amrex::Hypre::setVerbose ( int  _verbose)

Set HYPRE verbosity level (_verbose).

◆ solve()

virtual void amrex::Hypre::solve ( MultiFab soln,
const MultiFab rhs,
Real  rel_tol,
Real  abs_tol,
int  max_iter,
const BndryData bndry,
int  max_bndry_order 
)
pure virtual

Solve the linear system using the concrete interface implementation.

Parameters
solnSolution MultiFab updated in place.
rhsRight-hand side.
rel_tolRelative convergence tolerance.
abs_tolAbsolute convergence tolerance.
max_iterMaximum iterations allowed.
bndryBoundary condition data.
max_bndry_orderMaximum order at the boundary.

Implemented in amrex::HypreABecLap3, amrex::HypreABecLap, and amrex::HypreABecLap2.

Member Data Documentation

◆ acoefs

MultiFab amrex::Hypre::acoefs
protected

◆ bcoefs

Array<MultiFab,3> amrex::Hypre::bcoefs
protected

◆ comm

MPI_Comm amrex::Hypre::comm = MPI_COMM_NULL
protected

◆ diaginv

MultiFab amrex::Hypre::diaginv
protected

◆ eb_stencil_size

constexpr HYPRE_Int amrex::Hypre::eb_stencil_size = 3 *3 *3
staticconstexpr

Stencil size used on EB cells (3^D).

◆ geom

Geometry amrex::Hypre::geom
protected

◆ is_matrix_singular

bool amrex::Hypre::is_matrix_singular { false }
protected

◆ m_bndry

BndryData const* amrex::Hypre::m_bndry = nullptr
protected

◆ m_factory

FabFactory<FArrayBox> const* amrex::Hypre::m_factory = nullptr
protected

◆ m_maxorder

int amrex::Hypre::m_maxorder = -1
protected

◆ num_sweeps

int amrex::Hypre::num_sweeps = 2
protected

◆ old_default

bool amrex::Hypre::old_default = true
protected

◆ options_namespace

std::string amrex::Hypre::options_namespace {"hypre"}
protected

◆ regular_stencil_size

constexpr HYPRE_Int amrex::Hypre::regular_stencil_size = 2*3 + 1
staticconstexpr

Stencil size used on regular cells.

◆ relax_order

int amrex::Hypre::relax_order = 1
protected

◆ relax_type

int amrex::Hypre::relax_type = 6
protected

◆ scalar_a

Real amrex::Hypre::scalar_a
protected

◆ scalar_b

Real amrex::Hypre::scalar_b
protected

◆ strong_threshold

Real amrex::Hypre::strong_threshold = Real(0.25)
protected

◆ verbose

int amrex::Hypre::verbose = 0
protected

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