Professional Documents
Culture Documents
539
Lecture
6
Four
Important
Linear
PDEs
3.
Heat
equation
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
𝝀 < 𝟎
!" !
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.
5