1"""Simple example: Tank Pressure โ Thrust"""
5from pathlib
import Path
7sys.path.insert(0, str(Path(__file__).parent.parent))
13config = load_config(str(Path(__file__).parent.parent /
"configs" /
"default.yaml"))
19print(
"PINTLE ENGINE PIPELINE: Tank Pressure โ Thrust")
21print(
"\nINPUT: Tank Pressures")
22print(
"OUTPUT: Chamber Pressure (SOLVED), Thrust, and all performance parameters")
26print(
"\n๐ Example 1: Single Point Evaluation")
32print(f
"Input Tank Pressures:")
33print(f
" P_tank_O = {P_tank_O/1e6:.2f} MPa")
34print(f
" P_tank_F = {P_tank_F/1e6:.2f} MPa")
37results = runner.evaluate(P_tank_O, P_tank_F)
39print(f
"\nSolved Results:")
40print(f
" Pc (SOLVED) = {results['Pc']/1e6:.2f} MPa")
41print(f
" MR = {results['MR']:.2f}")
42print(f
" แน_O = {results['mdot_O']:.3f} kg/s")
43print(f
" แน_F = {results['mdot_F']:.3f} kg/s")
44print(f
" c*_actual = {results['cstar_actual']:.0f} m/s")
45print(f
" Thrust = {results['F']/1000:.2f} kN")
46print(f
" Isp = {results['Isp']:.1f} s")
49print(
"\n๐ Example 2: Pressure Array (Sweep)")
53P_tank_O_sweep = np.array([4.0e6, 5.0e6, 6.0e6, 7.0e6])
54P_tank_F_sweep = np.array([3.6e6, 4.5e6, 5.4e6, 6.3e6])
56print(f
"Evaluating {len(P_tank_O_sweep)} different pressure combinations:")
57for i
in range(len(P_tank_O_sweep)):
58 print(f
" Point {i+1}: P_O={P_tank_O_sweep[i]/6894.76:.0f} psi, P_F={P_tank_F_sweep[i]/6894.76:.0f} psi")
60results_sweep = runner.evaluate(P_tank_O_sweep, P_tank_F_sweep)
62print(f
"\nResults for each pressure combination:")
63for i
in range(len(P_tank_O_sweep)):
64 print(f
" Point {i+1}:")
65 print(f
" Solved Pc = {results_sweep['Pc'][i]/6894.76:.0f} psi")
66 print(f
" Thrust = {results_sweep['F'][i]/1000:.2f} kN")
67 print(f
" MR = {results_sweep['MR'][i]:.2f}")
68 print(f
" Isp = {results_sweep['Isp'][i]:.1f} s")
71print(
"\n๐ Example 3: Time Series (Blowdown Simulation)")
74t = np.linspace(0, 10, 100)
76P_tank_O_ts = 6.0e6 * np.exp(-t / 5.0) + 1.0e6
77P_tank_F_ts = 5.5e6 * np.exp(-t / 5.0) + 1.0e6
79print(f
"Time series: {len(t)} points over {t[-1]:.1f} seconds")
80print(f
"Initial tank pressures: P_O={P_tank_O_ts[0]/6894.76:.0f} psi, P_F={P_tank_F_ts[0]/6894.76:.0f} psi")
81print(f
"Final tank pressures: P_O={P_tank_O_ts[-1]/6894.76:.0f} psi, P_F={P_tank_F_ts[-1]/6894.76:.0f} psi")
84results_ts = runner.evaluate_time_series(t, P_tank_O_ts, P_tank_F_ts)
86print(f
"\nSolved Results (time series):")
87print(f
" Initial Pc (SOLVED) = {results_ts['Pc'][0]/6894.76:.0f} psi")
88print(f
" Final Pc (SOLVED) = {results_ts['Pc'][-1]/6894.76:.0f} psi")
89print(f
" Initial Thrust = {results_ts['F'][0]/1000:.2f} kN")
90print(f
" Final Thrust = {results_ts['F'][-1]/1000:.2f} kN")
91print(f
" Initial Isp = {results_ts['Isp'][0]:.1f} s")
92print(f
" Final Isp = {results_ts['Isp'][-1]:.1f} s")
95print(
"โ
Pipeline correctly solves Pc from tank pressures!")