0% found this document useful (0 votes)
32 views16 pages

Finite Element Method Course Notes

The PE281 Finite Element Method Course Notes provide a detailed derivation of the Finite Element Method (FEM) starting from a simple ordinary differential equation (ODE) to demonstrate fundamental concepts and potential pitfalls. The notes cover the weak form of the original equation, Galerkin approximations, and the construction of basis functions, particularly focusing on piecewise linear functions known as 'hat functions'. The document emphasizes the importance of variational boundary-value problems and the use of finite element meshes in FEM.

Uploaded by

Timothy Gunawan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views16 pages

Finite Element Method Course Notes

The PE281 Finite Element Method Course Notes provide a detailed derivation of the Finite Element Method (FEM) starting from a simple ordinary differential equation (ODE) to demonstrate fundamental concepts and potential pitfalls. The notes cover the weak form of the original equation, Galerkin approximations, and the construction of basis functions, particularly focusing on piecewise linear functions known as 'hat functions'. The document emphasizes the importance of variational boundary-value problems and the use of finite element meshes in FEM.

Uploaded by

Timothy Gunawan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PE281 Finite Element Method Course Notes

summarized by Tara LaForce

Stanford, CA 23rd May 2006

1 Derivation of the Method


In order to derive the fundamental concepts of FEM we will start by looking
at an extremely simple ODE and approximate it using FEM.

1.1 The Model Problem


The model problem is:

−u′′ + u = x 0 < x < 1


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

and this problem can be solved analytically: u (x) = x − sinhx/sinh1. The


purpose of starting with this problem is to demonstrate the fundamental
concepts and pitfalls in FEM in a situation where we know the correct answer,
so that we will know where our approximation is good and where it is poor.
In cases of practical interest we will look at ODEs and PDEs that are too
complex to be solved analytically.
FEM doesn’t actually approximate the original equation, but rather the weak
form of the original equation. The purpose of the weak form is to satisfy
the equation in the "average sense," so that we can approximate solutions
that are discontinuous or otherwise poorly behaved. If a function u(x) is a
solution to the original form of the ODE, then it also satisfies the weak form
of the ODE. The weak form of Eq. 1 is

1
Z 1 Z 1
′′
(−u + u) vdx = xvdx (2)
0 0

The function v(x) is called the weight function or test function. v(x) can be
any function of x that is sufficiently well behaved for the integrals to exist.
The set of all functions v that also have v(0) = 0, v(1) = 0 are denoted by
H. (We will put many more constraints on v shortly.)
The new problem is to find u so that
R1
(−u′′ + u − x) vdx = 0 f orallv ∈ H
0 (3)
u (0) = 0 u (1) = 0
Once the problem is written in this way we can say that the solution u belongs
to the class of trial functions which are denoted H̃. When the problem is
written in this way the classes of test functions H and trial functions H̃
are not the same.
R 1 ′′For example, u must be twice differentiable and have the
property that 0 u vdx < ∞, while v doesn’t even have to be continuous as
long as the integral in Eq. 3 exists and is finite. It is possible to approximate
u in this way, but having to work with two different classes of functions
unnecessarily complicates the problem. In order to make sure that H and H̃
are the same we can observe that if v is sufficiently smooth then
Z 1 Z 1
−u vdx = ′′
u′ v ′ dx − u′ v|10 (4)
0 0

This formulation must be valid since u must be twice differentiable and v was
arbitrary. This puts another constraint on v that it must be differentiable
and thatRthose derivatives must be well-enough behaved to ensure that the
1
integral 0 u′ v ′ dx exists. Moreover, since we decided from the outset that
v(0) = 0 and v(1) = 0, the second term in Eq. 4 is zero regardless of the
behavior of u′ at these points. The new problem is
Z 1
(u′ v ′ + uv − xv) dx = 0. (5)
0

Notice that by performing the integration by parts we restricted the class of


test functions H by introducing v ′ into the equation. We have simultaneously
expanded the class of trial functions H̃, since u is no longer required to have

2
a second derivative in Eq. 5. The weak formulation defined in Eq. 5 is called
a variational boundary-value problem.
In Eq. 5 u and v have exactly the same constraints on them:
R1 R1
1. u and v must be square integrable, that is: 0 uvdx ≈ 0 u2 dx < ∞
2. The
R 1 ′ first derivatives
R 1 ′ 2 of u and v must be square integrable, that is:
0
u v ′
dx ≈ 0
(u ) dx < ∞ (this actually guarantees the first property)
3. We had already assumed that v(0) = 0 and v(1) = 0 and we know from
the original statement of the problem that u(0) = 0 and u(1) = 0.

Now we have that H̃ = H = H01 . Any function w is a member of H01


R1
if 0 (u′ )2 dx < ∞ and w(0) = w(1) = 0. H01 is the space of admissible
functions for the variational boundary-value problem (ie. all admissible test
and trial functions are in H01 )
We will consider the variational form Eq. 5 to be the equation that we would
like to approximate, rather than the original statement in Eq. 1. Once we
have found a solution to Eq. 5 in this way we can ask the question whether
this formulation is also a solution to Eq. 1: That is, whether this solution is
a function satisfying Eq. 1 at every x in 0 < x < 1, or whether we have found
a solution that satisfies only the weak form of the equation. In the case that
we can only find a solution to the weak form, no "classical" solution exists.

1.2 Galerkin Approximations


We now have the problem re-stated so that we are looking for u ∈ H01 such
that
Z 1 Z 1
′ ′
(u v + uv) dx = xvdx (6)
0 0

for all v ∈ H01 . In order to narrow down the number of functions we will
consider in our approximate solutions we will make two more assumptions
about H01 . First, we will assume that H01 is a linear space of functions (that
is if v1 , v2 ∈ H01 and a, b are constants then av1 + bv2 ∈ H01 .)
1
The second assumption is that√ H0 is infinite dimensional. For example1 if we
have the sine series ψn (x) = 2sin(nπx) for n = 1, 2, 3, ... and v ∈ H0 then

3
v can be represented by v (x) = ∞
P
R1 n=1 an ψn (x). The scalar coefficients an
are given by an = 0 v (x) ψn (x) dx, just like usual. Hence infinititely many
coefficients an must be found to define v exactly. As in Fourier analysis,
many of these coefficients will be zero. We will also truncate the series in
order to have managable length series, just like in discrete Fourier analysis.
Unlike in Fourier analysis, though the basis functions do not have to be sines
and cosines, much less smooth functions can be used. In fact our set of basis
functions do not even have to be smooth and can contain discontinuities in
the derivatives, but they must be continuous. We will assume that the infinite
series converges so that we can consider only the first N basis functions and
get a good approximation vN of the original test (or trial) function:
XN
v∼
= vN = βi φi (x) (7)
i=1

where φi are as-yet unspecified basis functions. This subspace of functions is


(N )
denoted H0 and is a subspace of H01 . Galerkin’s method consists of finding
(N )
an approximate solution to Eq. 6 in a finite-dimensional subspace H0 of
(1
H0 of admissible functions
PN rather than in the whole space H01 . Now we are
looking for uN = i=1 αi φi (x). The new approximate problem we have is
(N )
to find uN ∈ H0 such that
Z 1 Z 1
(u′N vN

+ uN vN ) dx = xvN dx (8)
0 0

(N )
for all vN ∈ H0 . Since the φi are known (in principle) uN will be completely
determined once the coefficients αi have been found.
In order to find that αn we put N
P PN
i=1 αi φi (x) and i=1 βi φi (x) into Eq. 8.

 hP i hP i 
d N d N
i=1 βi φi (x) dx j=1 αj φi (x) +
 
 hdx
Z 1 i hP i


dx = 0 (9)
PN N
i=1 βi φ i (x) j=1 αj φ i (x) −
0  
 PN
 
x i=1 βi φi (x)

for all N independent sets of βi .


This can be expanded and factored to give

4
XN X
N
Z 1  
 Z 1 
βi φ′j (x) φ′i (x) + φj (x) φi (x) dx αj − xφi (x) dx = 0
i=1 j=1 0 0
(10)
for all N independent sets of βi . The structure of Eq. 10 is easier to see if it
is re-written as
XN  XN 
βi Kij αj − Fi = 0 (11)
i=1 j=1

for all βi . Where


Z 1
R1 
Kij = 0
φ′j (x) φ′i (x) + φj (x) φi (x) dx F = xφi (x) dx (12)
0

and where i, j = 1, ..., N. The N × N matrix of Kij is called the stiffness


matrix and the vector F is the load vector. Since the βi are known Kij and
F can be calculated directly. But the βi were arbitrary so we can choose each
element βi for each
P equation. For the first equation choose β1 = 1 and βn = 0
for n 6= 1. Now N j=1 K1j αj = F1 . Similarly for the second equation choose
β2 = 1 and βn = 0 for n 6= 2 so that N
P
j=1 K2j αj = F2 . In this way we have
chosen N independent equations that can be used to find the PNN unknowns
αi . Moreover the N coefficients αi can be found from αj = j=1 (K −1 )jiFi
where (K −1 )ji are the elements of the inverse of K.
The stiffness matrix K is symmetric for this simple problem, which makes
the computation of the matrix faster since we don’t have to compute all of
the elements, symmetric matricies are also much faster to invert.

1.3 Finite Elements Basis Functions


Now we have done a great deal of work, but it may not seem like we are
much closer to finding a solution to the original ODE since we still know
nothing about φi . The purpose of using such a general formulation is that
any set of linearly independent functions will work to solve the ODE. Now
we are finally going to talk about what kind of functions we will want to use
as basis functions. The finite element method is a general and systematic
technique for constructing basis functions for Galerkin approximations. In

5
FEM the basis functions φi are defined piecewise over subregions. Over any
subdomain the φi will be chosen to be polynomials of low degree, though
other possibilities do exist.

• finite elements are the subregions of the domain over which each basis
function is defined. Hence each basis function has compact support over
an element. Each element has length h. The lengths of the elements
do NOT need to be the same (but generally we will assume that they
are.)

• nodes or nodal points are defined within each element. In Figure 1 the
five nodes are the endpoints of each element (numbered 0 to 4).

• the finite element mesh is the collection of elements and nodal points
that make up the domain and is shown in Figure 1. An element i is
denoted by Ωi .

Now we need to construct the actual basis functions using the three criteria
defined before: 1) The basis functions are simple functions defined piecewise
over the finite element mesh, 2) the basis functions must be in the class of test
functions H01 , and 3) The basis functions are chosen so that the parameters
αi are the values of uN (x) at the nodal points.
The simplest set of basis functions are the “hat functions” on elements i =
1, 2, 3.
 x−xi−1 
 hi
for xi−1 ≤ x ≤ xi 
xi+1 −x
φi (x) = hi+1
for xi ≤ x ≤ xi+1 (13)
 
0 for x < xi−1 , x > xi+1

where hi = xi − xi−1 is the length of element i. The derivatives are


 1 
 hi
for xi−1 ≤ x ≤ xi 
−1
φ′i (x) = hi+1
for xi ≤ x ≤ xi+1 (14)
0 for x < xi−1 , x > xi+1
 

The equations for elements 0 and 4 have been left out since we decided that
u(0) = u(1) = 1, so no basis functions are required. In general the basis
functions for the first and last elements are half of the functions since there

6
is no i−1 or i+1 node, respectively. The hat functions are shown in Figure 2.
The mathematical term for hat functions is piece-wise linear basis functions

Ω1 Ω2 Ω3 Ω4

h1 h2 h3 h4

0 1 2 3 4

Figure 1: Four finite elements on the interval [0 1].

1
1
φ1 φ2 φ3 φ∗1 φ∗2 φ∗3

Ω1 Ω2 Ω3 Ω4 Ω1 Ω2 Ω3 Ω4
0 0

h1 h2 h3 h4 h1 h2 h3 h4

−1
−1
0 1 2 3 4 0 1 2 3 4

Figure 2: Four hat functions (top) and their derivatives (bottom) on the interval [0 1].

Looking at the three criteria above, clearly the functions in Eq. 13 are simple
and defined element-wise. It is easy to show that they are in H01 , since they
have square-integrable first derivatives. They also satisfy the third criteria
since φi (xj ) = 1 if i = j and 0 otherwise. Hence each function contributes to
the value of uN at exactly one node and αi = uN (xi ).
It is less clear that the hat functions will give a continuous representation
of vN and uN . Let v be the sine function with period 2 shown in Figure

7
3. At the nodes (0, 1, 2, 3, 4) sine has the values (0,0.7071,1,0.7071,0).
The representation vN on the finite element mesh is vN = 0.7071φ1 (x) +
φ2 (x) + 0.7071φ3 (x). When the elements are summed up the sine wave
is approximated by piecewise linear functions between each of the nodes,
and is exactly represented at each node. When more nodes are used the
approximation improves and in the limit of N → ∞ the sine wave would be
exactly represented. In FEM we will never proceed all the way to the limit,
so the interval size h will always have finite size h. This is why the term
finite elements is used.

1 vN
sin(pi x)
φ2

0.7071φ1 0.7071φ3

Ω1 Ω2 Ω3 Ω4
0

h1 h2 h3 h4

−1

0 0.5 1 1.5 2 2.5 3 3.5 4

Figure 3: The finite element approximation of sin(πx) using five nodes on the interval
[0 1].

1.4 The Stiffness Matrix K and the Load Vector F for


Hat Functions
Recall from Eq. 12 that each element of the stiffness matrix K is given by
R1 
Kij = 0R φ′i (x) φ′j (x) + φi (x) φj (x) dx
= 4e=1 Ωe φ′i (x) φ′j (x) + φi (x) φj (x) dx
P
(15)
= 4e=1 Kije
P

8
similarly
Z 1 X4 Z X4
Fi = xφi (x)dx = xφi (x)dx = Fie (16)
0 e=1 Ωe e=1

where we have used the property that φ(x) are defined piecewise on each
element 1 through 4. In order to compute an approximation of the solution
to the model ODE it is necessary to compute nine elements for Kij from
i, j = 1, 2, 3 and three elements for F . But since each of the functions φ(x)
are defined in the same way it is possible to compute K e and F e for a generic
element and then to construct the matrix using the sums above. Consider a
generic interior element Ωe on the interval xA to xB . We will use a change
of variables and rewrite this in terms of ξ, a dummy variable for x. We
will have ξ = (0, h). On this element exactly two of the hat functions are
nonzero: ψA (ξ) = 1− hξ and ψB (ξ) = hξ . Convince yourself that this definition
is equivalent to the previous definition of the hat function, but with the origin
shifted to the start of one of the interior elements. The two hat functions
have derivatives ψA′ (ξ) = − h1 and ψB′ (ξ) = h1 .
It is also important to notice that for the hat functions φi (x) 6= 0 on only
the elements Ωi and Ωi+1 . This results in a tridiagonal sparse matrix K for
any number of elements in the mesh as will be shown below. Using Eq. 15
you can see that there are three integrals that contribute to Kij :
Rh
kAA = 0 [ψAe ′ (ξ)]2 + [ψAe (ξ)]2 dξ

Rh
= 0 [1/h]2 + [1 − ξ/h]2 dξ = 1/h + h/3

Rh
kAB = 0 (ψAe ′ (ξ) ψBe ′ (ξ) + ψAe (ξ) ψBe (ξ))dξ
Rh (17)
= 0 ((−1/h) (1/h) + (1 − ξ/h) (ξ/h))dξ = −1/h + h/6
Rh
kBB = 0 [ψBe ′ (ξ)]2 + [ψBe (ξ)]2 dξ

Rh
= 0 [−1/h]2 + [ξ/h]2 dξ = 1/h + h/3


Similarly the components that contribute to the load vector are:


Rh
FAe = 0 (xA + ξ) (1 − ξ/h) dξ = h6 (2xA + xB )
Rh (18)
FBe = 0 (xA + ξ) (ξ/h) dξ = h6 (xA + 2xB )

where the xA and xB terms come from evaluating the forcing function f (x) =
x at the endpoints of the generic element.

9
Thus each generic interior element contributes to the stiffness matrix a 2 × 2
submatrix
 
e 1/h + h/3 −1/h + h/6
k = (19)
−1/h + h/6 1/h + h/3
and two entries to the load vector
 
e 2xA + xB
f = h/6 (20)
xA + 2xB
For the 4 element mesh we have derived the contributions to the overall
stiffness matrix K from each node is given by:

   
1/h + h/3 0 0 1/h + h/3 −1/h + h/6 0
1 2
K =  0 0 0 K = −1/h + h/6 1/h + h/3 0
  
 0 0 0  0  0 0 
0 0 0 0 0 0
K 3 =  0 1/h + h/3 −1/h + h/6  K 4 =  0 0 0 
0 −1/h + h/6 1/h + h/3 0 0 1/h + h/3
(21)
where the contributions from elements 1 and 4 have only one entry because
only half of the hat function exists on these elements. Similarly the contri-
butions to the load vector are
   
2h 2h + 2h
F 1 = h/6  0  F 2 = h/6  h + 4h  (22)
0 0
   
0 0
F 3 = h/6  4h + 3h  F 4 = h/6  0  (23)
2h + 6h 6h + 4h

where h = 0.35 for the model problem. Now K = K 1 + K 2 + K 3 + K 4


and F = F 1 + F 2 + F 3 + F 4 . The final system of equations has symmetric
and diagonally dominant stiffness matrix K, which is very nice to work with
mathematically.
P3 The values of uN at each node is given by α̃ = K −1 F and
uN = i=1 αi φi (x).

10
Using this we get that the approximation to the model problem is u =
0.0353φ1(x) + 0.0569φ2(x) + 0.0505φ3 (x). This is not a very accurate an-
swer, since only four elements were used. A more accurate approximation
can be obtained by using more elements, but at the cost of building and
inverting a larger stiffness matrix K. The usual way of estimating the error
of an FEM approximation using linear basis functions (the hat functions we
derived) using the L2 or mean-square norm is that ||e||0 < C2 h2 . This is an
a-priori error estimate and in general a worst-case scenario, the actual error
may be substantially smaller.

2 General One Dimensional Problems


At this point we will extend the derivation above to include general linear
second-order elliptic ODEs of the form

d2 u (x) du
ao (x) 2
+ a1 (x) + a2 (x) u (x) = f (x) . (24)
dx dx
Recall that this equation is elliptic if ao never changes sign or vanishes, ie
|ao (x)| > γ > 0. We will also focus on two-point boundary-value problems
which are problems where half of the boundary conditions are specified at
each end point.

2.1 Flow Through Porous Media


One example in which elliptic boundary value problems arise in PE is as
one-dimensional flow through porous media. Start by defining the flux σ of
the fluid as σ(x) = −k(x) du
dx
. σ can be a general flux function of any type,
but for porous media flow, u is hydraulic head or pressure, σ is the flow
rate, k is the absolute permeability, f (x) is the fluid source/sink and may
represent wells or a boundary condition with flow across it, such as a constant
flux boundary with an aquifer. In porous media flow we are also implicitly
assuming the additional equation for Darcy’s law holds, that is σ = −ku′ .
The permeability does not have to be constant in this formulation, but may
vary with x.

11
2.2 One-Dimensional Heat-Loss
One example in which elliptic boundary value problems arise in PE is heat
loss from a wellbore. For the moment we can consider only 1D heat loss, but
radial heat loss can be approximated using FEM as well. In heat loss u is
the temperature, σ is the heat flux given by Fourier’s law, f (x) is the heat
source (in this example, the wellbore), and k is the thermal conductivity of
the porous medium.

2.3 Boundary Conditions


The most general boundary conditions that we will consider are

α0 du(0) + β0 u (0) = γ0
dx (25)
αl du(l)
dx
+ βl u (l) = γl

Only the value of u is specified in a Dirichlet Boundary Condition. Only


the value of du(0)
dx
is specified in a Neumann Boundary Condition. The flux
du(0)
−k(0)(− dx ) = σ0 or a linear combination of the flux and u are specified in
a natural boundary condition.
Now we have a general ODE of the form
 
d du (x) du
− k (x) + c (x) + b (x) u (x) = f (x) (26)
dx dx dx
where the second derivative of u has been replaced by the definition of the
flux. This ODE doesn’t necessarily have a second derivative at every single
point in the domain since k(x) may not be continuous. u must have a second
derivative over every smooth sub-domain Ωi , but there may discontinuites at
the boundary between two subdomains. We didn’t worry about the existence
of the second derivative in the model problem in the last section because the
real physical problems we want to solve have the form of Eq. 26, with the
boundary conditions defined in Eq. 25, not the form of Eq. 1.
As before, the ODE is multiplied by the test function v and integrated to
give the variational form of the two-point boundary-value problem on any
smooth domain Ω

12
Z Z
−ku ′
v|xxii−1 + ′ ′ ′
(ku v + cu v + buv) dx − f vdx = 0 (27)
Ω Ωi

If our domain is not smooth we can solve this problem over a series of sub-
domains where the ODE is smooth and sum them. There are three types of
discontinuity that are possible at the edges of the Ω:

• k(x) is discontinuous, f (x) is continuous at x1 . This gives a jump


condition across the boundary of the element, but since k is finite on
both sides of the jump the flux is continuous and [σ (x)] = 0 at the
boundary.
• f (x) is discontinuous, k(x) is continuous at x2 . This gives a jump
condition across the boundary of the element, but as long as f is finite
on both sides of the jump the flux is continuous and [σ (x)] = 0 at the
boundary.
• f (x) is discontinuous at x3 and has a concentrated forcing term given
by the −fˆδ(x − xi ) which is not finite. This gives a jump condition
across the boundary of the element, and the flux is not continuous and
[σ (x)] = fˆ at the boundary.

As a consequence when we sum over all of the elements the variational bound-
ary value problem becomes
Rl
k (0) u′ (0) v (0) − k (l) u′ (l) v (l) + 0 (ku′ v ′ + cu′ v + buv) dx
Rl (28)
+ [σ (x1 )] v (x1 ) + [σ (x2 )] v (x2 ) + [σ (x3 )] v (x3 ) = 0 f vdx
At the points x1 and x2 the jump condition is zero so those terms drop out,
but the jump at x3 is not zero, so we would have to deal with the fˆ term
in the FEM. For the rest of the derivation we will assume that we have no
discontinuites of this type, but it is important to know that even very messy
domains can easily be handled using FEM.
Rewriting Eq. 28 so that the homogeneous ODE is on the left and the forcing
and boundary terms are on the right gives
Rl
0
(ku′ v ′ + cu′ v + buv) dx = −v (0) k (0) [γ0 − β0 u (0)]/α0
Rl (29)
+v (l) k (l) [γl − βl u (l)]/αl + 0 f vdx + fˆv (x3 )

13
2.4 Galerkin Approximation
Exactly as in the first section we are looking for a finite set of basis functions
{φ1 , φ2 , ..., φN } to approximate uN ∈ H (N ) . In this case we are no longer
requiring that our basis functions have the property v(0) = v(l) = 0 because
the ODE is not necessarily zero at the endpoints, and we want to have the
same test and trial functions. The stiffness matrix for Eq. 29 is given by
Z l 
Kij = kφ′i φ′j + cφ′j φi + bφj φi dx (30)
0

where j = i or j = i + 1 are the only nonzero entries. The load vector is


Z l
Fi = f φi (x)dx + −φi (0) k (0) γ0 /α0 + φi (l) k (l) γl /αl (31)
0

where φi (0) = 0 for every element except the first and φi (l) = 0 for every
element except the last. Once again we will be looking only at linear shape
functions, but since we are now using vN that do not have v(0) = v(l) = 0
we are going to re-define the shape functions slightly so that the origin of the
shifted coordinate system is at the center of the element and ξ = −1 at the left
endpoint and ξ = 1 at the right endpoint. Now the two functions defined on a
generic element Ωe are given by ψ̂1 (ξ) = 0.5 (1 − ξ) and ψ̂2 (ξ) = 0.5 (1 + ξ).
This is exactly the same functions employed in the first section, except that
now on the first and last elements the basis functions are no longer zero.
The real purpose of redefining the hat functions in this way is that this
formulation allows for the easy definition of higher-order approximations.
Each element makes a contribution to the stiffness matrix of the form
Z se2
kije kψie ′ (ξ) ψje ′ (ξ) + cψje ′ (ξ) ψie (ξ) + cψie (ξ) ψje (ξ) dξ

= (32)
se1

for j = i ± 1 and contributes to the load vector


Z se2  
fie = fˆψie (ξ) dξ. (33)
se1

Typically the integrals are computed numerically. We are ignoring the bound-
ary conditions and any discontinuities in the data at this point.

14
For linear basis functions each element has two nodes that contribute, so the
first element has two equations of the form

1 1
k11 u1 + k12 u2 = f11
(34)
k21 u1 + k22 u2 = f12
1 1

The ith interior node has two equations of the form

i i
k11 ui−1 + k12 ui = f1i
(35)
k21 ui−1 + k22 ui = f2i
i i

This gives a tridiagonal matrix K and a load vector F such that

1 1
f11
   
k11 k12 0 0
1 1 2
 k21 k22 + k11 2  1 2
k12 0   F =  f22 + f13

K=
 0 2 2 3 N −1  f2 + f1
 (36)
k21 k22 + k11 k12  
0 0 N −1
k21 N −1
k22 f2N −1

Provided that there are no discontinuities in the initial data. (See the book
for how to handle discontinuities.) This formulation isn’t complete because
doesn’t account for any boundary conditions.

2.5 Natural Boundary Conditions


For general natural boundary conditions of the form

α0 du(0) + β0 u (0) = γ0
dx
du(l) (37)
αl dx + βl u (l) = γl

the matrix-vector equation including boundary conditions is

   
1
k11 − k(0)β 1
k12 0 0 f11 − k(0)γ
0
 0
αo u1 αo
1 1 2 2
k21 k22 + k11 k12 0   u2  f21 + f12
   

N −1
= 
0 2
k21 2 3
k22 + k11 k12 u3   f22 + f13
   
  
0 0 N −1
k21 k22 + k(l)β
N −1
αl
l uN−1 N −1
f2 + k(l)γ
αl
l

(38)

15
2.6 Neumann Boundary Conditions
For Neumann Boundary Conditions the equation is identical to Eq.38 with
βo = βl = 0.

2.7 Dirichlet Boundary Conditions


For Dirichlet Boundary conditions the matrix problem reduces to a smaller
problem. Since u(0) and u(l) are both specified we don’t have to solve for
them. The first and last rows do not need to be included in the equation,
but the second and N − 2 row of the load vector must be adjusted so that
the new matrix-vector problem is

k1 γ
 
1 2 2 f21 + f12 − 21βo o
  
k22 + k11 k12 0 0 u2
k 2
k 2
+ k 3
k 3
0   u3
  f22 + f13
   
21 22 11 12 = 
N −2
f23 + f14
 3 3 4
0 k21 k22 + k11 k12   u4  
 
 
N −2 N −2 N −1 N−1
0 0 k21 k22 + k11 uN−2 f2N −2 + f1N −1 −
k12 γl
βl
(39)
Any combination of boundary conditions is also possible, and each boundary
can be set up as described above independently of the other.

3 Higher-Order Approximations
In general it is possible to use any polynomial function to approximate the
function on each element. In practice it is rarely desirable to use much higher
than quadratic basis functions because higher-order functions have too much
oscillation. In order to define basis functions of order n each element must
have n + 1 nodes. The ith shape functions for an nth order approximation
for the basis functions is

(ξ − ξ1 ) (ξ − ξ2 ) . . . (ξ − ξi−1 ) (ξ − ξi+1 ) . . . (ξ − ξn+1)


ψ̂i (ξ) = (40)
(ξi − ξ1 ) (ξi − ξ2 ) . . . (ξi − ξi−1 ) (ξi − ξi+1 ) . . . (ξi − ξn+1 )
Each of these functions is one at the node ξi and zero at ξj for i 6= j, which
implies that they are all linearly independent on the element. There are n+1

16

You might also like