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

Functions

 _clip (x, lo, hi)
 _tri (table, ip, im, ie, w0, w1, w2, w3, w4, w5, w6, w7)
 cea_eval (Pcg, MRg, epsg, cstar, Cf, Tc, gam, Rt, Mt, Cfvac, MR, Pc, eps)
 _reynolds (rho, u, d, mu)
 _cd_inf_orifice (d_hyd, cdinf, geom, dref, dmin, exps, logg, cdmax, cdfloor)
 _cd_lichtarowicz_re (cd_u, Re, x)
 _cd_from_re (Re, P_in, T_in, d_hyd, cdinf, aRe, cdmin, geom, dref, dmin, exps, logg, cdmax, cdfloor, upc, Pref, aP, utc, Tref, aT, lod, beta, cdu)
 _dpf (mdot, rho, ah, k0, k1, phi, P_tank, kx, dex)
 _bern (mdot_seed, dP, Pi, rho, area, dhyd, mu, Tin, cd_cap, cdinf, aRe, cdmin, geom, dref, dmin, exps, logg, cdmax, cdfloor, upc, Pref, aP, utc, Tref, aT, lod, beta, cdu)
 _stream_state (m, Pc, P_tank, rho, A, dh, mu, Tin, cd_cap, AH, K0, K1, PHI, KX, DEX, cdinf, aRe, cdmin, geom, dref, dmin, exps, logg, cdmax, cdfloor, upc, Pref, aP, utc, Tref, aT, lod, beta, cdu, pv, cc)
 _stream_flow (Pc, P_tank, rho, A, dh, mu, Tin, cd_cap, AH, K0, K1, PHI, KX, DEX, cdinf, aRe, cdmin, geom, dref, dmin, exps, logg, cdmax, cdfloor, upc, Pref, aP, utc, Tref, aT, lod, beta, cdu, pv, cc)
 _churchill_f (Re, rel_rough)
 _cd_side (P, side, Re, P_in, Pc, cd_cap)
 _net_march (P, side, m_total, P_port, Pc, cd_cap, holes)
 _stream_state_net (m, Pc, P_tank, side, A, cd_cap, P, holes)
 _stream_flow_net (Pc, P_tank, side, A, cd_cap, P, holes)
 _tn4222 (d_jet, v_jet, rho_l, mu_l, sigma, rho_g, scale, prop)
 _lefebvre (d_or, We, Oh, C, m, p)
 _tau_evap (D32, rho_l, Lv, Tb, Tc, Pc, rho_ch, cp_g, C_ev, ev_model, K_legacy)
 _ohnesorge (mu, rho, sigma, d)
 injector_solve (P, P_tank_O, P_tank_F, Pc)
 _smd_pintle (L_open, V_rel, rho_f, mu_f, sigma_f, C, B, n, p)
 injector_solve_pintle (P, P_tank_O, P_tank_F, Pc)
 _solve_injector (P, P_O, P_F, Pc)
 _sign (x)

Variables

 PI = np.pi
float G0 = 9.80665
float P_SEA = 101325.0
float RANKINE_PER_K = 0.45359237 / 0.0254
float STEFAN = 1e-8
float NU_LAMINAR = 0.4
float PRANDTL = 0.8
int D_M_REF = 1e-6
float CS_C_L = 200.0
int GAS_MU = 2200.0
int SMD_INGEBO = 2
int EFF_CONSTANT = 1

Detailed Description

Numba mirror of the Python injector solve (impinging and pintle) and the CEA lookup.

All state arrives as one flat float64 vector built by params.extract_params, plus the CEA tables
as plain arrays -- @njit sees no Python objects.

injector_solve / injector_solve_pintle / _dpf mirror the Python injector exactly (one closure
pass with Cd untouched, the K_exit exit dump, A_hydraulic, pintle's fixed-K x*, the back-channel
ring network hole by hole), and that is what accel.solve serves on the default path. The chamber
(c* efficiency, ablative liner, nozzle, Pc root) is engine/accel/chamber.py.

Function Documentation

◆ _bern()

engine.accel.kernels._bern ( mdot_seed,
dP,
Pi,
rho,
area,
dhyd,
mu,
Tin,
cd_cap,
cdinf,
aRe,
cdmin,
geom,
dref,
dmin,
exps,
logg,
cdmax,
cdfloor,
upc,
Pref,
aP,
utc,
Tref,
aT,
lod,
beta,
cdu )
protected

Definition at line 166 of file kernels.py.

References _cd_from_re(), and _reynolds().

◆ _cd_from_re()

engine.accel.kernels._cd_from_re ( Re,
P_in,
T_in,
d_hyd,
cdinf,
aRe,
cdmin,
geom,
dref,
dmin,
exps,
logg,
cdmax,
cdfloor,
upc,
Pref,
aP,
utc,
Tref,
aT,
lod,
beta,
cdu )
protected

Definition at line 115 of file kernels.py.

References _cd_inf_orifice(), _cd_lichtarowicz_re(), and _clip().

Referenced by _bern(), _cd_side(), _stream_state(), and injector_solve_pintle().

◆ _cd_inf_orifice()

engine.accel.kernels._cd_inf_orifice ( d_hyd,
cdinf,
geom,
dref,
dmin,
exps,
logg,
cdmax,
cdfloor )
protected

Definition at line 90 of file kernels.py.

References _clip().

Referenced by _cd_from_re(), and injector_solve().

◆ _cd_lichtarowicz_re()

engine.accel.kernels._cd_lichtarowicz_re ( cd_u,
Re,
x )
protected
engine.core.discharge.cd_lichtarowicz_re (Lichtarowicz, Duggins & Markland 1965).

Definition at line 106 of file kernels.py.

Referenced by _cd_from_re().

◆ _cd_side()

engine.accel.kernels._cd_side ( P,
side,
Re,
P_in,
Pc,
cd_cap )
protected
impinging._stream_flow.cd_of for one stream: Cd(Re, P_in) capped, then the Nurick limit.

Definition at line 261 of file kernels.py.

References _cd_from_re().

Referenced by _net_march().

◆ _churchill_f()

engine.accel.kernels._churchill_f ( Re,
rel_rough )
protected
impinging._churchill_f: Darcy friction, Churchill (1977).

Definition at line 251 of file kernels.py.

Referenced by _net_march().

◆ _clip()

engine.accel.kernels._clip ( x,
lo,
hi )
protected

◆ _dpf()

engine.accel.kernels._dpf ( mdot,
rho,
ah,
k0,
k1,
phi,
P_tank,
kx,
dex )
protected
feed_loss.delta_p_feed: K_eff(P) velocity head on A_hydraulic plus the exit dump.

dp = K_eff (rho/2) (mdot/(rho A_hyd))^2 + K_exit (rho/2) (mdot/(rho A_exit))^2, with
A_exit the d_exit bore when one is declared and A_hyd otherwise. The passage is ALWAYS
A_hydraulic (the schema derives it from d_inlet), never pi d_inlet^2/4: a twin line
declares the summed area, and the bore-derived area overstated its loss 4x.

k0 arrives with the itemised fittings already summed in (params._feed). The Colebrook
friction path (feed_system.<side>.roughness_m) is NOT mirrored -- it needs mu per call --
and accel.can_handle hands those configs to Python.

Definition at line 136 of file kernels.py.

Referenced by _stream_state(), _stream_state_net(), and injector_solve_pintle().

◆ _lefebvre()

engine.accel.kernels._lefebvre ( d_or,
We,
Oh,
C,
m,
p )
protected

Definition at line 395 of file kernels.py.

Referenced by injector_solve().

◆ _net_march()

engine.accel.kernels._net_march ( P,
side,
m_total,
P_port,
Pc,
cd_cap,
holes )
protected
impinging._RingManifold.march: one branch of the dividing-flow ring, hole by hole.

Fills ``holes`` with each hole's flow (port first); returns (stream total, flow-weighted Cd).

Definition at line 284 of file kernels.py.

References _cd_side(), and _churchill_f().

Referenced by _stream_state_net().

◆ _ohnesorge()

engine.accel.kernels._ohnesorge ( mu,
rho,
sigma,
d )
protected

Definition at line 433 of file kernels.py.

Referenced by injector_solve().

◆ _reynolds()

engine.accel.kernels._reynolds ( rho,
u,
d,
mu )
protected

Definition at line 84 of file kernels.py.

Referenced by _bern(), _stream_state(), injector_solve(), and injector_solve_pintle().

◆ _sign()

engine.accel.kernels._sign ( x)
protected

Definition at line 701 of file kernels.py.

◆ _smd_pintle()

engine.accel.kernels._smd_pintle ( L_open,
V_rel,
rho_f,
mu_f,
sigma_f,
C,
B,
n,
p )
protected
spray.smd_pintle: SMD = C * L_open * We_rel^(-n) * (1 + B*Oh_f)^p.

Definition at line 567 of file kernels.py.

Referenced by injector_solve_pintle().

◆ _solve_injector()

engine.accel.kernels._solve_injector ( P,
P_O,
P_F,
Pc )
protected
Dispatch on injector type. Both branches return the same tuple type.

Definition at line 693 of file kernels.py.

References injector_solve(), and injector_solve_pintle().

◆ _stream_flow()

engine.accel.kernels._stream_flow ( Pc,
P_tank,
rho,
A,
dh,
mu,
Tin,
cd_cap,
AH,
K0,
K1,
PHI,
KX,
DEX,
cdinf,
aRe,
cdmin,
geom,
dref,
dmin,
exps,
logg,
cdmax,
cdfloor,
upc,
Pref,
aP,
utc,
Tref,
aT,
lod,
beta,
cdu,
pv,
cc )
protected
Mirrors impinging._stream_flow: Illinois false position on [0, Cd_cap A sqrt(2 rho (P_tank - Pc))].

Definition at line 208 of file kernels.py.

References _stream_state().

Referenced by injector_solve().

◆ _stream_flow_net()

engine.accel.kernels._stream_flow_net ( Pc,
P_tank,
side,
A,
cd_cap,
P,
holes )
protected
impinging._stream_flow with ``network``: the same Illinois root on the stream total; the
last state evaluated is the root's, so ``holes`` ends holding the solved per-hole flows.

Definition at line 341 of file kernels.py.

References _stream_state_net().

Referenced by injector_solve().

◆ _stream_state()

engine.accel.kernels._stream_state ( m,
Pc,
P_tank,
rho,
A,
dh,
mu,
Tin,
cd_cap,
AH,
K0,
K1,
PHI,
KX,
DEX,
cdinf,
aRe,
cdmin,
geom,
dref,
dmin,
exps,
logg,
cdmax,
cdfloor,
upc,
Pref,
aP,
utc,
Tref,
aT,
lod,
beta,
cdu,
pv,
cc )
protected

Definition at line 189 of file kernels.py.

References _cd_from_re(), _dpf(), and _reynolds().

Referenced by _stream_flow().

◆ _stream_state_net()

engine.accel.kernels._stream_state_net ( m,
Pc,
P_tank,
side,
A,
cd_cap,
P,
holes )
protected
impinging._stream_flow.state with a ring network.

Definition at line 328 of file kernels.py.

References _dpf(), and _net_march().

Referenced by _stream_flow_net().

◆ _tau_evap()

engine.accel.kernels._tau_evap ( D32,
rho_l,
Lv,
Tb,
Tc,
Pc,
rho_ch,
cp_g,
C_ev,
ev_model,
K_legacy )
protected
Droplet evaporation time [s]. ONE definition, shared by every kernel site.

The kernel used to hardcode the legacy fixed-K law (tau = K*D32^2) at the impinging and
pintle injector-solve sites while the Python reference
(engine/core/injectors/impinging.py) used the DERIVED Spalding constant, which is the
schema default (spray.evaporation.model = "derived"). x_star gates the Cd-reduction
loop, so the two paths disagreed on mass flow: measured 9.7% on thrust and 8.7% on Pc
for a shipped config. The A/B parity suite missed it because it sweeps tank pressure at
fixed geometry and never diffs x_star.

Derived branch (matches _evap_k_derived on the Python side):
    B_M  = cp_g (Tc - Tb) / Lv          Spalding mass-transfer number
    D_v  = 2e-5 (Tc/300)^1.75 (101325/Pc)   binary diffusivity, same scaling law
    k_ev = C_ev (8 rho_ch D_v / rho_l) ln(1 + B_M)
    tau  = D32^2 / k_ev
Falls back to the legacy law when the model is off or an input is missing, so a config
that does not declare the derived model is bit-identical to before.

Definition at line 401 of file kernels.py.

References max.

Referenced by injector_solve().

◆ _tn4222()

engine.accel.kernels._tn4222 ( d_jet,
v_jet,
rho_l,
mu_l,
sigma,
rho_g,
scale,
prop )
protected
Mirrors spray.smd_impinging_tn4222 (NACA TN 4222, dV = Vj) times smd_scale.

Definition at line 380 of file kernels.py.

Referenced by injector_solve().

◆ _tri()

engine.accel.kernels._tri ( table,
ip,
im,
ie,
w0,
w1,
w2,
w3,
w4,
w5,
w6,
w7 )
protected

Definition at line 52 of file kernels.py.

Referenced by cea_eval().

◆ cea_eval()

engine.accel.kernels.cea_eval ( Pcg,
MRg,
epsg,
cstar,
Cf,
Tc,
gam,
Rt,
Mt,
Cfvac,
MR,
Pc,
eps )

Definition at line 63 of file kernels.py.

References _clip(), and _tri().

◆ injector_solve()

engine.accel.kernels.injector_solve ( P,
P_tank_O,
P_tank_F,
Pc )
Returns (ok, mdot_O, mdot_F, u_O, u_F, D32_O, D32_F, mom_R, Cd_O, Cd_F,
Pi_O, Pi_F, dpi_O, dpi_F, A_geom_O, A_geom_F,
dpf_O, dpf_F, We_O, We_F, u_rel, x_star, constraints_ok, n_iter).
ok=0 => NaN/invalid.

The trailing eight are already computed by the solve; they are returned so the
diagnostics dict can be assembled here instead of by a second solve in C.

Definition at line 440 of file kernels.py.

References _cd_inf_orifice(), _clip(), _lefebvre(), _ohnesorge(), _reynolds(), _stream_flow(), _stream_flow_net(), _tau_evap(), _tn4222(), max, and min.

Referenced by _solve_injector().

◆ injector_solve_pintle()

engine.accel.kernels.injector_solve_pintle ( P,
P_tank_O,
P_tank_F,
Pc )
Pintle branch flows. Same 24-tuple shape as injector_solve.

Ports what PintleInjector.solve actually EXECUTES. Two things in that
function do not run and are deliberately not reproduced:
  * the `if feed_iter < 2:` quick-update block is dead -- `feed_iter` is 2
    once the `for feed_iter in range(3)` loop exits, so the condition is
    never true (confirmed by counting cd_from_re calls: 2/iteration, not 4);
  * that 3-iteration feed loop recomputes delta_p_feed from an unchanged
    mdot, so its 6 calls all return the same two values.
Mass flow therefore converges through the outer Cd-relaxation loop alone.

mom_R is left NaN: pintle has no momentum_ratio_R (see _eta_advanced).

Definition at line 578 of file kernels.py.

References _cd_from_re(), _clip(), _dpf(), _reynolds(), and _smd_pintle().

Referenced by _solve_injector().

Variable Documentation

◆ CS_C_L

float engine.accel.kernels.CS_C_L = 200.0

Definition at line 40 of file kernels.py.

◆ D_M_REF

int engine.accel.kernels.D_M_REF = 1e-6

Definition at line 39 of file kernels.py.

◆ EFF_CONSTANT

int engine.accel.kernels.EFF_CONSTANT = 1

Definition at line 43 of file kernels.py.

◆ G0

float engine.accel.kernels.G0 = 9.80665

Definition at line 32 of file kernels.py.

◆ GAS_MU

int engine.accel.kernels.GAS_MU = 2200.0

Definition at line 41 of file kernels.py.

◆ NU_LAMINAR

float engine.accel.kernels.NU_LAMINAR = 0.4

Definition at line 37 of file kernels.py.

◆ P_SEA

float engine.accel.kernels.P_SEA = 101325.0

Definition at line 33 of file kernels.py.

◆ PI

engine.accel.kernels.PI = np.pi

Definition at line 31 of file kernels.py.

◆ PRANDTL

float engine.accel.kernels.PRANDTL = 0.8

Definition at line 38 of file kernels.py.

◆ RANKINE_PER_K

float engine.accel.kernels.RANKINE_PER_K = 0.45359237 / 0.0254

Definition at line 35 of file kernels.py.

◆ SMD_INGEBO

int engine.accel.kernels.SMD_INGEBO = 2

Definition at line 42 of file kernels.py.

◆ STEFAN

float engine.accel.kernels.STEFAN = 1e-8

Definition at line 36 of file kernels.py.