This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

twoPhaseFluidTables

Generate fluid property tables from REFPROP or CoolProp database

Syntax

fluidTables = twoPhaseFluidTables(uRange,pRange,mLiquid,mVapor,n,substance,installPath)
twoPhaseFluidTables(block,fluidTables)

Description

example

fluidTables = twoPhaseFluidTables(uRange,pRange,mLiquid,mVapor,n,substance,installPath)retrieves from a database the properties of a fluid and tabulates them for use in the Two-Phase Fluid Properties (2P). The properties are mapped during retrieval into the space adopted in the block: pressure on one axis, a normalized internal energy on a second. The normalization ensures that for ease of computation the phase domains have simple straight boundaries.

The function queries the database indicated in the installPath argument for the fluid named in the substance argument. Two databases are supported: REFPROP, an industry standard developed by NIST, and the open-source CoolProp. The property tables are formatted as matrices with mLiquid or mVapor rows spanning the specific internal energies given in uRange and n columns spanning the pressures given in pRange.

The fluid tables are stored in a structure array (the output fluidTables). The hierarchy of the structure array mirrors the way in which the Two-Phase Fluid Properties (2P) block is organized, with liquid and vapor substructures—mirroring the Liquid Properties and Vapor Properties block tabs—containing the properties of the respective phases. The properties are those required of a two-phase fluid model—among them specific volume, specific entropy, kinematic viscosity, and thermal conductivity.

twoPhaseFluidTables(block,fluidTables) assigns the tabulated properties of a fluid to the parameters of a Two-Phase Fluid Properties (2P) block. The argument block specifies the path to the Two-Phase Fluid Properties (2P) block. The argument fluidTables specifies the name of the structure array in which the tabulated fluid properties are stored. The structure array must have been generated in a previous call to the twoPhaseFluidTables function.

Examples

Retrieve the Properties of Water from REFPROP

Get the properties of water from REFPROP and save them as tables in a structure named waterTables. Assume the REFPROP root folder to be C:\REFPROP. Specify a specific internal energy range of 25-4,000 kJ/kg split over 25 rows and a pressure range of 0.01-15 MPa split over 60 columns:

waterTables = twoPhaseFluidTables([25,4000],[0.01,15],25,25,60,...
'water','C:\Program Files\REFPROP\')

Retrieve the Properties of R-134a from CoolProp

Get the properties of R-134a from CoolProp and save them as tables in a structure named r134aTables. Assume the CoolProp root folder to be C:\CoolProp. Specify a specific internal energy range of 80-500 kJ/kg split over 25 rows and a pressure range of 0.001-3 MPa split over 60 columns:

r134aTables = twoPhaseFluidTables([80,500],[0.001,3],25,25,60,...
'R134a','C:\Program Files\CoolProp\')

Assign the Properties of R-134a to a Block

Populate the parameter fields of a Two-Phase Fluid Properties (2P) block with the property tables of R-134a (stored previously in the structure r134aTables). Select the block and get its path name:

gcb
Assign to the block the tables of R-134a:
twoPhaseFluidTables(gcb,r134aTables)
Open the block dialog box and check that the parameter fields are specified in terms of r134aTables data.

Input Arguments

collapse all

Lower and upper bounds of the specific internal energy range onto which to map the fluid properties. The liquid tables range in specific internal energy from the lower bound to the liquid saturation value. The vapor properties range from the vapor saturation value to the upper bound. The bounds must encompass a range broad enough to include both liquid and vapor saturation values (both retrieved from the database).

Example: [30,4000]

Lower and upper bounds of the (absolute) pressure range onto which to map the fluid properties. The upper bound can be above the critical pressure of the fluid.

Example: [0.01,100]

Number of rows to include in the fluid tables for the liquid phase. Each row gives the fluid properties at a fixed value of the normalized specific internal energy, with the normalized specific internal energy increasing from left to right between the lower bound of uRange and the liquid saturation value.

Example: 25

Number of rows to include in the fluid tables for the vapor phase. Each row gives the fluid properties at a fixed value of the normalized specific internal energy, with the normalized specific internal energy increasing from left to right between the vapor saturation value and the upper bound of uRange.

Example: 25

Number of columns to include in the fluid tables. Each column gives the fluid properties at a fixed pressure, with the pressure increasing form left to right between the bounds given in pRange. The number of columns is the same whether for the liquid or vapor phase.

Example: 60

Name of the fluid whose property tables the function is to construct. The name must be one recognized by the database specified. Refer to the database documentation for a list of valid fluid names.

Example: 'water'

Computer path to the installation folder of the database that the function is to query. The function identifies the database—REFPROP or CoolProp—by the files contained in the folder. The files should include a DLL file in the case of REFPROP and a MEX file in the case of CoolProp.

Example: 'C:\Program Files\REFPROP\'

Simulink path to the Two-Phase Fluid Properties (2P) block whose fluid tables the function is to specify. To obtain the path to a block, click the block in the model canvas and, at the MATLAB command prompt, enter gcb.

Example: 'ssc_refrigeration/Two-Phase Fluid Properties (2P)'

Name of the structure array in which the fluid tables that the function is to specify are stored. The tables must have been generated in a prior call to this function. The structure array must be currently in the MATLAB workspace.

Example: 'waterTables'

Output Arguments

collapse all

Name of the structure array in which to save the fluid property tables. The array reflects in its hierarchy the structure of the Two-Phase Fluid Properties (2P) block.

Contents of the fluidTables Structure Array

See the table for more on the fields of the fluidTables structure array.

FieldContentsDimensionsUnits
pPressuren-by-1MPa
unormNormalized specific internal energymLiquid- or mVapor-by-11
vSpecific volumemLiquid- or mVapor-by-nm^3/kg
sSpecific entropymLiquid- or mVapor-by-nkJ/(kg*K)
TTemperaturemLiquid- or mVapor-by-nK
nuKinematic viscositymLiquid- or mVapor-by-nmm^2/s
kThermal conductivitymLiquid- or mVapor-by-nW/(m*K)
PrPrandtl numbermLiquid- or mVapor-by-n1
u_satSaturation specific internal energymLiquid- or mVapor-by-1kJ/kg
uSpecific internal energymLiquid- or mVapor-by-1kJ/kg
u_minMinimum specific internal energy1-by-1kJ/kg
u_maxMaximum specific internal energy1-by-1kJ/kg
p_minMinimum pressure1-by-1MPa
p_maxMaximum pressure1-by-1MPa
p_critCritical pressure1-by-1MPa
u_critSpecific internal energy at the critical point1-by-1kJ/kg
n_subNumber of elements in the pressure vector below the critical pressure1-by-11

Tips

Install REFPROP as described by NIST (https://www.nist.gov/srd/refprop). The root folder of the installation should contain a DLL file (refprp62.dll) and a subfolder with FLD files (such as acetone.fld), which contain the fluid definitions. Use of REFPROP with the twoPhaseFluidTables function is limited to 64-bit Windows systems. This function has been tested with REFPROP versions 9.1 and 9.1.1.

Install CoolProp as described by the CoolProp development team (http://www.coolprop.org). The root folder of the installation should contain a MEX file—CoolPropMATLAB_wrap.mexw64, CoolPropMATLAB_wrap.mexa64, or CoolPropMATLAB_wrap.mexmaci64, depending on the operating system—and various MATLAB® files that together make up a wrapper function. CoolProp is compatible with Windows, Linux, and Macintosh systems. twoPhaseFluidTables has been tested with CoolProp versions 6.0.0 and 6.1.0.

Introduced in R2015b