Professional Documents
Culture Documents
iterations: 119
Comparison of the solutions using finite differences
and the analytical solution
Dependent variables
These values are calculated in the VB program
Wslab = x2 - x1 = 0.2 m Slab width
Dx = (Wslab) / nDx = 0.01 m distance interval
tstep = Dx^2 / (6*a) = 1.515 s time step to obtain Fo = 1/6
Fo = a*tstep/Dx^2 = 0.167 - must be <0.5 to be stable
nDtstep = (tfinal - tinitial) / t step = 118.8 - number of time intervals
x F
-0.1 0
-0.08 -59
-0.06 -95
-0.04 -95
-0.02 -59
0 0
0.02 59
0.04 95
0.06 95
0.08 59
0.1 0
Required is the temperature at a position:
0.05 m from mid plane
after a time
10
To be considered
For the comparison, check that both cases have the same input values.
U(x,t)
= x1, insert function P = 0 100
= x2, insert function Q = 0
80
60
40
20
0
-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1
Distance x [m]
Surface temperatures
Function P: Ts-0.1 = 0 ºC
Function Q: Ts+0.1 = 0 ºC
Do not change the location of the cells in the input range (those shaded in yellow).
The VB program looks in those cells for the appropriate values.
Input to yellow shaded cells.
If Fo is greater than 0.5, either use a smaller time step or fewer distance intervals.
When using the proposed time step, the value of the Fourier number has a fixed value
of Fo = 1/6
Temperature T
Tadim = (Ts - T) / (Ts - T0)
Ts - T = Tadim * (Ts -T0)
T= Ts - Tadim * (Ts -T0)
parison, check that both cases have the same input values.
defined with function F
with functions P & Q
)
0
36
73
10
8
14
4
Analytic solution
A slab is initially at uniform temperature T ini .
At time t = 0, it is inmersed in a fluid at temperature T s.
The thermal diffusivity is Alpha and the half thickness
is L.
Tini = 100 ºC
Ts = 0 ºC
Alpha = 1.10E-05 m²/s
L= 0.1 m
For
Tini = 100 ºC
Ts = 0 ºC
Tadim = (T - Ts) / (Tini - Ts)
T - Ts = Tadim * (Tini -Ts)
T= Ts + Tadim * (Tini -Ts)
Tadim = Tadim_Alpha_L_tau_x
Alpha = 1.10E-05 m²/s
L= 0.1 m
tau = 36 s
x= 0.06 m
Tadim = #VALUE! -
=
n
T-T s ∞
2⋅( -1 ) −(n+1/2)2⋅π 2⋅Fo
Dimensionless temperature of a slab according equation (3.44) [2] =∑ ⋅e ⋅cos ( ( n+1
T 0 -T s n = 0 ( n+1/2 )⋅π
Dimensionless temperature
tau Distance x [m]
s -0.1 -0.09 -0.08 -0.07 -0.06 -0.05 -0.04 -0.03 -0.02 -0.01 0 0.01 0.02 0.03
9.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
45.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
73.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
120.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
200.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
300.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
400.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
600.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
900.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
tau = 45 (s)
0.0
-0.1 -0.08 -0.06 -0.04 -0.02
Distance x from0midplane (m) 0.02 0.04
Temperature
tau Distance x [m]
s -0.1 -0.09 -0.08 -0.07 -0.06 -0.05 -0.04 -0.03 -0.02 -0.01 0 0.01 0.02 0.03
0.1 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
1.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
5.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
10.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
20.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
30.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
36.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
50.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
60.0 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
Location Temperature as function of the distance x, with the time tau as para
Temperature
120.0 x t x T
m ºC m s
100.0 0.06 0.0 -0.10 ###
0.06 10.0 -0.08 ###
80.0
0.06 20.0 -0.06 ###
0.06 30.0 -0.04 ###
60.0
0.06 40.0 -0.02 ###
40.0 0.06 50.0 0.00 ###
0.06 60.0 0.02 ###
20.0
0.06 70.0 0.04 ###
0.06 80.0 0.06 ###
0.0
-0.1 0.06 -0.08
90.0 -0.06 0.08 -0.04
tau = 0.1###
(s) tau = 1-0.02
(s) tau = 50 (s) 0.02
tau = 10 (s) 0.04
tau = 2
0.06 100 tau
0.10= 30 (s)
### tau = 36 (s) tau = 50 (s) tau = 60 (s) x
T
Fourier number
Fo = a * tau/L²
tau = Fo * L²/a (s)
(3 . 44 ), [1 ] page 151 Tadim = (T - Ts) / (Tini - Ts)
T - Ts =
Microsoft Equation
3.0
n page 1 of 3
2⋅( -1 ) −(n+1/2)2⋅π 2⋅Fo
⋅e ⋅cos ( ( n+1/2 ) ⋅π⋅( x/L )) (3. 44)
+1/2 )⋅π
page 2 of 3
0.02
tau = 10 (s) 0.04
tau = 20 (s) 0.06 0.08 0.1
tau = 60 (s) x
rev.cjc.21.04.2018
page 3 of 3
Analytic solution
A slab is initially at uniform temperature T ini . Fo
At time t = 0, it is inmersed in a fluid at temperature T s.
0.01
Considering the case of an infinite value of the 0.03
convection coefficient, the dimensionless temperature 0.1
is given by equation (3.44), [2], page 151. 0.3
1
Application of VB function
Tadim = Tadim_Alpha_L_tau_x Dimen
Alpha = 1.10E-05 m²/s
L= 0.1 m 1.00
tau = 90.9 s
0.90
x= 0.06 m
Tadim = #VALUE! - 0.80
Tadim (-)
0.70
Dx = 0.1
0.60
0.50
Fo = Alpha * t / L^2
t = Fo * L^2 / a 0.40
Fo = 0.01
0.30
L= 0.1
a= 1.10E-05 0.20
t = 9.09
0.10
0.00
-0.1
For
Tini = 100 ºC Fo
Ts = 0 ºC
0.01
Tadim = (T - Ts) / (Tini - Ts) 0.03
T - Ts = Tadim * (Tini -Ts) 0.1
T= Ts + Tadim * (Tini -Ts) 0.3
1
Evaluation at point whith location
x= 0.06 m
at a time
100
t= 40 s
Temperature (ºC)
90
Fo
1
Tadim = Tadim_Alpha_L_tau_x 80
Alpha = 1.10E-05
70
L= 1.0E-01 Fo
tau = 91 60
3
x= 0.06
Tadim = #VALUE! 50
Fo
40
T= #VALUE! ºC
30
Fo
20
10 Fo
0
-0.1 -0.08
=
n
T-T s ∞
2⋅( -1 ) −(n+1/2)2⋅π 2⋅Fo
Dimensionless temperature of a slab according equation (3.44) [2] =∑ ⋅e ⋅cos ( ( n+1
T 0 -T s n = 0 ( n+1/2 )⋅π
Dimensionless temperature Tadim (-)
tau Distance x [m]
s -0.1 -0.09 -0.08 -0.07 -0.06 -0.05 -0.04 -0.03 -0.02 -0.01 0 0.01 0.02 0.03
9.09 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
27.27 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
90.91 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
272.73 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
909.09 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
IF(Tadim_Alpha_L_tau_x($E$15,$E$16,$K8,L$7)>0,Tadim_Alpha_L_tau_x($E$15,$E$16,$K8,L$7),0)
Dimensionless temperature as function of distance x, with Fourier number as parameter (
0.1
1.1E-05 9 -0.1
1.00 Alpha L tau x
0.90
0.80 Fo=0.01
Tadim (-)
0.70
Fo=0.03
0.60
0.50
Fo=0.1
0.40
Fo=0.3
0.30
0.20
Fo=1
0.10
0.00
-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.0
Distance from midplane x (m)
Temperature
tau Distance x [m]
s -0.1 -0.09 -0.08 -0.07 -0.06 -0.05 -0.04 -0.03 -0.02 -0.01 0 0.01 0.02 0.03
9 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
27 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
91 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
273 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
909 ### ### ### ### ### ### ### ### ### ### ### ### ### ###
90
Fo=0.0
1
80 Location Time
x t x tau
70
m
Fo=0.0
ºC m s
3 0.06 0.0 -0.10 40.0
60
0.06 10.0 -0.08 40.0
50 0.06 20.0 -0.06 40.0
Fo=0.1
0.06 30.0 -0.04 40.0
40
0.06 40.0 -0.02 40.0
30 0.06 50.0 0.00 40.0
Fo=0.3
0.06 60.0 0.02 40.0
20 0.06 70.0 0.04 40.0
0.06 80.0 0.06 40.0
10 Fo=1
0.08 40.0
0 0.10 40.0
-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06
distance from midplane x (m)
Fourier number
Fo = a * tau/L²
tau = Fo * L²/a (s)
(3 . 44 ), [1 ] page 151 Tadim = (T - Ts) / (Tini - Ts)
T - Ts =
Microsoft Equation
3.0
n page 1 of 3
2⋅( -1 ) −(n+1/2)2⋅π 2⋅Fo
⋅e ⋅cos ( ( n+1/2 ) ⋅π⋅( x/L )) (3. 44)
+1/2 )⋅π
(-)
,$E$16,$K8,L$7),0)
mber as parameter (-)
page 2 of 3
rameter
rev.cjc.21.04.2018
page 3 of 3
Dimensioning
Constants
Help variables
'Slab width
Wslab = x2 - x1 ' (m) Slab Width.
'Distance interval
Delta_x = (Wslab) / nDelta_x ' (m) distance interval, Lslab/nDelta_x
'Step time
tstep = Delta_x ^ 2 / (6 * Alpha) ' (s) time step (to obtain Fo = 1/6)
'Fourier number
Fo = Alpha * tstep / Delta_x ^ 2 ' (-) Fourier number must be <0.5
'Number of time intervals
nDelta_t = (tfinal - tinitial) / tstep ' (-) number of time intervals
Starting values
t = tinitial 'set to the initial value
iter = 0 'the number of iterations
j=3 'actual column number
calculation and output
Main loop
Finite difference equation applied to column j
Y
end_of_main_loop:
End
tau for Fo = 1/6
Fourier number
Fo = a * tau/L²
tau = Fo * L² / Alpha
Fo = 1/6
tau = L² /(6 * Alpha)
[1] ChemEcalcs
Jeff Munic
http://www.chemecalcs.com/heat-equation.php
Function F(x)
'initial condition, insert function F(x) here:
'A function list can be found at Help |VB Documentation|VB Lang Reference|Functions
F = 100 * Sin(pi * x)
End Function
Function P(t)
' boundary condition at x=x1, insert function P(t) here:
P=0
End Function
Function Q(t)
'boundary condition at x=x2, insert function Q(t) here:
Q=0
End Function
Sub heat_eq()
'initial condition
For i = 0 To n
x = x1 + i * h
V(i) = F(x)
Next i
t = t_init
iter = 0 'the number of iterations
j=3 'column number for initial output
'main loop
Do
For i = 1 To n - 1
'below is the main finite difference equation
U(i) = V(i) + r * (V(i + 1) - 2 * V(i) + V(i - 1))
Next i
For i = 0 To n
V(i) = U(i) 'over writes array V for next time interval
Next i
'error checking: prevent infinite loop
If iter > 50000 Then
MsgBox ("Error, the program is not solved after 50,000 iterations")
GoTo end_of_main_loop
End If
If Abs(t - t_out(1)) < k / 2 Or Abs(t - t_out(2)) < k / 2 Or Abs(t - t_out(3)) < k / 2 Or Abs(t - t_out(4)) < k / 2 Or Abs(t
CR = 21 'reset current row
For i = 0 To n 'output to each row in column j
Cells(CR + i, j) = U(i)
Next i
j=j+1 'increment column
End If
t=t+k ' increment time to next interval
'keep calculating until time is within 1/2 interval of tmax
Loop While Abs(t_max - t) > k / 2
end_of_main_loop:
End Sub
- t_out(4)) < k / 2 Or Abs(t - t_out(5)) < k / 2 Then 'output other interval
Temperature response of a slab with negligible surface resistance
Deduction of the analytic solution [2]
44 ), [2 ] page 151
⋅π⋅( x /L )) (3. 44 )
-L 0 L x
n
T-T s ∞
2⋅( -1 ) −( n+1/2 )2⋅π2⋅Fo
=∑ ⋅e ⋅cos ( ( n
T 0 -T s n = 0 ( n+1/2 )⋅π
Microsoft Equation
3.0
n
T-T s ∞
2⋅( -1 ) −( n+1/2 )2⋅π 2⋅Fo
=∑ ⋅e ⋅cos ( ( n+1/2 ) ⋅π⋅( x /L ))
T 0 -T s n = 0 ( n+1/2 )⋅π
rev.cjc.03.05.2018
page 1 of 3
page 2 of 3
page 3 of 3
⋅π⋅( x /L )) (3. 44 )