matplotlib

Previous topic

CoolProp

Next topic

HumidAirProp Module

This Page

CoolProp Module

CoolProp.CoolProp.DerivTerms(str Output, double T, double rho, str Fluid) → double

Call signature:

DerivTerms(OutputName, T, rho, Fluid) --> float

where Fluid is a string with a valid CoolProp fluid name, and T and rho are the temperature in K and density in kg/m 3 . The value OutputName is one of the strings in the table below:

OutputName Description
dpdT Derivative of pressure with respect to temperature at constant density [kPa/K]
dpdrho Derivative of pressure with respect to density at constant temperature [kPa/(kg/m3)]
Z Compressibility factor [-]
dZ_dDelta Derivative of Z with respect to reduced density [-]
dZ_dTau Derivative of Z with respect to inverse reduced temperature [-]
VB Second virial coefficient [m3/kg]
dBdT Derivative of second virial coefficient with respect to temperature [m3/kg/K]
VC Third virial coefficient [m6/kg2]
dCdT Derivative of third virial coefficient with respect to temperature [m6/kg2/K]
phir Residual non-dimensionalized Helmholtz energy [-]
dphir_dTau Partial of residual non-dimensionalized Helmholtz energy with respect to inverse reduced temperature [-]
d2phir_dTau2 Second partial of residual non-dimensionalized Helmholtz energy with respect to inverse reduced temperature [-]
dphir_dDelta Partial of residual non-dimensionalized Helmholtz energy with respect to reduced density [-]
d2phir_dDelta2 Second partial of residual non-dimensionalized Helmholtz energy with respect to reduced density [-]
d2phir_dDelta_dTau First cross-partial of residual non-dimensionalized Helmholtz energy [-]
d3phir_dDelta2_dTau Second cross-partial of residual non-dimensionalized Helmholtz energy [-]
phi0 Ideal-gas non-dimensionalized Helmholtz energy [-]
dphi0_dTau Partial of ideal-gas non-dimensionalized Helmholtz energy with respect to inverse reduced temperature [-]
d2phi0_dTau2 Second partial of ideal-gas non-dimensionalized Helmholtz energy with respect to inverse reduced temperature [-]
dphi0_dDelta Partial of ideal-gas non-dimensionalized Helmholtz energy with respect to reduced density [-]
d2phi0_dDelta2 Second partial of ideal-gas non-dimensionalized Helmholtz energy with respect to reduced density [-]
IsothermalCompressibility Isothermal compressibility [1/kPa]
CoolProp.CoolProp.DerivTermsU(in1, T, rho, fluid, units=None)

Make the DerivTerms function handle different kinds of unit sets. Use kSI or SI to identify your desired unit system. Both input and output values have to be from the same unit set.

CoolProp.CoolProp.F2K(double T_F) → double

Convert temperature in degrees Fahrenheit to Kelvin

CoolProp.CoolProp.FluidsList() → list

Return a list of strings of all fluid names

Returns:FluidsList – All the fluids that are included in CoolProp
Return type:list of strings of fluid names

Notes

Here is an example:

In [0]: from CoolProp.CoolProp import FluidsList

In [1]: FluidsList()
CoolProp.CoolProp.IProps(long iOutput, long iInput1, double Input1, long iInput2, double Input2, long iFluid) → double

This is a more computationally efficient version of the Props() function as it uses integer keys for the input and output codes as well as the fluid index for the fluid. It can only be used with CoolProp fluids. An example of how it should be used:

#  These should be run once in the header of your file
from CoolProp.CoolProp import IProps, get_Fluid_index
from CoolProp import param_constants
iPropane = get_Fluid_index('Propane')

#  This should be run using the cached values - much faster !
IProps(param_constants.iP,param_constants.iT,0.8*Tc,param_constants.iQ,1,iPropane)

The reason that this function is significantly faster than Props is that it skips all the string comparisons which slows down the Props function quite a lot. At the C++ level, IProps doesn’t use any strings and operates on integers and floating point values

CoolProp.CoolProp.IsFluidType(string Fluid, string Type) → bool

Check if a fluid is of a given type

Valid types are:

  • Brine
  • PseudoPure (or equivalently PseudoPureFluid)
  • PureFluid
CoolProp.CoolProp.K2F(double T_K) → double

Convert temperature in Kelvin to degrees Fahrenheit

CoolProp.CoolProp.Phase(str Fluid, double T, double p) → string

Given a set of temperature and pressure, returns one of the following strings

  • Gas
  • Liquid
  • Supercritical
  • Two-Phase

Phase diagram:

    |         |
    |         |    Supercritical
    |         |
p   | Liquid (b)------------
    |        /
    |       /
    |      /       Gas
    |     /
    |   (a)
    |  /
    |------------------------

               T

   a: triple point
   b: critical point
   a-b: Saturation line
CoolProp.CoolProp.Phase_Tp(str Fluid, double T, double p) → string
CoolProp.CoolProp.Phase_Trho(str Fluid, double T, double rho) → string
CoolProp.CoolProp.Props(in1, in2, in3=None, in4=None, in5=None, in6=None, in7=None)

Call Type #1:

Props(Fluid,PropName) --> float

Where Fluid is a string with a valid CoolProp fluid name, and PropName is one of the following strings:

Tcrit Critical temperature [K]
Treduce Reducing temperature [K]
pcrit Critical pressure [kPa]
rhocrit Critical density [kg/m3]
rhoreduce Reducing density [kg/m3]
molemass Molecular mass [kg/kmol]
Ttriple Triple-point temperature [K]
Tmin Minimum temperature [K]
ptriple Triple-point pressure [kPa]
accentric Accentric factor [-]
GWP100 Global Warming Potential 100 yr
ODP Ozone Depletion Potential

This type of call is used to get fluid-specific parameters that are not dependent on the state

Call Type #2:

Alternatively, Props can be called in the form:

Props(OutputName,InputName1,InputProp1,InputName2,InputProp2,Fluid) --> float

where Fluid is a string with a valid CoolProp fluid name. The value OutputName is either a single-character or a string alias. This list shows the possible values

OutputName Description
Q Quality [-]
T Temperature [K]
P Pressure [kPa]
D Density [kg/m3]
C0 Ideal-gas specific heat at constant pressure [kJ/kg/K]
C Specific heat at constant pressure [kJ/kg/K]
O Specific heat at constant volume [kJ/kg/K]
U Internal energy [kJ/kg]
H Enthalpy [kJ/kg]
S Entropy [kJ/kg/K]
A Speed of sound [m/s]
G Gibbs function [kJ/kg]
V Dynamic viscosity [Pa-s]
L Thermal conductivity [kW/m/K]
I or SurfaceTension Surface Tension [N/m]
w or accentric Accentric Factor [-]

The following sets of input values are valid (order doesn’t matter):

InputName1 InputName2
T P
T D
P D
T Q
P Q
H P
S P
S H
T S

Python Only : InputProp1 and InputProp2 can be lists or numpy arrays. If both are iterables, they must be the same size.

If InputName1 is T and OutputName is I or SurfaceTension, the second input is neglected since surface tension is only a function of temperature

CoolProp.CoolProp.PropsSI(in1, in2, in3=None, in4=None, in5=None, in6=None, in7=None)

Just like Props(), but this function ALWAYS takes in and returns SI units (K, kg, J/kg, Pa, N/m, etc.)

Call Type #1:

Props(Fluid,PropName) --> float

Where Fluid is a string with a valid CoolProp fluid name, and PropName is one of the following strings:

Tcrit Critical temperature [K]
Treduce Reducing temperature [K]
pcrit Critical pressure [Pa]
rhocrit Critical density [kg/m3]
rhoreduce Reducing density [kg/m3]
molemass Molecular mass [kg/kmol]
Ttriple Triple-point temperature [K]
Tmin Minimum temperature [K]
ptriple Triple-point pressure [Pa]
accentric Accentric factor [-]
GWP100 Global Warming Potential 100 yr
ODP Ozone Depletion Potential

This type of call is used to get fluid-specific parameters that are not dependent on the state

Call Type #2:

Alternatively, Props can be called in the form:

Props(OutputName,InputName1,InputProp1,InputName2,InputProp2,Fluid) --> float

where Fluid is a string with a valid CoolProp fluid name. The value OutputName is either a single-character or a string alias. This list shows the possible values

OutputName Description
Q Quality [-]
T Temperature [K]
P Pressure [Pa]
D Density [kg/m3]
C0 Ideal-gas specific heat at constant pressure [J/kg]
C Specific heat at constant pressure [J/kg]
O Specific heat at constant volume [J/kg]
U Internal energy [J/kg]
H Enthalpy [J/kg]
S Entropy [J/kg/K]
A Speed of sound [m/s]
G Gibbs function [J/kg]
V Dynamic viscosity [Pa-s]
L Thermal conductivity [W/m/K]
I or SurfaceTension Surface Tension [N/m]
w or accentric Accentric Factor [-]

The following sets of input values are valid (order doesn’t matter):

InputName1 InputName2
T P
T D
P D
T Q
P Q
H P
S P
S H

Python Only : InputProp1 and InputProp2 can be lists or numpy arrays. If both are iterables, they must be the same size.

If InputName1 is T and OutputName is I or SurfaceTension, the second input is neglected since surface tension is only a function of temperature

CoolProp.CoolProp.PropsU(in1, in2, in3=None, in4=None, in5=None, in6=None, in7=None)

Make the Props function handle different kinds of unit sets. Use kSI or SI to identify your desired unit system. Both input and output values have to be from the same unit set.

CoolProp.CoolProp.add_REFPROP_fluid

add_REFPROP_fluid(signatures, args, kwargs, defaults)

Add a REFPROP fluid to CoolProp internal structure

example

add_REFPROP_fluid(“REFPROP-PROPANE”)

CoolProp.CoolProp.cair_sat(double T) → double

The derivative of the saturation enthalpy cair_sat = d(hsat)/dT

CoolProp.CoolProp.disable_TTSE_LUT(char *FluidName) → bool
CoolProp.CoolProp.disable_TTSE_LUT_writing(char *FluidName) → bool
CoolProp.CoolProp.enable_TTSE_LUT(char *FluidName) → bool
CoolProp.CoolProp.enable_TTSE_LUT_writing(char *FluidName) → bool
CoolProp.CoolProp.fromSI(str in1, in2=None, str in3='kSI')

Call fromSI(Property, Value, Units) to convert from SI units to a given set of units. At the moment, only kSI is supported. This convenience function is used inside both the PropsU and DerivTermsU functions.

CoolProp.CoolProp.get_ASHRAE34(str Fluid)

Return the safety code for the fluid from ASHRAE34 if it is in ASHRAE34

CoolProp.CoolProp.get_BibTeXKey(str Fluid, str key) → string

Return the BibTeX key for the given fluid.

The possible keys are

  • EOS
  • CP0
  • VISCOSITY
  • CONDUCTIVITY
  • ECS_LENNARD_JONES
  • ECS_FITS
  • SURFACE_TENSION

BibTeX keys refer to the BibTeX file in the trunk/CoolProp folder

Returns:empty string if Fluid not in CoolProp, “Bad key” if key is invalid
Return type:key, string
CoolProp.CoolProp.get_CAS_code(string Fluid) → string

Return a string with the CAS number for the given fluid

CoolProp.CoolProp.get_Fluid_index

get_Fluid_index(signatures, args, kwargs, defaults)

Gets the integer index of the given CoolProp fluid (primarily for use in IProps function)

CoolProp.CoolProp.get_REFPROPname(str Fluid) → string

Return the REFPROP compatible name for the fluid (only useful on windows)

Some fluids do not use the REFPROP name. For instance, ammonia is R717, and propane is R290. You can still can still call CoolProp using the name ammonia or R717, but REFPROP requires that you use a limited subset of names. Therefore, this function that returns the REFPROP compatible name. To then use this to call REFPROP, you would do something like:

In [0]: from CoolProp.CoolProp import get_REFPROPname, Props

In [1]: Fluid = 'REFPROP-' + get_REFPROPname('R290')

In [2]: Props('D', 'T', 300, 'P', 300, Fluid)
CoolProp.CoolProp.get_TTSESinglePhase_LUT_range(char *FluidName) → tuple

Get the current range of the single-phase LUT

Returns:
Return type:tuple of hmin,hmax,pmin,pmax
CoolProp.CoolProp.get_TTSE_mode(string fluid) → str

Get the mode of the TTSE table, one of "TTSE" or "BICUBIC"

CoolProp.CoolProp.get_aliases(str Fluid)

Return a comma separated string of aliases for the given fluid

CoolProp.CoolProp.get_debug_level()

Return the current debug level as integer

Returns:level – If level is 0, no output will be written to screen, if >0, some output will be written to screen. The larger level is, the more verbose the output will be
Return type:int
CoolProp.CoolProp.get_errstr() → string

Return the current error string

CoolProp.CoolProp.get_fluid_param_string

get_fluid_param_string(signatures, args, kwargs, defaults)

CoolProp.CoolProp.get_global_param_string

get_global_param_string(signatures, args, kwargs, defaults)

CoolProp.CoolProp.get_standard_unit_system() → int
CoolProp.CoolProp.isConstant(what)

Get the boolean telling you if the given key matches with a fluid constant.

CoolProp.CoolProp.isenabled_TTSE_LUT(char *FluidName) → bool
CoolProp.CoolProp.isenabled_TTSE_LUT_writing(char *FluidName) → bool
CoolProp.CoolProp.iterable(a) → bool
CoolProp.CoolProp.ndarray_or_iterable(input)
CoolProp.CoolProp.rebuildState(d)
CoolProp.CoolProp.set_TTSESat_LUT_size(char *FluidName, int N) → bool
CoolProp.CoolProp.set_TTSESinglePhase_LUT_range(char *FluidName, double hmin, double hmax, double pmin, double pmax) → bool
CoolProp.CoolProp.set_TTSESinglePhase_LUT_size(char *FluidName, int Np, int Nh) → bool
CoolProp.CoolProp.set_TTSE_mode(char *FluidName, char *Value) → bool

Set the mode of the TTSE table, one of "TTSE" or "BICUBIC"

CoolProp.CoolProp.set_debug_level(int level)

Set the current debug level as integer in the range [0,10]

Parameters:level (int) – If level is 0, no output will be written to screen, if >0, some output will be written to screen. The larger level is, the more verbose the output will be
CoolProp.CoolProp.set_reference_state

set_reference_state(signatures, args, kwargs, defaults)

Accepts one of two signatures:

Type #1:

set_reference_state(FluidName,reference_state)

FluidName The name of the fluid param reference_state The reference state to use, one of

IIR (h=200 kJ/kg, s=1 kJ/kg/K at 0C sat. liq.)
ASHRAE (h=0,s=0 @ -40C sat liq)
NBP (h=0,s=0 @ 1.0 bar sat liq.)

Type #2:

set_reference_state(FluidName,T0,rho0,h0,s0)

FluidName The name of the fluid

T0 The temperature at the reference point [K]

rho0 The density at the reference point [kg/m^3]

h0 The enthalpy at the reference point [J/kg]

s0 The entropy at the reference point [J/kg]

CoolProp.CoolProp.set_standard_unit_system(int unit_system)
CoolProp.CoolProp.toSI(str in1, in2=None, str in3='kSI')

Call toSI(Property, Value, Units) to convert from a given set of units to SI units. At the moment, only kSI is supported. This convenience function is used inside both the PropsU and DerivTermsU functions.