Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
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 i
n 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 thermody
namic 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,
Ac
ademic 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 1
963 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 press
ure) 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 e
vent, 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 TH
E STEAM TABLES
AND THE HELP SYSTEM
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,
Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
2
SpecificVolumeWaterHelp.ms, EntropyWaterHelp.ms, Working

w

SteamTables.mws, and
MakeHelp.mws. SteamTablesHelp.ms contains the various functions for the evaluation of
the
rmodynamic properties. MakeHelp.ms describes how to install the optional help system for
SteamTables. Working

w

SteamTables.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 th
e 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
includi
ng 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 i
s 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 H
ELP 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 inst
alling the help
system.
First, read into the worksheet the library program:
> readlib(makehelp);
proc(nm::name, file::name, lib::name) ... end
Next, you will need to decide in which directory you wish to install the help system. For exam
ple, I installed my help
system in
E:
\
class work
\
THERMODYNAMICS
\
ThermoSoft
\
Compiled.
Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
3
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 bac
kslash
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
\
\
SourceC
ode
\
\
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
\
\
Entro
pyWaterHelp.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 He
lp 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 conta
ining the following:
STEAM TABLES
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 Table
s
, prepared by C. A. Meyer, R. B., McClintock, G. J. Silvestri and R. C. Spencer,
Jr., Sixth Edition, ASME, 1993.
Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
4
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 t
he 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)
EnthalpyS
aturatedVaporWater(T)
EnthalpyWater(P, T)
EntropySaturatedLiquidWater(T)
EntropySaturatedVaporWater(T)
EntropyWater(P, T)
CriticalTemperatureWater
CriticalPressureWater
CriticalSpecificVolumeWater
TriplePointTemperatureWater
TriplePointPressureWater
To se
e 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,
Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
5
> alias(v_v,SpecificVolumeSaturatedVaporWater);
allow
s one to use v_v(T) instead of the lengthier SpecificVolumeSaturatedVaporWater(T).
3. USING THERMODYNAM
IC FUNCTIONS
In order to evaluate the various thermodynamics properties, you must load SteamTables into
your Maple worksheet. Once you have done so,
the thermody
namic functions can be used as you
would any other built

in Maple™ functions. They can also be incorporated into user

defined functions
or programs.
For your convenience, I created a worksheet template, Working

w

SteamTables, that will
allow you to execu
te 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`:
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.
Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
6
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*Critica
lPressureWater);
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
3.3 Find the Saturation Pressure Corresponding to 500C.
Saturation conditions exist only in the range of temperatures be
tween 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 S
aturation 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.
Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
7
3.5 Find the Specific Volume (m^3/k
g) of Superheated Steam at 400 C and 1.2 MPa.
> SpecificVolumeWater(1.2*MPa,(273.15+400)*K);
Note: The function SpecificVolumeWater evaluates the specific volume of superheated and sub

cooled
liquid. If you happen to insert saturation conditions, the f
unction 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);
4. ALIASES
We used a descriptive, longhand way to den
ote 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
confus
ion, you may re

define 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 fami
liar 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):
Now, every time we write "v," Maple knows that we mean SpecificVolume.
> v(0.1*MPa,400*K);
>
SpecificVolumeSu
perheatedWater(.1*MPa,400*K);
5. USING THERMODYNAM
ICS 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 thermod
ynamic properties. In order to
Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
8
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;
>
plot('SaturationPressureWater(T*K)/MPa',T=T1/K..T2/K,title=`Saturation Pressure vs.
Temperature`, labels=[`Temperature (K)`,`
p (MPa)`]);
Note that the saturation pressure increases monotonically as a function of the temperature.
Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
9
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)`]);
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);
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 TH
ERMODYNAMIC FUNCTION
S TO SOLVE SOME SIMP
LE 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.
Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
10
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 w
ith 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 th
e 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 m
3
, 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 := SaturationTemperatu
reWater(0.6*MPa): x:='x':
NOTE: The colon is used to suppress the output. Next, we calculate the specific volume of the
mixture.
>
specificvolume := volume/mass;
Then, we set up an equation (eq) for the specific volume with the only unknown being the q
uality 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 := (1

x)*SpecificVolumeSaturatedLiquidWater(Tsat)+
x*SpecificVolumeSatura
tedVaporWater(Tsat) = specificvolume;
>
x := solve(eq,x);
The mass of the liquid is (1

x)*mass
>
liquid_mass := (1

x)*mass;
Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
11
Note that in this example, we incorporated the thermodynamic function into the equation.
7. COMBINED FUNCTION
S
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 press
ure. 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 operati
ons into a single one by using a function within a function,
i.e.,
>
SpecificVolumeSaturatedVaporWater(SaturationTemperatureWater(0.1*MPa));
You may even define your own specific volume function to obtain the specific volume directly as a
function of th
e saturation pressure.
>
MyVgsp := psat

> SpecificVolumeSaturatedVaporWater(SaturationTemperatureWater(psat));
>
MyVgsp(3.5*MPa);
8. IMPLICIT RELATION
SHIPS
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).
Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
12
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^3

0.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 non

numerical parts of our expressions
(i.e., the units). Alternatively, we can write the expressions as
nondimensional quantities.
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`]);
Haim H. Bau, Thermodynamics with Maple: Steam Tables (
October 28, 2013
)
13
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 b
ehavior 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 i
s always a good practice to check the results.
>
fn(");
Close enough!
Enter the password to open this PDF file:
File name:

File size:

Title:

Author:

Subject:

Keywords:

Creation Date:

Modification Date:

Creator:

PDF Producer:

PDF Version:

Page Count:

Preparing document for printing…
0%
Σχόλια 0
Συνδεθείτε για να κοινοποιήσετε σχόλιο