![]() |
Block-Structured AMR Software Framework
|
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) |
Multilevel HYPRE solver that mirrors MLMG's ABecLaplacian structure.
|
delete |
|
delete |
| 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.
| a_geom | Per-level geometries (fine to coarse). |
| a_grids | Per-level BoxArrays. |
| a_dmap | Per-level DistributionMappings. |
| a_hypre_solver_id | Solver type (BoomerAMG or SSAMG). |
| a_parmparse_prefix | ParmParse prefix for runtime options. |
| 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).
| amrex::HypreMLABecLap::~HypreMLABecLap | ( | ) |
| 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
| void amrex::HypreMLABecLap::buildIJMaps | ( | ) |
Build the device maps of the IJ assembly; public for cuda.
Communicate b coefficients needed by level flev at coarse/fine interfaces.
| flev | Finest AMR level whose coarse/fine stencils are being prepared. |
| a_bcoefs | Face-centered coefficients for that level (per direction). |
| 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.
| flev | AMR level whose coarse/fine data are exchanged. |
| a_bcoefs | Face arrays for that level. |
| tags | Cached copy tags extracted from FabArray communications. |
|
inlinenodiscardnoexcept |
|
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.
|
inlinenodiscardnoexcept |
Iterations and final relative residual of the last solve.
|
delete |
|
delete |
|
inline |
IJ mode only: redo the solver/preconditioner setup at the next solve.
|
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.
| 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).
| a_phi | Per-level EB values; missing or null entries mean zero. |
| a_beta | Per-level b coefficient on the EB (cell-centered). |
EB operator: homogeneous Dirichlet boundary condition on the EB.
|
inline |
Flag whether the assembled operator is singular (v).
|
inline |
Override the maximum number of HYPRE iterations (v).
|
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().
|
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)
|
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.
|
inlinenoexcept |
Throw std::runtime_error instead of aborting when the solve fails.
| 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.
| a_ascalar | Scalar applied to the diagonal term. |
| a_bscalar | Scalar applied to the diffusive term. |
| a_acoefs | Level-by-level a coefficients. |
| a_bcoefs | Level-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_levelbcdata | BC 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_lobc | Low-side boundary-condition types. |
| a_hibc | High-side boundary-condition types. |
| a_coarse_bc | Optional BC data from even coarser AMR level. |
|
inline |
Set HYPRE's logging verbosity (v).
| 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.