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

Classes

class  CEACache
class  CEAAuxTables

Functions

bool _cea_build_allowed ()
float _isentropic_cf_vac (float gamma, float eps)
float _scalar_clamp (float x, float lo, float hi)
 _get_CEA_Obj ()
 safe_print (*args, **kwargs)
Tuple[float, float, float, float, float, float] parse_cea_basic (str out)
List[Tuple[int, int, int, float, float, float, float, float, float]] _compute_cea_point_chunk (List[Tuple[int, int, int, float, float, float]] chunk, str ox_name, str fuel_name, Optional[float] expansion_ratio=None, Optional[Any] lock=None)
Dict[str, np.ndarray] _load_npz_tables (str path)
Tuple[int, float, bool] _aux_axis (np.ndarray grid, float x, bool log)
np.ndarray _fill_nan_nearest (np.ndarray a)
CEAAuxTables get_aux_tables (str ox_name, str fuel_name)

Variables

int CEA_TABLE_SCHEMA_VERSION = 2
 _CEA_Obj = None
 logger = logging.getLogger("evaluate")
 _original_print = print
 print = safe_print
 encoding
 errors
 stdout
 buffer
dict _NPZ_TABLE_MEMO = {}
int CEA_AUX_SCHEMA_VERSION = 1
tuple AUX_SPECIES = ("H2O", "CO2", "CO", "H2", "OH", "O2", "O", "H")
 _AUX_MR = np.round(np.linspace(0.8, 4.0, 65), 6)
 _AUX_PC = np.geomspace(1.0e5, 1.2e7, 16)
 _AUX_EPS = np.geomspace(1.1, 60.0, 48)
float _PSI = 6894.757293168361
float _BTU_LBM_R = 4186.8
float _MILLIPOISE = 1.0e-4
float _MCAL_CM_S_K = 0.4184
dict _AUX_MEMO = {}

Detailed Description

RocketCEA wrapper with MR/Pc caching and bilinear interpolation

Function Documentation

◆ _aux_axis()

Tuple[int, float, bool] engine.pipeline.cea_cache._aux_axis ( np.ndarray grid,
float x,
bool log )
protected
Cell index, weight and clamp flag on a uniform (or log-uniform) grid.

Definition at line 1130 of file cea_cache.py.

References max, and min.

Referenced by engine.pipeline.cea_cache.CEAAuxTables._bilinear(), and engine.pipeline.cea_cache.CEAAuxTables._exit().

◆ _cea_build_allowed()

bool engine.pipeline.cea_cache._cea_build_allowed ( )
protected

Definition at line 31 of file cea_cache.py.

Referenced by engine.pipeline.cea_cache.CEACache._build_cache().

◆ _compute_cea_point_chunk()

List[Tuple[int, int, int, float, float, float, float, float, float]] engine.pipeline.cea_cache._compute_cea_point_chunk ( List[Tuple[int, int, int, float, float, float]] chunk,
str ox_name,
str fuel_name,
Optional[float] expansion_ratio = None,
Optional[Any] lock = None )
protected
Worker function for parallel CEA cache building.

Computes CEA properties for a chunk of grid points.
This function must be at module level for multiprocessing.

Parameters:
-----------
chunk : List[Tuple[int, int, int, float, float, float]]
    List of (i, j, k_idx, Pc_psia, MR, eps) tuples
ox_name : str
    Oxidizer name
fuel_name : str
    Fuel name
expansion_ratio : float, optional
    Fixed expansion ratio (for 2D cache). If None, uses eps from chunk (3D cache)
lock : multiprocessing.Lock, optional
    Lock to serialize RocketCEA calls (RocketCEA is not process-safe)

Returns:
--------
results : List[Tuple[int, int, int, float, float, float, float, float, float]]
    List of (i, j, k_idx, cstar, Cf, Tc, gamma, R, M) tuples

Definition at line 214 of file cea_cache.py.

References _get_CEA_Obj(), and parse_cea_basic().

◆ _fill_nan_nearest()

np.ndarray engine.pipeline.cea_cache._fill_nan_nearest ( np.ndarray a)
protected
Fill failed CEA points from the nearest good one along the first axis (MR), then Pc.

Definition at line 1142 of file cea_cache.py.

References min.

Referenced by engine.pipeline.cea_cache.CEAAuxTables._build().

◆ _get_CEA_Obj()

engine.pipeline.cea_cache._get_CEA_Obj ( )
protected
Lazy import of CEA_Obj - only import when needed for cache building.

Definition at line 101 of file cea_cache.py.

Referenced by engine.pipeline.cea_cache.CEAAuxTables._build(), engine.pipeline.cea_cache.CEACache._build_cache_sequential(), and _compute_cea_point_chunk().

◆ _isentropic_cf_vac()

float engine.pipeline.cea_cache._isentropic_cf_vac ( float gamma,
float eps )
protected
Ideal vacuum thrust coefficient from gamma + area ratio (isentropic, frozen).

Fallback for caches built before the Cf_vac table existed. Slightly low vs CEA's
shifting-equilibrium Cf_vac (the same ~2% frozen gap documented in the thrust-model
analysis); regenerate the cache to get the exact CEA value. Self-contained to avoid
importing the nozzle solvers here.

Definition at line 49 of file cea_cache.py.

Referenced by engine.pipeline.cea_cache.CEACache.eval(), and engine.pipeline.cea_cache.CEACache.eval_cf_vac().

◆ _load_npz_tables()

Dict[str, np.ndarray] engine.pipeline.cea_cache._load_npz_tables ( str path)
protected
Return the fully-materialised contents of a cache .npz, memoised per file version.

Definition at line 305 of file cea_cache.py.

Referenced by engine.pipeline.cea_cache.CEAAuxTables._load(), and engine.pipeline.cea_cache.CEACache._load_cache().

◆ _scalar_clamp()

float engine.pipeline.cea_cache._scalar_clamp ( float x,
float lo,
float hi )
protected
float(np.clip(x, lo, hi)) for a scalar, without numpy's per-call overhead.
Matches np.clip exactly, including NaN pass-through (NaN < lo and NaN > hi are
both False, so NaN is returned). Hot path: called per CEA lookup.

Definition at line 85 of file cea_cache.py.

Referenced by engine.pipeline.cea_cache.CEACache.eval(), and engine.pipeline.cea_cache.CEACache.eval_cf_vac().

◆ get_aux_tables()

CEAAuxTables engine.pipeline.cea_cache.get_aux_tables ( str ox_name,
str fuel_name )

Definition at line 1301 of file cea_cache.py.

Referenced by engine.pipeline.cea_cache.CEACache.aux().

◆ parse_cea_basic()

Tuple[float, float, float, float, float, float] engine.pipeline.cea_cache.parse_cea_basic ( str out)
Extract Tc, gamma, R, c*, and Isp from NASA CEA text output (chamber values only).

Returns:
--------
Tc : float [K]
gamma : float
R : float [J/(kg*K)]
cstar : float [m/s]
M : float [kg/kmol]
Isp : float [s] (ambient Isp, or NaN if not found)

Definition at line 162 of file cea_cache.py.

Referenced by engine.pipeline.cea_cache.CEACache._build_cache_sequential(), and _compute_cea_point_chunk().

◆ safe_print()

engine.pipeline.cea_cache.safe_print ( * args,
** kwargs )
Log function that handles Unicode encoding errors gracefully

Definition at line 121 of file cea_cache.py.

References decode().

Variable Documentation

◆ _AUX_EPS

engine.pipeline.cea_cache._AUX_EPS = np.geomspace(1.1, 60.0, 48)
protected

Definition at line 1122 of file cea_cache.py.

◆ _AUX_MEMO

dict engine.pipeline.cea_cache._AUX_MEMO = {}
protected

Definition at line 1127 of file cea_cache.py.

◆ _AUX_MR

engine.pipeline.cea_cache._AUX_MR = np.round(np.linspace(0.8, 4.0, 65), 6)
protected

Definition at line 1120 of file cea_cache.py.

◆ _AUX_PC

engine.pipeline.cea_cache._AUX_PC = np.geomspace(1.0e5, 1.2e7, 16)
protected

Definition at line 1121 of file cea_cache.py.

◆ _BTU_LBM_R

float engine.pipeline.cea_cache._BTU_LBM_R = 4186.8
protected

Definition at line 1124 of file cea_cache.py.

◆ _CEA_Obj

engine.pipeline.cea_cache._CEA_Obj = None
protected

Definition at line 99 of file cea_cache.py.

◆ _MCAL_CM_S_K

float engine.pipeline.cea_cache._MCAL_CM_S_K = 0.4184
protected

Definition at line 1126 of file cea_cache.py.

◆ _MILLIPOISE

float engine.pipeline.cea_cache._MILLIPOISE = 1.0e-4
protected

Definition at line 1125 of file cea_cache.py.

◆ _NPZ_TABLE_MEMO

dict engine.pipeline.cea_cache._NPZ_TABLE_MEMO = {}
protected

Definition at line 302 of file cea_cache.py.

◆ _original_print

engine.pipeline.cea_cache._original_print = print
protected

Definition at line 120 of file cea_cache.py.

◆ _PSI

float engine.pipeline.cea_cache._PSI = 6894.757293168361
protected

Definition at line 1123 of file cea_cache.py.

◆ AUX_SPECIES

tuple engine.pipeline.cea_cache.AUX_SPECIES = ("H2O", "CO2", "CO", "H2", "OH", "O2", "O", "H")

Definition at line 1119 of file cea_cache.py.

◆ buffer

engine.pipeline.cea_cache.buffer

Definition at line 157 of file cea_cache.py.

◆ CEA_AUX_SCHEMA_VERSION

int engine.pipeline.cea_cache.CEA_AUX_SCHEMA_VERSION = 1

Definition at line 1118 of file cea_cache.py.

◆ CEA_TABLE_SCHEMA_VERSION

int engine.pipeline.cea_cache.CEA_TABLE_SCHEMA_VERSION = 2

Definition at line 46 of file cea_cache.py.

◆ encoding

engine.pipeline.cea_cache.encoding

Definition at line 154 of file cea_cache.py.

◆ errors

engine.pipeline.cea_cache.errors

Definition at line 154 of file cea_cache.py.

◆ logger

engine.pipeline.cea_cache.logger = logging.getLogger("evaluate")

Definition at line 117 of file cea_cache.py.

◆ print

◆ stdout

engine.pipeline.cea_cache.stdout

Definition at line 157 of file cea_cache.py.