Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Bau, Thermodynamics with Maple: Steam Tables (April 2, 2018) 1
B. How to Use the MAPLE Steam Tables
1. INTRODUCTION
Real materials often do not behave in accordance with the ideal gas law. Hence, we must
resort to using more elaborate state equations or thermodynamic tables. To this end, we have
prepared packages in Maple™ which calculate the thermodynamic properties of various
materials. These packages use correlations to represent the thermodynamic properties typically
available in tables such as the ones at the end of your book. All the packages are designed in a
similar way. In this tutorial, we focus on the properties of water.
You will learn:
(i) How to install Steam Tables and its help system as Maple packages on your computer;
(ii) How to obtain the thermodynamic properties of water; and
(iii) How to use these thermodynamic functions within Maple™ to solve some simple
problems.
Formulas used in this package (except the saturation temperature for water, which is
based on an equation found in Steam and Gas Tables with Computer Equations by T. F. Irvine
and P. E. Liley, Academic Press, 1984) are based on equations found in: ASME Steam Tables:
Thermodynamic and Transport Properties of Steam: Comprising Tables And Charts for Steam
and Water, Calculated Using the 1967 IFC Formulation for Industrial Use in Conformity with
the 1963 International Skeleton Tables, prepared by C. A. Meyer, R. B., McClintock, G. J.
Silvestri and R. C. Spencer, Jr., 6th Edition, ASME 1993.
The packages use SI units exclusively. It is crucial that you insert the data
(typically temperature and pressure) using the appropriate units (more specifically,
pressures must be expressed in MPa and temperatures must be expressed in
degrees K) in the appropriate order. You must insert the numerical values of the
properties together with their units. In any event, it is always a good practice to
keep track of the units that you are using.
Note: When you need to use the thermodynamic functions within plotting routines, you should
enclose the property function name with single quotes (') so that Maple™ knows that you wish to
delay the evaluation of the function. You will also need to remove the units since the plotting
routine will not be able to manipulate them. These points will be clarified later.
2. HOW TO INSTALL THE STEAM TABLES AND THE HELP SYSTEM
Haim H. Bau, Thermodynamics with Maple: Steam Tables (April 2, 2018) 2
To download the steam tables to your computer, go to the course web site,
http://www.seas.upenn.edu/~meam203/. Click on Thermodynamics with Maple. By clicking on
the file names, download to your hard disk the files: SteamTables.ms, SteamTablesHelp.ms,
thermodynamic properties. MakeHelp.ms describes how to install the optional help system for
SteamTables. WorkingwSteamTables.mws is a Maple worksheet that you may want to use as a
template whenever you need to use the SteamTables. The other files contain the various help
windows that go with the steam tables. The help files are not essential for using the steam tables.
After downloading the necessary files, you will need to compile them. From Maple,
open the file " SteamTables.ms." Go to the end of the file. The last statement of the file is:
> save `E:\\class work\\THERMODYNAMICS\\ThermoSoft\\Compiled\\SteamTables.m`;
Change this statement to the path and the name of the folder where you would like to
store the compiled version of the file, i.e.,
>save `C:\\A folder name of your choice \\ SteamTables.m `;
Witness that file names containing characters special to Maple (such as backslash) must
be preceded by a backslash when entering the string in Maple. Execute all the statements in the
file including the last "save" statement. To do this, simply go to the edit menu and select
“execute worksheet.” The net result will be the creation of the compiled version of the file
entitled SteamTables.m in the selected folder.
The creation of the help system is a bit more convoluted. To make the task easier, you
can use the worksheet, MakeHelp.ms, which you may have downloaded. The worksheet's
content is shown in the box below. You need to make appropriate changes in the various paths.
HOW TO IMPLEMENT THE HELP SYSTEM FOR THERMODYNAMIC PROPERTIES
This worksheet will guide you through the steps needed to establish the help library for SteamTables. This process
needs to be done only once. The help system is optional. The steam tables can be used without installing the help
system.
First, read into the worksheet the library program:
> readlib(makehelp);
proc(nm::name, file::name, lib::name) ... end
Haim H. Bau, Thermodynamics with Maple: Steam Tables (April 2, 2018) 3
Next, you will need to decide in which directory you wish to install the help system. For example, I installed my
help system in
E:\class work\THERMODYNAMICS\ThermoSoft\Compiled.
You will need to change the name of the folder as appropriate.
Note that file names containing characters special to Maple (such as backslash) must be preceded by a backslash
when entering the string in Maple.
> libname:=libname,`E:\class work\THERMODYNAMICS\ThermoSoft\Compiled`:
Next, we construct the help system for each of the functions.
> makehelp(`SteamTables`,`E:\\class
work\\THERMODYNAMICS\\ThermoSoft\\SourceCode\\SteamTablesHelp.mws`,`E:\\class
work\\THERMODYNAMICS\\ThermoSoft\\Compiled`):
> makehelp(`SpecificVolumeWater`,`E:\\class
work\\THERMODYNAMICS\\ThermoSoft\\SourceCode\\SpecificVolumeWaterHelp.mws`,`E:\\class
work\\THERMODYNAMICS\\ThermoSoft\\Compiled`):
> makehelp(`EnthalpyWater`,`E:\\class
work\\THERMODYNAMICS\\ThermoSoft\\SourceCode\\EnthalpyWaterHelp.mws`,`E:\\class
work\\THERMODYNAMICS\\ThermoSoft\\Compiled`):
> makehelp(`EntropyWater`,`E:\\class work\\THERMODYNAMICS\\ThermoSoft\\
SourceCode\\EntropyWaterHelp.mws`,`E:\\class work\\THERMODYNAMICS\\ThermoSoft\\Compiled`):
Maple will install the new file, maple.hdb, in the folder, E:\class
work\THERMODYNAMICS\ThermoSoft\Compiled.
To get help for a particular function, you may use the standard Maple Help command (?).
Type a (?) followed by the function name. Note that this command need not be terminated with
a semicolon (;).
For example, to obtain information about the contents of SteamTables, type:
> ? SteamTables
This will open a new window containing the following:
STEAM TABLES
Haim H. Bau, Thermodynamics with Maple: Steam Tables (April 2, 2018) 4
Formulas used in this package (except saturation temperature for water which is based on an equation
found in Steam and Gas Tables with Computer Equations by T.F. Irvine and P.E. Liley, Academic Press, 1984) are
based on equations found in: ASME Steam Tables: Thermodynamic And Transport Properties Of Steam:
Comprising Tables And Charts For Steam And Water, Calculated Using the 1967 IFC Formulation For Industrial
Use In Conformity With The 1963 International Skeleton Tables, prepared by C. A. Meyer, R. B., McClintock, G.
J. Silvestri and R. C. Spencer, Jr., Sixth Edition, ASME, 1993.
All rights are reserved.
This package consists of thermodynamic functions that return their corresponding values. The independent
variables should be supplied together with their units.
SI units are exclusively used!
To read the SteamTables into your Maple session, you will need to have a compiled version of
SteamTables on your hard disk and you will need to specify the appropriate path to the folder in which
SteamTables was saved.
> read 'path\\SteamTables.m';
For example,
> read 'E:\\class work\\THERMODYNAMICS\\ThermoSoft\\Compiled\\SteamTables.m';
The function included in this package are listed below. P is the pressure expressed in MPa, T is the
temperature expressed in degrees Kelvin (K).
SaturationPressureWater(T)
SaturationTemperatureWater(P)
SpecificVolumeSaturatedLiquidWater(T)
SpecificVolumeSaturatedVaporWater(T)
SpecificVolumeWater(P, T)
EnthalpySaturatedLiquidWater(T)
EnthalpySaturatedVaporWater(T)
EnthalpyWater(P, T)
EntropySaturatedLiquidWater(T)
EntropySaturatedVaporWater(T)
EntropyWater(P, T)
CriticalTemperatureWater
CriticalPressureWater
Haim H. Bau, Thermodynamics with Maple: Steam Tables (April 2, 2018) 5
CriticalSpecificVolumeWater
TriplePointTemperatureWater
TriplePointPressureWater
To see how each function operates, invoke individual help commands, i.e.,
> ?SpecificVolumeWater
The lengthy function names can be abbreviated through the use of an alias. For example,
the alias command,
> alias(v_v,SpecificVolumeSaturatedVaporWater);
allows one to use v_v(T) instead of the lengthier SpecificVolumeSaturatedVaporWater(T).
3. USING THERMODYNAMIC FUNCTIONS
In order to evaluate the various thermodynamics properties, you must load SteamTables
into your Maple worksheet. Once you have done so, the thermodynamic functions can be used
as you would any other builtin Maple™ functions. They can also be incorporated into user
defined functions or programs.
For your convenience, I created a worksheet template, WorkingwSteamTables, that will
allow you to execute all the necessary command at the beginning of the Maple session in which
you plan to evaluate thermodynamic properties. Remember to change the names of the paths to
accord with they way you have saved the different files on your computer.
Working with SteamTables
You may use this worksheet as a template. Just make sure to modify the various paths according to your machine
settings.
First, we need to read the package SteamTables into our worksheet. Note that file names containing characters
special to Maple (such as backslash) must be preceded by a backslash when entering the string in Maple.
> read `E:\\class work\\THERMODYNAMICS\\ThermoSoft\\Compiled\\SteamTables.m`;
Next, you will need to establish a path to where your library files are located.
> libname:=libname,`E:\\class work\\THERMODYNAMICS\\ThermoSoft\\Compiled`:
Haim H. Bau, Thermodynamics with Maple: Steam Tables (April 2, 2018) 6
Generally, it's a good idea to try to use one of the thermodynamic functions to make sure that everything works
properly.
> SpecificVolumeWater(.2*MPa,500*K);
3
m
1.144220489
kg
Now, you can modify this worksheet and save it under a separate title.
You may wish to save the worksheet under a different name so that the template remains
unaltered and ready for future use.
The simplest use of SteamTables is to evaluate the thermodynamic properties of various
states. This will save you from having to look up the data in tables and then interpolate it for
states that are not documented explicitly in the tables.
3.1 Evaluate the Saturation Temperature (K).
> SaturationTemperatureWater(0.1*MPa);
372.8717383 K
> SaturationTemperatureWater(.999*CriticalPressureWater);
647.366934 K
You may wish to convert the above value to degrees centigrade.
> ("273.15*K)*C/K;
374.216934 C
Try to calculate saturation temperatures at other pressures.
3.2 Find the Saturation Pressure Corresponding to 210 C.
Remember the temperature must be expressed in degrees K and the pressure in MPa.
> SaturationPressureWater((273.15+210)*K);
1.907739012 MPa
Haim H. Bau, Thermodynamics with Maple: Steam Tables (April 2, 2018) 7
3.3 Find the Saturation Pressure Corresponding to 500C.
Saturation conditions exist only in the range of temperatures between the triple and
critical points. Since the critical temperature of water is 647.3K<(500+273.15), the request is
meaningless. This is reflected in Maple's response.
> SaturationPressureWater((273.15+500)*K);
Temperature out of range
3.4 Find the Saturation Temperature Corresponding to a Pressure of 75 kPa.
> SaturationTemperatureWater(75.0*10^(3)*MPa);
365.0061712*K
NOTE: You need to put parentheses around the negative exponent; otherwise an error will result.
3.5 Find the Specific Volume (m^3/kg) of Superheated Steam at 400 C and 1.2 MPa.
> SpecificVolumeWater(1.2*MPa,(273.15+400)*K);
m3
.2547045825
kg
Note: The function SpecificVolumeWater evaluates the specific volume of superheated and sub
cooled liquid. If you happen to insert saturation conditions, the function will return two values.
The first one will correspond to saturated liquid and the second one will correspond to saturated
vapor.
> SpecificVolumeWater(SaturationPressureWater(400*K),400*K);
3 3
.001066995579 m , .7304193052 m
kg kg
4. ALIASES
We used a descriptive, longhand way to denote the various thermodynamic functions so
that they are easy to remember. The drawback of our scheme is that the function names are
lengthy and cumbersome to use. In situations when you are working with a single substance and
there is no risk of confusion, you may redefine the function name and use simpler notation or a
nickname. For example, below, we will use the alias command to tell Maple that the symbol v
and SpecificVolumeWater mean the same thing.
First, we demonstrate that Maple is not familiar with the function v.
> v(0.1*MPa,400*K);
v(.1*MPa,400*K)
Next, we define v as the alias of SpecificVolume.
> alias(v=SpecificVolumeWater):
Haim H. Bau, Thermodynamics with Maple: Steam Tables (April 2, 2018) 8
Now, every time we write "v," Maple knows that we mean SpecificVolume.
> v(0.1*MPa,400*K);
m3
1.825635334
kg
> SpecificVolumeSuperheatedWater(.1*MPa,400*K);
m3
1.825635334
kg
5. USING THERMODYNAMICS FUNCTIONS WITHIN PLOTTING ROUTINES
The thermodynamic functions can be incorporated into plotting routines so that one may
visualize the relationship between different factors that affect the thermodynamic properties. In
order to use a thermodynamic function in a plot routine, you must enclose the function and the
range within single quotes. The single quote (') must be there so that Maple™ delays the
evaluation of any Boolean statements within the function. Since the plotting command can plot
only numbers, we will have to peel off the units before we can carry out the plotting.
5.1 The Saturation Temperature as a Function of Pressure
For example, suppose we examine the relationship between saturation pressure and
saturation temperature. As you know by now, for simple compressible materials, the saturation
temperature and pressure are not independent. Once we specify the saturation temperature, we
uniquely determine the saturation pressure and the specific volume. The inverse is also true.
Now, suppose we plot the saturation pressure as a function of the temperature over the
range between the triple and the critical points. (Temperatures from 273.16 to 647 K)
> T1:=TriplePointTemperatureWater; T2:=CriticalTemperatureWater;
T1 := 273.16 K
T2 := 647.3 K
Note that the saturation pressure increases monotonically as a function of the temperature.
5.2 PLOTTING MORE THAN ONE FUNCTION ON THE SAME GRAPH
We may generate a similar graph for the specific volume of saturated water (liquid and
vapor). Since the specific volumes of liquid and vapor differ by two orders of magnitude, we
shall multiply the former by a factor of 1000.
> plot({'1000*SpecificVolumeSaturatedLiquidWater(T*K)*kg/m^3',
'SpecificVolumeSaturatedVaporWater(T*K)*kg/m^3'},T=T1/K .. T2/K, 0..20, title = `Specific
Volume vs. Temperature`, labels=[`Temperature(K)`,`v(m^3/kg)`]);
Haim H. Bau, Thermodynamics with Maple: Steam Tables (April 2, 2018) 10
Note that the specific volume of the liquid increases with the temperature while the
specific volume of the saturated vapor decreases with the temperature. Why?
Find the difference between the specific volumes at the critical point. Should there be a
difference in the values?
> SpecificVolumeSaturatedLiquidWater(T2)SpecificVolumeSaturatedVaporWater(T2);
3 3
.003175093426 m .003175093426 m
kg kg
1 2
It also may be interesting to depict the specific volume as a function of the pressure.
Unfortunately, the SteamTables do not provide us with an explicit relationship between specific
volume and pressure. However, below we shall see that this shortcoming can be overcome
without difficulty.
6. USING THERMODYNAMIC FUNCTIONS TO SOLVE SOME SIMPLE PROBLEMS
In this section, I demonstrate how Maple™, together with the SteamTables, can be used
to solve a few simple problems in thermodynamics. Feel free to make changes in problem
parameters. Explore how the results change as you change problem variables. You may also try
to solve problems different from the ones listed below. How about using Maple to help you
solve your homework problems?
In all the examples below, we will manipulate the units together with the numerical
values. This is a good practice that you should adopt in all your engineering calculations. This
way you will be able to make sure that all the units are consistent and that the results of the
calculations have the correct units. If the units are wrong, surely the result cannot be correct.
One of the advantages of using a symbolic manipulation package such as Maple is that it can
manipulate symbols just as well as it can manipulate numbers.
Problem 6.1: A vessel, having a volume of 0.4 m3, contains 2.0 kg of a liquid water and water
vapor mixture in equilibrium at a pressure of 600 k Pa.
Calculate the volume and mass of the liquid.
First, we list the available data:
> volume := 0.4*m^3: mass := 2*kg: Tsat := SaturationTemperatureWater(0.6*MPa): x:='x':
Haim H. Bau, Thermodynamics with Maple: Steam Tables (April 2, 2018) 11
NOTE: The colon is used to suppress the output. Next, we calculate the specific volume of the
mixture.
> specificvolume := volume/mass;
m3
specificvolume := .2000000000
kg
Then, we set up an equation (eq) for the specific volume with the only unknown being the
quality x. We solve for x using Maple™'s solve command. Using solve here may be an
overkill; but it will help us to familiarize ourselves with yet another Maple™ function.
> eq := (1x)*SpecificVolumeSaturatedLiquidWater(Tsat)+
x*SpecificVolumeSaturatedVaporWater(Tsat) = specificvolume;
( 1x ) m 3 x m3 m3
eq := .001100934992 .3149966234 .2000000000
kg kg kg
> x := solve(eq,x);
x := .6336470119
The mass of the liquid is (1x)*mass
> liquid_mass := (1x)*mass;
liquid_mass := .7327059762 kg
Note that in this example, we incorporated the thermodynamic function into the equation.
7. COMBINED FUNCTIONS
SteamTables and our thermodynamic functions are constructed in such a way that you
can explicitly obtain the specific volume of a saturated vapor once you know the saturation
temperature.
Suppose you wish to find the specific volume that corresponds to a given pressure. This
is easy. Once you know the pressure, you can calculate the saturation temperature (Tsat) and
insert its value in the function, SpecificVolumeSaturatedVaporWater(Tsat), to compute the
specific volume. Moreover, you can combine these two operations into a single one by using a
function within a function, i.e.,
> SpecificVolumeSaturatedVaporWater(SaturationTemperatureWater(0.1*MPa));
m3
1.688631059
kg
You may even define your own specific volume function to obtain the specific volume directly
as a function of the saturation pressure.
Haim H. Bau, Thermodynamics with Maple: Steam Tables (April 2, 2018) 12
> MyVgsp := psat > SpecificVolumeSaturatedVaporWater(SaturationTemperatureWater(psat));
MyVgsp := psatSpecificVolumeSaturatedVaporWater( SaturationTemperatureWater ( psat ) )
> MyVgsp(3.5*MPa);
m3
.05726890024
kg
8. IMPLICIT RELATIONSHIPS
A somewhat more difficult problem involves the determination of thermodynamic relationships
which are not given explicitly in the tables such as the saturation pressure as a function of the
specific volume or the temperature as a function of the pressure and specific volume. Under
these circumstances, when you are using the tables, you will need to resort to trial and error
techniques. As we shall see below, Maple™ offers us a more elegant solution.
Problem 8.1: Find the saturation temperature corresponding to a specific vapor volume of
0.02352 m^3/kg (the corresponding specific liquid volume is 0.001384 m^3/kg).
The problem is that we do not have an explicit expression which would give us the
SaturationTemperatureWater(v). Instead, we need to evaluate the transcendental relation
(*) SpecificVolumeSaturatedVaporWater(T)0.02352*m^3/kg=0
to find T. This is a single equation with a single unknown. The difficulty arises because the
function SpecificVolumeSaturatedVaporWater(T) is nonlinear. In other words, we need to find
the zero(es) of a transcendental equation.
It is always a good idea to plot the function so we can see how it behaves; see whether it has
multiple zeroes, one, or none; and obtain a rough estimate for the zero location.
To this end, we will plot
SpecificVolumeSaturatedVaporWater(T)*kg/m^30.02352
as a function of T and find the zero of this function (or the point at which the function crosses the
abscissa). In order to be able to plot, we need to peel off the nonnumerical parts of our
expressions (i.e., the units). Alternatively, we can write the expressions as nondimensional
quantities.
Haim H. Bau, Thermodynamics with Maple: Steam Tables (April 2, 2018) 13
First, we define the function f(T), where T is a pure number:
> fn := T > SpecificVolumeSaturatedVaporWater(T*K)/(.02352*m^3/kg)1:
> plot(fn,273.15+287..273.15+310,0.03..0.03,labels=[`T (K)`,`fn`]);
The figure suggests that the answer is Tsat~568K which, as we shall discover later, is not too bad
an estimate. We could have refined the result by zooming on the curve to blow it up in the
vicinity of the crossing point.
Although the above procedure shows us the qualitative behavior of specific volume as a function
of the temperature T, it is not a very efficient procedure for obtaining the actual numerical data.
To solve the equation fn(T)=0, we use the Maple numerical solver
>fsolve('fn(T)=0',T,500..600);
568.1314801
It is always a good practice to check the results.
> fn(");
.13 10 8
Close enough!