ASTR 474 · Computational Astrophysics · Lecture 06

Lecture 06: Finite-Volume Resolution and Shock Tests

Does adding cells improve a result, or merely make a sharper-looking plot?

14-week course · 3 credits · Week 6

Motivation

Does adding cells improve a result, or merely make a sharper-looking plot?

A finite-volume scheme represents cell averages, so a discontinuity is spread across a resolution-dependent number of cells. Grid convergence must compare quantities and integrated errors on a common coordinate, not compare line thickness by eye.

Today’s result must be interpretable as a physical statement with declared data, algorithm, uncertainty, and a check that could fail.

Learning objectives

After this lecture, you can

Core language

Terms for This Lecture

Cell average

Definition: The volume-averaged state represented by one finite-volume zone.

Why it matters here: It helps answer Does adding cells improve a result, or merely make a sharper-looking plot? within the numerical model described here.

Relationships: Connect it to Numerical flux, the governing expression \(\mathbf U_i^{n+1}=\mathbf U_i^n-\frac{\Delta t}{\Delta x}(\hat{\mathbf F}_{i+1/2}-\hat{\mathbf F}_{i-1/2})\), and the computed diagnostic developed later in the lecture.

Boundary or common confusion: A fine grid is not automatically converged; the reference solution also has error, and a first-order method diffuses shocks. Never label the 512-cell solution exact.

Physical and mathematical model

State what is being evolved

A finite-volume scheme represents cell averages, so a discontinuity is spread across a resolution-dependent number of cells. Grid convergence must compare quantities and integrated errors on a common coordinate, not compare line thickness by eye.

\[\mathbf U_i^{n+1}=\mathbf U_i^n-\frac{\Delta t}{\Delta x}(\hat{\mathbf F}_{i+1/2}-\hat{\mathbf F}_{i-1/2})\]

Define the state, coordinates, units, initial/boundary conditions, and domain before interpreting solver output.

Numerical method

Algorithm choice is a modeling decision

Run the identical initial-value problem at 32, 64, 128, and 256 cells; preserve CFL and final time; record mass error and L1 density discrepancy against a finer reference; discuss numerical diffusion and boundary influence.

  1. Write the model and its assumptions.
  2. Choose a solver and identify its stability, accuracy, and conservation properties.
  3. Record configuration, tolerances or timestep, and output sampling.
  4. Compare against an analytic limit, independent method, or controlled refinement.

Visual reasoning

Shock resolution and L1 discrepancy

Resolution study of shock structureCell-count blocks and error bars show measured L1 discrepancy and mass conservation for four finite-volume grids. Resolution changes both shock width and integrated error32 cellsL1 0.030764 cellsL1 0.0207128 cellsL1 0.0125256 cellsL1 0.00521 Finite-volume cells; gold baseline marks conserved mass
Bar heights encode the computed L1 density discrepancy; separate mass errors are given in the figure caption and lab table.

Computed example

One result, with a check

The density L1 discrepancy against the 512-zone reference decreases from 0.03066 at 32 cells to 0.00521 at 256; measured mass errors are listed independently.

Inputs and method are generated by src/astr474_computations.py; the machine-readable values are in data/generated/computed_results.json.

A fine grid is not automatically converged; the reference solution also has error, and a first-order method diffuses shocks. Never label the 512-cell solution exact.

Verification

What would falsify this result?

Do not report a smoother curve as proof of convergence.

Failure modes

Numerical agreement has a domain

A fine grid is not automatically converged; the reference solution also has error, and a first-order method diffuses shocks. Never label the 512-cell solution exact.

Solver error, discretization error, stochastic error, parameter uncertainty, and model discrepancy are different quantities. Diagnose and report them separately.

Active reasoning

Make a prediction before rerunning

Does adding cells improve a result, or merely make a sharper-looking plot?

State a measurable outcome, a competing explanation, and the smallest computation that distinguishes them. Include an expected direction or scaling, then test it.

Workflow

From parameters to auditable output

Run the identical initial-value problem at 32, 64, 128, and 256 cells; preserve CFL and final time; record mass error and L1 density discrepancy against a finer reference; discuss numerical diffusion and boundary influence.

Record the exact command, package versions, data path, random seed if applicable, and output checksum. Keep raw inputs unchanged and generated files separate.

Transfer

Lab and problem-set connection

Lab 04 requires a resolution table and a plot with discontinuity structure, not only a single final image.

Submit plots with labeled axes/units, a concise uncertainty argument, and enough code or intermediate values for a peer to reproduce the claim.

Synthesis

Three durable checks

  1. Does the implemented equation match the intended physical model?
  2. Does the numerical result converge under a controlled method change?
  3. Does the interpretation stay inside the validity and provenance limits?

A fine grid is not automatically converged; the reference solution also has error, and a first-order method diffuses shocks. Never label the 512-cell solution exact.

Sources

Technical references

Data and provenance details are recorded in reference-log.md. Last updated 2026-09-27.