# Multigrid solvers

## Nodal projection

The following inputs are defined using the `nodal_proj` prefix.

| Description | Type | Default
verbose | Verbosity of multigrid solver in nodal projection | Int | 0
bottom_verbose | Verbosity of BiCGStab solver in nodal projection | Int | 0
mg_rtol | Relative tolerance in nodal projection | Real | 1.e-11
mg_atol | Absolute tolerance in nodal projection | Real | 1.e-14
maxiter | Maximum number of iterations in the nodal projection | Int | 100
bottom_maxiter | Maximum number of iterations in the nodal projection bottom solver if using bicg, cg, bicgcg or cgbicg | Int | 100
mg_max_coarsening_level | Maximum number of coarser levels to allow in the nodal projection If set to 0, the bottom solver will be called at the current level | Int | 100
bottom_solver | Which bottom solver to use in the nodal projection Options are bicgcg, bicgstab, cg, cgbicg, smoother or hypre | String | bicgcg
hypre_namespace | Namespace to use in the nodal projection when using hypre to control hypre specific settings. It can be any string. | String | hypre
hypre_interface | Which interface to use in the nodal projection when using hypre Options are ij, semi_structured or structured | String | ij

## MAC projection

The following inputs are defined using the `mac_proj` prefix.

| Description | Type | Default
--- | --- | --- | ---
verbose | Verbosity of multigrid solver in MAC projection | Int | 0
bottom_verbose | Verbosity of BiCGStab solver in MAC projection | Int | 0
mg_rtol | Relative tolerance in MAC projection | Real | 1.e-11
mg_atol | Absolute tolerance in MAC projection | Real | 1.e-14
maxiter | Maximum number of iterations in the MAC projection | Int | 200
bottom_maxiter | Maximum number of iterations in the MAC projection bottom solver if using bicg, cg, bicgcg or cgbicg | Int | 200
mg_max_coarsening_level | Maximum number of coarser levels to allow in the MAC projection If set to 0, the bottom solver will be called at the current level | Int | 100
bottom_solver | Which bottom solver to use in the MAC projection Options are bicgcg, bicgstab, cg, cgbicg, smoother or hypre | String | bicgcg
hypre_namespace | Namespace to use in the MAC projection when using hypre to control hypre specific settings. It can be any string. | String | hypre
hypre_interface | Which interface to use in the MAC projection when using hypre Options are ij, semi_structured or structured | String | ij

## Diffusion

The following inputs are defined using the `diffusion` prefix.

| Description | Type | Default
--- | --- | --- | ---
verbose | Verbosity of linear solver for diffusion solve | int | 0
bottom_verbose | Verbosity of BiCGStab solver in diffusion solve | int | 0
mg_rtol | Relative tolerance in diffusion solve | Real | 1.e-11
mg_atol | Absolute tolerance in diffusion solve | Real | 1.e-14
maxiter | Maximum number of iterations in diffusion solve | int | 100
bottom_maxiter | Maximum number of iterations in diffusion solve bottom solver if using bicg, cg, bicgcg or cgbicg | int | 100
mg_max_coarsening_level | Maximum number of coarser levels to allow in diffusion solve If set to 0, the bottom solver will be called at the current level | int | 100
bottom_solver | Which bottom solver to use in the diffusion solve Options are bicgcg, bicgstab, cg, cgbicg, or smoother | string | bicgcg

## Hypre Settings

hypre settings are specified using the following inputs which are read directly by AMReX when hypre is used as the bottom solve for the MAC and/or nodal projections. By default, these inputs are defined using the `hypre` prefix, however different settings for the nodal and MAC projections can be used by specifying a `hpyre_namespace` for each solver.

Warning

- MFIX-Exa must be built with hypre enabled to use hypre as the bottom solve.

- If hypre is used for the nodal and MAC projections, then either the `hypre_namespace` must be left as the default (`hypre`) or unique name spaces must be provided for both.

These inputs follow the typical approach for using hypre in MFIX-Exa where BoomerAMG is employed as a preconditioner and GMRES for the linear solver.

| Description | Type | Default
hypre_preconditioner | Type of preconditioner Options are BoomerAMG or euclid | string | none
recompute_preconditioner | Recompute preconditioner during runs | Bool | true
hypre_solver | Type of hypre solver Options are BoomerAMG, GMRES, COGMRES, LGMRES, FlexGMRES, BiCGSTAB, PCG or Hybrid | string | BoomerAMG
verbose | Verbosity of hypre | int | 0
num_krylov | Number of iterations | int | 50

The following inputs are valid when using `BoomerAMG` as a preconditioner or solver.

| Description | Type | Default
bamg_verbose | Set BoomerAMG verbosity | int | 0
bamg_logging | See HYPRE_BoomerAMGSetLogging | int | 0
bamg_max_iterations | See HYPRE_BoomerAMGSetMaxIter | int | 1
bamg_precond_tolerance | See HYPRE_BoomerAMGSetTol | Real | 0.0
bamg_coarsen_type | See HYPRE_BoomerAMGSetCoarsenType | int | 6
bamg_cycle_type | See HYPRE_BoomerAMGSetCycleType | int | 1
bamg_relax_order | See HYPRE_BoomerAMGSetRelaxOrder | int | 1
bamg_relax_type | See HYPRE_BoomerAMGSetRelaxType | int | 6
bamg_down_relax_type | See HYPRE_BoomerAMGSetCycleRelaxType | int | 11
bamg_up_relax_type | See HYPRE_BoomerAMGSetCycleRelaxType | int | 11
bamg_coarse_relax_type | See HYPRE_BoomerAMGSetCycleRelaxType | int | 11
bamg_num_sweeps | See HYPRE_BoomerAMGSetNumSweeps | int | 2
bamg_num_down_sweeps | See HYPRE_BoomerAMGSetCycleNumSweeps | int | 2
bamg_num_up_sweeps | See HYPRE_BoomerAMGSetCycleNumSweeps | int | 2
bamg_num_coarse_sweeps | See HYPRE_BoomerAMGSetCycleNumSweeps | int | 1
bamg_max_levels | See HYPRE_BoomerAMGSetMaxLevels | int | 20
bamg_strong_threshold | See HYPRE_BoomerAMGSetStrongThreshold | Real | 0.57
bamg_interp_type | See HYPRE_BoomerAMGSetInterpType | int | 0
bamg_variant | See HYPRE_BoomerAMGSetVariant | int | 0
bamg_keep_transpose | See HYPRE_BoomerAMGSetKeepTranspose | int | 0
bamg_min_coarse_size | See HYPRE_BoomerAMGSetMinCoarseSize | int | 1
bamg_max_coarse_size | See HYPRE_BoomerAMGSetMaxCoarseSize | int | 9
bamg_pmax_elmts | See HYPRE_BoomerAMGSetPMaxElmts | int | 4
bamg_agg_num_levels | See HYPRE_BoomerAMGSetAggNumLevels | int | 0
bamg_agg_interp_type | See HYPRE_BoomerAMGSetAggInterpType | int | 4
bamg_agg_pmax_elmts | See HYPRE_BoomerAMGSetAggPMaxElmts | int | 0
bamg_trunc_factor | See HYPRE_BoomerAMGSetTruncFactor | Real | 0.1
bamg_set_restriction | See HYPRE_BoomerAMGSetRestriction | int | 0

| Description | Type | Default
adjust_singular_matrix | Should be true if the problem to be solved has singular matrix | Bool | false
overwrite_existing_matrix_files | Over-write existing matrix files | Bool | false

Note

This list is likely incomplete because the AMReX / hypre interface continues to evolve.