Professional Documents
Culture Documents
Abstract
The spectral element method (SEM) is a high order numerical
method for solving partial differential equations that inherits the accuracy of spectral methods and the geometrical flexibility of the finite
element method.
These lectures provide an introduction to the SEM for graduate
students in Earth science. The construction of the method is described
for a model problem in 1D and 2D. The elements of its mathematical
basis, including its connection to spectral methods, are outlined to
explain the key choices in the construction of the SEM that lead to
an accurate and efficient numerical method. Practical guidelines for
programmers and users of the SEM and entry points to advanced topics
and to the relevant applied math literature are provided.
These lectures were preceded by lectures on the finite difference
method (FDM) and the finite element method (FEM). Several concepts
from the FEM lectures reappear here, with slightly different notations.
We favor redundancy in the hope that the resulting exposition of key
practical aspects will contribute to attenuate the perceived complexity
of programming the FEM and SEM.
These lectures were first taught in Caltech on Winter 2009.
Contents
1 Overview
1.1 Overview of the spectral element method . . . . . . . . . . .
1.2 Historical perspective . . . . . . . . . . . . . . . . . . . . . .
4
4
4
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5
5
6
7
8
9
13
3 The
3.1
3.2
3.3
3.4
3.5
3.6
3.7
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
17
17
18
19
19
20
20
22
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4 Numerical properties
23
4.1 Dispersion analysis in 1D . . . . . . . . . . . . . . . . . . . . 24
4.2 Optimal choice of h and P . . . . . . . . . . . . . . . . . . . . 28
5 Time integration of the wave equation
31
5.1 Second order schemes . . . . . . . . . . . . . . . . . . . . . . 31
5.2 Higher-order symplectic schemes . . . . . . . . . . . . . . . . 37
6 Miscellaneous
38
6.1 Limitations of the SEM . . . . . . . . . . . . . . . . . . . . . 38
6.2 Advanced topics . . . . . . . . . . . . . . . . . . . . . . . . . 38
A References
39
B Available software
39
C Homework problems
40
C.1 Love wave modes in a horizontally layered medium . . . . . . 40
C.2 Wave propagation and numerical dispersion . . . . . . . . . . 42
Overview
1.1
The SEM combines the best of two worlds: flexibility of FEM and accuracy
of spectral methods.
The operational procedure is similar to FEM:
1. PDE problem formulated in weak form.
2. Domain decomposition into a mesh of quadrilateral (2D) or hexaedral
(3D) elements, possibly deformed.
3. Galerkin method: approximate the weak form over a finite space of
piecewise polynomial functions
4. Evaluate the integrals in the weak form with numerical quadrature
The SEM is a high-order method: the basis functions are polynomials of
order typically 4. Among several ways to construct a high-order FEM, the
SEM is characterized by an optimal choice of basis functions and quadrature
rule. Optimal means less expensive (fewer operations and smaller memory
requirement) for a given accuracy.
Different than h-p FEM:
Nodal basis instead of Modal basis
Tensor-product basis. Each element is mapped to the reference element [1, 1]D . In the reference element, assume a set of basis functions
made of products of polynomials of each space variable, with degree
P : (x) = pi (x)pj (y)pk (z).
diagonal matrix by choice of quadrature and interpolation nodes (but
equivalent to mass lumping)
spectral convergence (note also convergence of inter-element fluxes)
The SEM has, of course, some limitations that will be reviewed in Section 6.1.
1.2
Historical perspective
1960s FEM
1970s spectral methods (1965 FFT)
1990s SEM
DGM?
History of SEM
introduced by Patera (1984) on Chebyshev polynomials, for fluid dynamics
generalized by Maday and Patera (1989) to Legendre polynomials
application to seismic wave propagation: Cohen et al (1993), Seriani
and Priolo (1994), Faccioli et al (1997), Komatitsch and Vilotte (1998),
Chaljub, Nissen-Meyer.
application to earthquake dynamics: Ampuero (2002 +Vilotte), Festa
(2004), Kaneko (2009)
application to geophysical fluid dynamics: Taylor et al (1997, atmospheric model, shallow water equation on the sphere), Dupont et
al (2004, ocean modeling on triangles), Fournier et al (2004, core
magneto-hydrodynamics), Rosenberg et al (2006, AMR, +Aime Fournier)
2
2.1
Dirichlet
(2.2)
Neumann
(2.3)
Weak form
Define Sobolev spaces
2
b
a
u(x)2 dx < }
du
L2 ([a, b])}
dx
H01 ([a, b]) = {u H 1 ([a, b]) | u(a) = u(b) = 0}
(2.4)
(2.5)
(2.6)
Find u H 1 ([a, b]) such that for all test functions v H01 ([a, b]) the following
is satisfied
Z b
Z b
Z b
v u
vf dx
(2.7)
vu dx =
dx
a
a
a x x
See previous lectures on FEM for proof of equivalence between strong and
weak formulation. In particular, note that the boundary terms appearing
b
after integration-by-parts vanish, [v u
x ]a = 0. Equation 2.7 can be written
as
a(u, v) (u, v) = (f, v)
(2.8)
where (, ) denotes dot product and the first term is a bilinear form a(, ).
2.2
Galerkin approximation
n
X
ui i (x).
(2.9)
i=0
v h V h .
(2.10)
(2.11)
with
Kij
= a(i , j )
(2.12)
Mij
= (i , j )
(2.13)
fi = (f, i )
(2.14)
Two important choices will be expanded next: the basis functions and the
numerical method to evaluate the integrals.
2.3
Spectral methods
The basis functions i are polynomials of degree P that span the whole
domain. In principle, infinite modal expansion:
u(x) =
u
i i (x)
(2.15)
i=0
with
u
i = (u, i )
(2.16)
P
X
u
i i (x)
(2.17)
i=0
If the basis is well chosen the coefficients ui decay very fast, and truncation introduces a very small error for sufficiently large P . Optimal choices
have the spectral convergence property: for infinitely smooth functions, the
truncation error decays as a function of P faster than any power law
||u u
h || = O(P m ) m > 0
(2.18)
[Catch: spectral convergence does not hold for less smooth functions.]
A family of optimal choices are the eigenfunctions of singular Sturm-Liouville
problems. The polynomials within this family are the so-called Jacobi polynomials. Legendre polynomials are a special case.
The Legendre polynomials are the only sequence of polynomials {Li } of
degree i that satisfy the following orthogonality conditions:
Z 1
Li ()Lj () d = ij i, j = 0, 1, ....
(2.19)
1
Ceas lemma: The spectral convergence property also holds for the solution
of the PDE problem in weak form: ||u uh || is of same order as ||u u
h ||.
7
2.4
In practice the integrals involved above are evaluated by numerical integration (quadrature). Gaussian quadrature is based on polynomial expansions.
The quadrature rule is defined by P nodes i and weights wi designed so
that
Z 1
P
X
wi p(i )
(2.20)
p() d =
1
i=0
The optimal quadrature, i.e. one that achieves exact integration up to degree 2P + 1, is the so-called Gauss-Legendre quadrature rule. The GaussLegendre quadrature takes {i }Pi=0 to be the zeros of LP +1 and the weights
wi =
2
(1
i2 )[LP +1 (i )]2
(2.21)
2
P (P + 1)[LP (i )]2
(2.22)
The GLL nodes are not uniformly distributed, they tend to cluster near the
end points 1 (the inter-nodal distance near the end points is asymptotically
1/P 2 ).
2.5
u
m Lm ()
(2.23)
m=0
(2.24)
u() u
() =
u
m Lm ()
(2.25)
m=0
P
X
u
m Lm ()
(2.26)
m=0
with
u
m = (u, Lm )P =
P
X
wi u(i ) Lm (i )
(2.27)
i=0
Approximating u
by u
introduces an error of the same order as the aliasing
error between u
and u. Hence, u
is also a spectral approximation of u.
The following identity arises from the particular choice of GLL interpolation
and quadrature: u
is the polynomial of degree P that interpolates u at the
P GLL nodes,
u
(i ) = u(i ).
(2.28)
Hence, the modal representation in Equation 2.26 is equivalent to the following nodal representation:
u
() =
P
X
i=0
ui i ()
(2.29)
where the coefficients are simply the values of u at the GLL nodes
ui = u(i )
(2.30)
and {i }Pi=0 are the Lagrange interpolation polynomials associated with the
GLL nodes of order P .
Definition of the discrete spectral method
For a given order P , the method consists of:
1. map the domain x [a, b] into the reference segment [1, 1]
x=
a+b
+ h/2
2
(2.31)
Y j
i i
(2.32)
j6=i
10
= h/2
(2.33)
wi p (i )q (i )
(2.34)
wi pi qi
(2.35)
i=0
P
X
= h/2
i=0
= h/2 wp pq
(2.36)
What if we had evaluated the mass matrix with exact integration? Must
(Q)
be done with a different quadrature, with Q + 1 quadrature nodes {i }Q
i=0
(Q)
and weights {wi }Q
,
exact
at
least
up
to
degree
2P
(instead
of
2P
1
for
i=0
GLL with P + 1 nodes). GLL quadrature with Q = P + 1 or GL quadrature
with Q = P 1 would work.
exact
Mpq
= h/2
Q
X
wi
(2.37)
i=0
The terms here are 6= 0, because the values are requested at nodes that
are not the nodes that define the s. Hence, the exact mass matrix is full:
exact 6= 0 for all p, q.
Mpq
The spectral mass matrix can also be obtained by lumping the exact mass
matrix, a typical trick in FEM. The sum of the p-th row of the exact mass
matrix is:
P
X
exact
Mpq
=
P
X
(p , q )
(2.38)
q=0
q=0
= p ,
P
X
q=0
= (p , 1)
= wp pq
11
(2.39)
(2.40)
(2.41)
Stiffness matrix
The stiffness matrix is full.
Kpq = 2/h (p , q )P
= 2/h
P
X
wi p (i ) q (i )
(2.42)
(2.43)
i=0
(2.45)
K = 2/h HWHt
(2.46)
= h/2
P
X
i=0
P
X
(2.47)
wi f (i )p (i )
(2.48)
wi f (i )pi
(2.49)
i=0
= h/2 wp f (p )
(2.50)
(2.51)
12
+ 2 u + f = 0
(2.52)
x
x
The mass matrix is
Mpq = h/2 wp (p ) pq
(2.53)
(2.54)
2.6
Basis functions that span the whole domain are not practical for complicated geometries (e.g. seismic wave propagation in a sedimentary basin) or
models with discontinuous physical properties (e.g. wave equation in layered
media). The approach, borrowed from FEM, is to decompose the domain
into elements, then apply a spectral method within each element. The continuity of the solution across inter-element boundaries is efficiently achieved
by the choice of Lobatto nodes.
The spectral element mesh
The domain [a, b] is partitioned into N elements e = [Xe1 , Xe ], e =
1, ..., N , with X0 = a and XN = b.
A mapping e is defined between each element (x e ) and the reference
element ( [1, 1]):
x = e () =
1+
1
Xe1 +
Xe , [1, 1]
2
2
(2.55)
x (Xe1 + Xe )/2
, x e
Xe Xe1
(2.56)
or, inversely,
= (e )1 (x) = 2
Each element is provided with a GLL sub-grid. The i-th GLL node of the
e-th element is located at
xei = e (i )
(2.57)
13
The non-redundant list of these nodes (i.e. inter-element nodes counted only
once) form a set of N P + 1 global nodes
xI = xei
(2.58)
The table I(i, e) is the local-to-global index map table. We adopt the following shortcut notation for this association between indices:
I (i, e)
(2.59)
(P + 1) each.
e=1
To assemble is to add the local contributions from each element into a global
array. The assembled vector
N
a = A ae ,
e=1
(2.60)
(2.61)
(i,e)
I(i,e)
e
a
ae1 + ae0
(2.62)
a (:) = 0
loop over e from 1 to N
compute the local vector ae (:)
loop over i from 0 to P
k = I(i , e)
a(k) = a(k) + ae(i)
end loop over i
end loop over e
A = A Ae ,
e=1
14
(2.63)
(2.64)
(i,j,e)
I(i,e)
J(j,e)
e
Aij
Ae1 + Ae0P
P0
A (:,:) = 0
loop over e from 1 to N
compute the local matrix Ae(:,:)
loop over j from 0 to P
kj = I(j , e)
loop over i from 0 to P
ki = I(i , e)
A(ki,kj) = A(ki,kj) + Ae(i,j)
end loop over i
end loop over j
end loop over e
Basis functions
A set of global basis functions is defined by gluing together the spectral basis
functions based on the GLL nodes of each element:
e
i (x) if I (i, e) and x e
I (x) =
(2.66)
0
else
where
ei (x) = i [(e )1 (x)]
for x e
(2.67)
[Figure here.]
These basis functions are continuous across inter-element boundaries. This
efficiently enforces the continuity of the solution. (Same as in FEM.)
15
Galerkin approximation
A Galerkin approximation based on these basis functions and numerical
integration leads to Equation 2.11 with
N
K =
(2.68)
A Me
(2.69)
A fe
(2.70)
e=1
N
M =
f
A Ke
e=1
N
e=1
where
e
Kij
= (i , j )P /(he /2)
(2.71)
Mije
fie
= (i , j )P he /2
(2.72)
= (f, i )P he /2
(2.73)
u(x)v(x)dx =
a
N Z
X
e=1 e
N Z 1
X
e=1
uv dx
(2.74)
ue ()v e () d he /2
(2.75)
N
X
(ue , v e )P he /2
(2.76)
e=1
Note that
i () if i | I (i, e)
eI () =
(if node I belongs to element e)
0
else
16
(2.77)
= (I , J )P
=
(2.78)
N
X
(eI , eJ )P he /2
(2.79)
e=1
(i , j )P he /2
(2.80)
(i,j,e)
I(i,e)
J(j,e)
Matrix-vector multiplications
In practice, for large scale problems the assembled stiffness matrix is rarely
computed and stored as is, but a function is written to evaluate the matrixvector product a = Ku. This function computes the local contributions
ae = Ke ue on-the-fly as it assembles the vector a. The pseudo-code for this
function is:
a (:) = 0
loop over e from 1 to N
loop over i from 0 to P
k = I(i , e)
xe(i ) = x(k)
end loop over i
ae = Ae xe
loop over i from 0 to P
k = I(i , e)
a(k) = a(k) + ae(i)
end loop over i
end loop over e
1
2
3
4
5
6
7
8
9
10
11
12
create the
local vector xe
Note the similarity with the vector assembly pseudo-code. This procedure
satisfies the data locality principle.
3
3.1
Strong form
Consider a finite spatial domain R2 . Let D and N be a nonoverlapping partition of the boundaries of . Let f (x, y) be some forcing
17
function. Let denote the gradient operator, and n the outward normal to
a boundary.
The 2D Helmholtz model problem is:
Find u(x, y) with (x, y) such that
2u 2u
+ 2 + u + f (x, y) = 0
x2
y
(3.1)
for (x, y) D
u(x, y) n = 0
for (x, y) N
(3.2)
(3.3)
(3.4)
Weak form
Find u H10 () such that for all v H10 () we have
a(u, v) (u, v) = (f, v)
(3.5)
Z Z
u v dx dy
(3.6)
(3.7)
with
Kij
= a(i , j )
(3.8)
Mij
= (i , j )
(3.9)
fi = (f, i )
3.2
(3.10)
3.3
(3.11)
Basis function
(3.12)
3.4
2D integrals
P
P
X
X
wj u(i , j )
wi
P X
P
X
wi wj u(i , j )
(3.15)
i=0 j=0
J e (, ) = y
=
y
(3.14)
j=0
i=0
(3.13)
P
P
XX
i=0 j=0
where Jije = J e (i , j ).
19
wi wj u(i , j )Jije
(3.16)
(3.17)
(3.18)
3.5
Assembly operations apply as in the 1D case. Lets consider only the local
contribution from element e. The local matrix component associated to
nodes I (i, j) and K (k, l) is
e
MIK
= (eI , eK )P
(3.19)
=
=
=
=
=
P X
P
X
m=0 n=0
P X
P
X
m=0 n=0
P X
P
X
wm wn [eI eK J e ](m ,n )
(3.20)
wm wn i (m )j (n ) k (m )l (n ) Jije
(3.21)
wm wn Jije im jn km ln
(3.22)
m=0 n=0
wi wj Jije ik jl
wi wj Jije IK
(3.23)
(3.24)
3.6
The local contribution from element e to the stiffness matrix is the integral
Z Z
I K
I K
e
+
dx dy
(3.25)
a (I , K ) =
x x
y y
e
evaluated with the GLL quadrature. This requires a change of variables to
the reference element with local coordinate system (, ). Applying the
chain rule for differentiation:
2
X
X e
X e
I K
I K
I
K
+
=
(3.26)
x x
y y
xk
xk
k=1 =,
=,
!
2
X X e e X
K
I
(3.27)
=
xk xk
k=1
XX
20
Ke ()
(3.28)
with
e ()
KIJ
P X
P
X
()
Wpq
p=0 q=0
where
()
Wpq
eI eK
(3.29)
(p ,q )
#
" 2
X
e
= wp wq Jpq
xk xk
k=1
+ 1)2
(3.30)
(p ,q )
+ 1)2
p
q
XX
()
(3.32)
=
Wpq
i (p ) j (q ) k (p ) l (q )
| {z }
| {z }
p
q
jq
= jl
lq
()
(3.33)
where H is the matrix of derivatives of the Lagrange basis functions (Equation 2.44). The matrix Ke () is very sparse: node I (i, j) interacts only
with nodes in column j. [Figure here.] Efficiency of tensor-product basis,
low operation count compared to hp-FEM.
Matrix-vector multiplication:
Fe () = Ke () ue
e ()
FI
e ()
(3.34)
ueJ
(3.35)
e ()
(3.36)
KIJ
XX
k
=
=
XX
k
XX
k
KI (kl) uekl
jl
()
(3.37)
Hip Hkp
()
Hip Wpj
X
|
X
k
21
()
jl Wpj uekl
{z
()
Wpj
uekj
Hkp uekj
(3.38)
(3.39)
Lets store the vector Fe in matrix form: we define the matrix [Fe ] with size
(P + 1) (P + 1) and components Fije such that I (i, j). Similarly define
Ue as the matrix-form storage of vector ue . We get:
i
h
(3.40)
Fe () = H(We () Ht Ue )
Similarly [Exercise: show it]:
i
h
Fe () = (We () Ue H)Ht
i
h
Fe () = H(We () Ue H)
i
h
Fe () = (We () Ht Ue )Ht
(3.41)
(3.42)
(3.43)
(3.44)
= U H
(3.45)
[F ] = W
e ()
+ W
e ()
(3.46)
(3.47)
(3.48)
These steps are the core of any SEM code. They involve 4 matrix-matrix
multiplications (mxm operations) that can be highly optimized. All matrices
involved have size (P + 1) (P + 1). The floating point operation count in
the 2D SEM is of order (P + 1)3 , much more efficient than the order (P + 1)4
flops count in the FEM. In 3D the relative efficiency is still more dramatic:
(P + 1)4 flops for the SEM versus (P + 1)6 for the FEM.
3.7
Boundary matrix
If the boundary condition is non zero on the Neumann boundary an additional term appears in the weak form:
a(u, v) (u, v) = (f, v) + (, v)N
22
(3.49)
where
(, v)N =
(x, y) v(x, y) ds
(3.50)
(3.53)
The vector involves only the nodes on the boundary N . The boundary
matrix B is diagonal. At the boundary element level:
b (1D)
b
Bij
= wi Ji
ij
(3.54)
Numerical properties
For the sake of clarity, we will consider a non-dispersive medium with wave
speed c governed by the scalar wave equation, and a monochromatic plane
wave with frequency and wavenumber k = /c. The phase velocity /k
of the numerical solution is generally different than c. We quantify the
dispersion error by the relative phase velocity misfit between the numerical
and the theoretical wave solutions:
. /k c
.
=
c
(4.1)
For frequency domain problems, we will see that depends on the SEM
polynomial order P and on the non-dimensional number = kh, where h is
the element size. Later on, for time domain problems we will see that time
discretization introduces an additional error that depends on the order q of
the time integration scheme and on = t, where t is the time step.
In practice, we can measure the time delay misfit T between a synthetic
seismogram and the exact analytical solution (e.g. by sub-sample precision
cross-correlation time delay estimate). The dispersion error is related to
the time delay by
T
(4.2)
=
T
Because the phase velocity error is independent of T , Equation 4.2 implies
that the time delay grows proportionally to the travel time.
The average number of GLL nodes per wavelength, G, is defined by
.
G = p/h = 2 p/kh,
4.1
(4.3)
Dispersion analysis in 1D
(4.4)
24
RP (x)
1 x2 /2
4822x2 +x4
48+2x2
36001680x2 +92x4 x6
3600+120x2 +2x4
2
24
4
2880
6
604800
(4.5)
(4.7)
We denote dn () the spectral displacement of the n-th edge node (xn = nh)
and
G1 = s12
(4.8)
(4.9)
(4.10)
The structure of the condensed problem is similar to that of a finite difference scheme, and the standard Von Neumann analysis technique can be
applied. Assuming dn () = d0 () exp(ikhn), Equation 4.10 yields a dispersion relation between wavenumber k and frequency , of the form of
Equation 4.4.
25
P!
(2P )!
(4.11)
2
(4.12)
(e/2G)2P
.
4p(2P + 1)
(4.13)
where we have employed Stirlings formula, n! 2nn+1/2 en , to approximate A(P ) (e/4P )2P /[4P (2P + 1)]. The error decays faster than
exponentially as a function of P , provided that
G > e/2 4.27.
(4.14)
26
12
6 5
10
20
6 5
NGLL = 4
10
NGLL = 5
15
h/c
8
6
10
4
Re(k h)
Im(k h)
exact
2
0
10
25
6 5
10
10
40
6 5
NGLL = 6
15
NGLL = 7
20
h/c
10
30
15
20
10
10
5
0
10
50
10
6 5
15
20
10
60
NGLL = 8
6 5
15
20
NGLL = 9
50
40
10
h/c
40
30
30
20
20
10
0
10
10
15
Re(k h) and Im(k h)
20
25
10
15
20
Re(k h) and Im(k h)
25
30
Figure 1: Dispersion curves for SEM, including complex wavenumbers. Stability of explicit time schemes is related to the highest propagating frequency
(red circle, the end of the last optical branch). The red cross indicates half
that frequency.
27
10
20
10
65 4 3
0.5
10
4
5
6
7
8
9
10
10
10
10
T / T , dispersion error
T / T , dispersion error
10
10
10
10
10
10
4
5
6
7
8
9
10
10
10
12
10
10
10
10
10
10
kh
10
Nodes per wavelength
4.2
We are concerned with the two competing goals that determine the performance of a simulation: maximizing accuracy while minimizing the computational cost. In SEM accuracy can be improved by decreasing h or by
28
1
40.6
128
406
2
9.6
17.2
30.5
3
6.5
9.5
14
4
5.5
7.3
9.7
5
5
6.3
7.9
6
4.7
5.7
6.9
7
4.5
5.4
6.3
8
4.4
5.1
5.9
9
4.4
5
5.6
10
4.3
4.8
5.4
30
2
3
4
6
10
15
25
20
15
10
0
6
10
10
10
10
29
Code
SEMLAB
SEM2DPACK
SEM2DPACK
AXISEM
AXISEM
SPECFEM3D
E(p)/(p + 1)D
p+1
4(p + 2)
8(p + 3)
8(p + 7)
12(p + 9)
9(2p + 11)
22
30
D
L
h
(4.16)
It can be rewritten as
cost (kL)D ,
where
=
E(P )
.
(kh)D
(4.17)
(4.18)
The first term in Equation 4.17 is entirely due to the physical dimensions
of the problem whereas the term encapsulates the effect of the numerical
resolution. In the remainder we will refer to as the computational cost.
We have assumes that a good preconditioner is available, so that the number
of iterations required by the solver is practically a constant. Note that for
large P we get
(P + 1)D+1
(4.19)
(kh)D
We can now address the cost-accuracy trade-offs of SEM for frequency domain solvers. For a given accuracy level we must find the optimal values
hopt and Popt that minimize the cost function in Equation 4.18 under the
constrain of Equation 4.11 (fixed accuracy). This optimization problem is
solved graphically in Figure 4, where we show the cost as a function of P
and assuming h is given by Equation 4.11. The minimum of each curve
(indicated by circles) gives the optimal values of P for a given accuracy level.
[Plot also the optimal h.]
5
5.1
Leapfrog
dn+1 = dn + tvn+1/2
vn+3/2 = vn+1/2 + tM1 [K dn+1 + f (tn )]
Storage requirements: two global fields, d and v.
31
(5.1)
(5.2)
3D
10
= 10%
1%
0.1%
0.01%
10
10
10
10
Polynomial order
15
20
32
Newmark schemes
Man+1 = Kdn+1 + f (tn+1 )
(5.3)
(5.4)
2
(5.5)
Predictor-corrector implementation:
1. Predictor:
= dn + t vn + (1/2 )t2 an
d
= vn + (1 )tan
v
2. Solver:
(5.6)
(5.7)
+ f (tn+1 )]
an+1 = M1 [K d
(5.8)
+ t2 an+1
dn+1 = d
(5.9)
+ t an+1
vn+1 = v
(5.10)
3. Corrector:
h
C
,
Dm c
(5.11)
(5.12)
1
2
2 6
42 + 6 29
4
13.55
5
19.80
6
27.38
7
36.27
8
46.42
9
57.87
(5.14)
The usual leapfrog scheme is second order accurate, q = 2, and its dimensionless factor is B = 1/24. Within the second order class it is the most
accurate scheme.
Within the asymptotic regime, the total dispersion error combining space
and time discretizations is
= A(P ) (kh)2P + B(t)q .
(5.15)
In common practice the time step is set to a moderate fraction of the critical
value (5.11), i.e. t = tc with . 1. We can write in terms of = kh
as
q
C
2P
q
(5.16)
A(P ) + B
Dm (P )
Both components of the dispersion error are compared in Figure 5 for P = 8.
The error is dominated by the time-discretization error as soon as more than
34
10
70.6
2.5
2
P=8
1.5
1
0.5
0
0.5
1.5
2
2.5
h / = wavelengths per element
3.5
50
20
10
T/T
0
10
2P
max
T/T roundoff
3
10
10
10
12
10
15
10
10
10
h / = wavelengths per element
Figure 5: Phase velocity curve (top) and dispersion error (bottom) for SEM
with p = 8 as a function of resolution (wavelengths per element or nodes per
wavelength). The green dashed line is the theoretical estimate, the black
dashed line is the time-discretization error of the centered difference scheme.
35
10
G = 4.5
p=2
5
6
10
T = X
10
p=19
10
10
10
10
10
10
10
36
5.2
There are several methods to achieve higher order in time integration. The
so-called symplectic timestepping algorithms are very convenient.
The update of displacement and velocity fields, d and v, from time t to
t + t is composed of a n-stage sub-stepping iteration. For k = 1 to n, do:
t t + ak t
d d + ak t v
(5.17)
(5.18)
1
v v + bk t M
[K d + f (t)]
(5.19)
d d + an+1 t v
(5.20)
(5.21)
For instance, a good fourth order algorithm is the position extended ForestRuth-like (PEFRL) scheme:
a1 = a5 =
b1 = b4 = 1/2
a2 = a4 =
b2 = b3 =
(5.22)
a3 = 1 2( + )
with
= 0.1786178958448091
= 0.2123418310626054
= 0.06626458266981849
Its error coefficient is B = 1/12500 and its critical CFL number is C =
2.97633.
Miscellaneous
6.1
6.2
Advanced topics
References
Bernardi and Maday (2001), Spectral, spectral element and mortar element
methods: mathematical analysis
Boyd (200?), Spectral elements (chapter of book in progress):
Gottlieb and Hesthaven, Spectral methods for hyperbolic problems: duality between modal Legendre aproximation and nodal Lagrange interpolation
(section 2), computational efficiency (section 7.4)
van de Vosse and Minev (1996), Spectral element methods: theory and
applications: spectral, pseudo-spectral and spectral elements (sections 2.2
and 2.3)
Deville, Fischer and Mund (2002), High-order methods for incompressible
fluid flow:
Canuto, Spectral Methods: Evolution to Complex Geometries and Applications to Fluid Dynamics: Chapter 5
Available software
39
Homework problems
C.1
(C.1)
We will look for the depth distribution of displacement u(z). The strong
form of this problem is:
Find the displacement profile u(z) and horizontal wavenumber k such that
du
d
2
2
(z)
=0
(C.2)
(z)u(z) + k (z)u(z)
dz
dz
with the following boundary conditions:
du
(z = 0) = 0
dz
u(z = H1 + H2 ) = 0
(C.3)
(C.4)
40
(C.5)
Write down the expression for the local matrices Me , Kex and Kez . Note
that the structure of Kx is similar to that of M, and that the bottom node (Dirichlet condition) must be removed from the unknowns.
Consider two cases:
(a) the layer interface interface lies inside an element (case A)
(b) the interface coincides with an inter-element boundary (Case B)
3. Write a code that
(a) generates a 1D mesh in which each element can have a different
size. For case A, the top two elements should have size h = 300 m
and the others h = 850 m. For case B, h = 400 m in layer 1 and
h = 900 m in layer 2.
(b) computes the SEM matrices for cases A and B. Let the polynomial degree P (the same for all elements) be a user specified
parameter.
(c) finds the two eigenvalues of the discrete problem that have the
smallest algebraic value (k02 and k12 ), and the associated eigenvectors
(d) evaluates by GLL quadrature a measure of error defined as the
integral of the squared difference between the SEM solutions and
their exact values (computed analytically, see below):
=
(uSEM
(z) uexact
(z))2 dz
m
m
(C.6)
C.2
(C.8)
42