me471s03_lec05

7

Click here to load reader

Upload: hasen-bebba

Post on 01-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: me471s03_lec05

8/9/2019 me471s03_lec05

http://slidepdf.com/reader/full/me471s03lec05 1/7

Problems in Two Spacial Dimensions

Diffusion, Laplace and Poisson EquationsSolution Using Linear and Bilinear Finite Elements

Let’s recall the diffusion equation governing, for example, transient problems in heat transfer. If u(x, y, t) is the temperature in a 2d conducting body (e.g. a thin plate with insulated faces) occupyinga region  D  of the x, y-plane, then

ρc∂u

∂t  =

  ∂ 

∂x(kx

∂u

∂x) +

  ∂ 

∂y(ky

∂u

∂y) + Q(x, y, t),   (x, y) ∈ D, t > 0

where ρ, c, kx, ky  are the density, specific heat, and conductivities in the two coordinate directionsrespectively, and  Q  is the given rate of heat generation in  D. On the surface of the body (edge of the thin conducting plate), denoted by ∂D, a variety conditions can be specified. We’ll consider thefollowing fairly general case: We assume that ∂D  = ∪3

j=1∂Dj   with  ∂Dj   three disjoint regions andrequire that u  =  g1(x, y, t) on ∂ D1, q n =  g2(x,y,t) on ∂ D2, and q n − hu =  g3(x, y, t) on ∂ D3, wheregj, h are given functions, and  q n = −nxkx∂u/∂x− nyky∂u/∂y  is the heat flux in the direction of theexterior normal vector, (nx, ny) to ∂ D.  In addition to these boundary conditions, we give the initial

condition u(x,y, 0) =  g0(x, y),   (x, y) ∈ D, where g0  is the given initial temperature in the body.

We will begin by looking at steady state problems with  kx   =  ky   =  k   =constant. Setting  Q/k   =f (x, y) we see that the temperature satisfies the Poisson equation −∆u =  f   or

−(∂ 2u

∂x2 +

 ∂ 2u

∂y2) =  f.

If no heat is generated within the body, the temperature satisfies the Laplace equation ∆u   = 0.A large number of other physical problems turn out to be governed by the Laplace or Poissonequation (e.g., potential flow problems in fluid mechanics, displacement of a membrane in elasticity,electrostatic potential in electromagnetic theory, to name a few). As in the case of an ODE, westart with the partial differential equation (PDE), develop the weak form, decide on a space of functions in which to represent the approximate solution (we’ll again choose continuous, piecewiselinear functions – this time on triangles instead of intervals). Using Galerkin’s method this will leadus to a numerical method of solution.

Before we begin, it is probably wise to review the statement of the divergence theorem (in 2D),because we will use it in obtaining the weak form. In 1D this theorem will be familiar as thefundamental theorem of calculus, i.e., that if a real valued function  f   is defined, continuous, and

has a continuous derivative  f  on an interval [a, b], then ba

 f (x) dx  =  f (b) − f (a). Note that theintegral involves values of the function on the boundary of its interval of definition. To generalize totwo dimensions, we need to consider functions defined on sets in  R

2. The sets we will consider willalways be geometrically simple — triangles, rectangles, ellipses, etc. possibly having holes which arethemselves triangles, rectangles, ellipses.

First, let’s recall that a smooth curve in 2d is defined as a map  X  : R → R2 X (t) = (x(t), y(t)),   0 ≤

t ≤

   with the component functions differentiable, and   X 

= 0.   The points   X (0) and   X () are

called the initial and final ends of the curve. If   X (0) =   X () the curve is closed otherwise it’sopen. For example, the equations   x   =   t, y   =   t2,   0 ≤   t ≤  1 define an open curve (a parabola),while x  =  r cos(t), y  =  r sin(t),   0 ≤  t ≤  2π  define a closed curve (a circle of radius  r). We won’tdistinguish between the set of points  C  = {X (t) : 0 ≤ t ≤ }  and the curve  X . If  f   :  D ⊂  R

2 →  R

is a function whose domain includes  C , we define the integral of  f  along  C  (from the initial end to

1

Page 2: me471s03_lec05

8/9/2019 me471s03_lec05

http://slidepdf.com/reader/full/me471s03lec05 2/7

the final end) by  C 

f ds  =

   0

f (X (t))X (t) dt.

The integral  −C  f ds   is defined by the right hand side above with the limits of integration in-

terchanged and represents the integral along   C   from the final end to the initial end. Clearly, −C 

 f ds   = −  C 

 f ds.   It is often convenient to replace   t   as the parameter along the curve by

s   = s(t) = t0 X (τ ) dτ . The function s   represents distance along the curve measured from

X (0), and since s = 0 we can always solve   s   = s(t) for   t   =   t(s). (For our examples, the circlehas the distance function   s   = s(t) =   rt   (i.e., the arc length), while in the case of the parabola

s  = s(t) = t0

√ 1 + 4τ 2 dτ   = [ln(2t +

√ 4t2 + 1) + 2t

√ 4t2 + 1]/4.) With distance along  C   as the

parameter, the line integral takes the simpler form

 C 

f ds  =

   L0

f (X (s))ds

where L  =  s() is the length of  C , and we use the notational abuse  X (t(s)) =  X (s).

Let’s denote a geometrically simple region of interest by  D  and its boundary curve by  ∂ D. (Tech-nically, D  is a connected open set, and in fact, for all our applications is the interior of a polygon.)The boundary curve will always be closed and piecewise smooth, i.e., it will consist of one or severalpieces each of which is a smooth curve as described above with the final end of the last piece equal tothe initial end of the first. For simplicity, we’ll treat ∂D as if it has only one piece and use distance salong the curve as the parameter:   X  = (x(s), y(s)), 0 ≤ s ≤ L. We assume that as one travels along∂D  in the direction of increasing  s,  D  lies to the left. In particular, at each point of the boundarycurve (with the exception of possible corner points when is more than one piece) there is unit atangent vector,   X (s) = (x(s), y(s)), and a normal vector  n(s) = (y, −x) obtained by rotatingX (s) by 90◦ in the clockwise direction (n  points out of  D).

Suppose that on the region D  there is defined a vector function    f  = (f x, f y) where both componentsf j , j  =  x, y  have continuous first partial derivatives on  D, then the divergence theorem states that

 D

∇ ·   f dA = ∂D

n ·   f ds,

where ∇·  f  = ∂f x/∂x + ∂f y/∂y  and  n ·  f  = nxf x + nyf y. Note that the left hand side is a 2d integral

and the right hand side is a 1d integral. (Of course, the integral of the scalar function  g  = n ·   f   isdefined as in the discussion above.)

It may be worth while to derive the divergence theorem in the simple case of a rectangle   D   =(a, b) × (c, d). In this case,  ∂ D = ∪4

j=1∂Dj  with,  ∂ D1  described by x  =  s − a, y =  c,   0 ≤ s ≤ b − a,∂D2  by x  =  b, y =  s − c,   0 ≤ s ≤ d − c,  etc.. Then

 D

 ∂f x/∂xdA   = dc

  f x(x, y)|x=bx=a dy  = dc

  f x(b, y) dy −  dc

  f x(a, y) dy = ∂D2

f x ds −  ∂D4

f x ds,

 D

 ∂f y/∂y dA   =  ba

 f y(x, y)|y=dy=c dx  =  b

a

 f y(x, d) dx−  

b

a

 f y(x, c) dx =  ∂D3

f y ds−  ∂D1

f y ds,

where, for example, we have used ∂D4

f x ds = d−c0

  f x(a, d − s) ds = dc

  f x(a, y) dy. Adding the twoequations above and noting, for example, that on the side  x  =  b, c ≤ y ≤ d  the outer normal is inthe positive x-direction so that n ·   f  = f x  while on x  =  a, c ≤ y ≤ d   the outer normal is oppositelydirected so that n ·   f  = −f x.

2

Page 3: me471s03_lec05

8/9/2019 me471s03_lec05

http://slidepdf.com/reader/full/me471s03lec05 3/7

A second concept we need to discuss before embarking on 2d finite element methods is the use of continuous, piecewise linear interpolation of functions of two variables on triangles and on triangu-lated domains. This is the generalization to 2d piecewise linear interpolation of functions of a singlevariable on intervals.

First, lets describe a triangulation of a domain  D. We will always approximate  ∂ D  by a collectionof straight line segments. Thus, we can always assume that  D  is a polygon. A subdivision of  D  is afinite collections of sets  T j ,  j  = 1, . . . , nt   such that  T i ∩ T j  = ∅ and ∪T j  =  D. A triangulation of apolygonal  D  is a subdivision of  D  consisting of triangles and having the property that no vertex of any triangle lies in the interior of an edge of another triangle.

Now, suppose we have a triangulation of  D  and a function  f (x, y) defined on  D . Let  P i  = (xi, yi),i = 1, . . . , N   be the vertices of the triangles in the triangulation, and  f i  =  f (P i) the values of  f   atthese points. On each triangle T j  we define a linear function  Lj(x, y) =  ajx + bjy + cj  by requiringLj(P k) =  f k  at each vertex of  T j . These three equations completely determine the three coefficientsof  Lj . In addition, the function L(x, y) which equals  Lj  on  T j  is continuous on the entire polygonaldomain D. This continuity is clear on individual triangles. It also holds on the edges because alonga common edge of two triangles we have a linear function of one variable (say distance along theedge) and this is uniquely determined by the values f j  at the end points. We will provide more detailon efficient computing of the continuous piecewise linear interpolant of a data set in what follows.

Now I’ll describe the model problem to be used in illustrating the formulation of the weak form, andsubsequent development of the 2D finite element method. Suppose that f  is a given function, andD  is a given region of the  x, y–plane with boundary ∂ D. Consider the problem of determining thesolution u(x, y) of the partial differential equation

∂ 2u

∂x2 +

 ∂ 2u

∂y2  = −f,   (x, y) ∈ D,

which satisfies the boundary conditions

u =  p,   (x, y) ∈ ∂D p, nx∂u

∂x +  ny

∂u

∂y  = q,   (x, y) ∈ ∂Dq,

where p,q,  are given functions,  ∂D p, ∂Dq, are curves which together compose  ∂D, and (nx, ny) isthe unit exterior normal to the boundary.

We assume that the basic domain is triangulated, divided into  ne  triangles which meet one anotheronly along their edges and are such that no vertex of any triangle is an interior point of the edgeof another triangle. The vertices of the triangles are called (global) nodes (labeled (xk, yk),   k   =1, . . . , n), and the triangles themselves are called elements. We denote the vertices of a typicalelement ∆e   by (xe1, ye1), (xe2, ye2), (xe3, ye3). 1,2,3 are called the local node numbers of element  e  =1, . . . , ne. Local node 1 is chosen arbitrarily, the remaining nodes are labeled in sequence as theboundary is traversed in the counterclockwise direction. The relation between local and globalnodes is provided by the configuration matrix n(e, j), e = 1, . . . , ne, j  = 1, 2, 3, where  n(e, j) is theglobal node number corresponding to local node  j  of element e.

We begin to develop our numerical method by finding the weak form of the model equation. Toobtain this form, we define the residual

r = −

∂ 2u

∂x2 +

 ∂ 2u

∂y2

− f,

3

Page 4: me471s03_lec05

8/9/2019 me471s03_lec05

http://slidepdf.com/reader/full/me471s03lec05 4/7

and note that if  u  is a solution of the differential equation, and  w  is an arbitrary function possessingfirst partial derivatives and vanishing of  ∂ D p  then

 D

rwdA = 0.

Noting that

−w

∂ 2u

∂x2 +

 ∂ 2u

∂y2

= −∇· (w∇u) + ∇w · ∇u,

and using the divergence theorem (i.e. R

(∂M ∂x

 + ∂N ∂y

 ) dA = ∂R

(Mnx+N ny) ds) applied to (M, N ) =

(w∂u/∂x, w∂u/∂y) and the region  R  =  D  we find

 D

(∂u

∂x

∂w

∂x  +

 ∂ u

∂y

∂w

∂y ) dA =

 D

fwdA +

 ∂Dq

(nx∂u

∂x +  ny

∂u

∂y)w ds,

where since  w  = 0 on  ∂ D p  the last integral above is only over the portion  ∂Dq   over the boundarytraversed in the counterclockwise direction (ds  is the length element along the boundary). We call

this last equation the weak form of the partial differential equation. Note that B(u) =  nx

∂u

∂x +ny∂u

∂y   =q (x, y) is given on the boundary  ∂ Dq  so that the right hand side can be computed in terms of givenfunctions. If  u   is a smooth function taking the values  u  =  p  on  ∂D p, and the function  u  satisfiesthe weak form for every  w  which vanishes on  ∂ D p, then by reversing the integration by parts it willfollow that  u   satisfies the differential equation in  D  and its normal derivative takes the value  q  onthe portion  ∂ Dq  of the boundary.

We will use the weak form as our starting place for finding approximate solutions (also called trialfunctions). In general, I’ll denote the approximation by the same letter as the exact one (althoughthis is not, in general, considered a good practice). The only type of approximation we consider forthe present is constructed by triangulating the domain, letting  uj   j  = 1, . . . , n denote the values of the solution at the vertices of the triangles (these are the numbers that we’ll actually compute!) andusing piecewise linear interpolation on the triangles to define the trial function  u(x, y) on the entiretriangulated domain. We can give an explicit representation of  u  on any triangular element ∆e  as

follows: We define the three linear functions (element shape functions)  H ei (x, y) =  aeix + beiy +  ceion ∆e   by requiring that  H ei (xej , yej ) =  δ ij , i.e.,  H ei   equals 1 at local node   i  and 0 at the other twonodes of ∆e. As we mentioned above, for each fixed   i  these three conditions determine the threecoefficients aei , bei , cei  uniquely, i.e., we have the equations

xe1   ye1   1

xe2   ye2   1xe3   ye3   1

aei

beicei

=

δ i1

δ i2δ i3

, i = 1, 2, 3.

The solutions of these equations can be written as:

H ei   =  1

2Ae

[(xejyek − xekyej ) + (yej − yek)x + (xek − xej)y],

where Ae  is the area of ∆e, and (i,j,k) take the values (1,2,3), (2,3,1) and (3,1,2). The formula forthe shape function can be pictured as follows:

4

Page 5: me471s03_lec05

8/9/2019 me471s03_lec05

http://slidepdf.com/reader/full/me471s03lec05 5/7

P

P2

P3

P1

 

A2

A3

A1

 

The point  P   = (x, y) in the element defines 3 sub-triangles   Aej , j   = 1, 2, 3, where  Ae

j   is oppositeto   P j   = (xej , yej ) and   H ej   =   Ae

j/Ae.   The   H ej , as mentioned above, are called the element shapefunctions, and in terms of these shape functions, the trial solution in the element may be expressedas u(x, y) =  ue1H e1(x, y) + ue2H e2(x, y) + ue3H e3(x, y), or

u = ( H e1(x, y)   H e2(x, y)   H e3(x, y) )

ue1

u32u33

,

where uej  is the value of the trial solution at the local node  j.  (Of course, the  uej  are related to the

global nodal values  ui  via the connectivity matrix, i.e.,  uej  = un(e,j)).

The global interpolant is obtained by piecing together the element interpolation functions. Thisinterpolant may be expressed in the same way as the one dimensional case,  u(x, y) =

ni=1 φi(x, y)ui,

or

u = ( φ1   · · ·   φn )

u1...

un

,

where each  φi   is defined in terms of  H ej   as follows: Let K i  be the set of element numbers definedby  K i   = {e   :  n(e, j) =   i, j ∈ {1, 2, 3}}, and  Di   = ∪e∈K i∆e  be the union of all triangles ∆e   suchthat node i  equals  n(e, 1), n(e, 2) or  n(e, 3).  Then φi  vanishes outside of  Di  and if  n(e, j) =  i, thenφi|∆e

 = H ej , where φi|∆e denotes φi  restricted to ∆e. The  φi  are the two dimensional versions of the

‘tent functions’ we used in solving ODE’s. The graphs of these new functions are truly tents in 3Dsense, i.e., the base of the tent with apex above the point  P i  is the union of the triangular domainshaving  P i   as a vertex. The tent itself rises to unit height above P i, and the walls of the tent arecomposed of triangular plane surfaces.

We are now in a position to find the algebraic equations which determine the nodal values of  u. Asour test functions  w  we take the same  φi  described above omitting those  i  which lie on  ∂ D p  (sincew = 0 is imposed here). In this way we have the same number of test functions  w  =  φi  as unknownvalues of  u.  To make the algebra easier we actually ignore this restriction on  w  – i.e., we use every

φi  and then throw out the extra equations at the end. Substituting the test and trial functions intothe weak form gives

nj=1

 D

(∂φi

∂x

∂φj

∂x  +

 ∂ φi∂y

∂φj

∂y  ) dA

uj  =

 D

f φi dA +

 ∂Dq

qφi ds, i = 1, . . . , n

5

Page 6: me471s03_lec05

8/9/2019 me471s03_lec05

http://slidepdf.com/reader/full/me471s03lec05 6/7

The integrals on the left hand side form the elements of the global  n × n stiffness matrix K  = [K ij].If we introduce the n × 1 column vector Φ = [φ1  φ2  · · ·   φn]T , we can express  K  in the form

K  =

 D

∂ Φ

∂x

∂ ΦT 

∂x  +

 ∂ Φ

∂y

∂ ΦT 

∂y

 dA.

Letting F   denote the  n × 1 vector

F  =

 D

f Φ dA +

 ∂Dq

q Φ ds,

and  U   = [u1   u2   · · ·   un]T , we have the formal system of linear equations  KU   =  F   whose solutionprovides the unknown values of the trial function at the nodes. The system is only formal, since wehave not taken into account the known values of  uj  on the  ∂ D p.  This is easy to do. If  uj   is known,we set the jth row K j∗  equal to zero and then set K jj  = 1. Finally, we set F j  = uj . Obviously, thesesimple changes will enforce the required condition. (If desired, the symmetry of  K  can be retainedif we also set the  j th column  K ∗j  equal to zero – of course, with the exception of  K jj  = 1.)

As in the case of one dimensional problems, we don’t need to work with  n × n   matrices. We canfocus on individual triangular elements containing just three nodes. To see how this comes about,consider, for example, the  n × 1 contribution L  =

 D Φf dA  to the load vector. Since  D  = ∪e∆e, we

can write L  as the sum

L =

nee=1

 ∆e

Φf dA =

nee=1

L∆e ,

where  L∆e = D

 Φ|∆ef dA, and the restriction of Φ to element  e  is completely determined by the

shape functions  H ej ,  that is, in element  e,  all components of Φ vanish except the three composedfrom the element basis functions  H ej , j   = 1, 2, 3. These non vanishing components may be foundfrom the configuration or connectivity matrix:   H ej   =  φn(e,j)|∆e

. Thus, we can compute the 3 × 1element vector

Le =

 ∆e

H e1H e2H e3

f dA =

 ∆e

H ef dA, H  e =

H e1H e2H e3

and use this vector to build  L, e.g., add  Le

1   to  Ln(e,1), etc.. Similar remarks apply to the stiffnessmatrix  K  and the remaining portion  Q  =

 ∂Dq

q Φ ds of the load vector. Thus,

K  =

nee=1

 ∆e

∂ Φ

∂x

∂ ΦT 

∂x  +

 ∂ Φ

∂y

∂ ΦT 

∂y

 dA  =

nee=1

K ∆e

where  K ∆e is determined by the restriction of the derivatives of Φ to the element ∆ e.  Thus, thisn × n  matrix has all its components zero except those arising from the 3 × 3 element matrix

[K ers] =

 ∆e

(∂H er∂x

∂H es∂x

  + ∂ H er

∂y

∂H es∂y

  ) dA

=

 ∆e

(∂H e

∂x

∂H eT 

∂x  +

 ∂ H e

∂y

∂H eT 

∂y  ) dA.

Once these matrices are computed, the  n × n  matrices  K ∆e can be found using the configuration

matrix, and the global stiffness matrix can be assembled by a simple summation. In more detail, if n(e, r) =  i, n(e, s) =  j , then  K ers   is equal to  K ∆e

ij   . In the same way, the remaining portion of theload vector can be written as

Q =

nee=1

 ∂Dq∩∂ ∆e

q Φ ds =

nee=1

Q∆e ,

6

Page 7: me471s03_lec05

8/9/2019 me471s03_lec05

http://slidepdf.com/reader/full/me471s03lec05 7/7

where Q∆e is determined by the restriction of Φ to the boundary of elements  e  which form part of ∂Dq.  These  n × 1 vectors can be composed from the 3 × 1 element vectors

Qe = [Qer] =

 ∂ ∆e

qH er ds

=

 ∂ ∆e

qH e ds,

where we note that on  ∂ ∆e  only two components of  H e are nonzero.

All that remains is to describe explicitly the process of constructing the global stiffness and loadvectors from the element K e and F e. In fact, this is an easy process once the connectivity matrix isgiven. It is probably best explained using specific examples to illustrate the details, and we will takeadvantage of the textbook exercises to do this. One point that has to be kept in mind: We are dealingwith a case in which there is a single unknown at each node (the value ui  of the trial function at thenode). The text examples are written to handle a more general case in which there are nd   unknownsper node. This complicates things in the following minor way: With one unknown per node, node kcan be associated with unknown  uk  so there is no problem keeping track of the unknowns. With  nd

unknowns per node or a total of  n ·nd  unknowns in the system, we keep track of them as follows: Atnode 1 we have unknowns (degrees of freedom) 1, . . . , nd  and at node 2 unknowns  nd + 1, . . . , 2nd,

and in general, at node  k   unknowns (k − 1) ∗ nd + 1, . . . , k nd. To deal with this complication, wecan use an additional book keeping matrix beside the connectivity matrix. In our text this is calledthe index matrix, say J . It simply keeps a count of the indices of the unknowns that are associatedwith each element. It is a simple matter to compute  J  for any element – so  J  can be thought of as avector with  ndn p  components, where  n p  is the number of points per element (n p = 3 in the case of linear triangles). For theoretical considerations it is probably better to think of  J  as an  ne × ndn pmatrix where J (e, k), k = 1, . . . , ndn p  provides the information which  n(e, j), j  = 1, . . . , n p  does inthe case  nd = 1.

This essentially completes our discussion of the weak formulation of the Laplace and Poisson equa-tions and the subsequent assembly process used in developing the finite element equations. Notethat if  ∂ D =  ∂Dq, the solution is only determined to within an arbitrary constant (since  u  =  c  willbe a solution of the homogeneous equation (f  = 0) for any constant  c). In this case, the stiffnessmatrix will have rank  n

−1, and provided the problem is consistent will determine the nodal values

to within an arbitrary constant.

7