STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
feedtwin.comps.iec_gas Namespace Reference

Classes

class  GasCv

Functions

float iec_gamma (FlowConditions flow)
bool is_gas (FlowConditions flow)
float expansion_drop (float a, float x_critical)

Variables

float XT_TYPICAL = 0.70
float GAMMA_IDEAL_PRESSURE = 1.0e3

Detailed Description

Gas through a flow coefficient, with expansion and choking, per IEC 60534-2-1.

For the components that opt in: the relief valve (:mod:`feedtwin.comps.relief`)
always, and the regulator seat when ``Setup.regulator_compressible_seat`` is on
(:mod:`feedtwin.comps.regulator`). The plain :class:`~feedtwin.comps.elements.Valve`
is untouched.

The standard
------------
IEC 60534-2-1:2011, *Industrial-process control valves -- Part 2-1: Flow
capacity -- Sizing equations for fluid flow under installed conditions*,
compressible fluids, turbulent flow, no fittings (F_P = 1):

.. code-block:: text

    W = N6 . C . Y . sqrt(x . p1 . rho1)               non-choked
    Y = 1 - x / (3 . F_gamma . xT)                     expansion factor
    F_gamma = gamma / 1.40                             specific heat ratio factor
    choked once x >= F_gamma . xT, where Y = 2/3 and W stops depending on p2

with ``x = (p1 - p2) / p1``. Inverting it for the drop at a given flow is a cubic
in ``x`` (:func:`expansion_drop`); past the choke there is no drop that passes
the flow, and the caller pins the flow at :meth:`GasCv.capacity` instead.

The scale, ``N6 . C``
---------------------
Not the tabulated N6. The coefficient is the library's own Cv-to-K conversion,
``fluids.fittings.Cv_to_K`` -- the Cv definition, one US gallon per minute of
water at one psi -- so that ``Y -> 1`` reproduces exactly the incompressible law
the rest of the library already uses for the same Cv. It agrees with IEC's
N6 = 2.73 (Cv, kg/h, kPa) to 0.15 %. (The library's
:func:`~feedtwin.comps.elements._calibrate_choke`, used by the plain valve's
choked ceiling, is 5.4 % lower: it calibrates against ``fluids``'s N9, which is
referenced to 0 degC, with a standard density taken at 15 degC. Reported, not
changed here.)

gamma
-----
The standard's ``gamma`` is the gas's ratio of specific heats as an ideal-gas
property (air and nitrogen 1.40, helium 1.66), not the real-gas cp/cv at the
inlet: for nitrogen at 1055 psia and 200 K, near a GN2 burnout, cp/cv is 1.84
(CoolProp), and using it would raise the flow at the drop seen there by 6 %.
:func:`iec_gamma` takes ``FlowConditions.gamma_ideal`` -- cp/cv at 1 kPa and the
node temperature, which :func:`~feedtwin.comps.elements.conditions_from_fluid`
fills for every gas-priced node -- and falls back to the real-gas value only when
the caller built conditions by hand without it.

Function Documentation

◆ expansion_drop()

float feedtwin.comps.iec_gas.expansion_drop ( float a,
float x_critical )
``x`` in ``[0, x_critical]`` solving ``x . Y(x)^2 = a``.

``Y = 1 - x / (3 x_critical)``. The left side rises monotonically from 0 to
``4 x_critical / 9`` at the choke; ``a`` at or past that returns the choke.
Newton on a bracket, bisecting whenever a step leaves it.

Definition at line 84 of file iec_gas.py.

References min.

Referenced by feedtwin.comps.iec_gas.GasCv.drop().

◆ iec_gamma()

float feedtwin.comps.iec_gas.iec_gamma ( FlowConditions flow)
The ratio of specific heats IEC 60534's F_gamma is built from: the
ideal-gas value when the conditions carry it, else the real-gas cp/cv.

Definition at line 68 of file iec_gas.py.

◆ is_gas()

bool feedtwin.comps.iec_gas.is_gas ( FlowConditions flow)
Whether these conditions were priced as a gas.

:func:`~feedtwin.comps.elements.conditions_from_fluid` fills
``gamma_ideal`` only for a gas-priced node; a liquid leaves it zero and
keeps the incompressible law.

Definition at line 74 of file iec_gas.py.

Variable Documentation

◆ GAMMA_IDEAL_PRESSURE

float feedtwin.comps.iec_gas.GAMMA_IDEAL_PRESSURE = 1.0e3

Definition at line 65 of file iec_gas.py.

◆ XT_TYPICAL

float feedtwin.comps.iec_gas.XT_TYPICAL = 0.70

Definition at line 62 of file iec_gas.py.