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

Classes

class  Table2D
class  InjectorCard
class  ChamberCard
class  EngineCard
class  _CardCStar
class  CardChamber

Functions

float _catmull_rom (float p0, float p1, float p2, float p3, float t)
bool _inside (Sequence[tuple[float, float]] polygon, float x, float y)
tuple[tuple[float, float],...] _hull (Any raw)

Variables

int CARD_SCHEMA = 1

Detailed Description

An engine card: another tool's injector and chamber, tabulated for the twin.

feedtwin's own engine is deliberately simple:
* an orifice leg per side, with the config's Reynolds-law Cd;
* ``p_c = mdot c* eta / A_t`` on the CEA table, with ``eta = 1``.

EngineDesign's engine is not simple:
* its Cd comes from the plate's passages and a ring-network manifold;
* its c* efficiency comes from a spray march, Rupe stream-tube mixing and wall
  heat loss;
* its nozzle carries a Rayleigh stagnation loss and the real exit state.

Calling that physics from inside the twin's chamber closure would cost seconds
per step. A card is the same physics, sampled once and tabulated, in a form the
twin's network and chamber closure can evaluate in microseconds.

The boundary is the line exit
-----------------------------
The card starts where the drawing's feed line ends: the injector face node,
whose pressure is the line-end pressure in the lumped K-factor convention every
feedtwin line uses (``dp = (f L/D + sum K) rho v^2/2``, no acceleration term).
Everything downstream of that point is the card's:

* the discharge into the manifold (a Borda exit, K = 1 at the exit bore), which
  no drawing line models;
* the manifold;
* the orifices;
* the chamber;
* the nozzle.

Nothing upstream of it is the card's. The caller that builds a card samples its
engine with every feed-line loss removed, so the drawing's lines and the card
never count the same loss twice.

What is tabulated, and why in that form
---------------------------------------
* **Injector, per side.** The flow capacity ``phi = mdot / sqrt(dp)``
  [kg/(s Pa^0.5)] over ``(mdot, inlet pressure)``. For an incompressible
  orifice ``phi`` is nearly constant (``Cd A sqrt(2 rho)``), so the table holds
  the slow part. ``dp = (mdot / phi)^2`` keeps the quadratic exact at any
  flow, including flows outside the table.
* **Chamber.**
  * ``c*_eff = p_c A_t / mdot``: the effective characteristic velocity,
    efficiency and stagnation loss included.
  * ``v_vac = (F + p_a A_e) / mdot``: the vacuum exhaust velocity.
  * Both are tabulated over ``(O/F, mdot_total)``. Thrust at any ambient is then
    ``mdot v_vac - p_a A_e``. That is exact for a full-flowing nozzle, which is
    what lets a card built at one site serve another, or serve a vehicle
    climbing through the atmosphere.

Tables are uniform grids evaluated with Catmull-Rom (C1, interpolating, exact on
linear data, with linear ghost nodes at the edges). Outside the grid they clamp, which keeps every query physical. Every table also carries
the convex hull of the points it was fitted to. A query outside the hull is
reported as extrapolated, so a trace says when it left what the card knows.

Opt-in. An :class:`~feedtwin.engine.design.InjectorSide` without a card, and a
:class:`~feedtwin.engine.chamber.Chamber` that is not a :class:`CardChamber`,
behave exactly as before.

Function Documentation

◆ _catmull_rom()

float feedtwin.engine.card._catmull_rom ( float p0,
float p1,
float p2,
float p3,
float t )
protected
Uniform Catmull-Rom between ``p1`` (t=0) and ``p2`` (t=1).

Definition at line 82 of file card.py.

Referenced by feedtwin.engine.card.Table2D.__call__().

◆ _hull()

tuple[tuple[float, float], ...] feedtwin.engine.card._hull ( Any raw)
protected

◆ _inside()

bool feedtwin.engine.card._inside ( Sequence[tuple[float, float]] polygon,
float x,
float y )
protected
Point in polygon by ray casting, the boundary included. An empty polygon
contains nothing.

Ray casting alone is half-open: of a square's four edges it keeps two, so a
sample on the far edge of the hull -- the highest flow or pressure the card was
built from -- read as outside it, and a query there counted as extrapolated.
The edge test runs on each axis scaled to the hull's extent, since the axes
differ by six orders of magnitude (kg/s against Pa).

Definition at line 176 of file card.py.

References max, and min.

Referenced by feedtwin.engine.card.ChamberCard.covers(), and feedtwin.engine.card.InjectorCard.covers().

Variable Documentation

◆ CARD_SCHEMA

int feedtwin.engine.card.CARD_SCHEMA = 1

Definition at line 79 of file card.py.