1"""Physics-based replacements for arbitrary multipliers.
3This module provides physics-based calculations to replace arbitrary factors
4and multipliers throughout the codebase.
7from __future__
import annotations
9from typing
import Dict, Optional
21 Calculate recirculation length based on physics.
24 - Recirculation length scales with chamber diameter
25 - Depends on Reynolds number (turbulent flow)
26 - Depends on velocity ratio (fuel/LOX)
27 - Typical: L_recirc = 0.2-0.4 * D_chamber for turbulent jets
34 Pintle tip diameter [m]
36 Fuel injection velocity [m/s]
38 LOX injection velocity [m/s]
40 Chamber Reynolds number
45 Recirculation length [m]
50 Re_factor = np.clip(Re_chamber / 1e5, 0.5, 2.0)
51 base_factor = 0.2 + 0.1 * np.log10(
max(Re_factor, 0.1))
54 velocity_ratio = fuel_velocity / (lox_velocity + 1e-10)
55 velocity_factor = 1.0 + 0.2 * np.clip(velocity_ratio - 1.0, 0.0, 2.0)
58 pintle_ratio = d_pintle_tip / (D_chamber + 1e-10)
59 pintle_factor = 1.0 + 0.3 * np.clip(pintle_ratio - 0.1, 0.0, 0.3)
61 L_recirc = base_factor * D_chamber * velocity_factor * pintle_factor
63 return float(np.clip(L_recirc, 0.1 * D_chamber, 0.5 * D_chamber))
67 evaporation_length: float,
68 chamber_length: float,
75 Calculate evaporation factor based on physics.
78 - If evaporation_length < chamber_length: good evaporation
79 - Factor based on d^2-law evaporation: t_evap ~ d^2 / K
80 - Accounts for incomplete evaporation when L_evap > L_chamber
84 evaporation_length : float
85 Evaporation length [m]
86 chamber_length : float
89 Sauter mean diameter [m]
95 Chamber temperature [K]
100 Evaporation factor (0-1, higher = better)
102 if chamber_length <= 0:
106 evap_ratio = evaporation_length / chamber_length
112 if evap_ratio <= 1.0:
114 evap_factor = 1.0 - 0.2 * evap_ratio
118 evap_factor = np.exp(-(evap_ratio - 1.0))
121 if SMD > 0
and target_smd > 0:
122 smd_penalty = (SMD / target_smd) ** 0.5
123 evap_factor = evap_factor / smd_penalty
125 return float(np.clip(evap_factor, 0.1, 1.0))
135 Calculate SMD factor based on physics.
138 - Smaller droplets → better mixing
139 - Factor based on mixing time: t_mix ~ d^2 / D
140 - Accounts for spray quality from Weber/Reynolds numbers
145 Actual Sauter mean diameter [m]
149 Injector Reynolds number
151 Injector Weber number
156 SMD factor (0-1, higher = better mixing)
158 if SMD <= 0
or target_smd <= 0:
161 we_factor = np.clip(We_injector / 15.0, 0.5, 2.0)
162 estimated_factor = 0.5 + 0.3 * np.log10(
max(we_factor, 0.1))
163 return float(np.clip(estimated_factor, 0.3, 0.9))
167 smd_ratio = SMD / target_smd
171 smd_factor = 1.0 / (1.0 + (smd_ratio - 1.0) ** 2)
173 return float(np.clip(smd_factor, 0.1, 1.0))
177 heat_flux_chamber: float,
186 Calculate throat heat flux using Bartz correlation (physics-based).
189 - Bartz correlation: q_throat / q_chamber = f(V, P, D)
190 - Accounts for velocity, pressure, and diameter effects
191 - No arbitrary multipliers
195 heat_flux_chamber : float
196 Chamber heat flux [W/m²]
198 Chamber pressure [Pa]
200 Chamber velocity [m/s]
202 Throat velocity [m/s] (sonic)
212 heat_flux_throat : float
213 Throat heat flux [W/m²]
215 if V_chamber <= 0
or V_throat <= 0:
216 return heat_flux_chamber * 1.3
222 velocity_ratio = V_throat / V_chamber
223 velocity_factor = velocity_ratio ** 0.8
226 P_throat = Pc * ((2.0 / (gamma + 1.0)) ** (gamma / (gamma - 1.0)))
227 pressure_ratio = P_throat / Pc
228 pressure_factor = pressure_ratio ** 0.2
231 diameter_ratio = D_chamber / (D_throat + 1e-10)
232 diameter_factor = diameter_ratio ** 0.1
235 heat_flux_ratio = velocity_factor * pressure_factor * diameter_factor
237 heat_flux_throat = heat_flux_chamber * heat_flux_ratio
239 return float(heat_flux_throat)
244 velocity_ratio: float,
249 Calculate turbulence enhancement at throat based on physics.
252 - Turbulence increases near throat due to:
253 1. Higher Reynolds number (sonic conditions)
254 2. Flow acceleration (velocity gradient)
255 3. Geometry change (diameter reduction)
260 Throat Reynolds number
261 velocity_ratio : float
271 Turbulence enhancement factor
274 Re_factor = np.clip(Re_throat / 1e5, 0.5, 2.0)
275 Re_enhancement = 1.0 + 0.15 * np.log10(
max(Re_factor, 0.1))
278 velocity_enhancement = 1.0 + 0.1 * (velocity_ratio - 1.0)
281 diameter_ratio = D_chamber / (D_throat + 1e-10)
282 geometry_enhancement = 1.0 + 0.05 * np.log10(
max(diameter_ratio, 1.0))
284 enhancement = Re_enhancement * velocity_enhancement * geometry_enhancement
286 return float(np.clip(enhancement, 1.0, 1.3))
290 heat_flux_local: float,
291 heat_flux_avg: float,
292 thermal_conductivity: float,
293 backface_temp_limit: float,
297 Calculate graphite thickness multiplier based on thermal requirements.
300 - Thickness needed to maintain backface temperature
301 - t ~ k × (T_surface - T_backface) / q
302 - Higher heat flux → thicker graphite needed
306 heat_flux_local : float
307 Local heat flux [W/m²]
308 heat_flux_avg : float
309 Average heat flux [W/m²]
310 thermal_conductivity : float
311 Graphite thermal conductivity [W/(m·K)]
312 backface_temp_limit : float
313 Maximum backface temperature [K]
315 Surface temperature [K]
320 Thickness multiplier (relative to average)
322 if heat_flux_avg <= 0:
327 delta_T = surface_temp - backface_temp_limit
333 heat_flux_ratio = heat_flux_local / heat_flux_avg
339 multiplier = 0.8 + 0.4 * np.clip(heat_flux_ratio - 0.5, 0.0, 2.0)
341 return float(np.clip(multiplier, 0.7, 1.8))
float calculate_throat_heat_flux_physics(float heat_flux_chamber, float Pc, float V_chamber, float V_throat, float gamma, float D_chamber, float D_throat)
float calculate_recirculation_length_physics(float D_chamber, float d_pintle_tip, float fuel_velocity, float lox_velocity, float Re_chamber)
float calculate_smd_factor_physics(float SMD, float target_smd, float Re_injector, float We_injector)
float calculate_turbulence_enhancement_physics(float Re_throat, float velocity_ratio, float D_chamber, float D_throat)
float calculate_evaporation_factor_physics(float evaporation_length, float chamber_length, float SMD, float target_smd, float Pc, float Tc)
float calculate_graphite_thickness_multiplier_physics(float heat_flux_local, float heat_flux_avg, float thermal_conductivity, float backface_temp_limit, float surface_temp)