API reference

This page defines the application–program interface for the compflow module. The nomenclature section sets out the names and symbols for the quantites calculated by the code, then the main functions are listed in three categories. First, evaluation of a non-dimensional group given Mach number; second, the reverse operation of finding the Mach number that corresponds to the value of another quantity; and third, evaluation of derivatives with respect to Mach number. This page concludes with a description of the lookup table function.

Note

The library makes minimal attempts to validate input data, in the interests of speed. So, for example, feeding most functions a negative Mach number will silently produce bogus results. If this is not what you want, validate your own data before calling the library.

Nomenclature

The code deals in the following non-dimensional groups:

Non-dimensional group

Mathematical symbol

Variable name

Mach number

\(\Ma\)

Ma

Ratio of specific heats

\(\gamma = \dfrac{c_p}{c_v}\)

ga

Stagnation temperature ratio

\(\dfrac{T_0}{T}\)

To_T

Stagnation pressure ratio

\(\dfrac{p_0}{p}\)

Po_P

Stagnation density ratio

\(\dfrac{\rho_0}{\rho}\)

rhoo_rho

Normalised velocity

\(\dfrac{V}{\sqrt{c_pT_0}}\)

V_cpTo

Impulse function

\(\dfrac{F}{\dot{m}\sqrt{c_pT_0}}\)

F_mcpTo

Normalised mass flow (or flow function)

\(\dfrac{\dot{m}\sqrt{c_pT_0}}{Ap_0}\)

mcpTo_APo

Static normalised mass flow

\(\dfrac{\dot{m}\sqrt{c_pT_0}}{Ap}\)

mcpTo_AP

Area to choking area ratio

\(\dfrac{A}{A_*}\)

A_Acrit

Post-shock Mach number

\(\Ma_\mathrm{sh}\)

Mash

Shock stagnation pressure ratio

\(\dfrac{p_{0\mathrm{sh}}}{p_0}\)

Posh_Po

The following dimensional quantities are used in the definitions:

Symbol

Dimensional quantity

\(A\)

Flow area

\(A_*\)

Choking flow area

\(c_p\)

Specific heat capacity at constant pressure

\(c_v\)

Specific heat capacity at constant volume

\(F\)

Impulse

\(\dot{m}\)

Mass flow rate

\(p\)

Static pressure

\(p_0\)

Stagnation pressure

\(\rho\)

Static density

\(\rho_0\)

Stagnation density

\(T\)

Static temperature

\(T_0\)

Stagnation temperature

\(V\)

Velocity

Evaluation from Mach number

compflow.To_T_from_Ma(Ma, ga)

Stagnation temperature ratio as function of Mach number.

compflow.Po_P_from_Ma(Ma, ga)

Stagnation pressure ratio as function of Mach number.

compflow.rhoo_rho_from_Ma(Ma, ga)

Stagnation density ratio as function of Mach number.

compflow.V_cpTo_from_Ma(Ma, ga)

Normalised velocity as function of Mach number.

compflow.mcpTo_APo_from_Ma(Ma, ga)

Normalised mass flow as function of Mach number.

compflow.mcpTo_AP_from_Ma(Ma, ga)

Static normalised mass flow as function of Mach number.

compflow.F_mcpTo_from_Ma(Ma, ga)

Impulse function as a function of Mach number.

compflow.A_Acrit_from_Ma(Ma, ga)

Ratio of area to choking area as function of Mach number.

compflow.Mash_from_Ma(Ma, ga)

Post-shock Mach number as function of Mach number.

compflow.Posh_Po_from_Ma(Ma, ga)

Shock stagnation pressure ratio as function of Mach number.

compflow.To_T_from_Ma(Ma, ga)

Stagnation temperature ratio as function of Mach number.

\[\frac{T_0}{T} = 1 + \frac{\gamma - 1}{2} \Ma^2\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

To_T – Stagnation temperature ratio, \(T_0/T\).

Return type

array

compflow.Po_P_from_Ma(Ma, ga)

Stagnation pressure ratio as function of Mach number.

\[\frac{p_0}{p} = \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) ^\tfrac{\gamma}{\gamma - 1}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

Po_P – Stagnation pressure ratio, \(p_0/p\).

Return type

array

compflow.rhoo_rho_from_Ma(Ma, ga)

Stagnation density ratio as function of Mach number.

\[\frac{\rho_0}{\rho} = \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) ^\tfrac{1}{\gamma - 1}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

rhoo_rho – Stagnation density ratio, \(\rho_0/\rho\).

Return type

array

compflow.V_cpTo_from_Ma(Ma, ga)

Normalised velocity as function of Mach number.

\[\frac{V}{\sqrt{c_p T_0}} = \sqrt{\gamma -1}\, \Ma \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right)^{-\tfrac{1}{2}}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

V_cpTo – Normalised velocity, \(V/\sqrt{c_p T_0}\).

Return type

array

compflow.F_mcpTo_from_Ma(Ma, ga)

Impulse function as a function of Mach number.

\[\frac{F}{\dot{m}\sqrt{c_p T_0}} = \frac{\sqrt{\gamma -1}}{\gamma}\, \frac{1 + \gamma \Ma^2}{\Ma} \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) ^{-\tfrac{1}{2}}\]

where

\[F = (p + \rho V^2)A\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

F_mcpTo – Impulse function, \({F/\dot{m}\sqrt{c_p T_0}}\).

Return type

array

compflow.mcpTo_APo_from_Ma(Ma, ga)

Normalised mass flow as function of Mach number.

\[\frac{\dot{m}\sqrt{c_p T_0}}{A p_0} = \frac{\gamma}{\sqrt{\gamma -1}}\, \Ma \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) ^{-\tfrac{1}{2}\tfrac{\gamma + 1}{\gamma - 1}}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

mcpTo_APo – Normalised mass flow, \({\dot{m}\sqrt{c_p T_0}}/{A p_0}\).

Return type

array

compflow.mcpTo_AP_from_Ma(Ma, ga)

Static normalised mass flow as function of Mach number.

\[\frac{\dot{m}\sqrt{c_p T_0}}{A p} = \frac{\gamma}{\sqrt{\gamma -1}}\, \Ma \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) ^{\tfrac{1}{2}}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

mcpTo_AP – Static pressure variant of normalised mass flow, \({\dot{m}\sqrt{c_p T_0}}/{A p}\).

Return type

array

compflow.A_Acrit_from_Ma(Ma, ga)

Ratio of area to choking area as function of Mach number.

\[\frac{A}{A_*} = \frac{1}{\Ma}\left[\frac{2}{\gamma +1} \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right)\right] ^{\tfrac{1}{2}\tfrac{\gamma + 1}{\gamma - 1}}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

A_Acrit – Ratio of area to choking area, \(A/A_*\).

Return type

array

compflow.Mash_from_Ma(Ma, ga)

Post-shock Mach number as function of Mach number.

\[\Ma_\mathrm{sh} = \left(\frac{1 + \frac{\gamma - 1}{2} \Ma^2} {\gamma \Ma^2 - \frac{\gamma - 1}{2}} \right)^{\tfrac{1}{2}}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

Mash – Post-shock Mach number, \(\Ma_\mathrm{sh}\).

Return type

array

compflow.Posh_Po_from_Ma(Ma, ga)

Shock stagnation pressure ratio as function of Mach number.

\[\frac{p_{0\mathrm{sh}}}{p_0} = \left( \frac{\frac{\gamma + 1}{2}\Ma^2}{1 + \frac{\gamma - 1}{2} \Ma^2} \right)^{\tfrac{\gamma}{\gamma-1}} \left( \frac{2 \gamma }{\gamma + 1} \Ma^2 - \frac{\gamma - 1}{\gamma + 1} \right)^{\tfrac{-1}{\gamma -1}}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

Posh_Po – Shock stagnation pressure ratio, \(p_{0\mathrm{sh}}/p_0\).

Return type

array

Inversion to Mach number

compflow.Ma_from_To_T(To_T, ga)

Mach number as function of stagnation temperature ratio.

compflow.Ma_from_Po_P(Po_P, ga)

Mach number as function of stagnation pressure ratio.

compflow.Ma_from_rhoo_rho(rhoo_rho, ga)

Mach number as function of stagnation density ratio.

compflow.Ma_from_V_cpTo(V_cpTo, ga)

Mach number as function of normalised velocity.

compflow.Ma_from_F_mcpTo(F_mcpTo, ga[, sup])

Mach number as function of impulse function.

compflow.Ma_from_mcpTo_APo(mcpTo_APo, ga[, sup])

Mach number as function of normalised mass flow.

compflow.Ma_from_mcpTo_AP(mcpTo_AP, ga)

Mach number as function of static normalised mass flow.

compflow.Ma_from_A_Acrit(A_Acrit, ga[, sup])

Mach number as function of area to choking area ratio.

compflow.Ma_from_Mash(Mash, ga)

Mach number as function of post-shock Mach number.

compflow.Ma_from_Posh_Po(Posh_Po, ga)

Mach number as function of shock stagnation pressure ratio.

compflow.Ma_from_To_T(To_T, ga)

Mach number as function of stagnation temperature ratio.

The inverse of compflow.To_T_from_Ma(), which permits a direct analytical solution.

\[\Ma = \sqrt{\frac{2}{\gamma - 1} \left[\frac{T_0}{T} - 1\right]}\]

Returns NaN if input data is not physically possible, where \({T_0}/{T}<1\).

Parameters
  • To_T (array) – Stagnation temperature ratio, \(T_0/T\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

Ma – Mach number, \(\Ma\).

Return type

array

compflow.Ma_from_Po_P(Po_P, ga)

Mach number as function of stagnation pressure ratio.

The inverse of compflow.Po_P_from_Ma(), which permits a direct analytical solution.

\[\Ma = \sqrt{ \frac{2}{\gamma - 1}\left[\left(\frac{p_0}{p}\right) ^\tfrac{\gamma - 1}{\gamma} - 1\right]}\]

Returns NaN if input data is not physically possible, where \({p_0}/{p}<1\).

Parameters
  • Po_P (array) – Stagnation pressure ratio, \(p_0/p\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

Ma – Mach number, \(\Ma\).

Return type

array

compflow.Ma_from_rhoo_rho(rhoo_rho, ga)

Mach number as function of stagnation density ratio.

The inverse of compflow.rhoo_rho_from_Ma(), which permits a direct analytical solution.

\[\Ma = \sqrt{ \frac{2}{\gamma - 1}\left[\left(\frac{\rho_0}{\rho}\right) ^{\gamma - 1} - 1\right]}\]

Returns NaN if input data is not physically possible, where \({\rho_0}/{\rho}<1\).

Parameters
  • rhoo_rho (array) – Stagnation density ratio, \(\rho_0/\rho\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

Ma – Mach number, \(\Ma\).

Return type

array

compflow.Ma_from_V_cpTo(V_cpTo, ga)

Mach number as function of normalised velocity.

Inverse of compflow.V_cpTo_from_Ma(), which permits a direct analytical solution.

\[\Ma = \sqrt{\frac{1}{\gamma-1}\left[ \frac{\left(\frac{V}{\sqrt{c_p T_0}}\right)^2} {1 - \frac{1}{2}\left(\frac{V}{\sqrt{c_p T_0}}\right)^2} \right]}\]

Returns NaN if input data is not physically possible, where \(V/\sqrt{c_pT_0} < 0\) or \(V/\sqrt{c_pT_0} > \sqrt{2}\).

Parameters
  • V_cpTo (array) – Normalised velocity, \(V/\sqrt{c_p T_0}\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

Ma – Mach number, \(\Ma\).

Return type

array

compflow.Ma_from_F_mcpTo(F_mcpTo, ga, sup=False)

Mach number as function of impulse function.

The inverse of compflow.F_mcpTo_from_Ma(), which at a given value of \(F/{\dot{m}\sqrt{c_p T_0}}\) must be solved iteratively for \(\Ma\) using Newton’s method.

\[\frac{F}{\dot{m}\sqrt{c_p T_0}} = \frac{\sqrt{\gamma -1}}{\gamma}\, \frac{1 + \gamma \Ma^2}{\Ma} \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) ^{-\tfrac{1}{2}}\]

The impulse function reaches a minimum at the sonic velocity \(\Ma=1\). This means that for some values of \(F/\dot{m}\sqrt{c_p T_0}\), there are two possible solutions. Return the subsonic solution with \(\Ma\le 1\) by default; the supersonic solution with \(\Ma>1\) is retrived by setting the parameter sup=True. Return NaN for input data below the mimimum value.

Parameters
  • F_mcpTo (array) – Impulse function, \(F/\dot{m}\sqrt{c_p T_0}\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

  • sup (bool, default False) – If true, return the supersonic solution, otherwise the subsonic solution.

Returns

Ma – Mach number, \(\Ma\).

Return type

array

compflow.Ma_from_mcpTo_APo(mcpTo_APo, ga, sup=False)

Mach number as function of normalised mass flow.

The inverse of compflow.mcpTo_APo_from_Ma(), which at a given value of \({\dot{m}\sqrt{c_p T_0}}/{A p_0}\) must be solved iteratively for \(\Ma\) using Newton’s method.

\[\frac{\dot{m}\sqrt{c_p T_0}}{A p_0} = \frac{\gamma}{\sqrt{\gamma -1}}\, \Ma \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) ^{-\tfrac{1}{2}\tfrac{\gamma + 1}{\gamma - 1}}\]

For each \({\dot{m}\sqrt{c_p T_0}}/{A p_0}\), there are two possible values of \(\Ma\). Return the subsonic solution with \(\Ma\le 1\) by default; the supersonic solution with \(\Ma>1\) is retrived by setting the parameter sup=True.

Returns NaN if input data is not physically possible, where \({\dot{m}\sqrt{c_p T_0}}/{A p_0} < 0\). The normalised mass flow reaches a maximum at the sonic velocity \(\Ma=1\). Input data above the maximum value correspond to choking — also return NaN in this case.

Parameters
  • mcpTo_APo (array) – Normalised mass flow, \({\dot{m}\sqrt{c_p T_0}}/{A p_0}\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

  • sup (bool, default False) – If true, return the supersonic solution, otherwise the subsonic solution.

Returns

Ma – Mach number, \(\Ma\).

Return type

array

compflow.Ma_from_mcpTo_AP(mcpTo_AP, ga)

Mach number as function of static normalised mass flow.

The inverse of compflow.mcpTo_AP_from_Ma(), which at a given value of \({\dot{m}\sqrt{c_p T_0}}/{A p}\) must be solved iteratively for \(\Ma\) using Newton’s method.

\[\frac{\dot{m}\sqrt{c_p T_0}}{A p} = \frac{\gamma}{\sqrt{\gamma -1}}\, \Ma \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) ^{\tfrac{1}{2}}\]

Returns NaN if input data is not physically possible, where \({\dot{m}\sqrt{c_p T_0}}/{A p} < 0\).

Parameters
  • mcpTo_AP (array) – Static normalised mass flow, \({\dot{m}\sqrt{c_p T_0}}/{A p}\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

Ma – Mach number, \(\Ma\).

Return type

array

compflow.Ma_from_A_Acrit(A_Acrit, ga, sup=False)

Mach number as function of area to choking area ratio.

The inverse of compflow.A_Acrit_from_Ma(), which at a given value of \(A/A_*\) must be solved iteratively for \(\Ma\) using Newton’s method.

\[\frac{A}{A_*} = \frac{1}{\Ma}\left[ \frac{2}{\gamma +1} \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) \right]^{\tfrac{1}{2}\tfrac{\gamma + 1}{\gamma - 1}}\]

Returns NaN if input data is not physically possible, where \(A/A_* < 1\).

Parameters
  • A_Acrit (array) – Ratio of area to choking area, \(A/A_*\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

  • sup (bool, default False) – If true, return the supersonic solution, otherwise the subsonic solution.

Returns

Ma – Mach number, \(\Ma\).

Return type

array

compflow.Ma_from_Mash(Mash, ga)

Mach number as function of post-shock Mach number.

The inverse of compflow.Mash_from_Ma(), which at a given value of \(\Ma_\mathrm{sh}\) must be solved iteratively for \(\Ma\) using Newton’s method.

\[\Ma_\mathrm{sh} = \left( \frac{1 + \frac{\gamma - 1}{2} \Ma^2} {\gamma \Ma^2 - \frac{\gamma - 1}{2}} \right)^{\tfrac{1}{2}}\]

Returns NaN if input data is not physically possible, where \(\Ma_\mathrm{sh}>1\) or \(\Ma_\mathrm{sh}<0\).

Parameters
  • Mash (array) – Post-shock Mach number, \(\Ma_\mathrm{sh}\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

Ma – Mach number, \(\Ma\).

Return type

array

compflow.Ma_from_Posh_Po(Posh_Po, ga)

Mach number as function of shock stagnation pressure ratio.

The inverse of compflow.Posh_Po_from_Ma(), which at a given value of \(p_{0\mathrm{sh}}/p_0\) must be solved iteratively for \(\Ma\) using Newton’s method.

\[\frac{p_{0\mathrm{sh}}}{p_0} = \left(\frac{\frac{\gamma+1}{2}\Ma^2}{1+\frac{\gamma-1}{2}\Ma^2}\right) ^{\tfrac{\gamma}{\gamma-1}} \left(\frac{2\gamma}{\gamma+1}\Ma^2-\frac{\gamma-1}{\gamma+1}\right) ^{\tfrac{-1}{\gamma -1}}\]

Returns NaN if input data is not physically possible, where \(p_{0\mathrm{sh}}/p_0 > 1\) or \(p_{0\mathrm{sh}}/p_0 < 0\).

Parameters
  • Posh_Po (array) – Shock stagnation pressure ratio, \(p_{0\mathrm{sh}}/p_0\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

Ma – Mach number, \(\Ma\).

Return type

array

Derivatives with respect to Mach number

compflow.der_To_T_from_Ma(Ma, ga)

Derivative of stagnation temperature ratio by Mach number.

compflow.der_Po_P_from_Ma(Ma, ga)

Derivative of stagnation pressure ratio by Mach number.

compflow.der_rhoo_rho_from_Ma(Ma, ga)

Derivative of stagnation density ratio by Mach number.

compflow.der_V_cpTo_from_Ma(Ma, ga)

Derivative of normalised velocity by Mach number.

compflow.der_F_mcpTo_from_Ma(Ma, ga)

Derivative of impulse function by Mach number.

compflow.der_mcpTo_APo_from_Ma(Ma, ga)

Derivative of normalised mass flow by Mach number.

compflow.der_mcpTo_AP_from_Ma(Ma, ga)

Derivative of static normalised mass flow by Mach number.

compflow.der_A_Acrit_from_Ma(Ma, ga)

Derivative of choking area ratio by Mach number.

compflow.der_Mash_from_Ma(Ma, ga)

Derivative of post-shock Mach number by Mach number.

compflow.der_Posh_Po_from_Ma(Ma, ga)

Derivative of shock pressure ratio by Mach number.

compflow.der_To_T_from_Ma(Ma, ga)

Derivative of stagnation temperature ratio by Mach number.

The derivative of compflow.To_T_from_Ma() with respect to Mach number.

\[\frac{\D}{\D\Ma}\left(\frac{T_0}{T}\right) = \left(\gamma - 1\right)\Ma\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

der_To_T – Derivative of stagnation temperature ratio, \(\DMa(T_0/T)\).

Return type

array

compflow.der_Po_P_from_Ma(Ma, ga)

Derivative of stagnation pressure ratio by Mach number.

The derivative of compflow.Po_P_from_Ma() with respect to Mach number.

\[\DMa\left(\frac{p_0}{p}\right) = \gamma \Ma \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) ^\tfrac{1}{\gamma - 1}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

der_Po_P – Derivative of stagnation pressure ratio, \(\DMa(p_0/p)\).

Return type

array

compflow.der_rhoo_rho_from_Ma(Ma, ga)

Derivative of stagnation density ratio by Mach number.

The derivative of compflow.rhoo_rho_from_Ma() with respect to Mach number.

\[\DMa\left(\frac{\rho_0}{\rho}\right) = \Ma\left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) ^\tfrac{-1}{\gamma - 1}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

der_rhoo_rho – Derivative of stagnation density ratio, \(\DMa(\rho_0/\rho)\).

Return type

array

compflow.der_V_cpTo_from_Ma(Ma, ga)

Derivative of normalised velocity by Mach number.

The derivative of compflow.V_cpTo_from_Ma() with respect to Mach number.

\[\DMa\left(\frac{V}{\sqrt{c_p T_0}}\right) = {\sqrt{\gamma -1}} \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right)^{-\tfrac{3}{2}}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

der_V_cpTo – Derivative of normalised velocity, \(\DMa(V/\sqrt{c_p T_0})\).

Return type

array

compflow.der_F_mcpTo_from_Ma(Ma, ga)

Derivative of impulse function by Mach number.

The derivative of compflow.F_mcpTo_from_Ma() with respect to Mach number.

\[\DMa\left(\frac{F}{\dot{m}\sqrt{c_p T_0}} \right)= \frac{\sqrt{\gamma -1}}{\gamma}\, \frac{1 + \gamma \Ma^2}{\Ma^2} \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) ^{-\tfrac{3}{2}}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

der_F_mcpTo – Derivative of impulse function, \(\DMa(F/{\dot{m}\sqrt{c_p T_0}})\).

Return type

array

compflow.der_mcpTo_APo_from_Ma(Ma, ga)

Derivative of normalised mass flow by Mach number.

The derivative of compflow.mcpTo_APo_from_Ma() with respect to Mach number.

\[\DMa\left(\frac{\dot{m}\sqrt{c_p T_0}}{A p_0} \right)= \frac{\gamma}{\sqrt{\gamma -1}} \left(1 - \frac{\frac{\gamma + 1}{2} \Ma^2} {1 + \frac{\gamma - 1}{2} \Ma^2 } \right) \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right) ^{-\tfrac{1}{2}\tfrac{\gamma + 1}{\gamma - 1}}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

der_mcpTo_APo – Derivative of normalised mass flow, \(\DMa({\dot{m}\sqrt{c_pT_0}}/{Ap_0})\).

Return type

array

compflow.der_mcpTo_AP_from_Ma(Ma, ga)

Derivative of static normalised mass flow by Mach number.

The derivative of compflow.mcpTo_AP_from_Ma() with respect to Mach number.

\[\DMa\left(\frac{\dot{m}\sqrt{c_p T_0}}{A p} \right)= \frac{\gamma}{\sqrt{\gamma -1}} \Big(1 + (\gamma - 1) \Ma^2 \Big) \left(1 + \frac{\gamma - 1}{2} \Ma^2 \right)^{-\tfrac{1}{2}}\]
Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

der_mcpTo_AP – Derivative of static pressure variant of normalised mass flow, \(\DMa({\dot{m}\sqrt{c_p T_0}}/{A p})\).

Return type

array

compflow.der_A_Acrit_from_Ma(Ma, ga)

Derivative of choking area ratio by Mach number.

The derivative of compflow.A_Acrit_from_Ma() with respect to Mach number.

Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

der_A_Acrit – Derivative of ratio of area to choking area, \(\DMa(A/A_*)\).

Return type

array

compflow.der_Mash_from_Ma(Ma, ga)

Derivative of post-shock Mach number by Mach number.

The derivative of compflow.Mash_from_Ma() with respect to Mach number.

Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

der_Mash – Derivative of post-shock Mach number, \(\DMa(\Ma_\mathrm{sh})\).

Return type

array

compflow.der_Posh_Po_from_Ma(Ma, ga)

Derivative of shock pressure ratio by Mach number.

The derivative of compflow.Posh_Po_from_Ma() with respect to Mach number.

Parameters
  • Ma (array) – Mach number, \(\Ma\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

Returns

der_Posh_Po – Derivative of shock stagnation pressure ratio, \(\DMa(p_{0\mathrm{sh}}/p_0)\).

Return type

array

Lookup normalised mass flow

compflow.lookup_mcpTo_APo(mcpTo_APo, ga, atol=1e-06)

Invert normalised mass flow relation with lookup table.

This function is equivalent to compflow.Ma_from_mcpTo_APo() for subsonic inputs, but uses a lookup table rather than iteratively solving. The lookup table is faster for large amounts of input data, more than about 100 elements.

The first call of this function with a given value of gamma will automatically prepare the table, distributing sampling points as required to yield a uniform small error in Mach number. The table is then cached for future calls.

Parameters
  • mcpTo_APo (array) – Normalised mass flow, \({\dot{m}\sqrt{c_p T_0}}/{A p_0}\).

  • ga (float) – Ratio of specific heats, \(\gamma\).

  • atol (float) – Tolerance on error in inverted \(\Ma\) values.

Returns

Ma – Mach number, \(\Ma\).

Return type

array

Raises

ValueError – If Mach number is outside the table range of \(0\le\Ma\le 1\).