STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_gas_viscosity_units.py
Go to the documentation of this file.
1"""Huzel & Huang's combustion-gas viscosity fit, mu = 46.6e-10 M^0.5 T[R]^0.6, is in lbm/(in s).
2
3It was converted with the lbf s/in^2 factor (6894.76) instead of 17.858, which made the gas
4viscosity g_c = 386x too high and the Bartz convective coefficient ~117x too low -- the
5long-standing "ablative convection ~283x low". Checked against NASA CEA transport properties,
6not against the code.
7"""
8import math
9
10import pytest
11
12from engine.pipeline.constants import LBM_PER_IN_S_TO_PA_S
13
14
16 assert LBM_PER_IN_S_TO_PA_S == pytest.approx(0.45359237 / 0.0254, rel=1e-12)
17 assert LBM_PER_IN_S_TO_PA_S == pytest.approx(17.857967, rel=1e-6)
18
19
20@pytest.mark.parametrize("T, M, mu_cea", [
21 # LOX/ethanol, O/F 1.5, Pc 434 psia chamber: CEA frozen transport 1.04e-4 Pa s
22 (3226.0, 22.25, 1.04e-4),
23])
25 from engine.pipeline.thermal.regen_cooling import calculate_gas_viscosity_huzel
26 mu = calculate_gas_viscosity_huzel(T, M)
27 # Huzel's fit is an approximation; within a factor 1.6 of CEA. The wrong unit gave 264x.
28 assert mu_cea / 1.6 < mu < mu_cea * 1.6
29 assert mu == pytest.approx(46.6e-10 * math.sqrt(M) * (T * 1.8) ** 0.6 * 17.857967, rel=1e-6)
30
31
33 from engine.pipeline.thermal.regen_cooling import calculate_gas_viscosity_huzel
34 from engine.accel.chamber import _huzel_mu as _gas_viscosity_huzel # the spray march film
35 T, M = 3226.0, 22.25
36 assert _gas_viscosity_huzel(T, M) == pytest.approx(calculate_gas_viscosity_huzel(T, M), rel=1e-12)
37 src = open("engine/pipeline/thermal/ablative_cooling.py").read()
38 assert "6894.76" not in src, "ablative_cooling.py converts the Huzel fit with the lbf factor again"
test_huzel_viscosity_is_the_right_order_against_cea(T, M, mu_cea)
static double read(int32_t code)