Compressible flow and compressor sizing (fluids.compressible)

This module contains equations for modeling flow where density changes significantly during the process - compressible flow. Also included are equations for choked flow - the phenomenon where the velocity of a fluid reaches its speed of sound.

For reporting bugs, adding feature requests, or submitting pull requests, please use the GitHub issue tracker or contact the author at Caleb.Andrew.Bell@gmail.com.

Compression Processes

fluids.compressible.isothermal_work_compression(P1, P2, T, Z=1.0)[source]

Calculates the work of compression or expansion of a gas going through an isothermal process.

W=zRTln(P2P1)W = zRT\ln\left(\frac{P_2}{P_1}\right)
Parameters
P1float

Inlet pressure, [Pa]

P2float

Outlet pressure, [Pa]

Tfloat

Temperature of the gas going through an isothermal process, [K]

Zfloat

Constant compressibility factor of the gas, [-]

Returns
Wfloat

Work performed per mole of gas compressed/expanded [J/mol]

Notes

The full derivation with all forms is as follows:

W=P1P2VdP=zRTP1P21PdPW = \int_{P_1}^{P_2} V dP = zRT\int_{P_1}^{P_2} \frac{1}{P} dP
W=zRTln(P2P1)=P1V1ln(P2P1)=P2V2ln(P2P1)W = zRT\ln\left(\frac{P_2}{P_1}\right) = P_1 V_1 \ln\left(\frac{P_2} {P_1}\right) = P_2 V_2 \ln\left(\frac{P_2}{P_1}\right)

The substitutions are according to the ideal gas law with compressibility:

The work of compression/expansion is the change in enthalpy of the gas. Returns negative values for expansion and positive values for compression.

An average compressibility factor can be used where Z changes. For further accuracy, this expression can be used repeatedly with small changes in pressure and the work from each step summed.

This is the best possible case for compression; all actual compresssors require more work to do the compression.

By making the compression take a large number of stages and cooling the gas between stages, this can be approached reasonable closely. Integrally geared compressors are often used for this purpose.

References

1

Couper, James R., W. Roy Penney, and James R. Fair. Chemical Process Equipment: Selection and Design. 2nd ed. Amsterdam ; Boston: Gulf Professional Publishing, 2009.

Examples

>>> isothermal_work_compression(1E5, 1E6, 300)
5743.427304244769
fluids.compressible.isentropic_work_compression(T1, k, Z=1.0, P1=None, P2=None, W=None, eta=None)[source]

Calculation function for dealing with compressing or expanding a gas going through an isentropic, adiabatic process assuming constant Cp and Cv. The polytropic model is the same equation; just provide n instead of k and use a polytropic efficiency for eta instead of a isentropic efficiency. Can calculate any of the following, given all the other inputs:

  • W, Work of compression

  • P2, Pressure after compression

  • P1, Pressure before compression

  • eta, isentropic efficiency of compression

W=(kk1)ZRT1[(P2P1)(k1)/k1]/ηisentropicW = \left(\frac{k}{k-1}\right)ZRT_1\left[\left(\frac{P_2}{P_1} \right)^{(k-1)/k}-1\right]/\eta_{isentropic}
Parameters
T1float

Initial temperature of the gas, [K]

kfloat

Isentropic exponent of the gas (Cp/Cv) or polytropic exponent n to use this as a polytropic model instead [-]

Zfloat, optional

Constant compressibility factor of the gas, [-]

P1float, optional

Inlet pressure, [Pa]

P2float, optional

Outlet pressure, [Pa]

Wfloat, optional

Work performed per mole of gas compressed/expanded [J/mol]

etafloat, optional

Isentropic efficiency of the process or polytropic efficiency of the process to use this as a polytropic model instead [-]

Returns
W, P1, P2, or etafloat

The missing input which was solved for [base SI]

Notes

For the same compression ratio, this is always of larger magnitude than the isothermal case.

The full derivation is as follows:

For constant-heat capacity “isentropic” fluid,

V=P11/kV1P1/kV = \frac{P_1^{1/k}V_1}{P^{1/k}}
W=P1P2VdP=P1P2P11/kV1P1/kdPW = \int_{P_1}^{P_2} V dP = \int_{P_1}^{P_2}\frac{P_1^{1/k}V_1} {P^{1/k}}dP
W=P11/kV111k[P211/kP111/k]W = \frac{P_1^{1/k} V_1}{1 - \frac{1}{k}}\left[P_2^{1-1/k} - P_1^{1-1/k}\right]

After performing the integration and substantial mathematical manipulation we can obtain:

W=(kk1)P1V1[(P2P1)(k1)/k1]W = \left(\frac{k}{k-1}\right) P_1 V_1 \left[\left(\frac{P_2}{P_1} \right)^{(k-1)/k}-1\right]

Using PV = ZRT:

W=(kk1)ZRT1[(P2P1)(k1)/k1]W = \left(\frac{k}{k-1}\right)ZRT_1\left[\left(\frac{P_2}{P_1} \right)^{(k-1)/k}-1\right]

The work of compression/expansion is the change in enthalpy of the gas. Returns negative values for expansion and positive values for compression.

An average compressibility factor should be used as Z changes. For further accuracy, this expression can be used repeatedly with small changes in pressure and new values of isentropic exponent, and the work from each step summed.

For the polytropic case this is not necessary, as eta corrects for the simplification.

References

1

Couper, James R., W. Roy Penney, and James R. Fair. Chemical Process Equipment: Selection and Design. 2nd ed. Amsterdam ; Boston: Gulf Professional Publishing, 2009.

Examples

>>> isentropic_work_compression(P1=1E5, P2=1E6, T1=300, k=1.4, eta=0.78)
10416.876986384483
fluids.compressible.isentropic_T_rise_compression(T1, P1, P2, k, eta=1)[source]

Calculates the increase in temperature of a fluid which is compressed or expanded under isentropic, adiabatic conditions assuming constant Cp and Cv. The polytropic model is the same equation; just provide n instead of k and use a polytropic efficienty for eta instead of a isentropic efficiency.

T2=T1+ΔTsηs=T1{1+1ηs[(P2P1)(k1)/k1]}T_2 = T_1 + \frac{\Delta T_s}{\eta_s} = T_1 \left\{1 + \frac{1} {\eta_s}\left[\left(\frac{P_2}{P_1}\right)^{(k-1)/k}-1\right]\right\}
Parameters
T1float

Initial temperature of gas [K]

P1float

Initial pressure of gas [Pa]

P2float

Final pressure of gas [Pa]

kfloat

Isentropic exponent of the gas (Cp/Cv) or polytropic exponent n to use this as a polytropic model instead [-]

etafloat

Isentropic efficiency of the process or polytropic efficiency of the process to use this as a polytropic model instead [-]

Returns
T2float

Final temperature of gas [K]

Notes

For the ideal case of eta = 1, the model simplifies to:

T2T1=(P2P1)(k1)/k\frac{T_2}{T_1} = \left(\frac{P_2}{P_1}\right)^{(k-1)/k}

References

1

Couper, James R., W. Roy Penney, and James R. Fair. Chemical Process Equipment: Selection and Design. 2nd ed. Amsterdam ; Boston: Gulf Professional Publishing, 2009.

2

GPSA. GPSA Engineering Data Book. 13th edition. Gas Processors Suppliers Association, Tulsa, OK, 2012.

Examples

>>> isentropic_T_rise_compression(286.8, 54050, 432400, 1.4)
519.5230938217768
fluids.compressible.isentropic_efficiency(P1, P2, k, eta_s=None, eta_p=None)[source]

Calculates either isentropic or polytropic efficiency from the other type of efficiency.

ηs=(P2/P1)(k1)/k1(P2/P1)k1kηp1\eta_s = \frac{(P_2/P_1)^{(k-1)/k}-1} {(P_2/P_1)^{\frac{k-1}{k\eta_p}}-1}
ηp=(k1)ln(P2P1)kln(1ηs(ηs+(P2P1)1k(k1)1))\eta_p = \frac{\left(k - 1\right) \ln{\left (\frac{P_{2}}{P_{1}} \right )}}{k \ln{\left (\frac{1}{\eta_{s}} \left(\eta_{s} + \left(\frac{P_{2}}{P_{1}}\right)^{\frac{1}{k} \left(k - 1\right)} - 1\right) \right )}}
Parameters
P1float

Initial pressure of gas [Pa]

P2float

Final pressure of gas [Pa]

kfloat

Isentropic exponent of the gas (Cp/Cv) [-]

eta_sfloat, optional

Isentropic (adiabatic) efficiency of the process, [-]

eta_pfloat, optional

Polytropic efficiency of the process, [-]

Returns
eta_s or eta_pfloat

Isentropic or polytropic efficiency, depending on input, [-]

Notes

The form for obtained eta_p from eta_s was derived with SymPy.

References

1

Couper, James R., W. Roy Penney, and James R. Fair. Chemical Process Equipment: Selection and Design. 2nd ed. Amsterdam ; Boston: Gulf Professional Publishing, 2009.

Examples

>>> isentropic_efficiency(1E5, 1E6, 1.4, eta_p=0.78)
0.7027614191263858
fluids.compressible.polytropic_exponent(k, n=None, eta_p=None)[source]

Calculates one of:

  • Polytropic exponent from polytropic efficiency

  • Polytropic efficiency from the polytropic exponent

n=kηp1k(1ηp)n = \frac{k\eta_p}{1 - k(1-\eta_p)}
ηp=(nn1)(kk1)=n(k1)k(n1)\eta_p = \frac{\left(\frac{n}{n-1}\right)}{\left(\frac{k}{k-1} \right)} = \frac{n(k-1)}{k(n-1)}
Parameters
kfloat

Isentropic exponent of the gas (Cp/Cv) [-]

nfloat, optional

Polytropic exponent of the process [-]

eta_pfloat, optional

Polytropic efficiency of the process, [-]

Returns
n or eta_pfloat

Polytropic exponent or polytropic efficiency, depending on input, [-]

References

1

Couper, James R., W. Roy Penney, and James R. Fair. Chemical Process Equipment: Selection and Design. 2nd ed. Amsterdam ; Boston: Gulf Professional Publishing, 2009.

Examples

>>> polytropic_exponent(1.4, eta_p=0.78)
1.5780346820809246

Compressible Flow

fluids.compressible.isothermal_gas(rho, fd, P1=None, P2=None, L=None, D=None, m=None)[source]

Calculation function for dealing with flow of a compressible gas in a pipeline for the complete isothermal flow equation. Can calculate any of the following, given all other inputs:

  • Mass flow rate

  • Upstream pressure (numerical)

  • Downstream pressure (analytical or numerical if an overflow occurs)

  • Diameter of pipe (numerical)

  • Length of pipe

A variety of forms of this equation have been presented, differing in their use of the ideal gas law and choice of gas constant. The form here uses density explicitly, allowing for non-ideal values to be used.

m˙2=(πD24)2ρavg(P12P22)P1(fdLD+2lnP1P2)\dot m^2 = \frac{\left(\frac{\pi D^2}{4}\right)^2 \rho_{avg} \left(P_1^2-P_2^2\right)}{P_1\left(f_d\frac{L}{D} + 2\ln\frac{P_1}{P_2} \right)}
Parameters
rhofloat

Average density of gas in pipe, [kg/m^3]

fdfloat

Darcy friction factor for flow in pipe [-]

P1float, optional

Inlet pressure to pipe, [Pa]

P2float, optional

Outlet pressure from pipe, [Pa]

Lfloat, optional

Length of pipe, [m]

Dfloat, optional

Diameter of pipe, [m]

mfloat, optional

Mass flow rate of gas through pipe, [kg/s]

Returns
m, P1, P2, D, or Lfloat

The missing input which was solved for [base SI]

Notes

The solution for P2 has the following closed form, derived using Maple:

P2=P1(e0.51m2(Cm2+ lambertW(BP1m2eCm2+BP1m2)m2+BP1))1P_2={P_1 \left( {{ e}^{0.5\cdot{\frac {1}{{m}^{2}} \left( -C{m}^{2} +\text{ lambertW} \left(-{\frac {BP_1}{{m}^{2}}{{ e}^{-{\frac {-C{m}^{ 2}+BP_1}{{m}^{2}}}}}}\right){}{m}^{2}+BP_1 \right) }}} \right) ^{-1}}
B=π2D442ρavgB = \frac{\pi^2 D^4}{4^2} \rho_{avg}
C=fdLDC = f_d \frac{L}{D}

A wide range of conditions are impossible due to choked flow. See P_isothermal_critical_flow for details. An exception is raised when they occur.

The 2 multiplied by the logarithm is often shown as a power of the pressure ratio; this is only the case when the pressure ratio is raised to the power of 2 before its logarithm is taken.

A number of limitations exist for this model:

  • Density dependence is that of an ideal gas.

  • If calculating the pressure drop, the average gas density cannot be known immediately; iteration must be used to correct this.

  • The friction factor depends on both the gas density and velocity, so it should be solved for iteratively as well. It changes throughout the pipe as the gas expands and velocity increases.

  • The model is not easily adapted to include elevation effects due to the acceleration term included in it.

  • As the gas expands, it will change temperature slightly, further altering the density and friction factor.

There are many commercial packages which perform the actual direct integration of the flow, such as OLGA Dynamic Multiphase Flow Simulator, or ASPEN Hydraulics.

This expression has also been presented with the ideal gas assumption directly incorporated into it [4] (note R is the specific gas constant, in units of J/kg/K):

m˙2=(πD24)2(P12P22)RT(fdLD+2lnP1P2)\dot m^2 = \frac{\left(\frac{\pi D^2}{4}\right)^2 \left(P_1^2-P_2^2\right)}{RT\left(f_d\frac{L}{D} + 2\ln\frac{P_1}{P_2} \right)}

References

1

Crane Co. Flow of Fluids Through Valves, Fittings, and Pipe. Crane, 2009.

2

Kim, J. and Singh, N. “A Novel Equation for Isothermal Pipe Flow.”. Chemical Engineering, June 2012, http://www.chemengonline.com/a-novel-equation-for-isothermal-pipe-flow/?printmode=1

3

Wilkes, James O. Fluid Mechanics for Chemical Engineers with Microfluidics and CFD. 2 edition. Upper Saddle River, NJ: Prentice Hall, 2005.

4

Rennels, Donald C., and Hobart M. Hudson. Pipe Flow: A Practical and Comprehensive Guide. 1st edition. Hoboken, N.J: Wiley, 2012.

Examples

>>> isothermal_gas(rho=11.3, fd=0.00185, P1=1E6, P2=9E5, L=1000, D=0.5)
145.4847572636031

Empirical Compressible Flow

fluids.compressible.Panhandle_A(SG, Tavg, L=None, D=None, P1=None, P2=None, Q=None, Ts=288.7, Ps=101325.0, Zavg=1.0, E=0.92)[source]

Calculation function for dealing with flow of a compressible gas in a pipeline with the Panhandle A formula. Can calculate any of the following, given all other inputs:

  • Flow rate

  • Upstream pressure

  • Downstream pressure

  • Diameter of pipe

  • Length of pipe

A variety of different constants and expressions have been presented for the Panhandle A equation. Here, a new form is developed with all units in base SI, based on the work of [1].

Q=158.02053E(TsPs)1.0788[P12P22LSG0.8539TavgZavg]0.5394D2.6182Q = 158.02053 E \left(\frac{T_s}{P_s}\right)^{1.0788}\left[\frac{P_1^2 -P_2^2}{L \cdot {SG}^{0.8539} T_{avg}Z_{avg}}\right]^{0.5394}D^{2.6182}
Parameters
SGfloat

Specific gravity of fluid with respect to air at the reference temperature and pressure Ts and Ps, [-]

Tavgfloat

Average temperature of the fluid in the pipeline, [K]

Lfloat, optional

Length of pipe, [m]

Dfloat, optional

Diameter of pipe, [m]

P1float, optional

Inlet pressure to pipe, [Pa]

P2float, optional

Outlet pressure from pipe, [Pa]

Qfloat, optional

Flow rate of gas through pipe at Ts and Ps, [m^3/s]

Tsfloat, optional

Reference temperature for the specific gravity of the gas, [K]

Psfloat, optional

Reference pressure for the specific gravity of the gas, [Pa]

Zavgfloat, optional

Average compressibility factor for gas, [-]

Efloat, optional

Pipeline efficiency, a correction factor between 0 and 1

Returns
Q, P1, P2, D, or Lfloat

The missing input which was solved for [base SI]

Notes

[1]’s original constant was 4.5965E-3, and it has units of km (length), kPa, mm (diameter), and flowrate in m^3/day.

The form in [2] has the same exponents as used here, units of mm (diameter), kPa, km (length), and flow in m^3/hour; its leading constant is 1.9152E-4.

The GPSA [3] has a leading constant of 0.191, a bracketed power of 0.5392, a specific gravity power of 0.853, and otherwise the same constants. It is in units of mm (diameter) and kPa and m^3/day; length is stated to be in km, but according to the errata is in m.

[4] has a leading constant of 1.198E7, a specific gravity of power of 0.8541, and a power of diameter which is under the root of 4.854 and is otherwise the same. It has units of kPa and m^3/day, but is otherwise in base SI units.

[5] has a leading constant of 99.5211, but its reference correction has no exponent; other exponents are the same as here. It is entirely in base SI units.

[6] has pressures in psi, diameter in inches, length in miles, Q in ft^3/day, T in degrees Rankine, and a constant of 435.87. Its reference condition power is 1.07881, and it has a specific gravity correction outside any other term with a power of 0.4604.

References

1(1,2)

Menon, E. Shashi. Gas Pipeline Hydraulics. 1st edition. Boca Raton, FL: CRC Press, 2005.

2

Crane Co. Flow of Fluids Through Valves, Fittings, and Pipe. Crane, 2009.

3

GPSA. GPSA Engineering Data Book. 13th edition. Gas Processors Suppliers Association, Tulsa, OK, 2012.

4

Campbell, John M. Gas Conditioning and Processing, Vol. 2: The Equipment Modules. 7th edition. Campbell Petroleum Series, 1992.

5

Coelho, Paulo M., and Carlos Pinho. “Considerations about Equations for Steady State Flow in Natural Gas Pipelines.” Journal of the Brazilian Society of Mechanical Sciences and Engineering 29, no. 3 (September 2007): 262-73. doi:10.1590/S1678-58782007000300005.

6

Ikoku, Chi U. Natural Gas Production Engineering. Malabar, Fla: Krieger Pub Co, 1991.

Examples

>>> Panhandle_A(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15)
42.56082051195928
fluids.compressible.Panhandle_B(SG, Tavg, L=None, D=None, P1=None, P2=None, Q=None, Ts=288.7, Ps=101325.0, Zavg=1.0, E=0.92)[source]

Calculation function for dealing with flow of a compressible gas in a pipeline with the Panhandle B formula. Can calculate any of the following, given all other inputs:

  • Flow rate

  • Upstream pressure

  • Downstream pressure

  • Diameter of pipe

  • Length of pipe

A variety of different constants and expressions have been presented for the Panhandle B equation. Here, a new form is developed with all units in base SI, based on the work of [1].

Q=152.88116E(TsPs)1.02[P12P22LSG0.961TavgZavg]0.51D2.53Q = 152.88116 E \left(\frac{T_s}{P_s}\right)^{1.02}\left[\frac{P_1^2 -P_2^2}{L \cdot {SG}^{0.961} T_{avg}Z_{avg}}\right]^{0.51}D^{2.53}
Parameters
SGfloat

Specific gravity of fluid with respect to air at the reference temperature and pressure Ts and Ps, [-]

Tavgfloat

Average temperature of the fluid in the pipeline, [K]

Lfloat, optional

Length of pipe, [m]

Dfloat, optional

Diameter of pipe, [m]

P1float, optional

Inlet pressure to pipe, [Pa]

P2float, optional

Outlet pressure from pipe, [Pa]

Qfloat, optional

Flow rate of gas through pipe at Ts and Ps, [m^3/s]

Tsfloat, optional

Reference temperature for the specific gravity of the gas, [K]

Psfloat, optional

Reference pressure for the specific gravity of the gas, [Pa]

Zavgfloat, optional

Average compressibility factor for gas, [-]

Efloat, optional

Pipeline efficiency, a correction factor between 0 and 1

Returns
Q, P1, P2, D, or Lfloat

The missing input which was solved for [base SI]

Notes

[1]’s original constant was 1.002E-2, and it has units of km (length), kPa, mm (diameter), and flowrate in m^3/day.

The form in [2] has the same exponents as used here, units of mm (diameter), kPa, km (length), and flow in m^3/hour; its leading constant is 4.1749E-4.

The GPSA [3] has a leading constant of 0.339, and otherwise the same constants. It is in units of mm (diameter) and kPa and m^3/day; length is stated to be in km, but according to the errata is in m.

[4] has a leading constant of 1.264E7, a diameter power of 4.961 which is also under the 0.51 power, and is otherwise the same. It has units of kPa and m^3/day, but is otherwise in base SI units.

[5] has a leading constant of 135.8699, but its reference correction has no exponent and its specific gravity has a power of 0.9608; the other exponents are the same as here. It is entirely in base SI units.

[6] has pressures in psi, diameter in inches, length in miles, Q in ft^3/day, T in degrees Rankine, and a constant of 737 with the exponents the same as here.

References

1(1,2)

Menon, E. Shashi. Gas Pipeline Hydraulics. 1st edition. Boca Raton, FL: CRC Press, 2005.

2

Crane Co. Flow of Fluids Through Valves, Fittings, and Pipe. Crane, 2009.

3

GPSA. GPSA Engineering Data Book. 13th edition. Gas Processors Suppliers Association, Tulsa, OK, 2012.

4

Campbell, John M. Gas Conditioning and Processing, Vol. 2: The Equipment Modules. 7th edition. Campbell Petroleum Series, 1992.

5

Coelho, Paulo M., and Carlos Pinho. “Considerations about Equations for Steady State Flow in Natural Gas Pipelines.” Journal of the Brazilian Society of Mechanical Sciences and Engineering 29, no. 3 (September 2007): 262-73. doi:10.1590/S1678-58782007000300005.

6

Ikoku, Chi U. Natural Gas Production Engineering. Malabar, Fla: Krieger Pub Co, 1991.

Examples

>>> Panhandle_B(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15)
42.35366178004172
fluids.compressible.Weymouth(SG, Tavg, L=None, D=None, P1=None, P2=None, Q=None, Ts=288.7, Ps=101325.0, Zavg=1.0, E=0.92)[source]

Calculation function for dealing with flow of a compressible gas in a pipeline with the Weymouth formula. Can calculate any of the following, given all other inputs:

  • Flow rate

  • Upstream pressure

  • Downstream pressure

  • Diameter of pipe

  • Length of pipe

A variety of different constants and expressions have been presented for the Weymouth equation. Here, a new form is developed with all units in base SI, based on the work of [1].

Q=137.32958ETsPs[P12P22LSGTavgZavg]0.5D2.667Q = 137.32958 E \frac{T_s}{P_s}\left[\frac{P_1^2 -P_2^2}{L \cdot {SG} \cdot T_{avg}Z_{avg}}\right]^{0.5}D^{2.667}
Parameters
SGfloat

Specific gravity of fluid with respect to air at the reference temperature and pressure Ts and Ps, [-]

Tavgfloat

Average temperature of the fluid in the pipeline, [K]

Lfloat, optional

Length of pipe, [m]

Dfloat, optional

Diameter of pipe, [m]

P1float, optional

Inlet pressure to pipe, [Pa]

P2float, optional

Outlet pressure from pipe, [Pa]

Qfloat, optional

Flow rate of gas through pipe at Ts and Ps, [m^3/s]

Tsfloat, optional

Reference temperature for the specific gravity of the gas, [K]

Psfloat, optional

Reference pressure for the specific gravity of the gas, [Pa]

Zavgfloat, optional

Average compressibility factor for gas, [-]

Efloat, optional

Pipeline efficiency, a correction factor between 0 and 1

Returns
Q, P1, P2, D, or Lfloat

The missing input which was solved for [base SI]

Notes

[1]’s original constant was 3.7435E-3, and it has units of km (length), kPa, mm (diameter), and flowrate in m^3/day.

The form in [2] has the same exponents as used here, units of mm (diameter), kPa, km (length), and flow in m^3/hour; its leading constant is 1.5598E-4.

The GPSA [3] has a leading constant of 0.1182, and otherwise the same constants. It is in units of mm (diameter) and kPa and m^3/day; length is stated to be in km, but according to the errata is in m.

[4] has a leading constant of 1.162E7, a diameter power of 5.333 which is also under the 0.50 power, and is otherwise the same. It has units of kPa and m^3/day, but is otherwise in base SI units.

[5] has a leading constant of 137.2364; the other exponents are the same as here. It is entirely in base SI units.

[6] has pressures in psi, diameter in inches, length in miles, Q in ft^3/hour, T in degrees Rankine, and a constant of 18.062 with the exponents the same as here.

References

1(1,2)

Menon, E. Shashi. Gas Pipeline Hydraulics. 1st edition. Boca Raton, FL: CRC Press, 2005.

2

Crane Co. Flow of Fluids Through Valves, Fittings, and Pipe. Crane, 2009.

3

GPSA. GPSA Engineering Data Book. 13th edition. Gas Processors Suppliers Association, Tulsa, OK, 2012.

4

Campbell, John M. Gas Conditioning and Processing, Vol. 2: The Equipment Modules. 7th edition. Campbell Petroleum Series, 1992.

5

Coelho, Paulo M., and Carlos Pinho. “Considerations about Equations for Steady State Flow in Natural Gas Pipelines.” Journal of the Brazilian Society of Mechanical Sciences and Engineering 29, no. 3 (September 2007): 262-73. doi:10.1590/S1678-58782007000300005.

6

Ikoku, Chi U. Natural Gas Production Engineering. Malabar, Fla: Krieger Pub Co, 1991.

Examples

>>> Weymouth(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15)
32.07729055913029
fluids.compressible.Spitzglass_high(SG, Tavg, L=None, D=None, P1=None, P2=None, Q=None, Ts=288.7, Ps=101325.0, Zavg=1.0, E=1.0)[source]

Calculation function for dealing with flow of a compressible gas in a pipeline with the Spitzglass (high pressure drop) formula. Can calculate any of the following, given all other inputs:

  • Flow rate

  • Upstream pressure

  • Downstream pressure

  • Diameter of pipe (numerical solution)

  • Length of pipe

A variety of different constants and expressions have been presented for the Spitzglass (high pressure drop) formula. Here, the form as in [1] is used but with a more precise metric conversion from inches to m.

Q=125.1060E(TsPs)[P12P22LSGTavgZavg(1+0.09144/D+150127D)]0.5D2.5Q = 125.1060 E \left(\frac{T_s}{P_s}\right)\left[\frac{P_1^2 -P_2^2}{L \cdot {SG} T_{avg}Z_{avg} (1 + 0.09144/D + \frac{150}{127}D)} \right]^{0.5}D^{2.5}
Parameters
SGfloat

Specific gravity of fluid with respect to air at the reference temperature and pressure Ts and Ps, [-]

Tavgfloat

Average temperature of the fluid in the pipeline, [K]

Lfloat, optional

Length of pipe, [m]

Dfloat, optional

Diameter of pipe, [m]

P1float, optional

Inlet pressure to pipe, [Pa]

P2float, optional

Outlet pressure from pipe, [Pa]

Qfloat, optional

Flow rate of gas through pipe at Ts and Ps, [m^3/s]

Tsfloat, optional

Reference temperature for the specific gravity of the gas, [K]

Psfloat, optional

Reference pressure for the specific gravity of the gas, [Pa]

Zavgfloat, optional

Average compressibility factor for gas, [-]

Efloat, optional

Pipeline efficiency, a correction factor between 0 and 1

Returns
Q, P1, P2, D, or Lfloat

The missing input which was solved for [base SI]

Notes

This equation is often presented without any correction for reference conditions for specific gravity.

This model is also presented in [2] with a leading constant of 1.0815E-2, the same exponents as used here, units of mm (diameter), kPa, km (length), and flow in m^3/hour.

References

1

Coelho, Paulo M., and Carlos Pinho. “Considerations about Equations for Steady State Flow in Natural Gas Pipelines.” Journal of the Brazilian Society of Mechanical Sciences and Engineering 29, no. 3 (September 2007): 262-73. doi:10.1590/S1678-58782007000300005.

2

Menon, E. Shashi. Gas Pipeline Hydraulics. 1st edition. Boca Raton, FL: CRC Press, 2005.

Examples

>>> Spitzglass_high(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15)
29.42670246281681
fluids.compressible.Spitzglass_low(SG, Tavg, L=None, D=None, P1=None, P2=None, Q=None, Ts=288.7, Ps=101325.0, Zavg=1.0, E=1.0)[source]

Calculation function for dealing with flow of a compressible gas in a pipeline with the Spitzglass (low pressure drop) formula. Can calculate any of the following, given all other inputs:

  • Flow rate

  • Upstream pressure

  • Downstream pressure

  • Diameter of pipe (numerical solution)

  • Length of pipe

A variety of different constants and expressions have been presented for the Spitzglass (low pressure drop) formula. Here, the form as in [1] is used but with a more precise metric conversion from inches to m.

Q=125.1060E(TsPs)[2(P1P2)(Ps+1210)LSGTavgZavg(1+0.09144/D+150127D)]0.5D2.5Q = 125.1060 E \left(\frac{T_s}{P_s}\right)\left[\frac{2(P_1 -P_2)(P_s+1210)}{L \cdot {SG} \cdot T_{avg}Z_{avg} (1 + 0.09144/D + \frac{150}{127}D)}\right]^{0.5}D^{2.5}
Parameters
SGfloat

Specific gravity of fluid with respect to air at the reference temperature and pressure Ts and Ps, [-]

Tavgfloat

Average temperature of the fluid in the pipeline, [K]

Lfloat, optional

Length of pipe, [m]

Dfloat, optional

Diameter of pipe, [m]

P1float, optional

Inlet pressure to pipe, [Pa]

P2float, optional

Outlet pressure from pipe, [Pa]

Qfloat, optional

Flow rate of gas through pipe at Ts and Ps, [m^3/s]

Tsfloat, optional

Reference temperature for the specific gravity of the gas, [K]

Psfloat, optional

Reference pressure for the specific gravity of the gas, [Pa]

Zavgfloat, optional

Average compressibility factor for gas, [-]

Efloat, optional

Pipeline efficiency, a correction factor between 0 and 1

Returns
Q, P1, P2, D, or Lfloat

The missing input which was solved for [base SI]

Notes

This equation is often presented without any correction for reference conditions for specific gravity.

This model is also presented in [2] with a leading constant of 5.69E-2, the same exponents as used here, units of mm (diameter), kPa, km (length), and flow in m^3/hour. However, it is believed to contain a typo, and gives results <1/3 of the correct values. It is also present in [2] in imperial form; this is believed correct, but makes a slight assumption not done in [1].

This model is present in [3] without reference corrections. The 1210 constant in [1] is an approximation necessary for the reference correction to function without a square of the pressure difference. The GPSA version is as follows, and matches this formulation very closely:

Q=0.821[(P1P2)D5LSG(1+91.44/D+0.0018D)]0.5Q = 0.821 \left[\frac{(P_1-P_2)D^5}{L \cdot {SG} (1 + 91.44/D + 0.0018D)}\right]^{0.5}

The model is also shown in [4], with diameter in inches, length in feet, flow in MMSCFD, pressure drop in inH2O, and a rounded leading constant of 0.09; this makes its predictions several percent higher than the model here.

References

1(1,2,3)

Coelho, Paulo M., and Carlos Pinho. “Considerations about Equations for Steady State Flow in Natural Gas Pipelines.” Journal of the Brazilian Society of Mechanical Sciences and Engineering 29, no. 3 (September 2007): 262-73. doi:10.1590/S1678-58782007000300005.

2(1,2)

Menon, E. Shashi. Gas Pipeline Hydraulics. 1st edition. Boca Raton, FL: CRC Press, 2005.

3

GPSA. GPSA Engineering Data Book. 13th edition. Gas Processors Suppliers Association, Tulsa, OK, 2012.

4

PetroWiki. “Pressure Drop Evaluation along Pipelines” Accessed September 11, 2016. http://petrowiki.org/Pressure_drop_evaluation_along_pipelines#Spitzglass_equation_2.

Examples

>>> Spitzglass_low(D=0.154051, P1=6720.3199, P2=0, L=54.864, SG=0.6, Tavg=288.7)
0.9488775242530617
fluids.compressible.Oliphant(SG, Tavg, L=None, D=None, P1=None, P2=None, Q=None, Ts=288.7, Ps=101325.0, Zavg=1.0, E=0.92)[source]

Calculation function for dealing with flow of a compressible gas in a pipeline with the Oliphant formula. Can calculate any of the following, given all other inputs:

  • Flow rate

  • Upstream pressure

  • Downstream pressure

  • Diameter of pipe (numerical solution)

  • Length of pipe

This model is a more complete conversion to metric of the Imperial version presented in [1].

Q=84.5872(D2.5+0.20915D3)TsPs(P12P22LSGTavg)0.5Q = 84.5872\left(D^{2.5} + 0.20915D^3\right)\frac{T_s}{P_s}\left(\frac {P_1^2 - P_2^2}{L\cdot {SG} \cdot T_{avg}}\right)^{0.5}
Parameters
SGfloat

Specific gravity of fluid with respect to air at the reference temperature and pressure Ts and Ps, [-]

Tavgfloat

Average temperature of the fluid in the pipeline, [K]

Lfloat, optional

Length of pipe, [m]

Dfloat, optional

Diameter of pipe, [m]

P1float, optional

Inlet pressure to pipe, [Pa]

P2float, optional

Outlet pressure from pipe, [Pa]

Qfloat, optional

Flow rate of gas through pipe at Ts and Ps, [m^3/s]

Tsfloat, optional

Reference temperature for the specific gravity of the gas, [K]

Psfloat, optional

Reference pressure for the specific gravity of the gas, [Pa]

Zavgfloat, optional

Average compressibility factor for gas, [-]

Efloat, optional

Pipeline efficiency, a correction factor between 0 and 1

Returns
Q, P1, P2, D, or Lfloat

The missing input which was solved for [base SI]

Notes

Recommended in [1] for use between vacuum and 100 psi.

The model is simplified by grouping constants here; however, it is presented in the imperial unit set inches (diameter), miles (length), psi, Rankine, and MMSCFD in [1]:

Q=42(24)(D2.5+D330)(14.4Ps)(Ts520)[(0.6SG)(520Tavg)(P12P22L)]0.5Q = 42(24)\left(D^{2.5} + \frac{D^3}{30}\right)\left(\frac{14.4}{P_s} \right)\left(\frac{T_s}{520}\right)\left[\left(\frac{0.6}{SG}\right) \left(\frac{520}{T_{avg}}\right)\left(\frac{P_1^2 - P_2^2}{L}\right) \right]^{0.5}

References

1(1,2,3)

GPSA. GPSA Engineering Data Book. 13th edition. Gas Processors Suppliers Association, Tulsa, OK, 2012.

2
    1. Oliphant, “Production of Natural Gas,” Report. USGS, 1902.

Examples

>>> Oliphant(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15)
28.851535408143057
fluids.compressible.Fritzsche(SG, Tavg, L=None, D=None, P1=None, P2=None, Q=None, Ts=288.7, Ps=101325.0, Zavg=1.0, E=1.0)[source]

Calculation function for dealing with flow of a compressible gas in a pipeline with the Fritzsche formula. Can calculate any of the following, given all other inputs:

  • Flow rate

  • Upstream pressure

  • Downstream pressure

  • Diameter of pipe

  • Length of pipe

A variety of different constants and expressions have been presented for the Fritzsche formula. Here, the form as in [1] is used but with all inputs in base SI units.

Q=93.500TsPs(P12P22LSG0.8587Tavg)0.538D2.69Q = 93.500 \frac{T_s}{P_s}\left(\frac{P_1^2 - P_2^2} {L\cdot {SG}^{0.8587} \cdot T_{avg}}\right)^{0.538}D^{2.69}
Parameters
SGfloat

Specific gravity of fluid with respect to air at the reference temperature and pressure Ts and Ps, [-]

Tavgfloat

Average temperature of the fluid in the pipeline, [K]

Lfloat, optional

Length of pipe, [m]

Dfloat, optional

Diameter of pipe, [m]

P1float, optional

Inlet pressure to pipe, [Pa]

P2float, optional

Outlet pressure from pipe, [Pa]

Qfloat, optional

Flow rate of gas through pipe at Ts and Ps, [m^3/s]

Tsfloat, optional

Reference temperature for the specific gravity of the gas, [K]

Psfloat, optional

Reference pressure for the specific gravity of the gas, [Pa]

Zavgfloat, optional

Average compressibility factor for gas, [-]

Efloat, optional

Pipeline efficiency, a correction factor between 0 and 1

Returns
Q, P1, P2, D, or Lfloat

The missing input which was solved for [base SI]

Notes

This model is also presented in [1] with a leading constant of 2.827, the same exponents as used here, units of mm (diameter), kPa, km (length), and flow in m^3/hour.

This model is shown in base SI units in [2], and with a leading constant of 94.2565, a diameter power of 2.6911, main group power of 0.5382 and a specific gravity power of 0.858. The difference is very small.

References

1(1,2)

Menon, E. Shashi. Gas Pipeline Hydraulics. 1st edition. Boca Raton, FL: CRC Press, 2005.

2

Coelho, Paulo M., and Carlos Pinho. “Considerations about Equations for Steady State Flow in Natural Gas Pipelines.” Journal of the Brazilian Society of Mechanical Sciences and Engineering 29, no. 3 (September 2007): 262-73. doi:10.1590/S1678-58782007000300005.

Examples

>>> Fritzsche(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, Tavg=277.15)
39.421535157535565
fluids.compressible.Muller(SG, Tavg, mu, L=None, D=None, P1=None, P2=None, Q=None, Ts=288.7, Ps=101325.0, Zavg=1.0, E=1.0)[source]

Calculation function for dealing with flow of a compressible gas in a pipeline with the Muller formula. Can calculate any of the following, given all other inputs:

  • Flow rate

  • Upstream pressure

  • Downstream pressure

  • Diameter of pipe

  • Length of pipe

A variety of different constants and expressions have been presented for the Muller formula. Here, the form as in [1] is used but with all inputs in base SI units.

Q=15.7743TsPsE(P12P22LZavgTavg)0.575(D2.725μ0.15SG0.425)Q = 15.7743\frac{T_s}{P_s}E\left(\frac{P_1^2 - P_2^2}{L \cdot Z_{avg} \cdot T_{avg}}\right)^{0.575} \left(\frac{D^{2.725}}{\mu^{0.15} SG^{0.425}}\right)
Parameters
SGfloat

Specific gravity of fluid with respect to air at the reference temperature and pressure Ts and Ps, [-]

Tavgfloat

Average temperature of the fluid in the pipeline, [K]

mufloat

Average viscosity of the fluid in the pipeline, [Pa*s]

Lfloat, optional

Length of pipe, [m]

Dfloat, optional

Diameter of pipe, [m]

P1float, optional

Inlet pressure to pipe, [Pa]

P2float, optional

Outlet pressure from pipe, [Pa]

Qfloat, optional

Flow rate of gas through pipe at Ts and Ps, [m^3/s]

Tsfloat, optional

Reference temperature for the specific gravity of the gas, [K]

Psfloat, optional

Reference pressure for the specific gravity of the gas, [Pa]

Zavgfloat, optional

Average compressibility factor for gas, [-]

Efloat, optional

Pipeline efficiency, a correction factor between 0 and 1

Returns
Q, P1, P2, D, or Lfloat

The missing input which was solved for [base SI]

Notes

This model is presented in [1] with a leading constant of 0.4937, the same exponents as used here, units of inches (diameter), psi, feet (length), Rankine, pound/(foot*second) for viscosity, and 1000 ft^3/hour.

This model is also presented in [2] in both SI and imperial form. The SI form was incorrectly converted and yields much higher flow rates. The imperial version has a leading constant of 85.7368, the same powers as used here except with rounded values of powers of viscosity (0.2609) and specific gravity (0.7391) rearranged to be inside the bracketed group; its units are inches (diameter), psi, miles (length), Rankine, pound/(foot*second) for viscosity, and ft^3/day.

This model is shown in base SI units in [3], and with a leading constant of 15.7650, a diameter power of 2.724, main group power of 0.5747, a specific gravity power of 0.74, and a viscosity power of 0.1494.

References

1(1,2)

Mohitpour, Mo, Golshan, and Allan Murray. Pipeline Design and Construction: A Practical Approach. 3rd edition. New York: Amer Soc Mechanical Engineers, 2006.

2

Menon, E. Shashi. Gas Pipeline Hydraulics. 1st edition. Boca Raton, FL: CRC Press, 2005.

3

Coelho, Paulo M., and Carlos Pinho. “Considerations about Equations for Steady State Flow in Natural Gas Pipelines.” Journal of the Brazilian Society of Mechanical Sciences and Engineering 29, no. 3 (September 2007): 262-73. doi:10.1590/S1678-58782007000300005.

Examples

>>> Muller(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, mu=1E-5,
... Tavg=277.15)
60.45796698148659
fluids.compressible.IGT(SG, Tavg, mu, L=None, D=None, P1=None, P2=None, Q=None, Ts=288.7, Ps=101325.0, Zavg=1.0, E=1.0)[source]

Calculation function for dealing with flow of a compressible gas in a pipeline with the IGT formula. Can calculate any of the following, given all other inputs:

  • Flow rate

  • Upstream pressure

  • Downstream pressure

  • Diameter of pipe

  • Length of pipe

A variety of different constants and expressions have been presented for the IGT formula. Here, the form as in [1] is used but with all inputs in base SI units.

Q=24.6241TsPsE(P12P22LZavgTavg)5/9(D8/3μ1/9SG4/9)Q = 24.6241\frac{T_s}{P_s}E\left(\frac{P_1^2 - P_2^2}{L \cdot Z_{avg} \cdot T_{avg}}\right)^{5/9} \left(\frac{D^{8/3}}{\mu^{1/9} SG^{4/9}}\right)
Parameters
SGfloat

Specific gravity of fluid with respect to air at the reference temperature and pressure Ts and Ps, [-]

Tavgfloat

Average temperature of the fluid in the pipeline, [K]

mufloat

Average viscosity of the fluid in the pipeline, [Pa*s]

Lfloat, optional

Length of pipe, [m]

Dfloat, optional

Diameter of pipe, [m]

P1float, optional

Inlet pressure to pipe, [Pa]

P2float, optional

Outlet pressure from pipe, [Pa]

Qfloat, optional

Flow rate of gas through pipe at Ts and Ps, [m^3/s]

Tsfloat, optional

Reference temperature for the specific gravity of the gas, [K]

Psfloat, optional

Reference pressure for the specific gravity of the gas, [Pa]

Zavgfloat, optional

Average compressibility factor for gas, [-]

Efloat, optional

Pipeline efficiency, a correction factor between 0 and 1

Returns
Q, P1, P2, D, or Lfloat

The missing input which was solved for [base SI]

Notes

This model is presented in [1] with a leading constant of 0.6643, the same exponents as used here, units of inches (diameter), psi, feet (length), Rankine, pound/(foot*second) for viscosity, and 1000 ft^3/hour.

This model is also presented in [2] in both SI and imperial form. Both forms are correct. The imperial version has a leading constant of 136.9, the same powers as used here except with rounded values of powers of viscosity (0.2) and specific gravity (0.8) rearranged to be inside the bracketed group; its units are inches (diameter), psi, miles (length), Rankine, pound/(foot*second) for viscosity, and ft^3/day.

This model is shown in base SI units in [3], and with a leading constant of 24.6145, and the same powers as used here.

References

1(1,2)

Mohitpour, Mo, Golshan, and Allan Murray. Pipeline Design and Construction: A Practical Approach. 3rd edition. New York: Amer Soc Mechanical Engineers, 2006.

2

Menon, E. Shashi. Gas Pipeline Hydraulics. 1st edition. Boca Raton, FL: CRC Press, 2005.

3

Coelho, Paulo M., and Carlos Pinho. “Considerations about Equations for Steady State Flow in Natural Gas Pipelines.” Journal of the Brazilian Society of Mechanical Sciences and Engineering 29, no. 3 (September 2007): 262-73. doi:10.1590/S1678-58782007000300005.

Examples

>>> IGT(D=0.340, P1=90E5, P2=20E5, L=160E3, SG=0.693, mu=1E-5, Tavg=277.15)
48.92351786788815

Critical Flow

fluids.compressible.T_critical_flow(T, k)[source]

Calculates critical flow temperature Tcf for a fluid with the given isentropic coefficient. Tcf is in a flow (with Ma=1) whose stagnation conditions are known. Normally used with converging/diverging nozzles.

TT0=2k+1\frac{T^*}{T_0} = \frac{2}{k+1}
Parameters
Tfloat

Stagnation temperature of a fluid with Ma=1 [K]

kfloat

Isentropic coefficient []

Returns
Tcffloat

Critical flow temperature at Ma=1 [K]

Notes

Assumes isentropic flow.

References

1

Cengel, Yunus, and John Cimbala. Fluid Mechanics: Fundamentals and Applications. Boston: McGraw Hill Higher Education, 2006.

Examples

Example 12.4 in [1]:

>>> T_critical_flow(473, 1.289)
413.2809086937528
fluids.compressible.P_critical_flow(P, k)[source]

Calculates critical flow pressure Pcf for a fluid with the given isentropic coefficient. Pcf is in a flow (with Ma=1) whose stagnation conditions are known. Normally used with converging/diverging nozzles.

PP0=(2k+1)k/(k1)\frac{P^*}{P_0} = \left(\frac{2}{k+1}\right)^{k/(k-1)}
Parameters
Pfloat

Stagnation pressure of a fluid with Ma=1 [Pa]

kfloat

Isentropic coefficient []

Returns
Pcffloat

Critical flow pressure at Ma=1 [Pa]

Notes

Assumes isentropic flow.

References

1

Cengel, Yunus, and John Cimbala. Fluid Mechanics: Fundamentals and Applications. Boston: McGraw Hill Higher Education, 2006.

Examples

Example 12.4 in [1]:

>>> P_critical_flow(1400000, 1.289)
766812.9022792266
fluids.compressible.is_critical_flow(P1, P2, k)[source]

Determines if a flow of a fluid driven by pressure gradient P1 - P2 is critical, for a fluid with the given isentropic coefficient. This function calculates critical flow pressure, and checks if this is larger than P2. If so, the flow is critical and choked.

Parameters
P1float

Higher, source pressure [Pa]

P2float

Lower, downstream pressure [Pa]

kfloat

Isentropic coefficient []

Returns
flowtypebool

True if the flow is choked; otherwise False

Notes

Assumes isentropic flow. Uses P_critical_flow function.

References

1

API. 2014. API 520 - Part 1 Sizing, Selection, and Installation of Pressure-relieving Devices, Part I - Sizing and Selection, 9E.

Examples

Examples 1-2 from API 520.

>>> is_critical_flow(670E3, 532E3, 1.11)
False
>>> is_critical_flow(670E3, 101E3, 1.11)
True
fluids.compressible.P_isothermal_critical_flow(P, fd, D, L)[source]

Calculates critical flow pressure Pcf for a fluid flowing isothermally and suffering pressure drop caused by a pipe’s friction factor.

P2=P1e12D(D(LambertW(e1D(DLfd))+1)+Lfd)P_2 = P_{1} e^{\frac{1}{2 D} \left(D \left(\operatorname{LambertW} {\left (- e^{\frac{1}{D} \left(- D - L f_d\right)} \right )} + 1\right) + L f_d\right)}
Parameters
Pfloat

Inlet pressure [Pa]

fdfloat

Darcy friction factor for flow in pipe [-]

Dfloat

Diameter of pipe, [m]

Lfloat

Length of pipe, [m]

Returns
Pcffloat

Critical flow pressure of a compressible gas flowing from P1 to Pcf in a tube of length L and friction factor fd [Pa]

Notes

Assumes isothermal flow. Developed based on the isothermal_gas model, using SymPy.

The isothermal gas model is solved for maximum mass flow rate; any pressure drop under it is impossible due to the formation of a shock wave.

References

1

Wilkes, James O. Fluid Mechanics for Chemical Engineers with Microfluidics and CFD. 2 edition. Upper Saddle River, NJ: Prentice Hall, 2005.

Examples

>>> P_isothermal_critical_flow(P=1E6, fd=0.00185, L=1000., D=0.5)
389699.73176
fluids.compressible.P_upstream_isothermal_critical_flow(P, fd, D, L)[source]

Not part of the public API. Reverses P_isothermal_critical_flow.

Examples

>>> P_upstream_isothermal_critical_flow(P=389699.7317645518, fd=0.00185,
... L=1000., D=0.5)
1000000.00000

Stagnation Point

fluids.compressible.stagnation_energy(V)[source]

Calculates the increase in enthalpy dH which is provided by a fluid’s velocity V.

ΔH=V22\Delta H = \frac{V^2}{2}
Parameters
Vfloat

Velocity [m/s]

Returns
dHfloat

Incease in enthalpy [J/kg]

Notes

The units work out. This term is pretty small, but not trivial.

References

1

Cengel, Yunus, and John Cimbala. Fluid Mechanics: Fundamentals and Applications. Boston: McGraw Hill Higher Education, 2006.

Examples

>>> stagnation_energy(125)
7812.5
fluids.compressible.P_stagnation(P, T, Tst, k)[source]

Calculates stagnation flow pressure Pst for a fluid with the given isentropic coefficient and specified stagnation temperature and normal temperature. Normally used with converging/diverging nozzles.

P0P=(T0T)kk1\frac{P_0}{P}=\left(\frac{T_0}{T}\right)^{\frac{k}{k-1}}
Parameters
Pfloat

Normal pressure of a fluid [Pa]

Tfloat

Normal temperature of a fluid [K]

Tstfloat

Stagnation temperature of a fluid moving at a certain velocity [K]

kfloat

Isentropic coefficient []

Returns
Pstfloat

Stagnation pressure of a fluid moving at a certain velocity [Pa]

Notes

Assumes isentropic flow.

References

1

Cengel, Yunus, and John Cimbala. Fluid Mechanics: Fundamentals and Applications. Boston: McGraw Hill Higher Education, 2006.

Examples

Example 12-1 in [1].

>>> P_stagnation(54050., 255.7, 286.8, 1.4)
80772.80495900588
fluids.compressible.T_stagnation(T, P, Pst, k)[source]

Calculates stagnation flow temperature Tst for a fluid with the given isentropic coefficient and specified stagnation pressure and normal pressure. Normally used with converging/diverging nozzles.

T=T0(PP0)k1kT=T_0\left(\frac{P}{P_0}\right)^{\frac{k-1}{k}}
Parameters
Tfloat

Normal temperature of a fluid [K]

Pfloat

Normal pressure of a fluid [Pa]

Pstfloat

Stagnation pressure of a fluid moving at a certain velocity [Pa]

kfloat

Isentropic coefficient []

Returns
Tstfloat

Stagnation temperature of a fluid moving at a certain velocity [K]

Notes

Assumes isentropic flow.

References

1

Cengel, Yunus, and John Cimbala. Fluid Mechanics: Fundamentals and Applications. Boston: McGraw Hill Higher Education, 2006.

Examples

Example 12-1 in [1].

>>> T_stagnation(286.8, 54050, 54050*8, 1.4)
519.5230938217768
fluids.compressible.T_stagnation_ideal(T, V, Cp)[source]

Calculates the ideal stagnation temperature Tst calculated assuming the fluid has a constant heat capacity Cp and with a specified velocity V and temperature T.

T=T+V22CpT^* = T + \frac{V^2}{2C_p}
Parameters
Tfloat

Tempearture [K]

Vfloat

Velocity [m/s]

Cpfloat

Ideal heat capacity [J/kg/K]

Returns
Tstfloat

Stagnation temperature [J/kg]

References

1

Cengel, Yunus, and John Cimbala. Fluid Mechanics: Fundamentals and Applications. Boston: McGraw Hill Higher Education, 2006.

Examples

Example 12-1 in [1].

>>> T_stagnation_ideal(255.7, 250, 1005.)
286.79452736318405