Вы находитесь на странице: 1из 21

The Finite Element Method.

The Finite Difference


method.
http://www.math.unibas.ch/beilina
1
Vector spaces of polynomials
Let
P
q
(a, b) =
_
p(x) =
q

i=0
c
i
x
i
: p(x) degree q on (a, b), c
i
R
_
,
(1)
where c
i
are coefcients of p(x).
A basis of P
q
(a, b) consists of a special set of polynomials. A usual basis
is the set {1, x, ..., x
q
} which is a basis because this set is linearly
independent since a
0
1 + a
1
x + a
2
x
2
+ ... + a
q
x
q
= 0 for all
a < x < b implies that a
0
= a
1
= ... = a
q
= 0, and any polynomial can
be written as a linear combination of these polynomials. It follows that
dimP
q
(a, b) = q + 1. Another basis is the set {(x c)
i
}
q
i=0
, where
a < c < b.
2
Lagrange basis
Let 0 = x
0
< x
1
< ... < x
n
= 1 be a partition of [0; 1], and let S be the
linear space of functions v such that
1. v C
0
([0, 1]),
2. v
[x
i1
,x
i
]
is a linear polynomial, i = 1, ..., n, and
3. v(0) = 0.
Further, i = 1, ..., n we dene
i
such that
i
(x
j
) =
ij
- the Kronecker
delta. We call {
i
: 1 i n} a nodal (Lagrange) basis of S V and
v(x
i
) are the nodal values of a function v.
3
The explicit expression for the Lagrange basis functions
i
is

i
(x) =
(x
0
)(x
1
) ... (x
q
))
(
i

0
)(
i

1
) .... (
i

q
)
=

j=i
x
j

i

j
. (2)
For example, Lagrange basis functions for q = 1 are

1
=
x
0

0
,
0
=
x
1

1
.
4
Polynomial interpolation
On of the examples of a polynomial approximation of a function is the
Taylor Polynomial of degree q.
We assume, that f C([a, b]), and we choose interpolation nodes
a x
1
< x
2
< ... < x
n
b and dene a polynomial interpolant

q
f P
q
(a, b), that interpolates f at the nodes x
i
by requirement that

q
f(x
i
) = f(x
i
), i = 0, ..., q. Wed can express
q
f using Lagranges
formula

q
f =
n

i=1
f(x
i
)
i
. (3)
For q = 1 we have:

1
f = f(a)
x b
a b
+ f(b)
x a
b a
, a x b. (4)
5
In the case q = 0 we have following constant interpolants of a function
f(x):
f(x)

0
(x)

0
= a
b

0
(x)
f(x)

0
= b
a
Here,
0
(x) = f(
0
) with
0
= a and
0
= b.
6
Denition For a given v C
0
([0, 1]), the interpolant of v is v
I
S and
determined by v
I
=

n
i=1
v(x
i
)
i
.
If v S v = v
I
. We now prove the approximation theorem for
interpolant:
Theorem Let h = max
1in
(x
i
x
i1
). Then
||u u
I
||
E
Ch||u

|| u V , where C is independent of h and u.


Proof We recall denition of the two norms and we prove the estimate
piecewise, or
_
x
j
x
j1
(u u
I
)

(x)
2
dx c(x
j
x
j1
)
2
_
x
j
x
j1
u

(x)
2
dx, (5)
then the theorem follows then by summing over j and with C =

c.
7
Let e = u u
I
denote the error; since u
I
is a linear polynomial on each
interval, the (5) is equivalent to
_
x
j
x
j1
e

(x)
2
dx c(x
j
x
j1
)
2
_
x
j
x
j1
e

(x)
2
dx. (6)
We then change variables by afne mapping of the interval [x
j1
, x
j
] to
the interval [0, 1] to get
_
1
0
e

( x)
2
d x c
_
1
0
e

( x)
2
d x, (7)
where x = x
j1
+ x(x
j
x
j1
) and e(x) = e(x
j1
+ x(x
j
x
j1
)).
8
Verication of (7): let w = e and w vanishes at both ends of the interval.
By Rolls Theorem, w

() = 0 for 0 < < 1. Thus,


w

(y) =
_
y

(x) dx. By Schwarz inequality,


|w

(y)| =

_
y

(x) dx

_
y

1 w

(x) dx

_
y

1 dx

1/2

_
y

(x)
2
dx

1/2
=

1/2
(
_
y

(x)
2
dx)
1/2

1/2
(
_
1
0
w

(x)
2
dx)
1/2
.
(8)
Then, to get (7) we squaring and integrate (8) with respect to y with
c = sup
0<<1
_
1
0

dy = 1/2.
2
9
Galerkins method with piecewise polynomials
We consider a model of stationary heat conduction of a thin wire on the
interval [0, 1] that is heated by a heat source of intensity f(x). We want to
determine the stationary distribution of the temperature u(x) in the wire.
Let q(x) denote the heat ux in the direction x, 0 < x < 1. By
conservation law
q(x
2
) q(x
1
) =
_
x
2
x
1
f(x) dx,
where x
1
, x
2
are the endpoints of an arbitrary sub-interval (x
1
, x
2
) of
(0, 1).
By fundamental theorem of calculus, q(x
2
) q(x
1
) =
_
x
2
x
1
q

(x) dx, and


we conclude that
q

(x) = f(x). (9)


10
The Fouriers law q(x) = a(x)u

(x) states that heat ows from warm


regions to cold regions at a rate proportional to the temperature gradient
u

(x). Here a(x) > 0 is coefcient of heat conductivity. Combining


Fouriers law and (9), we get a stationary heat equation in 1D:
(a(x)u

(x))

= f(x), 0 < x < 1. (10)


To dene the solution u uniquely, we complete (10) with Dirichlet
boundary conditions at the x = 0 and x = 1 and get nally a two-point
boundary-value problem:
(a(x)u

(x))

= f(x), 0 < x < 1,


u(0) = u(1) = 0.
(11)
11
The Galerkin nite element method (FEM)
We consider the problem (11) in the case a = 1:
u

(x) = f(x), 0 < x < 1,


u(0) = u(1) = 0,
(12)
and formulate the simplest FEM for (12) based on continuous piecewise
linear approximation.
Let I
h
: 0 = x
0
< x
1
< .... < x
M+1
= 1 be a partition of interval
I = (0, 1) into subintervals I
j
= (x
j1
, x
j
) of length h
j
= x
j
x
j1
.
Let V
h
denote the set of continuous piecewise linear functions on I
h
that
are zero x = 0 and x = 1.
12
V
h
is a nite dimensional vector space, dimV
h
= M, with a basis
consisting of the hat functions {
i
}
M
i=1
:

i
(x) =
_

_
0, if x / [x
i1
, x
i+1
],
xx
i1
x
i
x
i1
, if x [x
i1
, x
i
],
x
i+1
x
x
i+1
x
i
, if x [x
i
, x
i+1
];
(13)
0 = x
0
x
1
x
i1

i1
x
i

i
x
i+1

i+1
x
M+1
= 1
13
We also can write hat functions as

i
(x
j
) =
ij
=
_
_
_
1, if i = j,
0, if i = j.
(14)
The coordinates of a function v in V
h
in this basis are the values v(x
i
) at
the interior nodes x
i
, i = 1, ..., M, and a function v V
h
can be written
v(x) =

M
i=1
v
i

i
(x), v
i
= v(x
i
).
14
Now, the Galerkins method is based on stating the equation (12) in the
form
_
1
0
(u

(x) f(x), v) = 0 v V
h
. We integrate this equation
by parts to get:

_
1
0
u

(x)v(x) dx = u

(1)v(1)+u

(0)v(0)+
_
1
0
u

(x)v

(x) dx (15)
and we get following variatonal formulation of (12): nd u V
h
such that
_
1
0
u

(x)v

(x) dx =
_
1
0
f(x)v(x)dx v V
h
. (16)
The Galerkin FEM for (12) is: nd u
h
V
h
such that
_
1
0
u

h
(x)v

(x) dx =
_
1
0
f(x)v(x)dx v V
h
. (17)
15
The discrete system of equations
Using basis of hat functions {
i
}
M
i=1
we have: u
h
=

M
i=1
u
hi

i
(x).
Substituting into (17) we have:
M

i=1
u
h
i
_
x
i+1
x
i1

i
(x)v

(x) dx =
_
1
0
f(x)v(x)dx v V
h
. (18)
We take v =
j
(x) and get:
M

i=1
u
hi
_
x
i+1
x
i1

i
(x)

j
(x) dx =
_
1
0
f(x)
j
(x) dx, i = 1, ..., M.
(19)
16
Let U = u
hi
denote the vector of unknown coefcients and A = (a
ij
) is
stiffness matrix M M with coefcients
a
ij
=
_
x
i+1
x
i1

i
(x)

j
(x) dx, (20)
and the load vector b = (b
j
) with
b
j
=
_
1
0
f(x)
j
(x) dx. (21)
Then, is equivalent to the linear system
AU = b. (22)
To solve this equation, we rst need to compute the stiffness matrix A and
load vector b.
17
Note, that a
ij
= 0 unless i = j 1, i = j, j = j + 1. Using the denition
of test functions (13), we compute rst diagonal elements a
ii
:
a
ii
=
_
x
i+1
x
i1

i
(x)

i
(x) dx
=
_
x
i
x
i1
_
1
h
i
_
2
dx
+
_
x
i+1
x
i
_
1
h
i+1
_
2
dx
=
1
h
i
+
1
h
i+1
.
(23)
18
Similarly,
a
i,i+1
=
_
x
i+1
x
i1

i
(x)

i+1
(x) dx
=
_
x
i+1
x
i
1
h
i+1
1
h
i+1
dx
=
1
h
i+1
,
a
i1,i
=
_
x
i+1
x
i1

i1
(x)

i
(x) dx
=
_
x
i
x
i1
1
h
i
1
h
i
dx
=
1
h
i
.
(24)
Verication: write (13) for
i+1
and
i1
and insert then into (24).
19
We compute coefcients of b in the same way to get:
b
j
=
_
x
j+1
x
j1
f(x)
j
(x) dx
=
_
x
j
x
j1
f(x)
x x
j1
h
j
dx
+
_
x
j+1
x
j
f(x)
x
j+1
x
h
j+1
dx

h
j
+ h
j+1
2
f(x
j
).
(25)
20
Relationship to Difference Methods
The matrix A is sparse matrix in the nense that most of its entries are
zero. In this case, A is banded matrix with non-zero entries occuring only
in the diagonal, super- and sub-diagonal positions. Using the dentions of
stiffness matrix a
i1,i
, a
ii
, a
i,i+1
we can write the i-th equation for the
system AU = b as:

1
h
i
U
i1
+
_
1
h
i
+
1
h
i+1
_
U
i

1
h
i+1
U
i+1

h
i
+ h
i+1
2
f(x
i
),
U
i
U
i1
h
i
+
U
i
U
i+1
h
i+1

h
i
+ h
i+1
2
f(x
i
),
2
h
i
+ h
i+1
_
U
i+1
U
i
h
i+1

U
i
U
i1
h
i
_
f(x
i
).
(26)
The difference operator on the left hand side can also beseen to be an
O(h) accurate approximation to the differential operator
d
2
dx
2
. For the
uniform mesh, equation (26) reduces to the second-order accurate
difference equations.
21

Вам также может понравиться