Galerkin's Method G U L : Computation Methods For Nanoengineering
Galerkin's Method G U L : Computation Methods For Nanoengineering
3. Galerkins Method
i 1
We next ask the question: what is the best approximation to u, i.e., how to
determine the coefficients of expansion ui in order to obtain the best
approximate solution ?
u , v uv * d ,
(2) Two functions are said to be orthogonal to each other if their inner product
u, v 0 .
is zero:
(3) The inner product of a function with itself is called the L2-norm of the
function and is written as
u , u u d .
r Lu~ g .
Galerkins method
Galerkins method states that the best approximation for u is the one that
gives the least residual. This can be achieved by minimizing the L2-norm of
the residual,
2
r, r Lu~ g d .
ECE 452/Van
58
~ to g.
or the square of the distance (difference) from g
g~ Lu~ ,
~?
dimension function/vector g by a finite (lower) dimension function/vector g
To answer this question, let us use a simple vector analogy. Suppose
g ax by cz
g ax by cz
r~
g g
ECE 452/Van
~
g ax by
The best approximation to g that we can form using these basis vectors is
~
g ax by ,
59
which is the projection of g onto the basis subspace x-y. This is the
2
approximate vector for which ~
g g is a minimum.
x and y , i.e.,
i x , y .
r , i 0 ,
r , i 0 ,
i = 1, 2, N
Lu~, i g , i ,
i = 1, 2, N.
Lu~ g , i 0 ,
N
u~ u j j ,
Since
j 1
Lu~ u j L j .
j 1
u j L j , i g , i
j 1
or
u j L j , i g , i .
j 1
Kij u j bi
j 1
i = 1, 2, N
(1)
where Kij L j , i
ECE 452/Van
bi g , i .
60
Remarks:
Lu g ,
Lu~ g .
Lu~, wi g , wi ,
There are several common choices for the weighting function wi:
(1) Point collocation method (or point matching method): wi is the delta
function
1, at node i
wi ( x, y ) ( x xi )( y yi )
0, otherwise
1, ( x, y ) i
wi ( x, y )
0, ( x, y ) i
wi ( x, y ) i ( x, y ) .
This choice of the weighting function minimizes the L2-norm of the residual.
a ( x , y ) u g ( x , y )
ECE 452/Van
61
(2) Choose the basis functions: For each node i in the mesh we define a global
basis function i(x, y) with the property
1,
i ( x, y )
0,
at node i, ( xi , yi )
all other nodes
The global basis function i is constructed piecewise from the local basis
functions defined over each triangular element.
(4) Matrix solution: Solve the matrix equation to obtain the FE solution u.
Constructing the basis functions
Leq ( x, y )
(x3, y3)
where
(x1, y1)
1
( aqe x bqe y cqe ) ,
2 Ae
q = 1, 2, 3
aqe yq 1 yq 2 ,
bqe xq 2 xq 1 ,
(x2, y2)
cqe
xq 1
xq 2
yq 1
yq 2
1 xq
1
Ae 1 xq 1
2
1 xq 2
xq 1 yq 2 xq 2 yq 1 ,
yq
yq 1 ,
yq 2
62
The global basis function i for a node i can be constructed from the local
basis functions as follows:
Let i = set of triangles sharing a common vertex at global node i. The global
basis function i associated with node i is
i ei
0,
for ( x, y ) i
The global basis function i is non-zero only over those triangles connected to
global node i, i.e., i specifies the non-zero domain of i.
In the FE method, we first formulate an equation for the local solution over
each element e using Galerkins technique.
Over triangle e, expand the approximate local solution e(x, y) in terms of the
local basis functions Leq
u~e ( x, y )
uqe Leq ( x, y ) .
3
q 1
or
uqe
3
q 1
p = 1, 2, 3,
K epquqe bep ,
3
q 1
b ep g , Lep
ECE 452/Van
gLep d
(1)
Lep (aLeq )d
Eq.(1) may be put in matrix form to obtain the elemental matrix equation for
triangular element e,
63
K e ue = b e
The Ne elemental matrix equations are next assembled into the global system
Ku = b consisting of N equations in N unknowns ui.
The elements Kij and bi of the global system are obtained from the elemental
matrix equations as follows. Consider the computation of the element Kij
given by
Kij L j , i i L j d ,
where L a .
If i and j are not neighbour nodes, then the non-zero domains of i and j do
not overlap (i.e, i and j do not overlap). In this case we have
Kij = 0
If nodes i and j are adjacent to each other, then the integral in (1) is taken
over the region of overlap between the non-zero domains of i and j.
Let
then
We have
Kij
But since
ECE 452/Van
(1)
m
n
ij = i j = {m, n}
i L j d i L j d i L j d .
ij
(2)
64
over m:
over n:
Eq.(2) becomes
Kij
i L p ,
p | T(m, p) = i
i Lnp ,
p | T(n, p) = i
j Lm
q,
q | T(m, q) = j
j Lnq
q | T(n, q) = j
Kij
Kii
K epq ,
eij
K epp ,
ei
bi gi d
bi
bep ,
ei
gi d gLepd ,
ei e
p | T(e, p) = i.
The computation of the local matrix elements K epq involves the integral
Lep (aLeq )d .
(1)
ECE 452/Van
65
( ) 2 ,
Ce
Ce
(2)
where Ce is the perimeter of the triangle and n is the unit vector normal to
the edges. The LHS integral can be regarded as the boundary integral since
its value depends only on the values of u~e on the perimeter of triangle e.
From (2), we have
Ce
(3)
K epq
or
Lep aLeq n d .
Ce
Ce
We shall now show that the line integral around Ce vanishes for an interior
Consider the discrete equation for a global node i, which is obtained from
triangle e.
or
ECE 452/Van
q 1
au~, i g , i
i au~d gid .
(4)
66
The above integrals are over the set i of triangles connected to node i.
Suppose e is an interior triangle having a vertex at node i. Over this
triangle, the LHS integral in (4) is
^
n
ij
q q
^
n
e
jk
Lep au~e n d
Ce
(5)
ik
k
The line integral around Ce can be decomposed into a sum of integrals along
the edges of the triangle. For edge ij shared by adjacent triangles e and m,
we have
ij
ij
~ ~
are opposite
since Lep Lm
p and ue um on edge ij but the normal vectors n
to each other. Thus the contribution from the boundary integral of triangle e
along edge ij in (4) is cancelled by the contribution from the boundary
integral of adjacent triangle m along the same edge. The same relationship
also holds for the line integral along edge ik of triangle e. On edge jk the
line integral in (5) is 0 since Lep 0 . Thus for an interior triangle we have
effectively,
Lepau~e n d 0 .
ECE 452/Van
Ce
67
(6)
The above integral can be evaluated exactly if a is constant. Since Lep and
Leq are linear triangular basis functions, their gradients are given by:
Lep
Leq
1
(a ep x b ep y ) ,
2 Ae
1
(aqe x bqe y ) .
2 Ae
K epq
4 Ae2
e
Boundary conditions
Neumann: au n is specified on a
i
p
a
j
ECE 452/Van
68
Lep , au~e
Lep au~e n d
Ce
(1)
g , Lep .
Since the line integral around Ce vanishes along interior edges of the triangle,
only the contribution along edge a remains:
Lep , au~e
Lepau~e n d
g , Lep .
(2)
Lepau~e n d 0 ,
(3)
3
Expand u~e in terms of the local basis functions, u~e uqe Leq , and substitute
q 1
K epquqe bep
3
q 1
bep g , Leq
gLeqd .
69
case. For this reason, homogeneous Neumann BCs are sometimes called
natural boundary conditions of the FE method.
au n Q hu .
Substituting the above expression into the line integral in Eq. (2), we get
Lep , au~e
Lep , au~e
Lep (Q hu~e )d
Lep hu~ed
or
q 1
LepQd .
q 1
K epquqe bep
q 1
q 1
bep g , Lep
g , Lep
g , Lep ,
g , Lep
LepQd
Lep hLeqd ,
LepQd .
A simple approach for imposing Dirichlet BCs in the global matrix equation
is called the large number method. In this technique the matrix K is first
constructed to include all nodes in the computational domain, treating
ECE 452/Van
Suppose node i is a Dirichlet node with specified value ui = Di. The general
equation for node i is
70
Kiju j bi ,
or
Kii ui
Kiju j bi .
j i
To force ui to have the value Di in the matrix solution, we set the diagonal
element Kii to be a very large number, such as 1020, and set bi = 10 Di, so that
20
1020 ui
Kiju j 1020 Di .
j i
If all the other elements in row i are much smaller than 1020, the above
equation will result in a matrix solution with ui = Di.
Gaussian quadratures
evaluating the elements K epq of the local stiffness matrix when a is not a
constant:
a ep a qe b ep bqe
e
e
e
K pq L p aLq d
a ( x, y )dxdy .
4 Ae2
e
e
(1)
n
f ( x, y )dxdy f ( L1, L2 , L3 )dxdy Ae wi f ( Li1, Li 2 , Li3 ) O(h )
i 1
(Li1, Li2, Li3) are the barycentric coordinates of the sampling points i,
wi are the weighting factors.
ECE 452/Van
71
sampling point
(Li1,Li2,Li3)
should be avoided.
13 , 13 , 13
12 ,0, 12
3
2
one sampling point
12 , 12 ,0
0, 12 , 12
e
ECE 452/Van
72
The above formula gives exact integration for linear functions f(x, y).
Example:
Ae
1 1 1
.
Lq ( x, y )dxdy Ae Lq ( 3 , 3 , 3 )
3
3
1
1 1
1
1
1 1
f ( x, y )dxdy 3 Ae f (0, 2 , 2 ) f ( 2 ,0, 2 ) f ( 2 , 2 ,0) O(h ) .
The above formula gives exact integration for linear and quadratic functions.
As an example, consider the following inner products
L1 , L1 L12 ( x, y )dxdy
e
L1, L2 L1 ( x, y ) L2 ( x, y )dxdy .
e
2
2
2 1
2 1 1
1
1 1
1
L1 ( x, y )dxdy 3 Ae L1 (0, 2 , 2 ) L1 ( 2 ,0, 2 ) L1 ( 2 , 2 ,0)
2
2
1 Ae 0 1 1 1 Ae .
3
2
2 6
1
1 1
1 1
1
1
1
1
L1L2dxdy 3 Ae L1 (0, 2 , 2 ) L2 (0, 2 , 2 ) L1( 2 ,0, 2 ) L2 ( 2 ,0, 2 )
1 Ae 0 1 1 0 1 1 1 Ae .
3
2 2
12
1 Ae , p q
.
L p Lq d 61
e
12 Ae , p q
The above example shows that the basis functions Lp and Lq are not
orthogonal to each other.
ECE 452/Van
73