Compressible
Overview
ax.set_ylim(0, 1.1)
plt.tight_layout() plt.show() ```
Python Libraries
These functions rely on the fluids library, which provides robust, vectorized implementations of gas dynamic relationships and pipeline standards. Using these validated libraries ensures accurate handling of compressibility effects, which are notoriously difficult to implement correctly using standard Excel formulas.
Gas Pipeline Transport
In industrial applications, compressible flow is dominant in natural gas transmission. Long-distance pipelines experience significant pressure drops, causing gas density to decrease and velocity to increase along the pipe.
- Weymouth Equation: Used for high-pressure, high-flow rate pipelines with large diameters. Implemented in
WEYMOUTH_FLOW. - Panhandle Equations: Panhandle A is used for smooth pipes (moderate Reynolds numbers), while Panhandle B is for fully turbulent flow in high-pressure lines. See
PANHANDLE_AandPANHANDLE_B.
Thermodynamic Processes
Calculation of work and efficiency in compressors and turbines relies on defining the path of the state change:
- Isentropic: Adiabatic and reversible (ideal).
ISENTROPIC_WORKcalculates the theoretical work required for compression or expansion between two pressure states. - Polytropic: Real-world process with heat transfer and friction (PV^n = C).
POLYTROPIC_EXPmodels the expansion process using a polytropic exponent n. - Isothermal: Constant temperature (idealized cooling).
ISOTHERMAL_WORKcalculates work for processes where heat is removed to maintain constant temperature.
Native Excel Capabilities
Excel has no native support for compressible flow. Users typically build manual models using the ideal gas law and standard thermodynamic formulas. While this works for simple cases, it fails to account for: - Real gas effects (compressibility factor Z) - Choked flow conditions in complex piping - Iterative solutions for pipeline sizing equations
The Python functions provided here handle these complexities automatically, allowing for more reliable engineering design directly within the spreadsheet environment.
Tools
| Tool | Description |
|---|---|
| FRITZSCHE_FLOW | Calculate gas flow rate using the Fritzsche formula. |
| IGT_FLOW | Calculate gas flow rate using the IGT (Institute of Gas Technology) formula. |
| IS_CHOKED_FLOW | Determine if a flow is choked (critical) based on pressure ratio. |
| ISENTROPIC_EFF | Convert between isentropic and polytropic efficiency for compression. |
| ISENTROPIC_T_RISE | Calculate the temperature rise for isentropic compression or expansion. |
| ISENTROPIC_WORK | Calculate work of compression or expansion for a gas in an isentropic process. |
| ISOTHERMAL_GAS | Calculate mass flow rate for isothermal compressible gas flow in a pipe. |
| ISOTHERMAL_WORK | Calculate work of compression or expansion for a gas in an isothermal process. |
| MULLER_FLOW | Calculate gas flow rate using the Muller formula. |
| P_CRITICAL_FLOW | Calculate critical flow pressure for a fluid at Mach 1. |
| P_STAGNATION | Calculate stagnation pressure from static conditions. |
| PANHANDLE_A | Calculate gas flow rate in a pipeline using the Panhandle A formula. |
| PANHANDLE_B | Calculate gas flow rate in a pipeline using the Panhandle B formula. |
| POLYTROPIC_EXP | Calculate polytropic exponent or polytropic efficiency for compression. |
| STAGNATION_ENERGY | Calculate the increase in enthalpy due to fluid velocity. |
| T_CRITICAL_FLOW | Calculate critical flow temperature for a fluid at Mach 1. |
| T_STAG_IDEAL | Calculate ideal stagnation temperature from velocity and heat capacity. |
| T_STAGNATION | Calculate stagnation temperature from pressure ratio. |
| WEYMOUTH_FLOW | Calculate gas flow rate in a pipeline using the Weymouth formula. |