Пример #1
0
def test_combustion_products():
    from chemicals.combustion import fuel_air_spec_solver
    IDs = ['methane', 'carbon dioxide', 'ethane', 'propane',
           'isobutane', 'butane', '2-methylbutane', 'pentane',
           'hexane', 'nitrogen', 'oxygen', 'water']

    T = C2K(15)
    P = 1e5
    zs_fuel = [0.9652228316853225, 0.0059558310220860665, 0.018185509193506685, 0.004595963476244076,
               0.0009769695915451998, 0.001006970610302194, 0.000472984762445398, 0.0003239924667435125,
               0.0006639799746946288, 0.002594967217109564, 0.0, 0.0]
    zs_fuel = normalize(zs_fuel)
    zs_air = [0.0]*9 + [0.79, 0.21] + [0.0]

    constants, properties = ChemicalConstantsPackage.from_IDs(IDs)
    combustion = fuel_air_spec_solver(zs_air=zs_air, zs_fuel=zs_fuel, CASs=constants.CASs,
                                      atomss=constants.atomss, n_fuel=1.0, O2_excess=0.1)
    zs = combustion['zs_out']

    eos_kwargs = {'Pcs': constants.Pcs, 'Tcs': constants.Tcs, 'omegas': constants.omegas}
    gas = CEOSGas(PRMIX, eos_kwargs, T=T, P=P, zs=zs, HeatCapacityGases=properties.HeatCapacityGases)
    liquid = CEOSLiquid(PRMIX, eos_kwargs, T=T, P=P, zs=zs, HeatCapacityGases=properties.HeatCapacityGases)

    flasher = FlashVL(constants, properties, liquid=liquid, gas=gas)
    res = flasher.flash(T=400.0, P=1e5, zs=zs)
    assert res.phase_count == 1
    assert res.gas is not None
Пример #2
0
def API520_SH(T1, P1):
    r'''Calculates correction due to steam superheat for steam flow for use in
    API 520 relief valve sizing. 2D interpolation among a table with 28
    pressures and 10 temperatures is performed.


    Parameters
    ----------
    T1 : float
        Temperature of the fluid entering the valve [K]
    P1 : float
        Upstream relieving pressure; the set pressure plus the allowable
        overpressure, plus atmospheric pressure, [Pa]

    Returns
    -------
    KSH : float
        Correction due to steam superheat [-]

    Notes
    -----
    For P above 20679 kPag, use the critical flow model.
    Superheat cannot be above 649 degrees Celcius.
    If T1 is above 149 degrees Celcius, returns 1.

    Examples
    --------
    Custom example from table 9:

    >>> API520_SH(593+273.15, 1066.325E3)
    0.7201800000000002

    References
    ----------
    .. [1] API Standard 520, Part 1 - Sizing and Selection.
    '''
    if P1 > 20679E3 + atm:
        raise Exception('For P above 20679 kPag, use the critical flow model')
    if T1 > C2K(649):
        raise Exception('Superheat cannot be above 649 degrees Celcius')
    if T1 < C2K(149):
        return 1.  # No superheat under 15 psig
    return float(API520_KSH(T1, P1))
Пример #3
0
def test_celcius_to_kelvin():
    assert_equal(C2K([0, 0]), [273.15, 273.15])
Пример #4
0
def test_celcius_to_kelvin():
    assert_close1d([C2K(0.)], [273.15])