You are on page 1of 5

10.

539  
Lecture  6  Four  Important  Linear  PDEs  
3.  Heat  equation  

Prof.  Dean  Wang  


 
Heat  equation  
  𝑢! 𝑥, 𝑡 − 𝑘∆𝑢 𝑥, 𝑡 = 0,               (1)  
and  the  inhomogeneous  heat  equation  
  𝑢! 𝑥, 𝑡 − 𝑘∆𝑢 𝑥, 𝑡 = 𝑓 𝑥, 𝑡 .             (2)  
Where    
  𝑘  is  a  coefficient  (e.g.,  thermal  conductivity)  
!" !,!
   𝑢! 𝑥, 𝑡 = !"                 (3)    
! ! !! ! !,!
  ∆𝑢 𝑥, 𝑡 = !!! 𝑢!! 𝑢!! = !!! !           (4)  
!!!
 
For  one-­‐dimensional  problems   𝑥! = 𝑥 ,  we  have  
Heat  equation  as  
!" !,! ! ! ! !,!
  !"
+ 𝑘 !" ! = 0                 (5)  
and  inhomogeneous  heat  equation  as  
!" !,! ! ! ! !,!
  !"
+ 𝑘 !" ! = 𝑓 𝑥, 𝑡                 (6)  
 
For  two-­‐dimensional  problems   𝑥! = 𝑥, 𝑎𝑛𝑑  𝑥! = 𝑦 ,  we  have  
Heat  equation  as  
!" !,!,! ! ! ! !,!,! ! ! ! !,!,!
  !"
+𝑘 !" !
+ !" !
= 0             (7)  
and  inhomogeneous  heat  equation  as  
!" !,!,! ! ! ! !,!,! ! ! ! !,!,!
  !"
+𝑘 !" !
+ !" !
= 𝑓 𝑥, 𝑦, 𝑡           (8)  

1. Physical  Interpretation  
The  heat  equation,  also  known  as  the  diffusion  equation,  describes  in  typical  
applications  the  evolution  in  time  of  the  density  𝑢  of  some  quantity  such  as  heat,  
chemical  concentration,  etc.    
 
  n  
dS  
 
 
 
 
  V  
 

  1  
 
If  𝑉  is  any  smooth  region,  the  change  rate  of  the  total  quantity  within  𝑉  equals  the  
negative  of  the  net  flux  through  the  boundary  𝜕𝑉  of  𝑉 :  
!
  !" !
𝑢𝑑𝑥 = − !" 𝐹 ∙ 𝑛𝑑𝑆               (9)  
Where  𝐹  denotes  the  flux  density  and  𝑛  the  outer  normal  unit.    
 
In  view  of  the  Gauss-­‐Green  Theorem,  we  have  
!
  !" !
𝑢𝑑𝑥 = − !" 𝐹 ∙ 𝑛𝑑𝑆 = − ! 𝑑𝑖𝑣𝐹 𝑑𝑉           (10)  
and  since  𝑉  is  arbitrary,  we  have  
  𝑢! = −𝑑𝑖𝑣𝐹                   (11)    
 
In  many  instances  it  is  physically  reasonable  to  assume  the  flux  𝐹  is  proportional  to  
!"
the  gradient  !" ,  thus  
!"
  𝐹 = −𝑘∇𝑢 = −𝑘 !"                 (12)  
Substituting  (12)  into  (11)  give  the  heat  equation  as  
  𝑢! = −𝑑𝑖𝑣𝐹 = 𝑑𝑖𝑣 𝑘∇𝑢 = 𝑘∆𝑢             (13)  

2. Solve  Heat  Equation  using  Separation  of  Variables  


Solve  the  problem    
𝑢! − 𝑘𝑢!! = 0                                                        0 ≤ 𝑥 ≤ 𝑎
  𝑢 𝑥, 0 = 𝑔 𝑥                                                                                                         (14)  
𝑢 0, 𝑡 = 𝑢 𝑎, 𝑡 = 0                                                                        
 
 
  g(x)  
 
 
 
  x  
  0   a  
 
Step  1:  Let  𝑢 𝑥, 𝑡 = 𝑋 𝑥 𝑇 𝑡               (15)  
Step  2:  Substituting  (15)  into  (14)  gives  
  𝑇 ! 𝑋 − 𝑘𝑇𝑋 !! = 0                 (16)    
Step  3:  Dividing  (16)  by  𝑘𝑋𝑇,  we  have  
!! !"
  !"
= !
= −𝜆                     (17)  
!" !
Step  4:  First  solve   ! !
= −𝜆  with  𝑋 0 = 𝑋 𝑎 = 0,  which  is  an  eigenvalue  problem.      
  𝝀 = 𝟎  
!" !
The  solution  to   ! ! = 0  is  
  𝑋 𝑥 = 𝑐! + 𝑐! 𝑥                 (18)  
Applying  𝑋 0 = 𝑋 𝑎 = 0  we  have  the  trivial  solution  𝑋 𝑥 = 0  

  2  
 
  𝝀 < 𝟎  
!" !
  The  solution  to   ! ! = −𝜆  is    
𝑋 𝑥 = 𝐴sinh −𝜆𝑥 + 𝐵cosh −𝜆𝑥         (19)  
Applying  𝑋 0 = 𝑋 𝑎 = 0  we  have  the  trivial  solution  𝑋 𝑥 = 0  (Exercise!)  
 
    𝝀 > 𝟎  
We  have  the  solution  as    
 𝑋 𝑥 = 𝐴sin 𝜆𝑥 + 𝐵cos 𝜆𝑥           (20)  
  Applying  𝑋 0 = 0  gives  𝐵 = 0.  
  Now  applying  𝑋 𝑎 = 0  gives  
    𝐴sin 𝜆𝑎 = 0       =>   𝜆𝑎 = 𝑛𝜋          𝑛 = 1, 2, 3 …             (21)  
  So  we  have      
!"# !" !
  𝑋! 𝑥 = sin !
,   𝜆! = !
,   𝑛 = 1, 2, 3 …       (22)  
!!
Step  5:  Now  solving  the  time  differential  equation  !" = −𝜆!  gives  
!" !
  𝑇! = 𝑒 !!!! ! = 𝑒 !! ! !               (23)  
Step  6:  So  we  have  the  product  solution  in  the  form  as  
𝒏𝝅 𝟐
𝒏𝝅𝒙
  𝒖 𝒙, 𝒕 = 𝑿 𝒙 𝑻 𝒕 = ! 𝒏!𝟏 𝒄𝒏 𝐬𝐢𝐧 𝒂
𝒆!𝒌 𝒂 𝒕         (24)  
Step  7:  Use  BC:  𝑢 0, 𝑥 = 𝑔 𝑥 ,  we  have  
!"#
  𝑔 𝑥 = ! !!! 𝑐! sin !
              (25)  
Step  9:  Eq.  (25)  means  that  𝑐!  are  the  Fourier  coefficients  of  𝑓 𝑥 ,  so  
! ! !"#
  𝑐! = ! ! 𝑔 𝑥 sin ! 𝑑𝑥                 (26)  
 
Exercise  1:  Verify  (26).    
 
Example  1:  Solve  the  following  heat  equation  using  Matlab  “pdepd”.  
𝑢! − 𝑢!! = 0                                                                          0 ≤ 𝑥 ≤ 1
  𝑢 𝑥, 0 = 𝑠𝑖𝑛 𝜋𝑥                                                                                                       (27)  
𝑢 0, 𝑡 = 𝑢 1, 𝑡 = 0                                                                                    
 
A  little  bit  of  background  about  Matlab  “pdepe”:  
pdepe  solves  PDEs  of  the  form  (see  the  Matlab  manual):  
!" !" ! !" !"
  𝑐 𝑥, 𝑡, 𝑢, !" !" = 𝑥 !! !" 𝑥 ! 𝑓 𝑥, 𝑡, 𝑢, !" + 𝑠 𝑥, 𝑡, 𝑢, !"     (28)  
with  the  boundary  conditions  
  𝑝 𝑥! , 𝑡, 𝑢 + 𝑞 𝑥! , 𝑡 ∙ 𝑓 𝑥! , 𝑡, 𝑢, 𝑢! = 0           (29)  
  𝑝 𝑥! , 𝑡, 𝑢 + 𝑞 𝑥! , 𝑡 ∙ 𝑓 𝑟, 𝑡, 𝑢, 𝑢! = 0           (30)  
For  our  problem  (27),  we  have  
  𝑐 = 1,   𝑚 = 0,    𝑓 = 𝑢! ,  𝑠 = 0                 (31)  
  𝑝 0, 𝑡, 𝑢 = 𝑢,    𝑞 0, 𝑡 = 0,  𝑝 1, 𝑡, 𝑢 = 𝑢,    𝑞 1, 𝑡 = 0       (32)  
Step  1:  Specify  “pdefun.m”  

  3  
  function  [c,f,s]=pdefun(x,t,u,dudx)  
c=1;  
f=dudx;  
s=0;  
end  
Step  2:  Specify  the  boundary  condition  function  “bcfun.m”  
  function  [pl,ql,pr,qr]  =  bcfun(xl,ul,xr,ur,t)  
      pl=ul;  
ql=0;  
pr=ur;  
qr=0;  
end  
Step  3:  Specify  the  initial  condition  function  “inifun.m”  
  function  value  =  inifun(x)  
value  =  sin(pi*x);  
end  
Step  4:  Matlab  script  “pde_main.m”  that  solves  and  plots  
  m  =  0;  
%Define  the  solution  mesh  
x  =  linspace(0,1,100);  
t  =  linspace(0,1,100);  
%Solve  the  heat  equation  
u  =  pdepe(m,@pdefun,@inifun,@bcfun,x,t);  
%Plot  solution  
surf(x,t,u);  
title('Surface  plot  of  solution.');  xlabel('Distance  x');  
ylabel('Time  t');  
fig  =  plot(x,u(1,:),'erase','xor');  
%Plot  solution  changing  with  time  
for  k=2:length(t)    
       set(fig,'xdata',x,'ydata',u(k,:))    
       pause(.2)  
end  
Surface plot of solution.

0.8

0.6

0.4

0.2

0
1
0.8 1
0.6 0.8
0.4 0.6
0.4
0.2
0.2

 
0 0
Time t
Distance x

 
 

  4  
3. Fundamental  Solution  of  Heat  Equation  
The  function    
!!
!
  Φ 𝑥, 𝑡 = !!"# !/!
𝑒 ! !!"               (33)  
where   𝑥 = 𝑥!! + 𝑥!! +
⋯ + 𝑥!! !/!  
is  the  fundamental  solution  of  the  heat  equation.  

4. Solution  of  Heat  Equations    


Now  we  can  use  the  fundamental  solution  to  solve  the  initial-­‐value  heat  equation  
and  inhomogeneous  heat  equation.  
4.1 Initial-­‐value  problem    
𝑢 𝑥, 𝑡 − 𝑘∆𝑢 𝑥, 𝑡 = 0
  !               (34)  
𝑢 𝑥, 0 = 𝑔 𝑥                                    
A  solution  to  Eq.  (33)  can  be  given  as  
!!! !
!
  𝑢 𝑥, 𝑡 = !!
Φ 𝑥 − 𝑦, 𝑡 𝑔 𝑦 𝑑𝑦 = !!"# !/! !!
𝑒! !!" 𝑔 𝑦 𝑑𝑦         (35)  

4.2 Inhomogeneous  problem    


𝑢! 𝑥, 𝑡 − 𝑘∆𝑢 𝑥, 𝑡 = 𝑓 𝑥, 𝑡
              (36)  
𝑢 𝑥, 0 = 0                                                                    
A  solution  to  Eq.  (33)  can  be  given  as  
!
 𝑢 𝑥, 𝑡 = ! !! Φ 𝑥 − 𝑦, 𝑡 − 𝑠 𝑓 𝑦, 𝑠 𝑑𝑦 𝑑𝑠  
!!! !
! ! !
  = ! !!" !!! !/! ! !
𝑒 !! !!! 𝑓 𝑦, 𝑠 𝑑𝑦𝑑𝑠             (37)  
 

  5  

You might also like