|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Classes | |
| class | TestAccelMatchesPython |
| class | TestRandomizedSweep |
| class | TestCoolingIsActuallyApplied |
| class | TestDeliveredIspInvariant |
| class | TestChugKernelMatchesPython |
Functions | |
| _chamber_gate () | |
| _python_only () | |
| _rel (got, want) | |
| _assert_close (name, got, want, rtol=RTOL) | |
| _py_field (ref, key) | |
| _rig (cfg_rel) | |
| _default_path (r, p) | |
| _need_numba () | |
| test_injector_solve_matches_python (cfg_rel) | |
| test_default_path_matches_python_on_the_shipped_engine () | |
| test_chamber_kernel_serves_the_designs () | |
| test_heatup_tables_match_coolprop () | |
Variables | |
| ROOT = Path(__file__).resolve().parents[1] | |
| float | PSI_TO_PA = 6894.76 |
| float | PA_AMBIENT = 101325.0 |
| _ab_parity | |
| list | POINTS_PSI = [(563.467, 567.644), (518.4, 550.6), (597.3, 584.7)] |
| int | RTOL = 1e-6 |
| list | CONFIGS |
| list | CORE_FIELDS |
| list | DIAG_FIELDS |
| dict | _RIGS = {} |
| list | _INJ_CONFIGS |
| int | _INJ_CORE_KEYS = 18 |
| list | _INJ_KEYS |
Live A/B parity for the Numba accelerator against the authoritative Python physics. Runs both implementations on the same inputs at test time and diffs them field by field, so a drift on EITHER side fails regardless of which one moved. This is the sole numeric guard on the accelerated path now that the C port is gone. TOLERANCE. RTOL is 1e-6, not the 2e-3 the retired C suite used. Measured agreement on 120 randomized points across both configs is ~2.5e-9 -- the accelerated and Python paths run the same physics and differ only by Brent's convergence tolerance, so 1e-6 leaves ~400x headroom while still being three orders tighter than the old contract. If a change pushes this above 1e-6, that is a physics divergence, not rounding: fix it rather than widening the bound. THE REFERENCE MUST BE FORCED TO PYTHON. With the accelerator enabled, runner.evaluate reaches chamber_solver._accel_chamber_pc -> accel.chamber_solve and closure.flows -> accel.solve, so an unguarded "Python" reference is largely the same numba kernels and the comparison is self-referential (it reads as ~1e-15 agreement, which is the tell). _python_only() below disables the accelerator for the reference computation; without it this suite proves nothing. THE CONFIG LIST IS DELIBERATE. canonical/impinging.yaml has ablative cooling ON and a back-channel ring manifold, impinging_lox_ch4_8000N.yaml has neither (plenum, no liner), canonical/pintle.yaml exercises the pintle injector -- a different solve (kernels.injector_solve_pintle) and a different mixing input: no Rupe M, so E_m is rupe_Em_opt flat and the drops leave axially -- and the 6.5 kN ethalox fixture is the design as drawn, where both liquids heat up on CoolProp tables (engine.accel.chamber).
|
protected |
Definition at line 104 of file test_numba_ab_parity.py.
References _rel().
Referenced by test_default_path_matches_python_on_the_shipped_engine(), test_numba_ab_parity.TestAccelMatchesPython.test_diagnostics(), test_injector_solve_matches_python(), test_numba_ab_parity.TestAccelMatchesPython.test_kernel_level_raw_tuple(), and test_numba_ab_parity.TestAccelMatchesPython.test_wrapper_fields().
|
protected |
Python chamber physics the kernels do not mirror yet (empty => chamber kernels in use).
Definition at line 52 of file test_numba_ab_parity.py.
Referenced by _default_path(), _rig(), test_numba_ab_parity.TestCoolingIsActuallyApplied.test_effective_tc_differs_and_is_reported(), test_numba_ab_parity.TestAccelMatchesPython.test_kernel_level_raw_tuple(), test_numba_ab_parity.TestRandomizedSweep.test_sweep(), and test_numba_ab_parity.TestAccelMatchesPython.test_wrapper_fields().
|
protected |
What Layer 1 actually consumes: accel.evaluate, else (None) the runner on the DEFAULT, accelerator-enabled path -- which still routes the injector through accel.solve and the chug scan through the kernel.
Definition at line 148 of file test_numba_ab_parity.py.
References _chamber_gate(), and split().
Referenced by test_numba_ab_parity.TestAccelMatchesPython.test_diagnostics(), test_numba_ab_parity.TestRandomizedSweep.test_sweep(), and test_numba_ab_parity.TestAccelMatchesPython.test_wrapper_fields().
|
protected |
Definition at line 330 of file test_numba_ab_parity.py.
Referenced by test_chamber_kernel_serves_the_designs(), test_default_path_matches_python_on_the_shipped_engine(), test_heatup_tables_match_coolprop(), test_injector_solve_matches_python(), test_numba_ab_parity.TestChugKernelMatchesPython.test_minus_3pi_crossing(), and test_numba_ab_parity.TestChugKernelMatchesPython.test_randomised_loops().
|
protected |
Definition at line 110 of file test_numba_ab_parity.py.
Referenced by test_default_path_matches_python_on_the_shipped_engine(), test_numba_ab_parity.TestAccelMatchesPython.test_kernel_level_raw_tuple(), test_numba_ab_parity.TestRandomizedSweep.test_sweep(), and test_numba_ab_parity.TestAccelMatchesPython.test_wrapper_fields().
|
protected |
Force the authoritative Python path for the reference computation. Disables strict mode as well as the accelerator. Under ED_REQUIRE_ACCEL=1 (the CI parity job) closure._try_native_flows treats "disabled + strict" as a genuine accelerator failure and raises -- which is exactly right in production, and exactly wrong here, where the accelerator is off ON PURPOSE. Without this the whole suite fails under CI's env while passing locally.
Definition at line 81 of file test_numba_ab_parity.py.
Referenced by _rig(), test_default_path_matches_python_on_the_shipped_engine(), and test_numba_ab_parity.TestRandomizedSweep.test_sweep().
|
protected |
Definition at line 100 of file test_numba_ab_parity.py.
References max.
Referenced by _assert_close(), test_numba_ab_parity.TestChugKernelMatchesPython._same(), test_numba_ab_parity.TestCoolingIsActuallyApplied.test_effective_tc_differs_and_is_reported(), and test_numba_ab_parity.TestRandomizedSweep.test_sweep().
|
protected |
Config + runner + per-point pure-Python reference, built once.
Definition at line 119 of file test_numba_ab_parity.py.
References _chamber_gate(), and _python_only().
Referenced by test_numba_ab_parity.TestDeliveredIspInvariant.test_delivered_below_ceiling(), test_numba_ab_parity.TestAccelMatchesPython.test_diagnostics(), test_numba_ab_parity.TestCoolingIsActuallyApplied.test_effective_tc_differs_and_is_reported(), test_numba_ab_parity.TestAccelMatchesPython.test_kernel_level_raw_tuple(), test_numba_ab_parity.TestRandomizedSweep.test_sweep(), and test_numba_ab_parity.TestAccelMatchesPython.test_wrapper_fields().
| test_numba_ab_parity.test_chamber_kernel_serves_the_designs | ( | ) |
Every chamber piece is mirrored, so the shipped design and the one drawn from CAD run on the kernel (NOT_HANDLED here would put Layer 1 back on the ~60 ms Python solve).
Definition at line 470 of file test_numba_ab_parity.py.
References _need_numba().
| test_numba_ab_parity.test_default_path_matches_python_on_the_shipped_engine | ( | ) |
The shipped 6.5 kN at its tank pressure and pad ambient: what the default (accelerated) path returns -- the thing Layer 1 and the UI read -- must be the ED_ACCEL=off answer.
Definition at line 444 of file test_numba_ab_parity.py.
References _assert_close(), _need_numba(), _py_field(), and _python_only().
| test_numba_ab_parity.test_heatup_tables_match_coolprop | ( | ) |
The one tabulation in the chamber kernel: CoolProp's liquid cp(T) and density at the chamber pressure (combustion_physics.liquid_heatup_properties), for both liquids of the 6.5 kN engine over the whole Pc window. A point the table refuses is allowed (the kernel returns no solution and the caller runs Python); a point it answers must answer right.
Definition at line 486 of file test_numba_ab_parity.py.
References _need_numba().
| test_numba_ab_parity.test_injector_solve_matches_python | ( | cfg_rel | ) |
closure.flows runs accel.solve on the DEFAULT path, on every residual of the Python chamber solve. It must reproduce the Python injector: one closure pass with Cd untouched (impinging), the feed exit dump K_exit on d_exit, the passage at A_hydraulic, pintle's fixed-K x*.
Definition at line 409 of file test_numba_ab_parity.py.
References _assert_close(), and _need_numba().
|
protected |
Definition at line 46 of file test_numba_ab_parity.py.
|
protected |
Definition at line 388 of file test_numba_ab_parity.py.
|
protected |
Definition at line 391 of file test_numba_ab_parity.py.
|
protected |
Definition at line 392 of file test_numba_ab_parity.py.
|
protected |
Definition at line 116 of file test_numba_ab_parity.py.
| list test_numba_ab_parity.CONFIGS |
Definition at line 61 of file test_numba_ab_parity.py.
| list test_numba_ab_parity.CORE_FIELDS |
Definition at line 69 of file test_numba_ab_parity.py.
| list test_numba_ab_parity.DIAG_FIELDS |
Definition at line 74 of file test_numba_ab_parity.py.
| float test_numba_ab_parity.PA_AMBIENT = 101325.0 |
Definition at line 39 of file test_numba_ab_parity.py.
| list test_numba_ab_parity.POINTS_PSI = [(563.467, 567.644), (518.4, 550.6), (597.3, 584.7)] |
Definition at line 57 of file test_numba_ab_parity.py.
| float test_numba_ab_parity.PSI_TO_PA = 6894.76 |
Definition at line 38 of file test_numba_ab_parity.py.
| test_numba_ab_parity.ROOT = Path(__file__).resolve().parents[1] |
Definition at line 37 of file test_numba_ab_parity.py.
| int test_numba_ab_parity.RTOL = 1e-6 |
Definition at line 59 of file test_numba_ab_parity.py.