STAGNATION_ENERGY

Overview

Calculate the increase in enthalpy due to fluid velocity.

Excel Usage

=STAGNATION_ENERGY(velocity)
  • velocity (float, required): Velocity of the fluid [m/s]

Returns (float): Increase in enthalpy due to fluid velocity [J/kg]

Examples

Example 1: High speed flow (125 m/s)

Inputs:

velocity
125

Excel formula:

=STAGNATION_ENERGY(125)

Expected output:

7812.5

Example 2: Low speed flow (10 m/s)

Inputs:

velocity
10

Excel formula:

=STAGNATION_ENERGY(10)

Expected output:

50

Example 3: Supersonic flow (400 m/s)

Inputs:

velocity
400

Excel formula:

=STAGNATION_ENERGY(400)

Expected output:

80000

Example 4: Subsonic flow (50 m/s)

Inputs:

velocity
50

Excel formula:

=STAGNATION_ENERGY(50)

Expected output:

1250

Python Code

import micropip
await micropip.install(["fluids"])
from fluids.compressible import stagnation_energy as fluids_stag_e

def stagnation_energy(velocity):
    """
    Calculate the increase in enthalpy due to fluid velocity.

    See: https://fluids.readthedocs.io/fluids.compressible.html#fluids.compressible.stagnation_energy

    This example function is provided as-is without any representation of accuracy.

    Args:
        velocity (float): Velocity of the fluid [m/s]

    Returns:
        float: Increase in enthalpy due to fluid velocity [J/kg]
    """
    # Validate and convert inputs
    try:
        velocity = float(velocity)
    except (ValueError, TypeError):
        return "Invalid input: velocity must be a number."

    # Validation - velocity can be negative (direction) but we use magnitude
    if velocity == 0:
        return 0.0

    try:
        result = fluids_stag_e(V=abs(velocity))
        return float(result)
    except Exception as e:
        return f"Error: Failed to compute stagnation energy: {str(e)}"

Online Calculator