T_STAG_IDEAL
Overview
Calculate ideal stagnation temperature from velocity and heat capacity.
Excel Usage
=T_STAG_IDEAL(temp, velocity, cp)
temp(float, required): Static temperature [K]velocity(float, required): Velocity [m/s]cp(float, required): Heat capacity at constant pressure [J/kg/K]
Returns (float): Stagnation temperature [K]
Examples
Example 1: Textbook example from Cengel
Inputs:
| temp | velocity | cp |
|---|---|---|
| 255.7 | 250 | 1005 |
Excel formula:
=T_STAG_IDEAL(255.7, 250, 1005)
Expected output:
286.79452736318405
Example 2: High speed aircraft
Inputs:
| temp | velocity | cp |
|---|---|---|
| 220 | 300 | 1005 |
Excel formula:
=T_STAG_IDEAL(220, 300, 1005)
Expected output:
264.77611940298505
Example 3: Low speed flow
Inputs:
| temp | velocity | cp |
|---|---|---|
| 300 | 50 | 1005 |
Excel formula:
=T_STAG_IDEAL(300, 50, 1005)
Expected output:
301.2437810945274
Example 4: Different gas (helium, high Cp)
Inputs:
| temp | velocity | cp |
|---|---|---|
| 300 | 200 | 5193 |
Excel formula:
=T_STAG_IDEAL(300, 200, 5193)
Expected output:
303.8513383400732
Python Code
import micropip
await micropip.install(["fluids"])
from fluids.compressible import T_stagnation_ideal as fluids_t_stag_ideal
def t_stag_ideal(temp, velocity, cp):
"""
Calculate ideal stagnation temperature from velocity and heat capacity.
See: https://fluids.readthedocs.io/fluids.compressible.html#fluids.compressible.T_stagnation_ideal
This example function is provided as-is without any representation of accuracy.
Args:
temp (float): Static temperature [K]
velocity (float): Velocity [m/s]
cp (float): Heat capacity at constant pressure [J/kg/K]
Returns:
float: Stagnation temperature [K]
"""
# Validate and convert inputs
try:
temp = float(temp)
except (ValueError, TypeError):
return "Invalid input: temp must be a number."
try:
velocity = float(velocity)
except (ValueError, TypeError):
return "Invalid input: velocity must be a number."
try:
cp = float(cp)
except (ValueError, TypeError):
return "Invalid input: cp must be a number."
# Validation
if temp <= 0:
return "Invalid input: temp must be positive."
if cp <= 0:
return "Invalid input: cp must be positive."
try:
result = fluids_t_stag_ideal(T=temp, V=velocity, Cp=cp)
return float(result)
except Exception as e:
return f"Error: Failed to compute ideal stagnation temperature: {str(e)}"