Line data Source code
1 : // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 : // SPDX-License-Identifier: Apache-2.0
3 :
4 : #include "amg.hpp"
5 :
6 : namespace palace
7 : {
8 :
9 0 : BoomerAmgSolver::BoomerAmgSolver(int cycle_it, int smooth_it, bool agg_coarsen, int print)
10 0 : : mfem::HypreBoomerAMG()
11 : {
12 0 : HYPRE_BoomerAMGSetPrintLevel(*this, (print > 1) ? print - 1 : 0);
13 0 : HYPRE_BoomerAMGSetMaxIter(*this, cycle_it);
14 0 : HYPRE_BoomerAMGSetTol(*this, 0.0);
15 :
16 : // Set additional BoomerAMG options.
17 0 : int agg_levels = agg_coarsen ? 1 : 0; // Number of aggressive coarsening levels
18 : double theta = 0.5; // AMG strength parameter = 0.25 is 2D optimal (0.5-0.8 for 3D)
19 : int relax_type = 8; // 8 = l1-symm. GS, 13 = l1-GS, 18 = l1-Jacobi, 16 = Chebyshev
20 0 : if (mfem::Device::Allows(mfem::Backend::DEVICE_MASK))
21 : {
22 : // Modify options for GPU-supported features.
23 : agg_levels = 0;
24 : relax_type = 18;
25 : }
26 :
27 0 : HYPRE_BoomerAMGSetAggNumLevels(*this, agg_levels);
28 0 : HYPRE_BoomerAMGSetStrongThreshold(*this, theta);
29 0 : HYPRE_BoomerAMGSetRelaxType(*this, relax_type);
30 0 : HYPRE_BoomerAMGSetNumSweeps(*this, smooth_it);
31 :
32 : // int coarse_relax_type = 8; // l1-symm. GS (inexact coarse solve)
33 : // HYPRE_BoomerAMGSetCycleRelaxType(*this, coarse_relax_type, 3);
34 0 : }
35 :
36 : } // namespace palace
|