DOCUMENTATION / PHYSICAL WORLDS
Learned Simulators: Early Warnings.
A neural network standing in for a flow solver: which warnings come before it fails, and does it pay?
Open the experimentWhat the page shows
Flow past an obstacle in a channel, computed twice from the same starting frame: once by a fluid solver, once by a neural network trained to imitate it. Below them, the difference between the two flows, which stays dark until the network drifts off. Underneath, a row of warning lights that watch only the network’s own output, and a readout of the quantities an engineer would actually use: how often vortices shed, how hard the obstacle is pushed sideways, and its drag.
- The three panels
- Vorticity (how the fluid spins: orange counter-clockwise, cyan clockwise) for the solver and the network, and the difference in their velocities (white where they differ by one typical fluctuation or more). The obstacle is gray.
- Status line
- The frame (one frame is 25 solver steps), the field error between the flows (failure at 0.5) and whether the case is inside the network's training range.
- Warning lights
- One per signal. A light comes on when its signal stays above its threshold for 3 frames. Each shows a trace of recent values with the threshold dashed, and when it first came on relative to the failure.
- Decision readout
- Shedding frequency (as a Strouhal number), lift swing and mean drag over the last 80 frames, for both flows, and whether the network passes the decision check.
- The results
- Lower on the page: which signal warns best for each kind of shift, and the cost against failures of handing back to the solver, compared with running solvers alone.
How to use it
- Presets
- Cases chosen to show one behavior each, with a sentence on what to look for.
- Reynolds number
- How fast the flow is relative to its viscosity. The network was trained between 80 and 120.
- Shape and size
- The obstacle. The network saw only circles 12, 14 or 16 cells across.
- Off center / drag
- Move the obstacle across the channel with the slider, or drag it anywhere on the top panel. Training positions were within 5 cells of the middle.
- Network
- Ensemble member 0 (the network the study tested) or the one trained with noise on its inputs.
- Hand back
- When the chosen light comes on, the solver takes over for 40 frames and the network then resumes from the solver's frame. The status line counts how much of the time the network drove.
- Restart both
- Start the network again from the solver's current frame.
- Frames per second, Pause, Copy share link
- Speed, pause, and a link that reopens this exact case.
Every change of case restarts the solver from rest and lets the flow settle for 20,000 steps before the network joins (a second or two on most GPUs). Try this: start with “Training range” and note the frame at which the field error passes 0.5, then “Faster flow” and see how much sooner it fails and which light came on first.
Background and theory
Learned simulators
A learned simulator, or emulator, is a neural network trained on a solver’s output to predict the next state from the current one. Run on its own predictions, it can produce a whole flow far faster than the solver, on suitable hardware. Its weakness is that nothing makes it obey physics outside the cases it saw: given an unfamiliar case, it can drift into a plausible-looking but wrong flow. And reviews of the field have found that many claimed speedups came from comparisons against weak baselines.
The solver and the network
- The solver is a lattice Boltzmann method (D2Q9, two-relaxation-time collisions, bounce-back walls) on a channel 256 × 64 cells, checked against the Schäfer–Turek cylinder benchmark.
- The network is a U-Net with three resolution levels (about 426,000 parameters) that steps a 2× coarser copy of the flow 25 solver steps at a time. Its inputs are the flow, the obstacle’s outline and the Reynolds number. Five copies were trained from different random starts.
The warning signals
- Divergence
- How much the network's velocity field compresses or expands; an incompressible flow has none.
- Mass flux
- How much the flow rate varies along the channel; it should be the same everywhere.
- Momentum residual
- How far the network's frames are from satisfying the Navier–Stokes momentum equation.
- Wall slip
- Velocity inside the obstacle, which should be exactly zero.
- Spectral pile-up
- The share of energy at the finest scales, where errors tend to collect.
- Ensemble spread
- How much the five networks disagree when each is run from the same frame.
- Input novelty
- How unlike the training cases the Reynolds number and obstacle are; constant through a run.
- Combination
- A logistic regression on all seven, fitted on development data to predict failure within 25 frames.
Failure, two ways
A field failure is the network’s velocity being off by half a typical fluctuation (0.5σ) on average. A decision failure is the shedding frequency off by more than 5%, or the lift swing or drag by more than 10%, over the last 80 frames: what an engineer designing against vortex-induced vibration would care about.
Methods
The solver
- Lattice Boltzmann, D2Q9, on a 256 × 64 channel, with:
- two-relaxation-time collisions;
- halfway bounce-back on the walls and the obstacle;
- a Zou–He parabolic inlet, ramped up from rest over 6,000 steps;
- a fixed-pressure outlet;
- viscous sponge layers at both ends.
- Three versions failed along the way. Equilibrium and extrapolated inlets blew up at Re 100; two-relaxation time without sponges blew up below a relaxation time of about 0.513; a regularized collision was stable but read drag 12% high. The final solver is stable down to a relaxation time of about 0.508, which sets the limits: obstacles at least 12 cells across, and Reynolds numbers up to 220.
- Checked against the Schäfer–Turek benchmark, with a cylinder 15 cells across:
- steady drag at Re 20 within 2.5%;
- peak drag at Re 100 within 2.9%;
- Strouhal number 0.299, inside the reference range 0.295–0.305;
- half-swing of lift within 3.7%.
Data
- Each flow settles for 20,000 steps and is then recorded every 25 steps for 200 frames, coarsened 2× to 128 × 32: velocity, pressure (from density) and the obstacle mask. One frame is one network step.
- Training range: Reynolds number 80–120; circular obstacles 12, 14 or 16 cells across; centers within a 12 × 10-cell band. 512 training and 64 validation flows. Below about Re 75 the larger obstacles sit near the onset of shedding and have no frequency to score, which set the lower bound.
- Development set (for every threshold and the combination): the 64 validation flows, plus 64 shifted on purpose in other directions than the test axes: circles at Re 60–78, and blunt ellipses at Re 80–120.
- Test sets (simulated after the test was registered):
- 64 new in-distribution flows, recorded for 400 frames, twice the training length;
- 32 flows at each of 5 levels on four axes, with everything not shifted drawn from the training range: Reynolds number 135, 155, 175, 200, 220; shape (ellipse of aspect 2, rounded square, square, plate, two cylinders); 7–15 cells off center; 18–26 cells across.
- Drag and lift come from the pressure on the obstacle’s faces in the coarse frames, the same way for network and solver. On the solver’s own frames this reads the shedding frequency within 0.03% (median).
The network and its training
- A convolutional U-Net, three resolution levels, 32 channels at the finest (about 426,000 parameters). Inputs: the current frame, the obstacle mask and the Reynolds number. It predicts the change to the next frame, 25 solver steps ahead.
- Trained with Adam, batch 16, in two stages:
- 20,000 steps of one-step loss, at learning rate 10⁻³ after a 500-step warm-up, decaying toward 10⁻⁵;
- 5,000 steps of a 4-frame unrolled loss at 3 × 10⁻⁴, for stability.
- Five copies with seeds 0–4: seed 0 is the network under test, and the others supply ensemble spread. A sixth, trained with input noise of 0.3 typical frame changes, is evaluated as a second network under test. The five agree closely on validation: one-step error 0.019–0.020, and 0.15–0.19 after 50 frames.
- The networks were deliberately not stabilized further. Rollouts that diverge even in distribution (median field failure at frame 87) are this kind of emulator’s real behavior, and the frame-by-frame scoring below doesn’t need failure-free runs.
Scoring the signals
- Every signal is computed each frame from the network’s own output and the case’s inputs, never from the solver. The exact definitions:
- divergence: central differences, away from solids;
- mass flux: the coefficient of variation of Σy u across columns 8–111;
- momentum residual: interior fluid cells, with ν from the Reynolds number;
- spectral pile-up: energy above half the maximum wavenumber, behind the obstacle;
- input novelty: the Mahalanobis distance of (Reynolds number, distance from the obstacle mask to the nearest training mask) from the training cases;
- combination: logistic regression on the logarithms of all seven.
- An alarm is a signal above its threshold for 3 frames in a row. Each threshold is set on the development set so that 5% of its safe frames alarm. Safe frames are those at least 50 frames before field failure, or in a run that never fails.
- Discrimination: AUROC for “failure within the next k frames” (k = 10, 25, 50) over all frames before failure, per axis and level, for field and for decision failure.
- Lead time: the number of alarmed frames just before failure, capped at 50 (0 is a miss). Reported as a median and a miss rate.
- Uncertainty: bootstrap standard errors over trajectories (2,000 resamples). Comparisons between signals are paired, on the same resampled trajectories, and a difference counts at 3 standard errors.
- Conformal bound (secondary): the 90% quantile of validation field error at each horizon, and its coverage on each test level.
The fallback policy and its baselines
- The development set’s best signal (the combination) triggers a hand-back. The fine solver restarts from the network’s frame and runs 40 frames (1,000 steps), then the network resumes from the solver’s coarsened frame. To restart, the velocity is upsampled 2× and made divergence-free by one Poisson projection, and equilibrium populations are built from it. Without the projection, a restart from a network frame rang with sound waves that swamped the lift.
- Thresholds at 1, 2, 5, 10, 20, 30 and 50% development false alarms trace decision error against measured cost. Each run’s decision error is the largest of: frequency error / 5%, swing error / 10%, and drag error / 10%.
- Baselines on the same cases:
- the solver alone on the coarse 128 × 32 grid (pre-registered);
- on 192 × 48, about the network’s cost per frame;
- the full solver restarted from the same coarse first frame, the restart floor, which shows what restarting from a coarse frame costs in accuracy.
Pre-registration and amendments
Signals, failure definitions, data sets, measures, thresholds and questions were fixed on 30 October 2026, before any test flow was simulated. Amendments made before any test result was seen, after running the analysis on the probe set, are:
- a frames-elapsed reference signal, since within a rollout every check grows with time, as the error does;
- a time-matched AUROC, comparing runs only at the same frame;
- the two extra solver baselines;
- the divergence-free restart;
- running the fallback on the first 8 runs per level when its signal needs all five networks.
Nothing in the test or the code changed after the first test result.
Results and what they mean
The test was pre-registered: the signals, failure definitions, measures and questions were written down before any test flow was simulated, and every threshold and the combination were fitted on a separate development set with different kinds of shift. Five networks, 704 test flows: 64 in the training range and 32 at each of five levels along four axes (Reynolds number 135–220; five new shapes; 7–15 cells off center; 18–26 cells across).
- Signals warn of failure
- Outside the training range, the combination's AUROC for failure within 25 frames is 0.92–0.96 per axis, with no missed failures and a median of 19–30 frames of warning.
- The best signal depends on the shift
- The momentum residual is best for faster flow; the combination beats it by 5.6–9.4 standard errors on the other three axes. Comparing runs at the same frame and level, divergence and ensemble spread are best.
- Novelty warns as early far out
- On position and size shifts, input novelty leads the best physics check by 5–19 frames; it flags a new case from the first frame, though not the moment it goes wrong.
- In distribution, mostly the clock
- A signal that only counts frames scores 0.98, against 0.99 for the best checks; compared at the same frame, the best checks score about 0.89.
- Handing back doesn't pay
- The fallback policy fails 44–66% of runs on the decision check and costs 1.8 s per run, more than the accurate solver alone (1.6 s) and less accurate than restarting that solver from the same coarse frame (7% failing). Cheaper solvers are cheaper but fail 74–97% of runs.
- Noise training trades failure for warning
- In distribution the noise-trained network fails at frame 287 instead of 87, but every signal except novelty warns worse, by 0.03 to 0.24 in AUROC.
In the browser the balance is starker: on the site’s GPU code a frame of the solver takes about 0.5 ms and one network step about 3.7 ms on a laptop GPU. See Reading the results for AUROC, standard errors and pre-registration.
Limits and open questions
- One small network design on one 2D laminar flow; bigger or different networks may fail differently.
- The study’s costs are CPU timings on one laptop. A network on hardware that suits it far better than the solver could change the cost side, though not the warning results.
- The fallback used the combination because it was best on development data, and it needs all five networks. A single physics check would be much cheaper to run; it wasn’t tested as the fallback signal.
- The decision check fails at its first possible frame (60) in most shifted runs, so how well field warnings predict decision failure couldn’t really be measured.
- On the page, a hand back restarts the network from the solver running beside it. In the study a solver had to be restarted from the network’s frame, which costs accuracy (the restart-floor baseline).