Documente Academic
Documente Profesional
Documente Cultură
Nathan L. Gibson
gibsonn@math.oregonstate.edu
Department of Mathematics
Oregon State University
Corvallis, OR
ut = κuxx , 0 ≤ x ≤ L, t ≥ 0
ut = κuxx , 0 ≤ x ≤ L, t ≥ 0
• with
• Boundary conditions: u(t, 0) = u0 , u(t, L) = uL , and
• Initial conditions: u(0, x) = g(x)
ut = κuxx , 0 ≤ x ≤ L, t ≥ 0
• with
• Boundary conditions: u(t, 0) = u0 , u(t, L) = uL , and
• Initial conditions: u(0, x) = g(x)
t
domain of influence
tp
p
domain of dependence
0 x
0 xp L
Txx + Tyy = 0, 0 ≤ x ≤ W, 0 ≤ y ≤ H
Txx + Tyy = 0, 0 ≤ x ≤ W, 0 ≤ y ≤ H
Txx + Tyy = 0, 0 ≤ x ≤ W, 0 ≤ y ≤ H
T4 T2
yp
p
0 x
0 xp W
T1
utt = c2 uxx , 0 ≤ x ≤ L, t ≥ 0
utt = c2 uxx , 0 ≤ x ≤ L, t ≥ 0
utt = c2 uxx , 0 ≤ x ≤ L, t ≥ 0
domain of
influence
tp p
+c –c
domain
of dependence
0 x
0 xp L
∆xj = xj+1 − xj , j = 0, 1, 2, . . . m
In the case that the m + 2 spatial points xj are equally spaced, we have
∆x = ∆xj , ∀j
q q q q q q q q q q q x -
0 = x0 x1 x2 ... ... xj−1 xj xj+1 ... xm xm+1 =L
∆x
-
∆xj = xj+1 − xj , j = 0, 1, 2, . . . m
In the case that the m + 2 spatial points xj are equally spaced, we have
∆x = ∆xj , ∀j
q q q q q q q q q q q x -
0 = x0 x1 x2 ... ... xj−1 xj xj+1 ... xm xm+1 =L
∆x
-
Ujn ≈ u(tk , xj )
Ujn ≈ u(tk , xj )
U n = [U1n , U2n , . . . , Um
n
]
Ujn ≈ u(tk , xj )
U n = [U1n , U2n , . . . , Um
n
]
• Thus,
u(xj+1 ) − u(xj ) ∆x
ux (xj ) = + uxx (xj ) + O((∆x)2 )
∆x 2
• Thus,
u(xj+1 ) − u(xj ) ∆x
ux (xj ) = + uxx (xj ) + O((∆x)2 )
∆x 2
• The forward difference is a first order accurate approximation to the
partial derivative ux at xj and the LTE is O(∆x).
Multiscale Summer School – p. 15
Error in FDM: LTE
• The backward difference is a first order accurate
approximation to the partial derivative ux at xj and the LTE
is O(∆x).
ut = κuxx , 0 ≤ x ≤ 1, t ≥ 0
u(0, x) = f (x), Initial Condition
u(t, 0) = α, Boundary Condition at x = 0
u(t, 1) = β, Boundary Condition at x = 1
ut = κuxx , 0 ≤ x ≤ 1, t ≥ 0
u(0, x) = f (x), Initial Condition
u(t, 0) = α, Boundary Condition at x = 0
u(t, 1) = β, Boundary Condition at x = 1
q q q q q q q q q q q x -
0 = x0 x1 x2 ... ... xj−1 xj xj+1 ... xm xm+1 =1
∆x
-
.. 6 6
. q q q q q q q q q q q
(t2 , xj )
t2 q q q q q q q q q q q
∆t 6
?t1 q q q q q q q q q q q
t
t0 q q q q q q q q q q q 6
-x
0 = x 0 x1 x2 ... ... xj−1 xj xj+1 ... xm xm+1 = 1
Multiscale Summer School – p. 18
FDM for Parabolic PDEs: The Heat Equation
• Replace ut by a forward difference in time and uxx by a central
difference in space to obtain the explicit FDM
Ujk+1 − Ujk k
Uj+1 − 2Ujk + Uj−1
k
=κ
∆t (∆x)2
κ∆t
Ujk+1 Ujk k k k
=⇒ = + 2
Uj+1 − 2Uj + Uj−1 , j = 1, 2, . . . m
(∆x)
Ujk+1 − Ujk k
Uj+1 − 2Ujk + Uj−1
k
=κ
∆t (∆x)2
κ∆t
Ujk+1 Ujk k k k
=⇒ = + 2
Uj+1 − 2Uj + Uj−1 , j = 1, 2, . . . m
(∆x)
k+1 q q q
6 I
@
k q q @q
k−1 q q q
j−1 j j+1
1
Initial
0.9 function
0.8
0.7
0.6
0.5
0.4
0.3
Exact
0.2 Solution
0.1
dx=0.01, dt=1e−05, r=0.1
0
0 0.2 0.4 0.6 0.8 1
κ∆t 1
r= ≤
∆x 2
κ∆t 1
r= ≤
∆x 2
0.5
−0.5
−1
0.5
−0.5
−1
k+1 q q q
6
k q q q
k−1 q q q
j−1 j j+1
0.9 Initial
function
0.8
0.7
0.6
0.5
0.4
0.3
Exact
0.2 Solution
0.1
dx=0.01, dt=0.01, r=100
0
0 0.2 0.4 0.6 0.8 1
0.9 Initial
function
0.8
0.7
0.6
0.5
0.4
0.3
Exact
0.2 Solution
0.1
dx=0.01, dt=0.01, r=100
0
0 0.2 0.4 0.6 0.8 1
0.9 Initial
function
0.8
0.7
0.6
0.5
0.4
0.3
Exact
0.2 Solution
0.1
dx=0.01, dt=0.01, r=100
0
0 0.2 0.4 0.6 0.8 1
−2
−6
−8
−12
−14
−14 −12 −10 −8 −6 −4 −2 0
log (∆ x)
2
with βm + καm
2
= 0. Here eiαm x = cos(αm x) + i sin(αm x).
with βm + καm
2
= 0. Here eiαm x = cos(αm x) + i sin(αm x).
• To analyze the growth of different Fourier modes as they evolve under
the numerical scheme we consider each frequency separately, namely
let u(t, x) = eβm t eiαm x
with βm + καm
2
= 0. Here eiαm x = cos(αm x) + i sin(αm x).
• To analyze the growth of different Fourier modes as they evolve under
the numerical scheme we consider each frequency separately, namely
let u(t, x) = eβm t eiαm x
• In the discrete case we assume that Ujk = Gk eiαm j∆x with
G = eβm ∆t . Any growth in the solution will be due to the presence of
terms involving G.
with βm + καm
2
= 0. Here eiαm x = cos(αm x) + i sin(αm x).
• To analyze the growth of different Fourier modes as they evolve under
the numerical scheme we consider each frequency separately, namely
let u(t, x) = eβm t eiαm x
• In the discrete case we assume that Ujk = Gk eiαm j∆x with
G = eβm ∆t . Any growth in the solution will be due to the presence of
terms involving G.
• Thus requiring that this amplification factor G is bounded by one as
k → ∞ gives rise to a relation between ∆t and ∆x called the von
Neumann stability condition.
ut + aκux = 0, 0 ≤ x ≤ 1, t ≥ 0
u(0, x) = f (x), Initial Condition
ut + aκux = 0, 0 ≤ x ≤ 1, t ≥ 0
u(0, x) = f (x), Initial Condition
ut + aκux = 0, 0 ≤ x ≤ 1, t ≥ 0
u(0, x) = f (x), Initial Condition
u (x,0 ) x
Ujk+1 − Ujk k
Uj+1 − Ujk
+a =0
∆t ∆x
k+1 k a∆t k k
=⇒ Uj = Uj + Uj − Uj−1 , j = 1, 2, . . . m
∆x
Ujk+1 − Ujk k
Uj+1 − Ujk
+a =0
∆t ∆x
k+1 k a∆t k k
=⇒ Uj = Uj + Uj − Uj−1 , j = 1, 2, . . . m
∆x
• Associated to this scheme is a Computational Stencil
k+1 q q q • Scheme is explicit
6 • First order accurate is time
k
and space
q q q
x x
Q Q
x x
Q Q
x x
Q Q
uxx + uyy = 0, 0 ≤ x ≤ 1, 0 ≤ y ≤ 1
y
u=1
6
u=0 u=0
- x
u=0
ym t t t t t t t t t t t
ym−1t t t t t t t t t t t
.. 6
∆y
. t t t
t? -t t t t t t t
.. ∆x
. t t t t t t t t t t t
y2 t t t t t t t t t t t
y1 t t t t t t t t t t t
y
0 = y0 t t t t t t t t t t t 6
- x
0 = x 0 x1 x2 ... ... xj−1 xj xj+1 ... xm xm+1 = 1
• If ∆x = ∆y this becomes
• If ∆x = ∆y this becomes
k q q q
k−1 q q q
j−1 j j+1
AU = b
AU = b
−4 1 1 0 U1,1 0
1 −4 0 1 U2,1 0
=
1 0 −4 1 U1,2 1
0 1 1 −4 U2,2 1
increasing i
1 −4 1 1 each
• • • • block
• • • • (L + 1) ×
1 −4 1 • (L + 1)
1 −4 1
1 −4 1 1
1 1 −4 1 1
• • • • •
• • • • •
• • • • •
• • • •
• • • •
• • • • •
• • • • • J+1
• • • • • blocks
• • • • •
• • • •
• • • •
• • • • •
• • • • •
• • • • •
1 1 −4 1 1
1 1 −4 1
1 −4 1
• 1 −4 1
• • • •
• • • •
• 1 −4 1
1 1 −4
J + 1 blocks
• Complicated geometries
• High-order approximations
−u00 = f, 0<x<1
u(0) = u(1) = 0
• For example, elastic cord with fixed ends
• Solution must be twice differentiable
• This is unnecessarily strong if f is discontinuous
ui 1 ui
u1 ui 1
Ωi uN
x
x1 xi 1 xi xi 1 xN
u1 x 1
x
..
.
Ni (x)
ui x 1
x
..
.
uN x 1
x
or
Z 1 Z 1
û0 φ0j dx = f φj dx j = 1, . . . , M.
0 0
Note:
• When û and v̂ in same subspace: Galerkin
Aξ = b
0 · · · · · · 0 −1 2
Multiscale Summer School – p. 48
Compare to FDM
• Note that if Trapezoid rule is used to approximate
the right hand side, then bi = hfi , and therefore
the equations determining û are
ξi+1 − 2ξi + ξi−1
= hfi
h
which are exactly the same as FDM.
• The advantage of the FEM formulation is the
generality it allows (e.g., uniform h was not
required).
or in matrix form,
Aξ = b,
where ξj = û(Nj ), Aij = a(φi , φj )Ω is SPD, and
bi = (f, φi )Ω .
Multiscale Summer School – p. 53
Multidimensional Problem
• Let Ω be the unit cube {x, y, z} ∈ [0, 1]
• Assume homogeneous Dirichlet boundary
conditions
• Then the 3D Possion problem is:
Find u ∈ V := H01 (Ω) such that
−∆u = f in Ω,
u=0 on ∂Ω.
Find û ∈ Vh such that
a(û, v̂)Ω = (f, v̂)Ω , ∀v̂ ∈ Vh .
Multiscale Summer School – p. 56
Using Basis Functions
Representing û and v̂ in terms of nodal basis functions
i=1 of Vh , i.e., φj (Ni ) = δij for
{φi }M
i, j = 0, . . . , M + 1, we get the following system of
algebraic equations:
M
X
ξj a(φi , φj ) = (f, φi ), i = 1, . . . , M,
j=1
or in matrix form,
Aξ = b,
where ξj = û(Nj ), Aij = a(φi , φj )Ω is SPD, and
bi = (f, φi )Ω .
Multiscale Summer School – p. 57
Neumann Problem
• Let Ω be the unit square (x, y) ∈ [0, 1] × [0, 1]
• Assume Neumann boundary conditions
• Then the 2D Possion problem is:
Find u ∈ V := H 1 (Ω) such that
−∆u = f in Ω,
∂u
=g on ∂Ω.
∂n
algebraic equations:
M
X +1
ξj a(φi , φj ) = (f, φi )+hg, φi i∂Ω , i = 0, . . . , M +1,
j=0
or in matrix form,
Aξ = b,
where ξj = û(Nj ), Aij = a(φi , φj )Ω is SPD, and
bi = (f, φi )Ω + hg, φi i∂Ω .
Γ1
Γ0
or
a(u, v)Ω + α0 β0−1 hu, viΓ0 + α1 β1−1 hu, viΓ1 = (f, v)Ω ,
where a(u, v)Ω and (f, v)Ω are the same as above and
Z
hu, viΓj := uv, j = 0, 1.
Γj
χ0i := (u0 , φi )Ω ,
χ1i := (u1 , φi )Ω ,
Lij := (φi , φj )Ω .
Multiscale Summer School – p. 71
Fully Discrete Formulation
In order to discretize in time, we introduce a
(uniform) partition of the interval [0,T]:
0 = t0 < t1 < · · · < tNT = T , and
k := tn − tn−1 , n = 1, . . . , NT .
1 ξ n+1 − 2ξ n + ξ n−1 n n
2
L 2
+ Aξ = b , n = 1, . . . , NT ,
c k
Lξ 0 = χ0 ,
Lξ 1 = χ0 + kχ1 ,
Evaluating the left hand side analytically and the right via
Midpoint gives
ux (xi+(1/2) ) − ux (xi−(1/2) ) = xi+(1/2) − xi−(1/2) fi
Finally, using centered differences on the remaining derivatives
yields
ui+1 − 2ui + ui−1
= hfi
h
for h = xi+(1/2) − xi−(1/2) .
• Iterative
• If accuracy less important than speed
• Matrix-free
• Sparse
• SPD
• Conjugate Gradient
• SPD
• Eigenvalues clustered together (Precondition)