18 ag_o, ag_f = 1e-4, 8e-5
19 d1 = {
"Cd_O": 0.5,
"Cd_F": 0.6}
20 d2 = {
"Cd_O": 0.7,
"Cd_F": 0.6}
21 e1o, e1f, _ = effective_flow_areas_from_cd(d1, ag_o, ag_f)
22 e2o, e2f, _ = effective_flow_areas_from_cd(d2, ag_o, ag_f)
23 self.assertAlmostEqual(e2o / e1o, 0.7 / 0.5, places=7)
24 self.assertAlmostEqual(e2f, e1f, places=12)
27 ag_o, ag_f = 2e-4, 2e-4
28 eo, ef, w = effective_flow_areas_from_cd(
None, ag_o, ag_f)
29 self.assertEqual(eo, ag_o)
30 self.assertEqual(ef, ag_f)
31 self.assertIn(
"no_diagnostics", w)
32 eo2, ef2, w2 = effective_flow_areas_from_cd({}, ag_o, ag_f)
33 self.assertEqual(eo2, ag_o)
34 self.assertTrue(any(
"fallback_geometric" in x
for x
in w2))
37 cfg = load_config(str(ROOT /
"configs" /
"impinging_smoke.yaml"))
39 Po = cfg.lox_tank.initial_pressure_psi * 6894.76
40 Pf = cfg.fuel_tank.initial_pressure_psi * 6894.76
41 res = r.evaluate(Po, Pf, P_ambient=101325.0, silent=
True)
42 self.assertIn(
"Cd_O", res)
43 self.assertIn(
"Cd_F", res)
44 self.assertTrue(np.isfinite(res[
"Cd_O"])
and float(res[
"Cd_O"]) > 0)
45 self.assertTrue(np.isfinite(res[
"Cd_F"])
and float(res[
"Cd_F"]) > 0)
46 for k
in (
"A_geom_O",
"A_geom_F",
"A_eff_O",
"A_eff_F"):
48 self.assertTrue(np.isfinite(res[k]))
49 self.assertAlmostEqual(float(res[
"A_eff_O"]), float(res[
"Cd_O"]) * float(res[
"A_geom_O"]), places=6)
50 self.assertAlmostEqual(float(res[
"A_eff_F"]), float(res[
"Cd_F"]) * float(res[
"A_geom_F"]), places=6)
51 d = res.get(
"diagnostics")
or {}
52 self.assertAlmostEqual(float(res[
"Cd_O"]), float(d.get(
"Cd_O")), places=7)
53 diag_mr = d.get(
"momentum_ratio_R")
54 self.assertIsNotNone(diag_mr)
55 self.assertTrue(np.isfinite(diag_mr))
58 cfg = load_config(str(ROOT /
"configs" /
"impinging_smoke.yaml"))
60 P0o = cfg.lox_tank.initial_pressure_psi * 6894.76
61 P0f = cfg.fuel_tank.initial_pressure_psi * 6894.76
64 Pf = np.linspace(P0f * 0.85, P0f * 1.05, n)
65 out = r.evaluate_arrays(Po, Pf, P_ambient=101325.0)
66 md = out[
"mdot_total"]
67 self.assertEqual(len(md), n)
71 self.assertGreater(float(out[
"mdot_F"][-1]), float(out[
"mdot_F"][0]))
72 self.assertLess(float(out[
"MR"][-1]), float(out[
"MR"][0]))
73 self.assertNotAlmostEqual(float(md[-1]), float(md[0]), places=3)