Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Series expansion methods are the general class that encompass spectral and
nite element methods. We approximate functions as a linear combination
of prescribed expansion functions - we call these basis functions. For a con
tinuous function f (x), we write
f (x) =
aj j (x)
(3.1)
j=1
where j , j = 1, . . . , N, are the basis functions that each satisfy any boundary
conditions on f (x). The coecients aj are the unknowns and form a vector
of N numbers.
Suppose that we have a partial dierential equation of the arbitrary form
L (f ) = (x).
(3.2)
r(x) = L (f ) (x) = L
j=1
aj j (x) (x).
(3.3)
If L is linear and the basis functions, j (x) are the eigen-functions of L, then
the residual can be set to zero for the whole domain and the resulting N
algebraic equations can be solved for aj . Generally speaking, L is non-linear
so we will describe more general approaches for solving for the coecients
aj .
28
29
2
(||r(x)||2 ) = r(x)2 dx,
(3.4)
ii) the collocation method where we set the residual to zero at a discrete set
of positions xk (e.g. on a regular grid xk = kx),
r(xk ) = 0 k = 1, . . . , N
(3.5)
and iii) the Galerkin method which requires the residual to be orthogonal to
each of the basis functions,
k r(x)dx = 0 k = 1, . . . , N
(3.6)
k r(x)dx = 0 k = 1, . . . , N.
(3.7)
3.1
Spectral methods are a special case of the series expansion method; the basis
functions form an orthogonal set:
i j dx = 0 i = j.
The ability to use an orthogonal basis set is largely dictated by the domain
geometry and boundary conditions. For example, it is natural to use spherical
harmonics in spectral atmospheric models but dicult to model irregular
coasts with the same representation.
30
ak (t)eikx
k=N
g(x)h (x) dx = 0
S
eijx t
ak (t)eikx + cx
k=n
k=n
ak (t)eikx dx = 0 j = N, . . . , N
(3.8)
ijx ikx
dx =
i(kj)x
e
kj
= 0 j = k
j=k
31
3.1.2
aj sin (jx)
(3.9)
j=1
since the functions sin (jx) all satisfy the boundary conditions. The residual
of the governing equation is
r(x) =
aj xx sin (jx) +
j=1
aj x sin (jx) + 1
j=1
= 2
aj j 2 sin (jx) +
j=1
aj j cos (jx) + 1
(3.10)
j=1
1
0
j=1
j=1
= 0 k = 1, . . . , N
(3.11)
32
Once we evaluate the integrals and sums it will become apparent that (3.11)
represents a set of N algebraic equations in the unknowns, ak .
The rst term in (3.11) involves the expression
N
1
0 j=1
aj j
j=1
1
0
1
0
1
2
j=k
0 j=
k
which reects the orthogonality of the basis set. Evaluating the sum over j,
the rst term in (3.11) becomes
aj j
j=1
1
0
2
ak k 2 .
sin (kx) sin (jx) dx =
2
sin (kx) dx =
1
0
k k(1)(j+k)
.
(k 2 j 2 )
jk(1 (1)(j+k) )
(1)k 1
2 k 2
ak +
aj
=
k = 1, . . . , N
2
k2 j 2
k
j=1
(3.12)
ak
..
.
a1
.
..
a=
b=
..
.
(1)k 1
k
..
.
33
2 k 2
jk(1 (1)(j+k) )
ij +
2
k2 j 2
34
j(x)
0.5
0
0.5
1
0
0.2
0.6
0.4
0.8
0.8
0.8
0.4
ajj(x)
0.2
0
0.2
0.4
0
0.2
0.6
0.4
j j
(x)
0.5
0.5
0
0.2
0.4
0.6
Figure 3.1: Top: The basis functions used in the spectral method solution of
the Stommel model (N=6). Middle: the components of the solution due to
each basis function, aj j (x). Bottom: the numerical solution and analytical
solution.
35
0.8
0.6
(x)
0.4
0.2
0.2
0.4
0
0.8
0.6
0.4
0.2
Figure 3.2: Spectral solutions to the Stommel problem using dierent length
10
L1
L
2
L
10
Error
10
10
10
10
10
10
10
10
10
Figure 3.3: Convergence of the spectral method. The error, measured by the
l1 , l2 and l norms, is plotted as a function of N . Note the increasing rate
of convergence as N is increased.
36
(x)
x/x
j1
j+1
x/x
j1
j+1
Figure 3.4: a) The chapeau function and b) the top hat function
3.2
0
1
|xxj |
x
|x xj | > x
|x xj | x
(3.13)
j=1
i (t uj j + cuj x j uj x xj ) dx = 0 i = 1, . . . , N
(3.14)
1
i i1 dx =
x
6
i x i dx = 0
1
2
2
i xx i dx =
x
1
i xx i1 dx =
x
i x i1 dx =
37
3.5
=k
2=2skck)
4=2skck(1+2/3s2k )
=2s c (1+2/3s2(1+4/5*s2))
6
k k
k
k
=2s c /(14/3s2)
fe
k k
2.5
x/c
2
4
F.E. O(x )
6
F.D. O(x )
1.5
4
F.D. O(x )
F.D. O(x )
0.5
0.1
0.2
0.3
0.4
0.5
kx/
0.6
0.7
0.8
0.9
Figure 3.5: Dispersion relations for the O(x2 ), O(x4 ) and O(x6 )
nite dierence methods and the O(x4 ) nite elements method (using the
chapeau basis functions).
where the last two integrals were carried out by parts. Equation 3.14 then
becomes
1
c
(t ui1 + 4t ui + t ui+1 ) +
(ui+1 ui1 )
(ui+1 2ui + ui1 ) = 0
6
2x
x2
or, returning the nite dierence notation,
c
i ui
ii u = 0
Ax t u +
x
x2
where the averaging operator, Ax is dened:
1
1
Ax u = u + ii u = (ui1 + 4ui + ui+1 )
6
6
The nite element method gives fourth order spatial accuracy in this
problem. For comparison, the second order nite dierence approximation is
c
t u +
i ui
ii u = 0
x
x2
38
1
1
t u +
i u ii u
ii (u ii u) = 0
2
x
6
x
12
which uses a ve point stencil. The dispersion relation for the undamped
waves ( = 0) in these approximations are plotted in Fig. 3.5. Note that
although the stencil of the nite elements method is only three points (as
for the second order nite dierence approximation), and that the formal
truncation is O(x4 ), the dispersion relation is far more accurate than even
the sixth order nite dierence approximation.
Finite element Stommel model
Note that we can trivially see what the nite element approximation to the
Stommel problem would be by simply dropping the time-derivative in the
above problem. The resulting discretization is exactly the same as the secondorder nite dierence discretization.
3.3
ak cos (kx) +
k=1
bk sin (kx)
k=1
which has 2N + 1 degrees of freedom and where all coecients are real. This
representation has the advantage that it is immediately obvious that all terms
are real. A more succinct series representation is
(x) =
ck eikx
k=N
which also has 2N + 1 coecients but where the coecients ck are complex.
A complex number has two components, real and imaginary, and one may
wonder if there are in fact 4N + 2 degrees of freedom. If (x) is real, then
the coecients must satisfy a certain constraint as we derive now.
39
I
R
I
Let us write each coecient ck = cR
k + ic
k where
ck and
ck are
real
numbers. Then each term in the series is
I
ck eikx = (cR
k + ic
k ) [cos (kx) + i sin (kx)]
I
R
I
cR
k cos (kx) c
k sin (kx) + i
c
k sin (kx) + c
k cos (kx)
.
It is then obvious that the sum of contributions from modes k and k can
be written in term of cos (kx) and sin (kx) alone:
ck eikx + ck eikx =
I
I
R
(cR
k + c
k ) cos (kx) + (ck c
k ) sin (kx)
I
I
R
+i (cR
k + c
k ) sin (kx) + (ck + c
k ) cos (kx) .
I
I
R
cR
k c
k = 0 and
ck + c
k = 0
or more simply
ck = ck .
We can also associate each term in the two forms of Fourier series:
a0 = c 0
(which is real)
R
R
ak = ck + c
k = 2cR
k
I
I
bk = ck ck = 2cIk .