STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_chamber_out_of_table.py
Go to the documentation of this file.
1"""Beyond the c* table's O/F range, only what can burn makes chamber pressure.
2
3An Engine Abort vented the fuel tank while the LOX tank stayed pressed; the
4engine ran LOX-rich at O/F 20-70, the c* table clamped to its edge (O/F ~4)
5and priced the whole flow at that hot c*, the chamber sat at the fuel tank's
6own pressure, and the fuel line flowed backwards on every other step -- liquid
7"from nowhere" into the fuel tank for four seconds (Ethalox Stand, 2026-10-12).
8The rule extends :func:`unlit` (a lone propellant passes through unburned).
9"""
10
11from __future__ import annotations
12
13import pytest
14
15from feedtwin.engine.chamber import Chamber, burning
16
17RANGE = (1.0, 4.0)
18
19
21 assert burning(2.0, 1.0, RANGE) == 3.0
22 assert burning(4.0, 1.0, RANGE) == pytest.approx(5.0), "at the edge"
23 assert burning(5.0, 1.0, None) == 6.0, "no table, no range"
24
25
27 assert burning(20.0, 1.0, RANGE) == pytest.approx(5.0), "lean: fuel x (1 + 4)"
28 assert burning(0.5, 1.0, RANGE) == pytest.approx(1.0), "rich: ox x (1 + 1)"
29
30
32 edge = burning(4.0, 1.0, RANGE)
33 assert burning(4.0 + 1e-9, 1.0, RANGE) == pytest.approx(edge)
34 assert burning(1.0, 1e-6, RANGE) == pytest.approx(5e-6), "fuel gone, nothing burns"
35
36
37class _Flat:
38 """A c* table: constant c*, a range, clamped like the real one."""
39
40 mixture_ratios = (1.0, 4.0)
41
42 def combustion(self, pressure: float, mixture_ratio: float): # type: ignore[no-untyped-def]
43 from feedtwin.engine.chamber import CombustionState
44
45 return CombustionState(cstar=1600.0, thrust_coefficient=1.5)
46
47
49 monkeypatch: pytest.MonkeyPatch,
50) -> None:
51 import feedtwin.engine.chamber as module
52
53 monkeypatch.setattr(module, "CEATable", _Flat)
54 chamber = Chamber(throat_area=5e-4, cstar_model=_Flat()) # type: ignore[arg-type]
55 rich = chamber.evaluate(mdot_oxidiser=2.0, mdot_fuel=0.05)
56 burned = 0.05 * (1.0 + 4.0)
57 assert rich.pressure == pytest.approx(burned * 1600.0 / 5e-4)
58 clamped = 2.05 * 1600.0 / 5e-4
59 assert rich.pressure < 0.2 * clamped
combustion(self, float pressure, float mixture_ratio)
None test_a_lox_rich_abort_does_not_hold_the_chamber_at_the_hot_cstar(pytest.MonkeyPatch monkeypatch)