代码仓库移植
This commit is contained in:
commit
0f57ba94f3
44 files changed
+7119
No files matched your search
@@ -0,0 +1,67 @@
|
||||
# tests/cryo_tank/test_properties.py
|
||||
"""Tests for CoolProp property wrappers."""
|
||||
import pytest
|
||||
import sys
|
||||
sys.path.insert(0, "src")
|
||||
|
||||
from cryo_tank.properties import (
|
||||
ln2_rho, ln2_h, ln2_u, ln2_T_from_u,
|
||||
n2_vapor_u, n2_sat_pressure,
|
||||
he_u, he_h, he_cp, he_cv,
|
||||
)
|
||||
from cryo_tank.config import P_WORKING
|
||||
|
||||
|
||||
class TestLN2Properties:
|
||||
"""Liquid nitrogen properties at P = 0.17 MPa."""
|
||||
|
||||
def test_ln2_density_at_78K(self):
|
||||
rho = ln2_rho(78.0, P_WORKING)
|
||||
assert 800 < rho < 810 # ~803 kg/m3
|
||||
|
||||
def test_ln2_enthalpy_at_77K(self):
|
||||
h = ln2_h(77.0, P_WORKING)
|
||||
assert -130000 < h < -110000 # ~-122695 J/kg
|
||||
|
||||
def test_ln2_internal_energy_at_78K(self):
|
||||
u = ln2_u(78.0, P_WORKING)
|
||||
assert -130000 < u < -110000 # ~-120865 J/kg
|
||||
|
||||
def test_ln2_T_from_u_roundtrip(self):
|
||||
T_orig = 78.0
|
||||
u = ln2_u(T_orig, P_WORKING)
|
||||
T_recovered = ln2_T_from_u(u, P_WORKING)
|
||||
assert abs(T_recovered - T_orig) < 0.01
|
||||
|
||||
|
||||
class TestN2VaporProperties:
|
||||
"""N2 vapor properties."""
|
||||
|
||||
def test_n2_sat_pressure_at_78K(self):
|
||||
P_sat = n2_sat_pressure(78.0)
|
||||
assert 0.10e6 < P_sat < 0.12e6 # ~0.1093 MPa
|
||||
|
||||
def test_n2_vapor_internal_energy_at_78K(self):
|
||||
u = n2_vapor_u(78.0)
|
||||
assert 50000 < u < 60000 # ~55547 J/kg
|
||||
|
||||
|
||||
class TestHeliumProperties:
|
||||
"""Helium (ideal gas) properties."""
|
||||
|
||||
def test_he_cp_near_5196(self):
|
||||
cp = he_cp()
|
||||
assert abs(cp - 5196.2) < 10 # monatomic ideal gas
|
||||
|
||||
def test_he_cv_near_3117(self):
|
||||
cv = he_cv()
|
||||
assert abs(cv - 3117.1) < 10
|
||||
|
||||
def test_he_enthalpy_at_100K(self):
|
||||
h = he_h(100.0)
|
||||
# CoolProp gives ~524762 J/kg at 100K
|
||||
assert 500000 < h < 550000
|
||||
|
||||
def test_he_internal_energy_at_78K(self):
|
||||
u = he_u(78.0)
|
||||
assert 200000 < u < 280000 # ~247932 J/kg
|
||||
Reference in new issue
Block a user