Oblique / Prandtl-Meyer Flow Solver
- class pysagas.cfd.oblique_prandtl_meyer.OPM[source]
Oblique shock thoery and Prandtl-Meyer expansion theory flow solver.
This implementation uses oblique shock theory for flow-facing cell elements, and Prandtl-Meyer expansion theory for rearward-facing elements.
Extended Summary
Data attribute ‘method’ refers to which method was used for a particular cell, according to:
-1 : invalid / skipped (eg. 90 degree face)
0 : parallel face, do nothing
1 : Prandlt-Meyer
2 : normal shock
3 : oblique shock
- static _load_sens_data(sensitivity_filepath)[source]
Extracts design parameters from the sensitivity data.
- Parameters:
sensitivity_filepath (str)
- Return type:
Tuple[DataFrame, list[set]]
- static _solve_normal(M1, p1=1.0, T1=1.0, gamma=1.4)[source]
Solves the flow using normal shock theory.
- Parameters:
M1 (float) – The pre-shock Mach number.
p1 (float, optional) – The pre-shock pressure (Pa). The default is 1.0.
T1 (float, optional) – The pre-expansion temperature (K). The default is 1.0.
gamma (float, optional) – The ratio of specific heats. The default is 1.4.
- Returns:
M2 (float) – The post-shock Mach number.
p2 (float) – The post-shock pressure (Pa).
T2 (float) – The post-shock temperature (K).
- static _solve_oblique(theta, M1, p1=1.0, T1=1.0, gamma=1.4)[source]
Solves the flow using oblique shock theory.
- Parameters:
theta (float) – The flow deflection angle, specified in radians.
M1 (float) – The pre-shock Mach number.
p1 (float, optional) – The pre-shock pressure (Pa). The default is 1.0.
T1 (float, optional) – The pre-expansion temperature (K). The default is 1.0.
gamma (float, optional) – The ratio of specific heats. The default is 1.4.
- Returns:
M2 (float) – The post-shock Mach number.
p2 (float) – The post-shock pressure (Pa).
T2 (float) – The post-shock temperature (K).
- static _solve_pm(theta, M1, p1=1.0, T1=1.0, gamma=1.4)[source]
Solves for the Mach number, pressure and temperature after a Prandtl-Meyer expansion fan.
- Parameters:
theta (float) – The deflection angle, specified in radians.
M1 (float) – The pre-expansion Mach number.
p1 (float, optional) – The pre-expansion pressure (Pa). The default is 1.0.
T1 (float, optional) – The pre-expansion temperature (K). The default is 1.0.
gamma (float, optional) – The ratio of specific heats. The default is 1.4.
- Returns:
M2 (float) – The post-expansion Mach number.
p2 (float) – The post-expansion pressure (Pa).
T2 (float) – The post-expansion temperature (K).
- static beta_max(M, gamma=1.4)[source]
Returns the maximum shock angle for a given Mach number.
- Parameters:
M (float)
gamma (float)
- static dp_dtheta_obl(theta, M1, nominal_flowstate, p1=1.0, T1=1.0, gamma=1.4, perturbation=0.001)[source]
Solves for the sensitivities at the given point using oblique shock theory.
- Parameters:
theta (float) – The deflection angle, specified in radians.
M1 (float) – The pre-expansion Mach number.
nominal_flowstate (FlowState) – The nominal flowstate at this point.
p1 (float, optional) – The pre-expansion pressure (Pa). The default is 1.0.
T1 (float, optional) – The pre-expansion temperature (K). The default is 1.0.
gamma (float, optional) – The ratio of specific heats. The default is 1.4.
perturbation (float, optional) – The perturbation amount. Perturbations are calculated according to a multiple of (1 +/- perturbation). The default is 1e-3.
- Returns:
dM_dtheta (float) – The sensitivity of the post-expansion Mach number with respect to the deflection angle theta.
dP_dtheta (float) – The sensitivity of the post-expansion pressure (Pa) with respect to the deflection angle theta.
dT_dtheta (float) – The sensitivity of the post-expansion temperature (K) with respect to the deflection angle theta.
- static dp_dtheta_pm(theta, M1, nominal_flowstate, p1=1.0, T1=1.0, gamma=1.4, perturbation=0.001)[source]
Solves for the sensitivities at the given point using Prandtl-Meyer theory.
- Parameters:
theta (float) – The deflection angle, specified in radians.
M1 (float) – The pre-expansion Mach number.
nominal_flowstate (FlowState) – The nominal flowstate at this point.
p1 (float, optional) – The pre-expansion pressure (Pa). The default is 1.0.
T1 (float, optional) – The pre-expansion temperature (K). The default is 1.0.
gamma (float, optional) – The ratio of specific heats. The default is 1.4.
perturbation (float, optional) – The perturbation amount. Perturbations are calculated according to a multiple of (1 +/- perturbation). The default is 1e-3.
- Returns:
dM_dtheta (float) – The sensitivity of the post-expansion Mach number with respect to the deflection angle theta.
dP_dtheta (float) – The sensitivity of the post-expansion pressure (Pa) with respect to the deflection angle theta.
dT_dtheta (float) – The sensitivity of the post-expansion temperature (K) with respect to the deflection angle theta.
- static inv_pm(angle, gamma=1.4)[source]
Solves the inverse Prandtl-Meyer function using a bisection algorithm.
- Parameters:
angle (float)
gamma (float)
- static oblique_M2(M1, beta, theta, gamma=1.4)[source]
Calculates the Mach number following an oblique shock.
- Parameters:
M1 (float) – The pre-expansion Mach number.
beta (float) – The shock angle specified in radians.
theta (float) – The deflection angle, specified in radians.
gamma (float, optional) – The ratio of specific heats. The default is 1.4.
- Returns:
M2 – The post-shock Mach number.
- Return type:
float
References
Peter Jacobs
- static oblique_T2_T1(M1, beta, gamma=1.4)[source]
Returns the temperature ratio T2/T1 across an oblique shock.
- Parameters:
M1 (float) – The pre-shock Mach number.
beta (float) – The shock angle specified in radians.
gamma (float, optional) – The ratio of specific heats. The default is 1.4.
- Returns:
T2/T1 – The temperature ratio across the shock.
- Return type:
float
References
Peter Jacobs
- static oblique_beta(M1, theta, gamma=1.4, tolerance=1e-06)[source]
Calculates the oblique shock angle using a recursive algorithm.
- Parameters:
M1 (float) – The pre-shock Mach number.
theta (float) – The flow deflection angle, specified in radians.
gamma (float, optional) – The ratio of specific heats. The default is 1.4.
tolerance (float)
References
Peter Jacobs
- static oblique_p2_p1(M1, beta, gamma=1.4)[source]
Returns the pressure ratio p2/p1 across an oblique shock.
- Parameters:
M1 (float) – The pre-shock Mach number.
beta (float) – The shock angle specified in radians.
gamma (float)
- Returns:
p2/p1 – The pressure ratio across the shock.
- Return type:
float
References
Peter Jacobs
- static oblique_rho2_rho1(M1, beta, gamma=1.4)[source]
Returns the density ratio rho2/rho1 across an oblique shock.
- Parameters:
M1 (float) – The pre-shock Mach number.
beta (float) – The shock angle specified in radians.
gamma (float, optional) – The ratio of specific heats. The default is 1.4.
- Returns:
T2/T1 – The temperature ratio across the shock.
- Return type:
float
References
Peter Jacobs
- static pm(M, gamma=1.4)[source]
Solves the Prandtl-Meyer function and returns the Prandtl-Meyer angle in radians.
- Parameters:
M (float)
gamma (float)
- save(name)[source]
Save the solution to VTK file format. Note that the geometry mesh must have been loaded from a parser which includes connectivity information (eg. PyMesh or TRI).
- Parameters:
name (str) – The filename prefix of the desired output file.
attributes (Dict[str, list]) – The attributes dictionary used to initialise the file writer. Note that this is not required when calling solve from a child FlowSolver.
- solve(freestream=None, mach=None, aoa=None, cog=Vector(0, 0, 0))[source]
Run the flow solver.
- Parameters:
freestream (Flowstate, optional) – The free-stream flow state. The default is the freestream provided upon instantiation of the solver.
mach (float, optional) – The free-stream Mach number. The default is that specified in the freestream flow state.
aoa (float, optional) – The free-stream angle of attack. The default is that specified in the freestream flow state.
cog (Vector3)
- Returns:
result – The flow results.
- Return type:
:raises Exception : when no freestream can be found.:
- solve_sens(sensitivity_filepath=None, parameters=None, cells_have_sens_data=False, freestream=None, mach=None, aoa=None, cog=Vector(0, 0, 0), perturbation=0.001)[source]
Run the flow solver to obtain sensitivity information.
- Parameters:
freestream (Flowstate, optional) – The free-stream flow state. The default is the freestream provided upon instantiation of the solver.
Mach (float, optional) – The free-stream Mach number. The default is that specified in the freestream flow state.
aoa (float, optional) – The free-stream angle of attack. The default is that specified in the freestream flow state.
sensitivity_filepath (str | None)
parameters (list[str] | None)
cells_have_sens_data (bool | None)
mach (float | None)
cog (Vector3)
perturbation (float)
- Return type:
:raises Exception : when no freestream can be found.:
- static theta_from_beta(M1, beta, gamma=1.4)[source]
Calculates the flow deflection angle from the oblique shock angle.
- Parameters:
M1 (float) – The pre-expansion Mach number.
beta (float) – The shock angle specified in radians.
gamma (float, optional) – The ratio of specific heats. The default is 1.4.
- Returns:
theta – The deflection angle, specified in radians.
- Return type:
float
References
Peter Jacobs