1#ifndef AMREX_HYPRE_ML_NODELAP_H_
2#define AMREX_HYPRE_ML_NODELAP_H_
3#include <AMReX_Config.H>
86 std::string a_prefix =
"hypre_mlnodelap",
110 Real a_reltol,
Real a_abstol,
int a_maxiter);
167 if (m_ij) { m_ij->setNeedSetup(); }
168 m_algmg_reset =
true;
183 void numberUnknowns ();
186 void dumpSystem (
int k,
bool solution);
188 void fail (std::string
const& msg)
const;
191 [[nodiscard]]
int neumannScale (
int lev,
IntVect const& iv)
const;
193 [[nodiscard]]
bool onDirichletFace (
int lev,
IntVect const& iv)
const;
198 std::string m_prefix;
220 bool m_eb_scaling =
true;
221 bool m_has_dirichlet =
false;
222 bool m_throw_exception =
false;
225 struct DirichletCoupling {
Long row;
Real coef;
int lev;
int li;
IntVect node; };
226 Vector<DirichletCoupling> m_dbc;
228 Vector<Long> m_rank_offset;
234 enum class Backend { hypre, algmg };
235 Backend m_backend = Backend::hypre;
239 std::string m_dump_prefix;
240 Long m_dump_gather_max = 50000000;
244 void ijBeginAssembly ();
248 void ijEndAssembly ();
251 composite::OwnedCSR m_csr;
252 std::unique_ptr<SpMatrix<Real>> m_spA;
253 std::unique_ptr<AlgMG<Real>> m_algmg;
259 std::unique_ptr<HypreIJIface> m_ij;
260 HYPRE_IJMatrix m_A =
nullptr;
261 HYPRE_IJVector m_b =
nullptr;
262 HYPRE_IJVector m_x =
nullptr;
265 Real m_final_res = 0.0;
271 bool m_reuse_setup =
false;
272 int m_reuse_max_iter = 0;
275 composite::SetupReuse m_reuse;
280 bool m_recompute_pp =
false;
281 bool m_matrix_assembled =
false;
282 bool m_ij_gather_failed =
false;
286 composite::EntryGather m_ij_gather;
292 composite::EntryGather m_alg_gather;
293 bool m_algmg_reset =
false;
294 bool m_algmg_kept =
false;
A FortranArrayBox(FAB)-like object.
Definition AMReX_BaseFab.H:243
An Array of FortranArrayBox(FAB)-like Objects.
Definition AMReX_FabArray.H:383
Abstract factory interface for creating, aliasing, and destroying FAB objects.
Definition AMReX_FabFactory.H:73
HypreMLNodeLap & operator=(HypreMLNodeLap const &)=delete
Real getFinalResidualNorm() const
Definition AMReX_HypreMLNodeLap.H:118
HypreMLNodeLap(MLNodeLaplacian const &a_linop, std::string a_prefix="hypre_mlnodelap", int a_verbose=0)
Assemble the composite matrix from a prepared linear operator.
Definition AMReX_HypreMLNodeLap.cpp:242
void resetSolverSetup()
Redo the solver setup (hypre) or the AlgMG hierarchy at the next solve.
Definition AMReX_HypreMLNodeLap.H:166
void updateMatrix()
Assemble the matrix again from the operator's current coefficients, for the following solves: the MLN...
Definition AMReX_HypreMLNodeLap.cpp:1180
HypreMLNodeLap(HypreMLNodeLap const &)=delete
void setThrowException(bool t) noexcept
Definition AMReX_HypreMLNodeLap.H:114
void setReuseSetupMaxIter(int n) noexcept
Definition AMReX_HypreMLNodeLap.H:155
int getNumIters() const
Iterations and final relative residual of the last solve.
Definition AMReX_HypreMLNodeLap.H:117
void buildMatrix()
Definition AMReX_HypreMLNodeLap.cpp:529
HYPRE_BigInt BigInt
Definition AMReX_HypreMLNodeLap.H:75
BigInt numUnknowns() const
Number of composite unknowns.
Definition AMReX_HypreMLNodeLap.H:121
void populateMatrix(Gpu::DeviceVector< BigInt > &rows, Gpu::DeviceVector< BigInt > &cols, Gpu::DeviceVector< Real > &vals)
Definition AMReX_HypreMLNodeLap.cpp:1055
HypreMLNodeLap(HypreMLNodeLap &&)=delete
void setReuseSetupMaxChange(Real f)
Definition AMReX_HypreMLNodeLap.H:164
void solve(Vector< MultiFab * > const &a_sol, Vector< MultiFab const * > const &a_rhs, Real a_reltol, Real a_abstol, int a_maxiter)
Solve the composite system.
Definition AMReX_HypreMLNodeLap.cpp:1398
void setReuseSolverSetup(bool v)
Keep the solver setup across updateMatrix() calls, as HypreMLABecLap::setReuseSolverSetup: the kept s...
Definition AMReX_HypreMLNodeLap.cpp:1037
Real getMatrixScale() const noexcept
Definition AMReX_HypreMLNodeLap.H:151
Definition AMReX_MLNodeLaplacian.H:34
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:29
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:80
amrex_long Long
Definition AMReX_INT.H:30
PODVector< T, ArenaAllocator< T > > DeviceVector
A PODVector that uses the standard memory Arena. Note that the memory might or might not be managed d...
Definition AMReX_GpuContainers.H:24
int MPI_Comm
Definition AMReX_ccse-mpi.H:51
static constexpr int MPI_COMM_NULL
Definition AMReX_ccse-mpi.H:59
Definition AMReX_Amr.cpp:50
MLNodeLaplacianT< MultiFab > MLNodeLaplacian
Double precision nodal Laplacian.
Definition AMReX_HypreMLNodeLap.H:23
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:38