P_STAGNATION
Overview
Calculate stagnation pressure from static conditions.
Excel Usage
=P_STAGNATION(pressure, temp, temp_stag, k_isentropic)
pressure(float, required): Normal (static) pressure of a fluid [Pa]temp(float, required): Normal (static) temperature of a fluid [K]temp_stag(float, required): Stagnation temperature [K]k_isentropic(float, required): Isentropic exponent [-]
Returns (float): Stagnation pressure [Pa]
Examples
Example 1: Textbook example from Cengel
Inputs:
| pressure | temp | temp_stag | k_isentropic |
|---|---|---|---|
| 54050 | 255.7 | 286.8 | 1.4 |
Excel formula:
=P_STAGNATION(54050, 255.7, 286.8, 1.4)
Expected output:
80772.80495900588
Example 2: High speed flow
Inputs:
| pressure | temp | temp_stag | k_isentropic |
|---|---|---|---|
| 100000 | 250 | 300 | 1.4 |
Excel formula:
=P_STAGNATION(100000, 250, 300, 1.4)
Expected output:
189292.91587378542
Example 3: Low speed flow (small temperature rise)
Inputs:
| pressure | temp | temp_stag | k_isentropic |
|---|---|---|---|
| 101325 | 290 | 295 | 1.4 |
Excel formula:
=P_STAGNATION(101325, 290, 295, 1.4)
Expected output:
107572.35482214327
Example 4: Different gas (lower k)
Inputs:
| pressure | temp | temp_stag | k_isentropic |
|---|---|---|---|
| 200000 | 300 | 350 | 1.3 |
Excel formula:
=P_STAGNATION(200000, 300, 350, 1.3)
Expected output:
390061.19840465457
Python Code
import micropip
await micropip.install(["fluids"])
from fluids.compressible import P_stagnation as fluids_p_stag
def p_stagnation(pressure, temp, temp_stag, k_isentropic):
"""
Calculate stagnation pressure from static conditions.
See: https://fluids.readthedocs.io/fluids.compressible.html#fluids.compressible.P_stagnation
This example function is provided as-is without any representation of accuracy.
Args:
pressure (float): Normal (static) pressure of a fluid [Pa]
temp (float): Normal (static) temperature of a fluid [K]
temp_stag (float): Stagnation temperature [K]
k_isentropic (float): Isentropic exponent [-]
Returns:
float: Stagnation pressure [Pa]
"""
# Validate and convert inputs
try:
pressure = float(pressure)
except (ValueError, TypeError):
return "Invalid input: pressure must be a number."
try:
temp = float(temp)
except (ValueError, TypeError):
return "Invalid input: temp must be a number."
try:
temp_stag = float(temp_stag)
except (ValueError, TypeError):
return "Invalid input: temp_stag must be a number."
try:
k_isentropic = float(k_isentropic)
except (ValueError, TypeError):
return "Invalid input: k_isentropic must be a number."
# Validation
if pressure <= 0:
return "Invalid input: pressure must be positive."
if temp <= 0:
return "Invalid input: temp must be positive."
if temp_stag <= 0:
return "Invalid input: temp_stag must be positive."
if k_isentropic <= 1:
return "Invalid input: k_isentropic must be greater than 1."
if temp_stag < temp:
return "Invalid input: temp_stag must be greater than or equal to temp."
try:
result = fluids_p_stag(P=pressure, T=temp, Tst=temp_stag, k=k_isentropic)
return float(result)
except Exception as e:
return f"Error: Failed to compute stagnation pressure: {str(e)}"