57 """The reported Pe is the CEA expansion of the nozzle stagnation pressure the thrust uses."""
58 from engine.core.nozzle import calculate_thrust, contraction_ratio_of, nozzle_stagnation_loss
59 res = runner.evaluate(P_TANK, P_TANK, silent=
True)
60 cg = runner.config.chamber_geometry
61 kappa = nozzle_stagnation_loss(contraction_ratio_of(cg), res[
"gamma"])
62 ex = runner.cea_cache.aux.exit_state(res[
"MR"], res[
"Pc"] / kappa, cg.expansion_ratio)
63 assert res[
"P_exit"] == pytest.approx(ex[
"P_exit"], rel=1e-9)
65 t = calculate_thrust(res[
"Pc"], res[
"MR"], res[
"mdot_total"], runner.cea_cache, runner.config,
67 assert t[
"exit_to_ambient_ratio"] == pytest.approx(res[
"P_exit"] / res[
"P_ambient"], rel=1e-9)
70@pytest.mark.parametrize("CR, ceas", [(2.0, 1.051824), (3.0, 1.022720), (5.0, 1.008126)])
77 """At CR = 2 the throat sees Pc/1.0518: mdot c*_actual / At = Pc / kappa (was = Pc)."""
78 cfg = load_config(CFG)
79 At = cfg.chamber_geometry.A_throat
80 cfg.chamber_geometry.chamber_diameter = math.sqrt(4 * 2.0 * At / math.pi)
82 ratio = res[
"mdot_total"] * res[
"cstar_actual"] / At / res[
"Pc"]
84 assert 1.0 / ratio == pytest.approx(nozzle_stagnation_loss(2.0, res[
"gamma"]), rel=2e-3)
85 assert 1.0 / ratio > 1.04
90 Pc, MR, eps = 433.97 * PSI, 1.49930, 5.59852
91 at_site = c.eval(MR, Pc, 13.6437 * PSI, eps)
92 assert at_site[
"Cf_ideal"] == pytest.approx(1.50134, rel=5e-4)
93 vac = c.eval(MR, Pc, 0.0, eps)
94 assert vac[
"Cf_ideal"] == pytest.approx(vac[
"Cf_vac"], rel=1e-12)
105 """F = zeta Cf_vac P0 At - Pa Ae is what the runner delivers, so the sizing must depend on Pa
106 (it did not: vacuum and sea level gave the same throat)."""
108 cg = runner.config.chamber_geometry
109 kw = dict(pc_design=cg.design_pressure, thrust_design=cg.design_thrust, cea_cache=runner.cea_cache,
110 MR=cg.design_MR, diameter_inner=cg.chamber_diameter, diameter_exit=cg.exit_diameter,
111 l_star=cg.Lstar, nozzle_efficiency=cg.nozzle_efficiency)
112 At_site = solve_chamber_geometry_with_cea(Pa=94069.7, **kw)[3][
"final_A_throat"]
113 At_vac = solve_chamber_geometry_with_cea(Pa=0.0, **kw)[3][
"final_A_throat"]
114 assert (At_site - At_vac) / At_vac > 0.10