PHASE_SI

Overview

Excel Usage

=PHASE_SI(phase_si_name_one, value_one, phase_si_name_two, value_two, fluid)
  • phase_si_name_one (str, required): Name of the first input property (e.g., ‘T’, ‘P’).
  • value_one (float, required): Value of the first input property in SI units.
  • phase_si_name_two (str, required): Name of the second input property (e.g., ‘P’, ‘Q’).
  • value_two (float, required): Value of the second input property in SI units.
  • fluid (str, required): Fluid name (e.g., ‘Water’, ‘R134a’).

Returns (str): Phase description string (e.g., ‘liquid’, ‘gas’).

Examples

Example 1: Water Liquid Phase

Inputs:

phase_si_name_one value_one phase_si_name_two value_two fluid
T 300 P 101325 Water

Excel formula:

=PHASE_SI("T", 300, "P", 101325, "Water")

Expected output:

"liquid"

Example 2: Water Gas Phase

Inputs:

phase_si_name_one value_one phase_si_name_two value_two fluid
T 400 P 101325 Water

Excel formula:

=PHASE_SI("T", 400, "P", 101325, "Water")

Expected output:

"gas"

Example 3: Water Two-Phase

Inputs:

phase_si_name_one value_one phase_si_name_two value_two fluid
T 373.15 Q 0.5 Water

Excel formula:

=PHASE_SI("T", 373.15, "Q", 0.5, "Water")

Expected output:

"twophase"

Example 4: CO2 Supercritical

Inputs:

phase_si_name_one value_one phase_si_name_two value_two fluid
T 350 P 10000000 CO2

Excel formula:

=PHASE_SI("T", 350, "P", 10000000, "CO2")

Expected output:

"supercritical"

Python Code

import CoolProp.CoolProp as CP

def phase_si(phase_si_name_one, value_one, phase_si_name_two, value_two, fluid):
    """
    Identify the phase of a fluid at a given state using CoolProp.

    See: https://coolprop.org/coolprop/HighLevelAPI.html#phasesi-function

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

    Args:
        phase_si_name_one (str): Name of the first input property (e.g., 'T', 'P'). Valid options: Temperature (T), Pressure (P), Density (D), Enthalpy (H), Entropy (S), Vapor Quality (Q), Internal Energy (U).
        value_one (float): Value of the first input property in SI units.
        phase_si_name_two (str): Name of the second input property (e.g., 'P', 'Q'). Valid options: Temperature (T), Pressure (P), Density (D), Enthalpy (H), Entropy (S), Vapor Quality (Q), Internal Energy (U).
        value_two (float): Value of the second input property in SI units.
        fluid (str): Fluid name (e.g., 'Water', 'R134a').

    Returns:
        str: Phase description string (e.g., 'liquid', 'gas').
    """
    try:
        # CoolProp.PhaseSI(name1, prop1, name2, prop2, Ref)
        result = CP.PhaseSI(phase_si_name_one, value_one, phase_si_name_two, value_two, fluid)
        return str(result)
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator