Professional Documents
Culture Documents
1 Introduction to EES
The File menu provides commands for opening and saving work files and libraries, and for printing. The Edit menu provides the editing commands to cut, copy, and paste information. The Search menu provides Find and Replace commands for use in the Equations window.
E24-1
E24: Appendix A.1 Introduction to EES The Options menu provides commands for: setting the guess values and bounds of variables; selecting the unit system, providing information on built-in and user-supplied library functions; and setting program preferences. The Calculate menu contains the commands to check, format and solve the equation set. Commands to check the unit consistency of the equations and to update guess values are also provided. The Tables menu contains commands to set up and alter the contents of the Parametric and Lookup Tables. The Parametric Table, which is similar to a spreadsheet, allows the equation set to be solved repeatedly while varying the values of one or more variables. The Lookup table holds user-supplied data which can be interpolated in one or two dimensions with internal functions and used in the solution of the equation set. The Plot menu provides commands to prepare a new plot of data in the Parametric, Lookup, Array or Integral tables or to modify an existing plot. Curve-fitting capability and thermodynamic property plots are also provided. The Windows menu provides a convenient method of bringing any of the EES windows to the front or to organize the windows. The Help menu provides commands for accessing the online help documentation. The Heat Transfer menu provides access to EES solutions to problems developed for this textbook. A basic capability provided by EES is the solution of a set of non-linear algebraic equations. To demonstrate this capability, start EES and enter the simple example problem shown in Figure A.1-2 in the Equations window.
Text is entered in the same manner as for a word processor. Formatting rules are as follows: 1. Upper and lower case letters are not distinguished. EES will (optionally) change the case of all variables to match the manner in which they first appear. 2. Blank lines and spaces may be entered as desired since they are ignored. 3. Comments must enclosed within braces { } or within quote marks " ". Comments may span as many lines as needed. Comments within braces may be nested in which case only the outermost set of { } are in effect. Comments within quotes will also be displayed in the Formatted Equations window. 4. Variable names must start with a letter and consist of any keyboard characters except ( ) | * / + - ^ { } : " or ;. Array variables are identified with square braces around the array index or
E24-2
E24: Appendix A.1 Introduction to EES indices, e.g., X[5]. String variables are identified by a $ as the last character. The maximum length of a variable name is 30 characters. Equations can be as long as needed. Multiple equations may be entered on one line if they are separated by a semi-colon (;). The caret symbol (^) or ** is used to indicate raising to a power. The order in which the equations are entered does not matter. The position of known and unknown variables in the equations does not matter. The units of numerical constants can be entered by following the value with the unit designation in square brackets.
5. 6. 7. 8. 9.
If you wish, you may view the equations in mathematical notation (Figure A.1-3) by selecting the Formatted Equations command from the Windows menu or from the Formatted Equations speed-button located below the menu bar .
Select the Solve command from the Calculate menu or press F2. A dialog window will appear indicating the progress of the solution. When the calculations are completed, the button will change from Abort to Continue (Figure A.1-4).
Click the Continue button. The solution to this equation set will then be displayed (Figure A.15).
E24-3
E24-4
The known information (the values provided by the problem statement) should be entered and immediately converted to these base SI units; we work in a country that is somewhat backwards with respect to its unit system and therefore it will often be necessary to convert from units such as inch, torr, atm, tons (or mass or of cooling) etc. to the more rational set of SI units. All of the variables used in the problem statement and solution should have the appropriate base SI unit; EES allows the units of each variable to be explicitly set, as discussed in the subsequent example. The advantage of this technique is that these units are completely self-consistent. It is not necessary to do any unit conversions as you work the problem. Once the problem has been solved then you can convert the solution to whatever units are most appropriate. The other advantage of this technique is that EES can check that all of your equations are consistent with respect to the units that have been set for the variables that are involved. This capability provides a powerful check on your solution. Finally, EES allows equations to be entered in any order; however, it is a good idea to enter the equations in a logical order. When possible, equations should be entered in a sequential manner so that an intermediate solution can be obtained after each equation is entered. This is similar to the way you would solve the problem by hand or using a conventional programming language (that is, wherever possible, each new equation should use only information that was stated or obtained from a previous solution). There are several reasons for doing this. First, it allows your program to be debugged as it is written; it is common for a student to enter all of the equations involved in a problem into EES before he or she attempts to solve the problem. When a solution cannot be obtained it is a frustrating process to debug the over-long program. Better to enter a single equation and see if it solves. When problems are encountered they can immediately be isolated to the last equation that was entered. This is good engineering practice; when something goes wrong with an experiment or device, an experienced engineer will immediately try to isolate the problem by testing each sub-system of the device. There is another advantage to using the sequential approach discussed in the previous paragraph. EES solves a set of non-linear equations using an iterative approach; the approach starts from an
E24-5
E24: Appendix A.1 Introduction to EES initial point characterized by a set of guess values for each variable and iteratively improves the solution. The solution process is easier if the initial guess values for each variable are close to the final solution. By obtaining a series of intermediate solutions it is possible to always have a good set of guess values available; this allows the iterations that are required to go more smoothly.
The free-stream air temperature (T) is 20C and the air pressure is p=100 kPa. The resistance of the platinum wire (R) depends on its temperature (T) according to:
0.5 R = 0.30 ohm/K T -270 [K]
(A.1-1)
where R is in (ohm) and T is in (K). The hot wire is provided with a 0.1 amp current (i); the electrical dissipation is convected to the free stream so that the temperature of the wire depends on the heat transfer coefficient and therefore, on the velocity of the air. The measured voltage across the wire is related to the free stream velocity. Calculate and plot the voltage measured across the wire (V) for a range of free stream velocity (u) between 20 m/s and 100 m/s. Assume that the wire temperature does not vary either axially or radially.
E24-6
Start EES or select the New command from the File menu if you have already been using the program. A blank Equations window will appear. Since this problem will require use of the built-in properties for air, it is necessary to specify the unit system that will be used to obtain property information with the Unit System command in the Options menu (see Figure A.1-6). Note that the pressure will be expressed in Pa and energy units will be expressed in J with these choices. The first section of your EES program should contain the known information and accomplish the process of converting this information to the base SI unit system. Your code can be organized into sections that are identified with comments, as shown below:
"Appendix A: Heat Transfer Example" "Input Information"
Because the text entered in the equation window was enclosed by quotes, it is not considered to be part of the problem. Rather, comments are used to make the code more readable. It is good engineering practice to provide comments with most every line of code that you write so that you can, at a glance, recall what the purpose of the code is. The other method for entering comments is to use the curly brackets, {}. The known information is entered next, starting with the dimensions of the wire. The diameter of the wire is stated as 0.5 mm which is not in a base SI unit; therefore, the diameter must be converted from mm to m. This can be accomplished by dividing by 1000; however, you may not remember that mm and m are related by a factor of 1000. Also, the conversions between other units are not as easy to remember. Fortunately, EES has the built-in function convert which provides the conversion constant between any two dimensionally consistent units. The protocol for calling the convert function is: Convert(From,To) where From and To are unit designations. For example, to get the conversion factor required to convert mm to m would require Convert(mm,m). To view the units that are programmed in EES, select Unit Conversion Info from the Options menu (Figure A.1-8); the units are separated by dimension (the left scroll box).
E24-7
E24: Appendix A.1 Introduction to EES Therefore, the wire dimensions are entered and converted according to:
D=0.5 [mm]*convert(mm,m) L=1.0 [cm]*convert(cm,m) "diameter of wire" "length of wire"
Notice that the diameter is entered as 0.5 [mm] (the constant 0.5 has units mm) which is converted from mm to m using the convert function. Thus the variable D has units m. The units of the variables D and L must be explicitly set by the user. There are a number of ways to set the units. The easiest method is to select Variable Info from the Options menu (Figure A.1-9). The units for each variable can be entered in the column Units, as shown.
Select Check Units from the Calculate menu and EES will indicate that no unit problems are detected because the units of the constants, the variables, and the conversion factors are all consistent. To see this more clearly, select Formatted Equations from the Windows menu (Figure A.1-10) and notice that the units of the constants and conversion appropriately cancel. The Formatted Equations window provides the equations in a more readable format and these equations can be copied and pasted into a Word document in order to facilitate report writing.
E24-8
Notice that the process of converting the free stream temperature from C to K does not involve a simple multiplication and therefore a special function (converttemp) is required. The calling protocol for converttemp is: ConvertTemp(From,To,value) where From and To are the temperature scales to the converted from and converted to, respectively, and value is the value of the temperature to be converted. The units for each of the input parameters are entered in the Variable Information window. At this point we are ready to begin to solve the problem, keeping in mind the strategy that the equations should be entered sequentially so that solutions can be obtained periodically. The solution to this problem begins with an energy balance on the wire. This is a steady-state problem since the voltage at a specified air velocity does not vary with time. The steady-state ) with heat transfer energy balance on the wire balances generation due to ohmic dissipation ( g conv ), as shown in Figure A.1-7: from the surface due to convection ( q