





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Department of Mathematics Spring 2009
MATH 4365, Section 19530 MW 5:30-7:00PM
A. Caboussat
1.a) The finite differences scheme consists in finding u 0
, u 1
,... , u N
, u N +
, with u i
≃ u(x i
), such that
ui+
−a(xi+h/2)
h
2
a(xi−h/2)+a(xi+h/2)
h
2
−a(xi−h/2)
h
2
= f (xi), i = 1, 2 ,... , N,
u 0 = uN +1 = 0.
The scheme can be written as a linear system A~u =
b by setting ~u = (u 1 , u 2 ,... , uN )
T and
b =
(f (x 1 ),... , f (xN ))
T and
h
2
a(x 1 − h/2) + a(x 1 + h/2) −a(x 1 + h/2)
−a(x 2
− h/2) a(x 2
− h/2) + a(x 2
. (^) −a(x N − 1 +^ h/2)
−a(xN − h/2) a(xN − h/2) + a(xN + h/2)
1.b) The numerical approximation of u with this finite difference scheme (with α = 1) is illustrated in Figure 1
for various values of N.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
Figure 1: Deformation of the rope for N = 10 (first column), N = 100 (second column) and N = 1000 (third
column). The first row corresponds to a(x) = 1 + x, the second row corresponds to a(x) = 1 + 10x.
1.c) When a(x) = 1, the matrix A reads
h
2
and is symmetric positive definite. Therefore A~x = 0 ⇒ ~x
T A~x = 0 ⇒ ~x = 0 and the linear system admits
a unique solution.
1.d) If the boundary condition u(1) = 0 is replaced by u(1) + βu
′ (1) = 0, the boundary condition uN +1 = 0 is
replaced by uN +1 + β
uN +1−uN
h
= 0. The scheme is therefore:
u i+
−a(xi+h/2)
h
2
a(xi−h/2)+a(xi+h/2)
h
2
−a(xi−h/2)
h
2
= f (x i
), i = 1, 2 ,... , N,
u 0 = uN +1 + β
uN +1−uN
h
Therefore, we have N + 1 unknowns and the linear system becomes:
h
2
a(x 1 − h/2) + a(x 1 + h/2)
−a(x 2
− h/2)
. (^) −a(x N − 1 +^ h/2)
−a(xN − h/2) a(xN − h/2) + a(xN + h/2) −a(xN + h/2)
−βh (h
2
and
b =
f (x 1 )
f (x N
Results are illustrated in Figure 2.
1.e) We multiply the first equation of the problem by a function v, continuously differentiable on (0, 1) and
integrate on [0, 1]:
1
0
d
dx
a(x)u
′ (x)
v(x)dx =
1
0
f (x)v(x)dx.
Integration by parts of the left-hand side gives:
1
0
a(x)u
′ (x)v
′ (x)dx −
a(x)u
′ (x)v(x)
1
0
1
0
f (x)v(x)dx.
If we impose v(0) = v(1) = 0 then we obtain
1
0
a(x)u
′
(x)v
′
(x)dx =
1
0
f (x)v(x)dx.
This gives
jj
h
a(xj− 1 )
a(xj+1)
, j = 1, ..., N
Bj,j+1 = −
h
a(xj ) + a(xj+1 )
, j = 1, ..., (N − 1)
˜c j
= hf (x j
), j = 1, ..., N.
We notice that, when a(x) = 1, we have
Bjj = 2/h and
Bj,j+1 = − 1 /h, as in class.
1.i) The numerical approximation of u with this finite element scheme (with α = 1) is illustrated in Figure 7
for various values of N.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
Figure 3: Deformation of the rope for N = 10 (first column), N = 100 (second column) and N = 1000 (third
column). The first row corresponds to a(x) = 1 + x, the second row corresponds to a(x) = 1 + 10x.
When superimposing the fintie differences solution and the finite element solution, one obtain the results
in Figure 4.
Problem 2
2.a) The scheme based on finite differences in space and an explicit Euler scheme in time reads:
u
n+
i
− u
n
i
τ
u
n
i− 1
− 2 u
n
i
n
i+
h
2
n
i
= f (xi, tn), i = 1, ..., N,
u
n
0
= u
n
N +
together with the initial condition u
0
i
= u 0
(x i
), i = 0, ..., N + 1. Numerical results for the approximation
of the heat equation are given in Figure 5.
Note that the condition
τ 6
h
2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
1
2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
1
2
3
Figure 4: Deformation of the rope for N = 10 (first column) and N = 100 (second column). The first row
corresponds to a(x) = 1 + x, the second row corresponds to a(x) = x(1 − x).
guarantees the stability of the scheme. This condition becomes
τ 6
2
h
2 +^ α
when you consider α 6 = 0, meaning that the stability condition is even more restrictive.
2.b) For f (x, t) > 0 and α = 0, we have:
u
n+
i
2 τ
h
2
u
n
i
τ
h
2
u
n
i− 1
τ
h
2
u
n
i+
(a) If u
n
i
> 0, i = 0,... , N + 1 and (1) holds, then (2) implies u
n+
i
> 0, i = 1,... , N. Conclusion holds
since u
n+
0
= u
n+
N +
(b) If f ≡ 0, (2) implies:
|u
n+
i
2 τ
h
2
|u
n
i
τ
h
2
|u
n
i− 1
τ
h
2
|u
n
i+
|, i = 1,... , N.
Since 1 −
2 τ
h^2
> 0, we have for i = 1,... , N :
|u
n+
i
2 τ
h
2
|u
n
i
τ
h
2
|u
n
i− 1
τ
h
2
|u
n
i+
2 τ
h
2
max
06 j 6 N +
|u
n
j
τ
h
2
max
06 j 6 N +
|u
n
j
τ
h
2
max
06 j 6 N +
|u
n
j
2 τ
h
2
τ
h
2
τ
h
2
max
06 j 6 N +
|u
n
j
| = max
06 j 6 N +
|u
n
j
Hence the relation is also true for the maximum.
2.c) The finite differences scheme based on finite differences in space and an implicit Euler scheme in time
reads:
equation are given in Figure 6.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
1
(α = 0, τ =
1
10
) (α = 0, τ =
1
100
) (α = 0, τ =
1
500
(f = 10 sin(x) cos(t)) (f = 10 sin(x) cos(t)) (f = 10 sin(x) cos(t))
Figure 6: Profile of temperature at time t = 0 (red line) and time t = 1 s (blue line with bullets) for various
time steps τ , right-hand sides f and parameters α. Implicit Euler Scheme.
The method is unconditionally stable and allows very large time steps.
2.d) Let V be the function space of the continuous functions g, with piecewise continuous first derivatives g
′
and such that g(0) = g(1) = 0. The weak formulation corresponding to the problem semi-discretized in
time, consists in finding u(t) ∈ V such that ∀t ∈ (0, T ) :
1
0
∂u
∂t
vdx +
1
0
∂u
∂x
∂v
∂x
dx + α
1
0
uvdx =
1
0
f vdx, ∀v ∈ V,
with initial condition u(0) = u 0.
2.e) Let ϕ 1 (x), ϕ 2 (x),... , ϕN (x) be linear independent functions in V and Vh the subspace generated by
ϕ 1 (x),... , ϕN (x). The Galerkin approximation of the variational formulation consists in finding uh(t) ∈ Vh
such that ∀t ∈ (0, T ) :
1
0
∂uh
∂t
v h
dx +
1
0
∂uh
∂x
∂vh
∂x
dx + α
1
0
u h
v h
dx =
1
0
f v h
dx, ∀v h
h
with initial condition uh(0) = u 0 ,h, where u 0 ,h is the interpolant of u 0 in Vh. Since we are looking for
u h
(t) in V h
, we can write u h
(x, t) =
N
i=
u i
(t)ϕ i
(x). Choosing v h
= ϕ j
, j = 1, 2 , ..., N in the Galerkin
approximation, we get the following linear system of N equations with N unknowns u i
, i = 1, 2 , ..., N :
~u(t) + A~u(t) + αM~u(t) =
F (t) ,
where M , A, ~u(t)
~u(t) and
F (t) are defined as in class.
2.f ) We consider α = 10, N = 100, τ = 0.1 and f (x, t) = 10 sin(x) cos(t); plot the evolution of the temperature
as a function of space, for various times. The final scheme is the following :
~u
n+ −~u
n
τ
n+
F (t
n+ );
~u
0 = ~u 0
It leads to the resolution of a linear system at each time step.
(M + τ A + ατ M ) ~u
n+ = M~u
n
F (t
n+ ).
The mass matrix M is defined by : M ij
1
0
ϕ i
ϕ j
dx. When we use piecewise linear continuous finite
elements, M is tridiagonal and symmetric. The non-zero coefficients are:
i,i
xi
xi− 1
x − xi− 1
h
2
dx +
xi+
xi
xi+1 − x
h
2
dx =
h.
Mi,i+1 =
xi+
xi
xi+1 − x
h
x − xi
h
dx =
h.
Numerical results for the approximation of the heat equation based on finite elements in space and an
implicit Euler scheme in time are given in Figure 7. Results are a little bit more diffusive than the finite
differences schemes.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
1
(α = 0, τ =
1
10
) (α = 0, τ =
1
100
(f = 10 sin(x) cos(t)) (f = 10 sin(x) cos(t))
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
1
(α = 100, τ =
1
10
) (α = 100, τ =
1
100
(f = 10 sin(x) cos(t)) (f = 10 sin(x) cos(t))
Figure 7: Profile of temperature at time t = 0 (red line) and time t = 1 s (blue line with bullets) for various
time steps τ , right-hand sides f and parameters α. Implicit Euler Scheme with Finite elements in space
Note that if we use mass lumping for the matrix M (numerical integration with trapezoidal rule of the
coefficients of the matrix M ), this matrix becomes diagonal and the numerical diffusion is less important.
Figure 8 shows the results for τ =
1
10
and f = 10 sin(x) cos(t).