修改体积导数计算逻辑,补充完善index.md
This commit is contained in:
1 parent
1cf8427b52
commit
3994835c65
8 files changed
+557
-232
No files matched your search
@@ -12,10 +12,9 @@ from cryo_tank.config import (
|
||||
)
|
||||
|
||||
|
||||
def _make_tank():
|
||||
def _make_tank(**overrides):
|
||||
"""Create a CryoTank with default config and MLI heat leak."""
|
||||
heat_leak = MLIHeatLeak(A_total=A_TOTAL, q_mli=1.0)
|
||||
return CryoTank(
|
||||
kw = dict(
|
||||
V_total=V_TOTAL, H_tank=H_TANK,
|
||||
P_work=P_WORKING,
|
||||
T_init=T_INIT, ullage_fraction=ULLAGE_FRACTION,
|
||||
@@ -23,8 +22,10 @@ def _make_tank():
|
||||
mdot_out_ln2=MDOT_OUT_LN2,
|
||||
T_in_he=T_IN_HE,
|
||||
h_conv=H_CONV_SURFACE, T_env=T_ENV,
|
||||
heat_leak_model=heat_leak,
|
||||
heat_leak_model=MLIHeatLeak(A_total=A_TOTAL, q_mli=1.0),
|
||||
)
|
||||
kw.update(overrides)
|
||||
return CryoTank(**kw)
|
||||
|
||||
|
||||
class TestGeometry:
|
||||
@@ -75,3 +76,37 @@ class TestInitialState:
|
||||
info = tank.derive(y0)
|
||||
P_He = info['P_He']
|
||||
assert abs(P_He - P_WORKING) / P_WORKING < 1e-12
|
||||
|
||||
|
||||
class TestVolumeRate:
|
||||
|
||||
def test_ullage_volume_rate_includes_liquid_thermal_expansion(self):
|
||||
tank = _make_tank(
|
||||
mdot_in_ln2=0.0,
|
||||
mdot_out_ln2=0.0,
|
||||
h_conv=0.0,
|
||||
)
|
||||
y0 = tank.initial_state()
|
||||
info = tank.derive(y0)
|
||||
|
||||
Q_liq_to_ull = 0.0
|
||||
Q_leak = tank.heat_leak_model.compute(info['T_liq'], tank.T_env)
|
||||
A_wet, A_dry = tank.wetted_areas(info['liquid_level'])
|
||||
Q_leak_liq = Q_leak * A_wet / (A_wet + A_dry)
|
||||
dU_liq_dt = tank._liquid_energy_rate(
|
||||
info, Q_liq_to_ull, Q_leak_liq
|
||||
)
|
||||
|
||||
dV_ull_dt = tank._ullage_volume_rate(
|
||||
info, tank.dm_liq_dt, dU_liq_dt
|
||||
)
|
||||
|
||||
y_next = y0.copy()
|
||||
dt = 1.0
|
||||
y_next[1] += dU_liq_dt * dt
|
||||
finite_difference = (
|
||||
tank.derive(y_next)['V_ull'] - info['V_ull']
|
||||
) / dt
|
||||
|
||||
assert dV_ull_dt < 0.0
|
||||
assert abs(dV_ull_dt - finite_difference) / abs(finite_difference) < 1e-5
|
||||
Reference in new issue
Block a user