STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_n2_z_table.py
Go to the documentation of this file.
1
"""copv/n2_Z_lookup.csv covers the pressures a COPV holds, not only a propellant tank's.
2
3
The table stopped at 8.3 MPa; RegularGridInterpolator(fill_value=None) extrapolates linearly past
4
it, so the COPV solvers read Z 1.039 at 26 MPa and 300 K where CoolProp gives 1.105. On the LE4 (3)
5
stand's 1.312 kg in 4.619 L that put the charge at 3810 psia instead of 4141 (CoolProp, 300 K,
6
284 kg/m3), and shifted every COPV sizing in the Time-Series panel and Layer 2 by the same few
7
per cent. Extended to 60 MPa from CoolProp, the rows inside the old range untouched.
8
"""
9
10
from
__future__
import
annotations
11
12
from
pathlib
import
Path
13
14
import
pytest
15
16
TABLE = Path(__file__).resolve().parents[1] /
"copv"
/
"n2_Z_lookup.csv"
17
18
19
@pytest.fixture(scope="module")
20
def
interp
():
21
from
copv.blowdown_solver
import
load_Z_lookup_table
22
23
return
load_Z_lookup_table(str(TABLE))[0]
24
25
26
@pytest.mark.parametrize("T,P", [(300.0, 26e6)
, (300.0, 45e6), (250.0, 20e6), (90.0, 30e6)])
27
def
test_copv_pressures_read_coolprop_not_an_extrapolation
(interp, T, P):
28
CP = pytest.importorskip(
"CoolProp.CoolProp"
)
29
from
copv.blowdown_solver
import
Z_lookup
30
31
# On a tabulated temperature (90, 300) the value is CoolProp's own; 250 K sits between rows.
32
tol = 1e-9
if
T
in
(90.0, 300.0)
else
2e-4
33
assert
Z_lookup(T, P, interp) == pytest.approx(CP.PropsSI(
"Z"
,
"T"
, T,
"P"
, P,
"Nitrogen"
), abs=tol)
34
35
36
def
test_the_tank_range_is_unchanged
(interp):
37
"""A propellant-tank state (300 K, 5 MPa) still reads the original grid."""
38
CP = pytest.importorskip(
"CoolProp.CoolProp"
)
39
from
copv.blowdown_solver
import
Z_lookup
40
41
assert
Z_lookup(300.0, 5003015.075376884, interp) == pytest.approx(
42
CP.PropsSI(
"Z"
,
"T"
, 300.0,
"P"
, 5003015.075376884,
"Nitrogen"
), abs=1e-12
43
)
copv.blowdown_solver
Definition
blowdown_solver.py:1
test_n2_z_table.interp
interp()
Definition
test_n2_z_table.py:20
test_n2_z_table.test_copv_pressures_read_coolprop_not_an_extrapolation
test_copv_pressures_read_coolprop_not_an_extrapolation(interp, T, P)
Definition
test_n2_z_table.py:27
test_n2_z_table.test_the_tank_range_is_unchanged
test_the_tank_range_is_unchanged(interp)
Definition
test_n2_z_table.py:36
EngineDesign
tests
test_n2_z_table.py
Generated by
1.15.0