Numerical Methods For PDE's: 1 Discretization

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Numerical Methods for PDE’s

Homework
Sebastian Leonardo Lalvay Segovia
December 14, 2021

Finite Differences for the Wave Equation. Consider the wave equation in the bounded
domain (0, 1) with periodic boundary conditions:
 2 2
∂ u − ∂ u = 0

for (x, t) ∈ (0, 1) × R+

∂t2 ∂x2




u(0, t) = u(1, t) for t ∈ R+


(1)


 u(x, 0) = u0 (x) for x ∈ (0, 1)

 ∂u
 (x, 0) = u1 (x) for
 x ∈ (0, 1)
∂t

1 Discretization
To discretize the domain (0, 1) × R+ ∗ , we introduce a space step ∆x = 1/N > 0, where N > 0 is
the number of subintervals in (0, 1). The time step ∆t = 1/M > 0, where M > 0 is the number
of subintervals in [0, T ] ⊂ R+
∗ . Hence we obtain the nodes of a regular mesh:

(xj , tn ) = (j∆x, n∆t) for n ≥ 0, j ∈ {0, 1, · · · , N }

Remark 1.

1. N + 1 is the number of nodes in the space.

2. M + 1 is the number of nodes in time.

3. We denote unj = u(xj , tn ) as the approximation at (xj , tn ), where u is the exact solution.

2 Finite differences approximation


The principle of the finite difference method is to replace the derivatives by finite differences
using Taylor series in which we neglect the remainders. In this regard, we approximate the
second derivatives in time and space as follows:

1
1. Approximate the second derivative in time at (xj , tn ) by the centred finite difference and
approximate the second derivative in space at (xj , tn ) by the centred finite difference:

∂ 2u ujn−1 − 2unj + un+1


j
(x ,
j nt ) ≈
∂t2 (∆t)2
∂ 2u −unj−1 + 2unj − unj+1
− 2 (xj , tn ) ≈
∂x (∆x)2

2. Approximate the second derivative in time at (xj , tn−1 ) by the forward finite difference and
approximate the second derivative in space at (xj , tn−1 ) by the centred finite difference:

∂ 2u un+1
j − 2unj + un−1
j
(x , t
j n−1 ) ≈
∂t2 (∆t)2
n−1
∂ 2u −uj−1 + 2un−1
j
n−1
− uj+1
− 2 (xj , tn−1 ) ≈
∂x (∆x)2

3. Approximate the second derivative in time at (xj , tn+1 ) by the backward finite differ-
ence and approximate the second derivative in space at (xj , tn+1 ) by the centred finite
difference:

∂ 2u un+1
j − 2unj + un−1
j
2
(xj , tn+1 ) ≈ 2
∂t (∆t)
2
∂ u −uj−1 + 2un+1
n+1
j − un+1
j+1
− 2 (xj , tn+1 ) ≈ 2
∂x (∆x)

3 θ-centred scheme
Replacing the finite approximations above in (1) we obtain:

un−1
j − 2unj + un+1
j −unj−1 + 2unj − unj+1
+ = 0, n ≥ 0, j ∈ {0, 1, · · · , N − 1} (2)
(∆t)2 (∆x)2
un+1
j − 2unj + un−1
j −un−1
j−1 + 2uj
n−1 n−1
− uj+1
+ = 0, n ≥ 0, j ∈ {0, 1, · · · , N − 1} (3)
(∆t)2 (∆x)2
un+1
j − 2unj + un−1
j −un+1
j−1 + 2uj
n+1
− un+1
j+1
2
+ 2
= 0, n ≥ 0, j ∈ {0, 1, · · · , N − 1} (4)
(∆t) (∆x)

For 0 ≤ θ ≤ 1/2, we multiply by (1 − 2θ) in (2) and by θ in equation (3) and (4). Finally,
adding (2), (3) and (4) we obtain,

un−1
j − 2unj + un+1
j −unj−1 + 2unj − unj+1 un+1
j − 2unj + un−1
j
(1 − 2θ) + (1 − 2θ) + θ
(∆t)2 (∆x)2 (∆t)2
−un−1 n−1
j−1 + 2uj − un−1
j+1 un+1
j − 2unj + ujn−1 −un+1
j−1 + 2uj
n+1
− un+1
j+1
+θ + θ + θ =0
(∆x)2 (∆t)2 (∆x)2

2
un−1
j − 2unj + un+1
j −unj−1 + 2unj − unj+1 n−1
−uj−1 + 2un−1
j − un−1
j+1
2
+ (1 − 2θ) 2
+θ 2
(∆t) (∆x) (∆x)
n+1 n+1 n+1
−uj−1 + 2uj − uj+1
+θ =0
(∆x)2

When θ = 0 we obatain an explicit scheme, while the scheme is implicit if θ ̸= 0.

You might also like