0% found this document useful (0 votes)
43 views

Galerkin's Method G U L : Computation Methods For Nanoengineering

Galerkin's method is used to solve partial differential equations (PDEs) by approximating the solution as a linear combination of basis functions. It states that the best approximation minimizes the residual between the approximate and exact solutions. To apply Galerkin's method: (1) the domain is divided into finite elements and basis functions are defined on each element; (2) the residual is set to orthogonal to each basis function to derive the matrix equation; (3) the global matrix equation is assembled from the elemental equations and solved to obtain the approximate solution.

Uploaded by

mahmoud
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Galerkin's Method G U L : Computation Methods For Nanoengineering

Galerkin's method is used to solve partial differential equations (PDEs) by approximating the solution as a linear combination of basis functions. It states that the best approximation minimizes the residual between the approximate and exact solutions. To apply Galerkin's method: (1) the domain is divided into finite elements and basis functions are defined on each element; (2) the residual is set to orthogonal to each basis function to derive the matrix equation; (3) the global matrix equation is assembled from the elemental equations and solved to obtain the approximate solution.

Uploaded by

mahmoud
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Computation Methods for Nanoengineering

3. Galerkins Method

Consider the PDE Lu g defined over some domain . We approximate the


solution by the basis function expansion
N
u~ ui i .

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 ?

Before answering this question, we introduce the following definitions:

(1) The inner product of two functions u and v is defined as

u , v uv * d ,

where is the domain of u and v.

(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 .

(4) If is an approximate solution to the PDE Lu g , the residual of the


approximation is defined as

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 .

~ Lu~ , then we want to minimize


If we let g
2
g~ g g~ g d ,

ECE 452/Van

58

Computation Methods for Nanoengineering

~ to g.
or the square of the distance (difference) from g

Since g Lu is defined at an infinite number of points within , we can


regard g as a vector with infinite degrees of freedom or dimensions.
On the other hand, we have

g~ Lu~ ,

where is defined only at N points within via


N
u~ ui i .
i 1

~ is also defined only at N points in and can be regarded as a vector


Thus g

with (finite) N degrees of freedom or dimensions.

The question is what is the best way to approximate an infinite (higher)

~?
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

is the exact solution vector, which is a 3D vector.

Suppose also that we have only N = 2 basis vectors, i x , y , with which to


construct the approximate vector ~
g . These basis vectors span the 2D x-y
plane.

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

Computation Methods for Nanoengineering

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.

Note that the residual vector r ~


g g is orthogonal to both basis vectors

x and y , i.e.,

i x , y .

r , i 0 ,

In Galerkins method, to minimize the residual function r Lu~ g , we


require that r be orthogonal to all basis functions i of :
or

r , i 0 ,

i = 1, 2, N

Lu~, i g , i ,

i = 1, 2, N.

Lu~ g , i 0 ,

The minimum residual function is obtained by projecting g onto the subspace


spanned by the basis functions i in which g~ is defined.

N
u~ u j j ,

Since

j 1

Lu~ u j L j .
j 1

Galerkins method gives


N

u j L j , i g , i

j 1

or

u j L j , i g , i .

j 1

The above equation can be expressed as


N

Kij u j bi

j 1

i = 1, 2, N

(1)

where Kij L j , i

ECE 452/Van

bi g , i .

We can write (1) in matrix form as


Ku = b

60

Computation Methods for Nanoengineering

where K = N N matrix called the global stiffness matrix


b = N 1 vector called the global load vector

Remarks:

Galerkins method actually belongs to a more general class of techniques


called the Methods of Weighted Residual. In general, given a PDE

Lu g ,

A classical solution to the PDE is one that satisfies exactly

Lu~ g .

A weak solution to the PDE satisfies

Lu~, wi g , wi ,

where wi is a weighting function (or test function).

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

(2) Subdomain collocation method: wi is a uniform function over each


subdomain i,

1, ( x, y ) i
wi ( x, y )
0, ( x, y ) i

(3) Galerkins method: wi is the same as the basis functions,

wi ( x, y ) i ( x, y ) .

This choice of the weighting function minimizes the L2-norm of the residual.

4. Finite Element Analysis in 2D

Consider the electrostatic Boundary Value Problem

a ( x , y ) u g ( x , y )

defined over a domain , with boundary conditions that may be a


combination of Dirichlet, Neumann and Cauchy (mixed) types.

ECE 452/Van

61

Computation Methods for Nanoengineering

We seek a FE solution to the above problem using Galerkins method and

The solution procedure consists of the following main steps:

linear bases on triangular elements.

(1) Mesh generation: The solution domain is decomposed into Ne triangular


elements and N nodes. The resulting triangular mesh is specified by
arrays T and P.

(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.

(3) Formulate the matrix equation: Apply Galerkins method to each

triangular element to form the elemental equation. Assemble the


elemental equations to form the global matrix equation Ku = b.

(4) Matrix solution: Solve the matrix equation to obtain the FE solution u.
Constructing the basis functions

For each triangular element e, we express the local basis functions

associated with local node q in terms of the barycentric coordinate Leq :

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

with {q, q+1, q+2} forming a set of cyclic modulo-3 integers.


ECE 452/Van

62

Computation Methods for Nanoengineering

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

Le , for ( x, y ) and q such that T ( e, q ) i


q
i

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.

Constructing the elemental matrix equation

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

Apply Galerkins method over each triangle to get

Lu~e , Lep g , Lep ,

or

uqe
3

q 1

p = 1, 2, 3,

L{Leq }, Lep g , Lep ,

K epquqe bep ,
3

q 1

where K epq L{Leq }, Lep aLeq , Lep

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

Computation Methods for Nanoengineering

K e ue = b e

where Ke = 33 matrix called the local stiffness matrix


be = 31 vector called the local load vector

Assembling the global matrix equation

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

(i and j are not neighbour nodes)

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

ij = i j be the intersection of i and j

ij = {m, n} is the overlap of the non-zero domains of i and j.

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

Computation Methods for Nanoengineering

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

Lmp L{Lmq}d Lnp L{Lnq }d K mpq K npq .

In general, we can write

Kij

Kii

K epq ,

eij

K epp ,

i j are neighbour nodes


i = j.

ei

Similarly, for the load vector bi we have

bi gi d

bi

(i.e., p of m maps into i)

bep ,

ei

gi d gLepd ,
ei e

p | T(e, p) = i.

The method of integration by parts

The computation of the local matrix elements K epq involves the integral

K epq L{Leq }, Lep

Lep (aLeq )d .

It is convenient to evaluate the above integral by the method of integration


by parts. Integration by parts also allows us to incorporate boundary

conditions that may be specified along an edge of a boundary triangle.

Consider Galerkins formulation of the local solution u~e over triangle e,

au~e , Lep g , Lep

(1)

From the identity for two functions and

ECE 452/Van

65

Computation Methods for Nanoengineering

( ) 2 ,

substitute Lep and au~e to get

( Lep au~e ) Lep au~e Lep (au~e ) .

Integrate both sides over triangle e:

( Lepau~e )d Lep au~ed Lep (au~e )d .

Ce

Apply the divergence theorem to the integral on the LHS to get

Lepau~e n d Lep au~ed Lep (au~e )d ,


e

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

Lep (au~e )d Lep au~ed Lepau~e n d .

Ce

(3)

Substituting u~e uqe Leq into the above equation, we get

K epq
or

Lep (aLeq )d Lep aLeqd Lep aLeq n d

K epq Lep , aLeq

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

Computation Methods for Nanoengineering

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

Lep au~ed Lep , au~e

^
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

Lep au~e n d Lmpau~m n d

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

Eq. (3) becomes simply

au~e , Lep Lep , au~e ,

67

Computation Methods for Nanoengineering

which, upon replacing u~e by Leq , gives

K epq Lep , aLeq Lep aLeq d .

(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

The integral in (6) can be directly evaluated to give

K epq

(a ep aqe bepbqe )d 4 Ae (a ep aqe bepbqe ) .


a

4 Ae2
e

If a is not a constant, one can evaluate the integral approximately using

Boundary conditions

numerical integration formulas (e.g., Gaussian quadratures).

If triangle e is a boundary element, we have the following common types of

boundary conditions that may be specified on boundary edge a of triangle e:


Dirichlet: u is specified on a

Neumann: au n is specified on a

Mixed type: au n hu Q is specified on a.

i
p

a
j

ECE 452/Van

68

Computation Methods for Nanoengineering

To obtain the elemental equation for triangle e, we start with Galerkins


formulation of the weak solution over e:

au~e , Lep g , Lep

Perform integration by parts to get

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)

We now consider each type of BC that may be specified on a.

In this case we have,

(1) Homogeneous Neumann BC: au n 0 on a

Lepau~e n d 0 ,

so Eq.(2) becomes simply

Lep , au~e g , Lep .

(3)
3

Expand u~e in terms of the local basis functions, u~e uqe Leq , and substitute
q 1

into (3) to obtain

K epquqe bep
3

q 1

where K epq Lep , aLeq Lep aLeq d

bep g , Leq

gLeqd .

Thus the elemental equation for a boundary element with homogeneous


Neumann BC specified on its edge(s) is the same as the equation for an

interior element. The boundary conditions are automatically satisfied in this


ECE 452/Van

69

Computation Methods for Nanoengineering

case. For this reason, homogeneous Neumann BCs are sometimes called
natural boundary conditions of the FE method.

(2) Cauchy BC: au n hu Q specified on a

Note that this case includes inhomogenous Neumann BC where h = 0.


Rewrite the boundary condition as

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

uqe Lep , aLeq

LepQd .

q 1

K epquqe bep

uqe Lep hLeqd


3

q 1

q 1

where K epq Lep , aLeq

bep g , Lep

g , Lep

Substituting u~e uqe Leq into the above equation, we get

g , Lep ,

g , Lep

LepQd

Lep hLeqd ,

LepQd .

(3) Dirichlet BC: u = h(x,y) on a

If u is specified on a then ui and uj are known. The discrete equations for


nodes i and j are simply ui = h(xi, yi) and uj = h(xj , yj).

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

Dirichlet nodes as unknown nodes.

Suppose node i is a Dirichlet node with specified value ui = Di. The general
equation for node i is

70

Computation Methods for Nanoengineering

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

the equation for node i becomes

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

Gaussian quadratures are formulas for approximating integrals of

polynomials over a triangular element. These formulas are useful for

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)

Over a triangle e, the integral of a polynomial of degree p is approximated by


a sum of weighted values of the function at certain sampling points on the
triangle:

n
f ( x, y )dxdy f ( L1, L2 , L3 )dxdy Ae wi f ( Li1, Li 2 , Li3 ) O(h )

where f(x, y) is a polynomial of degree p,

i 1

m is the number of sampling points,

(Li1, Li2, Li3) are the barycentric coordinates of the sampling points i,
wi are the weighting factors.

ECE 452/Van

71

Computation Methods for Nanoengineering

sampling point
(Li1,Li2,Li3)

The error of the approximation depends on the size of the triangle. It is

expressed as an nth-power of h, where h is the diameter of the circumscribing


circle. Thus in general, elongated triangles tend to have larger errors and

should be avoided.

For a given number of sampling points m, Gaussian quadratures give exact


integration for polynomials up to a certain degree. For example, exact
integration is obtained for the following quadratures:

m = 1 sampling point: exact integration for polynomials of degree p 1

m = 3 sampling points: exact integration for polynomials of degree p 2


m = 4 sampling points: exact integration for polynomials of degree p 3

m = 7 sampling points: exact integration for polynomials of degree p 4.

13 , 13 , 13

12 ,0, 12
3

2
one sampling point

12 , 12 ,0
0, 12 , 12

three sampling points

The following are some commonly used quadratures:

(1) Quadrature using 1 sampling point: m = 1, L1 = L2 = L3 = 1/3, w = 1.


2
1 1 1
f ( x, y )dxdy Ae f ( 3 , 3 , 3 ) O (h ) .

e
ECE 452/Van

72

Computation Methods for Nanoengineering

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

The above result is exact since Lq is a linear function.

(2) Quadrature using 3 sampling points: m = 3, w1 = w2 = w3 = 1/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

Applying the above formula to the first inner product we have

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

For the second inner product we have

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

In general, we can write

2 2

L1( 12 , 12 ,0) L2 ( 12 , 12 ,0)

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

You might also like