calculator package¶
Submodules¶
calculator.isentropic module¶
- calculator.isentropic.isentropic_P_P0(P0=None, P=None, T0=None, T=None, Cp=None, R=None)¶
Solve for the missing variable in the isentropic relation:
P0 / P = (T0 / T)^(Cp / R)
Exactly one of P0, P, T0, T, Cp, or R must be None.
- Parameters:
P0 (float) – Total pressure (None if unknown)
P (float) – Static pressure (None if unknown)
T0 (float) – Total temperature (None if unknown)
T (float) – Static temperature (None if unknown)
Cp (float) – Specific heat at constant pressure (None if unknown)
R (float) – Specific gas constant (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if math errors occur.
- calculator.isentropic.isentropic_T_T0(T0=None, T=None, gamma=None, M=None)¶
Solve for the missing variable in the isentropic relation:
T0 / T = 1 + ((gamma - 1) / 2) * M^2
Exactly one of T0, T, gamma, or M must be None.
- Parameters:
T0 (float) – Total temperature (None if unknown)
T (float) – Static temperature (None if unknown)
gamma (float) – Specific heat ratio (None if unknown)
M (float) – Mach number (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if a math error occurs.
- calculator.isentropic.isentropic_mach_P_P0(M=None, P0=None, P=None)¶
Solve for the missing variable in the relation:
M = sqrt(5 * ((P0 / P)^(2/7) - 1))
Exactly one of M, P0, or P must be None.
- Parameters:
M (float) – Mach number (None if unknown)
P0 (float) – Total pressure (None if unknown)
P (float) – Static pressure (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if a math error occurs.
- calculator.isentropic.isentropic_mach_T_T0(M=None, T0=None, T=None)¶
Solve for the missing variable in the relation:
M = sqrt(5 * (T0 / T - 1))
Exactly one of M, T0, or T must be None.
- Parameters:
M (float) – Mach number (None if unknown)
T0 (float) – Total temperature (None if unknown)
T (float) – Static temperature (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if a math error occurs.
- calculator.isentropic.isentropic_mach_rho_rho0(M=None, rho0=None, rho=None)¶
Solve for the missing variable in the relation:
M = sqrt(5 * ((rho0 / rho)^(2/5) - 1))
Exactly one of M, rho0, or rho must be None.
- Parameters:
M (float) – Mach number (None if unknown)
rho0 (float) – Total density (None if unknown)
rho (float) – Static density (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if a math error occurs.
- calculator.isentropic.isentropic_rho_rho0(rho0=None, rho=None, T0=None, T=None, Cv=None, R=None)¶
Solve for the missing variable in the isentropic relation:
rho0 / rho = (T0 / T)^(Cv / R)
Exactly one of rho0, rho, T0, T, Cv, or R must be None.
- Parameters:
rho0 (float) – Total density (None if unknown)
rho (float) – Static density (None if unknown)
T0 (float) – Total temperature (None if unknown)
T (float) – Static temperature (None if unknown)
Cv (float) – Specific heat at constant volume (None if unknown)
R (float) – Specific gas constant (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if math errors occur.
- calculator.isentropic.main()¶
calculator.calc module¶
- calculator.calc.main()¶
calculator.general module¶
- calculator.general.Cp_P_T(P0=None, P=None, T0=None, T=None, Cp=None, R=None)¶
Solve for the missing variable in the relation:
(P0 / P) = (T0 / T)^(Cp / R)
Exactly one of P0, P, T0, T, Cp, or R must be None.
- Parameters:
P0 (float) – Total pressure (None if unknown)
P (float) – Static pressure (None if unknown)
T0 (float) – Total temperature (None if unknown)
T (float) – Static temperature (None if unknown)
Cp (float) – Specific heat at constant pressure (None if unknown)
R (float) – Specific gas constant (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if math errors occur.
- calculator.general.Cv_rho_T(rho0=None, rho=None, T0=None, T=None, Cv=None, R=None)¶
Solve for the missing variable in the relation:
(rho0 / rho) = (T0 / T)^(Cv / R)
Exactly one of rho0, rho, T0, T, Cv, or R must be None.
- Parameters:
rho0 (float) – Total density (None if unknown)
rho (float) – Static density (None if unknown)
T0 (float) – Total temperature (None if unknown)
T (float) – Static temperature (None if unknown)
Cv (float) – Specific heat at constant volume (None if unknown)
R (float) – Specific gas constant (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if math errors occur.
- calculator.general.bernoulli_eqn(P=None, P0=None, rho=None, U=None)¶
Solve for the missing variable in the relation:
P0 = P + 0.5 * rho * U^2
Exactly one of P, P0, rho, or U must be None.
- Parameters:
P (float) – Static Pressure (None if unknown)
P0 (float) – Total Pressure (None if unknown)
rho (float) – Static density (None if unknown)
U (float) – Flow velocity (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if a math error occurs.
- calculator.general.compute_entropies(Cp_metric, R_metric, T1, T2, P1, P2, s1_initial=0.0)¶
Compute the entropy at two states given the relation:
Δs = Cp_metric * ln(T2/T1) - R_metric * ln(P2/P1) s₂ = s₁ + Δs
- Parameters:
Cp_metric (float) – Specific heat at constant pressure (in consistent units).
R_metric (float) – Specific gas constant (in consistent units).
T1 (float) – Temperature at state 1 (must be positive).
T2 (float) – Temperature at state 2 (must be positive).
P1 (float) – Pressure at state 1 (must be positive).
P2 (float) – Pressure at state 2 (must be positive).
s1_initial (float, optional) – Reference entropy at state 1 (default is 0.0).
- Returns:
- A tuple (s1, s2) where:
s1 is the entropy at state 1 (s1_initial), s2 is the entropy at state 2.
- Return type:
tuple
- Raises:
ValueError – If any temperature or pressure is non-positive.
- calculator.general.mach_eqn(M=None, U=None, gamma=None, R=None, T=None)¶
Solve for the missing variable in the Mach relation:
M = U / sqrt(gamma * R * T)
Exactly one of M, U, gamma, R, or T must be None.
- Parameters:
M (float) – Mach number (None if unknown)
U (float) – Flow velocity (None if unknown)
gamma (float) – Specific heat ratio (None if unknown)
R (float) – Specific gas constant (None if unknown)
T (float) – Static temperature (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if a math error occurs.
- calculator.general.main()¶
- calculator.general.velocity_T0_T(U=None, Cp=None, T0=None, T=None)¶
Solve for the missing variable in the relation:
U^2 = 2 * Cp * (T0 - T)
Exactly one of U, Cp, T0, or T must be None.
- Parameters:
U (float) – Flow velocity (None if unknown)
Cp (float) – Specific heat at constant pressure (None if unknown)
T0 (float) – Total temperature (None if unknown)
T (float) – Static temperature (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if a math error occurs.
calculator.normal_shock module¶
- calculator.normal_shock.mach1_mach2(M1=None, M2=None)¶
Solve for the missing variable in the relation
M2^2 = (1 + ((gamma-1)/2) * M1^2) / (gamma * M1^2 - ((gamma-1)/2))
Exactly one of M1 or M2 must be None.
- Parameters:
M1 (float) – Mach number before the shock (None if unknown)
M2 (float) – Mach number after the shock (None if unknown)
- Returns:
The computed M2 (if M1 was provided) or computed M1 (if M2 was provided).
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None, if division by zero occurs, or if a math error occurs (e.g. negative value under a square root).
- calculator.normal_shock.main()¶
- calculator.normal_shock.normal_shock_P(M1=None, P1=None, P2=None, P2_P1_ratio=None)¶
Solve for the missing variable in the normal shock pressure relation:
P2 / P1 = (7*M1^2 - 1) / 6
The missing variable can be any one of M1, P1, P2, or the pressure ratio. The ratio may be provided explicitly via P2_P1_ratio.
- Parameters:
M1 (float) – Upstream Mach number (None if unknown)
P1 (float) – Upstream pressure (None if unknown)
P2 (float) – Downstream pressure (None if unknown)
P2_P1_ratio (float) – Pressure ratio (P2/P1) (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if the input combination is invalid or a math error occurs.
- calculator.normal_shock.normal_shock_P0(P1=None, P2=None, T1=None, T2=None, P01=None, P02=None, P2_P1_ratio=None, T1_T2_ratio=None, P02_P01_ratio=None)¶
Solve for the missing variable in the normal shock total pressure relation:
P02 / P01 = (P2 / P1) * (T1 / T2)^(7/2)
The missing variable can be any one of P1, P2, T1, T2, P01, or P02, or the corresponding ratio (static, temperature, or total pressure). The ratios may be provided explicitly via P2_P1_ratio, T1_T2_ratio, or P02_P01_ratio.
- Parameters:
P1 (float) – Upstream static pressure (None if unknown)
P2 (float) – Downstream static pressure (None if unknown)
T1 (float) – Upstream temperature (None if unknown)
T2 (float) – Downstream temperature (None if unknown)
P01 (float) – Upstream total pressure (None if unknown)
P02 (float) – Downstream total pressure (None if unknown)
P2_P1_ratio (float) – Static pressure ratio (P2/P1) (None if unknown)
T1_T2_ratio (float) – Temperature ratio (T1/T2) (None if unknown)
P02_P01_ratio (float) – Total pressure ratio (P02/P01) (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if the input combination is invalid or a math error occurs.
- calculator.normal_shock.normal_shock_T(M1=None, T1=None, T2=None, T2_T1_ratio=None)¶
Solve for the missing variable in the normal shock temperature relation:
T2 / T1 = ((7*M1^2 - 1) * (5 + M1^2)) / (36 * M1^2)
The missing variable can be any one of M1, T1, T2, or the temperature ratio. The ratio may be provided explicitly via T2_T1_ratio.
- Parameters:
M1 (float) – Upstream Mach number (None if unknown)
T1 (float) – Upstream temperature (None if unknown)
T2 (float) – Downstream temperature (None if unknown)
T2_T1_ratio (float) – Temperature ratio (T2/T1) (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if the input combination is invalid or a math error occurs.
- calculator.normal_shock.normal_shock_rho(M1=None, rho1=None, rho2=None, rho2_rho1_ratio=None)¶
Solve for the missing variable in the normal shock density relation:
rho2 / rho1 = (6 * M1^2) / (5 + M1^2)
The missing variable can be any one of M1, rho1, rho2, or the density ratio. The ratio may be provided explicitly via rho2_rho1_ratio.
- Parameters:
M1 (float) – Upstream Mach number (None if unknown)
rho1 (float) – Upstream density (None if unknown)
rho2 (float) – Downstream density (None if unknown)
rho2_rho1_ratio (float) – Density ratio (rho2/rho1) (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if the input combination is invalid or a math error occurs.
- calculator.normal_shock.pitot_tube(M=None, P1=None, P02=None)¶
Solve for the missing variable in the pitot tube relation:
P02 / P1 = (6^6 * M^7) / (5^(7/2) * (7*M^2 - 1)^(5/2))
Exactly one of M, P1, or P02 must be None.
- Parameters:
M (float) – Mach number (None if unknown)
P1 (float) – Static pressure (None if unknown)
P02 (float) – Pitot (total) pressure (None if unknown)
- Returns:
The computed value of the missing variable.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if a math error occurs.
calculator.oblique_shock module¶
- calculator.oblique_shock.M2_Mn2_relation(M2=None, Mn2=None, beta=None, theta=None)¶
Solve for the missing variable in the relation
M2 = Mn2 / sin(beta - theta)
Exactly one of M2, Mn2, beta, or theta must be None.
- Parameters:
M2 (float) – Downstream Mach number (None if unknown)
Mn2 (float) – Downstream normal Mach number (None if unknown)
beta (float) – Shock angle in degrees (None if unknown)
theta (float) – Flow deflection angle in degrees (None if unknown)
- Returns:
- The computed value of the missing variable. In the case of beta or theta,
the result is in degrees.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None, if a math error occurs, or if the computed value is non-physical.
- calculator.oblique_shock.mach_angle(angle=None, mach=None)¶
Solve for the missing variable in the relation
mu = asin(1 / M)
Exactly one of angle or mach must be None.
- Parameters:
angle (float) – Mach angle in degrees (None if unknown)
mach (float) – Mach number (None if unknown)
- Returns:
The computed mach angle (in degrees) or mach number.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if a math error occurs.
- calculator.oblique_shock.mach_beta_relation(Mn1=None, M1=None, beta=None)¶
Solve for the missing variable in the relation
Mn1 = M1 * sin(beta)
Exactly one of Mn1, M1, or beta must be None.
- Parameters:
Mn1 (float) – The normal component of Mach number (None if unknown)
M1 (float) – The free-stream Mach number (None if unknown)
beta (float) – The shock angle in degrees (None if unknown)
- Returns:
- The computed value of the missing variable. If beta is computed,
the result is in degrees.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if a math error occurs.
- calculator.oblique_shock.machn1_machn2_relation(Mn1=None, Mn2=None, gamma=None)¶
Solve for the missing variable in the relation
Mn2^2 = (1 + ((gamma - 1)/2) * Mn1^2) / (gamma * Mn1^2 - ((gamma - 1)/2))
Exactly one of Mn1, Mn2, or gamma must be None.
- Parameters:
Mn1 (float) – The upstream normal Mach number (None if unknown)
Mn2 (float) – The downstream normal Mach number (None if unknown)
gamma (float) – The specific heat ratio (None if unknown)
- Returns:
- The computed value of the missing variable. For Mn1 and Mn2,
the result is positive.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None, if a math error occurs, or if the computed value is non-physical.
- calculator.oblique_shock.main()¶
- calculator.oblique_shock.max_deflection_angle(M1=None, gamma=None, num_points=10000)¶
Determine the maximum flow deflection angle (theta_max) and its corresponding shock angle (beta_max) for a given upstream Mach number M1 and specific heat ratio gamma.
- Parameters:
M1 (float) – Upstream Mach number.
gamma (float) – Specific heat ratio (default is 1.4).
num_points (int) – Number of sample points for beta between the Mach angle and 90°.
- Returns:
- (theta_max, beta_max) in degrees, where theta_max is the maximum deflection
angle and beta_max is the shock angle corresponding to theta_max.
- Return type:
Tuple[float, float]
- calculator.oblique_shock.oblique_P2_P1(P1=None, P2=None, gamma=None, Mn1=None)¶
Solve for the missing variable in the relation
P2 / P1 = 1 + [2 * gamma / (gamma + 1)] * (Mn1^2 - 1)
Exactly one of P1, P2, gamma, or Mn1 must be None.
- Parameters:
P1 (float) – Upstream pressure (None if unknown)
P2 (float) – Downstream pressure (None if unknown)
gamma (float) – Specific heat ratio (None if unknown)
Mn1 (float) – Upstream normal Mach number (None if unknown)
- Returns:
- The computed value of the missing variable. For P1 or P2, the result is a pressure;
for Mn1, a Mach number; and for gamma, a dimensionless value.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None, if a math error occurs, or if the computed value is non-physical.
- calculator.oblique_shock.oblique_rho2_rho1(rho2=None, rho1=None, Mn1=None, gamma=None)¶
Solve for the missing variable in the relation
rho2 / rho1 = ((gamma + 1) * Mn1^2) / (2 + (gamma - 1) * Mn1^2)
Exactly one of rho2, rho1, Mn1, or gamma must be None.
- Parameters:
rho2 (float) – Downstream density (None if unknown)
rho1 (float) – Upstream density (None if unknown)
Mn1 (float) – Upstream normal Mach number (None if unknown)
gamma (float) – Specific heat ratio (None if unknown)
- Returns:
- The computed value of the missing variable. In the case of rho2 or rho1,
the result is a density; for Mn1, a Mach number; and for gamma, a dimensionless value.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None, if a math error occurs, or if the computed value is non-physical.
- calculator.oblique_shock.phi_beta_theta(phi=None, beta=None, theta=None)¶
Solve for the missing variable in the relation
phi = beta - theta
Exactly one of phi, beta, or theta must be None.
- Parameters:
phi (float) – The angle difference in degrees (None if unknown)
beta (float) – The shock angle in degrees (None if unknown)
theta (float) – The flow deflection angle in degrees (None if unknown)
- Returns:
The computed value of the missing variable in degrees.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if a math error occurs.
- calculator.oblique_shock.solve_beta(theta: float, M1: float, gamma: float, branch: str = 'weak') float¶
Solve for the shock angle beta using the theta-beta-Mach relation for the specified shock branch.
tan(theta) = 2 * cot(beta) * [(M1^2 * sin^2(beta) - 1) / (M1^2 * (gamma + cos(2*beta)) + 2)]
- Parameters:
theta (float) – Flow deflection angle in degrees.
M1 (float) – Free-stream Mach number.
gamma (float) – Specific heat ratio.
branch (str) – ‘weak’ for the weak shock solution or ‘strong’ for the strong shock solution.
- Returns:
Shock angle beta in degrees.
- Return type:
float
- Raises:
ValueError – if an invalid branch is provided or a math error occurs.
- calculator.oblique_shock.temperature_ratio(T1=None, T2=None, P1=None, P2=None, rho1=None, rho2=None, T_ratio=None, P_ratio=None, rho_ratio=None)¶
Solve for the missing variable in the relation
T2 / T1 = (P2 / P1) * (rho1 / rho2)
- The function may be used in two modes:
Ratio mode: If T_ratio, P_ratio, or rho_ratio is provided (non-None), the corresponding ratio is used and the individual temperatures, pressures, or densities are ignored.
Component mode: If both T1 and T2 (or both P1 and P2, or both rho1 and rho2) are provided, the corresponding ratio is computed.
If both the individual values are unknown (i.e. T1 and T2 for temperature, etc.), the function returns the computed ratio.
Exactly one of the three independent quantities (T_ratio, P_ratio, or rho_ratio) must be unknown (i.e. determined by the relation). The other two must be provided either directly or via their components.
- Parameters:
T1 (float) – Upstream temperature (None if unknown)
T2 (float) – Downstream temperature (None if unknown)
P1 (float) – Upstream pressure (None if unknown)
P2 (float) – Downstream pressure (None if unknown)
rho1 (float) – Upstream density (None if unknown)
rho2 (float) – Downstream density (None if unknown)
T_ratio (float) – Temperature ratio T2/T1 (None if unknown)
P_ratio (float) – Pressure ratio P2/P1 (None if unknown)
rho_ratio (float) – Density ratio rho1/rho2 (None if unknown)
- Returns:
- The computed missing ratio (T_ratio, P_ratio, or rho_ratio). In the case where T1 and T2 (or P1/P2 or rho1/rho2)
are both unknown, the function returns the computed ratio.
- Return type:
float
- Raises:
ValueError – if not exactly one independent ratio is unknown or if a math error occurs.
- calculator.oblique_shock.theta_beta_mach(theta=None, beta=None, M1=None, gamma=None)¶
Solve for the missing variable in the relation
tan(theta) = 2 * cot(beta) * [(M1^2 * sin^2(beta) - 1) / (M1^2 * (gamma + cos(2*beta)) + 2)]
Exactly one of theta, beta, M1, or gamma must be None.
- Parameters:
theta (float) – Flow deflection angle in degrees (None if unknown)
beta (float) – Shock angle in degrees (None if unknown)
M1 (float) – Free-stream Mach number (None if unknown)
gamma (float) – Specific heat ratio (None if unknown)
- Returns:
- The computed value of the missing variable. If theta or beta is computed,
the result is in degrees.
- Return type:
float
- Raises:
ValueError – if not exactly one variable is None or if a math error occurs.
calculator.prandtl_meyer module¶
- calculator.prandtl_meyer.expansion_P2_P1(gamma=None, M1=None, M2=None, P1=None, P2=None, P2_P1_ratio=None)¶
Solve the expansion pressure ratio relation
P2/P1 = [ (1 + [(gamma - 1) / 2] * M1^2) / (1 + [(gamma - 1) / 2] * M2^2) ]^(gamma/(gamma - 1))
- The function may be used in two modes:
Ratio mode: If P2_P1_ratio is provided (non-None), it is used and the individual pressures P1 and P2 are ignored.
Component mode: If both P1 and P2 are provided, the effective ratio is computed as P2/P1. In either case, if both P1 and P2 are unavailable, the function returns the computed ratio.
Exactly one of the four independent quantities (P2_P1_ratio (or P2/P1), gamma, M1, or M2) must be unknown. The other parameters must be provided.
- Parameters:
gamma (float) – Specific heat ratio (None if unknown)
M1 (float) – Upstream Mach number (None if unknown)
M2 (float) – Downstream Mach number (None if unknown)
P1 (float) – Upstream pressure (None if unknown)
P2 (float) – Downstream pressure (None if unknown)
P2_P1_ratio (float) – Pressure ratio P2/P1 (None if unknown)
- Returns:
- The computed missing variable. When P2_P1_ratio is solved for, the result is the ratio;
otherwise, the computed gamma, M1, or M2 is returned.
- Return type:
float
- Raises:
ValueError – if not exactly one variable among the effective P2/P1 ratio, gamma, M1, and M2 is None or if a math error occurs.
- calculator.prandtl_meyer.expansion_T2_T1(gamma=None, M1=None, M2=None, T1=None, T2=None, T2_T1_ratio=None)¶
Solve the expansion temperature ratio relation
T2/T1 = (1 + [(gamma - 1) / 2] * M1^2) / (1 + [(gamma - 1) / 2] * M2^2)
- The function may be used in two modes:
Ratio mode: If T2_T1_ratio is provided (non-None), it is used and the individual temperatures T1 and T2 are ignored.
Component mode: If both T1 and T2 are provided, the effective ratio is computed as T2/T1. In either case, if both T1 and T2 are unavailable, the function returns the computed ratio.
Exactly one of the four independent quantities (T2_T1_ratio (or T2/T1), gamma, M1, or M2) must be unknown. The other parameters must be provided.
- Parameters:
gamma (float) – Specific heat ratio (None if unknown)
M1 (float) – Upstream Mach number (None if unknown)
M2 (float) – Downstream Mach number (None if unknown)
T1 (float) – Upstream temperature (None if unknown)
T2 (float) – Downstream temperature (None if unknown)
T2_T1_ratio (float) – Temperature ratio T2/T1 (None if unknown)
- Returns:
- The computed missing variable. When T2_T1_ratio is solved for, the result is the ratio;
otherwise, the computed gamma, M1, or M2 is returned.
- Return type:
float
- Raises:
ValueError – if not exactly one independent variable among the effective temperature ratio, gamma, M1, and M2 is None or if a math error occurs.
- calculator.prandtl_meyer.main()¶
- calculator.prandtl_meyer.prandtl_meyer(gamma=None, mach=None)¶
Compute the Prandtl-Meyer function (in degrees) for a given Mach number and specific heat ratio (gamma).
The Prandtl-Meyer function is defined as:
ν(M) = sqrt((γ+1)/(γ-1)) * arctan( sqrt((γ-1)/(γ+1) * (M^2 - 1) ) ) - arctan( sqrt(M^2 - 1) )
- Parameters:
gamma (float) – Specific heat ratio (dimensionless). Must be greater than 1.
mach (float) – Mach number (dimensionless). Must be greater than or equal to 1.
- Returns:
Prandtl-Meyer angle in degrees.
- Return type:
float
- Raises:
ValueError – If gamma is not greater than 1 or if mach is less than 1.
- calculator.prandtl_meyer.prandtl_meyer_difference(M1=None, M2=None, gamma=None)¶
Compute the difference in Prandtl-Meyer angles (in degrees) between two Mach numbers.
The difference is calculated as:
θ = ν(M₂) - ν(M₁)
where ν(M) is the Prandtl-Meyer function evaluated at Mach number M.
- Parameters:
M1 (float) – The first Mach number (dimensionless), must be greater than or equal to 1.
M2 (float) – The second Mach number (dimensionless), must be greater than or equal to 1.
gamma (float) – Specific heat ratio (dimensionless). Default is 1.4.
- Returns:
Difference in Prandtl-Meyer angle (in degrees).
- Return type:
float
- Raises:
ValueError – If any of the Mach numbers or gamma do not meet the input requirements.
calculator.state module¶
- class calculator.state.State(T=None, T0=None, P=None, P0=None, rho=None, rho0=None, velocity=None, mach=None)¶
Bases:
object- solve_state_isentropic()¶
Solve for all state variables using isentropic relations
- Raises:
ValueError – if state is not solvable
- calculator.state.main()¶
calculator.utils module¶
- calculator.utils.atm2pa(pres_atm: float) float¶
- calculator.utils.deg2rad(angle_deg: float) float¶
- calculator.utils.k2r(temp_K: float) float¶
- calculator.utils.main()¶
- calculator.utils.pa2atm(pres_pa: float) float¶
- calculator.utils.r2k(temp_R: float) float¶
- calculator.utils.rad2deg(angle_rad: float) float¶