Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Performing Iterations in EES

2,966 views

Published on

Performing Manual and Automated Iterations in Engineering Equation Solver (EES) - Examples from Heat Transfer.
All the EES codes shown in the examples are available at: https://goo.gl/KExGFi

Published in: Engineering
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Thank you very much. I was looking for this example for iterations in EES for long time
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Performing Iterations in EES

  1. 1. Performing Manual and Automated Iterations in Engineering Equation Solver (EES) Examples from Heat Transfer Naveed ur Rehman http://www.naveedurrehman.com/ 4th June, 2018
  2. 2. All the EES codes shown in the examples are available at: https://goo.gl/KExGFi 2
  3. 3. A problem that doesn’t require iterative solution 3
  4. 4. A problem that doesn’t require iterative solution 𝑄 = β„Žπ΄ 𝑇𝑠 βˆ’ π‘‡π‘Ž Let’s say: 𝑄 = 2000π‘Š 𝐴 = 1π‘š2 π‘‡π‘Ž = 25°𝐢 β„Ž = 10𝑃 Where, 𝑃 = π‘ƒπ‘Ÿ π‘‡π‘Ž for β€˜Air’ Find 𝑇𝑠? Note: The Prandtl number, which is a material property, is required at a known temperature (Ta=25⁰C). No iteration is needed! 4
  5. 5. A problem that doesn’t require iterative solution 𝑄 = β„Žπ΄ 𝑇𝑠 βˆ’ π‘‡π‘Ž Let’s say: 𝑄 = 2000π‘Š 𝐴 = 1π‘š2 π‘‡π‘Ž = 25°𝐢 β„Ž = 10𝑃 Where, 𝑃 = π‘ƒπ‘Ÿ π‘‡π‘Ž for β€˜Air’ Find 𝑇𝑠? Q = h*A*(Ts-Ta) Q = 2000 [W] A = 1 [m^2] Ta = 25 [C] h = 10*P P = prandtl(Air,T=Ta) EES Codes (Code-1.EES) 5
  6. 6. A problem that require iterative solution 6 Performing manual iteration in EES
  7. 7. A problem that require iterative solution 𝑄 = β„Žπ΄ 𝑇𝑠 βˆ’ π‘‡π‘Ž Let’s say: 𝑄 = 2000π‘Š 𝐴 = 1π‘š2 π‘‡π‘Ž = 25°𝐢 β„Ž = 10𝑃 Where, 𝑃 = π‘ƒπ‘Ÿ 𝑇𝑠 for β€˜Air’ Find 𝑇𝑠? Note: The Prandtl number, which is a material property, is required at an unknown temperature! This problem can not be solved without performing iteration. 7 MANUAL
  8. 8. A problem that require iterative solution 𝑄 = β„Žπ΄ 𝑇𝑠 βˆ’ π‘‡π‘Ž Let’s say: 𝑄 = 2000π‘Š 𝐴 = 1π‘š2 π‘‡π‘Ž = 25°𝐢 β„Ž = 10𝑃 Where, 𝑃 = π‘ƒπ‘Ÿ 𝑇𝑠 for β€˜Air’ Find 𝑇𝑠? Q = h*A*(Ts-Ta) Q = 2000 [W] A = 1 [m^2] Ta = 25 [C] h = 10*P P = prandtl(Air,T=Ts) EES Codes (Code-2.EES) Wrong approach! 8 MANUAL
  9. 9. A problem that require iterative solution 𝑄 = β„Žπ΄ 𝑇𝑠 βˆ’ π‘‡π‘Ž Let’s say: 𝑄 = 2000π‘Š 𝐴 = 1π‘š2 π‘‡π‘Ž = 25°𝐢 β„Ž = 10𝑃 Where, 𝑃 = π‘ƒπ‘Ÿ 𝑇𝑠 for β€˜Air’ Find 𝑇𝑠? Q = h*A*(Ts-Ta) Q = 2000 [W] A = 1 [m^2] Ta = 25 [C] h = 10*P Ts_guess = 100 [C] check = Ts_guess - Ts P = prandtl(Air,T=Ts_guess) EES Codes (Code-3.EES) Right approach! Assume some β€˜guess’ value of the unknown variable. Your guess will correct only when the difference between the solution and your guess will be β€˜0’ i.e. check = 0 Evaluate material property at guess value. 9 MANUAL
  10. 10. Check is not β€˜0’ so an iteration is required. Set the guess variable value to the current solution. A problem that require iterative solution 𝑄 = β„Žπ΄ 𝑇𝑠 βˆ’ π‘‡π‘Ž Let’s say: 𝑄 = 2000π‘Š 𝐴 = 1π‘š2 π‘‡π‘Ž = 25°𝐢 β„Ž = 10𝑃 Where, 𝑃 = π‘ƒπ‘Ÿ 𝑇𝑠 for β€˜Air’ Find 𝑇𝑠? Q = h*A*(Ts-Ta) Q = 2000 [W] A = 1 [m^2] Ta = 25 [C] h = 10*P Ts_guess = 305.9 [C] check = Ts_guess - Ts P = prandtl(Air,T=Ts_guess) EES Codes (Code-3.EES) Right approach! 10 MANUAL
  11. 11. A problem that require iterative solution 𝑄 = β„Žπ΄ 𝑇𝑠 βˆ’ π‘‡π‘Ž Let’s say: 𝑄 = 2000π‘Š 𝐴 = 1π‘š2 π‘‡π‘Ž = 25°𝐢 β„Ž = 10𝑃 Where, 𝑃 = π‘ƒπ‘Ÿ 𝑇𝑠 for β€˜Air’ Find 𝑇𝑠? Q = h*A*(Ts-Ta) Q = 2000 [W] A = 1 [m^2] Ta = 25 [C] h = 10*P Ts_guess = 313.3 [C] check = Ts_guess - Ts P = prandtl(Air,T=Ts_guess) EES Codes (Code-3.EES) Right approach! 11 Check is still not β€˜0’ so another iteration is required. Set the guess variable value to the current solution. MANUAL
  12. 12. A problem that require iterative solution 𝑄 = β„Žπ΄ 𝑇𝑠 βˆ’ π‘‡π‘Ž Let’s say: 𝑄 = 2000π‘Š 𝐴 = 1π‘š2 π‘‡π‘Ž = 25°𝐢 β„Ž = 10𝑃 Where, 𝑃 = π‘ƒπ‘Ÿ 𝑇𝑠 for β€˜Air’ Find 𝑇𝑠? Q = h*A*(Ts-Ta) Q = 2000 [W] A = 1 [m^2] Ta = 25 [C] h = 10*P Ts_guess = 313.3 [C] check = Ts_guess - Ts P = prandtl(Air,T=Ts_guess) EES Codes (Code-3.EES) Right approach! Check is approx. β€˜0’ so no further iteration is required. The current solution (or guess) is the final answer. 12 MANUAL
  13. 13. A problem that require iterative solution 13 Performing automated iteration in EES
  14. 14. A problem that require iterative solution 𝑄 = β„Žπ΄ 𝑇𝑠 βˆ’ π‘‡π‘Ž Let’s say: 𝑄 = 2000π‘Š 𝐴 = 1π‘š2 π‘‡π‘Ž = 25°𝐢 β„Ž = 10𝑃 Where, 𝑃 = π‘ƒπ‘Ÿ 𝑇𝑠 for β€˜Air’ Find 𝑇𝑠? 14 Same problem AUTOMATED
  15. 15. A problem that require iterative solution 15 Subprogram solver(Ts_guess : Ts) Q = h*A*(Ts-Ta) Q = 2000 [W] A = 1 [m^2] Ta = 25 [C] h = 10*P P = prandtl(Air,T=Ts_guess) End EES Codes (Code-4.EES) Step #1 Create a β€˜solver β€˜ subprogram as shown containing the original codes of your main problem. Make sure that you are evaluating the material properties at the guess value. AUTOMATED
  16. 16. Procedure control(Ts_guess : Ts) nmax = 100 dTmin = 0.001 n:=0 Ts := Ts_guess Repeat T = Ts Call solver(T : Ts) n := n +1 dT = abs(T-Ts) Until ( (n=nmax) or (dT < dTmin)) End A problem that require iterative solution 16 EES Codes (Code-4.EES) Step #2 Create a β€˜controlβ€˜ procedure to control the flow of iterations. There is no need to change anything else in this procedure. β€˜nmax’ is the maximum number of iterations (100 is more than enough!) dTmin is the stopping condition, similar to β€˜check’. If you want to be super precise, use dTmin=0 AUTOMATED
  17. 17. Ts_guess = 100 [C] Call control(Ts_guess : Ts) A problem that require iterative solution 17 EES Codes (Code-4.EES) Step #3 Write these codes outside any procedure or subprogram. Yes, this is the initial guess. AUTOMATED
  18. 18. A problem that require iterative solution 18 Performing automated iteration in EES and getting more than single output
  19. 19. A problem that require iterative solution 𝑄 = β„Žπ΄ 𝑇𝑠 βˆ’ π‘‡π‘Ž Let’s say: 𝑄 = 2000π‘Š 𝐴 = 1π‘š2 π‘‡π‘Ž = 25°𝐢 β„Ž = 10𝑃 Where, 𝑃 = π‘ƒπ‘Ÿ 𝑇𝑠 for β€˜Air’ Find 𝑇𝑠, P and β„Ž? 19 Same problem but required variables are more than single. AUTOMATED Multiple outputs
  20. 20. Subprogram solver(Ts_guess : Ts, P, h) Q = h*A*(Ts-Ta) Q = 2000 [W] A = 1 [m^2] Ta = 25 [C] h = 10*P P = prandtl(Air,T=Ts_guess) End A problem that require iterative solution 20 EES Codes (Code-5.EES) Step #1 More variables at output AUTOMATED Multiple outputs
  21. 21. Procedure control(Ts_guess : Ts, P, h) nmax = 100 dTmin = 0.001 n:=0 Ts := Ts_guess Repeat T = Ts Call solver(T : Ts, P, h) n := n +1 dT = abs(T-Ts) Until ( (n=nmax) or (dT < dTmin)) End A problem that require iterative solution 21 EES Codes (Code-5.EES) Step #2 More variables at output AUTOMATED Multiple outputs
  22. 22. Ts_guess = 100 [C] Call control(Ts_guess : Ts, P, h) A problem that require iterative solution 22 EES Codes (Code-5.EES) Step #3 More variables at output AUTOMATED Multiple outputs
  23. 23. A problem that require iterative solution 23 Performing automated iteration in EES and working with inputs from outside subprogram
  24. 24. A problem that require iterative solution 24 EES Codes (Code-6.EES) Subprogram solver(Ts_guess, Q, A, Ta : Ts, P, h) Q = h*A*(Ts-Ta) h = 10*P P = prandtl(Air,T=Ts_guess) End Procedure control(Ts_guess, Q, A, Ta : Ts, P, h) nmax = 100 dTmin = 0.001 n:=0 Ts := Ts_guess Repeat T = Ts Call solver(T, Q, A, Ta : Ts, P, h) n := n +1 dT = abs(T-Ts) Until ( (n=nmax) or (dT < dTmin)) End Q = 2000 [W] A = 1 [m^2] Ta = 25 [C] Ts_guess = 100 [C] Call control(Ts_guess, Q, A, Ta : Ts, P, h) Step #1 Step #2 Step #3 AUTOMATED Multiple inputs and outputs
  25. 25. Performing Manual and Automated Iterations in Engineering Equation Solver (EES) Examples from Heat Transfer Thank you! Naveed ur Rehman http://www.naveedurrehman.com/

Γ—