You are on page 1of 7

Model Problem

It is easiest to develop the basis of the finite element method with a specific physical problem in
mind. To this end, lets look at the equation for the displacement of a 1D elastic bar as shown in
the sketch below

The assumptions are: The bar occupies the region 0 x `, and all its properties depend on x only.
The displacement of all points of the bar at position x at time t = 0 is u(x, t). The force exerted on
the portion of the bar to the left of x by the portion to the right of x is P (x) = A(x)(x, t), with
the force per unit area at x. There is a linear support force per unit length, c(x)u(x, t) opposing
the motion of the bar. At the ends x = 0, ` a variety of conditions are possible. To keep things
simple, lets assume that the ends of the bar are rigidly constrained so that u(0, t) = u(`, t) = 0
(other conditions will be considered later). If (x) is the mass per unit length, Newtons second law
for the segment of the bar occupying the interval [x dx/2, x + dx/2] is
dx
u = P (x + dx/2) P (x dx/2) c(x)dxu + f (x)dx + O(dx2 ),
where u
= 2 u/t2 . Dividing by dx and letting dx 0 we find
A
cu + f
x
Now we assume that the rod is linearly elastic so that the stress is proportional to the strain
e = u/x. Thus,
u
= E(x)
x
Substitution gives the equation of motion

u=

u
(AE(x) ) cu + f.
x
x
In this equation we assume that , A, E, c, and f are given functions of x. In the time dependent
case, we must in addition to fixing the ends of the rod, specify the initial position, u(x, 0) and
velocity u(x, 0)/t as functions of x.

u=

The energy equation for this system can be obtained by multiplying the equation by u and integrating
over the length of the bar. This gives
Z `
Z `
Z `
Z `

u
uf
dx.
u
cuu dx +
u
u dx =
(AE(x) ) dx
x
x
0
0
0
0
1

On the left hand side we have u


u = ( 21 u 2 )/t. On the right hand side, we need to integrate by
parts to obtain a useful expression. We use
u

u
u u
(AE(x) ) =
(uAE(x)

) AE(x)
,
x
x
x
x
x x


u u
1
u 2
AE(x)
=
AE(x)( )
x x
t 2
x

together with
1 cu2
2 t

cuu =
to find that

Z
0

1 2
u dx +
2

Z
0

1
u
AE(x)( )2 dx +
2
x

Z
0

1 2
cu dx
2

f u dx

= uAE(x)

`
u
.
x 0

Since the ends of the bar are fixed, u(0,


t) = u(`,
t) = 0, and the quantity in the brackets on the left
is constant in time and represents to total energy in the bar. Clearly, the first term is the kinetic
energy, the second the elastic energy, the third the elastic support energy, and the last the energy
supplied by the applied force.
Lets specialize now to the time independent, or static, case continuing to require that the displacment vanishes at both ends of the rod. (This restriction can be easily removed later.) The
displacement u(x) of the bar satisfies

du
d
(AE(x) ) + cu = f, 0 < x < `, u(0) = u(`) = 0,
dx
dx

were AE(x) = A(x)E(x) is a given function AE C 1 ([0, `]), and c, f C([0, `]) are given. Note
that the set V = {u C 2 ([0, `]) : u(0) = u(`) = 0} is a linear subspace of C 2 ([0, `]), and observe
that the function
d
du
Lu = (AE(x) ) + cu
dx
dx
is a linear mapping of V into C([0, `]). Thus, finding the solution of our differential equation
equivalent to finding u V such that Lu = f where f C([0, `]) is given. (Well continue to use
the abreviated notation V = {u C 2 ([0, `]) : u(0) = u(`) = 0} in the following paragraphs without
further comment.)
We will consider 2 additional derivations of the basic equation. The first is based on a property of
the potential energy of the rod. For any w V , define the function
P(w) =

Z
0

dw 2
1
AE(x)(
) dx +
2
dx

Z
0

1 2
cw dx
2

f w dx, w V

Recall from the above discussion that for a rod with displacement w(x) the first term represents the
elastic energy stored due to deformation of the rod, the second the energy stored due to deformation
of the supports, and the last the potential energy due to work done by the external force. We call
P the potential energy of the rod. We now show that of all functions in V , the solution u of the
equation Lu = f minimizes the potential energy. Let w V be an arbitrary element, then we can

always write w = u + v where Lu = f and v V (just take v = w u and recall that V is a linear
space). Then
P(w) = P(u + v) = P(u) +

`
0 0

(AEu v + cuv f v) dx +

Z
0

1
1
AE(v 0 )2 + cv 2 dx
2
2

where weve used the short hand notation 0 = d/dx. Lets concentrate on the middle term above
W(u, v) =

(AEu0 v 0 + cuv f v) dx,

which well call the first variation of P or the weak form of the equation Lu = f . We now use
integration by parts on W to show that u V satisfies Lu = f W(u, v) = 0 for all v = V. The
first term of W becomes
Z `
Z `
Z `
`
(AEu0 )0 v dx + (AEu0 v)|0
(AEu0 v)0 (AEu0 )0 v dx =
AEu0 v 0 dx =
0

Because v V vanishes at both ends of the interval, the integrated term vanishes and we find
W(u, v) =

((AEu0 )0 v + cuv f v) dx =

(Lu f )v dx = 0

since u satisfies Lu = f . Thus, we have


P(w) = P(u) +

Z
0

1
1
AE(v 0 )2 + cv 2 dx,
2
2

that is P(w) is equal to P(u) plus a term which is clearly nonnegative. This second term can only
vanish if v 0. (Even if the coefficient c = 0 we can conclude that v 0 = 0 or v = b =constant,
but then since v(0) = 0 b = 0.) Thus, in any case, P(w) has its minimum at w = u, and the
problem: find u V satisfying Lu = f for given continuous f is equivalent to finding u V make
P a minimum.
Now lets focus on the weak form or first variation1 W. We know that Lu = f W(u, v) = 0 for
all v V . We can show without difficulty that the implication sign can be reversed so that the
variational form implies the differential equation. That is, introducing the notation
a(u, v) =

(AEu0 v 0 + cuv) dx,

(f, v) =

f v dx,

1 The reason W is called the first variation of P can be seen as follows: Replace v by v. You can always do this
since v V and V is a linear space. We then have
Z `
Z `

1
1
P(u + v) P(u) = 
AEu0 v 0 + cuv f v dx + 2
AE(v 0 )2 + v 2 dx
2
0
0 2

Now divide by  and take the limit  0 to obtain


lim

0

P(u + v) P(u)


DP(u)(v) =



AEu0 v 0 + cuv f v dx,

where the notation is meant to suggest that DP(u) is the first derivative of P evaluated at u and this real valued
function (DP(u) : V R) is, in turn, applied to v.

we write W(u, v) = 0 in the form a(u, v) = (f, v), and suppose that the function u V satisfies
a(u, v) = (f, v), for all v V.
It then follows that u is the solution of Lu = f. This demonstration merely involves reversing the
steps that lead to the variational form, i.e., just reversing the integration by parts.2
The result of these considerations is that we can replace the original boundary value problem with
the following:
find u V such that a(u, v) = (f, v) for all v V
This is called the weak formulation of our boundary value problem (BVP), and we will point out a
few more of its features shortly, but first lets see how it leads directly to a numerical method. Let
Vn be a finite dimensional subspace of V with a system of basis vectors
j , j = 1, . . . , n, and look
P
for an approximate solution to our BVP in Vn . Thus, we take u = j uj j as a linear combination
of the basis vectors with coefficients uj to be found. Since Vn V we demand that the weak form
be satisfied for all v Vn . Using the facts that a(u, v) is symmetric, linear in each argument, and
that a(u, v) = (f, v) for all v Vn is equvalent to a(u, i ) = (f, i ), i = 1, . . . , n (since are a
system of basis vectors for Vn ), we conclude that
n
X

a(i , j )uj = (f, i ), i = 1, . . . , n,

j=1

that is, we obtain a system of n linear equations for the unknown coefficients uj of the approximate
solution.
As a specific example, take u00 + u = x 0 < x < 1, u(0) = u(1) = 0. Since AE 1, c
1, f (x) = x, this fits into our general format with V = {v C 2 ([0, 1]) : v(0) = v(1) = 0}. We have
R1
R1
a(u, v) = 0 (u0 v 0 + uv) dx and (f, v) = 0 xv dx. Lets pick Vn as the set of all polynomials of degree
at most n + 1, n 1 on [0, 1] which satisfy p(0) = p(1) = 0. Any p V can be written in the form
p(x) = x(1 x)q(x), where q is a polynomial of degree at most n 1 (V1 consists of all multiples of
x(1 x), V2 contains all linear combination of the polynomials 1 = x(1 x), 2 = x2 (1 x), and
in general Vn is spanned by j = xj (1 x), j = 1, . . . , n.) We compute

Z 1
Z 1

2

xi+j (1 x)2 dx =
i j dx =
(k + 1)(k + 2)(k + 3) k=i+j
0
0
and

0i 0j dx =

(ixi1 (1 x) xi )(jxj1 (1 x) xj ) dx = ij

2 Since



2

(k 1)k(k + 1) k=i+j

were new to these manipulations, I will go through the details. Starting with a(u, v) integrate the first
term by parts to obtain
Z `
Z `
`


a(u, v) =
(AEu0 v)0 (AEu0 )0 v + cuv dx =
(AEu0 )0 v + cuv dx + (AEu0 v) 0 ,
0

and note that the integrated terms vanish since v V vanishes at both ends of the interval. Now combine this result
with the (f, v) term to find
Z `
Z `

(AEu0 )0 + cu f v dx =
(Lu f )v dx = 0
0

Finally, observe that unless Lu f = 0 the above integral cannot vanish. For example, suppose Lu f > 0 throught
some subinterval I = (x1 , x2 ) [0, `] and vanishes in [0, `] I, then is is easy to construct a v V such that
v(x) > 0, x I and v = 0 outside of I. Such a v would make the integral positive rather than zero.

and finally
Z
0

xi dx =

xi+1 (1 x) dx =

1
.
(i + 2)(i + 3)

These formulas allow us to compute




2ij
2
kij = a(i , j ) =
+
(k 1)k(k + 1) (k + 1)(k + 2)(k + 3) k=i+j
(called theP
stiffness matrix) and fi = (f, i ) (the load vector) after which we need to solve the linear
n
equations j=1 ki juj = fi , i = 1, . . . , n. Lets progam the above procedure
function [x,u]=myode(n,m)
%
function [x,u]=myode(n,m)
% Inputs: n=dimension of approximating subspace
%
m: solution computed at points x=linspace(0,1,m)
% Outputs: x and u(x) with u the numerical solution at x
%
kstif=zeros(n,n);
fload=zeros(n,1);
for i=1:n
fload(i)=1/((i+2)*(i+3));
for j=1:n
s=i+j;
kstif(i,j)=2*(i*j/((s-1)*s*(s+1)) +1/((s+1)*(s+2)*(s+3)));
end
end
ucoef=kstif\fload;
x=linspace(0,1,m);
u=zeros(1,m);
for i=1:n
u=u+ucoef(i)*poly(i,x);
end
%================================
function y=poly(i,x)
y=(x.^i).*(1-x);
Running this program gives close agreement with the exact solution, u(x) = x sinh(x)/ sinh(1) as
shown in the plot below.

0.06

0.05

0.04

0.03

0.02

0.01

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

where the circles represent the exact solution, and the line the n = 2 numerical approximation. A
more quantative comparison gives
>> [x,u2]=myode(2,11);
>> [x,u4]=myode(4,11);
>> yy=x-sinh(x)/sinh(1);
>> output=[x;yy;u2;u4];
>> fprintf(%10s %10s %10s %10s\n,x,uexac,n=2, n=4)...
;fprintf(%10.6f %10.6f %10.6f %10.6f\n,output)
x
uexac
n=2
n=4
0.000000
0.000000
0.000000
0.000000
0.100000
0.014766
0.014594
0.014766
0.200000
0.028680
0.028550
0.028680
0.300000
0.040878
0.040890
0.040878
0.400000
0.050483
0.050638
0.050483

0.500000
0.600000
0.700000
0.800000
0.900000
1.000000

0.056591
0.058260
0.054507
0.044295
0.026518
0.000000

0.056818
0.058452
0.054564
0.044178
0.026315
0.000000

0.056590
0.058260
0.054508
0.044295
0.026518
0.000000