PHASE_SI
This function determines the thermodynamic phase region of a fluid by querying CoolProp with two independent input properties and one fluid identifier. The output is a phase label such as liquid, gas, twophase, or supercritical.
Phase determination can be expressed as:
\phi = g\left(n_1, v_1,\; n_2, v_2,\; \text{fluid}\right)
where n_1,n_2 are property codes, v_1,v_2 are SI values, and \phi is the returned phase classification string.
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’).
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
Show 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
Name of the first input property (e.g., 'T', 'P').
Value of the first input property in SI units.
Name of the second input property (e.g., 'P', 'Q').
Value of the second input property in SI units.
Fluid name (e.g., 'Water', 'R134a').