SlideShare une entreprise Scribd logo
1  sur  25
Performing
Manual and Automated Iterations
in
Engineering Equation Solver (EES)
Examples from Heat Transfer
Naveed ur Rehman
http://www.naveedurrehman.com/
4th June, 2018
All the EES codes shown in the
examples are available at:
https://goo.gl/KExGFi
2
A problem that doesn’t require
iterative solution
3
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
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
A problem that require iterative
solution
6
Performing manual iteration in EES
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
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
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
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
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
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
A problem that require iterative
solution
13
Performing automated iteration in EES
A problem that require iterative solution
𝑄 = ℎ𝐴 𝑇𝑠 − 𝑇𝑎
Let’s say:
𝑄 = 2000𝑊
𝐴 = 1𝑚2
𝑇𝑎 = 25°𝐶
ℎ = 10𝑃
Where,
𝑃 = 𝑃𝑟 𝑇𝑠 for ‘Air’
Find 𝑇𝑠?
14
Same problem
AUTOMATED
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
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
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
A problem that require iterative
solution
18
Performing automated iteration in EES
and getting more than single output
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
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
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
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
A problem that require iterative
solution
23
Performing automated iteration in EES
and working with inputs from outside
subprogram
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
Performing
Manual and Automated Iterations
in
Engineering Equation Solver (EES)
Examples from Heat Transfer
Thank you! Naveed ur Rehman
http://www.naveedurrehman.com/

Contenu connexe

Tendances

Thermodynamic Chapter 5 Air Standard Cycle
Thermodynamic Chapter 5 Air Standard CycleThermodynamic Chapter 5 Air Standard Cycle
Thermodynamic Chapter 5 Air Standard Cycle
Muhammad Surahman
 
6th ed solution manual---fundamentals-of-heat-and-mass-transfer
6th ed solution manual---fundamentals-of-heat-and-mass-transfer6th ed solution manual---fundamentals-of-heat-and-mass-transfer
6th ed solution manual---fundamentals-of-heat-and-mass-transfer
Ronald Tenesaca
 
Thermodynamics Chapter 3- Heat Transfer
Thermodynamics Chapter 3- Heat TransferThermodynamics Chapter 3- Heat Transfer
Thermodynamics Chapter 3- Heat Transfer
VJTI Production
 

Tendances (20)

Equations
EquationsEquations
Equations
 
LECTURE Notes on compressor
LECTURE Notes on compressorLECTURE Notes on compressor
LECTURE Notes on compressor
 
Ch 05 MATLAB Applications in Chemical Engineering_陳奇中教授教學投影片
Ch 05 MATLAB Applications in Chemical Engineering_陳奇中教授教學投影片Ch 05 MATLAB Applications in Chemical Engineering_陳奇中教授教學投影片
Ch 05 MATLAB Applications in Chemical Engineering_陳奇中教授教學投影片
 
Hvac formulas
Hvac formulasHvac formulas
Hvac formulas
 
Batch Reactors. Chemcad Dynamic Simulation
Batch Reactors. Chemcad Dynamic SimulationBatch Reactors. Chemcad Dynamic Simulation
Batch Reactors. Chemcad Dynamic Simulation
 
Thermodynamic Chapter 5 Air Standard Cycle
Thermodynamic Chapter 5 Air Standard CycleThermodynamic Chapter 5 Air Standard Cycle
Thermodynamic Chapter 5 Air Standard Cycle
 
6th ed solution manual---fundamentals-of-heat-and-mass-transfer
6th ed solution manual---fundamentals-of-heat-and-mass-transfer6th ed solution manual---fundamentals-of-heat-and-mass-transfer
6th ed solution manual---fundamentals-of-heat-and-mass-transfer
 
Chapter_3.pdf
Chapter_3.pdfChapter_3.pdf
Chapter_3.pdf
 
SYNGAS Process Integration
SYNGAS Process IntegrationSYNGAS Process Integration
SYNGAS Process Integration
 
Matlab complex numbers
Matlab complex numbersMatlab complex numbers
Matlab complex numbers
 
Ideal reheat rankine cycle
Ideal reheat rankine cycleIdeal reheat rankine cycle
Ideal reheat rankine cycle
 
Modelling of a cooling tower in EES
Modelling of a cooling tower in EESModelling of a cooling tower in EES
Modelling of a cooling tower in EES
 
Finite DIfference Methods Mathematica
Finite DIfference Methods MathematicaFinite DIfference Methods Mathematica
Finite DIfference Methods Mathematica
 
4B group 4
4B group 44B group 4
4B group 4
 
Ch 6- fugacidad mezcla
Ch 6- fugacidad mezclaCh 6- fugacidad mezcla
Ch 6- fugacidad mezcla
 
Two Dimensional Steady Heat Conduction using MATLAB
Two Dimensional Steady Heat Conduction using MATLABTwo Dimensional Steady Heat Conduction using MATLAB
Two Dimensional Steady Heat Conduction using MATLAB
 
Thermodynamics Chapter 3- Heat Transfer
Thermodynamics Chapter 3- Heat TransferThermodynamics Chapter 3- Heat Transfer
Thermodynamics Chapter 3- Heat Transfer
 
(04052013) presentation on TSI.pptx
(04052013)  presentation on TSI.pptx(04052013)  presentation on TSI.pptx
(04052013) presentation on TSI.pptx
 
Gas turbine details
Gas turbine detailsGas turbine details
Gas turbine details
 
Refrigeration vtu atd notes pdf download
Refrigeration vtu atd notes pdf downloadRefrigeration vtu atd notes pdf download
Refrigeration vtu atd notes pdf download
 

Similaire à Performing Iterations in EES

T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptx
GadaFarhan
 
Non linear function
Non linear functionNon linear function
Non linear function
venyclaudia
 
Problem descriptionThe Jim Thornton Coffee House chain is .docx
Problem descriptionThe Jim Thornton Coffee House chain is .docxProblem descriptionThe Jim Thornton Coffee House chain is .docx
Problem descriptionThe Jim Thornton Coffee House chain is .docx
elishaoatway
 
Solutions_Manual_to_accompany_Applied_Nu.pdf
Solutions_Manual_to_accompany_Applied_Nu.pdfSolutions_Manual_to_accompany_Applied_Nu.pdf
Solutions_Manual_to_accompany_Applied_Nu.pdf
WaleedHussain30
 

Similaire à Performing Iterations in EES (20)

T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptx
 
01 - DAA - PPT.pptx
01 - DAA - PPT.pptx01 - DAA - PPT.pptx
01 - DAA - PPT.pptx
 
Data Structure: Algorithm and analysis
Data Structure: Algorithm and analysisData Structure: Algorithm and analysis
Data Structure: Algorithm and analysis
 
Non linear function
Non linear functionNon linear function
Non linear function
 
Lecture 08 of Agricultural instrumentation
Lecture 08 of Agricultural instrumentationLecture 08 of Agricultural instrumentation
Lecture 08 of Agricultural instrumentation
 
algo_vc_lecture8.ppt
algo_vc_lecture8.pptalgo_vc_lecture8.ppt
algo_vc_lecture8.ppt
 
Es272 ch1
Es272 ch1Es272 ch1
Es272 ch1
 
Admission in india 2014
Admission in india 2014Admission in india 2014
Admission in india 2014
 
chap5airstandardcycle2010-130703012738-02.pdf
chap5airstandardcycle2010-130703012738-02.pdfchap5airstandardcycle2010-130703012738-02.pdf
chap5airstandardcycle2010-130703012738-02.pdf
 
lesson2.ppsx
lesson2.ppsxlesson2.ppsx
lesson2.ppsx
 
Analysis of Algorithum
Analysis of AlgorithumAnalysis of Algorithum
Analysis of Algorithum
 
Video lectures for b.tech
Video lectures for b.techVideo lectures for b.tech
Video lectures for b.tech
 
Problem descriptionThe Jim Thornton Coffee House chain is .docx
Problem descriptionThe Jim Thornton Coffee House chain is .docxProblem descriptionThe Jim Thornton Coffee House chain is .docx
Problem descriptionThe Jim Thornton Coffee House chain is .docx
 
Software Metrics
Software MetricsSoftware Metrics
Software Metrics
 
Solutions_Manual_to_accompany_Applied_Nu.pdf
Solutions_Manual_to_accompany_Applied_Nu.pdfSolutions_Manual_to_accompany_Applied_Nu.pdf
Solutions_Manual_to_accompany_Applied_Nu.pdf
 
System Modeling
System ModelingSystem Modeling
System Modeling
 
Chapter one
Chapter oneChapter one
Chapter one
 
Solutions fox
Solutions   foxSolutions   fox
Solutions fox
 
Overview Of Using Calculator
Overview Of Using CalculatorOverview Of Using Calculator
Overview Of Using Calculator
 
Annotations.pdf
Annotations.pdfAnnotations.pdf
Annotations.pdf
 

Dernier

Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
jaanualu31
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
chumtiyababu
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 

Dernier (20)

Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 

Performing Iterations in EES

  • 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. All the EES codes shown in the examples are available at: https://goo.gl/KExGFi 2
  • 3. A problem that doesn’t require iterative solution 3
  • 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. 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. A problem that require iterative solution 6 Performing manual iteration in EES
  • 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. 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. 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. 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. 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. 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. A problem that require iterative solution 13 Performing automated iteration in EES
  • 14. A problem that require iterative solution 𝑄 = ℎ𝐴 𝑇𝑠 − 𝑇𝑎 Let’s say: 𝑄 = 2000𝑊 𝐴 = 1𝑚2 𝑇𝑎 = 25°𝐶 ℎ = 10𝑃 Where, 𝑃 = 𝑃𝑟 𝑇𝑠 for ‘Air’ Find 𝑇𝑠? 14 Same problem AUTOMATED
  • 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. 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. 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. A problem that require iterative solution 18 Performing automated iteration in EES and getting more than single output
  • 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. 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. 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. 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. A problem that require iterative solution 23 Performing automated iteration in EES and working with inputs from outside subprogram
  • 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. Performing Manual and Automated Iterations in Engineering Equation Solver (EES) Examples from Heat Transfer Thank you! Naveed ur Rehman http://www.naveedurrehman.com/