core.compressible_flow¶
Compressible flow relations for convergent-divergent nozzle analysis.
- Isentropic flow — Critical pressure ratio, exit Mach from expansion ratio, exit pressure, choked-flow detection.
- Nozzle performance — Ideal and corrected thrust coefficient (Cf), optimal expansion ratio for a given altitude, thrust from Cf.
- Loss models — Percentage-based correction factors for divergent angle, finite-rate kinetics, boundary layer, and two-phase flow losses. These combine into an overall nozzle efficiency applied to the ideal Cf.
All loss functions return values in the 0–100% range and follow standard empirical correlations from Humble, Henry & Larson.
machwave.core.compressible_flow
¶
Compressible flow theory and analysis.
apply_thrust_coefficient_correction(ideal_thrust_coefficient, nozzle_correction_factor)
¶
Apply nozzle efficiency correction to thrust coefficient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ideal_thrust_coefficient
|
float
|
Ideal thrust coefficient. |
required |
nozzle_correction_factor
|
float
|
Nozzle efficiency (0-1). |
required |
Returns:
| Type | Description |
|---|---|
float
|
Corrected thrust coefficient. |
Source code in machwave/core/compressible_flow/nozzle.py
get_boundary_layer_loss_fraction(chamber_pressure_psi, throat_diameter_inch, expansion_ratio, time, c_1, c_2)
¶
Boundary layer loss accounts for the decrement in performance due to the viscous and heat transfer effects in the nozzle walls. It is time dependent.
Valid for liquid, solid, and hybrid propellants.
The time dependence is exponential due to the transient heat up, important in motors with short burn durations (less than 4 seconds). Dependence on expansion ratio represents the effect of a the amount of nozzle surface area.
Time constant C2 comes from analysis of a the transient heating of a BATES motor.
Time constant C1 was obtained from a direct measurement of the heat loss in a BATES motor, among other things.
Ordinary nozzle: C1 = 0.003650 C2 = 0.000937
Solid steel nozzle with relatively thick walls: C1 = 0.005060 C2 = 0.000000
The source AFRPL-TR-75-36 calculates it as a percentage, here it is converted to a fraction [0, 1].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chamber_pressure_psi
|
float
|
The chamber pressure [psi]. |
required |
throat_diameter_inch
|
float
|
The throat diameter [in]. |
required |
expansion_ratio
|
float
|
The expansion ratio of the nozzle. |
required |
time
|
float
|
The time in seconds [s]. |
required |
c_1
|
float
|
Coefficient for the boundary layer loss. |
required |
c_2
|
float
|
Coefficient for the boundary layer loss. |
required |
Returns: The boundary layer loss fraction in [0, 1].
Source code in machwave/core/compressible_flow/losses.py
get_critical_pressure_ratio(k)
¶
Get critical pressure ratio for choked flow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
float
|
Isentropic exponent. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Critical pressure ratio. |
get_exit_mach_from_expansion_ratio(k, expansion_ratio)
¶
Get exit Mach number from expansion ratio.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
float
|
Isentropic exponent. |
required |
expansion_ratio
|
float
|
Expansion ratio (A_exit / A_throat). |
required |
Returns:
| Type | Description |
|---|---|
float
|
Exit Mach number. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If solver fails to converge. |
Source code in machwave/core/compressible_flow/isentropic.py
get_exit_pressure(k_exhaust, expansion_ratio, chamber_pressure)
¶
Get exit pressure from isentropic relations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k_exhaust
|
float
|
Isentropic exponent at exit. |
required |
expansion_ratio
|
float
|
Expansion ratio. |
required |
chamber_pressure
|
float
|
Chamber pressure [Pa]. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Exit pressure [Pa]. |
Source code in machwave/core/compressible_flow/isentropic.py
get_expansion_ratio_from_exit_mach(mach, k)
¶
Get expansion ratio from exit Mach number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mach
|
float
|
Mach number. |
required |
k
|
float
|
Isentropic exponent. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Expansion ratio (A / A_throat). |
Source code in machwave/core/compressible_flow/isentropic.py
get_ideal_thrust_coefficient(chamber_pressure, exit_pressure, external_pressure, expansion_ratio, k_exhaust)
¶
Get ideal thrust coefficient for DeLaval nozzle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chamber_pressure
|
float
|
Chamber pressure [Pa]. |
required |
exit_pressure
|
float
|
Exit pressure [Pa]. |
required |
external_pressure
|
float
|
External pressure [Pa]. |
required |
expansion_ratio
|
float
|
Expansion ratio. |
required |
k_exhaust
|
float
|
Isentropic exponent at exit. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Ideal thrust coefficient. |
References
https://www.nakka-rocketry.net/th_thrst.html
Source code in machwave/core/compressible_flow/nozzle.py
get_kinetics_loss_fraction(i_sp_th_frozen, i_sp_th_shifting, chamber_pressure_psi)
¶
The kinetics loss accounts for the decrement in performance due to incomplete heat transfer of latent heat to sensible heat caused by the finite time required for the gas phase chemical reactions to occur.
Valid for liquid, solid, and hybrid propellants. The expansion ratio of the i_sp_th_frozen and i_sp_th_shifting should be the same.
Pressure correction is applied for chamber pressures above 1.379 MPa (200 psi), in order to dampen the effect of the kinetics loss.
The source AFRPL-TR-75-36 calculates it as a percentage, here it is converted to a fraction [0, 1].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_sp_th_frozen
|
float
|
The specific impulse of the frozen flow [s]. |
required |
i_sp_th_shifting
|
float
|
The specific impulse of the shifting flow [s]. |
required |
chamber_pressure_psi
|
float
|
The chamber pressure [psi]. |
required |
Returns: The kinetics loss fraction in [0, 1].
Source code in machwave/core/compressible_flow/losses.py
get_nozzle_divergent_loss_fraction(divergent_angle)
¶
Calculates the divergent nozzle loss fraction given the half angle. NOTE: only applicable for a conical convergent-divergent nozzle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
divergent_angle
|
float
|
The half angle of the divergent nozzle [degrees]. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The divergent loss fraction in [0, 1]. |
Source code in machwave/core/compressible_flow/losses.py
get_optimal_expansion_ratio(k, chamber_pressure, atmospheric_pressure)
¶
Get optimal expansion ratio for DeLaval nozzle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
float
|
Isentropic exponent. |
required |
chamber_pressure
|
float
|
Chamber pressure [Pa]. |
required |
atmospheric_pressure
|
float
|
External pressure [Pa]. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Optimal expansion ratio. |
Source code in machwave/core/compressible_flow/nozzle.py
get_overall_nozzle_efficiency(divergent_loss, kinetics_loss, boundary_layer_loss, two_phase_loss, other_losses)
¶
Calculates the overall nozzle efficiency by combining the loss fractions.
All inputs are loss fractions in [0, 1] (not percentages).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
divergent_loss
|
float
|
The divergent nozzle loss fraction. |
required |
kinetics_loss
|
float
|
The kinetics loss fraction. |
required |
boundary_layer_loss
|
float
|
The boundary layer loss fraction. |
required |
two_phase_loss
|
float
|
The two-phase flow loss fraction. |
required |
other_losses
|
float
|
Additional losses, as a fraction in [0, 1]. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The overall nozzle efficiency, as a fraction in [0, 1]. |
Source code in machwave/core/compressible_flow/losses.py
get_thrust_from_thrust_coefficient(thrust_coefficient, chamber_pressure, nozzle_throat_area)
¶
Get thrust from thrust coefficient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
thrust_coefficient
|
float
|
Thrust coefficient. |
required |
chamber_pressure
|
float
|
Chamber stagnation pressure [Pa]. |
required |
nozzle_throat_area
|
float
|
Nozzle throat area [m^2]. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Thrust [N]. |
Source code in machwave/core/compressible_flow/nozzle.py
get_two_phase_flow_loss_fraction(chamber_pressure_psi, mass_fraction_of_condensed_phase, expansion_ratio, throat_diameter_inch, characteristic_length_inch)
¶
Two-phase flow loss accounts for the decrement in performance due to the presence of a condensed phase in the combustion products.
Valid for solid, and hybrid propellants.
The source AFRPL-TR-75-36 calculates it as a percentage, here it is converted to a fraction [0, 1].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chamber_pressure_psi
|
float
|
The chamber pressure [psi]. |
required |
mass_fraction_of_condensed_phase
|
float
|
The mass fraction of the condensed phase. |
required |
expansion_ratio
|
float
|
The expansion ratio of the nozzle. |
required |
throat_diameter_inch
|
float
|
The throat diameter [in]. |
required |
characteristic_length_inch
|
float
|
The characteristic length [in]. |
required |
Returns: The two-phase flow loss fraction in [0, 1].
Source code in machwave/core/compressible_flow/losses.py
is_flow_choked(chamber_pressure, external_pressure, critical_pressure_ratio)
¶
Check if flow is choked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chamber_pressure
|
float
|
Chamber pressure [Pa]. |
required |
external_pressure
|
float
|
External pressure [Pa]. |
required |
critical_pressure_ratio
|
float
|
Critical pressure ratio. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if flow is choked, False otherwise. |