Skip to content

coolprop_interface

FluidProperties

Source code in process/core/coolprop_interface.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
class FluidProperties:
    def __init__(self, coolprop_inputs: list[str | float]):
        self._coolprop_inputs = tuple(coolprop_inputs)

    @property
    def temperature(self):
        """fluid temperature [K]"""
        return _temperature(self._coolprop_inputs)

    @property
    def pressure(self):
        """fluid pressure [Pa]"""
        return _pressure(self._coolprop_inputs)

    @property
    def density(self):
        """fluid density [kg/m3]"""
        return _density(self._coolprop_inputs)

    @property
    def enthalpy(self):
        """fluid specific enthalpy [J/kg]"""
        return _enthalpy(self._coolprop_inputs)

    @property
    def entropy(self):
        """fluid entropy [J/kg/K]"""
        return _entropy(self._coolprop_inputs)

    @property
    def specific_heat_const_p(self):
        """fluid specific heat capacity at constant pressure [J/kg/K]"""
        return _specific_heat_const_p(self._coolprop_inputs)

    @property
    def specific_heat_const_v(self):
        """fluid specific heat capacity at constant volume [J/kg/K]"""
        return _specific_heat_const_v(self._coolprop_inputs)

    @property
    def viscosity(self):
        """fluid viscosity [Pa.s]"""
        return _viscosity(self._coolprop_inputs)

    @property
    def thermal_conductivity(self):
        """fluid thermal conductivity [W/m/K]"""
        return _thermal_conductivity(self._coolprop_inputs)

    @classmethod
    def of(
        cls,
        fluid_name: str,
        *,
        temperature: float | None = None,
        pressure: float | None = None,
        entropy: float | None = None,
        vapor_quality: float | None = None,
    ):
        """Calculates the fluid properties of a fluid given its temperature and pressure.

        Parameters
        ----------
        fluid_name :
            the name of the fluid to calculate properties for, e.g. 'Helium' or 'Water'.
        temperature :
            the current temperature [K] of the fluid to calculate the properties with respect to.
        pressure :
            the current pressure [Pa] of the fluid to calculate the properties with respect to.
        entropy :
            the current entropy [J/kg/K] of the fluid to calculate the properties with respect to.
        vapor_quality :
            the molar vapor quality [mol/mol] of the fluid to calculate the properties with respect to.
            `[0, 1]`, where `0` is a saturated liquid and `1` is a saturated vapor.
        """
        coolprop_inputs = []

        if temperature is not None:
            coolprop_inputs += ["T", temperature]

        if pressure is not None:
            coolprop_inputs += ["P", pressure]

        if entropy is not None:
            coolprop_inputs += ["S", entropy]

        if vapor_quality is not None:
            coolprop_inputs += ["Q", vapor_quality]

        coolprop_inputs.append(fluid_name.title())

        return cls(coolprop_inputs)

temperature property

fluid temperature [K]

pressure property

fluid pressure [Pa]

density property

fluid density [kg/m3]

enthalpy property

fluid specific enthalpy [J/kg]

entropy property

fluid entropy [J/kg/K]

specific_heat_const_p property

fluid specific heat capacity at constant pressure [J/kg/K]

specific_heat_const_v property

fluid specific heat capacity at constant volume [J/kg/K]

viscosity property

fluid viscosity [Pa.s]

thermal_conductivity property

fluid thermal conductivity [W/m/K]

of(fluid_name, *, temperature=None, pressure=None, entropy=None, vapor_quality=None) classmethod

Calculates the fluid properties of a fluid given its temperature and pressure.

Parameters:

Name Type Description Default
fluid_name str

the name of the fluid to calculate properties for, e.g. 'Helium' or 'Water'.

required
temperature float | None

the current temperature [K] of the fluid to calculate the properties with respect to.

None
pressure float | None

the current pressure [Pa] of the fluid to calculate the properties with respect to.

None
entropy float | None

the current entropy [J/kg/K] of the fluid to calculate the properties with respect to.

None
vapor_quality float | None

the molar vapor quality [mol/mol] of the fluid to calculate the properties with respect to. [0, 1], where 0 is a saturated liquid and 1 is a saturated vapor.

None
Source code in process/core/coolprop_interface.py
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
@classmethod
def of(
    cls,
    fluid_name: str,
    *,
    temperature: float | None = None,
    pressure: float | None = None,
    entropy: float | None = None,
    vapor_quality: float | None = None,
):
    """Calculates the fluid properties of a fluid given its temperature and pressure.

    Parameters
    ----------
    fluid_name :
        the name of the fluid to calculate properties for, e.g. 'Helium' or 'Water'.
    temperature :
        the current temperature [K] of the fluid to calculate the properties with respect to.
    pressure :
        the current pressure [Pa] of the fluid to calculate the properties with respect to.
    entropy :
        the current entropy [J/kg/K] of the fluid to calculate the properties with respect to.
    vapor_quality :
        the molar vapor quality [mol/mol] of the fluid to calculate the properties with respect to.
        `[0, 1]`, where `0` is a saturated liquid and `1` is a saturated vapor.
    """
    coolprop_inputs = []

    if temperature is not None:
        coolprop_inputs += ["T", temperature]

    if pressure is not None:
        coolprop_inputs += ["P", pressure]

    if entropy is not None:
        coolprop_inputs += ["S", entropy]

    if vapor_quality is not None:
        coolprop_inputs += ["Q", vapor_quality]

    coolprop_inputs.append(fluid_name.title())

    return cls(coolprop_inputs)