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 separatefrm runs and computes the difference between them.
1
Run the coarse simulation
Edit This writes hierarchy data files to
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):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:- Coarsen the fine hierarchy — the fine-grid solution is conservatively coarsened by a factor of 2 onto a hierarchy that matches the coarse grid.
- Interpolate back — the coarsened-fine solution is interpolated onto the coarse patch hierarchy using
CONSERVATIVE_LINEAR_REFINEfor side-centered velocities andLINEAR_REFINEfor cell-centered quantities. - Subtract — the interpolated fine solution is subtracted from the coarse solution on each level.
- Compute norms — weighted L1, L2, and max norms are computed using the SAMRAI hierarchy data operations.
Visualization
The convergence tester writes two VisIt snapshots toconvergence_viz/:
- Snapshot 0: solution fields before differencing (for visual inspection)
- Snapshot 1: error fields after differencing (for visualizing the spatial distribution of the error)