STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_props_near_dome.py
Go to the documentation of this file.
1
"""The tables are not trusted near the saturation line (``backends.coolprop._Dome``).
2
3
CoolProp's bicubic tables interpolate across the saturation line wherever a
4
table cell straddles it. Measured against the equation of state (HEOS), on
5
CoolProp 7.2 and 8.0: nitrogen ten kelvin above its boiling point at 1.07 bar
6
read 83 kg/m^3 for 4.3; saturated oxygen vapour at 90 K read 0.47 bar for
7
0.99 -- the partial pressure a cold LOX ullage is built from. Near the line the
8
tables now decline and the chain's HEOS answers; away from it nothing changes.
9
These are checked against CoolProp's HEOS directly, not against feedtwin.
10
"""
11
12
from
__future__
import
annotations
13
14
import
CoolProp.CoolProp
as
CP
15
import
pytest
16
17
from
feedtwin.props
import
Fluid
18
19
N2 =
Fluid
(
"nitrogen"
)
20
O2 =
Fluid
(
"oxygen"
)
21
22
23
@pytest.mark.parametrize("above_K", [0.5, 2.0, 5.0, 10.0])
24
def
test_cold_nitrogen_near_an_atmosphere_is_a_gas
(above_K: float) ->
None
:
25
p = 107613.0
26
T = CP.PropsSI(
"T"
,
"P"
, p,
"Q"
, 1,
"Nitrogen"
) + above_K
27
assert
N2.get(
"rho"
, p=p, T=T) == pytest.approx(
28
CP.PropsSI(
"D"
,
"P"
, p,
"T"
, T,
"Nitrogen"
), rel=1e-3
29
)
30
31
32
@pytest.mark.parametrize("T", [90.0, 110.0, 140.0])
33
def
test_saturated_oxygen_vapour_has_its_own_pressure
(T: float) ->
None
:
34
rho = CP.PropsSI(
"D"
,
"T"
, T,
"Q"
, 1,
"Oxygen"
)
35
assert
O2.get(
"p"
, rho=rho, T=T) == pytest.approx(
36
CP.PropsSI(
"P"
,
"D"
, rho,
"T"
, T,
"Oxygen"
), rel=1e-3
37
)
38
39
40
def
test_a_vent_gas_temperature_from_its_enthalpy
() -> None:
41
p = 2.2e5
42
T = CP.PropsSI(
"T"
,
"P"
, p,
"Q"
, 1,
"Nitrogen"
) + 1.0
43
h = CP.PropsSI(
"H"
,
"P"
, p,
"T"
, T,
"Nitrogen"
)
44
assert
N2.get(
"T"
, p=p, h=h) == pytest.approx(T, abs=0.02)
45
46
47
@pytest.mark.parametrize
(
48
"T,p"
,
49
[(144.0, 5.0e6), (148.5, 5.0e6), (144.0, 6.0e6), (140.0, 6.0e6)],
50
)
51
def
test_just_past_the_critical_band_the_tables_are_not_trusted
(
52
T: float, p: float
53
) ->
None
:
54
"""Nitrogen just outside the old band (0.75-1.5 p_c, below T_c + 16 K)
55
read density 3.7 % off, cp 9.4 %, cp/cv 14 % and viscosity 15 % at these
56
points. The band reaches 2.5 p_c and T_c + 30 K now; HEOS answers there."""
57
for
key, prop
in
((
"rho"
,
"D"
), (
"cp"
,
"C"
), (
"mu"
,
"V"
)):
58
assert
N2.get(key, p=p, T=T) == pytest.approx(
59
CP.PropsSI(prop,
"P"
, p,
"T"
, T,
"Nitrogen"
), rel=1e-3
60
), key
61
gamma = CP.PropsSI(
"C"
,
"P"
, p,
"T"
, T,
"Nitrogen"
) / CP.PropsSI(
62
"O"
,
"P"
, p,
"T"
, T,
"Nitrogen"
63
)
64
assert
N2.get(
"gamma"
, p=p, T=T) == pytest.approx(gamma, rel=1e-3)
65
66
67
def
test_away_from_the_line_the_tables_still_answer
() -> None:
68
"""The guard costs nothing where the tables are good: warm pressurant and
69
subcooled LOX at tank pressure stay on the fast backend."""
70
assert
N2.state(p=3.0e7, T=293.15).backend ==
"bicubic"
71
assert
O2.state(p=3.7e6, T=90.0).backend ==
"bicubic"
72
assert
N2.state(p=107613.0, T=82.0).backend ==
"heos"
feedtwin.props.fluid.Fluid
Definition
fluid.py:146
feedtwin.props
Definition
__init__.py:1
test_props_near_dome.test_away_from_the_line_the_tables_still_answer
None test_away_from_the_line_the_tables_still_answer()
Definition
test_props_near_dome.py:67
test_props_near_dome.test_just_past_the_critical_band_the_tables_are_not_trusted
None test_just_past_the_critical_band_the_tables_are_not_trusted(float T, float p)
Definition
test_props_near_dome.py:53
test_props_near_dome.test_saturated_oxygen_vapour_has_its_own_pressure
None test_saturated_oxygen_vapour_has_its_own_pressure(float T)
Definition
test_props_near_dome.py:33
test_props_near_dome.test_cold_nitrogen_near_an_atmosphere_is_a_gas
None test_cold_nitrogen_near_an_atmosphere_is_a_gas(float above_K)
Definition
test_props_near_dome.py:24
test_props_near_dome.test_a_vent_gas_temperature_from_its_enthalpy
None test_a_vent_gas_temperature_from_its_enthalpy()
Definition
test_props_near_dome.py:40
lib
feedtwin
tests
test_props_near_dome.py
Generated by
1.15.0