CoolProp provides functions for thermophysical properties of fluids. It is open-source, free, and licensed under the MIT License. Basically, you can do anything you like with the MIT license. It is very permissive and not copy-left. You can use CoolProp in commercial code.
0.0 General
CoolProp supports lots of programming languages, 122 pure and pseudo-pure fluids, and some mixtures.
Download address:
https://sourceforge.net/projects/coolprop/files/CoolProp/
Detailed document:
After installation, we need to activate CoolProp. In Excel, please activate "CoolProp" in Excel Add-ins dialog box. In VBA Editor, please activate "CoolProp" in References dialog box.
For a string literal in Excel or VBA, use double-quotation-marks ( " ) instead of single-quotation-marks ( ' ).
This article is tested per CoolProp Version 6.4.
1.0 High-Level Functions
CoolProp for Excel provides four high-level functions: PropsSI, Props1SI, PhaseSI, HAPropsSI.
1.1 PropsSI
Function PropsSI(ByVal output As String, ByVal Name1 As String, ByVal Value1 As Double, ByVal Name2 As String, ByVal Value2 As Double, ByVal fluid As String)
The parameter output is the name of output property that will be returned. Parameters Name1 and Value1 are the name and value of the first input property. Parameters Name2 and Value2 are the name and value of the second input property. The parameter fluid is the name of fluid for which the output property will be calculated.
Per State Postulate in thermodynamics, the state of a pure substance will be determined when two independent, intensive properties are given. That is why two properties are required as function input.
For the name of properties, please refer to Section 2.1 in this article.
CoolProp only uses SI units for input/output properties, other systems of units are not supported. For the unit of properties, please refer to Section 2.1 in this article.
VBA Example:
Private Sub Test1_1()
'density of Nitrogen at 101325 Pa & 300 K
D1 = PropsSI("D", "P", 101325, "T", 300, "Nitrogen")
Debug.Print D1 & " kg/m^3" '1.13816468646245 kg/m^3
'order of input properties is irrelevant
D2 = PropsSI("D", "T", 300, "P", 101325, "Nitrogen")
Debug.Print D2 & " kg/m^3" '1.13816468646245 kg/m^3
End Sub
1.2 Props1SI
Function Props1SI(ByVal fluid As String, ByVal output As String)
Some fluid information (e.g., pressure at the critical point) is not related to the state of the fluid, so only fluid name (parameter fluid) and output property name (parameter output) are required.
For the name and unit of parameter output in function Props1SI, please refer to Section 2.2 in this article.
VBA Example:
Private Sub Test1_2()
'call Props1SI function
Tcrit1 = Props1SI(“Tcrit”,”Water”)
Debug.Print Tcrit1 & " K" '647.096 K
'call PropsSI function using dummy arguments for the unused parameters
Tcrit2 = PropsSI("Tcrit","",0,"",0,"Water")
Debug.Print Tcrit2 & " K" '647.096 K
End Sub
1.3 PhaseSI
Function PhaseSI(ByVal Name1 As String, ByVal Value1 As Double, ByVal Name2 As String, ByVal Value2 As Double, ByVal fluid As String)
PhaseSI function only returns the name of the phase, therefore there is no parameter output.
VBA Example:
Private Sub Test1_3()
'PhaseSI function returns name of phase (as string)
phase1 = PhaseSI('P',101325,'Q',0,'Water')
Debug.Print phase1 'twophase
'PropsSI function returns phase index (as floating point number)
phase2 = PropsSI('Phase','P',101325,'Q',0,'Water')
Debug.Print phase2 '6.0
End Sub
1.4 HAPropsSI
Function HAPropsSI(ByVal output As String, ByVal Input1Name As String, ByVal Value1 As Double, ByVal Input2Name As String, ByVal Value2 As Double, ByVal Input3name As String, ByVal Value3 As Double)
HAPropsSI function returns the property of humid air. It requires three properties as function input, and one of them should be humidity. HAPropsSI function is based on ASHREA-RP1485. It is applicable for pressure from 0.01 kPa up to 10 MPa, in a temperature range from -143.15 °C up to 350 °C with a humidity ratio from 0 kg of water up to 10 kg of water per kg of dry air.
For the name and unit of parameters in function HAPropsSI, please refer to Section 2.3 in this article.
VBA Example:
Private Sub Test1_4()
'Enthalpy at dry bulb temperature T of 25C,
'pressure P of one atmosphere, relative humidity R of 50%
h = HAPropsSI('H','T',298.15,'P',101325,'R',0.5)
Debug.Print h & " J per kg dry air" '50423.45039076901
#Temperature of saturated air
T1 = HAPropsSI('T','P',101325,'H',h,'R',1.0)
Debug.Print T1 & " K" '290.96209246907983 K
'order of input properties doesn't matter
T2 = HAPropsSI('T','H',h,'R',1.0,'P',101325)
Debug.Print T2 & " K" '290.96209246907983 K
End Sub
2.0 Table of String Inputs
2.1 Inputs/Outputs to PropsSI Function
Common properties for PropsSI function are listed in the following table. For a complete list, please refer to:
http://www.coolprop.org/coolprop/HighLevelAPI.html#table-of-string-inputs-to-propssi-function
Parameter |
Units |
Input/Output |
Description |
DMOLAR, Dmolar |
mol/m^3 |
IO |
Molar density |
D, DMASS, Dmass |
kg/m^3 |
IO |
Mass density |
HMOLAR, Hmolar |
J/mol |
IO |
Molar specific enthalpy |
H, HMASS, Hmass |
J/kg |
IO |
Mass specific enthalpy |
P |
Pa |
IO |
Pressure |
Q |
mol/mol |
IO |
Mass vapor quality |
SMOLAR, Smolar |
J/mol/K |
IO |
Molar specific entropy |
S, SMASS, Smass |
J/kg/K |
IO |
Mass specific entropy |
T |
K |
IO |
Temperature |
UMOLAR, Umolar |
J/mol |
IO |
Molar specific internal energy |
U, UMASS, Umass |
J/kg |
IO |
Mass specific internal energy |
CONDUCTIVITY, L, conductivity |
W/m/K |
O |
Thermal conductivity |
CP0MASS, Cp0mass |
J/kg/K |
O |
Ideal gas mass specific constant
pressure specific heat |
CP0MOLAR, Cp0molar |
J/mol/K |
O |
Ideal gas molar specific constant
pressure specific heat |
CPMOLAR, Cpmolar |
J/mol/K |
O |
Molar specific constant pressure
specific heat |
CVMASS, Cvmass, O |
J/kg/K |
O |
Mass specific constant volume specific
heat |
CVMOLAR, Cvmolar |
J/mol/K |
O |
Molar specific constant volume
specific heat |
C, CPMASS, Cpmass |
J/kg/K |
O |
Mass specific constant pressure
specific heat |
PHASE, Phase |
|
O |
Phase index as a float |
PRANDTL, Prandtl |
|
O |
Prandtl number |
V, VISCOSITY, viscosity |
Pa s |
O |
Viscosity |
Z |
|
O |
Compressibility factor |
In Input/Output column, I indicates properties for parameters Name1, Name2; O indicates properties for parameters output.
2.2 Trivial Inputs for Props1SI Function
Common properties for Props1SI function are listed in the following table. For a complete list, please refer to:
http://www.coolprop.org/coolprop/HighLevelAPI.html#trivial-inputs
Parameter |
Units |
Description |
GAS_CONSTANT, gas_constant |
J/mol/K |
Molar gas constant |
M, MOLARMASS, MOLAR_MASS, molar_mass, molarmass |
kg/mol |
Molar mass |
PCRIT, P_CRITICAL, Pcrit, p_critical, pcrit |
Pa |
Pressure at the critical point |
RHOCRIT, RHOMASS_CRITICAL, rhocrit, rhomass_critical |
kg/m^3 |
Mass density at critical point |
RHOMOLAR_CRITICAL, rhomolar_critical |
mol/m^3 |
Molar density at critical point |
TCRIT, T_CRITICAL, T_critical, Tcrit |
K |
Temperature at the critical point |
PTRIPLE, P_TRIPLE, p_triple, ptriple |
Pa |
Pressure at the triple point (pure
only) |
TTRIPLE, T_TRIPLE, T_triple, Ttriple |
K |
Temperature at the triple point |
FRACTION_MAX, fraction_max |
|
Fraction (mole, mass, volume) maximum
value for incompressible solutions |
FRACTION_MIN, fraction_min |
|
Fraction (mole, mass, volume) minimum
value for incompressible solutions |
T_FREEZE, T_freeze |
K |
Freezing temperature for
incompressible solutions |
PMAX, P_MAX, P_max, pmax |
Pa |
Maximum pressure limit |
PMIN, P_MIN, P_min, pmin |
Pa |
Minimum pressure limit |
TMAX, T_MAX, T_max, Tmax |
K |
Maximum temperature limit |
TMIN, T_MIN, T_min, Tmin |
K |
Minimum temperature limit |
2.3 Inputs/Outputs to HAPropsSI Function
Complete properties for HAPropsSI function are listed in the following table:
Parameter |
Units |
Input/Output |
Description |
P |
Pa |
Input |
Pressure |
P_w |
Pa |
Input |
Partial pressure of water vapor |
T, Tdb, T_db |
K |
Input/Output |
Dry-Bulb Temperature |
B, Twb, T_wb, WetBulb |
K |
Input/Output |
Wet-Bulb Temperature |
D, Tdp, DewPoint, T_dp |
K |
Input/Output |
Dew-Point Temperature |
psi_w, Y |
mol water/mol humid air |
Input/Output |
Water mole fraction |
R, RH, RelHum |
|
Input/Output |
Relative humidity in [0, 1] |
W, Omega, HumRat |
kg water/kg dry air |
Input/Output |
Humidity Ratio |
H, Hda, Enthalpy |
J/kg dry air |
Input/Output |
Mixture enthalpy per dry air |
Hha |
J/kg humid air |
Input/Output |
Mixture enthalpy per humid air |
S, Sda, Entropy |
J/kg dry air/K |
Input/Output |
Mixture entropy per unit dry air |
Sha |
J/kg humid air/K |
Input/Output |
Mixture entropy per unit humid air |
V, Vda |
m^3 /kg dry air |
Input/Output |
Mixture volume per unit dry air |
Vha |
m^3 /kg humid air |
Input/Output |
Mixture volume per unit humid air |
C, cp |
J/kg dry air/K |
Output |
Mixture specific heat per unit dry air |
Cha, cp_ha |
J/kg humid air/K |
Output |
Mixture specific heat per unit humid air |
CV |
J/kg dry air/K |
Output |
Mixture specific heat at constant volume per unit
dry air |
CVha, cv_ha |
J/kg humid air/K |
Output |
Mixture specific heat at constant volume per unit
humid air |
K, k, Conductivity |
W/m/K |
Output |
Mixture thermal conductivity |
M, Visc, mu |
Pa-s |
Output |
Mixture viscosity |
Z |
|
Output |
Compressibility factor Z=pv/(RT) |
In Input/Output column, Input indicates properties for parameters Name1, Name2, Name3; Output indicates properties for parameters output.
3.0 Fluids
3.1 Pure and Pseudo-Pure Fluids
Common pure and pseudo-pure fluids are listed in the following table. For a complete list, please refer to:
http://www.coolprop.org/fluid_properties/PurePseudoPure.html#list-of-fluids
Name |
Thermal Conductivity |
Viscosity |
Melting Line |
Surface Tension |
Air |
✓ |
✓ |
||
Ammonia |
✓ |
✓ |
✓ |
|
Argon |
✓ |
✓ |
✓ |
✓ |
CarbonDioxide |
✓ |
✓ |
✓ |
✓ |
CarbonMonoxide |
✓ |
✓ |
||
Ethane |
✓ |
✓ |
✓ |
✓ |
Ethanol |
✓ |
✓ |
✓ |
✓ |
Hydrogen |
✓ |
✓ |
✓ |
✓ |
IsoButane |
✓ |
✓ |
✓ |
✓ |
Isopentane |
✓ |
✓ |
✓ |
✓ |
Methane |
✓ |
✓ |
✓ |
✓ |
Methanol |
✓ |
✓ |
✓ |
✓ |
Nitrogen |
✓ |
✓ |
✓ |
✓ |
Oxygen |
✓ |
✓ |
✓ |
✓ |
Water |
✓ |
✓ |
✓ |
✓ |
n-Butane |
✓ |
✓ |
✓ |
✓ |
n-Hexane |
✓ |
✓ |
✓ |
|
n-Pentane |
✓ |
✓ |
✓ |
✓ |
n-Propane |
✓ |
✓ |
✓ |
✓ |
For Thermal Conductivity, Viscosity, Melting Line, Surface Tension, not all of these properties are supported for a given fluid.
3.2 IAPWS-IF97
The International Association for the Properties of Water and Steam released IAPWS-IF97 for fast computation of water properties. The IF97 backend can be accessed in function PropsSI and function Props1SI. However, water is the only fluid name that can be specified, as "IF97::Water". The following figure is the valid range of temperature and pressure. Temperature and pressure outside of these regions will result in an “Out of Range” error.
VBA Example:
Private Sub Test3_2()
T_init = 500#
P_init = 101325
S_init = PropsSI("S", "T", T_init, "P", P_init, "IF97::Water") '7938.58736435735
H_init = PropsSI("H", "S", S_init, "P", P_init, "IF97::Water") '2928535.50133066
T_final = PropsSI("T", "H", H_init, "P", P_init, "IF97::Water") '499.998052904717
Debug.Print S_init & " J/kg/K"
Debug.Print H_init & " J/kg"
Debug.Print T_final & " K"
End Sub
3.3 Incompressible Fluids
In CoolProp, the incompressible fluids are divided into three major groups.
- Pure fluids
- Mass-based binary mixtures
- Volume-based binary mixtures
The incompressible pure fluids implemented in CoolProp cover secondary refrigerants, heat transfer oils, and molten salt mixture. For a complete list of incompressible pure fluids and temperature range, please refer to:
http://www.coolprop.org/fluid_properties/Incompressibles.html#pure
For mass-based binary mixtures and volume-based binary mixtures. Most of them are secondary heat transfer fluids, but there are also aqueous ammonia (MAM) and lithium bromide (LiBr). The concentration always refers to the added component ranging from 0.0 for pure water to 1.0 for no water at all. For a complete list of mass-based and volume-based binary mixtures, temperature range and concentration range, please refer to:
http://www.coolprop.org/fluid_properties/Incompressibles.html#massmix
http://www.coolprop.org/fluid_properties/Incompressibles.html#volumix
VBA Example:
Private Sub Test3_3()
'Incompressible, Pure fluid
T_init = 500#
P_init = 101325
H_init = PropsSI("H", "T", T_init, "P", P_init, "INCOMP::DowQ") '408385.32146991
Debug.Print H_init & " J/kg"
'Incompressible, Mass-based binary mixture
'The fraction notation can be in the form of percent, LiBr-23%, or as a fraction between 0 and 1, LiBr[0.23]
D1 = PropsSI("D", "T", 300, "P", 101325, "INCOMP::LiBr[0.23]") '1187.54382436172
D2 = PropsSI("D", "T", 300, "P", 101325, "INCOMP::LiBr-23%") '1187.54382436172
Debug.Print "D1 = " & D1 & " kg/m^3" & vbNewLine & _
"D2 = " & D2 & " kg/m^3"
'Incompressible, MITSW (MIT Seawater)
Dsea = PropsSI("D", "T", 300, "P", 101325, "INCOMP::MITSW-3.5%") '1022.97856743166
Debug.Print Dsea & " kg/m^3"
End Sub
3.4 Mixture
The only types of inputs that are allowed for mixtures right now are:
- Pressure/quality
- Temperature/quality
- Temperature/pressure
The format of mixture name is:
"Name1[Frac1]&Name2[Frac2]&Name3[Frac3]"
Components are separated by ("&"); the fraction of the component is in ("[") and ("]") brackets; the fraction of mixture adopts mole fractions; space (" ") is not allowed in mixture name.
CoolProp provides MixtureString function for Excel:
Function MixtureString(names As Range, fractions As Range) As String
The parameter names is the Excel cells for component names of the mixture. The parameter fractions is the Excel cells for component fractions of the mixture. A string for mixture name will be returned.
Mixture calculations require binary interaction parameters for each pair in the mixture. While many binary interaction parameters are available in the CoolProp library, sadly, many are not. For a complete list of binary pairs, please refer to:
http://www.coolprop.org/fluid_properties/Mixtures.html#binary-pairs
沒有留言:
張貼留言