STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_handcheck_without_rocketcea.py
Go to the documentation of this file.
1
"""Forward mode's independent check runs where rocketcea is not installed.
2
3
The API image leaves rocketcea out on purpose (it builds CEA from Fortran; requirements-base.txt),
4
and handcheck imported it first thing: POST /api/evaluate on the LE4 (3) stand came back with
5
``handcheck = {"rows": [], "error": "ModuleNotFoundError: No module named 'rocketcea'"}`` and the
6
page said only "Independent check: unavailable". Nothing tested handcheck at all.
7
8
Without rocketcea the textbook rows (mass balance, F = Cf Pc_ns At, Isp, the injector's Sutton 8-1,
9
Rupe M, stay time) need no CEA and must run; c* is checked against the committed wide CEA table;
10
the rows that need live CEA say so, and ``note`` says why.
11
"""
12
13
from
__future__
import
annotations
14
15
import
copy
16
import
sys
17
18
import
pytest
19
20
PSI = 6894.757
21
CFG =
"tests/fixtures/ethalox_6500N_doublet_cad_2026-09-28.yaml"
22
23
24
@pytest.fixture(scope="module")
25
def
solved
():
26
from
engine.core.runner
import
PintleEngineRunner
27
from
engine.pipeline.io
import
load_config
28
29
cfg = load_config(CFG)
30
P = 578.0 * PSI
31
r = PintleEngineRunner(copy.deepcopy(cfg)).evaluate(P, P, silent=
True
)
32
return
cfg, r, P
33
34
35
@pytest.fixture
36
def
no_rocketcea
(monkeypatch):
37
"""Make ``import rocketcea`` fail here even where it is installed."""
38
monkeypatch.setitem(sys.modules,
"rocketcea"
,
None
)
39
monkeypatch.setitem(sys.modules,
"rocketcea.cea_obj"
,
None
)
40
41
42
def
_rows
(hc):
43
return
{row[
"quantity"
]: row
for
row
in
hc[
"rows"
]}
44
45
46
def
test_the_check_runs_and_says_what_it_could_not_check
(solved, no_rocketcea):
47
from
engine.pipeline.handcheck
import
handcheck
48
49
cfg, r, P = solved
50
hc = handcheck(cfg, r, P, P)
51
assert
"error"
not
in
hc
52
assert
"rocketcea"
in
hc[
"note"
]
53
rows =
_rows
(hc)
54
for
q
in
(
"mdot = Pc_ns At / c*"
,
"F = Cf Pc_ns At"
,
"Isp = F / (mdot g0)"
,
"Rupe M"
):
55
assert
rows[q][
"kind"
] ==
"compare"
and
rows[q][
"ok"
], rows[q]
56
for
q
in
(
"Tc ideal"
,
"gamma chamber"
,
"exit pressure"
,
"Cf (zeta_n on vacuum Cf)"
):
57
assert
rows[q][
"kind"
] ==
"info"
and
rows[q][
"hand"
] ==
"needs rocketcea"
, rows[q]
58
59
60
def
test_c_star_is_checked_against_the_committed_wide_table
(solved, no_rocketcea):
61
from
engine.pipeline.handcheck
import
handcheck
62
63
cfg, r, P = solved
64
rows =
_rows
(handcheck(cfg, r, P, P))
65
c = rows[
"c* ideal"
]
66
assert
c[
"kind"
] ==
"compare"
and
c[
"ok"
]
and
"wide"
in
c[
"source"
], c
67
assert
rows[
"eta c*"
][
"ok"
], rows[
"eta c*"
]
68
69
70
def
test_a_clamped_mixture_ratio_shows_up_as_a_c_star_disagreement
(solved, no_rocketcea):
71
"""The wide table spans O/F 0.1-20 where the design's cache stops at 2.5: past the edge the
72
model's c* is the edge's, the table's is the point's, and the row says so."""
73
from
engine.core.runner
import
PintleEngineRunner
74
from
engine.pipeline.handcheck
import
handcheck
75
76
cfg, _, _ = solved
77
PO, PF = 578.0 * PSI, 300.0 * PSI
78
r = PintleEngineRunner(copy.deepcopy(cfg)).evaluate(PO, PF, silent=
True
)
79
assert
r[
"MR"
] > 2.5
80
c =
_rows
(handcheck(cfg, r, PO, PF))[
"c* ideal"
]
81
assert
c[
"kind"
] ==
"compare"
and
not
c[
"ok"
], c
engine.core.runner
Definition
runner.py:1
engine.pipeline.handcheck
Definition
handcheck.py:1
engine.pipeline.io
Definition
io.py:1
test_handcheck_without_rocketcea.solved
solved()
Definition
test_handcheck_without_rocketcea.py:25
test_handcheck_without_rocketcea.test_a_clamped_mixture_ratio_shows_up_as_a_c_star_disagreement
test_a_clamped_mixture_ratio_shows_up_as_a_c_star_disagreement(solved, no_rocketcea)
Definition
test_handcheck_without_rocketcea.py:70
test_handcheck_without_rocketcea._rows
_rows(hc)
Definition
test_handcheck_without_rocketcea.py:42
test_handcheck_without_rocketcea.no_rocketcea
no_rocketcea(monkeypatch)
Definition
test_handcheck_without_rocketcea.py:36
test_handcheck_without_rocketcea.test_c_star_is_checked_against_the_committed_wide_table
test_c_star_is_checked_against_the_committed_wide_table(solved, no_rocketcea)
Definition
test_handcheck_without_rocketcea.py:60
test_handcheck_without_rocketcea.test_the_check_runs_and_says_what_it_could_not_check
test_the_check_runs_and_says_what_it_could_not_check(solved, no_rocketcea)
Definition
test_handcheck_without_rocketcea.py:46
EngineDesign
tests
test_handcheck_without_rocketcea.py
Generated by
1.15.0