From Arrays to Claims
Source: PHY653B Ch. 4
Intuition
A simulation produces arrays. A paper contains claims. Chapter 4 is about the step between — the part of computational physics that is neither physics nor programming, and where most of the credibility is won or lost.
The diagnostic toolkit
Dispersion relations from raw data. 2-D FFT in \(x\) and \(t\); the ridges in the \((k,\omega)\) plane are your measured dispersion relation. Overplot the analytic branch and you compare every mode at once instead of one rate at a time. See growth-rate fitting.
Growth and damping rates. Fit envelopes, scan windows, report spread. The factor of two between amplitude and energy is waiting for you.
Correlations and structure functions. For turbulence, the two-point structure function \(S_p(\ell) = \langle|\delta u(\ell)|^p\rangle\) measures intermittency directly and is far more informative than a snapshot. Kolmogorov predicts \(S_2 \propto \ell^{2/3}\); deviations at high \(p\) are the signature of intermittent structures.
Energy spectra and cascades. \(E(k)\) from an isotropised FFT, with the caveat that a finite box gives you few decades and the extremes are contaminated — the largest scales by the box, the smallest by dissipation and grid effects. Fit the inertial range only, and say where it is. See energy cascade (PC316).
Modal decomposition. POD/DMD extract coherent structures and their frequencies from otherwise incomprehensible fields. Powerful, and easy to over-interpret: a mode is a basis vector, not necessarily a physical object.
Synthetic diagnostics. The most important item on the list, and the one most often skipped.
Synthetic diagnostics
An experimental instrument does not measure what your code outputs. An interferometer measures \(\int n_e\,dl\) along a chord. A Thomson scattering system measures a convolution of the distribution with an instrument function over a finite volume. A camera integrates emissivity along a line of sight through an optically thin plasma.
Comparing your raw simulated \(n_e(x,y,z)\) against the experiment's processed density profile compares two different quantities and hides real disagreement — usually in the direction that flatters your simulation.
A synthetic diagnostic applies the instrument's response to the simulation output, producing the quantity the instrument would actually have reported. Then you compare like with like. It is extra work, it frequently makes your agreement look worse, and it is the difference between a comparison and a demonstration.
Uncertainty
Every reported number needs one. Sources, in rough order of honesty:
| Source | Captures | Notes |
|---|---|---|
| Fit-window scan | analysis-choice sensitivity | usually dominant; cheapest to do |
| Ensemble over seeds | statistical noise | essential for anything PIC-driven |
| Resolution scan | discretisation error | difference between two finest runs |
| Formal least-squares error | nothing much | assumes independent errors; almost always an underestimate |
Building the module
Chapter 4's practical advice, which is worth taking literally: write the diagnostics as a library, separate from the solver, taking arrays in and returning numbers with uncertainties. Test it against synthetic data whose answer you know — a pure exponential with known rate, a single wave with known \((k,\omega)\). A diagnostic that has never been tested on a known signal is as untrustworthy as an untested solver, and it is far more likely to be believed because its output is a number rather than a picture.
Common mistakes
- Diagnostics entangled with the solver, so they can never be tested independently.
- Comparing raw simulation output to processed experimental data.
- Fitting a spectrum across the whole \(k\) range, including the box scale and the dissipation range, and reporting the slope.
- A number without an uncertainty.
Related concepts
- Growth-rate fitting — the most common diagnostic, done properly
- Verification and validation — the framework
- PIC noise and heating — the noise floor
- Energy cascade (PC316) · Turbulence (PC316)
Knowledge graph position
Prerequisites: FFT, statistics, verification and validation. Leads to: publishable results; validation against experiment.
Quiz
Q1 (conceptual). Why is a synthetic diagnostic necessary when comparing with experiment?
Answer
Instruments measure line integrals, convolutions and finite-volume averages, not the raw fields a code stores. Comparing unprocessed simulation output to processed measurements compares different quantities and can hide genuine disagreement. The synthetic diagnostic applies the instrument response to the simulation so both sides are the same quantity.
Q2 (conceptual). Why should diagnostics be written as a separate, independently tested module?
Answer
Because a diagnostic can be wrong in ways that look like physics, and a number is more readily believed than a picture. Separating it lets you validate it on synthetic signals with known answers — a pure exponential, a single wave — before trusting it on data whose answer you do not know.
Q3 (MCQ). When fitting an energy spectrum \(E(k)\), you should restrict the fit to:
- (a) the whole available \(k\) range
- (b) the inertial range only, stated explicitly, excluding box-scale and dissipation-range contamination
- (c) the largest scales
- (d) the dissipation range
Answer
(b). The largest scales are set by the box rather than by physics, and the smallest are contaminated by dissipation and grid effects. Only the inertial range carries the cascade physics — and a finite box gives you few decades of it, so state where you fitted.