Files
pipe-system-simulation-test/tests/cryo_tank/test_properties.py
T

55 lines
1.4 KiB
Python

# 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,
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 TestHeliumProperties:
"""Helium properties."""
def test_he_cp_near_5196(self):
cp = he_cp()
assert abs(cp - 5196.2) < 10
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