P_CRITICAL_FLOW
Overview
Calculate critical flow pressure for a fluid at Mach 1.
Excel Usage
=P_CRITICAL_FLOW(p_stag, k_isentropic)
p_stag(float, required): Stagnation pressure of a fluid with Ma=1 [Pa]k_isentropic(float, required): Isentropic exponent [-]
Returns (float): Critical flow pressure at Ma=1 [Pa]
Examples
Example 1: Textbook example (P=1.4MPa, k=1.289)
Inputs:
| p_stag | k_isentropic |
|---|---|
| 1400000 | 1.289 |
Excel formula:
=P_CRITICAL_FLOW(1400000, 1.289)
Expected output:
766812.9022792266
Example 2: Air at standard conditions (k=1.4)
Inputs:
| p_stag | k_isentropic |
|---|---|
| 500000 | 1.4 |
Excel formula:
=P_CRITICAL_FLOW(500000, 1.4)
Expected output:
264140.8938585871
Example 3: High pressure nozzle
Inputs:
| p_stag | k_isentropic |
|---|---|
| 5000000 | 1.3 |
Excel formula:
=P_CRITICAL_FLOW(5000000, 1.3)
Expected output:
2728638.6690703253
Example 4: Steam conditions (k=1.135)
Inputs:
| p_stag | k_isentropic |
|---|---|
| 1000000 | 1.135 |
Excel formula:
=P_CRITICAL_FLOW(1000000, 1.135)
Expected output:
577430.4000110733
Python Code
import micropip
await micropip.install(["fluids"])
from fluids.compressible import P_critical_flow as fluids_p_crit
def p_critical_flow(p_stag, k_isentropic):
"""
Calculate critical flow pressure for a fluid at Mach 1.
See: https://fluids.readthedocs.io/fluids.compressible.html#fluids.compressible.P_critical_flow
This example function is provided as-is without any representation of accuracy.
Args:
p_stag (float): Stagnation pressure of a fluid with Ma=1 [Pa]
k_isentropic (float): Isentropic exponent [-]
Returns:
float: Critical flow pressure at Ma=1 [Pa]
"""
# Validate and convert inputs
try:
p_stag = float(p_stag)
except (ValueError, TypeError):
return "Invalid input: p_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 p_stag <= 0:
return "Invalid input: p_stag must be positive."
if k_isentropic <= 1:
return "Invalid input: k_isentropic must be greater than 1."
try:
result = fluids_p_crit(P=p_stag, k=k_isentropic)
return float(result)
except Exception as e:
return f"Error: Failed to compute critical flow pressure: {str(e)}"