STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
engine.accel Namespace Reference

Namespaces

namespace  cea
namespace  chamber
namespace  diagnostics
namespace  kernels
namespace  params
namespace  stability

Classes

class  Outcome

Functions

bool available ()
bool enabled ()
bool require ()
bool can_handle (config)
tuple chamber_physics_not_mirrored (config=None)
bool can_handle_chamber (config)
 _chamber_run (config, cache, P_tank_O, P_tank_F, P_ambient)
 chamber_point (config, cache, P_tank_O, P_tank_F, P_ambient=101325.0)
 evaluate (config, cache, P_tank_O, P_tank_F, P_ambient=101325.0)
 evaluate_ex (config, cache, P_tank_O, P_tank_F, P_ambient=101325.0)
 solve (config, P_tank_O, P_tank_F, Pc)
 solve_ex (config, P_tank_O, P_tank_F, Pc)
 chamber_solve (config, cache, P_tank_O, P_tank_F)
 chamber_solve_ex (config, cache, P_tank_O, P_tank_F)
 warmup ()
 chug_margin_fast (streams, chamber, **kw)

Variables

list __all__

Detailed Description

Numba-backed physics accelerator for the Layer-1 optimizer inner loop.

Replaced the hand-written C port that used to live at engine/native (deleted once
this reached parity and then overtook it). Every entry point returns None rather
than raising when it cannot handle a config, because every caller treats None as
"fall back to the authoritative Python path".

Set ED_ACCEL=off to disable the accelerator entirely; everything then runs on the
Python physics, which stays authoritative and is what the parity suite diffs
against.

Function Documentation

◆ _chamber_run()

engine.accel._chamber_run ( config,
cache,
P_tank_O,
P_tank_F,
P_ambient )
protected
(P vector, result vector, Outcome) of one accelerated chamber solve.

Definition at line 133 of file __init__.py.

References can_handle_chamber().

Referenced by chamber_point(), chamber_solve_ex(), and evaluate_ex().

◆ available()

bool engine.accel.available ( )
False (never raises) when numba is absent, so a missing dep degrades to Python.

Definition at line 51 of file __init__.py.

Referenced by enabled().

◆ can_handle()

bool engine.accel.can_handle ( config)
Impinging and pintle; regen-coupled feed loss is not ported for either.

Definition at line 77 of file __init__.py.

Referenced by can_handle_chamber(), and solve_ex().

◆ can_handle_chamber()

bool engine.accel.can_handle_chamber ( config)
Adds the chamber gates on top of can_handle(): film and regen cooling are not mirrored
(their heat returns to the propellant and feeds the injector), nor the legacy efficiency
switch. The per-config pieces (the wide c* table, the mixing and blowing models) are checked
by chamber.chamber_inputs, which returns None for anything it does not mirror.

Definition at line 117 of file __init__.py.

References can_handle().

Referenced by _chamber_run().

◆ chamber_physics_not_mirrored()

tuple engine.accel.chamber_physics_not_mirrored ( config = None)
Python chamber physics engine.accel.chamber does not reproduce (empty: none).

Kept as the seam the parity suite and Layer 1 read: an entry here would send every chamber
call to the Python solve, which is slower but never different physics.

Definition at line 109 of file __init__.py.

◆ chamber_point()

engine.accel.chamber_point ( config,
cache,
P_tank_O,
P_tank_F,
P_ambient = 101325.0 )
Chamber and nozzle at one point, without diagnostics or stability: (dict | None, Outcome).

For callers that sample the engine hundreds of times and need only the operating point --
Layer X's engine card (engine/layerx/card.py). Same root as evaluate(); nothing here is a
second solve that could drift from it.

Definition at line 157 of file __init__.py.

References _chamber_run(), and g.

◆ chamber_solve()

engine.accel.chamber_solve ( config,
cache,
P_tank_O,
P_tank_F )
Whole chamber residual loop -> (Pc, diagnostics), or None.

Definition at line 269 of file __init__.py.

References chamber_solve_ex().

◆ chamber_solve_ex()

engine.accel.chamber_solve_ex ( config,
cache,
P_tank_O,
P_tank_F )
As chamber_solve(), but returns (result_or_None, Outcome).

The only consumer (chamber_solver._accel_chamber_pc) reads element 0. Shares
chamber.evaluate_core's root with evaluate(): a second, subtly different root-find is how
the two paths would drift apart.

Definition at line 274 of file __init__.py.

References _chamber_run(), and g.

Referenced by chamber_solve().

◆ chug_margin_fast()

engine.accel.chug_margin_fast ( streams,
chamber,
** kw )
Chug gain/phase margin. Dispatches like the rest of this surface.

fast_acoustic deliberately has no counterpart here: it measured 10.5 us in
Python against 4.2 us in C, and acoustic.fast_acoustic has no loop to compile.
A 6 us difference does not justify a kernel, so that path stays pure Python.

Definition at line 315 of file __init__.py.

◆ enabled()

bool engine.accel.enabled ( )

Definition at line 60 of file __init__.py.

References available().

◆ evaluate()

engine.accel.evaluate ( config,
cache,
P_tank_O,
P_tank_F,
P_ambient = 101325.0 )
Single-call chamber + nozzle + thrust + stability. None => caller falls back.

Definition at line 176 of file __init__.py.

References evaluate_ex().

◆ evaluate_ex()

engine.accel.evaluate_ex ( config,
cache,
P_tank_O,
P_tank_F,
P_ambient = 101325.0 )
As evaluate(), but returns (result_or_None, Outcome).

Definition at line 181 of file __init__.py.

References _chamber_run(), g, and max.

Referenced by evaluate().

◆ require()

bool engine.accel.require ( )
Strict mode: a genuine accelerator failure raises instead of falling back.

Without it a broken accelerator is invisible -- every caller falls back to
Python and the suite passes green on the wrong path.

Definition at line 68 of file __init__.py.

◆ solve()

engine.accel.solve ( config,
P_tank_O,
P_tank_F,
Pc )
Injector mass flows at a given Pc -> (mdot_O, mdot_F, diagnostics), or None.

Definition at line 235 of file __init__.py.

References solve_ex().

◆ solve_ex()

engine.accel.solve_ex ( config,
P_tank_O,
P_tank_F,
Pc )
As solve(), but returns (result_or_None, Outcome).

Sits on the FALLBACK path: closure.flows
calls it on every residual iteration of the Python chamber solve, so it runs
far more often than evaluate() does.

The param vector is rebuilt per call rather than cached on the config, exactly
as the C path rebuilds its state per call. Caching would be wrong here: Layer 1
mutates the worker's config in place between candidates
(_apply_x_to_worker_config_inplace), so a config-keyed cache would serve stale
geometry.

Definition at line 240 of file __init__.py.

References can_handle().

Referenced by solve().

◆ warmup()

engine.accel.warmup ( )
Force the JIT to compile/load before a ProcessPool is built.

@njit(cache=True) persists compiled code, but each worker process still
deserializes it on first call -- un-warmed, that lands inside the first CMA
generation and skews it. Call this in the parent AND in the pool's worker
initialiser.

Never raises: a warmup failure must not block optimization, exactly as the
C prewarm didn't.

Definition at line 296 of file __init__.py.

Variable Documentation

◆ __all__

list engine.accel.__all__
private
Initial value:
1= ["available", "enabled", "can_handle", "can_handle_chamber",
2 "chamber_physics_not_mirrored",
3 "evaluate", "solve", "chamber_solve", "warmup", "require",
4 "chug_margin_fast", "Outcome",
5 "evaluate_ex", "solve_ex", "chamber_solve_ex"]

Definition at line 17 of file __init__.py.