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
Convective terms: Adams-Bashforth
Nonlinear convective terms are handled explicitly using a second-order Adams-Bashforth extrapolation:input2d
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: Infrm/input2d:
input2d
The saddle-point linear system
After discretizing in time, the equations at each time step form a saddle-point system: where contains the viscous and drag terms for both phases, contains the volume-fraction-weighted gradient, and 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 inFullFACPreconditioner 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
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)