Accuracy: control, verification, and limits#
Why there is no in-loop error norm#
An adaptive integrator steers its step by an error norm over the whole field. The
four-wave-mixing signal lives orders of magnitude below the pump beams in the same
array, so a whole-field norm gives the signal a relative error of roughly
rtol * |pump| / |signal|: at a tolerance that looks tight, the signal can be wrong at
the percent level. An error proxy on the state is not error control on the
measurement.
Here the schedule is replayed (fixed steps, every save position an edge), so no step is ever rejected, and the error is controlled on the quantity that is measured:
Richardson calibration (
pnps.calibrate.richardson_metric()): run the fixed-step propagation at step target \(h\) and \(h/2\) and take the worst peak-normalised change over every extracted observable (all save positions, all windows,i_omega_win,i_omega_reimaged,i_omega_full): the error measure a trace retrieval sees. For a march of order \(p\) (4 for the defaultrk4ip, 5 fordopri5) \(D(h)\) is the \(h\)-run’s own error up to a factor \(2^p/(2^p - 1)\), and the \(h/2\)-run’s error is about \(D/(2^p - 1)\) once the steps are in the asymptotic regime.pnps.calibrate.richardson_table()keeps the same differences per save plane, window and observable, with each spectrum’s peak and the plane’salias_fractionbeside them, so a window or a thickness that limits the step can be seen, and the differences can be normalised by a trace’s peak over several delays rather than by each spectrum’s own.Order verification (
pnps.calibrate.convergence_order()): the observed order between halvings must be the march’s — a live correctness check of the stepper, run on your exact configuration. Coarse steps (one or two per save interval) are pre-asymptotic and give erratic pair orders; judge the order where \(D\) falls steadily.Production: pick the largest \(h\) with \(D\) comfortably below the target (e.g. \(D \le 5\times10^{-4}\) for \(10^{-3}\) trace fidelity), run the whole scan at that fixed \(h\), and re-verify a few sentinel delays at \(h/2\) afterwards.
examples/calibrate_production.pypackages this.
Isolating what the nonlinearity generated#
pnps.simulate.visit_nonlinear() streams one delay point plane by plane, handing
on the field \(E(z)\) and its nonlinear part \(N(z) = E(z) - e^{Lz} E(0)\): the input
carried by the configured linear operator alone
(pnps.bridge.bridge_tables(), pnps.reference.apply_linear()), which is
solprop’s own operator, applied in the interaction picture without truncation error, so
the two agree to rounding (below \(10^{-12}\) of the peak on the test grid). \(N\) is the
four-wave-mixing signal and the Kerr changes of the arms. Linear propagation in the
homogeneous slab keeps each transverse wavevector, so wherever the input is zero in
momentum, as in a signal window behind compact input holes, \(N\) is the field itself.
Error studies use it to tell the signal’s error apart from light that leaks from the
arms (pnps.bridge.Bridge.visit() is the plane-by-plane form of
pnps.bridge.Bridge.march(), holding one plane at a time).
Fixed steps also make runs deterministic: a replayed schedule is bit-reproducible on a given backend, and one bridge serving many delay points gives each the bits it would get alone.
The validation ladder#
tests/test_ladder.py validates this package — solprop integrating its
model through the bridge — against things that share no integrator
with it, on the tiny test configuration. Every tolerance is derived, not
tuned; the measured values below are what the tests record (run pytest -rA --junitxml=... to see them, as junit properties).
(i) Exact linear parity. Without the Kerr response the interaction-picture march must reproduce the exact propagator \(e^{Lz}\) of the independent NumPy reference (
pnps.reference.apply_linear()withpnps.reference.materials_tables()), on the complex field, for the lossless and the absorbing slab. The propagator applications and transform round trips of the march round to about 1.5e-13 of the peak over 5 µm, and the gate is \(10^{-12}\); on top, the two evaluate optmat’s index, whose own rounding floor is about \(10^{-13}\) relative, on frequency axes that agree to an ulp, so their wavenumbers may differ by that much, a phase of up to \(k_\mathrm{max} z \times 10^{-13}\) (3.9e-11 rad at 5 µm) that the gate adds (measured 7.7e-12 in all). A co-moving frame is a per-frequency phase rate, so in a linear run the observables may move only through rounding of the propagator modulus: the pinned and an unpinned frame agree to 64 ε per step (measured 0.6–2.0e-14 over 8 steps).(ii) First Born. The first-order four-wave-mixing signal, computed by Gauss–Legendre quadrature of the linearly propagated nonlinear source (
pnps.reference.first_born_signal(), 48 nodes), against the propagated field with the linear part subtracted at field level: gate \(5\times10^{-3}\) of the Born peak at 1 nJ (measured 1.65e-4; with the Raman response, gate \(5\times10^{-4}\), measured 1.30e-4), and the residual must fall linearly with the energy, as the next order of the perturbation series does (ratio 0.25 for a factor 4; gate 0.5). This validates the emergent signal amplitude, phase matching and chromatic collection with no reference implementation involved.(iii) Observed order. \(D\) at three halvings from 0.156 µm, read through the default compact windows, must fall at least at the march’s order (gate: half an order below): 4 for
rk4ip(measured 4.12, 4.21) and 5 fordopri5(measured 5.38, 5.99; a faster fall is a small leading error coefficient). The compact windows collect no linear light, and the linear part of the field changes with the step only at rounding, so \(D\) is the error of what the nonlinearity generated (examples/step_certification.pyseparates the parts). From 0.31 µm the first pair is pre-asymptotic on the tiny grid (4.22 and 3.51).(iv) Invariants. Energy never grows in a run with the band-edge absorbers; behind compact (raised-cosine) collection windows the signal corner is exactly dark at z = 0, in every window; and the isolated signal power scales as the cube of the energy (ratio 8.0 for a doubling, gate 2 %). Beside the ladder, the fused host reduction agrees with the NumPy reference reductions to Higham’s summation bound \(4 n_\mathrm{total} \varepsilon\) (measured 1e-14).
Self-diffraction. Rung (ii) on the two-beam layout (
tests/test_geometry.py): the isolated signal in the self-diffraction region against the first-Born quadrature projected onto that region, gate \(5\times10^{-3}\) at 1 nJ (measured 6.7e-5); and the signal’s power-weighted centre at \(-3s/2\) on the x axis within 5 % (measured −2.90 mm against −3.00 mm).
At the production shape, on a GPU#
The production shape (examples/tgfrog_window_series.py --full: 768 × 768 × 600, 16
planes to 40 µm, 0.5 µm steps) was run through both reductions on an NVIDIA H200
(solprop 0.1’s native CUDA build, 2026-10-23):
reduction |
delays |
s per delay |
device memory |
|---|---|---|---|
host |
6, from −40 fs to +40 fs |
195 |
28.7 GB |
solprop statistics (no field copy) |
2 (−0.13 fs, +40 fs) |
34 |
33.7 GB |
The two reductions agree with each other to 3e-15 of the peak in every trace. The host
reduction was 5.8 times slower on the device because each save plane was copied, a
5.3 GiB field, to the host; solprop 0.2 has narrowed that to 1.4 times
(Performance), and reduction="auto" takes solprop’s statistics for these
windows.
Further unit tests check the input former against the materialised NumPy beamlets (8 ε of the peak), the configured operator tables against this package’s own (How the model is put on solprop, and the measurements behind it), the bridge’s grid rule, and the re-imaging, signal-region and quadrature-weighting identities of the reduction.
Runtime guards and diagnostics (never silent)#
Per save, pnps.simulate.run_delay_point() reports and checks:
energy— the axial flux through the plane. The envelope Kerr response moves it physically, by a part in 1e7 per radian of nonlinear phase, so the run’s guard against numerical instability watches what the response conserves instead (The propagation engine: solprop);absorb_omega,absorb_lapandabsorb_k— the instantaneous measured power that the band edges’ spectral absorber, the group-delay lap budget and the transverse-wavevector ramp remove. Evanescent decay removes no flux (an evanescent column carries none), so it has no channel;gd_band_power— the fraction of the energy in the frequency bins the lap budget absorbs. It is a fraction of the whole beam, which the deep-UV edge barely registers in, so it says little about a band: readlap_lost;i_omega_beam— the whole beam’s spectrum, every column;alias_fraction— the share of the energy outside the inner momentum box, half of each axis’s largest wavenumber: where a cubic product of the field can fold back into its own band (solprop’s reading of the risk of transverse aliasing). It says a fold can land, not how large it is, and is read along \(z\) and against a refined grid. On the tiny test configuration it reads 0.13 on 48 transverse samples, 1.2e-3 on 64 (already at the entrance) and 8e-8 on 96; a grid sized bypnps.grids.optimal_spatial_grid()should read only the products’ tails;lap_lost(once per delay) — the energy per frequency bin the lap budget removed over the slab (pnps.absorber.lap_lost()). With the last plane ofi_omega_beamit gives a band’s share,pnps.absorber.lap_loss_share(): the part of that band the time window was too short to keep;edge_fraction— the share of the field norm in the outer 5% of the time window (informational; walked-off light legitimately lives there). It costs an inverse transform along \(\omega\) per plane, so it is computed only withConfig.edge_diagnostic=Trueand is NaN otherwise;delays are validated before a point and a scan run (raises): within 75% of
time_headroom, or where light that wraps the time window can drive at most 1e-5 of the input’s peak nonlinear polarization (pnps.absorber.wrap_coupling(); see The physical and numerical model); and a batch of delays is refused (one delay point at a time).
The invariance battery in examples/calibrate_production.py varies
gamma_max and trange to demonstrate the absorber and window are not
shaping the physics: a test that windows applied inside the step loop, whose effect
depends on how often they fire, could not pass.
Fidelity limits of the physical model#
No stepper fixes these; they are properties of the model, ranked for ~1% trace fidelity at 40 µm / 1 fs / 260 nm:
Raman is off by default. Fused silica carries \(f_R \approx 0.22\) of its Kerr index in a delayed response; for a 1 fs pulse this appears as a ~1%-level delay-asymmetric trace distortion. Turn it on with
raman=True(validated against the reference model’s own delayed polarisation at the first-Born level,tests/test_ladder.py).Two-photon absorption and carrier gratings at 260 nm (4.8 eV, above half the silica gap) are not modelled; estimate \(\beta I L\) for your intensities before trusting 1%.
Interfaces: the slab is modelled without Fresnel reflections or etalon effects; a parallel-faced 40 µm membrane would ripple transmitted spectra at the several-percent level unless wedged/AR-coated.
DUV data: the default slab is lossless, though silica absorbs strongly below about 160 nm (
Config.absorption=Truekeeps optmat’s loss), and the default Kerr index at a deep-UV carrier is an extrapolation of a fit validated from 350 nm.The absorbing band edge and the step (with
Config.absorption=True): optmat’s silica absorbs at up to 5e6 /m at the blue edge of the active band (131 nm on the test grid). In the interaction picture the march is pre-asymptotic in those bins until \(h \ll 1/\alpha \approx 0.2\,\mu\)m: on the tiny test grid the observeddopri5pair orders are 7.1 and 4.2 at 0.3 µm where the lossless default gives 5.3 and 5.1. Certify the step on the configured model (pnps.calibrate), not on a lossless one.Scalar field: co-polarised arms assumed; crossing-angle vectorial corrections are \(O(10^{-4})\).