Files
MeanField/experiments/POLYTROPE_VALIDATION_FINDINGS_2026-09-09.md
Emily Boudreaux 75cc638739 perf(allocations): reduced overall allocations by 95%, increaseed jacobian applicatin by 2x
This commit uses global pre allocated work space to dramatically reduce memory usage and allocation time
2026-09-10 06:50:56 -04:00

13 KiB
Raw Blame History

Physical validation findings — 2026-09-09

Outcome

The nonrotating n=1 model reaches a well-converged discrete equilibrium, and its global virial balance passes the initial 1e-6 screening budget. It does not yet pass the full analytic-accuracy screen. In particular, the exterior potential has roughly 1.31.4% errors near the surface, and several interior field/shape errors exceed the declared 1e-4 budgets. This is not yet a physical-accuracy sign-off for performance work.

These results do not establish that the formulation is wrong: one discretization cannot distinguish ordinary approximation error from a formulation bias or implementation defect. They do establish that further Newton convergence alone is not an adequate verification strategy.

The implemented experiment and commands are documented in POLYTROPE_VALIDATION.md.

Scope and reproducibility

  • Added an opt-in polytrope_validation_experiment target and experiment-only reference, reconstruction, integration, profile, replay, and reporting code.
  • No production physics, solver defaults, sandbox source/executable, or input mesh was changed by this implementation.
  • Ran one production Newton solve, approximately 864 seconds including context setup and diagnostics. Three subsequent saved-field replays required no Newton context or linear solves. Timings are not an isolated performance benchmark; a diagnostic build overlapped part of the solve.
  • Ran 140 independent analytic checks, mesh-based analytic controls, and angular sampling checks. Did not run the full test suite or ESTER.
  • The input mesh and sandbox executable SHA-256 hashes were unchanged: ce11ae99e21e6c3bbfbee402acd2e191c1da0d8261d2227b4203f73f2f337a74 and a904b39935a5add938129e5c3edb72f94b416f0e09ba5b3b937a8004fa463057, respectively. Every mesh-based run retains its own input.smesh copy.

The model has G=M=R=1, K=2/pi, central density pi/4, zero angular momentum, and zero surface pressure. The current mesh has 1,216 elements and the state has 178,074 values. Density and potential use DG order 2, enthalpy and displacement use H1 order 3. Gravity uses MFEM RT index 2 (reported element order 3). The geometry's order 4 does not make all solution fields fourth order.

Data and plots

Artifact Location
Original solve, seed baseline, coefficient/GF snapshots, residual blocks polytrope_solution_2026-09-09
Corrected analytic-mesh control polytrope_analytic_checked_2026-09-09
Default 6x12 angular replay polytrope_replay_2026-09-09
12x24 angular replay, 64 exterior shells polytrope_replay_dense_2026-09-09
24x48 angular replay, 64 exterior shells polytrope_replay_angular24_2026-09-09
Main generated numerical report polytrope_summary.md

Fixed-reference profiles, mean errors, angular scatter, and coverage

The original polytrope_analytic_mesh_2026-09-09 control is retained for provenance, but its angular RMS statistic contained the roundoff artifact described below. Use the checked control above for current interpretation. The default-grid saved GF replay reproduced every pre-existing aggregate physical metric exactly; new pressure/projection metrics were then added without rerunning Newton.

Independent controls

All 140 closed-form checks pass, including non-unit scales, central/surface limits, exterior potential, derivatives, and independent radial mass/energy integrals. No production LaneEmden integration or seed helper supplies the reference values.

On the actual undeformed mesh, exact analytic fields give:

Control Result
Relative mass error 3.92e-10
Relative binding-energy error 2.62e-10
Virial error 2.61e-10
Force-based virial error 5.23e-10
Change in virial between quadrature orders 14 and 18 1.38e-13
Located profile points 4,020 / 4,020
Maximum scaled pointwise sampling error 4.96e-11
Corrected maximum scaled angular RMS 2.12e-11

The first weighted variance update initially introduced a one-ulp contribution to the second moment, creating spurious angular RMS values near 1e-9. Exact first-sample initialization fixed this; a constant-field zero-variance check now guards it. This did not change the numerical volume integrals or Newton solve.

Control limitations matter: volume field errors are zero by construction because the same independent reference supplies the analytic fields and comparisons. Those zeros are not tests of FE representability. The nonzero global integral errors test integration/geometry, and requested-radius profile errors test the inverse mapping. Quadrature agreement alone does not resolve the extremely thin layer where the approximate surface crosses the exact analytic support.

The undeformed surface has RMS radius error 8.92e-6 R, despite a much smaller volume-equivalent radius bias of 9.06e-9 R. Signed surface errors cancel in the volume; this is not 1e-8 local surface accuracy.

Nonlinear and physical results

The experiment used nonlinear absolute tolerance 1e-8, relative tolerance 1e-8, linear relative tolerance 0.03, and an 80-iteration linear limit. It stopped before attempting another increasingly expensive near-floor correction.

Accepted step Nonlinear residual afterward Linear iterations Step length
Initial seed 1.81187e-4
1 7.41173e-6 24 1
2 2.20576e-7 25 1
3 6.60533e-9 28 1

All field L2 errors below use the full three-dimensional, physical-volume-weighted stellar domain and fixed analytic scales/radii, not fitted spherical profiles.

Diagnostic Final value Initial screening budget
Relative mass error 2.36e-11 1e-4
W = 0.5 integral rho Phi -0.750000539807 Exact -0.75
Integral P(rho) 0.250000102482 Exact 0.25
Virial ratio 3 integral P(rho) / abs(W) 0.999999690184 Exact 1
Virial error using P(rho) 3.10e-7 1e-6
Force-based virial error using P(rho) 3.73e-7 1e-6
Virial error using production P(h) 2.62e-7 Same 1e-6 comparison
Force-based virial error using P(h) 3.25e-7 Same 1e-6 comparison
Gravity-energy consistency error 6.30e-8 1e-6
Density relative L2 error 4.70e-4 1e-4 — fails
Enthalpy relative L2 error 3.27e-4 1e-4 — fails
Potential relative L2 error, stellar interior only 1.26e-4 1e-4 — fails
Gravity-gradient relative L2 error 5.98e-4 1e-4 — fails
Surface radius RMS error / R 2.75e-4 1e-4 — fails
Volume-equivalent radius error / R 2.07e-4 1e-4 — fails

The full screen also flags pointwise EOS mismatch and Bernoulli variation. All original budgets remain visible and unchanged. No density/enthalpy negativity was found at the volume quadrature samples. Higher-order integration changes the numerical virial by only 3.14e-14: these discrepancies are not explained by the diagnostic volume quadrature order.

Comparing seed and final state at the same quadrature order, density error worsens 1.43x, enthalpy error 12.8x, and potential error 1.31x. Gravity error falls to 0.694 of its initial value; mass, binding energy, moment of inertia, and virial balance improve. Newton solves the discrete equations, not the continuum reference-error minimization problem.

What is and is not responsible

Geometry remains healthy; spherical accuracy does not

All 19,968 stellar corner/inset samples are valid. The worst element condition number is 3.466, versus 3.464 before the solve. The smallest sampled relative mapping determinant is 0.99632 at the corner/inset samples. This is not the old folding/step-collapse mechanism.

Nevertheless, surface RMS radius error grows approximately 31x. The final mean radius is 0.999793481 R, and sampled radii range from 0.999381621 R to 1.000574426 R. There is both a mean contraction and an aspherical component (approximately 1.82e-4 R RMS). Center-of-mass displacement is only 1.79e-6 R and cannot explain that shape error.

The central-density border is small

The central border coefficient is -4.64e-13. Its normalized residual action is 1.25e-9; removing it changes the full residual norm from 6.61e-9 to 6.72e-9. The unbordered equations still satisfy the 1e-8 screening budget. This is not a large artificial center force masking the observed 1e-4-level field errors. The constrained central enthalpy is exactly 1; the independently sampled central DG density is 0.7853956513 versus the prescribed pi/4 = 0.7853981634.

The pointwise EOS mismatch has a verified projection component

The code enforces closure weakly in the density space, while the pressure force uses P(h). Put delta = h - 2K rho. Then

integral P(h) - integral P(rho)
    = integral delta^2/(4K) + integral rho delta.

For a converged density-space projection, the last term vanishes, but the nonnegative squared-error term can remain because density and enthalpy use different spaces. Numerically:

  • Measured pressure-integral difference: 1.20602555e-8.
  • Predicted squared projection contribution: 1.20605303e-8.
  • Difference: -2.75e-13, or -1.10e-12 of the analytic pressure integral.
  • Normalized closure-block residual: 6.71e-12.
  • Pointwise EOS RMS scaled by central enthalpy: 8.57e-5.

Thus the remaining pointwise EOS RMS is not evidence that Newton failed to solve the weak closure. This explanation does not remove the independent field, shape, or exterior-potential discrepancies.

Spatial discrepancies that global virial balance misses

Exterior potential

At r=1.001 R, the 24x48 angular sample has mean potential error +0.012866 GM/R, approximately 1.29% of the analytic potential magnitude there. The angular RMS is only 8.76e-5 GM/R: the error is predominantly radial.

The worst saved directional sample has error 0.0139741 GM/R on the (+,-,+) body diagonal, in exterior element 923; all eight body diagonals have almost the same error. Its inverse-location error is only 1.73e-15 R. This is not a single-element or locator accident.

Along that ray, samples from 1.001 R through 2 R all lie in the same exterior element. The error changes sign with radius rather than behaving like a constant potential offset. A coarse exterior potential representation is a plausible cause, but an exact-space approximation comparison is needed to establish it. The small stellar-interior potential L2 error in the earlier table excludes this vacuum region.

Cube-aligned gravity traces and angular sampling

At r=0.556875 R, fixed rays give gravity-gradient errors of approximately +0.01167 GM/R^2 on body diagonals, -0.00355 on face diagonals, and +0.000674 on axes. Each symmetry family is internally close. These are significant localized trace errors, not deteriorated element conditioning. Because RT tangential components can have one-sided traces on block seams, their solid-angle extent has not yet been established.

Angular sampling sensitivity is measurable:

Angular grid Mean radial-gravity error at 0.556875 R Mean potential error at 1.001 R
6x12 -6.0520e-4 +1.27950e-2
12x24 +5.3099e-4 +1.29368e-2
24x48 -1.8616e-5 +1.28660e-2

Errors use fixed GM/R^2 and GM/R scales, respectively. The exact radial means should not yet be treated as angularly converged. The roughly 1.3% exterior potential discrepancy survives all three grids. The full 3D volume errors and energy integrals are independent of this spherical sampling choice. The densest replay located all 114,268 requested points and used 64 finite-exterior shells.

  1. Use the saved fields for a cheap representation audit: compare the exterior potential with the best approximation of exact -GM/r in the identical potential space on the finite first exterior cells; densely sample both one-sided interface traces. Do not form a global physical L2 potential norm over the entire infinite exterior, where the exact 1/r potential is not square-integrable.
  2. Perturb the axis/face/body-diagonal rays slightly off the block seams to determine whether the gravity extrema occupy finite angular regions or are mainly trace effects.
  3. Perform a controlled mesh/order convergence study, retaining separate field, surface, virial, and border metrics. Do not replace this with a tighter Newton tolerance on the same discretization.
  4. Only after the analytic case is satisfactory, use the separately planned ESTER comparison for rotating/nonanalytic models. ESTER was not run here.

The tools needed to separate nonlinear convergence from physical accuracy are now in place. Global balance is encouraging; the field and exterior checks show why it is too early to certify this model as physically verified.