Skip to main content
The solver uses a staggered-grid (MAC) finite-difference discretization on the AMR patch hierarchy. The resulting linear system at each time step is a saddle-point problem solved by FGMRES preconditioned with a Full Approximation Cycle (FAC) multigrid method. The solver is second-order accurate in the L1L^1, L2L^2, and L∞L^\infty norms for all solution variables, verified for both the Newtonian and Oldroyd-B models.

Staggered-grid (MAC) layout

Variables are not all located at the same grid points. The Marker-and-Cell (MAC) layout places each variable where it is most naturally discretized: This placement is the standard MAC grid used in incompressible flow solvers. It avoids the pressure-velocity decoupling (checkerboard modes) that can arise with collocated grids, and it yields natural discrete divergence and gradient operators that are exact adjoints of each other.
On the AMR hierarchy, the staggered data lives on side-centered patch data (SideVariable) for velocities and cell-centered patch data (CellVariable) for pressure and volume fraction.

Time stepping

Viscous terms: trapezoidal rule

Viscous stresses are integrated with the trapezoidal rule (Crank-Nicolson), which is second-order accurate in time and unconditionally stable for the linear viscous terms:
input2d
This means the viscous operator is evaluated at the average of the current and new time levels, leading to an implicit system that must be solved at each step.

Convective terms: Adams-Bashforth

Nonlinear convective terms are handled explicitly using a second-order Adams-Bashforth extrapolation:
input2d
Adams-Bashforth uses information from the current and previous time steps to extrapolate the convective operator to the new time level without requiring iteration. The previous-time convective values are stored in d_Nn_old_var and d_Ns_old_var.

Convective limiters

The convective operator supports several flux limiters to suppress oscillations near sharp gradients: The frm/input2d example uses CUI for the advection-diffusion integrator:
input2d

CFL stability condition

The explicit Adams-Bashforth treatment of convection requires the time step to satisfy the CFL condition for stability. The maximum stable time step is: Δtmax=CFLmax⋅ΔxUmax\Delta t_\text{max} = \text{CFL}_\text{max} \cdot \frac{\Delta x}{U_\text{max}} In frm/input2d:
input2d
Setting CFL_MAX too large (above ~0.5 for most limiters) can cause instability. The example uses a conservative value of 0.1. Always verify stability for your specific velocity magnitudes and grid spacing.

The saddle-point linear system

After discretizing in time, the equations at each time step form a saddle-point system: [ABTB0][up]=[fg]\begin{bmatrix} \mathbf{A} & \mathbf{B}^T \\ \mathbf{B} & 0 \end{bmatrix} \begin{bmatrix} \mathbf{u} \\ p \end{bmatrix} = \begin{bmatrix} \mathbf{f} \\ g \end{bmatrix} where A\mathbf{A} contains the viscous and drag terms for both phases, BT\mathbf{B}^T contains the volume-fraction-weighted gradient, and B\mathbf{B} contains the divergence constraint. The full block structure is described in Multiphase model. The system is solved with FGMRES (Flexible GMRES), a Krylov method suitable for non-symmetric and variable-preconditioned systems:
input2d

FAC multigrid preconditioner

FGMRES converges slowly without preconditioning on the saddle-point system. The solver uses a Full Approximation Cycle (FAC) multigrid preconditioner implemented in FullFACPreconditioner with a box-relaxation smoother from MultiphaseStaggeredStokesBoxRelaxationFACOperator. FAC multigrid exploits the AMR hierarchy directly: the coarse grid levels serve as the coarse-grid correction hierarchy, avoiding the need to construct a separate multigrid hierarchy. The preconditioner is configured via the precond_db block:
input2d
The relaxation weight W = 0.75 in the example input controls the under-relaxation of the box smoother. Reducing it below 1.0 improves robustness for problems with large viscosity contrasts between phases.

Second-order accuracy

The combination of:
  • Staggered-grid spatial discretization (second-order centered differences),
  • Trapezoidal rule for viscous terms (second-order in time), and
  • Adams-Bashforth for convective terms (second-order in time)
yields a solver that is second-order accurate in space and time. This is verified in the companion paper via convergence studies in the L1L^1, L2L^2, and L∞L^\infty norms across all solution variables (un\mathbf{u}_n, us\mathbf{u}_s, pp, θn\theta_n) for both Newtonian and viscoelastic configurations.