today - university of british columbia€¦ · conservation equations q ab(t)= z b a c(x,t) dx a b...
TRANSCRIPT
Today
• Diffusion equation -
• derivation (transport eqns in general)
• initial conditions, boundary conditions
• steady state
• separation of variables
Conservation equations
Qab(t) =Z b
ac(x, t) dx
a b
c(x,t) is linear mass density of ink in a long narrow tube.
Conservation equations
Qab(t) =Z b
ac(x, t) dx
a b
c(x,t) is linear mass density of ink in a long narrow tube.
Conservation equations
Qab(t) =Z b
ac(x, t) dx
a b
c(x,t) is linear mass density of ink in a long narrow tube.
dQab
dt
(t) =d
dt
Z b
ac(x, t) dx =
Z b
a
�
�tc(x, t) dx
Define the flux Ja to be the amount of mass crossing the line x=a per unit of time (particles moving right count as positive flux) .
In that case, the change of Q inside the a-b box can also be counted watching flux, that is, flux at a - flux at b:
dQab
dt(t) = �Jb + Ja
JbJa
Conservation equations - Transport equation
Qab(t) =Z b
ac(x, t) dx
a bdQab
dt
(t) =d
dt
Z b
ac(x, t) dx =
Z b
a
�
�tc(x, t) dx
dQab
dt(t) = �Jb + Ja
Conservation equations - Transport equation
Qab(t) =Z b
ac(x, t) dx
a bdQab
dt
(t) =d
dt
Z b
ac(x, t) dx =
Z b
a
�
�tc(x, t) dx
dQab
dt(t) = �Jb + Ja
Need a model for flux. Let’s consider simpler case first (not diffusion yet!)
If fluid in pipe is moving with velocity v, flux is vc:
dQab
dt(t) = �Jb + Ja
Z b
a
�
�tc(x, t) dx )
Ja = vc(a, t)
= �vc(b, t) + vc(a, t) = � vc(x, t)����b
a
= �Z b
av
�c
�xdx
�c
�t= �v
�c
�xCalled Transport equation.
= �Z b
av
�c
�xdx
Conservation equations - Diffusion equation
Qab(t) =Z b
ac(x, t) dx
a bdQab
dt
(t) =d
dt
Z b
ac(x, t) dx =
Z b
a
�
�tc(x, t) dx
Ja
= �D�c
�x
����x=a
Now lets consider diffusion. We can derive this from chemical potential but
it also makes sense that for diffusion:
dQab
dt(t) = �Jb + Ja
Conservation equations - Diffusion equation
Qab(t) =Z b
ac(x, t) dx
a bdQab
dt
(t) =d
dt
Z b
ac(x, t) dx =
Z b
a
�
�tc(x, t) dx
Ja
= �D�c
�x
����x=a
Now lets consider diffusion. We can derive this from chemical potential but
it also makes sense that for diffusion:
dQab
dt(t) = �Jb + Ja
dQab
dt(t) = �Jb + Ja = D
�c
�x
����x=b
�D�c
�x
����x=a
= D�c
�x
����b
a
=Z b
aD
�2c
�x2dx
Z b
a
�
�tc(x, t) dx
�
�tc(x, t) = D
�2
�x2c(x, t))
Conservation equations - Diffusion equation
Qab(t) =Z b
ac(x, t) dx
a bdQab
dt
(t) =d
dt
Z b
ac(x, t) dx =
Z b
a
�
�tc(x, t) dx
Ja
= �D�c
�x
����x=a
Now lets consider diffusion. We can derive this from chemical potential but
it also makes sense that for diffusion:
dQab
dt(t) = �Jb + Ja
dQab
dt(t) = �Jb + Ja = D
�c
�x
����x=b
�D�c
�x
����x=a
= D�c
�x
����b
a
=Z b
aD
�2c
�x2dx
Z b
a
�
�tc(x, t) dx
�
�tc(x, t) = D
�2
�x2c(x, t))
The Diffusion Equation
dc
dt
= D
d
2c
dx
2
Initial and boundary conditions
Initial and boundary conditions
• One derivative in time requires an initial condition in t.
Initial and boundary conditions
• One derivative in time requires an initial condition in t.
• Two derivatives in space require two “initial conditions” in x (i.e. one at x=0 and one at x=L). Called boundary conditions (BCs).
Initial and boundary conditions
• One derivative in time requires an initial condition in t.
• Two derivatives in space require two “initial conditions” in x (i.e. one at x=0 and one at x=L). Called boundary conditions (BCs).
• Initial condition: c(x,0) = f(x) where f(x) gives initial concentration profile.
Initial and boundary conditions
• One derivative in time requires an initial condition in t.
• Two derivatives in space require two “initial conditions” in x (i.e. one at x=0 and one at x=L). Called boundary conditions (BCs).
• Initial condition: c(x,0) = f(x) where f(x) gives initial concentration profile.
• Boundary conditions:
Initial and boundary conditions
• One derivative in time requires an initial condition in t.
• Two derivatives in space require two “initial conditions” in x (i.e. one at x=0 and one at x=L). Called boundary conditions (BCs).
• Initial condition: c(x,0) = f(x) where f(x) gives initial concentration profile.
• Boundary conditions:
• c(0,t) = c0 and c(L,t) = cL Dirichlet conditions
Initial and boundary conditions
• One derivative in time requires an initial condition in t.
• Two derivatives in space require two “initial conditions” in x (i.e. one at x=0 and one at x=L). Called boundary conditions (BCs).
• Initial condition: c(x,0) = f(x) where f(x) gives initial concentration profile.
• Boundary conditions:
• c(0,t) = c0 and c(L,t) = cL
• anddc
dx
(0, t) = m0dc
dx
(L, t) = mL
Dirichlet conditions
Neumann conditions
Initial and boundary conditions
• One derivative in time requires an initial condition in t.
• Two derivatives in space require two “initial conditions” in x (i.e. one at x=0 and one at x=L). Called boundary conditions (BCs).
• Initial condition: c(x,0) = f(x) where f(x) gives initial concentration profile.
• Boundary conditions:
• c(0,t) = c0 and c(L,t) = cL
• anddc
dx
(0, t) = m0dc
dx
(L, t) = mL
Dirichlet conditions
Neumann conditions
Ja = �D
dc
dx
(a, t)Recall flux:Neumann conditions also called flux conditions (no-flux when m0 = mL = 0)
Initial and boundary conditions
• One derivative in time requires an initial condition in t.
• Two derivatives in space require two “initial conditions” in x (i.e. one at x=0 and one at x=L). Called boundary conditions (BCs).
• Initial condition: c(x,0) = f(x) where f(x) gives initial concentration profile.
• Boundary conditions:
• c(0,t) = c0 and c(L,t) = cL
• and
• c(0,t) = c0 and
dc
dx
(0, t) = m0dc
dx
(L, t) = mL
Dirichlet conditions
Neumann conditions
Mixed conditionsdc
dx
(L, t) = mL
(no-flux conditions)
Initial and boundary conditions
• One derivative in time requires an initial condition in t.
• Two derivatives in space require two “initial conditions” in x (i.e. one at x=0 and one at x=L). Called boundary conditions (BCs).
• Initial condition: c(x,0) = f(x) where f(x) gives initial concentration profile.
• Boundary conditions:
• c(0,t) = c0 and c(L,t) = cL
• and
• c(0,t) = c0 and
•
dc
dx
(0, t) = m0dc
dx
(L, t) = mL
Dirichlet conditions
Neumann conditions
Mixed conditionsdc
dx
(L, t) = mL
a
dc
dx
(0, t) + bc(0, t) = m0 Robin conditions
(no-flux conditions)
The Diffusion equation
• What does a steady state of the Diffusion equation look like?
The Diffusion Equation
dc
dt
= D
d
2c
dx
2
The Diffusion equation
• What does a steady state of the Diffusion equation look like?
The Diffusion Equation
dc
dt
= D
d
2c
dx
2
0 = D
d
2c
dx
2
The Diffusion equation
• What does a steady state of the Diffusion equation look like?
The Diffusion Equation
dc
dt
= D
d
2c
dx
2
0 = D
d
2c
dx
2
css(x) = Ax + B
The Diffusion equation
• What does a steady state of the Diffusion equation look like?
• A and B can be determined using the BCs. Getting A from Neumann conditions requires using the IC as well (total mass conservation).
The Diffusion Equation
dc
dt
= D
d
2c
dx
2
0 = D
d
2c
dx
2
css(x) = Ax + B
Separation of variables
Separation of variables
• Doc cam
This pdf is also posted on the lecture slides page.
• Find the Fourier series for f(x) = 2u0(x)-1 on the interval [-1,1].
fFS(x) = A0 + a1 cos
⇣�x
L
⌘+ a2 cos
✓2�x
L
◆+ · · ·
+b1 sin
⇣�x
L
⌘+ c2 sin
✓2�x
L
◆+ · · ·b2
Fourier series
• Find the Fourier series for f(x) = 2u0(x)-1 on the interval [-1,1].
• Our hope is that f(x) = fFS(x) so we calculate coefficients as if they were equal:
fFS(x) = A0 + a1 cos
⇣�x
L
⌘+ a2 cos
✓2�x
L
◆+ · · ·
+b1 sin
⇣�x
L
⌘+ c2 sin
✓2�x
L
◆+ · · ·b2
Fourier series
• Find the Fourier series for f(x) = 2u0(x)-1 on the interval [-1,1].
• Our hope is that f(x) = fFS(x) so we calculate coefficients as if they were equal:
fFS(x) = A0 + a1 cos
⇣�x
L
⌘+ a2 cos
✓2�x
L
◆+ · · ·
+b1 sin
⇣�x
L
⌘+ c2 sin
✓2�x
L
◆+ · · ·
bn =1L
Z L
�Lf(x) sin
⇣n�x
L
⌘dx
an =
1
L
Z L
�Lf(x) cos
⇣n�x
L
⌘dx
A0 =1
2L
Z L
�Lf(x) dx
b2
Fourier series
• Find the Fourier series for f(x) = 2u0(x)-1 on the interval [-1,1].
• Our hope is that f(x) = fFS(x) so we calculate coefficients as if they were equal:
fFS(x) = A0 + a1 cos
⇣�x
L
⌘+ a2 cos
✓2�x
L
◆+ · · ·
+b1 sin
⇣�x
L
⌘+ c2 sin
✓2�x
L
◆+ · · ·
bn =1L
Z L
�Lf(x) sin
⇣n�x
L
⌘dx
an =
1
L
Z L
�Lf(x) cos
⇣n�x
L
⌘dx
A0 =1
2L
Z L
�Lf(x) dx
• To simplify formulas, usually define a0 = 2A0 =
1L
Z L
�Lf(x) dx
b2
Fourier series
• Find the Fourier series for f(x) = 2u0(x)-1 on the interval [-1,1].
• Our hope is that f(x) = fFS(x) so we calculate coefficients as if they were equal:
fFS(x) = A0 + a1 cos
⇣�x
L
⌘+ a2 cos
✓2�x
L
◆+ · · ·
+b1 sin
⇣�x
L
⌘+ c2 sin
✓2�x
L
◆+ · · ·
bn =1L
Z L
�Lf(x) sin
⇣n�x
L
⌘dx
an =
1
L
Z L
�Lf(x) cos
⇣n�x
L
⌘dx
A0 =1
2L
Z L
�Lf(x) dx
• To simplify formulas, usually define a0 = 2A0 =
1L
Z L
�Lf(x) dx
b2
Fourier series
• Find the Fourier series for f(x) = 2u0(x)-1 on the interval [-1,1].
• Our hope is that f(x) = fFS(x) so we calculate coefficients as if they were equal:
bn =1L
Z L
�Lf(x) sin
⇣n�x
L
⌘dx
an =
1
L
Z L
�Lf(x) cos
⇣n�x
L
⌘dx
A0 =1
2L
Z L
�Lf(x) dx
• To simplify formulas, usually define a0 = 2A0 =
1L
Z L
�Lf(x) dx
fFS(x) =
a0
2
+ a1 cos
⇣�x
L
⌘+ a2 cos
✓2�x
L
◆+ · · ·
+b1 sin
⇣�x
L
⌘+ c2 sin
✓2�x
L
◆+ · · ·b2
Fourier series
• Find the Fourier series for f(x) = 2u0(x)-1 on the interval [-1,1].
• Our hope is that f(x) = fFS(x) so we calculate coefficients as if they were equal:
bn =1L
Z L
�Lf(x) sin
⇣n�x
L
⌘dx
an =
1
L
Z L
�Lf(x) cos
⇣n�x
L
⌘dx
A0 =1
2L
Z L
�Lf(x) dx
• To simplify formulas, usually define a0 = 2A0 =
1L
Z L
�Lf(x) dx
fFS(x) =
a0
2
+ a1 cos
⇣�x
L
⌘+ a2 cos
✓2�x
L
◆+ · · ·
+b1 sin
⇣�x
L
⌘+ c2 sin
✓2�x
L
◆+ · · ·b2
A0 is the average value of f(x)!
Fourier series
• Calculate the coefficients.
https://www.desmos.com/calculator/tlvtikmi0y Does f(x) = fFS(x) for all x?Problems at jumps! x=-1, 0, 1
Fourier series
fFS(x) =
a0
2
+ a1 cos
⇣�x
L
⌘+ a2 cos
✓2�x
L
◆+ · · ·
+b1 sin
⇣�x
L
⌘+ c2 sin
✓2�x
L
◆+ · · ·b2
bn =1L
Z L
�Lf(x) sin
⇣n�x
L
⌘dx
an =
1
L
Z L
�Lf(x) cos
⇣n�x
L
⌘dx
A0 =1
2L
Z L
�Lf(x) dx
a0 = 2A0 =1L
Z L
�Lf(x) dxa0 = 2A0 =
1L
Z L
�Lf(x) dx
an = 0
a0 = 0
bn = 2 (1- (-1)n) / nπ
fFS(x) =4
⇡
sin⇣⇡x
L
⌘+
4
3⇡sin
✓3⇡x
L
◆+
4
5⇡sin
✓5⇡x
L
◆
Fourier series
• Theorem Suppose f and f’ are piecewise continuous on [-L,L] and periodic beyond that interval. Then f(x) = fFS(x) at all points at which f is continuous. Furthermore, at points of discontinuity, fFS(x) takes the value of the midpoint of the jump. That is,
fFS(x) =f(x+) + f(x�)
2
Heat/Diffusion equation - example
• Find the solution to the heat/diffusion equation
• subject to BCs
• and with IC
• The “warming up the milk bottle” example.
ut
= 7uxx
u(0, t) = 0 = u(4, t)
u(x, 0) =
⇢1, 0 x 20, 2 < x 4
https://www.desmos.com/calculator/zvowjmu30g
Using Fourier Series to solve the Diffusion Equation
u(0, t) = u(2, t) = 0
u(x, 0) = x
ut
= 4uxx
https://www.desmos.com/calculator/yt7kztckeuhttps://www.desmos.com/calculator/wcdvgrveez
Using Fourier Series to solve the Diffusion Equation
u(0, t) = u(2, t) = 0
u(x, 0) = x
ut
= 4uxx
bn =(�1)n+14
n�
u(x, t) =
a0
2
+
1X
n=1
ane�n2�2tcos
n�x
2
u(x, t) =1X
n=1
bne�n2�2t sinn�x
2
(0 for n odd)
a0 = 1, an = � 8
n2�2for n even
(A)
(B)
https://www.desmos.com/calculator/yt7kztckeuhttps://www.desmos.com/calculator/wcdvgrveez
Using Fourier Series to solve the Diffusion Equation
u(0, t) = u(2, t) = 0
u(x, 0) = x
ut
= 4uxx
bn =(�1)n+14
n�
u(x, t) =
a0
2
+
1X
n=1
ane�n2�2tcos
n�x
2
u(x, t) =1X
n=1
bne�n2�2t sinn�x
2
(0 for n odd)
a0 = 1, an = � 8
n2�2for n even
(A)
(B)
https://www.desmos.com/calculator/yt7kztckeuhttps://www.desmos.com/calculator/wcdvgrveez
Using Fourier Series to solve the Diffusion Equation
u(0, t) = u(2, t) = 0
u(x, 0) = x
ut
= 4uxx
bn =(�1)n+14
n�
u(x, t) =
a0
2
+
1X
n=1
ane�n2�2tcos
n�x
2
u(x, t) =1X
n=1
bne�n2�2t sinn�x
2
(0 for n odd)
a0 = 1, an = � 8
n2�2for n even
(A)
(B)
https://www.desmos.com/calculator/yt7kztckeuhttps://www.desmos.com/calculator/wcdvgrveez
Using Fourier Series to solve the Diffusion Equation
u(0, t) = u(2, t) = 0
u(x, 0) = x
ut
= 4uxx
bn =(�1)n+14
n�
u(x, t) =
a0
2
+
1X
n=1
ane�n2�2tcos
n�x
2
u(x, t) =1X
n=1
bne�n2�2t sinn�x
2
(0 for n odd)
a0 = 1, an = � 8
n2�2for n even
(A)
(B)
https://www.desmos.com/calculator/yt7kztckeuhttps://www.desmos.com/calculator/wcdvgrveez
Using Fourier Series to solve the Diffusion Equation
u(0, t) = u(2, t) = 0
u(x, 0) = x
ut
= 4uxx
bn =(�1)n+14
n�
u(x, t) =
a0
2
+
1X
n=1
ane�n2�2tcos
n�x
2
u(x, t) =1X
n=1
bne�n2�2t sinn�x
2
(0 for n odd)
a0 = 1, an = � 8
n2�2for n even
(A)
(B)
• Show Desmos movies.https://www.desmos.com/calculator/yt7kztckeuhttps://www.desmos.com/calculator/wcdvgrveez
Using Fourier Series to solve the Diffusion Equation
ut
= 4uxx
du
dx
����x=0,2
= 0
u(x, 0) = cos
3�x
2
Using Fourier Series to solve the Diffusion Equation
ut
= 4uxx
du
dx
����x=0,2
= 0
u(x, 0) = cos
3�x
2
The IC is an eigenvector! Note that it satisfies the BCs.
Using Fourier Series to solve the Diffusion Equation
ut
= 4uxx
du
dx
����x=0,2
= 0
u(x, 0) = cos
3�x
2
v3(x) = cos
3�x
2
The IC is an eigenvector! Note that it satisfies the BCs.
Using Fourier Series to solve the Diffusion Equation
ut
= 4uxx
du
dx
����x=0,2
= 0
u(x, 0) = cos
3�x
2
vn(x) = cos
n�x
2
v3(x) = cos
3�x
2
The IC is an eigenvector! Note that it satisfies the BCs.
Using Fourier Series to solve the Diffusion Equation
ut
= 4uxx
du
dx
����x=0,2
= 0
u(x, 0) = cos
3�x
2
vn(x) = cos
n�x
2
v3(x) = cos
3�x
2
un(x, t) = e�ntcos
n�x
2
The IC is an eigenvector! Note that it satisfies the BCs.
Using Fourier Series to solve the Diffusion Equation
ut
= 4uxx
du
dx
����x=0,2
= 0
u(x, 0) = cos
3�x
2
vn(x) = cos
n�x
2
v3(x) = cos
3�x
2
un(x, t) = e�ntcos
n�x
2
The IC is an eigenvector! Note that it satisfies the BCs.
⇤
⇤tun(x, t) = �ne�nt
cos
n⇥x
2
Using Fourier Series to solve the Diffusion Equation
ut
= 4uxx
du
dx
����x=0,2
= 0
u(x, 0) = cos
3�x
2
vn(x) = cos
n�x
2
v3(x) = cos
3�x
2
un(x, t) = e�ntcos
n�x
2
The IC is an eigenvector! Note that it satisfies the BCs.
⇤
⇤tun(x, t) = �ne�nt
cos
n⇥x
2
⇥2
⇥x2un(x, t) = �n2�2
4
e�ntcos
n�x
2
Using Fourier Series to solve the Diffusion Equation
ut
= 4uxx
du
dx
����x=0,2
= 0
u(x, 0) = cos
3�x
2
vn(x) = cos
n�x
2
v3(x) = cos
3�x
2
un(x, t) = e�ntcos
n�x
2
The IC is an eigenvector! Note that it satisfies the BCs.
⇤
⇤tun(x, t) = �ne�nt
cos
n⇥x
2
⇥2
⇥x2un(x, t) = �n2�2
4
e�ntcos
n�x
2
44
Using Fourier Series to solve the Diffusion Equation
ut
= 4uxx
du
dx
����x=0,2
= 0
u(x, 0) = cos
3�x
2
vn(x) = cos
n�x
2
v3(x) = cos
3�x
2
un(x, t) = e�ntcos
n�x
2
The IC is an eigenvector! Note that it satisfies the BCs.
⇤
⇤tun(x, t) = �ne�nt
cos
n⇥x
2
⇥2
⇥x2un(x, t) = �n2�2
4
e�ntcos
n�x
2
44
Using Fourier Series to solve the Diffusion Equation
ut
= 4uxx
du
dx
����x=0,2
= 0
u(x, 0) = cos
3�x
2
vn(x) = cos
n�x
2
v3(x) = cos
3�x
2
un(x, t) = e�ntcos
n�x
2
The IC is an eigenvector! Note that it satisfies the BCs.
⇤
⇤tun(x, t) = �ne�nt
cos
n⇥x
2
⇥2
⇥x2un(x, t) = �n2�2
4
e�ntcos
n�x
2
44
Using Fourier Series to solve the Diffusion Equation
ut
= 4uxx
du
dx
����x=0,2
= 0
u(x, 0) = cos
3�x
2
vn(x) = cos
n�x
2
v3(x) = cos
3�x
2
un(x, t) = e�ntcos
n�x
2
The IC is an eigenvector! Note that it satisfies the BCs.
⇤
⇤tun(x, t) = �ne�nt
cos
n⇥x
2
⇥2
⇥x2un(x, t) = �n2�2
4
e�ntcos
n�x
2
�n = �n2⇥2
44
Using Fourier Series to solve the Diffusion Equation
ut
= 4uxx
du
dx
����x=0,2
= 0
u(x, 0) = cos
3�x
2
vn(x) = cos
n�x
2
v3(x) = cos
3�x
2
un(x, t) = e�ntcos
n�x
2
The IC is an eigenvector! Note that it satisfies the BCs.
⇤
⇤tun(x, t) = �ne�nt
cos
n⇥x
2
⇥2
⇥x2un(x, t) = �n2�2
4
e�ntcos
n�x
2
�n = �n2⇥2
44
u(x, t) = e�9�2tcos
3�x
2
So the solution is