ENGINEERING NOTE

3D Curved Cavities, Un-Averaged Slicing & Epistemic Error Budgets

Why averaging fields across 3D mesh vertices hides dielectric discontinuities, how ASME V&V 20 keeps numerical and experimental uncertainty separate, and what parallel direct solvers still trade off on large 3D meshes.

Published 2026-11-26 4 min read 766 words All Engineering Notes

Move a cavity simulation from 2D waveguides into 3D tetrahedra and two classic numerical headaches arrive at the same time: the infinite gradient nullspace $\nabla H^1(\Omega)$ threatens to flood zero-frequency modes into your eigensolver window, and curved metal or spherical boundaries turn jagged unless element geometry itself bends smoothly.

In nyx-ems::cavity, tetrahedral curl-curl discretisation uses first-kind tangentially continuous Nédélec elements (6 Whitney edges per tetrahedron at order = 1, or 20 DOFs—12 edge/gradient plus 8 face functions—with quadratic CurvedTet degree-6 integration at order = 2), projecting out the discrete gradient kernel inside projected_shift_invert_complex.

Plotting Fields Without Smearing Material Jumps

Take examples/20_cavity_3d_spherical_pml.nyx.json: a 25 mm air sphere surrounded by a 10 mm 5-layer spherical PML shell searched around 6.0 GHz. Solving 3,622 Nédélec DOFs finishes in 0.68 s and isolates the triply-degenerate fundamental leaky mode at 1.642 + 1.701i GHz ($Q = 0.483$) alongside a fourth mode at 2.824 + 2.557i GHz ($Q = 0.552$).

PLATE 04 20_cavity_3d_spherical_pml · cutaway3d · 3,622 DOFs
3D orthographic cutaway rendering of four modes in an open spherical PML cavity
Orthographic cutaway3d view of 20_cavity_3d_spherical_pml (3,622 DOFs, 0.68 s): triply-degenerate fundamental leaky resonances (modes 1–3) followed by mode 4.
PLATE 05 20_cavity_3d_spherical_pml · slice3d plane="z"
Planar z-slice rendering of un-averaged CellFields inside the 3D spherical PML cavity
Planar slice3d cross-section across z = 0 evaluated directly on per-cell CellFields so normal-field discontinuities across material interfaces stay sharp.

Notice why view3d deliberately refuses to average nodal values across shared vertices before drawing cutaway3d and slice3d: across any step in permittivity $\varepsilon$, normal electric fields $E_\perp$ jump physically. Traditional nodal post-processors average across element boundaries and erase the true surface peak. Keeping CellFields per cell node (cell_fields[c * nloc + a]) and evaluating expressions like |E| or abs2(E) inside each tetrahedron preserves every interface jump intact.1.To test assembly code without separate compilation paths, femcore::vvuq uses a zero-sized generic SourceField trait (UniformSource in production runs; FnSource in Method of Manufactured Solutions checks) so tests execute identical quadrature and Piola mappings.

SOLVER STDOUT
$ nyx run render_site_figures.nys # 20_cavity_3d_spherical_pml
ems: cavity, order=1, dim=3, dofs=3622, seconds=0.6795
  solver_kind: projected_shift_invert_complex, converged: true, restarts: 135
  max_algebraic_residual: 1.0544204088520082e-08
  mode 1: 1.642024e9 + 1.701e9i Hz  (Q = 4.827e-1, layer_frac = 0.9067, res = 5.610e-09)
  mode 2: 1.642024e9 + 1.701e9i Hz  (Q = 4.827e-1, layer_frac = 0.9067, res = 1.054e-08)
  mode 3: 1.642024e9 + 1.701e9i Hz  (Q = 4.827e-1, layer_frac = 0.9067, res = 8.801e-09)
  mode 4: 2.824384e9 + 2.557e9i Hz  (Q = 5.522e-1, layer_frac = 0.7033, res = 2.225e-11)

Keeping Epistemic Bounds Out of Gaussian Error Bars

Throughout crates/nyx-engine/tests/validation_*.rs, benchmarks follow the ASME V&V 20 comparison rule. Given a simulation output $S$ and experimental or cross-code reference $D$, the discrepancy $E = S - D$ must clear both the engineering tolerance and the expanded validation uncertainty together:

$$ |E| \le \mathrm{tol}_{\mathrm{rel}}|D| + \mathrm{tol}_{\mathrm{abs}} \qquad \text{AND} \qquad |E| \le k \sqrt{u_{\mathrm{num}}^2 + u_{\mathrm{input}}^2 + u_D^2} $$

When mesh error comes from Richardson 2-grid or 3-grid refinement, $u_{\text{num}}$ enters inside the square root. When a dual Prager–Synge solve produces a hard deterministic interval $[S_{\mathrm{low}}, S_{\mathrm{up}}]$ instead, we never smear its epistemic half-width $\delta_{\mathrm{ep}} = \frac{1}{2}(S_{\mathrm{up}} - S_{\mathrm{low}})$ into Gaussian variance—the check adds $\delta_{\mathrm{ep}}$ linearly outside the radical so every single source of uncertainty stays visible.

Representative baselines verified in this framework span the 40 × 20 × 30 mm lossy copper cavity (TE101 at 6.245676 GHz, Pozar surface-loss $Q_0 = 10,806.04$, plus driven CircuitRom vs Taubin $S_{21}$ parity) and the NAFEMS T1–T4 thermal and Timoshenko Si/Al bimorph benchmarks.

Parallel Thread Drift & Absorber Mode Filtering

Two practical limits from deep 3D runs are worth stating plainly:

  1. Multi-threaded sparse direct factorisation drift in 3D ems: While 3D electrostatic AMG (dfs) is bitwise reproducible (0.000e+00) between 1 and 8 threads across every tested circuit, multi-threaded sparse LU/LDLT inside faer currently shows 3.59e-10 to 1.15e-7 relative drift across thread counts.
  2. Over-asking around open PML absorbers: In cavities wrapped by lossy spherical shells, continuous absorber modes often cluster near the shift frequency. Asking the Krylov eigensolver for extra modes and pruning high layer_frac solutions keeps physical resonances from being crowded out.