Mastering-EES-Chapter1
Mastering-EES-Chapter1
4 x=0.25 cm
3 x=0.5 cm
x=0.75 cm
2 x=1.0 cm
x=1.5 cm
1 x=2.0 cm
0
0 25 50 75 100 125 150
Time (s)
400
380
10 MPa
360 8 MPa
Temperature (K)
6 MPa
340 4 MPa
320
300
280
260
-1750 -1500 -1250 -1000 -750 -500
Specific entropy (J/kg-K)
© S.A. Klein and G.F. Nellis, 2012-21
F-Chart Software
Box 44042
Madison, WI 53744
http://fchartsoftware.com
Starting with version 9.370, EES provides a Mastering EES menu item in the Help menu. If
the Mastering-EES.pdf file is placed in the same directory as the EES application, selecting
the Mastering EES menu item will start Adobe Reader, open the Mastering-EES.pdf file and
automatically enter the password.
TABLE OF CONTENTS
Acquiring EES
EES is licensed and distributed solely by F-Chart Software LLC. A license for EES can be
purchased directly from the company website, http://fchartsoftware.com. Single and multi-user
licenses are available. In addition, the company offers academic licenses for educational
institutions involved in formal classroom instruction and academic research leading to a degree.
Details and costs for the different license options can be found at http://fchartsoftware.com/ees/.
If you do not have access to EES, you can download a demonstration copy of the program from
http://fchartsoftware.com/ees/demo.php. The demonstration copy will allow you to examine
most of the features and examples that are provided in this book.
Commercial and Professional versions are available. The Commercial version provides all of the
basic functionality of EES, includes the ability to solve 6000 simultaneous equations and allows
access high accuracy property information. It can be used to conduct parametric studies, do unit
conversion and check unit consistency, provide publication quality plots, perform uncertainty
analyses, and many other things.
The current versions of EES are 32-bit Windows executable programs that are designed to run on
all modern 32 and 64-bit Windows operating systems such as Windows XP, Windows 7, 8 and
10. There is also a 64-bit Professional version of EES, as described in Appendix G.
Installing EES
Installing EES is relatively straightforward, but there are a few options that merit discussion. To
install the program, you will need both the Setup_EES.exe and EES.dft files. These files should
have been provided to you when you purchased the program or by a system administrator if you
obtained the program from your company or institution. There are a few institutions where the
EES.dft file has already been bundled with the setup file. Execute the Setup_EES.exe program
and click the Next button from the Welcome screen. Read the license agreement and, if you
agree, click the I Agree button and then click the Next button. Continue to click the Next button
until you see the Select Destination Directory dialog, shown in Figure 1-1.
The default directory that EES will be installed into is named EES32. EES is a 32-bit program,
but it will operate on all modern 32-bit and 64-bit Windows operating systems. (See Appendix
G for information on the 64-bit Professional version.) You can change the directory name, if you
wish, by clicking the Browse button. Depending on the particular installation program, you will
need to copy the EES.dft file to the directory that you choose to install EES. Click the Next
button after you have selected the directory.
The next window, shown in Figure 1-2, provides several installation options. If selected, the
Install Heat Transfer Library option will install an extensive set of library functions that facilitate
heat transfer calculations. These functions have been developed to accompany the text book
Heat Transfer, by G. F. Nellis and S.A. Klein (2009). Selection of this option is recommended
unless you are sure that you will never be doing any heat transfer calculations. A discussion of
these library functions is provided in Chapter 12.
Chapter 1: Introduction to EES 3
EES allows you to save custom Units and Constants files as discussed in Sections 1.5 and 1.9. If
you have done this, unselect the Overwrite Units files and Overwrite Constants.txt file in Figure
1-2. Otherwise these files will be replaced by the files in the installation program.
Clicking the Next button will install the program. If EES fails to start, the most likely problem is
that the EES.dft file is not contained in the directory that the program was installed into. In this
case, copy the EES.dft into the install directory and then restart EES by double-clicking on the
EES.exe icon or by entering C:\EES32\EES.exe in the Windows run dialog.
Silent Installation
It is possible to install EES silently, so that it installs the program with the default options and
without displaying any confirmation windows. To do a silent install, enter:
C:\myDir\Setup_EES.exe /s
into the Windows Run dialog after replacing myDir with the directory name where the
Setup_EES.exe program is located. By default, EES will place the program in the C:\EES32
directory (for the 32-bit version) or in the C:\EES64 dir (for the 64-bit version).
Online Help
Extensive online help is provided with the EES program installation. The index page for this
help file is shown in Figure 1-3. The online help can be made visible by selecting Help Index
from the Help menu or by pressing the F1 key. The help file is heavily hyperlinked. Clicking on
a word shown in blue font will move the display focus to that subject. There is also a Contents
box and an Index in the left pane of the Help window, as seen in Figure 1-3. Clicking on any
item in the Contents box will link directly to page for that item. The Index page allows you to
search for a specified keyword.
4 Chapter 1: Introduction to EES
Online help information for built-in and library functions can accessed by selecting the function
name in the Equations window (e.g., by double-clicking) followed by a right-click to bring up a
popup menu. Help for the selected function will be one of the options.
The EES help is in file EES.chm. The .chm extension stands for compiled HTML file and it is
the preferred method for distributing online help for Windows programs. However, some
networks do not allow .chm files to be transferred from a server to a client computer due to
possible security concerns. If you find that the online help is not working, we recommend that
you contact your Information Technology person, as this problem can be resolved. (See
http://www.helpscribble.com/chmnetwork.html or http://support.microsoft.com/kb/896358).
However, the EES help files are also located on the F-Chart Website on page
http://fchartsoftware.com/ees/eeshelp/ees_help_index.htm, which provides an alternative if the
EES.chm file is not made available. Note that the online help file has a Search tab that can be
used to search for keywords.
Several other methods of providing help are available within EES. They can all be accessed
from the Help menu. The EES manual is a .pdf file that is provided with EES and also available
on the F-Chart web site on page http://fchartsoftware.com/assets/downloads/ees_manual.pdf.
The manual can be accessed with the EES manual command if the manual is placed in the same
folder as the EES application.
The Mastering EES eBook that you are currently reading can also be accessed from the Help
menu by selecting the Mastering EES menu command. Accessing Mastering EES in this manner
requires that the Mastering-EES.pdf file be placed in the same folder as the EES application.
EES will attempt to automatically enter the password when this menu command is selected.
Note that there is a Check for New Mastering EES command in the Help menu. Selecting this
command will check to see if a newer version of the Mastering EES ebook is available and if so,
provide the option to download it from the website.
A number of short YouTube tutorials have been prepared directed to particular skills in EES,
such as plotting, using Parametric tables, and checking units. These tutorials can be accessed
from the YouTube Tutorials command in the Help menu.
Chapter 1: Introduction to EES 5
Entering Equations
Consider the following set of equations:
x y 3 (1-1)
y z4 (1-2)
z x2 3 (1-3)
Equations (1-1) through (1-3) are three non-linear equations in the three unknowns x, y, and z.
However, they are not directly solvable using most formal programming languages (e.g.,
MATLAB or Fortran) because they are equations rather than assignments. In order to solve this
system of equations using a formal programming language, it would be necessary to either
employ an iterative solution technique (e.g., successive substitution) or carry out sufficient
algebra to convert the equations into assignments. Let's take the latter approach here.
Substituting Eq. (1-3) into Eq. (1-2) provides:
y x2 3 4 (1-4)
x x2 7 3 (1-5)
x 2 x 10 0 (1-6)
Equation (1-6) is a quadratic equation that can be solved using the quadratic formula:
1 12 4 10
x (1-7)
2
Chapter 1: Introduction to EES 7
At its most fundamental level, EES is an equation solver that solves sets of nonlinear equations
directly. For example, the three equations (1-1) through (1-3) can be entered directly into the
Equations Window, as shown in Figure 1-4.
Figure 1-4: Equations Window with Eqs. (1-1) through (1-3) entered.
In this book, text that is entered in the Equations Window will be shaded, as shown below.
x+y=3
y=z-4
z=x^2-3
The Variable Information palette appears to the right of the Equations window. It shows the
variables that have been defined and their units. Click the Update button to update the palette to
the current contents of the Equations window. Slide the bar that separates the Equations window
and the palette left or right to adjust the size of the palette. Variable information for the Main
Program is shown by default. Click the Menu button to show variable information for
Procedures, Functions, Subprograms and Modules that are defined in the Equations window.
Figure 1-5: Equations Window after clicking the Update button in the Variable Information palette
8 Chapter 1: Introduction to EES
EES has identified one of the two solutions to the equation set. The other solution can be found
by changing guess values, as explained below. The process of solving the equations was done
internally; the user is not required to carry out any algebra or iteration.
There are several ways to view or change variable information. The simplest is to simply click
the mouse button on the variable name in the Variable Information palette. This action will
bring up the information for this one variable, as shown in Figure 1-9. The guess value, limits
units, alternate units and other information can be viewed or changed for the selected variable in
this dialog.
Figure 1-9: Dialog that appears after clicking on a variable in the Variable Information palette
Selecting the Hilite vars used once control in the Varialble Palette will highlite variable in the
selected program unit with a buff yellow background. For example, add the equation, xy=x+y to
the equations shown in Figure 1-5. Click the Hilite var used once button and the display will
appear as seen in Figure 1-10. Variables that are used only once are sometimes the result of a
typing error and highlighting them may help identify such problems.
10 Chapter 1: Introduction to EES
Note that the Variable Information dialog can be used as a smart Find command. Right-clicking
on a variable in the palette will locate it in the Equations window. Right-clicking on the variable
a second time will find the next occurrence of the variables.
In some cases, it is more convenient to display the variable information for all variables in the
program unit. This can be accomplished by selecting Variable Info from the Options menu (or
by pressing F9 or by right-clicking the Update button in the Variable Information palette.) The
full Variable Information dialog will appear, as shown in Figure 1-11. Use the mouse wheel to
scroll through long lists of variables.
Guess Values
There is a row corresponding to each of the three variables that make up the problem. Columns
allow the user to change various characteristics of these variables. The first column corresponds
to the guess values for each variable; these are the values used to start the iterative solution
process. By default, the guess value for each variable is 1. Note that x = 1, y = 1, and z = 1 is not
the correct solution, but it is closer to the solution x = 2.702, y = 0.2984, and z = 4.298 than it is
to the alternative solution x = -3.702, y = 6.702, and z = 10.7. In order to converge to the other
solution, it is necessary to change the guess values. For example, change the guess value of x to
something closer to x = -3.702 (e.g., -5), select OK and press F2 (the shortcut for the Solve
command). The solution identified by EES is shown in Figure 1-12. Guess values can also be
provided using other EES variables or equations, as described in Section 5.3.
Chapter 1: Introduction to EES 11
Limits
Lower and upper limits for each variable can also be set in the Variable Information Window.
For example, in order to identify only a solution for which the value of x is negative, the Variable
Information Window could have been set up as shown in Figure 1-13.
Figure 1-13: Variable Information Window with limits set for the variable x.
Display Format
All EES numerical values use double precision that internally provides 20 (32-bit version) or 16
(64-bit version) significant figures of precision. Tthe display format can be separately specified
for each variable. The available display formats are shown in Table 1-1.
In the Variable Information dialog, the display format is controlled by three columns under the
word Display. The first column indicates the format using the letter in the first column of Table
1-1. The number of significant figures or decimal digits is controlled with the entry in the second
12 Chapter 1: Introduction to EES
column. This can be an integer between 0 and 9 or the letter ‘M’, which indicates the maximum
number of significant figures. The third column provides additional formatting options such as
underline, box, italic, etc.
For example, the A in the first of the three columns under the word Display in Figure 1-13
indicates Auto format. This is the default format. In this case, EES selects the number of
significant figures and the value in the second column cannot be changed. Click on the A in the
second row of the able and select F. Select 9 from the second column and Boxed from the third
column so that the dialog appears as in Figure 1-14.
Figure 1-14: Variable Information dialog with format specified for variable y.
Click OK and then solve the equations, The Solutions window will appear as in Figure 1-15.
Figure 1-15: Solutions Window with an altered format for the variable y.
The display format can also be set directly in the Solution Window by right-clicking on a
variable. This will will bring up the Specify Format and Units dialog where the format for the
selected variable(s) can be directly entered.
The units column shows the units that have been entered for the variables. Units can be entered
directly into the column. Note that Units header is a drop down list. Clicking the arrow to the
right of Units allows for a selection of displaying/entering the base or alternative units.
Chapter 1: Introduction to EES 13
y=z-4
x+y=3
x^2-3=z
The Equations Window functions a lot like a word processor. You can use the cut (Ctrl+X),
copy (Ctrl+C), paste (Ctrl+V), Find, Replace, and undo (Ctrl-Z) commands just as you would in
Microsoft Word® or other programs that manipulate text. Multiple undo/redo capability is
provided for up to 32 changes. Equations are typically entered one per line; however, multiple
equations can be entered on the same line provided that they are separated by a semicolon (or a
colon if you are using European format):
The mathematical operators and order of operation used in the equations are consistent with
those used by most any programming language. For example, the equation:
a=2^3+3*4+2
will result in a = 22. Variable names in EES must start with a letter but they can include any
U.S. keyboard character except ( ) * / + - { } or ;. EES is case-insensitive; that is, the symbols x
and X are interpreted to be the same variable in the Equations Window. Very long equations can
be broken into two lines for ease of reading or improved printing by using the ampersand (&).
Our example doesn't include any long equations, but we could still break the first equation into
two lines according to:
x+y&
=3
y=z-4
z=x^2-3
Comments
It is good practice to annotate your EES code in order to clarify the meaning behind the equation
set. Typically each equation is followed by a comment that is ignored by the equation solver
itself but is visible to the user. Comments in the Equations Window should be enclosed either in
curly braces or quotes. Any line that begins with two forward slashes is also considered a
comment. The comments are displayed in blue (by default) in the Equations Window to indicate
that they are not part of the equation set that will be solved. Comments that begin with the !
character (referred to as comment type 2) are displayed in red by default. The default colors for
comments can be changed in the Equations tab of the Preferences dialog (Options menu).
Occasionally it will be useful to temporarily remove an equation or a group of equations from the
Equations Window. Of course, you could just delete the equation(s) and then type them back in
if and when they are needed again. However, a better solution is to "comment them out".
Highlight the equation(s) to be removed and then right-click to bring up a pop-up menu, as
shown in Figure 1-16. Select Comment {} in order to place curly brackets around the entire
section of highlighted code, temporarily removing it from the equation set. To restore the
equation(s), highlight the commented code, right-click and select Undo Comment {}.
Visible Hyperlinks
EES will automatically recognize hyperlinks that begin with http:\\, https:\\, or file: For example,
enter:
"http:\\fchartsoftware.com"
and notice that it becomes a link to that web page. A summary of the recognized visible hyper
link keywords is provided in Table 1-2.
Chapter 1: Introduction to EES 15
Hidden Hyperlinks
Hidden hyperlinks do not display the link itself. Instead, the selected text that, when clicked,
will execute the link is displayed with an underline font. Hidden hyperlinks can only be added
with the Professional version, but once added, they can be used in both the Commercial and
Professional versions. To enter a hidden hyperlink, select the text that is to be associated with
the link. Then click the right mouse button and select the Insert Link command from the popup
menu (Figure 1-17). This will bring up a dialog in which you enter the hyperlink.
Figure 1-17: Inserting a hyperlink into the Equations Window (Professional version)
Clicking on this text in the Equations window will launch the link. The link will also be
available in the Formatted Equations window. Syntax highlighting must be on in order for the
links to be active. Syntax highlighting can be toggled on/off by clicking on the control at the
bottom right of the Equations window. Note. You can edit the text without launching the link
by holding the Ctrl key down when selecting the text. A hidden hyperlink can be removed by
selecting the link and then clicking the Link button or by right-clicking the link and selecting
16 Chapter 1: Introduction to EES
Remove Link from the popup menu. The link can also be removed by deleting the text
associated with the link, including the spaces before and after the text.
The built-in math functions can be conveniently accessed by selecting Function Information
from the Options menu, which displays the Function Information dialog appearing in Figure 1-
18. By default, all the built-in math and string functions are initially shown in the list on the left
side of the dialog. The list of functions can be reduced by selecting a function classification
from the list on the right side. An example of the proper use of the selected function is shown in
the Ex: edit control at the bottom of the dialog. The text in the Ex: edit control can be edited in
the conventional manner. Clicking the Paste button will paste the contents of this control into
the Equations Window at the current cursor position.
Figure 1-18: Function Information dialog showing math and string functions.
String Variables
EES provides both numerical and string variables. A string variable is identified with a variable
name that ends with the $ character. The variable name must begin with a letter and consist of
30 or fewer characters, including the $ character. String variables can be set to string constants,
which are strings that enclosed with single quote marks.
A$ = 'carbon dioxide'
String variables can be used in EES equations anywhere in which character information is
provided. For example the name of a fluid provided to a thermophysical property function may
be a string variable, as shown in Section 4.3. A string variable may be used to supply the units
of other variables, as shown in Section 1.5. String variables may be passed as arguments to
internal functions, procedures, modules, and subprograms or to external functions and
procedures as described in Chapters 3 and 10. String variables are very useful in the Diagram
window, as shown in Chapter 15. String functions are provided to manipulate string variables
and to convert them to or from numerical values. A complete list of string functions is provided
in Appendix B. String functions can be accessed from the Function Information dialog, as
shown in Figure 1-18.
18 Chapter 1: Introduction to EES
where TabStop1, TabStop2, etc. are numerical values corresponding to the desired positions of the
tabs and Units indicates the units used for the tabs. The value of Units must either be in (for inch)
or cm (for centimeter). The code below sets two tab stops at 1 inch and 2 inch; notice that the
locations of the comments have shifted to 1 inch, which is consistent with the first tab stop set in
the $TabStops directive.
$TabStops 1 2 in
Clicking the mouse button in the first panel (B|W) toggles the screen between a white and black
background for the Equations, Formatted Equations, Solutions, and Residuals windows. The
default text colors are adjusted to ensure readability (Figure 1-20) and they can be further
adjusted in the Display tab of the Preferences dialog (Figure 1-21).
The second panel will display either US or EU. If US is displayed, the decimal separator is the
decimal point; otherwise it is a comma. The next panel displays the line and character on that
line at which the cursor is positioned. The various values of the current settings are displayed in
subsequent panels on the status bar, including the word wrap, overwrite, and caps lock settings.
Clicking the mouse button with the cursor positioned in any of these panels allows the settings to
be changed. The current unit system (discussed in Section 1.5) is displayed. The Warning panel
controls whether or not a window showing any warnings messages will be automatically
displayed after calculations are completed. These warnings can be manually displayed by
selecting Warnings from the Windows menu. The next two panels indicate whether unit
checking, and complex algebra are currently activated. The last panel toggles the syntax
highlighting setting. See section 1.9 for information relating to syntax highlighting.
Equations window are normally wrapped. This option is controlled by the Wrap setting in the
Equations window status bar at the bottom of the Equations window. If the Display line-break
indicator control is checked, a red hyphen will appear in the left margin to indicate that this line
continues from the one above. The Display uniform case for variable names will set the upper-
lower case of the a variable name to the way it is first entered. Up to five tab stops can be set in
this dialog in either centimeters or inches. (Click cm or in to toggle the unit setting.) If the
Preferences are stored, using the Store button, these settings will be the defaults. Up to 25 tab
stops can also be set with the $TabStops directive. See section 1.9 for more detail on syntax
settings.
Additional display setting are provided on the Display page shown in Figure 1-22. The font type
and size affects the font in all of the windows - not just the Equations window. There are two
types of comments. Comments that begin with an explanation character (!) can have a different
color then normal comments. For late-night coders, the background color for the Equations,
Solutions, Formatted Equations and Residuals windows can be set to black using the toggle
control at the bottom of the dialog. The background can also be set by clicking in the first pane
of the the status bar at the bottom of the Equations window.
Chapter 1: Introduction to EES 21
The settings on the Options page are shown with their default settings in Figure 1-23. An
explanation of each option follows:
Autosave every XXX minutes instructs EES to save the .EES. The information is saved to a
temporary .EES file that has the same name as the open EES file, but with a tilde (~) preceding
the filename. The autosave file is deleted when a new file is created or opened or when EES is
closed at the end of the work session, so do not depend upon it for permanent storage. You
should always save any file that you intend to use at a later time using the Save or Save As
commands. However, if EES quits unexpectedly, the last saved copy of the backup file should
still be available in your directory.
22 Chapter 1: Introduction to EES
Hide Solution window after change will cause the Solution, Arrays and Residuals windows to be
hidden if a change is made to the Equations window after a calculation is completed.
Include a Sum row in the Parametric Table will display the sum of the values in each column of
the Parametric Table in the bottom row of the table. The values in the Sum row are updated after
the calculations are completed. The option can also be turned on or off with the $SUMROW
directive.
Put Main array variables in the Arrays Table allows array variables (variables that include
brackets surrounding a subscript number) to be displayed in the Arrays table window, rather than
in the Solutions window. The Arrays table window will be automatically created after
calculations are completed showing all array values used in the Main program with the array
index value in the first column. This option can also be turned on or off with the $ARRAYS
directive. Note that the array variables in Functions, Procedures, Subprograms, and Modules can
also be displayed in separate tabbed windows of the Arrays table window by using the
$ARRAYS directive.
Display warning messages controls the default behavior of whether or not warning messages will
be displayed after calculations are completed. Warning messages may be generated internally if,
for example, thermodynamic property correlations are being applied beyond their range of
applicability, or by the user with the WARNING procedure. This option can also be turned on or
off with the $WARNINGS directive or with the control in the status bar of the Equations
window.
Maintain a list of most recent files in File menu will, if selected, provide menu items for up to
eight recently opened files. Selecting any of these menu items will open the corresponding file,
just as if the Open command were selected.
Display menu speedbar will present a series of buttons on a palette directly below the main
menu. These buttons provide quick access to the most frequently applied EES menu commands.
will check the unit consistency of each equation after calculations are
Check units automatically
completed. This option can also be invoked from the Equations window with the
$CHECKUNITS directive or by clicking the Unit Chk control in the status bar at the bottom of
the Equations window.
Auto set array units will set the units (and alternate units) of every variable in an array to the
units of the first array variable. This action occurs when the Arrays table is displayed and when
Chapter 1: Introduction to EES 23
exiting the Variable Information dialog after clicking the OK button. This setting can also be
made using the $AutoSetArrayUnits directive.
Set units automatically when possible will, if enabled, cause EES to enter the units of variables
for which the units have not been previously specified. Units will be set only when a variable is
by itself on the left hand side of an equal sign and a unit warning would otherwise occur. Note
that the same effect can be accomplished using the $AutoSetUnits directive.
Use enhanced convergence techniques will algebraically rearrange equations into equivalent
forms that converge more readily, reducing the need to provide guess values.
The Formatted Equations window is particularly useful for viewing large equations with multiple
parentheses. For example, consider the equation:
1.25 64 3.44
4 3.44 4 L 4 L
f (1-10)
ReD 0.00021
L 1
L
2
Equation (1-10) is the correlation provided by Shah and London (1978) for the average friction
factor associated with developing flow in a round tube. The symbol ReD is the Reynolds number
and L+ is the dimensionless length of the tube. This correlation can be entered in the Equations
24 Chapter 1: Introduction to EES
Window as shown below. Note that Chapter 12 discusses the EES heat transfer library which
implements this and other useful correlations automatically.
The equation for f is difficult to read or debug in the word processing format used by the
Equations Window. It is much easier to view in the Formatted Equations Window, as shown in
Figure 1-25.
Notice that the symbol f_bar is interpreted as f with an overbar in the Formatted Equations
Window. Similarly Re_D is interpreted as Re with a subscript D and L|plus is interpreted as L
with a superscript +. Greek symbols are also interpreted correctly; notice that the variable sigma
is interpreted as . The formatting options that are available are summarized in Table 1-3.
Section 1.6 shows how equations in the Formatted Equations Window can be copied in various
formats in order to facilitate writing reports or papers.
Password Protection
In the Professional version of EES, it is possible to password protect the Equations Window so
that only you can edit it. Right click in the Equations Window and select Protected from the
resulting pop-up menu. You will be prompted to enter and then re-enter a password, after which
the background color will change to indicate that the text is now read only. Any subsequent
attempt to edit the protected regions of the Equations Window will not be allowed until you
unprotect the text. The text can be unprotected by right clicking on it and selecting Protected, at
which time you must enter the password.
26 Chapter 1: Introduction to EES
Key Variables
The Solution Window in a large EES program will contain many variables. Variables are listed
in alphabetical order; however, it may be difficult to quickly and easily identify the small subset
of variables that are of particular interest. To focus attention on a particular variable, it is
possible to highlight its appearance. For example, open the example file named Dinner.ees
located in the Userlib\Examples folder within the folder containing the EES application. (In the
64-bit version, the file will be named Dinner.ees64 and located in the \Userlib64\Examples
folder.) You can access the example directly by selecting Getting Started with EES from the
Examples menu at the right of the menu bar and then selecting “Settling the bill”. Solve the
equations by pressing F2 and the Solution Window should appear. Select the variable Debbie in
the Solution Window and right-click on it. The Specify Format and Units dialog that appears is
shown in Figure 1-27.
The Specify Format and Units dialog allows you to change the formatting that is used to display
the variable in the Solutions Window. For example, you can box the variable and change its
background color. You can also select a subset of all of the variables in your Solution Window
and make them key variables. Select the variable of interest by clicking the mouse on it (or by
pressing the Tab key until the variable is selected). Then either press the Return key or press the
right mouse button. This action will display the Specify Format and Units dialog. Click the Key
Variable check box and an edit box will appear in which you can write some descriptive
comments about the variable, as shown in Figure 1-28. Select OK and you will see that a new
tab will appear in the Solutions Window allowing access to the Key Variables Window. All of
the variables that have been identified as key variables are placed in the Key Variable Window
together with their associated descriptive comments, as shown in Figure 1-29. The position of
each line in the Key Variable Window can be changed dragging the mouse, i.e., pressing and
holding the mouse button down on the desired line while moving the mouse to the new location.
Chapter 1: Introduction to EES 27
Note that you can customize the Key Variables window in several ways. Clicking the right
mouse will bring up a pop-up menu, as shown in Figure 1-30, that allows text, separators
(horizontal lines) and text centered within a separator to be added, edited or deleted. The first
menu command will differ depending on where the mouse was clicked. (In Figure 1-30, the
mouse was clicked on the text with separator). Text, headers, separators and new Key variables
initially appear above the item that receives the mouse click. Clicking at the bottom of the
window below all other items allows new items to be entered at the bottom of the list. However,
the order in which the items initially appear is not fixed. All items in the Key Variables window
can be 'dragged' to a different location by pressing and holding the left mouse down on the item
that is to be moved while moving the cursor up or down, as illustrated in Figure 1-31.
Figure 1-30. Right-click in the Key Variables window to bring up a popup menu.
28 Chapter 1: Introduction to EES
Figure 1-31: Items in the Key Variables window can be 'dragged' to a different position.
u2
P K (1-11)
2
where u is the velocity of the water. The inputs are entered in the Equations Window; note that
we'll start with V = 100 liter/min and subsequently vary this value.
$TabStops 2.5 in
"Inputs"
K=0.3 "K factor for a 45 degree elbow, dimensionless"
V_dot=100 [liter/min] "volumetric flow rate
D=2 [cm] "inner diameter of elbow
rho=1000 [kg/m^3] "density of water"
In Section 1.5, we will discuss how EES can help you deal with unit assignments and
conversions. For now we'll have to keep track of units manually. Notice that the units assigned
to each variable are indicated in the associated comment. The cross sectional area of the elbow
is given by:
D2
Ac (1-12)
4
Chapter 1: Introduction to EES 29
The variable pi# is a built-in constant in EES corresponding to the value of (other built-in
constants are discussed in Section 1.9). The units of the variable A_c will be most useful if
converted from cm2 to m2. (See section 1.5 for details concerning unit conversion.)
As written, the units for the variable u must be liter/min (the units for the variable V_dot) divided
by m2 (the units for the variable A_c). Therefore, the units for u must liter/min-m2. Note that in
this book, the hyphen sign will be used to indicate multiplication on one side of the divisor in the
liter
context of units; therefore liter/min-m2 should be read as . EES uses the same
min m 2
convention for unit specifications, although the hyphen can be replaced with a space or a dot
(Alt-250 on a U.S. keyboard).
The units for the variable u, as calculated, are not useful; let's convert the units to m/s, which are
more reasonable:
liter 1m3 min m
2
0.00001667 (1-14)
min-m 1000 liter 60 s s
The EES code, with the unit conversion, is:
Again, the units for the variable DELTAP don't make a lot of sense; as calculated, the units are
(kg/m3)(m/s)2. Let's convert to kPa, which are more commonly used:
kg m 2 0.001 kPa
=0.001 kPa (1-15)
m3 s 2 kg/m-s 2
Notice that we had to look up four separate unit conversion factors in order to accomplish the
unit conversion indicated by Eq. (1-15). Section 1.5 shows that EES greatly reduces the hassle
and potential errors that are associated with working with units.
The window on the left side of the dialog provides a list of all of the variables that are included
in the Equations Window. Highlight the independent and dependent variables of interest (in this
case, the variables V_dot and DeltaP) by clicking on them and then select Add to add the variables
to the window on the right side, which lists variables to be included in the table. Any other
variables that you wish to include in the table can also be added. You can select the variables
one at a time or all at once. Select OK in order to create the Parametric Table, shown in Figure
1-33. By default, there are 10 runs (rows) in the table. Runs can be added or removed by
selecting Insert/Delete Runs from the Tables menu or by right-clicking on any run number and
selecting Insert Runs or Delete Runs. There is a column for each of the variables included in the
table. Columns can be added or deleted by selecting Insert/Delete Vars from the Tables menu or
right clicking on any variable and selecting Insert Column or Delete.
Alter Values
To carry out a parametric study in which the volumetric flow rate is changed, it is necessary to
fill in the column for the variable V_dot with flow rate values that are of interest. This process
can be done manually, one run at a time. More typically, you will right-click on the column of
interest and select Alter Values or click on the triangular icon in the column header to bring up
the dialog shown in Figure 1-34.
Select the rows to be filled in (rows 1 to 10, for this example) and the pattern to be used to enter
the values. In Figure 1-34, the dialog is filled in so that the volumetric flow rate varies from 200
liter/min (in row 1) to 2000 liter/min (in row 10) in equally spaced intervals, as shown in Figure
1-35. Other options can also be specified by clicking on the drop down menu under First Value.
For plots that will use a logarithmic scale, the selection Last (Log) is particularly useful as it
logarithmically spaces the values in the table.
In the Professional version, the value entered for Last Row (upper left of Figure 1-34) can be set
to value greater than the current number of rows in the Parametric table. After confirmation,
EES will extend the number of rows in the table to this value. The Professional version also
allows EES variables (in addition to numerical values) to provide the First Value Last/Increment
values.
32 Chapter 1: Introduction to EES
The dialog is initially set so that EES will start with run 1 and end with run 10. By pressing OK,
EES will go to run 1 of the Parametric Table shown in Figure 1-35 and find that the value of the
variable V_dot is set to 200. Therefore, you can imagine that EES places the following equation
in the Equations Window.
V_dot=100
already exists in the Equations Window. The variable V_dot cannot have multiple values as it
causes the equation set to be over-constrained (8 equations and 7 variables). Solving the table
will result in the error dialog shown in Figure 1-37.
This problem can be alleviated by commenting out the equation that specifies the volumetric
flow rate in the Equations Window. Highlight the statement, right-click, and select Comment {}
in order to temporarily remove it from the equation set.
Now solve the table to obtain the solved Parametric Table shown in Figure 1-38.
It will sometimes be useful to solve only a portion of the table. This is easily accomplished by
changing the first and last run numbers in the Solve Table dialog.
All tables in the Professional version are equipped with a column-sizing control that
automatically sets the required width of the columns in the table. The control is a double-headed
arrow appearing in the upper left cell of the table, as shown in Figure 1- 39. When it is not
enabled, the arrowheads are gray-filled as seen in Figure 1- 39a. Clicking on the control resizes
the columns so that contents of the column just fit. The arrowheads will then be filled with a
light blue color, Figure 1- 39b. Holding the Ctrl key while clicking on the control returns the
column widths to their default size.
34 Chapter 1: Introduction to EES
Figure 1- 39: Parametric table in Professional version showing column sizing control a) off and b) on
In the Professional version of EES, the start and stop values can be set to variables. For
example, add the lines:
Open the Parametric Table, right click on the DeltaP variable column and select Alter Values.
Select Clear Values to clear the column. Solve the table again. This time, click on the arrow
next to First Run Number and change it to First Run Variable and then select startrow. Change
Last Run Number to Last Run Variable and select endrow. The result is shown in Figure 1-40.
Select OK and you will see that only runs 3 through 7 have been filled in.
Figure 1-40: Solve Table dialog with first and last runs set with variables.
Chapter 1: Introduction to EES 35
Formatting Columns
The Parametric Table shows the value of pressure drop for each corresponding value of
volumetric flow rate. In Section 1.4 we will see how to use this information to prepare a plot.
Before we do that, let's look at some other features of Parametric Tables. The position of the
columns can be adjusted by dragging (i.e., pressing the left mouse button and then moving
mouse while holding down the mouse button) the column headers. The units, alternate units ,
and format of the columns can be adjusted by right-clicking on the column and selecting
Properties to bring up the Format Properties Table dialog shown in Figure 1-41 (for the column
corresponding to the variable DELTAP). The format used to display the results, the background
color, and the column width can also be adjusted. The column number can also be set in this
dialog. At the bottom of the dialog, statistics are provided for the entries in the column.
A more elegant method for removing one or more lines of code when a Parametric Table is being
solved is to use the $If directive. The $If directive is used according to:
$If Condition
line(s) of code to be executed if Condition is true
36 Chapter 1: Introduction to EES
$Else
line(s) of code to be executed if Condition is false
$EndIf
where Condition is a keyword that indicates an execution condition. There are many such
keywords recognized by EES and these are discussed in more detail in Chapter 14. One
keyword is ParametricTable, which evaluates to true when the equations are being solved from a
Parametric Table. For our problem, we want to specify the value of the variable V_dot in the
Equations Window only if the value of ParametricTable is false:
$If ParametricTable
$Else
V_dot=100 "volumetric flow rate, in liter per min"
$EndIf
$IfNot ParametricTable
V_dot=100 "volumetric flow rate, in liter per min"
$EndIf
You should find that your equation set now runs if you select either Solve or Solve Table from
the Calculate menu (or if you press either F2 or F3, respectively).
The table can be saved as a text (.txt) or comma separated values (.csv) file; either of these file
formats can be opened by most any other software or spreadsheet Section 1.8 provide details on
Lookup File formats. The table can also be saved in a format that can be reopened by a different
EES program as a Lookup Table (.lkt). Lookup Tables are discussed in Section 1.8. Finally,
data can also be saved as an .xlsx file using the Save Table command in the Tables menu to
allow exporting to Excel. In this case, the first row in the Excel file will be the name of the
column. The second row will be the units. The data in the table will start in the third row.
Lookup files saved in the format can be opened with the Open Lookup Table command. Note
that a Parametric table can also be saved as a .PAR file using the Store Parametric Table
command in the Tables menu. A .PAR file can only be read by EES. This format is useful if
you wish to move a Parametric table to another EES file.
Select Copy to place the information on the clipboard. Open another spreadsheet or word
processor and then paste the information. The result is shown in Figure 1-46(a) using Excel. If
the Copy with Headers option is selected then the header for each column is also copied; the
result is shown in Figure 1-46(b). Notice in both cases that the number of significant figures
associated with the data that is copied corresponds to the number of significant figures used to
display the information in the Parametric Table. If the Copy (E-format) option is selected then
the data are copied with 12 significant figures so that there is no loss of accuracy associated with
the copy/paste operation, as shown in Figure 1-46(c). The Copy Alt units command will copy
the numerical data in selected section of the table in the alternate units, if they are defined.
Otherwise, it will just act as the Copy command.
When the Copy command is issued, EES actually copies the data to the clipboard in two formats.
The first format uses the number of significant figures that are displayed and this is what appears
Chapter 1: Introduction to EES 39
in an external program. In the second format, EES retains all of the significant digits. If you
paste data from one column of a table to another (or to any other table in EES), EES will paste
the data with all of the significant figures so there is no loss in precision during the copy process.
Generating a Plot
To generate a plot, select New Plot Window from the Plots menu in order to access the New Plot
Setup dialog shown in Figure 1-47. At the top of the dialog you can provide a title (in the Tab
Name field) and some descriptive text. The upper right portion of the dialog is used to select the
source of the data; here it is a Parametric Table and the title of the table is DP. (Not that the New
Plot Setup window width can be increased by dragging the right side if needed to display long
table names.) As shown in Figure 1-47, the New Plot dialog is set up to plot all 10 rows in the
table but it is also possible to plot only a subset of the rows. The two windows in the dialog
allow you to specify the independent (X-Axis) and dependent (Y-Axis) data. Figure 1-47 shows
the New Plot dialog set up to plot the pressure loss as a function of the flow rate. Select OK to
create the plot, which is shown in Figure 1-48.
Note that in the Professional version, variables may be plotted in their base or alternate set of
units. Alternate units can be entered in the Format Table dialog, as shown in Section 1.5.
40 Chapter 1: Introduction to EES
Modifying Axes
Almost every aspect of the plot can be modified in order to customize or improve it. A detailed
discussion of plotting options is provided in Chapter 9. Some of the common options are
described in this section.
Double-click (or right-click) on either axis label to bring up the Format Text Item dialog. You
can change the axis label to a descriptive text with units and change the font. A gray triangular
icon is visible at the bottom right of the plot when the plot toolbar is visible. You can resize the
plot by selecting the gray triangle in the bottom right-corner and holding the mouse button down
on the icon while moving the mouse to an alternative location. Note that the size of all text and
graphic items in the plot changes in proportion to the size of the plot unless the Ctrl key is held
down during this process. The axis scale can be adjusted by placing the mouse over any of the
axes (left, right, bottom, or top) and clicking the right mouse button. This action will bring up
the Modify Axis dialog shown in Figure 1-49, which allows you to make adjustments in the axis
scale, add grid lines, etc.
An improved plot of pressure loss as a function of flow rate is shown in Figure 1-50(a). By
selecting the Automatic scaling option in the Modify Axis dialog, the axis scale will be
automatically adjusted to encompass the data being presented. The axis labels can be scaled by a
factor of 10, 100, 1000, etc. by adjusting the Scale by 10^ option; Figure 1-50(b) shows the result
of scaling the labels by 100 (102). Select the top to bottom option in the Modify Axis dialog in
order to invert the scale, as shown in Figure 1-50(c).
42 Chapter 1: Introduction to EES
x 102
2000 18
1800 16
1600 14
1400
12
1200
10
1000
8
800
6
600
4
400
200 2
0 0
0 200 400 600 800 1000 1200 1400 1600 1800 2000 0 200 400 600 800 1000 1200 1400 1600 1800 2000
Flow rate (liter/min) Flow rate (liter/min)
(a) (b)
200
400
Pressure loss (kPa)
600
800
1000
1200
1400
1600
1800
2000
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Flow rate (liter/min)
(c)
Figure 1-50: Improved plot of pressure loss as a function of flow rate (a) with default y-axis format, (b) with
y-axis scaled by a factor of 102, and (c) with y-axis scaled from top-to-bottom.
Note that the range of values included on the X or Y axis can also be changed without use of the
Modify Axis dialog. This is done by simply positioning the mouse cursor on an axis and
dragging it. For example, if you wish the starting value of Flow rate shown in Figure 1-50 to be
less that 0, move the mouse over the left Y axis. The cursor will change to a . Press and hold
the left mouse button while moving the most slightly to the left. Release the mouse when the
axis is in the desired position.
Chapter 1: Introduction to EES 43
Overlaying Plots
Multiple data series can be overlaid onto the same plot. Change the resistance coefficient to K =
0.4 and run the Parametric Table again. Select Overlay Plot from the Plots menu in order to plot
pressure loss as a function of flow rate for the adjusted value of K. Your plot should now have
two sets of data, as shown in Figure 1-51.
2000 2000
1800 1800
1600 1600
Pressure loss (kPa)
1200 1200
1000 1000
800 800
600 600
400 400
200 200
0 0
0 200 400 600 800 1000 1200 1400 1600 1800 2000 0 200 400 600 800 1000 1200 1400 1600 1800 2000
Flow rate (liter/min) Flow rate (liter/min)
(a) (b)
2000
1800
1600
K = 0.4
Pressure loss (kPa)
1400
1200 K = 0.3
1000
800
600
400
200
0
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Flow rate (liter/min)
(c)
Figure 1-51: Plot with two data series (a) unmodified, (b) with error bars, and (c) with text annotations.
Modifying Plots
Double click (or right click) anywhere on the plot (other than on a text or graphic item) in order
to access the Modify Plot dialog shown in Figure 1-52. This dialog allows you to add and adjust
grid lines and modify the border and size of the plot. The upper window lists all of the data
series that appear in the plot. You can delete one or more of these series by selecting Delete
44 Chapter 1: Introduction to EES
button. The underlying data set that is used in the plot to can be extracted to a Lookup Table by
selecting Get Data button. The characteristics of each data series (e.g., the line thickness, color,
symbols, etc.) can be adjusted. The Smoothing option allows you to adjust the line passing
through the data using either a cubic spline, polynomial fit, or moving average.
The parameters in the Border box allow setting of the upper left corner of the plot and its width
and height. These width and height can also be changed by dragging the lower right corner of
the plot with the mouse button depressed. However, the setting here allow all plots to have the
same size and position .
At the bottom left of the Modify Plot dialog, controls are provided to allow data to be placed on
the primary (X1 and Y1) or secondary axes (X2 and Y2). The primary axes are shown at the
bottom (X-axis) and left (Y-axis) of the plot. The secondary axes are initially shown at the top
(X-axis) right (Y-axis), but they can be moved anywhere as detailed in section 9-1.
The controls at the bottom right allow the X and Y axes to exchange position and set the
background color of the plot rectangle. By default, the plot rectangle has a white background.
Clicking in the box to the right of Background color will bring up a color dialog that allows any
background color to be selected.
Chapter 1: Introduction to EES 45
Automatic Update
The Automatic update option in the Modify Plot dialog causes the data series to be re-plotted
each time the data source changes (e.g., the data in the Parametric Table are adjusted). This
option is useful if you want to adjust parameters in your model and immediately see how they
affect a plotted result. Once the Automatic update option is selected, the Data button becomes
live. Clicking this button will bring up the Modify Automatic Plot Data dialog, which allows
you to adjust the range of data that is plotted. Note that this dialog provides a check box for All
rows in table. If this box is selected, the range of plotted data will automatically change as the
number of rows of data change. If this option is not checked, then only the specified rows will
be updated.
Figure 1-53: Modify Automatic Plot Data after clicking the Data button.
Error Bars
Select Y-axis in the Modify Plot dialog to bring up the Specify Error Bar Information dialog
shown in Figure 1-54(a). The error bars can be set according to either an absolute or relative
uncertainty. Select an Absolute uncertainty of 50 kPa for the y error bar. Repeat the process for
the x error bar using an uncertainty of 50 liter/min in order to generate the plot shown in Figure
1-51(b). Alternatively, the uncertainty values used to generate the error bars can be obtained
from a table. It is also possible to generate asymmetric error bars by de-selecting the Identical
upper and lower values option in the Specify Error Information dialog, which brings up a
separate window for selecting the upper and lower uncertainty values, as shown in Figure 1-
54(b).
46 Chapter 1: Introduction to EES
(a) (b)
Figure 1-54: Specify Error Bar Information dialog (a) with identical upper and lower values, and (b) with
different upper and lower values.
Selecting the text tool opens the Format Text dialog, shown in Figure 1-56(a). You can type
text into the window in order to annotate your figure, as was done in Figure 1-51(c). The size,
font, style, and background of the text can be selected with the controls in this dialog. Clicking
the or button will change the selected text in the text field into a subscript or superscript,
respectively. For example, to enter Tinitial, type Tinitial into the text field. Then select initial and
click the button. The text field will change to T\dinitial\. The \d instructs EES to display the
following text up to the next \ as a subscript. \u in place of \d will result in a superscript. You
can enter these codes directly, without using the buttons if you prefer. Clicking the button
will insert a line break, carriage return code in the text string which will appear as \m in the text
edit box. When this option is selected, a check box will appear offering the option of centering
the lines of text with respect to each other.
Chapter 1: Introduction to EES 47
In the Professional version, you can also link the position of the text to a certain data point using
the Link Text to Data Point in Plot option at the bottom of Figure 1-56(a). This capability is
particularly useful if you have a plot that is automatically updated as you change parameters and
you would like the annotations to remain in their correct locations with respect to the data series.
(a) (b)
Figure 1-56: Format Text dialog with (a) Text item and (b) EES variable selected.
By default, the text tool is set to place a text item onto the plot; therefore the Text item radio
button is filled in at the top of the dialog. However, you can also annotate the plot using the
value of an EES variable by selecting the EES variable radio button. The resulting dialog is
shown in Figure 1-56(b). Use the pull down menu to select the appropriate variable (in our case
K). If the radio button Show name is selected, then both the value and the name of the variable
will be shown. If the Show units radio button is selected, then the units of the variable will also
be shown provided that they are set, as discussed in Section 1.5. The Integral radio button
automatically integrates one of the data series shown in the plots (selected by the user from a
dropdown menu) and places the value on the plot.
Note that strings of international characters can be displayed on the plot by entering the string in
the text box. EES will automatically detect if the entered text contains international characters.
If so, a blue (International Characters in use) message will appear under the text, as shown in
Figure 1-57. The subscript, superscript, and symbol buttons are disabled when international
characters are used. Also, a background color can be set for any text item, as shown in Figure 1-
57.
48 Chapter 1: Introduction to EES
There are several other useful tools in the Plot tool bar shown in Figure 1-55. The line tool
allows you to draw lines on your plot. By holding the shift key down during the drawing
process, the lines are constrained to horizontal, vertical, or 45°. The polyline tool allows you
to draw a series of connected lines. The square , circle , and polygon tools allow
rectangular, circular, and polygon regions to be outlined on the plot (note that the polygon tool is
only available in the Professional version). Holding the Shift key down while drawing these
objects forces them to have a constant aspect ratio.
When the plot tool bar is visible you can also copy graphic objects from other applications (e.g.,
PowerPoint®) and paste them into the plot window. The elbow shown at the bottom right of
Figure 1-58 was inserted in this manner. Right click on any of the objects on a plot in order to
change its properties (e.g., to add arrows to lines or to shade regions in opaque or semi-
transparent colors) or move objects forward (in front of) or backwards (behind each other) each
other. Select multiple objects at once by clicking on them one by one while holding the Shift
key down. Alternatively, you can select a rectangular region on the plot by pressing and holding
the left mouse button down at the upper left corner of the region and moving the mouse to the
lower right corner of the region. All objects within the region will be selected. The properties of
all selected objects can be changed at once.
Chapter 1: Introduction to EES 49
The alignment tool will be activated when multiple objects are selected. The alignment tool
can be used to align the positions of a group of selected objects vertically and/or horizontally.
Figure 1-58 shows a carefully formatted plot of pressure loss as a function of flow rate through a
45º elbow calculated using various values of the resistance coefficient. The alignment tool is
also activated when the X or Y-axis label is selected. In this case, the alignment tool can be used
to move the label to the center the axis.
Text and graphic items in Plot windows can be moved with the arrow keys when the Plot tool bar
(Figure 1-55) is visible. When an arrow key is pressed the first time, the selected items will
move 5 pixels. If the key is held down, the selected items will move quickly. Releasing and
pressing the key again (within 3 seconds) will move the selected items by 1 pixel, allowing fine
control. If the arrow key is then held down for more than 3 seconds, the speed at which the
selected items move in the designated direction will increase.
2000
1800
1600 K = 0.4
K = 0.35
Pressure loss (kPa)
1400
K = 0.3
1200
K = 0.25
1000 K = 0.2
800
600
400
200
0
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Flow rate (liter/min)
Figure 1-58: Formatted plot of pressure loss as a function of flow rate through a 45º elbow for various values
of the resistance coefficient.
The plot is normally locked in position in the plot window. However, it can be moved using the
Move plot tool (it can also be moved if the Ctrl key is held down). This tool is particularly
useful if the plot is located too close to the left or top of the plot window.
The Zoom tool allows a rectangular region of the plot to be selected, as shown in Figure 1-
60(a). A new plot is subsequently created, as shown in Figure 1-60(b), which includes the
selected region and therefore provides a zoomed in view of a certain region of the original plot.
50 Chapter 1: Introduction to EES
Figure 1-59: Plot window with cross hairs and status bar (at bottom).
(a) (b)
Figure 1-60: (a) Plot with the zoom feature activated and (b) new plot with zoomed in region.
Chapter 1: Introduction to EES 51
1.5 Units
In Section 1.3 we calculated the pressure loss through a 45º elbow. During the process of
solving the problem we found that it was tedious keeping track of the units of each variable and
converting between different units. Variables in engineering problems typically represent
physical quantities and therefore they will have units. EES allows you to assign not only a value
to each variable, but also its units. This is an incredibly useful feature of EES because the unit
consistency of the equations will be examined by EES and any unit conversion errors will be
flagged. Further, EES facilitates the process of converting between units by including a large
number of built-in unit conversion factors. EES can also display variables in dual units.
Unit System
Units are commonly categorized as belonging to the English or SI (Systems International) unit
system. If you are accessing any of the built-in thermodynamic or transport property functions
or any of the trigonometric functions in EES, then it is important that you specify the units
system that you will be using. This is done by selecting Unit System from the Options menu to
access the Unit System tab of the Preferences dialog, shown in Figure 1-61. You can select
which unit system (English or SI) you will be using. Most of the settings in this page become
important only when accessing property databases, as discussed in Chapter 4. In the section
labeled Trig functions you must specify whether you want to provide arguments to trigonometric
functions in radians or degrees.
Entering Units
Let's return to the example from Section 1.3. The inner diameter of the elbow is D = 2 cm and
the density of water is = 1000 kg/m3. The dimensionless resistance coefficient is estimated to
be K = 0.3, allowing the pressure loss can be estimated according to:
u2
P K (1-16)
2
52 Chapter 1: Introduction to EES
where u is the velocity of the water. We will compute the pressure loss when the volumetric
flow rate is V = 100 liter/min. The inputs are entered in EES as before:
"Inputs"
K=0.3 "K factor for a 45 degree elbow, dimensionless"
D=2 "diameter"
rho=1000 "density"
V_dot=100 "flow rate"
Solve the equations and examine the Solution Window, shown in Figure 1-62(a). The value of
each variable is indicated, but no units have been set.
(a) (b)
Figure 1-62: Solutions Window showing input parameters (a) with no units set and (b) with units set.
There are several ways to set the units (and alternate units) of each variable. The units of a
numerical constant (e.g., 2 or 1000) can be set directly in the Equations Window by placing the
unit within square brackets directly after the value. The units of each input variable can
therefore be set as they are entered.
"Inputs"
K=0.3 [-] "K factor for a 45 degree elbow, dimensionless"
D=2 [cm] "diameter"
rho=1000 [kg/m^3] "density"
V_dot=100 [liter/min] "flow rate"
The resulting Solutions Window is shown in Figure 1-62(b). Both the value and units for each
variable are indicated. Notice that using the hyphen alone as a unit specification indicates that
the variable K is dimensionless (i.e., it has no units). A space could be used in place of the
hyphen. The units for each variable can also be set by right-clicking on the variable in the
Solution Window in order to access the Specify Format and Units dialog, shown in Figure 1-63
for the variable D.
Chapter 1: Introduction to EES 53
It is also possible to set the units of a variable directly from the Equations window. This is done
by clicking on the variable name in the Variable Information palette. This action will bring up
the Variable Information dialog for the selected variable.
Finally, the units for each variable can be set in the Variable Information dialog that is accessed
by selecting Variable Info from the Options menu (or by pressing F9 or right-clicking the Update
button in the Variable Information palette).
Dual Units
Note that two fields are provided for units in Figure 1-63. If a second (alternate) set of units is
provided, it must have the same dimensions as the primary set of units. In this case, EES will
display the variable in the Solution Window in both sets of units. However, only values in the
primary units are used in the calculations. For example, we can enter in (for inches) in the
alternate units field, as seen in Figure 1-64a. Click the OK button and the Solution Window will
appear with the value of D shown both in cm and in inches (Figure 1-64b). EES uses its internal
unit conversion routines to determine the value (shown in brown font) for the second set of units.
Figure 1-64: a) Entering a second set of units and b) Display in the Solutions Window.
Dual units can be made to display in Parametric, Arrays, Lookup, and Integral tables as well. A
field is provided for alternate units in the Format Table dialog shown in Figure 1-41 and Figure 1-
65. This dialog can be made to appear by right-clicking in the header cell in any of the tables and
then selecting Properties from the pop-up menu that appears, as shown in Figure 1-65. Dual units
can be used to create plots with scales for both unit systems as shown in Section 9.1.
54 Chapter 1: Introduction to EES
Note that the Format Table dialog has a check box control named ‘Show values in alternate
units’. If an alternate set of units is provided with the same dimensions as the primary set and
this check box is selected, values will be displayed in both units, as seen in Figure 1-66.
The Professional version allows variables to be plotted in their primary or alternate units. See
section 9.1 for an example of this capability.
Chapter 1: Introduction to EES 55
Checking Units
The cross sectional area of the elbow is given by:
D2
Ac (1-17)
4
By default, EES will not automatically set the units of A_c. Solve the problem and access the
Solution Window, shown in Figure 1-68(a). Notice that there is no unit listed after the variable
A_c and also that a red warning message has appeared at the bottom of the Solution Window
indicating that EES has detected a potential problem with the unit consistency of the equations.
(a) (b)
56 Chapter 1: Introduction to EES
(c)
Figure 1-68: Solution Window with (a) the units of A_c not set, (b) the units of A_c set by the user, and (c) the
units of A_c automatically set by EES.
Select Check Units in order to bring up the Check Units window shown in Figure 1-69. EES has
identified that Eq. (1-17) is not dimensionally consistent if A_c is dimensionless and D has units
cm. It is evident that the units of the variable A_c must be cm2.
Clicking the left or right mouse button on an equation that has unit issues will bring up the pop-
up menu in Figure 1-70.
The first menu option will display the formatted equation showing the units of all variables and
constants. This display makes it easy to identify unit problems. The second option will move
the focus to the equation in the Equations window. The third option opens the Variable
Information dialog where the units of one or more variables in the equation can be specified.
The last option disables unit checking for the selected equation.
By default, EES automatically performs this type of unit check each time the system of equations
is solved. Although not recommended, this option can be deactivated by selecting Preferences
from the Options menu and selecting the Options tab to access the dialog shown in Figure 1-71.
Automatic unit checking can also be controlled with the $CheckUnits directive. Placing
$CheckUnits AutoOn at the top of the Equations Window activates automatic unit checking and
Chapter 1: Introduction to EES 57
$CheckUnits AutoOff deactivates it. The $CheckUnits On and $CheckUnits Off directives can be
placed around a set of equations in order to locally deactivate the unit checking for these
equations, as discussed in Section 14.2. The unit consistency of the equation set can also be
checked at any time by selecting Check Units from the Calculate menu (or by selecting F8).
It is not possible to set the units for the variable A_c in the Equations Window using square
brackets because the right side of Eq. (1-17) is not a numerical constant. For example, typing:
will result in EES interpreting the constant 4 in the denominator as having units cm2.
Alternatively, typing:
will result in EES interpreting the square bracket as the subscript in an array (discussed in
Section 1.7), leading to an error message. Rather, the units of the variable A_c must be set either
by right-clicking on the variable in the Solutions Window and entering the units or by using the
Variable Information window. The result is shown in Figure 1-68(b). Note that the red unit
warning is now gone.
should be confirmed by the user by right-clicking on these variables in the Solutions window and
then making any necessary changes in the dialog window that appears.
Automatic unit setting can also be activated by placing the $AutoSetUnits On directive at the top
of the EES Equations Window:
$AutoSetUnits On
V
u (1-18)
Ac
u=V_dot/A_c "velocity"
As written, the units for the variable u must be liter/min (the units for the variable V_dot) divided
by cm2 (the units for the variable A_c). Therefore, the units for u must liter/min-cm2. (Again,
note that in this book and also in EES, the hyphen sign will be used to indicate multiplication on
one side of the divisor in the context of units). If we set the units for u to liter/min-cm2 in the
Solutions Window, then EES will find no unit inconsistencies. Of course, the units liter/min-cm2
don't make a lot of sense for a velocity and it would be better to convert the value to a more
reasonable set of units, like cm/min. We could do this manually, looking up each of the various
unit conversion factors that are required to arrive at the conclusion that we need to multiply by
1000:
Fortunately, EES has built-in unit conversion information that is easily accessible using the
convert function. The convert function simply retrieves the conversion factor between two units
and therefore the function requires two arguments; the first argument is the unit to convert from
while the second is the unit to convert to. By adding the convert function to the equation
calculating the velocity:
u=V_dot/A_c*convert(liter/min-cm^2,cm/min) "velocity"
the unit conversion is easy and transparent to the user. The convert function returned the correct
unit conversion multiplier (1000) for the unit conversion that is specified by the two arguments.
This is particularly evident in the Formatted Equations Window, shown in Figure 1-72.
Chapter 1: Introduction to EES 59
The units of the variable u should now correctly be set as cm/min in the Solutions Window or in
the Variable Information dialog. EES will not automatically set the units in this situation.
Finally, Eq. (1-11) is used to compute the pressure loss and the result is converted to kPa:
The units of the variable DELTAP can be set to kPa in the Solutions Window. The unit
assignments of each variable will automatically be stored and the units will be indicated
whenever you use the variables, such in a Parametric Table or plot.
If you set a variable to a numerical constant followed by its units in brackets, EES will
automatically assign the units to the variable. Starting with version 9.437, EES will also
automatically assign the units to variables that have been set to a value using the Convert
command. For example, the following example will set the value of L to 12 and its units to ft.
The unit list can be modified so that it is most useful to you. You really want to include only a
small number of units that you use a lot in order for it to save you time. The buttons to the right
facilitate this process. Units can be added or removed with the Add New and Remove buttons,
respectively. The entire list can be cleared with the Clear button. If you change the units list and
want that change to be recorded beyond the current EES session then you should save the new
file using the Save button.
EES will automatically load the default SI and English units lists (SI_DefaultUnits.unt and
Eng_DefaultUnits.unt, respectively) upon opening. You may have your own, separate units list
that you have developed and would like to use. This is easy to do because the units list is simply
a text file that can be opened and edited with any text editor (e.g., Notepad®). For example,
Figure 1-74(a) illustrates a text file that is saved as MyUnits.unt. This units list can be loaded
using the Load button in Figure 1-73 and then used for the duration of the EES session, as shown
in Figure 1-74(b). Alternatively, a custom units list can be merged with an existing list using the
Merge button.
(a) (b)
Figure 1-74: The unit list saved as (a) MyUnits.unt file and (b) loaded into EES.
Chapter 1: Introduction to EES 61
If you don't want to load your custom units list each time you start EES then you can use the
$INCLUDE directive. The $INCLUDE directive provides an automatic method of loading a variety
of files when you run your EES code. Place the statement:
$INCLUDE MyUnits.unt
at the top of the EES file and you will find that the units list is automatically set as shown in
Figure 1-74(b). Note that regardless of how the units in the units list are organized, they are
simply a subset of the large set of units that are recognized by EES.
Applying this strategy to our pressure loss problem leads to the following equation set:
and the Solution Window shown in Figure 1-75. While it is not necessary that you take this
approach, it certainly makes solving systems of engineering equations much easier. The settings
for the base SI unit system are as shown in Figure 1-61.
Note that EES allows an alternate set of units to be specified for each variable, as shown in
Figure 1-63. The last three lines of the program are not needed if alternate units of liter/min,
cm/min, and kPa are provided for variables V_dot, u, and DELTAP, respectively. The Solution
window with these alternate units set appears as shown in Figure 1-76.
Figure 1-76: Solution Window using alternate units for variables V_dot, u, and DELTAP
Chapter 1: Introduction to EES 63
Note that there can be confusion in temperature units. In some cases, you may wish to convert a
temperature difference in Celsius to an equivalent temperature difference in Fahrenheit. In this
case you would not use the ConvertTemp function, but instead, use the Convert function, e.g.,
Convert(C,F). For clarity, EES provides temperature difference units , DELTAF, DELTAC,
DELTAR and DELTAK. For example, a variable representing a temperature difference could be
assigned units of DELTAC, which will be displayed as C in the Solutions Window. Use of the
temperature difference units is particularly important when using the Dual units option in the
Specific Format and Units dialog (Figure 1-63) as EES will automatically assume that a variable
having units of F, C, R, or K is a temperature rather than a temperature difference.
Adding Units
EES includes several hundred units and is therefore likely to include any unit you might run
across. However, it is possible to add to the list of units recognized by EES. For example,
braking distances are often expressed in car lengths where 1 car = 4 m. The unit ‘car’ is not
recognized by EES. The equation:
We can add the unit car to the list of those that are recognized by EES by opening the file
Units.txt found in the root EES installation directory using any convenient editor (e.g.,
Notepad®), as shown in Figure 1-78.
64 Chapter 1: Introduction to EES
Figure 1-78: Units.txt file opened using Notepad® with the unit car added.
Instructions for adding units are found at the top of the Units.txt file. Unit conversions are
organized according to dimension. Locate the dimension of interest (in this case, Length). The
first entry in the unit list (in this case, m) is the basis used for conversion of all other units in that
dimension. Reading down the list, this should be clear (1 Angstrom = 1x10-10 m, 1 nm = 1x10-9
m, etc.). Add the appropriate entry at the bottom of the list, as shown in Figure 1-78, and save
the units.txt file. When EES is re-started it will load the new set of unit conversions and the
statement:
will not result in an error. The units of the variable L should be set to m in the Solution Window,
as shown in Figure 1-79. Note that you must de-select the Overwrite Units files selection when
updating EES (see Figure 1-2) or your modified units.txt file will be overwritten when a new
version of EES is installed.
Chapter 1: Introduction to EES 65
Figure 1-80: Variable Information dialog shown a string variable used for the units of a variable.
U$='kJ/kg'
h_SI=15 [U$]
h_Eng=h_SI*convert(U$, Btu/lb_m)
Note that providing alternate units in the Variable Information is an easier way to show results in
two sets of units. See Section 15.6 for an example using string variables to allow units to be in
either English or SI units in the Diagram window.
1.6 Printing
Once you have completed your EES solution, you will need to document the results in some
way. This section discusses how you can output information from the EES file.
66 Chapter 1: Introduction to EES
Note that, by default, not all of the windows in your EES file will be printed. You need to select
from among those shown along the left side of the dialog. While there is only one Equations
Window, there may be more than one Parametric, Lookup, Array and Integral Tables and Plots.
You will need to indicate both whether you want these items to be printed as well as which of
these items are to be printed. A black check mark indicates that all of the items will be printed,
an open box indicates that none will be printed, and a gray check mark indicates that a subset has
been selected. For example, if more than one Plot window is present in the EES code, then
clicking on the Plots box will bring up the Select Plots to print dialog shown in Figure 1-81(b).
Select Preview in the Print dialog to bring up an on-screen display of the printed output.
(a) (b)
Figure 1-81: (a) Print and (b) Select Plots to print dialogs.
The Print Setup selection from the File menu allows you to set up the details of the printing
process (e.g., orientation, paper size, etc.). By default, the font and style used for the printed
output is the same as those used for the on-screen display. However, the Printer tab on the
Preferences dialog allows you to adjust these values independently.
Copying Equations
It is also possible to copy equations from the Formatted Equations Window in EES so that they
can be pasted into various applications. We will use Eq. (1-10), repeated below, as an example.
Chapter 1: Introduction to EES 67
1.25 64 3.44
4 3.44 4 L 4 L
f (1-20)
ReD L 1
0.00021
L
2
f_bar=(4/Re_D)*(3.44/sqrt(L|plus)+(1.25/(4*L|plus)+64/4-3.44/sqrt(L|plus))/(1+0.00021/L|plus^2))
Open the Formatted Equations Window, shown in Figure 1-82. Highlight the equation and right
click to access the pop-up menu shown in Figure 1-83.
Clicking on a comment in the Formatted Equations Window that contains a hidden or visible
hyperlink will automatically start your browser open this page. If you do not wish to have
hyperlinks active, select the Enable http links menu command from the Formatted Equations
pop-up menu so as to remove the check mark.
The three options at the bottom of the pop-up menu allow the equation to be copied and pasted in
a variety of formats. If the Copy as EES picture option is selected then the equation will be
placed on the clipboard as a picture (i.e., in windows metafile format), from which it can be
pasted into another application.
The next two options are only available in the Professional version of EES. The Copy as LaTeX
option translates the equation into LaTeX code that is placed on the clipboard. The Copy as
68 Chapter 1: Introduction to EES
MathType option translates the equation into MathType format that can subsequently be placed
in another application such as Microsoft Word® provided that the MathType® software is
installed.
LaTeX Report
EES can be used to create a high quality report that includes the Diagram, Equations, and
Solution Windows as well as any tables and plots. The report is created in the form of a TeX
document (.tex) that can be automatically processed by a LaTeX compiler to produce a device
independent (.dvi) output file that can be printed by various utilities. The PDFLaTeX accessory
available with the TeX compiler also produces a portable document interface (.pdf) file that is
compatible with Adobe Reader. The entire process can be made transparent to the user so that
the Latex Report feature effectively becomes a printer to produce .pdf files. The output quality
of the Latex Report feature is much higher than that obtained with the EES Print command.
Both the LaTeX software and Adobe Acrobat Reader (or any equivalent application) must be
installed on your computer in order to use this feature. These programs are available at no cost.
Download the distribution MiKTeX installation file (i.e., the latest version of the MiKTeX
software) from the web page https://miktex.org/download using the instructions provided when
you click the Help button in the Create LaTeX/PDF report dialog shown in Figure 1-84. Choose
the Basic MiKTeX Installer option for your operating system (32 or 64-bit). Note that EES must
eventually know the directory path in which the MiKTeX software is installed so you should
make a note of it. In order to configure EES to work with the MiKTeX package, start EES and
select Create LaTeX/PDF Report from the File menu in order to access the Create LaTeX/PDF
Report dialog shown in Figure 1-84. Click the Setup button and navigate to the pdfLaTeX
executable file (typically found in the miktex/bin subdirectory of the installation directory). If
you install MiKTeX in its default directory, EES will likely find it without your intervention.
In order to generate a report, access the dialog shown in Figure 1-84 by selecting the Create
LaTeX/PDF Report command in the file menu and enter the desired filename in the edit field at
the top of the window. By default, the filename will be the name of the EES file with a .tex
extension. The text entered in the Title field will be displayed at the top of the report. The
controls at the left side of the dialog allow you to select the items that will be included in the
report from among the various items in the EES file. If multiple items of the same type exist
(e.g., there are two plots in the EES file used to create Figure 1-84) then clicking on the value
within the square brackets will bring up a dialog that allows you to select a subset of the items.
The Equations Window selection provides some additional controls such as line numbering and
placing each equation and comments on separate lines. Very long equations may run off of the
right side of the report. It may be necessary to use the & character to break long equations into
segments in the Equations Window. The Solutions and Table group boxes each provide a control
that allows you to specify the number of columns per page to ensure that the text does not run off
the page of the report. The diagrams and plots that are to be included with the LaTeX document
are stored in separate jpeg files. The resolution of these files can be controlled using the JPG
quality control.
Chapter 1: Introduction to EES 69
At the bottom right of the dialog there are four checkboxes. If the Create PDF document
checkbox is selected then EES will attempt to start the PDFLaTeX application and compile the
.tex file in order to create a .pdf file. If the Display PDF document checkbox is selected then EES
will attempt to start Adobe Reader and display the .pdf file directly after it is created. If the
Delete TEX and JPG files checkbox is selected then the .tex file and .jpg files will be deleted,
leaving only the .pdf file. The Include Hyperlinks check box will only be enabled if you are using
a Professional verson and there are hidden hyperlinks within the Equations window. Clicking
this control will enable the hidden hyperlinks within the .PDF document.
Select Create to start the process of generating and compiling the report.
70 Chapter 1: Introduction to EES
1.7 Arrays
The variables that have been discussed in Sections 1.1 through 1.6 are all scalar variables; that is,
they can be assigned only one value. It will often be useful to use array variables which can be
assigned multiple values. Arrays are EES variables that have an array index enclosed in square
brackets at the end of the variable name. Data stored in arrays can be used to generate plots in
the same way that data stored in Parametric Tables can be used for this purpose, as discussed in
Section 1.4.
The value and units of the variable T_scalar can be examined in the Solution Window. The array
T_array[], assigned below, consists of three separate variables: T_array[1], T_array[2], and
T_array[3]. The value in subscripts is the index of the array; therefore, T_array[1] is the first
element of the array, and so on.
The values in the variable T_array[] will be stored in the Arrays Table Window, shown in Figure
1-85 and accessed by selecting Arrays from the Windows menu.
The array variables T_array[1], T_array[2], and T_array[3] behave just as ordinary EES variables.
They each have units, limits, guess values, etc. One purpose of using arrays is to organize
information; for example, each array variable may correspond to a thermodynamic state in a
system. Also, mathematical operations that are common to each element of an array can be
performed easily using the Duplicate command, discussed subsequently.
A string array variable must have the $ character just before the left bracket that holds the array
index. For example:
A$[1]='Hello'
A$[2]='World'
Chapter 1: Introduction to EES 71
T_array[1..3]=[100 [K], 200 [K], 300 [K]] "assignment using array notation"
Note that EES expects the correct number of values (three in the example above) to exist within
the square brackets on the right side of the equation above or it will post an error. If more than
three values were provided in the square brackets on the right side of the equation then the first
three would be used and EES would post a warning.
Two-Dimensional Arrays
If two indices are used for array assignments then the array will be two-dimensional (i.e., a
matrix rather than a vector). For example, the statement below:
The statement below assigns the value in the 2nd row (the first subscript) and 3rd column (the
second subscript) to the variable X. Examining the Solution Window shows that the scalar
variable X is equal to 600.
The Array Editor provides a convenient way to work with arrays. Ultimately the arrays accessed
by the Array Editor are listed in the Equations Window. In order to be recognized by the Array
Editor the array definition must begin with the comment {Array Name} and end with the comment
{Array Name end} where Name is the name of the array. For example, the statement below:
{Array a}
a[1,1..3]=[1,2,3]
a[2,1..3]=[4,5,6]
{Array a end}
would define the array a in a way that is recognized by the Array Editor. When the Array Editor
is opened, the dropdown menu at the top of the editor can be used to select from among any of
the arrays that have currently been defined in the Equations Window using this syntax. Note that
any array defined in the Array editor itself will use this syntax. Alternatively, a new array
variable can be created by selecting Enter array name from the Array drop down menu.
Modifications to existing arrays made in the Array Editor will show up in the Equations
Window. (Note that the Array Editor will not detect or be able to modify arrays that were not
created in the Array Editor.) This feature makes it easy to import data from other applications
such as Excel or MATLAB. For example, suppose you want to access a 5x5 array of data
generated in Excel, as shown in Figure 1-87.
Select Array Editor from the Edit menu. Name the array (D) and choose the right number of
rows and columns (5 and 5). Copy the data from Excel and select the Paste button ( ) to place
the data into the Arrays Editor, as shown in Figure 1-88.
Chapter 1: Introduction to EES 73
Select OK and the array D[] will be created in the Equations Window.
{Array D}
D[1..5,1]=[0.835379821,0.536458607,0.607826536,0.50104002,0.250295049]
D[1..5,2]=[0.596997554,0.795630883,0.179900142,0.205868913,0.439109551]
D[1..5,3]=[0.142993304,0.210596416,0.161575547,0.576841329,0.4000961]
D[1..5,4]=[0.70532211,0.077083658,0.333396857,0.179171305,0.198072072]
D[1..5,5]=[0.081197923,0.285540063,0.419114502,0.147024152,0.863134795]
{Array D end}
Run the EES program and you will see the array D[] created in the Arrays Table, as shown in
Figure 1-89. Again, do not modify or delete the comments that EES places around the array
values, as these are used to identify the array to the Array editor.
The variable index is iterated from the value start to the value stop. The equation(s) contained
between the Duplicate and End statements are written for each iteration. For example, the EES
code:
duplicate i=1,4
T[i]=i
end
is equivalent to writing:
T[1]=1
T[2]=2
T[3]=3
T[4]=4
When using Duplicate statements it is particularly important to remember that EES uses equations
rather than assignments. That is, do not accidentally place equations within a Duplicate statement
unless you actually want these equations to be duplicated in the Equations Window. A common
mistake that new users of EES make is shown below:
duplicate i=1,4
T[i]=i
x=4
end
T[1]=1
x=4
T[2]=2
x=4
T[3]=3
x=4
T[4]=4
x=4
which leads to 8 equations in 5 unknowns. Solving the EES code will lead to an error message.
Nested Duplicate statements can be used to generate two-dimensional arrays. For example, the
code below:
duplicate i=1,3
duplicate j=1,4
D[i,j]=i+j
end
end
Figure 1-90: Two dimensional array generated using a nested Duplicate statement.
It is possible to define array variables with more than two indices but this practice is not
recommended.
might represent a set of temperatures. Select Variable Info from the Options menu to access the
Variable Information Window, shown in Figure 1-91(a). By default, each element of the array is
shown and the guess values, limits, and units can be set differently for each element. This
arrangement is inconvenient if all elements share a common set of characteristics. De-select the
Show array variables check box in the upper left corner in order to collapse the array, as shown
in Figure 1-91(b). Any characteristic set for the row T[] will be applied to each element of the
array.
(a)
(b)
Figure 1-91: Variable Information Window (a) with each element of T shown and (b) with the array T
collapsed.
76 Chapter 1: Introduction to EES
It is possible to assign different values of the guess values or limits to each element in an array
using a different array that is setup just for this purpose. This capability is discussed in Section
5.4.
It is often the case that you will want to redefine the size of the arrays that you use in an EES
program. For example, arrays are particularly useful in order to solve the system of algebraic
equations that result from numerical models. These equations correspond to a set of equations
written for each node or control volume defined within a computational domain. One of the
most important things that you should do with a numerical model is to verify that the number of
nodes is sufficiently large that the numerical model has converged. This check is typically done
by increasing the number of nodes and observing how the solution changes. The final number of
nodes that is used is always a compromise between computational time and accuracy.
Based on this discussion, it is clear that you can easily introduce many variables using arrays that
you do not ultimately wish to use. In order to clear these variables from memory you must use
the Purge Unused Variable command from the Options menu, at which point EES will check if
there are unused variables in memory and ask whether you want to purge or keep them. Solving
the EES code below generates a 50x50 two-dimensional array D[]. The EES program includes
2502 variables, all of the entries in the array D[] as well as the variables Nx and Ny.
D[i,j]=i*j
end
end
Now reduce the values of the variables Nx and Ny, as shown below, in order to generate a 10x10
array and reduce the number of active variables to 102.
Because EES retained the original 2502 variables in memory there are currently 2400 unused
variables. In order to purge these variables and reduce the size of the EES file select Purge
Unused Variables from the Options menu. You will be asked to confirm that you want to purge
the unused variables with the dialog shown in Figure 1-92.
It is wise to save the file with a different name before you purge variables.
78 Chapter 1: Introduction to EES
Select OK in order to generate the blank Lookup Table shown in Figure 1-94(a).
Entering Data
Data can be typed directly into the cells of the table or pasted from the clipboard. Alternatively,
the values in a selected column can be entered, cleared, or changed by either selecting the
triangle icon ( ) or right clicking on the column header and selecting Alter Values; either option
brings up the Alter Values dialog. Select Enter Values and then indicate the pattern that should
be used. For example, Figure 1-95(a) shows the Alter Values dialog set up in order to enter
values ranging from 0 to 10 in equal increments, leading to Figure 1-94(b).
The column widths can be adjusted manually by dragging the divider between cells in the header
(top) row. Also, note the double arrow in the upper left cell above the Paste Special button in the
Professional version. Clicking this button will adjust the width of each column in the Lookup
Chapter 1: Introduction to EES 79
Table to fit the data. Clicking the button again will return the column widths to their original
values.
(a) (b)
Figure 1-95: Alter Values dialog shown (a) with Enter Values selected and (b) with Enter Equation selected.
In the Professional version, a value greater than the current number of rows can be entered in the
Last Row field (upper left in Figure 1-94). In this case, EES will, after confirmation, increase
the number of rows in the Lookup table to this value.
When text data are available on the clipboard, the Paste Special (green) button will be visible in
the upper left cell of the Lookup table as shown in Figure 1-94. Clicking this button will bring
up the Paste Special dialog (Figure 1-96). This dialog will allow data that use tabs, commas,
spaces, or semicolons to separate values in each column. In addition, this dialog makes it
possible to paste the column names and/or units into the Lookup table starting at a specified row
and column.
Using the Enter Equation option, values can be entered into the selected column of the table as a
function of values in other columns, previously-defined variables in the EES worksheet and EES
functions. Using this capability results in the Lookup table operating much like as spreadsheet
program. The #X sequence is used to refer to values in another column. For example the
following entry would set the values in column 1 of the Lookup table to 5* the values in column
2. Note that, instead of entering #2, you could alternative enter #ColName, where ColName is
the name of the column. The changes are applied only to the rows indicated in the edit boxes at
the upper left of the dialog.
Any of the EES functions can be used in the equation. For example, the following entry converts
temperatures in C (in column 2 of the table) to K.
In some cases, it is necessary to refer to a particular row of a column in the Lookup table. This
capability is available by including the row number in brackets. For example, the following
equation sets all of the values in column 1 to the value in row 3 of column 2.
Finally, is sometimes necessary to refer a row above or below the current row for which a value
is being entered. #R refers to the current row. #R can be used in a subscript. Entering #2[#R] is
exactly equivalent to entering #2. However, you can offset the row values by entering the offset
to #R. For example, the following equation copies the values in column 2 to column 1, but it
offsets the row so that the value in column 1 row 2 is equal to the value in column 2 row 1, and
so on for the entire row range.
Chapter 1: Introduction to EES 81
Note that EES will not provide an error if the row is less than zero or greater than the maximum
number of rows.
The Professional version provides the option to automatically update the values in a column that
have been set with an equation. Checking automatic update will result in the values assigned
with an equation being updated whenever the values it depends upon are changed. The values in
a Lookup table can be changed by the Lookup command in an EES function or EES Macro, by
the $CopytoLookup directive, or by entering or pasting values into the table.
To save an existing Lookup Table, right click on the tab for the Lookup Table to bring up the
Information Dialog for the Lookup Table, as shown in Figure 1-97.
The dialog allows you to edit the name, add some descriptive text, duplicate the Lookup Table
and alter its position with regard to other Lookup Tables in the EES file. The Save button allows
you to save the Lookup Table in a variety of formats. The data alone can be saved in an ASCII
text (.txt) or comma separated value (.csv) file that can be read by most other applications. The
data with the headers can also be saved in a text file. The table can also be saved in the EES-
specific Lookup File or Lookup Table formats. The Lookup Table (.lkt/.lkt64) format is a binary
82 Chapter 1: Introduction to EES
format that can subsequently be opened in other EES files or read directly by EES when using
Lookup Table/File functions. This format is typically easiest to use and corresponds to a Lookup
Table that is saved by and can subsequently be opened by the EES software. Lookup Files saved
in the .lkt/.lkt64 format are scecure because they are written in a binary format that cannot be
read by any application other than EES. All of the information associated with the file including
column names, units and column format, is saved in the .lkt/.lkt64 file. See Lookup File Formats
in the online help for details about these data file types.
Note that deleting the Lookup table means that the data that it contains will not be saved with the
EES file the next time the EES file is saved. However, the Delete command does not delete a
Lookup table that has been saved separately in Lookup File that has an .lkt, .txt, .csv, or other file
name extension.
X = Lookup('TableName',Row,Column)
Chapter 1: Introduction to EES 83
where 'TableName' is a string containing either the name of the table of interest (i.e., the name
shown in the tab in the Lookup Window) or the name of the Lookup File stored on disk
(including the directory information and file name extension). TableName may be provided with
a string variable. Note that all of the built-in functions listed in Appendix A, Table A-9 can
access a Lookup File stored on disk (rather than a Look Table displayed in EES) by providing
the name of the file rather than the name in the Lookup Table tab. Row is the number of the row
in the table and Column is either the number or name of the column. For example, the command:
will result in the variable X being assigned 0.4947 if the Lookup Table shown in Figure 1-94(c)
is available in the EES file. Non-integer values of the column or row will result in linear
interpolation; however, the Interpolation functions discussed in Chapter 2 are more appropriate
for this type of operation and provide the option of higher order interpolation.
Data can be written to a Lookup Table using the Lookup command in a Function or Procedure or
with the $CopytoLookup directive. Functions and Procedures are described in Chapter 3.
data for one row with the value for each column separated by one or more spaces or a tab
character. The basic form does not provide a means of specifying the names, units, or display
format for the data. EES assigns the names "COLUMN1', 'COLUMN2', etc. and these column
names should be used when the file is used with the Interpolate or Differentiate commands.
Automatic formatting is used to display the data if the file is read into the Lookup Table with the
Open Lookup Table command. The following example shows the .TXT data needed for a
Lookup file with five rows and three columns, with no column header information.
5 3
1 11 111
2 22 222
3 33 333
4 44 444
5 55 555
If the number of rows is a negative number, EES will determine the number of rows of data in
the file when the file is read.
If the number of columns is a negative number, EES will expect to find the format specification.
A format specification consists of one or two characters. The first character is the type of format
and the second character indicates the number of digits provided for this format. The number of
digits is usually an integer between 0 and 9 but the letter ‘M’ can be supplied to indicate the
maximum possible number of digits. Valid format specifications are:
A auto format. A followed by a number, e.g., A3, is accepted but the number is ignored.
F# fixed decimal format with # digits after the decimal point, e.g., F3.
E# exponential format with # digits after the decimal point or #+1 significant figures, e.g., E2
N# N significant figure format with # being the number of significant figures, e.g., N4
G# engineering format with # significant figures, e.g., G4
T# Time format; if # is 0, the default format is used; if # is 1, the format is
hours:minutes:seconds; if # is 2, the format is hours:minutes
D# Date format; # must be between 0 and 9 representing different date formats. 0 is the
default format
S string format. S followed by a number, e.g., S0, is accepted but the number is ignored.
The format specification is followed by one or more spaces and then the column heading and
units for each column. If a column contains string data, then the format specification must be S
(or S#) and the string data must be contained in single quotes. Units are optional but if supplied,
they must be enclosed in square brackets with a least one space separating them from the column
name. The following lines contain the .TXT data for each row, separated by one or more spaces
or a tab. The example below would create a table with 2 rows and 3 columns. The columns
would be formatted with E4, F1, and S format specifications and the column names will be
ColA, ColB, and Name.
2 -3
E4 ColA [Btu]
F0 ColB
Chapter 1: Introduction to EES 85
S Name
1.23E-12 2.2 'A'
2.34E-11 4.8 'B'
The Save Table command in the Tables menu and the $SaveTable directive provides a way to
save a Lookup table as a .txt file including the column header information.
Files having filename extensions other than .TXT, .LKT, .LKT64, .CSV, or .DAT can be read
provided that they are ASCII files with numerical values separated by a space or comma.
Lookup files with ASCII data may be read in with specifications provided by a FORMAT (.fmt)
file. See the online help for details relating to this file.
Built-In Constants
Constants in EES are denoted by a # sign after the name; constants are like variables in EES
except that their values cannot be changed in the Equations Window. A large number of
common physical constants are pre-assigned in EES. These entries can be viewed by selecting
Constants from the Options menu in order to access the Constants dialog, shown in Figure 1-99.
86 Chapter 1: Introduction to EES
Many physical constants of interest are available; for example, pi# is the value of (actually, pi
also refers to and is the only built-in constant in EES that does not require the use of #). R# is
the universal gas constant, k# is Boltzmann’s constant, etc. These constants are provided in the
unit system that has been specified by the user, as discussed in Section 1.5. The order of the
constants appearing in this dialog can be changed by clicking on the column header. For
example, clicking on Name at the top of column 1 will rearrange the order of the table so that the
entries are ordered alphabetically in terms of their names. Clicking a second time on Name will
reverse the order.
Adding Constants
It is possible to add constants by selecting Add from the Constants dialog in Figure 1-100 in
order to access the Add New Constant dialog shown in Figure 1-100.
The Add New Constant dialog prompts the user for the name, description, and value of the
constant in both SI and English units. For example, suppose we want to enter the Bohr radius,
a0, to our EES program. The value of the Bohr radius is 5.291772x10-11 m (or 1.736146x10-10 ft)
according to Mohr et al. (2011). The Add New Constant dialog should be filled out as shown in
Figure 1-100. If you select OK and access the Constant dialog by selecting Constants from the
Options menu then you will see that the constant a_0# has been added to the bottom of the
dialog, as shown in Figure 1-99. The new constants list can be saved by selecting the Store
Chapter 1: Introduction to EES 87
button in the Constants dialog so that it is available each time EES is opened. Note that you will
need to de-select the Overwrite Constants.txt file in the installation process, shown in Figure 1-2,
in order to keep your added constants when you update or reinstall the EES program.
Alternatively, make a copy of the Constants.txt file to ensure that it is not overwritten when you
install a new version of EES.
The user can also specify the value of constants in an EES program using the $Constant directive.
The calling protocol for the $Constant directive is:
where Name# is the name of the constant, ValueSI and ValueEng are the values of the constant in
the SI and English units specified by [UnitsSI] and [UnitsEng], respectively. For example, the Bohr
radius can be entered in EES according to:
Finally, it is possible to edit the Constants.txt file directly to add a constant that is loaded each
time EES is opened. See Section 14.3 for more detail relating the $Constant directive.
a=b+2
b^2=4+c
c=a-b
Open the Calculator Window by selecting Calculator from the Windows menu (or selecting the
button), as shown in Figure 1-102.
The result of any command preceded by a question mark will be displayed in the Calculator
Window. For example, the command:
?a+b
will lead to 6.899, as shown in Figure 1-102. New variables can also be defined in the
Calculator Window (provided that they don't already exist in the Equations Window). For
example, we can define the variable d in the Calculator Window:
d=a+b
and then use the variable d in a new expression, also shown in Figure 1-102. Use % to refer the
last calculated variable.
The Display preferences are shown in Figure 1-104. The fields in this window control some of
the basic display options. These options are applied independently of the setting of the Syntax
Highlighting control in the status bar of the Equations window. One of the most useful options is
the size of the font. The default size is 10, but the drop-down menu allows sizes to be selected
from 8 to 24. Large font sizes are useful when projecting EES in a classroom or presentation.
The screen can be dimmed with gray tones using the slider control at the bottom of this dialog.
The options in the Syntax tab are shown in Figure 1-106. The Tab Stops option can place up to
25 tabs at the specified locations, which are very useful for organizing the content. This option
can be also specified with the $TabStops directive as described in Appendix C. All of the other
90 Chapter 1: Introduction to EES
options affect the appearance of the content in the Equations window when the Syntax
Highlighting control in the status bar at the bottom of the Equations window
Figure 1-105) is selected. Clicking the Equations window button in the button bar below the
main menu bar when the Equations window is visible will also toggle the syntax highlighting
display on/off.
Syntax highlighting affects the display of keywords and both built-in and user-supplied
Functions, Procedures, Modules and Subprograms. The display options allow the both the case
and style of Function names and EES Keywords to be independently controlled. The font color
and style of constants and strings can be specified. Syntax highlighting can enhance the display
and make the equations easier to read as shown in Figure 1-107, where a section of the Equations
window is shown both without and with syntax highlighting using the default options.
Syntax highlighting must be on in order to have hyperlinks active. Note: Syntax highlighting
can increase the time required for EES to refresh the display. If you have a large EES program
and the display is slow, you may want to turn off syntax highlighting.
Clicking the Reset button will reset all preferences to their original (as-shipped) settings.
Chapter 1: Introduction to EES 91
Pressing OK will set the preferences you selected to be in effect for only the current session.
However, selecting the Store button will cause the preferences to be saved in an EES Preferences
(.prf) file. If you save the file as EES.prf in the EES working directory (which is the default
selection that is used when you select Store), then these preferences will automatically be loaded
whenever EES is started. Alternatively, you can save a .prf file that you want to apply only to
the current file in an alternative directory and subsequently load it using the Load button in
Figure 1-103.
Even more convenient is to load the preferences automatically using the $INCLUDE directive.
The $INCLUDE directive is discussed more completely in Section 14.5. Briefly, it provides a
method to automatically load various types of external files in an EES program. One type of file
that can automatically be loaded is the Preferences file.
For example, select Preferences from the Options dialog and then select the Display tab. Adjust
the font, size, etc. as you see fit and select Store. Save the .prf file in a directory of your
choosing (e.g., C:\temp\My Preferences.prf). Place an appropriate $INCLUDE directive at the top
of your EES file.
If you close and re-open the file you should find that the selections that you made in the
Preferences dialog and saved in the file My Preferences.prf are automatically loaded and used in
your EES file.
References
Mohr, P.J., B.N. Taylor, and D.B. Newell, "The 2010 CODATA Recommended Values of the
Fundamental Physical Constants (Web Version 6.0)," NIST, Gaithersburg, MD, 20899,
(2011).
Nellis, G.F. and S.A. Klein, Heat Transfer, Cambridge University Press, New York, (2009).
Shah, R.K. and A.L. London, Laminar Flow Forced Convection in Ducts, Academic Press, New
York, (1978).