Documentation

twoPhaseFluidTables

Generate fluid property tables from REFPROP database

Syntax

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

Description

example

fluidTables = twoPhaseFluidTables(uRange,pRange,mLiquid,mVapor,n,substance,refpropPath) returns the property tables for a two-phase fluid from the National Institute of Standards and Technology (NIST) REFPROP database. The input parameters specify the valid specific internal energy and pressure ranges, table dimensions, and fluid name. You use the fluid property tables as inputs in the Two-Phase Fluid Properties (2P) block.

Each table column corresponds to a different pressure. Each row corresponds to a different normalized internal energy—a transformation of the specific internal energy that converts the liquid and vapor regions of the fluid phase diagram into rectangular areas. This transformation enables you to format the property tables as rectangular matrices.

Before using this function for the first time, you must download additional MATLAB® support files from the NIST website and save them in your REFPROP installation folder. Use the NIST search engine to find the files by name. The 32-bit MATLAB version requires one support file:

  • rp_proto.m

The 64-bit MATLAB version requires two support files:

  • refprp64_thunk_pcwin64.dll

  • rp_proto64.m

This function has been tested against NIST Standard Reference Database 23: REFPROP Version 9.1. REFPROP 9.1 is supported only on Windows.

Examples

collapse all

Generate 25×60 fluid property tables for water at specific internal energies of 30–4,000 kJ/kg and pressures of 0.01–15 MPa. Assume that the liquid and vapor tables have the same numbers of rows. Assume also that the REFPROP software installation is in this folder:

C:\Program Files\REFPROP\

  1. At the MATLAB command prompt, enter the following code.

    fluidTables = twoPhaseFluidTables([30,4000],[0.01,15],25,25,60,...
    'water','C:\Program Files\REFPROP\')
    fluidTables = 
    
             p: [1x60 double]
        liquid: [1x1 struct]
         vapor: [1x1 struct]
         u_min: 30
         u_max: 4000
         p_min: 0.0100
         p_max: 15
  2. List the fields in the liquid and vapor substructures. At the MATLAB command prompt enter:

    fluidTables.liquid
    and
    fluidTables.vapor

    ans = 
    
        unorm: [25x1 double]
            v: [25x60 double]
            s: [25x60 double]
            T: [25x60 double]
           nu: [25x60 double]
            k: [25x60 double]
           Pr: [25x60 double]
        u_sat: [1x60 double]
            u: [25x60 double]
  3. Enter the structure field names as inputs in the Two-Phase Fluid Properties (2P) block dialog box. Ensure that the tables are on the MATLAB path.

    In the Parameters tab, enter the field names u_min, u_max, and p from the fluidTables structure as shown in the figure.

    In the Liquid Properties tab, enter the field names from the fluidTables.liquid substructure as shown in the figure.

    Liquid Properties Tab Inputs

    In the Vapor Properties tab, enter the field names from the fluidTables.vapor substructure as shown in the figure.

    Vapor Properties Tab Inputs

Input Arguments

collapse all

Specific internal energy range, specified as a two-element array with the minimum and maximum specific internal energies of the fluid property tables. The specific internal energies must be in units of kJ/kg.

Example: [30,4000]

Pressure range, specified as a two-element array with the minimum and maximum pressures of the fluid property tables. The pressures must be in units of MPa.

Example: [0.01,15]

Number of rows to include in the liquid property tables, specified as a scalar. Each row corresponds to a different normalized liquid internal energy.

Example: 25

Number of rows to include in the vapor property tables, specified as a scalar. Each row corresponds to a different normalized vapor internal energy.

Example: 25

Number of columns to include in the fluid property tables, specified as a scalar. This number is common to liquid and vapor property tables. Each column corresponds to a different pressure.

Example: 60

Fluid for which to get the property tables, specified as a string. The fluid name must be listed in the REFPROP database. A list of fluid names is available in the fluids subfolder of the REFPROP installation.

Example: 'water'

Path to the folder with the REFPROP installation, specified as a string. The path can be absolute or relative.

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

Output Arguments

collapse all

Fluid property tables, returned as a structure array with these fields.

FieldDescription
Pn-element vector with the lookup-table pressures in units of MPa
liquidSubstructure with liquid property tables
vaporSubstructure with vapor property tables
u_minMinimum specific internal energy allowed during simulation, in units of kJ/kg
u_maxMaximum specific internal energy allowed during simulation, in units of kJ/kg
p_minMinimum pressure allowed during simulation, in units of MPa
p_maxMaximum pressure allowed during simulation, in units of MPa

The fluidTables.liquid substructure contains these additional fields.

FieldDescription
unormmLiquid-element vector with the normalized internal energies of the liquid phase
vmLiquid-by-n matrix with the specific volumes of the liquid phase in units of m^3/kg
smLiquid-by-n matrix with the specific entropies of the liquid phase in units of kJ/(kg*K)
TmLiquid-by-n matrix with the temperature of the liquid phase in units of K
numLiquid-by-n matrix with the kinematic viscosities of the liquid phase in units of mm^2/s
kmLiquid-by-n matrix with the thermal conductivities of the liquid phase in units of W/(m*K)
PrmLiquid-by-n matrix with the Prandtl numbers of the liquid phase
u_satn-element vector with the saturated liquid specific internal energies in units of kJ/kg
umLiquid-by-n matrix with the specific internal energies of the liquid phase in units of kJ/k

The fluidTables.vapor substructure contains these additional fields:

FieldDescription
unormmVapor-element vector with the normalized internal energies of the vapor phase
vmVapor-by-n matrix with the specific volumes of the vapor phase in units of m^3/kg
smVapor-by-n matrix with the specific entropies of the vapor phase in units of kJ/(kg*K)
TmVapor-by-n matrix with the temperature of the vapor phase in units of K
numVapor-by-n matrix with the kinematic viscosities of the vapor phase in units of mm^2/s
kmVapor-by-n matrix with the thermal conductivities of the vapor phase in units of W/(m*K)
PrmVapor-by-n matrix with the Prandtl numbers of the vapor phase
u_satn-element vector with the saturated vapor specific internal energies in units of kJ/kg
umVapor-by-n matrix with the specific internal energies of the vapor phase in units of kJ/k

Introduced in R2015b

Was this topic helpful?