Engineering Equation Solver (Thai)

12,116 views

Published on

This slides are used in the class "Skill and Personality Development for Mechanical Engineers".

Published in: Education, Technology, Business
3 Comments
18 Likes
Statistics
Notes
  • thanks.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • thanks. it is very good. may i see lecture 2??
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • perfect
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
12,116
On SlideShare
0
From Embeds
0
Number of Embeds
1,455
Actions
Shares
0
Downloads
0
Comments
3
Likes
18
Embeds 0
No embeds

No notes for slide

Engineering Equation Solver (Thai)

  1. 1. Engineering Equation Solver Denpong Soodphakdee, Ph.D. Department of Mechanical Engineering Khon Kaen University denpong@kku.ac.th
  2. 2. EES ME KKU License 2
  3. 3. What is EES? o EES (pronounced “Ease”) is a general purpose equation solver, modeling and analysis tool which has started life specifically for the purpose of engineering education o It is quite capable (it is also used in industry) and is more than adequate for engineering education purposes o Students find it far easier to use than any other software they have been introduced to, including:  Mathematica  Matlab  Mathcad 3
  4. 4. Advantage of EES o It requires no real programming (although you can!) o Implicit (iterative solver) – equations in any order o It is geared towards engineering problems o Units enabled and unit conversion routines o Formatted equations view with Greek letters and maths symbols o Lots of online example programs o Excellent online help and online manual o It comes FREE to the entire Department – BOTH students and staff! o Students can take it home – it is small in size! 4
  5. 5. Features of EES o Excellent engineering features:  Lookup tables with linear-, cubic- and quadratic interpolation  Regressions  Plots and overlay plots  Diagram window (User Interface)  Animation (Cool!)  Built-in property library - thermo, fluid and material properties (easily extendible by users)  Predefined engineering constants o Excellent engineering analysis features:  Parametric studies  Uncertainty propagation  Min/Max. 5
  6. 6. Solving Nonlinear Equations o How would you solve the following? x 2  y 3  77 x 2 y 1 2   x  1.234 o And an implicit equation in f such as the following?  D  1 2.51  2.0log     3.7 Re f    f 6
  7. 7. Tutorial 1 :: Solving Nonlinear Equations o Create a new EES worksheet and save it as BasicEquation.ees o Now type in the nonlinear set of equations and solve for the 3 unknowns x 2  y 3  77 x 2 y 1 2   x  1.234 o The order in which the equations are entered does not matter at all! use Ctrl+F to see the equations in formatted view 7
  8. 8. Equation Formatting o Two types of comments:  Comments in quotes are shown in formatted view  Comments in curly brackets are not shown in formatted view quot;Equation Formattingquot; – this will be shown in formatted view quot;!Equation Formattingquot; – this will be shown in red {Equation Formatting} – this will not be shown  Can also highlight any text (select and then right-click) 8
  9. 9. Equation Formatting o Ordinary variables and equations  quot;Define some variables. Actually, they are really constants as you cannot later assign other values to any of them!quot; a = 1 b = 2 c = 3 e = 4  quot;!A more complex equation using these variablesquot; sqrt(1 + (a+b)/c + d) = e • Look at the formatted view! Ctrl-F • Note the position of the unknown “d” in the equation - it does not have to be on the left! 9
  10. 10. Equation Formatting o Raising the power k^2 = 5 Exponents are shown as superscripts in format view. o Clever Greek letters! or DELTAT = 1 deltaP = 2 or OMEGA = 100 omega = 100 or THETA = 45 theta = 45 Note: Although the formatted view distinguishes between upper and lower cases, the EES solver does not! Hence “OMEGA” and “omega” are regarded as the same variable! 10
  11. 11. Equation Formatting o General formatting y_old = 10 quot;Subscriptquot; z|alpha = 9 quot;Superscriptquot; x_dot = 10 quot;It understands dots & double dots!quot; x_ddot = 2 quot;Double dotquot; x_hat = 2 quot;Hatquot; x_bar = 22 quot;Over barquot; angle|o = 20 quot;Superscriptquot; T|star = 325 quot;Special superscript - starquot; Y|plus = 0.12 quot;Special superscript - plusquot; T_infinity = 25 quot;Often used to denote freestreamquot; 11
  12. 12. Constant o EES defines a large number of constants. Check out Options > Constants. Of interest are the following: (gravity)  g# So one can write F = m * g# Instead of g = 9.81 [m/s^2] F=m*g (Stefan-Boltzmann constant – radiation)  sigma# (Speed of light)  C# (Universal gas constant)  R# So the Ideal Gas Constant for air would be: R_air = R# / MolarMass(Air) 12
  13. 13. The Unit System o EES is fully unit-aware o The Unit System is the first thing that should be set at the start of a project  Set from the Options menu (next slide)  Safer to explicitly set units using directives (which will override dialog settings): $UnitSystem SI MASS DEG KPA C KJ 13
  14. 14. The Unit System o The unit system can be set by Option > Unit System 14
  15. 15. The Unit System o Individual constants can be assigned units: m = 25 [kg] a = 2.5 [m/s^2] F=m*a o Units cannot be assigned for equations, but EES will automatically determine the units for F (shown in purple in the results window) 15
  16. 16. The Unit System 16
  17. 17. The Unit System o EES also allows unit conversions  Suppose we have the equation F = m a, but we want F in kN. If we set [kN] for F in the units map, we will get a warning So we do this: F = m * a * convert(N, kN) quot;Alternatively you can do this, but then you need to know the conversion constantquot; F_1 = (m * a) / 1000 [N/kN] F_2 = m * a * 0.001 [kN/N] 17
  18. 18. The Unit System o We can even convert between British Gravitational and SI units: m_3 = 10 [lbm] a_3 = 3.5 [m/s^2] F_3 = (m_3 * convert(lbm, kg)) * a_3 18
  19. 19. The Unit System o We can also assign units to constants in situ to make a constant clearer, for example: quot;This is clearer than the next...quot; time = 3.5 [h] * 3600 [s/h] quot;The fact that this is 3.5 hours is not as apparent!quot; time = 12600 [s] o EES online examples:  Examples/Units conversion/Checking units and unit conversion (HeatEx.EES) 19
  20. 20. Built-in Functions o EES provides built-in functions in the following categories:  Mathematics  Fluid properties  Solid / Liquid properties  EES Library routines  External routines o Example code can be pasted o Function Info (Help) 20
  21. 21. Built-in Functions o A Maths example x=cos(Value) quot;This is exactly as it was pastedquot; Now it is up to you to modify the statement as you want it. Maybe you wanted to do the following: theta = 30 [deg] x_coordinate = cos(theta) or z = cos(33) quot;Hardcoding values is rarely a good ideaquot; 21
  22. 22. Built-in Functions o Maths examples LogValue = log10(100)quot;The log10(Value) was pasted!quot; T = 140 [C] quot;Note American spelling!quot; E = E_(Aluminum, T) o Integral equations  EES can perform numerical integration and differentiation. How would you solve the following? 3 y   x dx3 0 quot;An integral equation – be sure to switch off complex numbersquot; y = Integral(x^3, x, 0, 3, 0.06) 22
  23. 23. Built-in Functions o Property examples For properties one typically has to specify conditions such as pressures and temperatures. Furthermore, one has to specify the material (a solid or a fluid). The simplest example is probably the density of a gas. Let’s paste the density for air from the Fluid Properties Function Info dialog: rho_1=Density(Air,T=T_1,P=P_1) 23
  24. 24. Built-in Functions o Solid property example quot;Young’s Modulus – note the underscorequot; T = 140 [C] E = E_(Aluminum, T) 24
  25. 25. Built-in Functions o The property functions can be pasted from menu Option > Function Information 25
  26. 26. The Option Menu o Have a careful look at the functionality provided under the Options menu: Variable Info  Function Info  Unit Conversion Info  Constants  Unit System  Stop Criteria  Default Info  Preferences.  26
  27. 27. END OF EES LECTURE 1
  28. 28. Parametric Study o A parametric study is in essence the study of the influence of variations in one or more variables (parameters) on the solution. o In most software, a parametric study is performed by repeatedly solving the model whilst making adjustments to the desired variables (parameters) in the form of a loop. o EES accomplishes this very elegantly by using a spreadsheet-like approach. 28
  29. 29. Parametric Study Example o Let’s look at a really simple example  Say you want to perform a calculation such as: y  cos   But you want to perform this operation for several angles, say between 0 and 360 degrees.  To do this in EES, simply enter this equation in the equations window 29
  30. 30. The Parametric Table o A really simple example…:  EES does this in a particularly elegant way. It uses a spreadsheet to specify the variables that are to be specified as well at the variables for which the results are to be monitored: • The number of runs • Each row is a new run • theta is now specified in the table, and EES will automatically list the results of y in the same table 30
  31. 31. The Parametric Table o The independent (specified) variables are simply typed into the EES parametric table. One can manually type in all the values, or utilize the quick-fill button: 31
  32. 32. The Parametric Table o The simple equation can be solved for each value of theta and the results y are displayed in the table. 32
  33. 33. Plot Basics o Engineering data is often best visualized by means of graphs (plots). o Plotting in EES is really easy. Once the data is available, a plot can be generated in the following simple steps:  Select the plot type from the menu (e.g. X-Y)  Select the data source (e.g. Parametric table or array)  Select the dependent (Y-axis) and independent (X-axis) variables for plotting  Select the plot formatting: Heading and description • Line type and appearance (e.g spline, dot-dash, colour) • Marker and legend, tics, grid lines, number format • Automatic update from data source (on/off) • Scale of axes, log or linear plot type etc • 33
  34. 34. Plot Basics o Create x-y plot from Plots menu: 34
  35. 35. Plot Basics 35
  36. 36. Tutorial 2 :: Projectile Parametric Table o Lets create a more realistic model on which we can do a parametric study (Projectile ParametricTable.EES):  A simple projectile movement is used to demonstrate the use of a parametric study.  We can modify the angle theta as well as the initial velocity u either individually or simultaneously and determine their influence on the maximum distance that the projectile will travel. 36
  37. 37. Tutorial 2 :: Projectile Parametric Table o Equations of motion v=u+a*t s = u * t + (1/2) * a * t^2 o To calculate the maximum distance, calculate the time the projectile needs to reach maximum height by applying the first equation to the vertical velocity component (v = 0 and a = g). The total time will be twice this amount. o Now apply this total time to the horizontal velocity (which remains constant) using the second equation. The x-acceleration in the second equation is obviously zero.quot; 37
  38. 38. Tutorial 2 :: Projectile Parametric Table o So the equations will be as follows (remember the unit system!): $UnitSystem SI MASS C KPA KJ DEG quot;Equations of motion v=u+a*t Eq. 1 s = u * t + (1/2) * a * t^2 Eq. 2quot; quot;Define initial valuesquot; u = 30 [m/s] theta = 45 [deg] quot;This must be commented if you run the parametric table“ quot;Calculationsquot; u_x = u * cos(theta) quot;X-component velocityquot; u_y = u * sin(theta) quot;Y-component velocityquot; t = 2 * u_y / g# quot;Time needed to max distance – from Eq. 1quot; s = u_x * t quot;Max distance – from Eq. 2quot; 38
  39. 39. Tutorial 2 :: Projectile Parametric Table o Solve the model by Calculate > Solve menu or pressing F2 and observe the results: 39
  40. 40. Tutorial 2 :: Projectile Parametric Table o Now create a Parametric table by adding theta, s, t, ux and uy to it and vary theta from 0 to 90: 40
  41. 41. Tutorial 2 :: Projectile Parametric Table o The relation between theta and s can be plotted. 41
  42. 42. Plots and Graphs o There are 3 types of graphs that can be plotted with EES:  X-Y plots  Bar plots  X-Y-Z plots (3- dimensional) • Surface plots • Contour plots 42
  43. 43. END OF EES LECTURE 2

×