import numpy as np from cryo_tank.config import P_WORKING, T_IN_HE from examples.cryo_tank_cylinder_system import run_system def test_cryo_tank_cylinder_system_passes_he_boundary_to_cylinder(): history = run_system(t_end=20.0, max_step=1.0) assert len(history['t']) > 2 assert np.all(history['mdot_He'] >= 0.0) assert np.allclose(history['mdot_tank_inlet'], history['mdot_He']) assert np.allclose(history['mdot_cylinder_out'], history['mdot_He']) assert np.allclose(history['T_tank_ullage'], history['T_ull']) assert np.allclose(history['T_tank_liq'], history['T_liq']) assert history['m_cylinder'][-1] < history['m_cylinder'][0] assert history['U_cylinder'][-1] < history['U_cylinder'][0] assert np.all(history['P_he_source'] > history['P_tank']) assert np.allclose(history['P_he_source'], history['P_cylinder']) assert np.allclose(history['P_he_tank_inlet'], history['P_tank']) assert np.allclose(history['P_he_boundary'], P_WORKING) assert np.allclose(history['T_he_tank_inlet'], T_IN_HE) assert np.allclose(history['T_he_boundary'], T_IN_HE) assert np.all(history['h_he_boundary'] > 0.0) assert np.allclose(history['edot_He'], history['mdot_He'] * history['h_he_boundary'])