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

Functions

 _sat_T (P, Tb, Lb, MW, Tcrit)
 _spline_block (xs, ys)
 _tab_range (lo, hi, flag, h_target, fn, nf, tol_rel, tol_abs, depth)
 _piecewise (segments, fn, nf, tol_rel, tol_abs)
 _roots (f, a, b, n=800)
 heatup_tables (name, T0, Tb, Lb, MW, Tcrit)
 _pw_find (segs, ok, x)
 _pw_val (coef, k, j, dx)
 _pw_flag (segs, x)
 _saturation_state (P, Tb, Lb, MW, Tcrit)
 _huzel_mu (T, M)
 _area_ratio (M, gamma)
 _mach (ar, gamma, sup)
 _kappa (CR, gamma)
 _axis (lo, hi, n, x, log)
 _aux2 (Q, tab, k, MR, Pc)
 _aux3 (Q, tab, k, MR, Pc, eps)
 _wide_row (lnPc, cs, Pc, row)
 _interp (x, xp, fp)
 _cs_of_r (r, lnMR, row, MR_lo, MR_hi, r_lo, r_hi, c_lo, c_hi)
 _cs_of_MR (MR, lnMR, row, MR_lo, MR_hi, r_lo, r_hi, c_lo, c_hi)
 _rupe_Em_at_M (M, Em_opt, M_opt, curv)
 _heatup (Q, b, HTs, HTc, HTo, TLs, TLc, TLo, Pc, T0, Ts, Tc)
 _eta_vap (Q, CH, Pc, Tc, gamma, R, MR, mdot, D32_O, D32_F, u_O, u_F, u_ax, L_imp, L_b, lnMR, row, MR_lo, MR_hi, r_lo, r_hi, c_lo, c_hi, out)
 _eta_mix (Q, CH, MR, rupe_M, holes_O, holes_F, lnMR, row, MR_lo, MR_hi, r_lo, r_hi, c_lo, c_hi, out)
 _lk_eps0 (c, t, paL)
 _lk_species (h2o, T, P_bar, pa_bar, L_cm)
 _lk_overlap (pH, pC, L_cm)
 _ablative_Q (Q, CH, T0, P0, gamma, G, mu, cp, Pr, xH, xC, gas_mdot)
 _point (Pc, P, CH, C, P_O, P_F, eps_cea, out)
 _brentq (P, CH, C, P_O, P_F, a, b, xtol, rtol, maxit, out)
 evaluate_core (P, CH, C, P_O, P_F, Pa)
 _contour (cg)
 _aux_arrays (cache)
 _wide_arrays (cache)
 chamber_inputs (config, cache)
 warmup ()

Variables

float G0 = 9.80665
 RR_W = np.ascontiguousarray(_RR_WEIGHTS, np.float64)
 GL_X = np.ascontiguousarray(_HEATUP_GL_X, np.float64)
 GL_W = np.ascontiguousarray(_HEATUP_GL_W, np.float64)
 LK_H2O = np.ascontiguousarray(_LECKNER_H2O, np.float64)
 LK_CO2 = np.ascontiguousarray(_LECKNER_CO2, np.float64)
 N_HEAT = GL_X.size
list _QNAMES
dict _Q = {n: i for i, n in enumerate(_QNAMES)}
 NQ = len(_QNAMES)
dict _S_STRIDE = _Q["SF_OK"] - _Q["SO_OK"]
list _RNAMES
dict _R = {n: i for i, n in enumerate(_RNAMES)}
 NR = len(_RNAMES)
 _P_LO
 _P_HI
float _DX_KNOT = 0.004
 _TOL_CP
 _TOL_RHO
 _TOL_T
dict _HEAT_MEMO = {}
 _REFINE
 _MAX_DEPTH
tuple _NO_HT
str _CONTOUR_MEMO = OrderedDict()

Detailed Description

Numba mirror of the Python chamber solve, for the Layer 1 inner loop.

Each function here is a transcription of the Python function named in its docstring, in the same
order of operations, so the two paths compute the same physics and differ only by rounding and
by the one tabulation below. tests/test_numba_ab_parity.py diffs them live at 1e-6.

    residual(Pc) = mdot_injector(Pc) - (Pc/kappa) At / (eta_c* c*_ideal)       chamber_solver.residual
    eta_c* = eta_vap eta_mix eta_HL                                          combustion_eff.eta_cstar

The one thing numba cannot call is CoolProp, which the droplet heat-up reads at the chamber
pressure (combustion_physics.liquid_heatup_properties). It is tabulated here once per fluid as
functions of ln P -- cp at the 24 Gauss-Legendre nodes the Python integral uses, cp at the upper
limit, the density at the mean drop temperature, and CoolProp's saturation temperature -- as
cubic splines between the pressures where the integrand changes form (the critical pressure, where
the Clausius-Clapeyron surface temperature meets CoolProp's saturation line, where it reaches the
critical temperature, where the heat-up vanishes). Every interval is checked against CoolProp at
its midpoint when the table is built; an interval that misses is refused, and a pressure there
makes the kernel return no solution so the caller runs the Python solve.

Function Documentation

◆ _ablative_Q()

engine.accel.chamber._ablative_Q ( Q,
CH,
T0,
P0,
gamma,
G,
mu,
cp,
Pr,
xH,
xC,
gas_mdot )
protected
liner_response's heat_removed [W]: the lined stations' flux at the ablation temperature,
through the pyrolysis-blowing fixed point.

Definition at line 796 of file chamber.py.

References _lk_overlap(), _lk_species(), _mach(), max, and min.

Referenced by _point().

◆ _area_ratio()

engine.accel.chamber._area_ratio ( M,
gamma )
protected

Definition at line 351 of file chamber.py.

Referenced by _mach().

◆ _aux2()

engine.accel.chamber._aux2 ( Q,
tab,
k,
MR,
Pc )
protected
CEAAuxTables._bilinear.

Definition at line 417 of file chamber.py.

References _axis().

Referenced by _point().

◆ _aux3()

engine.accel.chamber._aux3 ( Q,
tab,
k,
MR,
Pc,
eps )
protected
CEAAuxTables._exit.

Definition at line 426 of file chamber.py.

References _axis().

Referenced by evaluate_core().

◆ _aux_arrays()

engine.accel.chamber._aux_arrays ( cache)
protected

Definition at line 1150 of file chamber.py.

Referenced by chamber_inputs().

◆ _axis()

engine.accel.chamber._axis ( lo,
hi,
n,
x,
log )
protected
cea_cache._aux_axis on a uniform (or log-uniform) grid of n points.

Definition at line 403 of file chamber.py.

References max, and min.

Referenced by _aux2(), and _aux3().

◆ _brentq()

engine.accel.chamber._brentq ( P,
CH,
C,
P_O,
P_F,
a,
b,
xtol,
rtol,
maxit,
out )
protected
scipy.optimize.brentq (the C original), on _point.

Definition at line 1002 of file chamber.py.

References _point(), and min.

Referenced by evaluate_core().

◆ _contour()

engine.accel.chamber._contour ( cg)
protected

Definition at line 1138 of file chamber.py.

Referenced by chamber_inputs().

◆ _cs_of_MR()

engine.accel.chamber._cs_of_MR ( MR,
lnMR,
row,
MR_lo,
MR_hi,
r_lo,
r_hi,
c_lo,
c_hi )
protected
CstarOfMR.__call__.

Definition at line 489 of file chamber.py.

References _cs_of_r().

Referenced by _eta_mix(), and _eta_vap().

◆ _cs_of_r()

engine.accel.chamber._cs_of_r ( r,
lnMR,
row,
MR_lo,
MR_hi,
r_lo,
r_hi,
c_lo,
c_hi )
protected
CstarOfMR.of_fraction for one oxidizer mass fraction -> (c*, outside the table).

Definition at line 477 of file chamber.py.

References _interp().

Referenced by _cs_of_MR(), and _eta_mix().

◆ _eta_mix()

engine.accel.chamber._eta_mix ( Q,
CH,
MR,
rupe_M,
holes_O,
holes_F,
lnMR,
row,
MR_lo,
MR_hi,
r_lo,
r_hi,
c_lo,
c_hi,
out )
protected

Definition at line 687 of file chamber.py.

References _cs_of_MR(), _cs_of_r(), and _rupe_Em_at_M().

Referenced by _point().

◆ _eta_vap()

engine.accel.chamber._eta_vap ( Q,
CH,
Pc,
Tc,
gamma,
R,
MR,
mdot,
D32_O,
D32_F,
u_O,
u_F,
u_ax,
L_imp,
L_b,
lnMR,
row,
MR_lo,
MR_hi,
r_lo,
r_hi,
c_lo,
c_hi,
out )
protected
calculate_vaporization_efficiency -> eta_vap (NaN where the Python raises).

Definition at line 547 of file chamber.py.

References _cs_of_MR(), _heatup(), _huzel_mu(), _saturation_state(), and max.

Referenced by _point().

◆ _heatup()

engine.accel.chamber._heatup ( Q,
b,
HTs,
HTc,
HTo,
TLs,
TLc,
TLo,
Pc,
T0,
Ts,
Tc )
protected
liquid_heatup_properties from the tables -> (status, I, rho_l).

status 1: CoolProp values; 0: Python returns None here (configured props);
-1: the tables cannot answer (a refused interval / outside them) -- no solution.

Definition at line 511 of file chamber.py.

References _pw_find(), _pw_flag(), and _pw_val().

Referenced by _eta_vap().

◆ _huzel_mu()

engine.accel.chamber._huzel_mu ( T,
M )
protected
regen_cooling.calculate_gas_viscosity_huzel.

Definition at line 345 of file chamber.py.

Referenced by _eta_vap().

◆ _interp()

engine.accel.chamber._interp ( x,
xp,
fp )
protected
np.interp for one point.

Definition at line 464 of file chamber.py.

Referenced by _cs_of_r(), and _point().

◆ _kappa()

engine.accel.chamber._kappa ( CR,
gamma )
protected
nozzle.nozzle_stagnation_loss (CR <= 1: bore not declared).

Definition at line 393 of file chamber.py.

References _mach().

Referenced by _point(), and evaluate_core().

◆ _lk_eps0()

engine.accel.chamber._lk_eps0 ( c,
t,
paL )
protected

Definition at line 751 of file chamber.py.

References max.

Referenced by _lk_species().

◆ _lk_overlap()

engine.accel.chamber._lk_overlap ( pH,
pC,
L_cm )
protected

Definition at line 787 of file chamber.py.

References max.

Referenced by _ablative_Q().

◆ _lk_species()

engine.accel.chamber._lk_species ( h2o,
T,
P_bar,
pa_bar,
L_cm )
protected

Definition at line 763 of file chamber.py.

References _lk_eps0(), max, and min.

Referenced by _ablative_Q().

◆ _mach()

engine.accel.chamber._mach ( ar,
gamma,
sup )
protected
gas_side.mach_from_area_ratio for one station: the root of A/A*(M) = ar on the requested
branch. The Python bisects 64 times; this is Newton kept inside the same shrinking bracket,
which lands on the same root to the last bit or two in ~6 steps instead of 64.

Definition at line 357 of file chamber.py.

References _area_ratio().

Referenced by _ablative_Q(), and _kappa().

◆ _piecewise()

engine.accel.chamber._piecewise ( segments,
fn,
nf,
tol_rel,
tol_abs )
protected
Tabulate fn(x, flag) -> (nf,) on each (lo, hi, flag) segment. Returns (segs, coef, ok).

Definition at line 161 of file chamber.py.

References _tab_range().

Referenced by heatup_tables().

◆ _point()

engine.accel.chamber._point ( Pc,
P,
CH,
C,
P_O,
P_F,
eps_cea,
out )
protected
supply - demand at Pc (NaN where the Python residual is NaN or raises); fills ``out``.

Definition at line 877 of file chamber.py.

References _ablative_Q(), _aux2(), _eta_mix(), _eta_vap(), _interp(), _kappa(), _wide_row(), and max.

Referenced by _brentq(), and evaluate_core().

◆ _pw_find()

engine.accel.chamber._pw_find ( segs,
ok,
x )
protected
(interval index, dx) of x in a piecewise table, or (-1, 0) outside or on a refused one.

Definition at line 293 of file chamber.py.

Referenced by _heatup().

◆ _pw_flag()

engine.accel.chamber._pw_flag ( segs,
x )
protected

Definition at line 316 of file chamber.py.

Referenced by _heatup().

◆ _pw_val()

engine.accel.chamber._pw_val ( coef,
k,
j,
dx )
protected

Definition at line 311 of file chamber.py.

Referenced by _heatup().

◆ _roots()

engine.accel.chamber._roots ( f,
a,
b,
n = 800 )
protected
Sign changes of f on [a, b], each refined by Brent.

Definition at line 181 of file chamber.py.

Referenced by heatup_tables().

◆ _rupe_Em_at_M()

engine.accel.chamber._rupe_Em_at_M ( M,
Em_opt,
M_opt,
curv )
protected
combustion_physics.rupe_Em_at_M (NaN where the Python raises).

Definition at line 496 of file chamber.py.

References max.

Referenced by _eta_mix().

◆ _sat_T()

engine.accel.chamber._sat_T ( P,
Tb,
Lb,
MW,
Tcrit )
protected
combustion_physics.saturation_state's surface temperature (Tcrit 0 => none).

Definition at line 91 of file chamber.py.

Referenced by heatup_tables().

◆ _saturation_state()

engine.accel.chamber._saturation_state ( P,
Tb,
Lb,
MW,
Tcrit )
protected
combustion_physics.saturation_state -> (ok, T_sat, h_fg).

Definition at line 327 of file chamber.py.

Referenced by _eta_vap().

◆ _spline_block()

engine.accel.chamber._spline_block ( xs,
ys )
protected
Per-interval cubic coefficients (highest power first) of not-a-knot splines through ys.

Definition at line 97 of file chamber.py.

Referenced by _tab_range().

◆ _tab_range()

engine.accel.chamber._tab_range ( lo,
hi,
flag,
h_target,
fn,
nf,
tol_rel,
tol_abs,
depth )
protected
Pieces (lo, hi, h, n, coef, ok, flag) covering [lo, hi]: one not-a-knot spline per run
of knots, each interval checked against fn at its midpoint; a run of intervals that misses
is tabulated again finer, and still refused after _MAX_DEPTH refinements.

Definition at line 109 of file chamber.py.

References _spline_block(), _tab_range(), and max.

Referenced by _piecewise(), and _tab_range().

◆ _wide_arrays()

engine.accel.chamber._wide_arrays ( cache)
protected

Definition at line 1168 of file chamber.py.

Referenced by chamber_inputs().

◆ _wide_row()

engine.accel.chamber._wide_row ( lnPc,
cs,
Pc,
row )
protected
CstarWideTable.row into ``row``.

Definition at line 446 of file chamber.py.

Referenced by _point().

◆ chamber_inputs()

engine.accel.chamber.chamber_inputs ( config,
cache )
The chamber tuple for evaluate_core, or None when a piece of the Python chamber solve is
not mirrored here (the caller then runs Python).

Definition at line 1188 of file chamber.py.

References _aux_arrays(), _contour(), _wide_arrays(), g, heatup_tables(), and max.

◆ evaluate_core()

engine.accel.chamber.evaluate_core ( P,
CH,
C,
P_O,
P_F,
Pa )
Pc root, converged state and delivered thrust -> (ok, result vector).

The window and the top-down bracket scan are chamber_solver.solve's (PC_CHOKE_FLOOR_PA,
PC_MIN_TOTAL_DROP_FRAC, _highest_sign_change); the thrust is nozzle.calculate_thrust.

Definition at line 1055 of file chamber.py.

References _aux3(), _brentq(), _kappa(), _point(), max, and min.

Referenced by warmup().

◆ heatup_tables()

engine.accel.chamber.heatup_tables ( name,
T0,
Tb,
Lb,
MW,
Tcrit )
(HT segs, HT coef, HT ok, TL segs, TL coef) for a fluid CoolProp knows, else None.

HT columns, as functions of x = ln P: cp at T_n = T0 + (T_hi - T0)(x_n + 1)/2 for each
Gauss-Legendre node x_n, cp at T_hi, and rho at (T0 + T_hi)/2, with T_hi = min(T_s, T_lim);
segment flag 1 = above the critical pressure (T_lim infinite). TL: T_lim(x) below it.

Definition at line 202 of file chamber.py.

References _piecewise(), _roots(), _sat_T(), and min.

Referenced by chamber_inputs().

◆ warmup()

engine.accel.chamber.warmup ( )
Load (or compile) evaluate_core for the argument types every config produces, so a worker
pool does not pay it inside its first generation. Never raises.

Definition at line 1298 of file chamber.py.

References evaluate_core().

Variable Documentation

◆ _CONTOUR_MEMO

str engine.accel.chamber._CONTOUR_MEMO = OrderedDict()
protected

Definition at line 1135 of file chamber.py.

◆ _DX_KNOT

float engine.accel.chamber._DX_KNOT = 0.004
protected

Definition at line 83 of file chamber.py.

◆ _HEAT_MEMO

dict engine.accel.chamber._HEAT_MEMO = {}
protected

Definition at line 88 of file chamber.py.

◆ _MAX_DEPTH

engine.accel.chamber._MAX_DEPTH
protected

Definition at line 106 of file chamber.py.

◆ _NO_HT

tuple engine.accel.chamber._NO_HT
protected
Initial value:
1= (np.zeros((0, 6)), np.zeros((N_HEAT + 2, 0, 4)), np.zeros(0),
2 np.zeros((0, 6)), np.zeros((1, 0, 4)), np.zeros(0))

Definition at line 288 of file chamber.py.

◆ _P_HI

engine.accel.chamber._P_HI
protected

Definition at line 82 of file chamber.py.

◆ _P_LO

engine.accel.chamber._P_LO
protected

Definition at line 82 of file chamber.py.

◆ _Q

dict engine.accel.chamber._Q = {n: i for i, n in enumerate(_QNAMES)}
protected

Definition at line 62 of file chamber.py.

◆ _QNAMES

list engine.accel.chamber._QNAMES
protected
Initial value:
1= [
2 "AT", "AE", "EPS", "EPS_CUR", "LSTAR", "AC", "CR", "ZETA_N",
3 "EFF_MODEL", "EFF_C", "RR_Q", "RR_XSCALE", "BLOW_AS", "EM_OPT", "M_OPT", "EM_CURV", "USE_COUP",
4 "IMP",
5 "SO_OK", "SO_RHO", "SO_TB", "SO_LB", "SO_MW", "SO_TCRIT", "SO_T0", "SO_CP", "SO_HT",
6 "SF_OK", "SF_RHO", "SF_TB", "SF_LB", "SF_MW", "SF_TCRIT", "SF_T0", "SF_CP", "SF_HT",
7 "AB_ON", "AB_TS", "AB_EW", "AB_E", "AB_BELOW", "AB_PHYS", "AB_BC", "AB_BMIN", "AB_BEFF",
8 "AB_RT", "AB_LB",
9 "AX_MR0", "AX_MR1", "AX_NMR", "AX_PC0", "AX_PC1", "AX_NPC", "AX_E0", "AX_E1", "AX_NE",
10]

Definition at line 52 of file chamber.py.

◆ _R

dict engine.accel.chamber._R = {n: i for i, n in enumerate(_RNAMES)}
protected

Definition at line 74 of file chamber.py.

◆ _REFINE

engine.accel.chamber._REFINE
protected

Definition at line 106 of file chamber.py.

◆ _RNAMES

list engine.accel.chamber._RNAMES
protected
Initial value:
1= [
2 "PC", "F", "ISP", "MR", "CSTAR", "GAMMA", "R", "TC_EFF", "TC_IDEAL", "MDOT", "MDOT_O",
3 "MDOT_F", "V_EXIT", "CF", "CF_IDEAL", "P_EXIT", "P_THROAT", "T_EXIT", "T_THROAT", "M_EXIT",
4 "CSTAR_IDEAL", "ETA", "ETA_VAP", "ETA_MIX", "ETA_HL", "KAPPA", "P0", "Q_ABL", "F_VAP",
5 "F_VAP_O", "F_VAP_F", "X0", "U_DROP0", "EM", "RUPE_M", "M_MOL", "CF_VAC",
6]

Definition at line 68 of file chamber.py.

◆ _S_STRIDE

dict engine.accel.chamber._S_STRIDE = _Q["SF_OK"] - _Q["SO_OK"]
protected

Definition at line 65 of file chamber.py.

◆ _TOL_CP

engine.accel.chamber._TOL_CP
protected

Definition at line 87 of file chamber.py.

◆ _TOL_RHO

engine.accel.chamber._TOL_RHO
protected

Definition at line 87 of file chamber.py.

◆ _TOL_T

engine.accel.chamber._TOL_T
protected

Definition at line 87 of file chamber.py.

◆ G0

float engine.accel.chamber.G0 = 9.80665

Definition at line 43 of file chamber.py.

◆ GL_W

engine.accel.chamber.GL_W = np.ascontiguousarray(_HEATUP_GL_W, np.float64)

Definition at line 46 of file chamber.py.

◆ GL_X

engine.accel.chamber.GL_X = np.ascontiguousarray(_HEATUP_GL_X, np.float64)

Definition at line 45 of file chamber.py.

◆ LK_CO2

engine.accel.chamber.LK_CO2 = np.ascontiguousarray(_LECKNER_CO2, np.float64)

Definition at line 48 of file chamber.py.

◆ LK_H2O

engine.accel.chamber.LK_H2O = np.ascontiguousarray(_LECKNER_H2O, np.float64)

Definition at line 47 of file chamber.py.

◆ N_HEAT

engine.accel.chamber.N_HEAT = GL_X.size

Definition at line 49 of file chamber.py.

◆ NQ

engine.accel.chamber.NQ = len(_QNAMES)

Definition at line 64 of file chamber.py.

◆ NR

engine.accel.chamber.NR = len(_RNAMES)

Definition at line 76 of file chamber.py.

◆ RR_W

engine.accel.chamber.RR_W = np.ascontiguousarray(_RR_WEIGHTS, np.float64)

Definition at line 44 of file chamber.py.