Professional Documents
Culture Documents
EES Iterations
EES Iterations
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 Note: The Prandtl number, which is a
𝑇𝑎 = 25°𝐶 material property, is required at a known
ℎ = 10𝑃 temperature (Ta=25⁰C).
Where, No iteration is needed!
𝑃 = 𝑃𝑟 𝑇𝑎 for ‘Air’
Find 𝑇𝑠 ?
4
A problem that doesn’t require iterative solution
Q = h*A*(Ts-Ta)
Let’s say:
𝑄 = 2000𝑊 Q = 2000 [W]
𝐴 = 1𝑚2 A = 1 [m^2]
𝑇𝑎 = 25°𝐶 Ta = 25 [C]
h = 10*P
ℎ = 10𝑃
Where, P = prandtl(Air,T=Ta)
𝑃 = 𝑃𝑟 𝑇𝑎 for ‘Air’
Find 𝑇𝑠 ?
5
A problem that require iterative
solution
Performing manual iteration in EES
6
MANUAL
7
MANUAL
Q = h*A*(Ts-Ta)
Let’s say:
𝑄 = 2000𝑊 Q = 2000 [W]
𝐴 = 1𝑚2 A = 1 [m^2]
𝑇𝑎 = 25°𝐶 Ta = 25 [C]
h = 10*P
ℎ = 10𝑃
Where, P = prandtl(Air,T=Ts)
𝑃 = 𝑃𝑟 𝑇𝑠 for ‘Air’
Find 𝑇𝑠 ?
8
MANUAL
Q = h*A*(Ts-Ta)
Let’s say:
𝑄 = 2000𝑊 Q = 2000 [W]
𝐴 = 1𝑚2 A = 1 [m^2] Assume some ‘guess’ value of
Ta = 25 [C] the unknown variable. Your
𝑇𝑎 = 25°𝐶 guess will correct only when
h = 10*P
ℎ = 10𝑃 the difference between the
solution and your guess will
Where, Ts_guess = 100 [C]
be ‘0’ i.e. check = 0
check = Ts_guess - Ts
𝑃 = 𝑃𝑟 𝑇𝑠 for ‘Air’
P = prandtl(Air,T=Ts_guess) Evaluate
Find 𝑇𝑠 ? material
property at
guess value.
9
MANUAL
Q = h*A*(Ts-Ta)
Let’s say:
𝑄 = 2000𝑊 Q = 2000 [W]
𝐴 = 1𝑚2 A = 1 [m^2]
𝑇𝑎 = 25°𝐶 Ta = 25 [C]
h = 10*P
ℎ = 10𝑃
Where, Ts_guess = 305.9 [C]
Check is not ‘0’ so
check = Ts_guess - Ts
𝑃 = 𝑃𝑟 𝑇𝑠 for ‘Air’ an iteration is
P = prandtl(Air,T=Ts_guess) required.
Find 𝑇𝑠 ? Set the guess
variable value to the
current solution.
10
MANUAL
Q = h*A*(Ts-Ta)
Let’s say:
𝑄 = 2000𝑊 Q = 2000 [W]
𝐴 = 1𝑚2 A = 1 [m^2]
𝑇𝑎 = 25°𝐶 Ta = 25 [C]
h = 10*P
ℎ = 10𝑃
Where, Ts_guess = 313.3 [C]
Check is still not ‘0’
check = Ts_guess - Ts
𝑃 = 𝑃𝑟 𝑇𝑠 for ‘Air’ so another iteration
P = prandtl(Air,T=Ts_guess) is required.
Find 𝑇𝑠 ? Set the guess
variable value to the
current solution.
11
MANUAL
Q = h*A*(Ts-Ta)
Let’s say:
𝑄 = 2000𝑊 Q = 2000 [W]
𝐴 = 1𝑚2 A = 1 [m^2]
𝑇𝑎 = 25°𝐶 Ta = 25 [C]
h = 10*P
ℎ = 10𝑃
Where, Ts_guess = 313.3 [C]
Check is approx. ‘0’
check = Ts_guess - Ts
𝑃 = 𝑃𝑟 𝑇𝑠 for ‘Air’ so no further
P = prandtl(Air,T=Ts_guess) iteration is required.
Find 𝑇𝑠 ? The current solution
(or guess) is the final
answer.
12
A problem that require iterative
solution
Performing automated iteration in EES
13
AUTOMATED
14
AUTOMATED
Q = h*A*(Ts-Ta)
Create a ‘solver ‘ subprogram as
Q = 2000 [W] shown containing the original
A = 1 [m^2] codes of your main problem.
Ta = 25 [C]
h = 10*P
P = prandtl(Air,T=Ts_guess)
Make sure that you are
End
evaluating the material
properties at the guess value.
15
AUTOMATED
16
AUTOMATED
17
A problem that require iterative
solution
Performing automated iteration in EES
and getting more than single output
18
AUTOMATED
𝑄 = ℎ𝐴 𝑇𝑠 − 𝑇𝑎
Let’s say:
𝑄 = 2000𝑊
𝐴 = 1𝑚2
𝑇𝑎 = 25°𝐶 Same problem but
ℎ = 10𝑃 required variables
Where, are more than
𝑃 = 𝑃𝑟 𝑇𝑠 for ‘Air’ single.
Find 𝑇𝑠 , P and ℎ?
19
AUTOMATED
Q = h*A*(Ts-Ta)
More variables at output
Q = 2000 [W]
A = 1 [m^2]
Ta = 25 [C]
h = 10*P
P = prandtl(Air,T=Ts_guess)
End
20
AUTOMATED
End
21
AUTOMATED
22
A problem that require iterative
solution
Performing automated iteration in EES
and working with inputs from outside
subprogram 23
AUTOMATED
T = Ts
Call solver(T, Q, A, Ta : Ts, P, h)
n := n +1
dT = abs(T-Ts)
End
24
Performing
Manual and Automated Iterations
in
Engineering Equation Solver (EES)
Examples from Heat Transfer