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
This commit is contained in:
2026-09-10 06:50:56 -04:00
parent b3c04d507a
commit 75cc638739
66 changed files with 207183 additions and 99552 deletions

View File

@@ -0,0 +1,90 @@
# One-level uniform h-refinement — 2026-09-09
## Scope and reproducibility
This study adds exactly one `stroid.refinement.UniformRefinement(mesh, 1)`
to the **loaded coarse solve's input**, without regenerating the initial mesh,
changing field orders, or changing the model or solver tolerances. The original
`sandbox.smesh`, sandbox executable, and all existing coarse data are preserved.
The current MeanField release links an older STROID archive in `/usr/local`
which lacks the multiblock configuration field. Its refinement operation would
therefore not preserve the intended mapping strategy. Instead,
`experiments/refine_polytrope_mesh.py` uses the installed STROID 0.5.0 Python
binding in the `stroidDev` environment to load, refine and save a complete mesh.
The validation executable loads that refined snapshot with `extraRefine=0`.
No STROID installation, production-library edit or rebuild is involved.
STROID refines the logical reference mesh and reprojects high-order geometry.
The study therefore measures joint geometry/field h-convergence, not subdivision
of an unchanged physical polynomial geometry. The separately refined analytic
control measures the geometry contribution.
| Property | Coarse | Refined |
| --- | ---: | ---: |
| Total hex elements | 1,216 | 9,728 |
| Stellar hex elements | 832 | 6,656 |
| Stored refinement level | 2 | 3 |
| Geometry order | 4 | 4 |
| Density/potential DG order | 2 | 2 |
| Enthalpy/displacement H1 order | 3 | 3 |
| Gravity RT index (reported element order) | 2 (3) | 2 (3) |
| Nonlinear absolute/relative tolerance | 1e-8 / 1e-8 | 1e-8 / 1e-8 |
| Linear relative tolerance / iteration cap | 0.03 / 80 | 0.03 / 80 |
| Volume quadrature orders | 14, 18 | 14, 18 |
The model remains nonrotating n=1, G=M=R=1, K=2/pi, central density pi/4,
zero surface pressure. The coarse accepted solution is reused, not re-solved.
Interior physical-volume errors, shape and virial balance are the acceptance
focus; exterior profiles are diagnostic only insofar as they influence the
interior. Two levels give an observed reduction, not proof of asymptotic order.
## Artifacts and provenance
- Coarse solve: `polytrope_solution_2026-09-09/`.
- Coarse analytic control: `polytrope_analytic_checked_2026-09-09/`.
- Refined mesh and binding provenance: `polytrope_h1_mesh_2026-09-09/`.
- Refined analytic control: `polytrope_h1_analytic_2026-09-09/`.
- Refined solve: `polytrope_h1_solution_2026-09-09/`.
SHA-256 hashes at study start:
~~~text
coarse input / sandbox.smesh
ce11ae99e21e6c3bbfbee402acd2e191c1da0d8261d2227b4203f73f2f337a74
refined.smesh
39cf76d21c74730ffaacf50ae66e150d2e88dcb66caf6a499339b7e90a1f8182
release polytrope_validation_experiment
90caa65be08c5d9dd17ddab267d02159ea440b94304e7d0d4aa7807e688009af
release sandbox (not run in this study)
a904b39935a5add938129e5c3edb72f94b416f0e09ba5b3b937a8004fa463057
~~~
The refinement JSON additionally records the actual STROID native-extension
path/hash, interpreter, regional element counts and configuration checks.
Current mesh-based outputs each retain the fully refined `input.smesh`, so
ordinary saved-field replay requires no new refinement or regeneration.
## Analytic geometry control
All 140 independent analytic self-checks and all 24 refined physical-control
screens passed. These are analytic fields evaluated on the represented mesh,
not an FE equilibrium solution: zero volume field errors are by construction.
| Control | Coarse | Refined |
| --- | ---: | ---: |
| Surface-radius relative RMS error | 8.91509e-6 | 4.29640e-7 |
| Volume-radius relative error | 9.062e-9 | 7.63599e-11 |
| Relative mass error | 3.922e-10 | 5.01155e-13 |
| Virial error | 2.615e-10 | 7.19869e-13 |
| Invalid stellar corner/inset samples | 0 | 0 |
| Profile points located | 4,020 / 4,020 | 4,020 / 4,020 |
The analytic surface error decreases about 20.75-fold. The refined virial is
already near its observed quadrature sensitivity (2.43e-13), so its enormous
two-level ratio should not be interpreted as a convergence order.
## Refined equilibrium
The refined solve is in progress. No equilibrium h-convergence conclusion is
available until its accepted fields have been measured.