The Convection-Diffusion Equation

​
collocation points
20
v
0.5
D
0.2
t
0.5
Consider the unsteady-state convection-diffusion problem described by the equation:
∂c
∂t
=D
2
∂
c
∂
2
x
-v
∂c
∂x
,
where
D
and
v
are the diffusion coefficient and the velocity, respectively.
The initial and boundary conditions are:
t=0
,
c(x,0)=0
,
x=0
,
c(0,t)=1
,
x=∞
,
c(∞,t)=0
,
where
c
is the concentration and
x
is the position.
This problem has an analytical solution:
c(x,t)=
1
2
erfc
x-vt
2
Dt
+
(vx)/D
e
erfc
x-+vt
2
Dt
.
This Demonstration plots the solution
c(x,t)
. The numerical solution obtained using Chebyshev orthogonal collocation is given by the red dots. The analytical solution is given by the blue curve. Excellent agreement between the two solutions is observed. You can vary the values of
t
,
D
, and
v
as well as the number of Chebyshev collocation points,
N+1
.

Details

In the discrete Chebyshev–Gauss–Lobatto case, the interior points are given by
y
j
=cos(jπ/N)
. These points are the extrema of the Chebyshev polynomials of the first kind,
T
N
(x)
.
The
(N+1)×(N+1)
Chebyshev derivative matrix at the quadrature points is an
(N+1)×(N+1)
matrix
D=

d
jk

0≤j,k⩽N
given by
d
00
=
2
2
N
+1
6
,
d
NN
=-
2
2
N
+1
6
,
d
jj
=
-
y
j
21-
2
y
j

for
1≤j≤N-1
, and
d
jk
=
j+k
c
j
(-1)
c
k
(
y
j
-
y
k
)
for
0≤j
,
k⩽N
, and
j≠k
,
where
c
j
=1
for
1≤j≤N-1
and
c
0
=
c
N
=2
.
The matrix
D
is then used as follows:
v'=Dv
and
v''=
2
D
v
, where
v
is a vector formed by evaluating
u
at
y
j
,
j=0,…,N
, and
v'
and
v''
are the approximations of
u'
and
u''
at the
y
j
.

References

[1] P. Moin, Fundamentals of Engineering Numerical Analysis, Cambridge, UK: Cambridge University Press, 2001.
[2] L. N. Trefethen, Spectral Methods in MATLAB, Philadelphia: SIAM, 2000.

Permanent Citation

Housam Binous, Brian G. Higgins
​
​"The Convection-Diffusion Equation"​
​http://demonstrations.wolfram.com/TheConvectionDiffusionEquation/​
​Wolfram Demonstrations Project​
​Published: June 11, 2013