Spectral and physics-oriented metrics¶
These metrics evaluate whether a surrogate preserves physically important structure rather than only minimizing pointwise error.
Spectral relative error¶
Let \(\mathcal F\) denote a spatial Fourier transform:
This compares Fourier magnitudes globally. It does not localize errors to specific frequency bands.
Binned spectral MSE¶
For a wavenumber bin \(B\):
NAVIER-CFD uses an orthonormal FFT and radial low/middle/high bins by default. When all bins cover the spectrum, their sum matches spatial-domain MSE up to numerical precision.
Fourier RMSE (fRMSE)¶
Following the RealPDEBench interpretation, the transform can include time and space. For frequency bin \(B\):
- Reports low-, middle-, and high-frequency errors.
- Lower is better; \(0\) is perfect.
- FFT axes, normalization and bin edges must be recorded.
Temporal frequency error¶
Let the spatially integrated signal be:
Then:
FE is useful for vortex shedding, oscillatory reactors and other periodic dynamics.
Divergence error¶
For velocity \(\mathbf u=(u_1,\ldots,u_d)\):
NAVIER-CFD reports:
This requires velocity-channel and grid-spacing metadata. It is not a substitute for checking local divergence fields or discrete solver conservation.
Kinetic-energy relative error¶
For constant-density flow:
For variable density:
The relative field error is:
Turbulent kinetic-energy error¶
For two-dimensional velocity fluctuations:
NAVIER-CFD computes the mean absolute difference between predicted and target fluctuation-energy fields. This follows the RealPDEBench-style long-time consistency interpretation.
Mean velocity profile error¶
At selected probes \(\mathbf x_j\):
When probes are not supplied, NAVIER-CFD can average over all non-profile spatial axes and compare full mean profiles. The selected profile axis and probe coordinates must be reported.
Vorticity RMSE¶
For two-dimensional flow:
This metric is sensitive to gradients and small-scale rotational structure.
Required context¶
context = MetricContext(
time_axis=1,
spatial_axes=(2, 3),
channel_axis=-1,
velocity_channels=(0, 1),
spacing=(dx, dy),
profile_axis=2,
evaluation_space="physical",
)
Metrics that cannot be supported by the supplied context are returned with valid=False and an explanation.