CV_CHOKE_PRESS_GAS

Overview

Excel Usage

=CV_CHOKE_PRESS_GAS(xt_factor, gamma, p_inlet, p_outlet)
  • xt_factor (float, required): Pressure difference ratio factor (-)
  • gamma (float, required): Specific heat capacity ratio (-)
  • p_inlet (float, optional, default: null): Inlet pressure (Pa)
  • p_outlet (float, optional, default: null): Outlet pressure (Pa)

Returns (float): Choked pressure (Pa)

Examples

Example 1: Docs example (given P1)

Inputs:

xt_factor gamma p_inlet
1 1.3 100000

Excel formula:

=CV_CHOKE_PRESS_GAS(1, 1.3, 100000)

Expected output:

7142.86

Example 2: Docs example (given P2)

Inputs:

xt_factor gamma p_outlet
1 1.3 7142.86

Excel formula:

=CV_CHOKE_PRESS_GAS(1, 1.3, 7142.86)

Expected output:

100000.04

Example 3: Air at 1.0 XT

Inputs:

xt_factor gamma p_inlet
1 1.4 100000

Excel formula:

=CV_CHOKE_PRESS_GAS(1, 1.4, 100000)

Expected output:

0

Example 4: Nitrogen at 0.7 XT

Inputs:

xt_factor gamma p_inlet
0.7 1.4 100000

Excel formula:

=CV_CHOKE_PRESS_GAS(0.7, 1.4, 100000)

Expected output:

30000

Python Code

from fluids.control_valve import control_valve_choke_P_g

def cv_choke_press_gas(xt_factor, gamma, p_inlet=None, p_outlet=None):
    """
    Calculates the pressure at which choked flow occurs in a gas control valve.

    See: https://fluids.readthedocs.io/fluids.control_valve.html#fluids.control_valve.control_valve_choke_P_g

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

    Args:
        xt_factor (float): Pressure difference ratio factor (-)
        gamma (float): Specific heat capacity ratio (-)
        p_inlet (float, optional): Inlet pressure (Pa) Default is None.
        p_outlet (float, optional): Outlet pressure (Pa) Default is None.

    Returns:
        float: Choked pressure (Pa)
    """
    try:
      xt_factor = float(xt_factor)
      gamma = float(gamma)
      if p_inlet is not None:
        p_inlet = float(p_inlet)
      if p_outlet is not None:
        p_outlet = float(p_outlet)

      if xt_factor <= 0:
        return "Error: XT factor must be positive."
      if gamma <= 1:
        return "Error: Specific heat capacity ratio must be greater than 1."

      if p_inlet is None and p_outlet is None:
        return "Error: Either inlet pressure or outlet pressure must be provided."

      return float(control_valve_choke_P_g(xT=xt_factor, gamma=gamma, P1=p_inlet, P2=p_outlet))
    except Exception as e:
      return f"Error: {str(e)}"

Online Calculator