Skip to content

Commit ef4d330

Browse files
authored
Hypre iterative ILU features (#4818)
Adding the capability to use iterative ILU as a BoomerAMG smoother and as a stand-alone preconditioner
1 parent 477c09f commit ef4d330

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

Src/Extern/HYPRE/AMReX_HypreIJIface.H

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ private:
6060
// Preconditioners
6161
void boomeramg_precond_configure(const std::string& prefix);
6262
void euclid_precond_configure(const std::string& prefix);
63+
void ilu_precond_configure(const std::string& prefix);
6364

6465
// Solvers
6566
void boomeramg_solver_configure(const std::string& prefix);

Src/Extern/HYPRE/AMReX_HypreIJIface.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ void HypreIJIface::init_preconditioner (
203203
boomeramg_precond_configure(prefix);
204204
} else if (name == "euclid") {
205205
euclid_precond_configure(prefix);
206+
} else if (name == "ILU") {
207+
ilu_precond_configure(prefix);
206208
} else {
207209
amrex::Abort("Invalid HYPRE preconditioner specified: " + name);
208210
}
@@ -324,6 +326,10 @@ void HypreIJIface::boomeramg_precond_configure (const std::string& prefix)
324326
hpp("bamg_ilu_level", HYPRE_BoomerAMGSetILULevel);
325327
hpp("bamg_ilu_max_iter", HYPRE_BoomerAMGSetILUMaxIter);
326328
#if defined(HYPRE_RELEASE_NUMBER) && (HYPRE_RELEASE_NUMBER >= 22900)
329+
hpp("bamg_ilu_iterative_algorithm_type", HYPRE_BoomerAMGSetILUIterSetupType);
330+
hpp("bamg_ilu_iterative_setup_type", HYPRE_BoomerAMGSetILUIterSetupOption);
331+
hpp("bamg_ilu_iterative_max_iter", HYPRE_BoomerAMGSetILUIterSetupMaxIter);
332+
hpp("bamg_ilu_iterative_tolerance", HYPRE_BoomerAMGSetILUIterSetupTolerance);
327333
hpp("bamg_ilu_reordering_type", HYPRE_BoomerAMGSetILULocalReordering);
328334
hpp("bamg_ilu_tri_solve", HYPRE_BoomerAMGSetILUTriSolve);
329335
hpp("bamg_ilu_lower_jacobi_iters", HYPRE_BoomerAMGSetILULowerJacobiIters);
@@ -373,6 +379,46 @@ void HypreIJIface::euclid_precond_configure (const std::string& prefix)
373379
hpp("euclid_mem", HYPRE_EuclidSetMem, 0);
374380
}
375381

382+
void HypreIJIface::ilu_precond_configure (const std::string& prefix)
383+
{
384+
if (m_verbose > 2) {
385+
amrex::Print() << "Creating ILU preconditioner" << '\n';
386+
}
387+
HYPRE_ILUCreate(&m_precond);
388+
389+
// Setup the pointers
390+
m_precondDestroyPtr = &HYPRE_ILUDestroy;
391+
m_precondSetupPtr = &HYPRE_ILUSetup;
392+
m_precondSolvePtr = &HYPRE_ILUSolve;
393+
394+
395+
HypreOptParse hpp(prefix, m_precond);
396+
#if defined(HYPRE_RELEASE_NUMBER) && (HYPRE_RELEASE_NUMBER >= 22100)
397+
// Process ILU smoother parameters
398+
// ParILUK
399+
hpp("ilu_type", HYPRE_ILUSetType);
400+
hpp("ilu_max_iter", HYPRE_ILUSetMaxIter);
401+
hpp("ilu_tolerance", HYPRE_ILUSetTol);
402+
hpp("ilu_reordering_type", HYPRE_ILUSetLocalReordering);
403+
hpp("ilu_print_level", HYPRE_ILUSetPrintLevel);
404+
405+
// ILUK
406+
hpp("ilu_fill", HYPRE_ILUSetLevelOfFill);
407+
// ILUT
408+
hpp("ilu_max_nnz_per_row", HYPRE_ILUSetMaxNnzPerRow);
409+
hpp("ilu_drop_threshold", HYPRE_ILUSetDropThreshold);
410+
#if defined(HYPRE_RELEASE_NUMBER) && (HYPRE_RELEASE_NUMBER >= 22900)
411+
hpp("ilu_iterative_algorithm_type", HYPRE_ILUSetIterativeSetupType);
412+
hpp("ilu_iterative_setup_type", HYPRE_ILUSetIterativeSetupOption);
413+
hpp("ilu_iterative_max_iter", HYPRE_ILUSetIterativeSetupMaxIter);
414+
hpp("ilu_iterative_tolerance", HYPRE_ILUSetIterativeSetupTolerance);
415+
hpp("ilu_tri_solve", HYPRE_ILUSetTriSolve);
416+
hpp("ilu_lower_jacobi_iters", HYPRE_ILUSetLowerJacobiIters);
417+
hpp("ilu_upper_jacobi_iters", HYPRE_ILUSetUpperJacobiIters);
418+
#endif
419+
#endif
420+
}
421+
376422
void HypreIJIface::boomeramg_solver_configure (const std::string& prefix)
377423
{
378424
if (m_has_preconditioner) {

0 commit comments

Comments
 (0)