Skip to main content
Adaptive Mesh Refinement (AMR) allows the solver to concentrate computational effort in regions where the solution changes rapidly — such as near a sharp fluid interface — while using a coarser, cheaper grid everywhere else. This produces second-order-accurate solutions at a fraction of the cost of a uniformly refined grid.

Why AMR matters

A two-phase fluid simulation often has a small region of interest — for example, a thin transition zone where the network volume fraction θn\theta_n varies sharply. Resolving this zone on a uniform grid requires refining the entire domain, which multiplies the cell count (and therefore compute time and memory) cubically in 3D. AMR instead maintains a hierarchy of nested grid levels. Each level is a refinement of the level below it. Only the cells that need high resolution are subdivided; cells in smooth regions remain at the coarser resolution.
The AMR implementation is built on IBAMR/SAMRAI. The patch hierarchy and gridding algorithm are configured through the GriddingAlgorithm block in the input file.

Gradient-based cell tagging

The solver tags cells for refinement by computing the absolute gradient of the network volume fraction θn\theta_n. Any cell where ∣∇θn∣>grad_abs_thresh|\nabla\theta_n| > \texttt{grad\_abs\_thresh} is marked for refinement. Marked cells are surrounded by a buffer of additional tagged cells (controlled by tag_buffer) to prevent the refined region from being too tightly cropped around the detected feature. The tagging method is set in the StandardTagAndInitialize block:
input2d
And the threshold and buffer are configured in the integrator block:
input2d
Lower values of grad_abs_thresh tag more cells (finer coverage of gradients); higher values restrict refinement to only the steepest transitions. Tune this together with tag_buffer to balance accuracy against cost.

The patch hierarchy

The grid is organized as a patch hierarchy — a stack of refinement levels numbered from 0 (coarsest) upward. Each level consists of a set of rectangular patches that tile the refined region without overlap. Key concepts:
  • Level 0 is the base Cartesian grid, spanning the entire domain.
  • Finer levels cover only the tagged subregions and are nested inside their parent level.
  • Refinement ratio specifies how many fine cells replace one coarse cell in each spatial direction.
  • Regridding — the hierarchy is rebuilt periodically to track moving features.

GriddingAlgorithm configuration

The GriddingAlgorithm block in the input file controls hierarchy construction. The following example is taken from frm/input2d:
input2d

Key parameters

Cost savings in practice

With max_levels = 3 and ratio_to_coarser = 2, 2, the finest level has 4× the linear resolution of the base level (8× in 2D, 64× in 3D). If the refined region covers only a small fraction of the domain, the total cell count — and therefore the computational cost — is substantially lower than an equivalent uniform fine grid. The README reports substantial cost savings from using AMR for the four-roll mill and related test problems described in the companion paper.