20 #ifndef GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRSTRATEGIES_HPP_
21 #define GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRSTRATEGIES_HPP_
29 #include <_hypre_utilities.h>
59 template<
typename STRATEGY >
65 STRATEGY strategy( numComponentsPerField );
66 strategy.setup( params, precond, mgrData );
73 template<
int NLEVEL >
109 HYPRE_Int result = 0;
110 for(
localIndex i = 0; i < numComponentsPerField.size(); ++i )
112 result += LvArray::integerConversion< HYPRE_Int >( numComponentsPerField[i] );
124 for( HYPRE_Int i = 0; i <
numLevels; ++i )
139 for( HYPRE_Int i = 0; i <
numLevels; ++i )
157 for( HYPRE_Int i = 0; i <
numLevels; ++i )
191 integer const & separateComponents )
199 #if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP
210 solver.
setup = HYPRE_BoomerAMGSetup;
211 solver.
solve = HYPRE_BoomerAMGSolve;
212 solver.
destroy = HYPRE_BoomerAMGDestroy;
226 integer const separateComponents,
227 bool const bubbleCoarse )
236 GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetFilterFunctions( solver.
ptr, bubbleCoarse ? 0 : separateComponents ) );
246 #if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP
253 HYPRE_Int constexpr l1SymmetricHybridGaussSeidel = 89;
254 HYPRE_Int constexpr gaussianElimination = 9;
262 solver.
setup = HYPRE_BoomerAMGSetup;
263 solver.
solve = HYPRE_BoomerAMGSolve;
264 solver.
destroy = HYPRE_BoomerAMGDestroy;
280 #if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP
290 solver.
setup = HYPRE_BoomerAMGSetup;
291 solver.
solve = HYPRE_BoomerAMGSolve;
292 solver.
destroy = HYPRE_BoomerAMGDestroy;
308 #if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP
318 solver.
setup = HYPRE_BoomerAMGSetup;
319 solver.
solve = HYPRE_BoomerAMGSolve;
320 solver.
destroy = HYPRE_BoomerAMGDestroy;
334 integer const & separateComponents )
347 HYPRE_ILUCreate( &solver.
ptr );
350 int const ilu_type = 0;
351 int const max_iter = 1;
352 double const tol = 0.0;
353 int const reordering = 0;
354 int const print_level = 0;
355 HYPRE_ILUSetType( solver.
ptr, ilu_type );
356 HYPRE_ILUSetMaxIter( solver.
ptr, max_iter );
357 HYPRE_ILUSetTol( solver.
ptr, tol );
358 HYPRE_ILUSetLocalReordering( solver.
ptr, reordering );
359 HYPRE_ILUSetPrintLevel( solver.
ptr, print_level );
361 solver.
setup = HYPRE_ILUSetup;
362 solver.
solve = HYPRE_ILUSolve;
363 solver.
destroy = HYPRE_ILUDestroy;
void createMGR(LinearSolverParameters const ¶ms, DofManager const *const dofManager, HyprePrecWrapper &precond, HypreMGRData &mgrData)
Create the MGR preconditioner object.
void setStrategy(LinearSolverParameters::MGR const ¶ms, arrayView1d< int const > const &numComponentsPerField, HyprePrecWrapper &precond, HypreMGRData &mgrData)
Helper to simplify MGR setup.
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Helper struct for strategies that provides some basic parameter arrays needed by MGR.
MGRCoarseGridMethod m_levelCoarseGridMethod[numLevels]
Coarse grid method for each level.
HYPRE_Int m_numBlocks
Number of different matrix blocks treated separately.
void setALMDisplacementAMG(HyprePrecWrapper &solver, integer const separateComponents, bool const bubbleCoarse)
Set up one of the two BoomerAMG instances used by the fully coupled single-phase ALM hierarchy.
void setDisplacementAMG(HyprePrecWrapper &solver, integer const &separateComponents)
Set up BoomerAMG to perform the solve for the displacement system.
MGRInterpolationType m_levelInterpType[numLevels]
Interpolation type for each level.
static HYPRE_Int totalNumBlocks(arrayView1d< int const > const &numComponentsPerField)
Total number of dof labels, i.e. the sum of all fields' components.
void setILUCoarseSolver(HyprePrecWrapper &solver)
MGRStrategyBase(HYPRE_Int const numBlocks)
Constructor.
void setPressureTemperatureAMG(HyprePrecWrapper &solver)
Set up BoomerAMG to perform the solve for the pressure/temperature system.
static constexpr HYPRE_Int numLevels
Number of levels.
stdVector< HYPRE_Int > m_labels[numLevels]
Dof labels kept at each level.
void setMechanicsFSolver(HyprePrecWrapper &precond, HypreMGRData &mgrData, integer const &separateComponents)
Set up BoomerAMG to perform the mechanics F-solve for the first F-relaxation.
void setupLabels()
Call this after populating lv_cindexes.
HYPRE_Int m_levelFRelaxIters[numLevels]
Number of F-relaxation iterations for each level.
void setPressureAMG(HyprePrecWrapper &solver)
Set up BoomerAMG to perform the solve for the pressure system.
void setReduction(HyprePrecWrapper &precond, HypreMGRData &mgrData)
Helper function that sets the reduction features common to all mgr strategies.
MGRFRelaxationType m_levelFRelaxType[numLevels]
F-relaxation type for each level.
HYPRE_Int * m_ptrLabels[numLevels]
Pointers to each level's labels, as consumed by MGR.
HYPRE_Int m_levelGlobalSmootherIters[numLevels]
Number of global smoother iterations for each level.
HYPRE_Real m_coarseGridThreshold
Coarse grid truncation threshold.
MGRGlobalSmootherType m_levelGlobalSmootherType[numLevels]
Global smoother type for each level.
HYPRE_Int m_numLabels[numLevels]
Number of dof labels kept.
MGRRestrictionType m_levelRestrictType[numLevels]
Restriction type for each level.
#define GEOS_LAI_CHECK_ERROR(call)
MGRCoarseGridMethod
This enum class specifies the strategy for level coarse grid computation in MGR.
@ galerkin
Galerkin coarse grid computation using RAP.
MGRRestrictionType
This enum class specifies the strategy for computing the level restriction operator in MGR.
HYPRE_Int getAMGAggressiveInterpolationType(LinearSolverParameters::AMG::AggInterpType const &type)
Returns hypre's identifier of the AMG aggressive interpolation type.
MGRFRelaxationType
This enum class specifies the F-relaxation type.
@ none
no F-relaxation if performed
HYPRE_Int getAMGRelaxationType(LinearSolverParameters::AMG::SmootherType const &type)
Returns hypre's identifier of the AMG smoother type.
@ PMIS
Parallel coarsening algorithm using independent sets.
HYPRE_Int getAMGCoarseningType(LinearSolverParameters::AMG::CoarseningType const &type)
Returns hypre's identifier of the AMG coarsening type.
MGRInterpolationType
This enum class specifies the strategy for computing the level intepolation operator in MGR.
@ jacobi
Diagonal scaling.
MGRGlobalSmootherType
This enum class specifies the global smoother type.
@ none
no global smoothing is performed (default)
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
int integer
Signed integer type.
Array< T, 1 > array1d
Alias for 1D array.
internal::StdVectorWrapper< T, Allocator, USE_STD_CONTAINER_BOUNDS_CHECKING > stdVector
Container for hypre preconditioner auxiliary data for MGR.
HyprePrecWrapper mechSolver
MGR mechanics fine solver pointer and functions.
HyprePrecWrapper nestedSolver
Optional nested MGR F-relaxation wrapper.
HyprePrecWrapper coarseSolver
MGR coarse solver pointer and functions.
array1d< HYPRE_Int > pointMarkers
array1d of unique tags for local degrees of freedom
Container for hypre preconditioner function pointers.
HYPRE_Solver ptr
pointer to preconditioner
SetupFunc setup
pointer to setup function
DestroyFunc destroy
pointer to destroy function
SolveFunc solve
pointer to apply function
@ chebyshev
Chebyshev polynomial smoothing.
@ l1jacobi
l1-Jacobi smoothing
@ Falgout
Ruge-Stueben followed by CLJP.
@ PMIS
Parallel coarsening as CLJP but with lower complexities (GPU support)
@ multipass
Multipass (GPU support)
@ modifiedExtendedE
Modularized Extended+e (GPU support)
Multigrid reduction parameters.
Set of parameters for a linear solver or preconditioner.