TPWS

Thermodynamic Properties of Water and Steam

by Howard Chao and Stella Unruh

 

Matlab Code

The IAPWS IF-97 equations were programmed and tested with Matlab 7.0.0.19920 (R14).  In order to make future updates and modifications easier, the code is broken down into numerous sub-functions.  These twenty-five files are detailed below.

 

bisection.m

Uses the bisection method to solve f(x) = target with use with tpws.m.  For instance, this code was used to solve for the density corresponding with a given pressure and temperature in Region 3 calculations.

 

region1_calc.m

Calculates the thermodynamic properties of water based on the IAPWS IF-97 Release for Region 1.

 

region1_gfe.m

Loads the numerical values of the coefficients and exponents of the dimensionless Gibbs free energy for Region 1.

 

region2_calc.m

Calculates the thermodynamic properties of water based on the IAPWS IF-97 Release for Region 2.

 

region2_gfe_ig.m

Loads the numerical values of the coefficients and exponents of the ideal gas part of the dimensionless Gibbs free energy for Region 2.

 

region2_gfe_r.m

Loads the numerical values of the coefficients and exponents of the residual part of the dimensionless Gibbs free energy for Region 2.

 

region23_coeff.m

Loads the numerical values of the coefficients of the B23-equation for defining the boundary between regions 2 and 3.

 

region23_pcalc.m

Calculates the pressure at a given temperature for the boundary between regions 2 and 3 based upon the IAPWS IF-97 Release.

 

region23_Tcalc.m

Calculates the temperature at a given pressure for the boundary between regions 2 and 3 based upon the IAPWS IF-97 Release.

 

region3_calc.m

Calculates the thermodynamic properties of water based on the IAPWS IF-97 Release for Region 3.

 

region3_hfe.m

Loads the numerical values of the coefficients and exponents of the dimensionless Helmholtz free energy for Region 3.

 

region4_calc.m

Calculates the thermodynamic properties of water based on the IAPWS IF-97 Release for Region 4.

 

region4_pcalc.m

Calculates the saturation pressure at a given temperature based upon the IAPWS IF-97 Release for Region 4.

 

region4_sat.m

Loads the numerical values of the coefficients of the dimensionless saturation equations.

 

region4_Tcalc.m

Calculates the saturation temperature at a given pressure based upon the IAPWS IF-97 Release for Region 4.

 

region5_calc.m

Calculates the thermodynamic properties of water based on the IAPWS IF-97 Release for Region 5.

 

region5_gfe_ig.m

Loads the numerical values of the coefficients and exponents of the ideal gas part of the dimensionless Gibbs free energy for Region 5.

 

region5_gfe_r.m

Loads the numerical values of the coefficients and exponents of the residual part of the dimensionless Gibbs free energy for Region 5.

 

tpws.m

Calculates the properties of water and steam based on the IAPWS IF-97 release as a function of temperature and pressure.  Thermodynamic properties are returned in a data structure and displayed in a table (optional).  The units used by this application must be stored in tpws_SetUnit.m.

 

tpws_Convu.m

Converts a tpws data structure from the standard IAPWS units to the unit set defined by tpwsUnits.

 

tpws_ConvuStand.m

Converts a tpws data structure from the units defined by tpwsUnits to the default IAPWS units.

 

tpws_Display.m

Displays the tpws data structure in a table format with corresponding units.

 

tpws_IntData.m

Initializes a empty data structure for use in the tpws applications.

 

tpws_RegionSelect.m

Determines the region of the data point at p and T based upon the IAPWS IF-97 Release.

 

tpws_SetUnit.m

Defines the unit set for use with tpws.m.

 

[ Introduction  |  Matlab Code  |  Program Verification  |  Examples  |   Suggested Improvements  |  References ]