Sie sind auf Seite 1von 3

Introduction to Ritz-Galerkin Discretization

Ritz-Galerkin discretization is the basis for finite element methods and for spectral methods. The low-level introduction presented here will illustrate some of the basic concepts and
it will enable us to solve simple 1-d problems. The underlying theory and higher-dimensional
implementation are quite involved and will be discussed in detail later.
An Illustrative Example. Consider the 1-d Poisson equation with homogeneous Dirichlet
boundary conditions,
def

Au =

d2 u
= f (x), 0 < x < 1,
dx2

u(0) = u(1) = 0.

(1)

We approximate the unknown solution by a linear combination of given basis functions,


uN (x) =

N
X

j j (x).

(2)

j=1

The basis functions j are required to satisfy homogeneous Dirichlet boundary conditions.
Due to linearity, uN will satisfy the same boundary conditions. In our previous discussion
of analytic solutions, the j s were taken to be the eigenfunctions for the negative Laplacian
operator, A in eqn (1). Here we allow other basis functions, e.g., piecewise polynomials or
special functions other than sines.
We define the residual error associated with the approximation (2) in eqn (1) to be
rN (x) = (AuN )(x) f (x).
In order to select the coefficients j in eqn (2), we require the residual to be orthogonal to
each of the basis functions,
1

Z
0

rN (x) i (x) dx = 0,

i = 1, . . . , N.

(3)

From the linearity of the differential operator A and the linearity of integration, we obtain
N
X
j=1

(Aj )(x) i (x) dx =

f (x) i (x) dx,

i = 1, . . . , N.

This linear system can be rewritten as A = b, where the coefficient matrix A and righthand-side vector b have entries
[A]i,j =
[b]i =

(Aj )(x) i (x) dx,

Z
0

i = 1, . . . , N, j = 1, . . . , N,

(4)

f (x) i (x) dx,

i = 1, . . . , N.

(5)

When the j s are chosen to be globally defined special functions like sines or cosines,
Ritz-Galerkin discretization is called a spectral method. (Spectral refers to eigenvalues and
1

eigenfunctions of a linear operator, but spectral functions can be used for an operator even
if they are its eigenfunctions.)
When the j s are chosen to be piecewise polynomials, Ritz-Galerkin discretization is
called a finite element method. For simplicity of implementation, it is advantageous to use
very low degree polynomials. This may require integration by parts to assemble the matrix
A in eqn (4). When A is the negative Laplacian,
[A]i,j =

Z
0

Z 1
d2 j
dj di
dx.

(x)
dx
=
i
2
dx
0 dx dx

(6)

Note that the boundary terms vanish because the i s satisfy homogeneous Dirichlet boundary
conditions.
Now consider continuous piecewise linear hat basis functions defined on an equispaced
grid {xi = ih | i = 1, . . . , N } with h = 1/(N + 1),

(x xi1 )/h,

xi1 x xi ,
i (x) = (xi+1 x)/h, xi x xi+1 ,

0,
otherwise.

(7)

These have piecewise constant derivatives

1/h,

xi1 < x < xi ,


di
= 1/h, xi < x < xi+1 ,
dx

0,
x < xi1 or x > xi+1 .

(8)

Note that each i is only piecewise continuously differentiable with discontinuities in the
derivatives at grid points xi1 and xi . Hence expression (4) for the matrix coefficients is not
valid. On the other hand, expression (6) is valid and yields

1/h,

[A]i,j = 2/h,

0,

if |i j| = 1,
if i = j,
otherwise.

(9)

The entries of the vector b in eqn (5) can be approximated by applying the trapazoidal
rule on each subinterval xj1 < x < xj ,
Z xi+1
x xi1
xi+1 x
[b]i = 0 +
f (x)
dx +
f (x)
dx + 0 h f (xi ).
h
h
xi1
xi
Z

xi

(10)

The error of this approximation is O(h2 ) provided f C 2 [0, 1].


Remark. The above Ritz-Galerkin-Finite Element discretization yields a coefficient matrix
A and right-hand-side vector b whose entries differ from those in the finite difference case
by a factor of h. If we multiply both A and b by h, then the formulas are identical to the
finite difference case.
It should be noted that the finite element derivation can be carried out even when u does
not have the C 4 continuity that was required in the finite difference derivation. In particular,
2

if f (x) = (x x) is the Dirac delta function centered at x (0, 1), then the exact solution
to the Poisson equation (1) is piecewise linear,
(

u(x) =

x(1 x), 0 x x,
x(1 x), x x 1.

The right-hand-side vector can be evaluated exactly,


[b]i = i (x),

i = 1, . . . , N,

and the finite element solution can be shown to be exact.


In the case of the 1-d linear steady-state diffusion equation with variable diffusivity,
!

d
du
Au =
(x)
.
dx
dx
If we proceed as above and apply midpoint quadrature, we obtain
[A]i,j

Z xj+1
1 di
1 di
(x)
(x)
dx +
dx
=
h dx
h dx
xj1
xj

(xi1/2 ),
j = i 1,

1 (xi1/2 ) + (xi1/2 ), j = i,
= O(h2 ) +
j = i + 1,
h

(xi+1/2 ),

0,
otherwise.
Z

xj

(11)

(12)

This is identical to the result obtained using finite volume discretization.

Exercises
1. Verify formula (9) for the entries of the matrix A from finite element discrization of
Poissons equation.
2. Verify formula (11) for the entries of the matrix A from finite element discretization of
the steady-state diffusion equation.

Das könnte Ihnen auch gefallen