STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
feedtwin.engine.chamber.CEATable Class Reference

Public Member Functions

 __init__ (self, str|Path path, *, float|None expansion_ratio=None)
tuple[str, str] propellants (self)
bool contains (self, float pressure, float mixture_ratio)
CombustionState combustion (self, float pressure, float mixture_ratio)
str __repr__ (self)

Public Attributes

 path = Path(path)
 pressures = np.asarray(data["Pc"], dtype=float)
 mixture_ratios = np.asarray(data["MR"], dtype=float)
 expansions = np.asarray(data["eps"], dtype=float)
tuple meta
tuple expansion_ratio

Protected Member Functions

tuple[float, float] _clamped (self, float pressure, float mixture_ratio)

Protected Attributes

dict _fields

Detailed Description

EngineDesign's own CEA cache, read directly.

The cache is a ``(p_c, O/F, epsilon)`` grid of ``c*``, ``C_F``, ``T_c``,
``gamma``, ``R`` and ``M`` for one propellant pair. Reading it rather than
re-running CEA has two virtues: it is fast enough to sit inside an
integrator's right-hand side, and it guarantees that feed-twin and
EngineDesign are quoting the *same* combustion, so a disagreement between
them is a real disagreement rather than two CEA runs with different options.

Args:
    path: A ``cea_cache_*.npz`` written by EngineDesign.
    expansion_ratio: Where on the epsilon axis to sit. Defaults to the
        table's own design value from its metadata.

Raises:
    ValueError: the point is outside the table. Refused rather than
        extrapolated -- the same discipline the property backends keep, and
        for the same reason: a CEA table extrapolated past its mixture-ratio
        range returns a number, and the number is fiction.

Definition at line 99 of file chamber.py.

Constructor & Destructor Documentation

◆ __init__()

feedtwin.engine.chamber.CEATable.__init__ ( self,
str | Path path,
* ,
float | None expansion_ratio = None )

Definition at line 121 of file chamber.py.

Member Function Documentation

◆ __repr__()

str feedtwin.engine.chamber.CEATable.__repr__ ( self)

◆ _clamped()

tuple[float, float] feedtwin.engine.chamber.CEATable._clamped ( self,
float pressure,
float mixture_ratio )
protected

Definition at line 161 of file chamber.py.

References max, min, mixture_ratios, pressures, and solenoid_characterization_gui.FullPlotWindow.pressures.

Referenced by combustion().

◆ combustion()

CombustionState feedtwin.engine.chamber.CEATable.combustion ( self,
float pressure,
float mixture_ratio )
Interpolated combustion state.

Clamped to the table's edges rather than extrapolated. A transient
passes through startup, where chamber pressure begins near zero and
mixture ratio is briefly whatever the first propellant to arrive makes
it; refusing there would make every ignition unrunnable. Clamping is
the honest compromise, and :meth:`contains` is how a caller asks whether
the point it cares about was inside.

Definition at line 178 of file chamber.py.

References _clamped(), _fields, contains(), and expansion_ratio.

◆ contains()

bool feedtwin.engine.chamber.CEATable.contains ( self,
float pressure,
float mixture_ratio )
Whether this point is inside the table, before clamping.

Definition at line 169 of file chamber.py.

References mixture_ratios, pressures, and solenoid_characterization_gui.FullPlotWindow.pressures.

Referenced by combustion().

◆ propellants()

tuple[str, str] feedtwin.engine.chamber.CEATable.propellants ( self)

Definition at line 155 of file chamber.py.

References meta.

Referenced by __repr__().

Member Data Documentation

◆ _fields

dict feedtwin.engine.chamber.CEATable._fields
protected
Initial value:
= {
name: RegularGridInterpolator(
grid, np.asarray(data[name], dtype=float), bounds_error=False
)
for name in ("cstar", "Cf", "Tc", "gamma")
if name in data
}

Definition at line 146 of file chamber.py.

Referenced by combustion().

◆ expansion_ratio

tuple feedtwin.engine.chamber.CEATable.expansion_ratio
Initial value:
= (
default_eps if expansion_ratio is None else float(expansion_ratio)
)

Definition at line 139 of file chamber.py.

Referenced by combustion().

◆ expansions

feedtwin.engine.chamber.CEATable.expansions = np.asarray(data["eps"], dtype=float)

Definition at line 131 of file chamber.py.

◆ meta

tuple feedtwin.engine.chamber.CEATable.meta
Initial value:
= (
json.loads(meta_raw) if isinstance(meta_raw, str) else dict(meta_raw)
)

Definition at line 134 of file chamber.py.

Referenced by propellants().

◆ mixture_ratios

feedtwin.engine.chamber.CEATable.mixture_ratios = np.asarray(data["MR"], dtype=float)

Definition at line 130 of file chamber.py.

Referenced by _clamped(), and contains().

◆ path

◆ pressures

feedtwin.engine.chamber.CEATable.pressures = np.asarray(data["Pc"], dtype=float)

Definition at line 129 of file chamber.py.

Referenced by _clamped(), contains(), and feedtwin.solve.steady.SteadyResult.dp().


The documentation for this class was generated from the following file: