Solving the Convection-Diffusion Equation in 1D Using Finite Differences

​
solve
pause
step
reset
grid
lines
line
points
joined
show initial conditions
3D solution plot
3D plot for speed
geometry/boundary conditions
initial conditions
test case
1
c
u
x,x
= d
u
t
+ a
u
x
grid size
0.03
​
​
length
1.00
​
​
Δt multiplier
0.25
​
​
c (diffusion)
1.00
​
​
d (advection)
1.00
​
​
a (convection)
8.00
​
​
run time
0.02
centered grid
​
​
​
​
​
auto y scale
manual
1.1
This Demonstration shows the solution of the convection-diffusion partial differential equation (PDE)
c
u
xx
=d
u
t
+a
u
x
in one dimension with periodic boundary conditions. You can specify different initial conditions. Selected preconfigured test cases are available from the dropdown menu.
The system is discretized in space and for each time step the solution is found using
n+1
u
=A
n
u
. The plot shown represents the solution
u(x,t)
. You can select a 3D or 2D view using the controls at the top of the display.

Details

The convection-diffusion partial differential equation (PDE) solved is
c
u
xx
=d
u
t
+a
u
x
, where
c
is the diffusion parameter,
d
is the advection parameter (also called the transport parameter), and
a
is the convection parameter. The domain is
0≤x≤L
with periodic boundary conditions. Initial conditions are given by
u(x,0)=g(x)
. You can specify
g(x)
using the initial conditions button. The time step is
Δt=m
2
h
c
, where
m
is the
Δt
multiplier,
h
is the grid size, and
c
is the diffusion parameter. You can change the
Δt
multiplier using the slider. The total run time of the simulation is specified using the slider labeled "time".
The system solved at each time step is
n+1
u
=A
n
u
where
u
is the solution of the PDE. The matrix
A
is given by
n+1
u
1
n+1
u
2
⋮
n+1
u
N-1
n+1
u
N
=
(1-2μ)
μ-
ν
2
0
⋯
μ+
ν
2
μ+
ν
2
(1-2μ)
μ-
ν
2
⋯
0
0
μ+
ν
2
⋱
μ-
ν
2
0
⋮
⋮
μ+
ν
2
(1-2μ)
μ-
ν
2
μ-
ν
2
0
0
μ+
ν
2
(1-2μ)
n
u
1
n
u
2
⋮
n
u
N-1
n
u
N
,
where
μ=
cΔt
d
2
h
and
ν=
aΔt
dh
. In the above
0
u
is taken to be the vector of initial conditions. All values used are assumed to be in SI units.

References

[1] S. J. Farlow, Partial Differential Equations for Scientists and Engineers, New York: Dover, 1993.

External Links

Heat Conduction Equation (Wolfram MathWorld)

Permanent Citation

Nasser M. Abbasi
​
​"Solving the Convection-Diffusion Equation in 1D Using Finite Differences"​
​http://demonstrations.wolfram.com/SolvingTheConvectionDiffusionEquationIn1DUsingFiniteDifferen/​
​Wolfram Demonstrations Project​
​Published: June 11, 2012