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
3CoolProp's bicubic tables interpolate across the saturation line wherever a
4table cell straddles it. Measured against the equation of state (HEOS), on
5CoolProp 7.2 and 8.0: nitrogen ten kelvin above its boiling point at 1.07 bar
6read 83 kg/m^3 for 4.3; saturated oxygen vapour at 90 K read 0.47 bar for
70.99 -- the partial pressure a cold LOX ullage is built from. Near the line the
8tables now decline and the chain's HEOS answers; away from it nothing changes.
9These are checked against CoolProp's HEOS directly, not against feedtwin.
10"""
11
12from __future__ import annotations
13
14import CoolProp.CoolProp as CP
15import pytest
16
17from feedtwin.props import Fluid
18
19N2 = Fluid("nitrogen")
20O2 = Fluid("oxygen")
21
22
23@pytest.mark.parametrize("above_K", [0.5, 2.0, 5.0, 10.0])
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])
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
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)
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
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"
None test_away_from_the_line_the_tables_still_answer()
None test_just_past_the_critical_band_the_tables_are_not_trusted(float T, float p)
None test_saturated_oxygen_vapour_has_its_own_pressure(float T)
None test_cold_nitrogen_near_an_atmosphere_is_a_gas(float above_K)
None test_a_vent_gas_temperature_from_its_enthalpy()