Skip to main content
The convergence tester compares the solution from two runs at different resolutions and reports L1, L2, and L∞ error norms for all solution variables. This is used to confirm that the solver achieves second-order accuracy in all norms for the Newtonian and viscoelastic models.

CMake target

How it works

The convergence tester is a post-processing program. It does not run the simulation itself — it reads the hierarchy data files written by two separate frm runs and computes the difference between them.
1

Run the coarse simulation

Edit input2d so the data dump interval is set to 1 and the data_dump_dirname is pointing to a known directory. Run frm at the coarse resolution (e.g. N = 32):
This writes hierarchy data files to hier_data_four_roll_mill/.
2

Run the fine simulation

Double the resolution (N = 64) and also double the number of time steps so both runs reach the same end time. Run frm again and write to a separate directory (set data_dump_dirname to hier_data_IB2d_fine or similar).
3

Run the convergence tester

Pass the convergence input file on the command line:
The tester reads the coarse and fine hierarchy files, coarsens the fine solution onto the coarse grid, and computes the difference.

Input file: input2d.convergence

coarse_iter_num and fine_iter_num specify which iteration snapshots to compare. The tester asserts that both snapshots correspond to the same simulation time before computing error norms.

Variables reported

The convergence tester computes and prints L1, L2, and max norms for each solution variable: Example output from convergence_tester.cpp:
Expected convergence rates for the Newtonian and non-Newtonian models are reported in the paper: Adaptive Mesh Refinement for Two-Phase Viscoelastic Fluid Mixture Models. The solver is demonstrated to be second-order accurate in L1, L2, and L∞ norms for all solution variables.

How the error is computed

The program implements a grid transfer convergence study:
  1. Coarsen the fine hierarchy — the fine-grid solution is conservatively coarsened by a factor of 2 onto a hierarchy that matches the coarse grid.
  2. Interpolate back — the coarsened-fine solution is interpolated onto the coarse patch hierarchy using CONSERVATIVE_LINEAR_REFINE for side-centered velocities and LINEAR_REFINE for cell-centered quantities.
  3. Subtract — the interpolated fine solution is subtracted from the coarse solution on each level.
  4. Compute norms — weighted L1, L2, and max norms are computed using the SAMRAI hierarchy data operations.
This approach avoids the need for a known analytical solution; the fine-grid solution acts as a reference.

Visualization

The convergence tester writes two VisIt snapshots to convergence_viz/:
  • Snapshot 0: solution fields before differencing (for visual inspection)
  • Snapshot 1: error fields after differencing (for visualizing the spatial distribution of the error)