GEOS
HypreMGR.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRSTRATEGIES_HPP_
21 #define GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRSTRATEGIES_HPP_
22 
24 
28 
29 #include <_hypre_utilities.h>
30 
31 namespace geos
32 {
33 
38 {
44 };
45 
46 namespace hypre
47 {
48 
49 namespace mgr
50 {
51 
61 {
62  HYPRE_Real tolerance{ 0.0 };
63  HYPRE_Int maxIterations{ 1 };
64  HYPRE_Int printLevel{ 0 };
65  HYPRE_Int cycleType{ 1 };
66  HYPRE_Int fRelaxCycle{ 1 };
67  HYPRE_Int globalSmoothCycle{ 1 };
68  HYPRE_Int nonCpointsToFpoints{ 1 };
69  HYPRE_Int nonGalerkinMaxElmts{ 1 };
70  HYPRE_Int pMaxElmts{ 0 };
71 };
72 
73 inline MGRParameters defaultMGRParameters()
74 {
75  return {};
76 }
77 
78 HYPRE_Int constexpr hydrofractureMinCoarseSize = 1000;
79 
80 inline void setMGRCycleSettings( HYPRE_Solver const solver,
81  MGRParameters const & params = defaultMGRParameters() )
82 {
83  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetCycleType( solver, params.cycleType ) );
84  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetFRelaxCycle( solver, params.fRelaxCycle ) );
85  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetGlobalSmoothCycle( solver, params.globalSmoothCycle ) );
86 }
87 
98 {
99  HYPRE_Real tolerance{ 0.0 };
100  HYPRE_Int maxIterations{ 1 };
101  HYPRE_Int printLevel{ 0 };
102  HYPRE_Int minCoarseSize{ -1 };
103  HYPRE_Int maxCoarseSize{ 9 };
104  HYPRE_Int smoothType{ 6 };
105  HYPRE_Int smoothNumLevels{ 0 };
106  HYPRE_Int smoothNumSweeps{ 1 };
107  HYPRE_Int smoothMaxRowNnz{ 20 };
108  HYPRE_Int iluLocalReordering{ 0 };
109 
110  HYPRE_Real maxRowSum{ -1.0 };
111  HYPRE_Real strongThreshold{ -1.0 };
112  HYPRE_Int numFunctions{ -1 };
113  HYPRE_Int filterFunctions{ -1 };
114  HYPRE_Int pMaxElmts{ -1 };
115 
116  HYPRE_Int aggressiveNumLevels{ -1 };
117  HYPRE_Int aggressiveInterpType{ -1 };
118  HYPRE_Int aggressivePMaxElmts{ -1 };
119  HYPRE_Int coarseningType{ -1 };
120 
121  HYPRE_Int relaxType{ -1 };
122  HYPRE_Int downRelaxType{ -1 };
123  HYPRE_Int upRelaxType{ -1 };
124  HYPRE_Int coarseRelaxType{ -1 };
125  HYPRE_Int numSweeps{ -1 };
126  HYPRE_Int relaxOrder{ -1 };
127 };
128 
129 inline BoomerAMGParameters displacementAMGParameters( integer const separateComponents,
130  bool const filterFunctions,
131  bool const useALMSmoother = false )
132 {
133  BoomerAMGParameters result;
134  result.maxRowSum = 1.0;
135  result.strongThreshold = useALMSmoother ? 0.8 : 0.6;
136  result.numFunctions = 3;
137  result.filterFunctions = filterFunctions ? separateComponents : 0;
138 
139  if( useALMSmoother )
140  {
141  result.pMaxElmts = 20;
142  result.aggressiveNumLevels = 1;
143 #if GEOS_USE_HYPRE_DEVICE != GEOS_USE_HYPRE_CUDA && GEOS_USE_HYPRE_DEVICE != GEOS_USE_HYPRE_HIP
145 #endif
146  }
147 
148 #if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP
151  result.numSweeps = useALMSmoother ? 2 : 1;
152 #else
153  if( useALMSmoother )
154  {
155  result.downRelaxType = 89;
156  result.upRelaxType = 89;
157  result.coarseRelaxType = 9;
158  result.numSweeps = 2;
159  result.relaxOrder = 0;
160  }
161  else
162  {
163  result.relaxOrder = 1;
164  }
165 #endif
166 
167  return result;
168 }
169 
170 inline BoomerAMGParameters almBubbleAMGParameters()
171 {
172  BoomerAMGParameters result = displacementAMGParameters( 0, false, true );
173  result.strongThreshold = 0.75;
174  result.filterFunctions = 0;
175  result.pMaxElmts = 10;
176  result.aggressiveNumLevels = -1;
177 #if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP
179 #else
180  result.coarseningType = -1;
181 #endif
182  result.numSweeps = 1;
183  return result;
184 }
185 
186 inline BoomerAMGParameters almReservoirDisplacementAMGParameters( integer const separateComponents )
187 {
188  BoomerAMGParameters result = displacementAMGParameters( separateComponents, true );
189 #if GEOS_USE_HYPRE_DEVICE != GEOS_USE_HYPRE_CUDA && GEOS_USE_HYPRE_DEVICE != GEOS_USE_HYPRE_HIP
190  result.downRelaxType = 89;
191  result.upRelaxType = 89;
192  result.coarseRelaxType = 9;
193  result.numSweeps = 1;
194  result.relaxOrder = 0;
195 #endif
196  return result;
197 }
198 
199 inline BoomerAMGParameters pressureAMGParameters( HYPRE_Int const minCoarseSize = -1 )
200 {
201  BoomerAMGParameters result;
202  result.minCoarseSize = minCoarseSize;
203  result.aggressiveNumLevels = 1;
204  result.aggressivePMaxElmts = 20;
206 
207 #if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP
210  result.maxRowSum = 1.0;
212  result.numSweeps = 2;
213 #else
214  result.relaxOrder = 1;
215 #endif
216 
217  return result;
218 }
219 
220 inline BoomerAMGParameters pressureTemperatureAMGParameters()
221 {
222  BoomerAMGParameters result;
223  result.aggressiveNumLevels = 1;
224  result.aggressivePMaxElmts = 16;
225  result.numFunctions = 2;
226 
227 #if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP
228  result.aggressiveNumLevels = 0;
230  result.maxRowSum = 1.0;
232  result.numSweeps = 2;
233 #else
234  result.relaxOrder = 1;
235 #endif
236 
237  return result;
238 }
239 
240 inline void configureBoomerAMG( HyprePrecWrapper & solver,
241  BoomerAMGParameters const & params )
242 {
243  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGCreate( &solver.ptr ) );
244  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetILULocalReordering( solver.ptr, params.iluLocalReordering ) );
245  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetILUMaxRowNnz( solver.ptr, params.smoothMaxRowNnz ) );
246  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetTol( solver.ptr, params.tolerance ) );
247  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetMaxIter( solver.ptr, params.maxIterations ) );
248  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetPrintLevel( solver.ptr, params.printLevel ) );
249  if( params.minCoarseSize >= 0 )
250  {
251  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetMinCoarseSize( solver.ptr, params.minCoarseSize ) );
252  }
253  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetMaxCoarseSize( solver.ptr, params.maxCoarseSize ) );
254  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetSmoothType( solver.ptr, params.smoothType ) );
255  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetSmoothNumLevels( solver.ptr, params.smoothNumLevels ) );
256  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetSmoothNumSweeps( solver.ptr, params.smoothNumSweeps ) );
257 
258  if( params.maxRowSum >= 0.0 )
259  {
260  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetMaxRowSum( solver.ptr, params.maxRowSum ) );
261  }
262  if( params.strongThreshold >= 0.0 )
263  {
264  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetStrongThreshold( solver.ptr, params.strongThreshold ) );
265  }
266  if( params.numFunctions >= 0 )
267  {
268  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetNumFunctions( solver.ptr, params.numFunctions ) );
269  }
270  if( params.filterFunctions >= 0 )
271  {
272  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetFilterFunctions( solver.ptr, params.filterFunctions ) );
273  }
274  if( params.pMaxElmts >= 0 )
275  {
276  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetPMaxElmts( solver.ptr, params.pMaxElmts ) );
277  }
278  if( params.aggressiveNumLevels >= 0 )
279  {
280  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetAggNumLevels( solver.ptr, params.aggressiveNumLevels ) );
281  }
282  if( params.aggressiveInterpType >= 0 )
283  {
284  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetAggInterpType( solver.ptr, params.aggressiveInterpType ) );
285  }
286  if( params.aggressivePMaxElmts >= 0 )
287  {
288  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetAggPMaxElmts( solver.ptr, params.aggressivePMaxElmts ) );
289  }
290  if( params.coarseningType >= 0 )
291  {
292  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetCoarsenType( solver.ptr, params.coarseningType ) );
293  }
294  if( params.relaxType >= 0 )
295  {
296  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetRelaxType( solver.ptr, params.relaxType ) );
297  }
298  if( params.numSweeps >= 0 )
299  {
300  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetNumSweeps( solver.ptr, params.numSweeps ) );
301  }
302  if( params.relaxOrder >= 0 )
303  {
304  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetRelaxOrder( solver.ptr, params.relaxOrder ) );
305  }
306  if( params.downRelaxType >= 0 )
307  {
308  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetCycleRelaxType( solver.ptr, params.downRelaxType, 1 ) );
309  }
310  if( params.upRelaxType >= 0 )
311  {
312  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetCycleRelaxType( solver.ptr, params.upRelaxType, 2 ) );
313  }
314  if( params.coarseRelaxType >= 0 )
315  {
316  GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetCycleRelaxType( solver.ptr, params.coarseRelaxType, 3 ) );
317  }
318 }
319 
328 template< typename STRATEGY >
330  arrayView1d< int const > const & numComponentsPerField,
331  HyprePrecWrapper & precond,
332  HypreMGRData & mgrData )
333 {
334  STRATEGY strategy( numComponentsPerField );
335  strategy.setup( params, precond, mgrData );
336 }
337 
342 template< int NLEVEL >
344 {
345 public:
346 
347  static constexpr HYPRE_Int numLevels = NLEVEL;
348 
349 protected:
350 
351  HYPRE_Int m_numBlocks{ 0 };
352 
354  HYPRE_Int m_numLabels[numLevels]{ -1 };
355  HYPRE_Int * m_ptrLabels[numLevels]{ nullptr };
356 
358  HYPRE_Int m_levelFRelaxIters[numLevels]{ -1 };
364  HYPRE_Real m_coarseGridThreshold{ 1.0e-20 };
365 
366  // TODO: the following options are currently commented out in MGR's code.
367  // Let's consider their use when re-enable in hypre
368  // HYPRE_Int m_numRestrictSweeps{ -1 }; ///< Number of restrict sweeps
369  // HYPRE_Int m_numInterpSweeps{ -1 }; ///< Number of interpolation sweeps
370 
376  static HYPRE_Int totalNumBlocks( arrayView1d< int const > const & numComponentsPerField )
377  {
378  HYPRE_Int result = 0;
379  for( localIndex i = 0; i < numComponentsPerField.size(); ++i )
380  {
381  result += LvArray::integerConversion< HYPRE_Int >( numComponentsPerField[i] );
382  }
383  return result;
384  }
385 
390  explicit MGRStrategyBase( HYPRE_Int const numBlocks )
391  : m_numBlocks( numBlocks )
392  {
393  for( HYPRE_Int i = 0; i < numLevels; ++i )
394  {
400  }
401  }
402 
406  void setupLabels()
407  {
408  for( HYPRE_Int i = 0; i < numLevels; ++i )
409  {
410  m_numLabels[i] = m_labels[i].size();
411  m_ptrLabels[i] = m_labels[i].data();
412  }
413  }
414 
421  HypreMGRData & mgrData )
422 
423  {
425  MGRParameters const mgrParameters = defaultMGRParameters();
426 
427  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetCpointsByPointMarkerArray( precond.ptr,
430  mgrData.pointMarkers.data() ) );
431  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetLevelFRelaxType( precond.ptr, toUnderlyingPtr( m_levelFRelaxType ) ) );
432  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetLevelNumRelaxSweeps( precond.ptr, m_levelFRelaxIters ) );
433  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetLevelInterpType( precond.ptr, toUnderlyingPtr( m_levelInterpType ) ) );
434  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetLevelRestrictType( precond.ptr, toUnderlyingPtr( m_levelRestrictType ) ) );
435  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetCoarseGridMethod( precond.ptr, toUnderlyingPtr( m_levelCoarseGridMethod ) ) );
436  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetLevelSmoothType( precond.ptr, toUnderlyingPtr( m_levelGlobalSmootherType ) ) );
437  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetLevelSmoothIters( precond.ptr, m_levelGlobalSmootherIters ) );
438  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetTruncateCoarseGridThreshold( precond.ptr, m_coarseGridThreshold ) );
439  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetNonCpointsToFpoints( precond.ptr, mgrParameters.nonCpointsToFpoints ) );
440  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetNonGalerkinMaxElmts( precond.ptr, mgrParameters.nonGalerkinMaxElmts ) );
441  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetPMaxElmts( precond.ptr, mgrParameters.pMaxElmts ) );
442  }
443 
444 public:
450  {}
451 
459  {
460  // Ensure that if no F-relaxation or global smoothing is chosen the corresponding number
461  // of iteration is set to 0
462  for( HYPRE_Int i = 0; i < numLevels; ++i )
463  {
465  {
466  m_levelFRelaxIters[i] = 0;
467  }
469  {
471  }
472  }
473  }
474 
475 protected:
476 
483  integer const & separateComponents )
484  {
485  configureBoomerAMG( solver, displacementAMGParameters( separateComponents, true ) );
486 
487  solver.setup = HYPRE_BoomerAMGSetup;
488  solver.solve = HYPRE_BoomerAMGSolve;
489  solver.destroy = HYPRE_BoomerAMGDestroy;
490  }
491 
503  integer const separateComponents,
504  bool const bubbleCoarse )
505  {
506  configureBoomerAMG( solver, bubbleCoarse
507  ? almBubbleAMGParameters()
508  : displacementAMGParameters( separateComponents, true, true ) );
509 
510  solver.setup = HYPRE_BoomerAMGSetup;
511  solver.solve = HYPRE_BoomerAMGSolve;
512  solver.destroy = HYPRE_BoomerAMGDestroy;
513  }
514 
521  integer const separateComponents )
522  {
523  configureBoomerAMG( solver, almReservoirDisplacementAMGParameters( separateComponents ) );
524 
525  solver.setup = HYPRE_BoomerAMGSetup;
526  solver.solve = HYPRE_BoomerAMGSolve;
527  solver.destroy = HYPRE_BoomerAMGDestroy;
528  }
529 
535  HYPRE_Int const minCoarseSize = -1 )
536  {
537  configureBoomerAMG( solver, pressureAMGParameters( minCoarseSize ) );
538 
539  solver.setup = HYPRE_BoomerAMGSetup;
540  solver.solve = HYPRE_BoomerAMGSolve;
541  solver.destroy = HYPRE_BoomerAMGDestroy;
542  }
543 
549  {
550  configureBoomerAMG( solver, pressureTemperatureAMGParameters() );
551 
552  solver.setup = HYPRE_BoomerAMGSetup;
553  solver.solve = HYPRE_BoomerAMGSolve;
554  solver.destroy = HYPRE_BoomerAMGDestroy;
555  }
556 
567  HypreMGRData & mgrData,
568  integer const & separateComponents )
569  {
570  setDisplacementAMG( mgrData.mechSolver, separateComponents );
571  HYPRE_MGRSetFSolver( precond.ptr, mgrData.mechSolver.solve, mgrData.mechSolver.setup, mgrData.mechSolver.ptr );
572  }
573 
578  HypreMGRData & mgrData,
579  integer const & separateComponents,
580  HYPRE_Int const level )
581  {
582  setDisplacementAMG( mgrData.mechSolver, separateComponents );
583  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetFSolverAtLevel( precond.ptr, mgrData.mechSolver.ptr, level ) );
584  }
596  void setILUFSolverAtLevel( HYPRE_Int const level,
597  HyprePrecWrapper & precond,
598  HypreMGRData & mgrData )
599  {
600  GEOS_LAI_CHECK_ERROR( HYPRE_ILUCreate( &mgrData.iluSolver.ptr ) );
601  GEOS_LAI_CHECK_ERROR( HYPRE_ILUSetType( mgrData.iluSolver.ptr, 0 ) );
602  GEOS_LAI_CHECK_ERROR( HYPRE_ILUSetLevelOfFill( mgrData.iluSolver.ptr, 0 ) );
603  GEOS_LAI_CHECK_ERROR( HYPRE_ILUSetMaxIter( mgrData.iluSolver.ptr, 1 ) );
604  GEOS_LAI_CHECK_ERROR( HYPRE_ILUSetTol( mgrData.iluSolver.ptr, 0.0 ) );
605  GEOS_LAI_CHECK_ERROR( HYPRE_ILUSetLocalReordering( mgrData.iluSolver.ptr, 0 ) );
606  GEOS_LAI_CHECK_ERROR( HYPRE_ILUSetPrintLevel( mgrData.iluSolver.ptr, 0 ) );
607 
608  mgrData.iluSolver.setup = HYPRE_ILUSetup;
609  mgrData.iluSolver.solve = HYPRE_ILUSolve;
610  mgrData.iluSolver.destroy = HYPRE_ILUDestroy;
611 
612  GEOS_LAI_CHECK_ERROR( HYPRE_MGRSetFSolverAtLevel( precond.ptr, mgrData.iluSolver.ptr, level ) );
613  }
614 
621  {
622  /* (Required) Create ILU solver */
623  HYPRE_ILUCreate( &solver.ptr );
624 
625  /* (Recommended) General solver options */
626  int const ilu_type = 0; /* 0, 1, 10, 11, 20, 21, 30, 31, 40, 41, 50 */
627  int const max_iter = 1;
628  double const tol = 0.0;
629  int const reordering = 0; /* 0: none, 1: RCM */
630  int const print_level = 0;
631  HYPRE_ILUSetType( solver.ptr, ilu_type );
632  HYPRE_ILUSetMaxIter( solver.ptr, max_iter );
633  HYPRE_ILUSetTol( solver.ptr, tol );
634  HYPRE_ILUSetLocalReordering( solver.ptr, reordering );
635  HYPRE_ILUSetPrintLevel( solver.ptr, print_level );
636 
637  solver.setup = HYPRE_ILUSetup;
638  solver.solve = HYPRE_ILUSolve;
639  solver.destroy = HYPRE_ILUDestroy;
640  }
641 
642 };
643 
651 void createMGR( LinearSolverParameters const & params,
652  DofManager const * const dofManager,
653  HyprePrecWrapper & precond,
654  HypreMGRData & mgrData );
655 
656 } // namespace mgr
657 
658 } // namespace hypre
659 
660 } // namespace geos
661 
662 #endif /*GEOS_LINEARALGEBRA_INTERFACES_HYPREMGRSTRATEGIES_HPP_*/
void createMGR(LinearSolverParameters const &params, DofManager const *const dofManager, HyprePrecWrapper &precond, HypreMGRData &mgrData)
Create the MGR preconditioner object.
void setStrategy(LinearSolverParameters::MGR const &params, arrayView1d< int const > const &numComponentsPerField, HyprePrecWrapper &precond, HypreMGRData &mgrData)
Helper to simplify MGR setup.
Definition: HypreMGR.hpp:329
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Definition: DofManager.hpp:45
Helper struct for strategies that provides some basic parameter arrays needed by MGR.
Definition: HypreMGR.hpp:344
MGRCoarseGridMethod m_levelCoarseGridMethod[numLevels]
Coarse grid method for each level.
Definition: HypreMGR.hpp:361
HYPRE_Int m_numBlocks
Number of different matrix blocks treated separately.
Definition: HypreMGR.hpp:351
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.
Definition: HypreMGR.hpp:502
void setDisplacementAMG(HyprePrecWrapper &solver, integer const &separateComponents)
Set up BoomerAMG to perform the solve for the displacement system.
Definition: HypreMGR.hpp:482
MGRInterpolationType m_levelInterpType[numLevels]
Interpolation type for each level.
Definition: HypreMGR.hpp:359
static HYPRE_Int totalNumBlocks(arrayView1d< int const > const &numComponentsPerField)
Total number of dof labels, i.e. the sum of all fields' components.
Definition: HypreMGR.hpp:376
void setILUCoarseSolver(HyprePrecWrapper &solver)
Definition: HypreMGR.hpp:620
MGRStrategyBase(HYPRE_Int const numBlocks)
Constructor.
Definition: HypreMGR.hpp:390
void setPressureTemperatureAMG(HyprePrecWrapper &solver)
Set up BoomerAMG to perform the solve for the pressure/temperature system.
Definition: HypreMGR.hpp:548
static constexpr HYPRE_Int numLevels
Number of levels.
Definition: HypreMGR.hpp:347
void setMechanicsFSolverAtLevel(HyprePrecWrapper &precond, HypreMGRData &mgrData, integer const &separateComponents, HYPRE_Int const level)
Configure the displacement F-solver attached to a specific MGR level.
Definition: HypreMGR.hpp:577
stdVector< HYPRE_Int > m_labels[numLevels]
Dof labels kept at each level.
Definition: HypreMGR.hpp:353
void setMechanicsFSolver(HyprePrecWrapper &precond, HypreMGRData &mgrData, integer const &separateComponents)
Set up BoomerAMG to perform the mechanics F-solve for the first F-relaxation.
Definition: HypreMGR.hpp:566
void normalizeReductionParameters()
Normalize MGR iteration counts without touching a HYPRE handle.
Definition: HypreMGR.hpp:458
void configure(LinearSolverParameters::MGR const &)
Apply parameter-dependent changes to the reduction hierarchy.
Definition: HypreMGR.hpp:449
void setupLabels()
Call this after populating lv_cindexes.
Definition: HypreMGR.hpp:406
void setALMReservoirDisplacementAMG(HyprePrecWrapper &solver, integer const separateComponents)
Set up the displacement F-solver used by the reservoir ALM strategy.
Definition: HypreMGR.hpp:520
void setPressureAMG(HyprePrecWrapper &solver, HYPRE_Int const minCoarseSize=-1)
Set up BoomerAMG to perform the solve for the pressure system.
Definition: HypreMGR.hpp:534
HYPRE_Int m_levelFRelaxIters[numLevels]
Number of F-relaxation iterations for each level.
Definition: HypreMGR.hpp:358
void setReduction(HyprePrecWrapper &precond, HypreMGRData &mgrData)
Helper function that sets the reduction features common to all mgr strategies.
Definition: HypreMGR.hpp:420
MGRFRelaxationType m_levelFRelaxType[numLevels]
F-relaxation type for each level.
Definition: HypreMGR.hpp:357
HYPRE_Int * m_ptrLabels[numLevels]
Pointers to each level's labels, as consumed by MGR.
Definition: HypreMGR.hpp:355
HYPRE_Int m_levelGlobalSmootherIters[numLevels]
Number of global smoother iterations for each level.
Definition: HypreMGR.hpp:363
HYPRE_Real m_coarseGridThreshold
Coarse grid truncation threshold.
Definition: HypreMGR.hpp:364
MGRGlobalSmootherType m_levelGlobalSmootherType[numLevels]
Global smoother type for each level.
Definition: HypreMGR.hpp:362
HYPRE_Int m_numLabels[numLevels]
Number of dof labels kept.
Definition: HypreMGR.hpp:354
void setILUFSolverAtLevel(HYPRE_Int const level, HyprePrecWrapper &precond, HypreMGRData &mgrData)
Set up an explicitly configured ILU(0) F-solver for a given MGR level.
Definition: HypreMGR.hpp:596
MGRRestrictionType m_levelRestrictType[numLevels]
Restriction type for each level.
Definition: HypreMGR.hpp:360
#define GEOS_LAI_CHECK_ERROR(call)
Definition: common.hpp:119
MGRCoarseGridMethod
This enum class specifies the strategy for level coarse grid computation in MGR.
Definition: HypreUtils.hpp:608
@ galerkin
Galerkin coarse grid computation using RAP.
MGRRestrictionType
This enum class specifies the strategy for computing the level restriction operator in MGR.
Definition: HypreUtils.hpp:593
HYPRE_Int getAMGAggressiveInterpolationType(LinearSolverParameters::AMG::AggInterpType const &type)
Returns hypre's identifier of the AMG aggressive interpolation type.
Definition: HypreUtils.hpp:446
MGRFRelaxationType
This enum class specifies the F-relaxation type.
Definition: HypreUtils.hpp:625
@ none
no F-relaxation if performed
HYPRE_Int getAMGRelaxationType(LinearSolverParameters::AMG::SmootherType const &type)
Returns hypre's identifier of the AMG smoother type.
Definition: HypreUtils.hpp:401
HYPRE_Int getAMGCoarseningType(LinearSolverParameters::AMG::CoarseningType const &type)
Returns hypre's identifier of the AMG coarsening type.
Definition: HypreUtils.hpp:507
MGRInterpolationType
This enum class specifies the strategy for computing the level intepolation operator in MGR.
Definition: HypreUtils.hpp:578
MGRGlobalSmootherType
This enum class specifies the global smoother type.
Definition: HypreUtils.hpp:648
@ none
no global smoothing is performed (default)
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:179
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:84
int integer
Signed integer type.
Definition: DataTypes.hpp:81
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:175
internal::StdVectorWrapper< T, Allocator, USE_STD_CONTAINER_BOUNDS_CHECKING > stdVector
Container for hypre preconditioner auxiliary data for MGR.
Definition: HypreMGR.hpp:38
HyprePrecWrapper mechSolver
MGR mechanics fine solver pointer and functions.
Definition: HypreMGR.hpp:41
HyprePrecWrapper nestedSolver
Optional nested MGR F-relaxation wrapper.
Definition: HypreMGR.hpp:43
HyprePrecWrapper coarseSolver
MGR coarse solver pointer and functions.
Definition: HypreMGR.hpp:40
HyprePrecWrapper iluSolver
MGR ILU fine solver pointer and functions.
Definition: HypreMGR.hpp:42
array1d< HYPRE_Int > pointMarkers
array1d of unique tags for local degrees of freedom
Definition: HypreMGR.hpp:39
Container for hypre preconditioner function pointers.
Definition: HypreUtils.hpp:52
HYPRE_Solver ptr
pointer to preconditioner
Definition: HypreUtils.hpp:62
SetupFunc setup
pointer to setup function
Definition: HypreUtils.hpp:63
DestroyFunc destroy
pointer to destroy function
Definition: HypreUtils.hpp:65
SolveFunc solve
pointer to apply function
Definition: HypreUtils.hpp:64
@ chebyshev
Chebyshev polynomial smoothing.
@ Falgout
Ruge-Stueben followed by CLJP.
@ PMIS
Parallel coarsening as CLJP but with lower complexities (GPU support)
@ modifiedExtendedE
Modularized Extended+e (GPU support)
Multigrid reduction parameters.
Set of parameters for a linear solver or preconditioner.
The BoomerAMG options used by the MGR strategies.
Definition: HypreMGR.hpp:98
MGR settings shared by the legacy HYPRE setup and generated YAML.
Definition: HypreMGR.hpp:61