You are on page 1of 8

4/24/15

NUMERICAL  SOLUTION  OF  THE  1-­‐D  DIFFUSION  


EQUATION  (39)  
I    Main  Topics  
A  MoCvaCon  for  using  a  numerical  technique  
B  Non-­‐dimensionalizing  the  diffusion  (heat  flow)  
equaCon  
C  Finite-­‐difference  soluCon  to  the  1-­‐D  heat  
equaCon  (diffusion  equaCon)    

4/24/15   GG454   1  

II  MoCvaCon  for  using  a  numerical  technique  

A  Insight  into  the  second  order  PDE  governing  


transient  flow  
B  Insight  into  effect  of  iniCal  condiCons  and  
boundary  condiCons  on  the  soluCon  
C  To  solve  for  a  wide  range  of  iniCal  value/
boundary  value  combinaCons  and  geometries  
D  Finite-­‐difference  method  a  good  learning  tool  

4/24/15   GG454   2  

1  
4/24/15  

III  Non-­‐dimensionalizing  the  heat  flow  


equaCon    
A  Start  with  the  heat  flow   ∂T ∂2 T
equaCon,  where     =α 2
∂t ∂x
T  =  temperature  (variable)  
t  =  Cme  (variable)  
α  =thermal  diffusivity  
(constant)  
x  =  posiCon  (variable)      
B  "Nondimensionalizing"            
(or  scaling)  eliminates  α  

4/24/15   GG454   3  

III  Non-­‐dimensionalizing  the  heat  flow  equaCon    


∂T ∂2 T
=α 2
∂t ∂x

C  Select  constant  scaling  terms  


xmax ( dimensions:length )
Tmax ( dimensions: K )
!

xmax 2
α
( dimensions:time )
D  Define  dimensionless  terms  
x* = x xmax
T * = T Tmax
⎛ x 2⎞
t* = t ⎜ max ⎟
⎝ α ⎠

4/24/15   GG454   4  

2  
4/24/15  

III  Non-­‐dimensionalizing  the  heat  flow  equaCon    


∂T ∂2 T
=α 2
∂t ∂x

C  Select  constant  scaling  terms   E  Recast  dimensioned  terms  


xmax ( dimensions:length ) x = x * xmax
Tmax ( dimensions: K )
! T = T *Tmax
⎛ x 2⎞
xmax 2 t = t * ⎜ max ⎟
α
( dimensions:time ) ⎝ α ⎠
D  Define  dimensionless  terms   F  Take  derivaCves  of  x*,  t*,  and  T  
x* = x xmax dx * dx = 1 xmax
T * = T Tmax α
dt * dt =
⎛ x 2⎞ xmax 2
t* = t ⎜ max ⎟
⎝ α ⎠ dT dT * = Tmax

4/24/15   GG454   5  

III  Non-­‐dimensionalizing  the  heat  flow  equaCon    


∂T ∂2 T
=α 2
∂t ∂x
F  DerivaCves  of  x*,  t*,  and  T  (from  previous  slide)  
dx * 1 dt * α dT
= = = Tmax
dx xmax dt xmax 2 dT *

G  Recast  derivaCves  in  heat  flow  equaCon  using  chain  rule  


∂T ∂T * dt * dT ∂T * α
= = Tmax
∂t ∂t * dt dT * ∂t * ( xmax )2
∂T ∂T * dx * dT ∂T * 1
= = Tmax
∂x ∂x * dx dT * ∂x * xmax
⎡ ∂T ⎤ ⎡ ∂T ⎤ ⎡ ∂T * 1 ⎤
∂⎢ ⎥ ∂⎢ ⎥ ∂⎢ Tmax ⎥
∂2 T ∂t ⎦ 1 = ∂ T * Tmax
= ⎣ ∂x ⎦ = ⎣ ∂x ⎦ dx * =
2
⎣ * x max

∂x 2 ∂x ∂x * dx ∂x * xmax ∂x *2 ( xmax )2

4/24/15   GG454   6  

3  
4/24/15  

III  Non-­‐dimensionalizing  the  heat  flow  equaCon    


∂T ∂2 T
=α 2
∂t ∂x
G  Dimensioned  derivaCves  in  heat  flow  equaCon  
∂T ∂T * α ∂ 2 T ∂ 2 T * α Tmax
= Tmax =
∂t ∂t * ( max )2
x ∂x 2 ∂x *2 ( xmax )2

H  SubsCtute  for  dimensioned  derivaCves  in  heat  flow  equaCon  


to  obtain  dimensionless  form  
∂T * α ∂ 2 T * Tmax
Tmax 2 =α
∂t * ( xmax ) ∂x *2 ( xmax )2
∂T * ∂ 2 T *
=
∂t * ∂x *2

 All  terms  here  are  dimensionless  

4/24/15   GG454   7  

III  Finite-­‐difference  soluCon  to  the  1-­‐D  


heat  equaCon  (diffusion  equaCon)    
A  Set  up  a  dimensionless  grid  
1  Let  Δx*  =  Δt*  =1  
2  The  row  number  I  gives  
the  Cme  step  
3  The  column  number  j  
gives  the  posiCon    

4/24/15   GG454   8  

4  
4/24/15  

III  Finite-­‐difference  soluCon  to  the  1-­‐D  


heat  equaCon  (diffusion  equaCon)    
∂T * ∂ 2 T *
=
B  Explicit  method   ∂t * ∂x *2
1  Approximate  ∂T*/∂t*  
Row  i+1  
∂T * [T *(x*,t *+Δt*) − T *(x*,t*)]

∂t * Δt *
∂T * [T *i+1, j −T *i, j ] Row  i  

∂t * i+1/2, j Δt *
2  Approximate  ∂2T*/∂x*2  
⎛ ∂T * ⎞ ∂⎛ ∂T * ⎞ ⎛ ∂T * ⎞
− ∂⎜
∂⎜ ⎟ ⎜⎝ ⎟⎠ ⎝ ∂x * ⎟⎠ i, j−1/2
∂ T*
2
⎝ ∂x * ⎠ ∂x *
= ≈ i, j+1/2

∂x *2 ∂x * Δx * Problem:  approximaCons  
T *i, j+1 −T *i, j T *i, j −T *i, j−1 are  at  two  different  
∂2 T * − T *i, j+1 −2T *i, j −T *i, j−1
≈ Δx * Δx * = points,  so  equaCng  them  
∂x * i, j
2
Δx * ( Δx *)2 is  problemaCc.  

4/24/15   GG454   9  

III  Finite-­‐difference  soluCon  to  the  1-­‐D  


heat  equaCon  (diffusion  equaCon)    
∂T * ∂ 2 T *
B  Explicit  method   =
∂t * ∂x *2
1  Approximate  ∂T*/∂t*  
Row  i+1  
∂T * [T *i+1, j −T *i, j ]

∂t * i+1/2, j Δt *
Row  i  
2  Approximate  ∂2T*/∂x*2  
∂2 T * T *i, j+1 −2T *i, j −T *i, j−1

∂x *2 i, j ( Δx *)2
3  Set  the  derivaCves  equal  
4  Solve  for  T*i+1,j  
5  SoluCon  prone  to  numerical  
error:  approximaCons  are  
at  two  different  points  
4/24/15   GG454   10  

5  
4/24/15  

III  Finite-­‐difference  soluCon  to  the  1-­‐D  


heat  equaCon  (diffusion  equaCon)    
C  Crank-­‐Nicolson  method  
1  Evaluate  ∂2T/∂x2  at  •  
by  averaging  the  
second  derivaCves  at  
!  

4/24/15   GG454   11  

III  Finite-­‐difference  soluCon  to  the  1-­‐D  


heat  equaCon  (diffusion  equaCon)    
2  Approximate  ∂T*/∂t*  at  •"
∂T * T * +T *i, j
≈ i+1, j
∂t * i+1/2, j Δt *

3  Approximate  ∂2T*/∂x*2  at  •  by  


averaging  values  at  !  
∂2 T * 1 ⎛ ∂2 T * ∂2 T * ⎞
≈ ⎜ +
∂x * i+1/2, j 2 ⎝ ∂x * i+1, j ∂x *2 i, j ⎟⎠
2 2

∂2 T * 1 ⎛ T *i+1, j+1 −2T *i+1, j −T *i+1, j−1 T *i, j+1 −2T *i, j −T *i, j−1 ⎞
≈ +
∂x *2 i+1/2, j 2 ⎜⎝ ( Δx *)2 ( Δx *)2 ⎟

∂2 T * 1⎛T * −2T *i+1, j −T *i+1, j−1 +T *i, j+1 −2T *i, j −T *i, j−1 ⎞
≈ ⎜ i+1, j+1 ⎟
∂x * i+1/2, j 2 ⎝
2
( Δx *)2 ⎠

4/24/15   GG454   12  

6  
4/24/15  

III  Finite-­‐difference  soluCon  to  the  1-­‐D  


heat  equaCon  (diffusion  equaCon)    
4  Now  equate  the  dimensionless  parCal   ∂T * ∂ 2 T *
=
derivaCves,  selng  dx*  =  dt*  =  1   ∂t * ∂x *2
T *i+1, j −T *i, j ≈
1
2
(
T *i+1, j+1 −2T *i+1, j +T *i+1, j−1 +T *i, j+1 −2T *i, j +T *i, j−1 )
5  Solve  for  T*i+1,j    

T *i+1, j ≈
1
2
(
T *i+1, j+1 −2T *i+1, j +T *i+1, j−1 +T *i, j+1 +T *i, j−1 )
2T *i+1, j ≈ T *i+1, j+1 −2T *i+1, j +T *i+1, j−1 +T *i, j+1 +T *i, j−1
4T *i+1, j ≈ T *i+1, j+1 +T *i+1, j−1 +T *i, j+1 +T *i, j−1
T *i+1, j+1 +T *i+1, j−1 +T *i, j+1 +T *i, j−1
T *i+1, j ≈
4

4/24/15   GG454   13  

III  Finite-­‐difference  soluCon  to  the  1-­‐D  


heat  equaCon  (diffusion  equaCon)    
T *i+1, j+1 +T *i+1, j−1 +T *i, j+1 +T *i, j−1
T *i+1, j ≈
4

5  The  value  of  T  at  any  


node  is  equal  to  the  
average  value  of  the  
two  adjacent  nodes  at  
the  same  Cme  step  and  
the  two  nodes  at  the  
preceding  Cme  step  

4/24/15   GG454   14  

7  
4/24/15  

III  Finite-­‐difference  soluCon  to  the  1-­‐D  


heat  equaCon  (diffusion  equaCon)    
D  Recap  
1  Convert  dimensioned   ⎛ x 2⎞
problem  to   x* = x xmax T * = T Tmax t* = t ⎜ max ⎟
dimensionless  problem   ⎝ α ⎠
2  Solve  the  dimensionless  
problem   T *i+1, j+1 +T *i+1, j−1 +T *i, j+1 +T *i, j−1
3  Convert  dimensionless   T *i+1, j ≈
temperature  soluCon   4
back  to  dimensioned  
soluCons  by  mulCplying   ⎛ x 2⎞
by  the  scaling  factor   x = x * xmax T = T *Tmax t = t * ⎜ max ⎟
⎝ α ⎠

4/24/15   GG454   15  

III  Finite-­‐difference  soluCon  to  the  1-­‐D  


heat  equaCon  (diffusion  equaCon)    
E  Closing  comments    
1  The  finite-­‐difference  method  is  essenCally  an  averaging  procedure  that  
describes  how  "informaCon"  propagates  within  a  system  
2  SoluCons  for  2-­‐D  Laplace  equaCon  and  1-­‐D  heat  equaCon  have  revealing  
similariCes  and  revealing  differences  
∂2 T ∂2 T ∂T ∂ 2 T
+ =0 =
∂x 2 ∂y 2 ∂t ∂x 2

The  value  of  T  at  the  red  node  is  approximately    


the  average  of  the  T  values  at  the  blue  nodes    
4/24/15   GG454   16  

8  

You might also like