me471_lec02

7

Click here to load reader

Upload: hasen-bebba

Post on 01-Jun-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: me471_lec02

8/9/2019 me471_lec02

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

Model Problem

It is easiest to develop the basis of the finite element method with a specific physical problem inmind. To this end, let’s look at the equation for the displacement of a 1D elastic bar as shown inthe 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 onthe 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) opposingthe motion of the bar. At the ends  x  = 0,   a variety of conditions are possible. To keep thingssimple, let’s 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, Newton’s second lawfor the segment of the bar occupying the interval [x − dx/2, x + dx/2] is

ρdxu =  P (x + dx/2) − P (x − dx/2) − c(x)dxu + f (x)dx + O(dx2),

where u =  ∂ 2u/∂t2. Dividing by dx  and letting  dx → 0 we find

ρu = ∂Aσ

∂x

  − cu + f 

Now we assume that the rod is linearly elastic so that the stress   σ   is proportional to the straine =  ∂u/∂x. Thus,

σ =  E (x)∂u

∂xSubstitution gives the equation of motion

ρu =  ∂ 

∂x(AE (x)

∂u

∂x) − cu + f.

In this equation we assume that   ρ,A, E, c,  and  f   are given functions of  x. In the time dependentcase, we must in addition to fixing the ends of the rod, specify the initial position,   u(x, 0) andvelocity  ∂ u(x, 0)/∂t  as functions of  x.

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

0

ρuu dx =

   0

u  ∂ 

∂x(AE (x)

∂u

∂x) dx −

   0

cuu dx +

   0

uf dx.

1

Page 2: me471_lec02

8/9/2019 me471_lec02

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

On the left hand side we have  ρuu =  ∂ ( 12

ρu2)/∂t. On the right hand side, we need to integrate byparts to obtain a useful expression. We use

u ∂ 

∂x(AE (x)

∂u

∂x) =

  ∂ 

∂x(uAE (x)

∂u

∂x) − AE (x)

∂u

∂x

∂  u

∂x,

AE (x)

∂u

∂x

∂  u

∂x  =

  ∂ 

∂t1

2 AE (x)(

∂u

∂x )2

together with

cuu = 1

2

∂cu2

∂t

to find that

∂ 

∂t

   0

1

2ρu2 dx +

   0

1

2AE (x)(

∂u

∂x)2 dx +

   0

1

2cu2 dx −

   0

fudx

= 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 leftis constant in time and represents to total energy in the bar. Clearly, the first term is the kineticenergy, the second the elastic energy, the third the elastic support energy, and the last the energy

supplied by the applied force.

Let’s specialize now to the time independent, or static, case continuing to require that the dis-placment vanishes at both ends of the rod. (This restriction can be easily removed later.) Thedisplacement  u(x) of the bar satisfies

−  d

dx(AE (x)

du

dx) + cu =  f,   0 < x < , u(0) = u() = 0,

were  AE (x) =  A(x)E (x) is a given function  AE   ∈  C 1([0, ]), and  c, f   ∈  C ([0, ]) are given. Notethat the set  V   =  {u  ∈  C 2([0, ]) :  u(0) =  u() = 0}   is a linear subspace of  C 2([0, ]), and observethat the function

Lu = − d

dx(AE (x)

du

dx) + cu

is a linear mapping of   V   into   C ([0, ]). Thus, finding the solution of our differential equationequivalent to finding  u  ∈  V    such that  Lu  =  f   where  f   ∈  C ([0, ]) is given. (We’ll continue to usethe abreviated notation  V   = {u ∈ C 2([0, ]) : u(0) = u() = 0}   in the following paragraphs withoutfurther 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) =

   0

1

2AE (x)(

dw

dx)2 dx +

   0

1

2cw2 dx −

   0

fw dx, w ∈ V 

Recall from the above discussion that for a rod with displacement  w(x) the first term represents theelastic 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 callP   the potential energy of the rod. We now show that of all functions in  V  , the solution  u  of theequation Lu  =  f   minimizes the potential energy. Let  w  ∈  V  be an arbitrary element, then we can

2

Page 3: me471_lec02

8/9/2019 me471_lec02

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

always write w  =  u + v  where Lu  =  f   and  v  ∈ V   (just take  v  =  w − u  and recall that  V   is a linearspace). Then

P (w) = P (u + v) = P (u) +

   0

(AEuv + cuv − fv) dx  +

   0

1

2AE (v)2 +

 1

2cv2 dx

where we’ve used the short hand notation 

= d/dx. Let’s concentrate on the middle term above

W (u, v) =

   0

(AEuv + cuv − f v) dx,

which we’ll call the first variation of   P  or the weak form of the equation   Lu   =   f . We now useintegration by parts on  W  to show that  u ∈ V   satisfies  Lu  =  f  ⇒ W (u, v) = 0 for all  v  =∈ V.  Thefirst term of  W  becomes  

0

AEuv dx =

   0

(AEuv) − (AEu)v dx =

   0

−(AEu)v dx + (AEuv)|

0

Because v  ∈ V  vanishes at both ends of the interval, the integrated term vanishes and we find

W (u, v) =   0

(−(AEu)v + cuv − f v)  dx  =   0

(Lu − f )v dx = 0

since u  satisfies  Lu  =  f . Thus, we have

P (w) = P (u) +

   0

1

2AE (v)2 +

 1

2cv2 dx,

that is  P (w) is equal to  P (u) plus a term which is clearly nonnegative. This second term can onlyvanish if  v   ≡  0. (Even if the coefficient  c  = 0 we can conclude that   v = 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 theproblem: find u ∈  V   satisfying  Lu  =  f   for given continuous  f   is equivalent to finding  u  ∈  V   makeP  a minimum.

Now let’s focus on the weak form or first variation1 W . We know that  Lu  =  f   ⇒ W (u, v) = 0 forall   v   ∈   V  . We can show without difficulty that the implication sign can be reversed so that thevariational form implies the differential equation. That is, introducing the notation

a(u, v) =

   0

(AEuv + cuv) dx,   (f, v) =

   0

fv dx,

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

P (u + v) −P (u) =  

  

0

AEuv + cuv − f v

 dx  + 2

  

0

1

2AE (v)2 +

 1

2v2 dx

Now divide by    and take the limit   → 0 to obtain

lim→0

(u

 + v

)−P 

(u

)

≡ DP (u)(v) =   0

AEuv + 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 valuedfunction (DP (u) : V    → R) is, in turn, applied to  v .

3

Page 4: me471_lec02

8/9/2019 me471_lec02

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

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 thesteps 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 withthe 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 afew more of its features shortly, but first let’s see how it leads directly to a numerical method. LetV n  be a finite dimensional subspace of  V  with a system of basis vectors  φj , j  = 1, . . . , n, and lookfor an approximate solution to our BVP in  V n. Thus, we take u  =

j ujφj  as a linear combination

of the basis vectors with coefficients  uj   to be found. Since  V n  ⊂ V  we demand that the weak formbe satisfied for all  v  ∈  V n. Using the facts that a(u, v) is symmetric, linear in each argument, andthat   a(u, v) = (f, v) for all   v   ∈   V n   is equvalent to   a(u, φi) = (f, φi), i   = 1, . . . , n  (since  φ   are asystem of basis vectors for  V n), we conclude that

nj=1

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

that is, we obtain a system of  n  linear equations for the unknown coefficients  uj  of the approximatesolution.

As a specific example, take   −u + 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

a(u, v) = 10

 (uv + uv) dx and (f, v) = 10

 xv dx. Let’s pick  V n  as the set of all polynomials of degreeat 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 (V 1  consists of all multiples of x(1 − x),  V 2  contains all linear combination of the polynomials  φ1  =  x(1 − x), φ2  =  x2(1 − x), andin general  V n  is spanned by  φj  = xj(1 − x), j  = 1, . . . , n.) We compute 

  1

0

φiφj dx  =   1

0

xi+j(1 − x)2 dx =   2(k + 1)(k + 2)(k + 3)

k=i+j

and    10

φ

j dx =

   10

(ixi−1(1 − x) − xi)( jxj−1(1 − x) − xj) dx =  ij  2

(k − 1)k(k + 1)

k=i+j

2Since we’re new to these manipulations, I will go through the details. Starting with   a(u, v) integrate the firstterm by parts to obtain

a(u, v) =

  

0

(AEuv) − (AEu)v +  cuv

 dx  =

  

0

−(AEu)v +  cuv

 dx  + (AEuv)

0

 ,

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

   0

−(AEu

)

+ cu − f 

v dx =   0

(Lu− f )v dx = 0

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

4

Page 5: me471_lec02

8/9/2019 me471_lec02

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

and finally    10

xφi dx =

   10

xi+1(1 − x) dx =  1

(i + 2)(i + 3).

These formulas allow us to compute

kij  = a(φi, φj) =   2ij

(k − 1)k(k + 1)  +

  2

(k + 1)(k + 2)(k + 3)

k=i+j

(called the stiffness matrix) and f i = (f, φi) (the load vector) after which we need to solve the linearequations

 n

j=1 ki juj  = f i, i = 1, . . . , n. Let’s 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) asshown in the plot below.

5

Page 6: me471_lec02

8/9/2019 me471_lec02

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

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.01

0.02

0.03

0.04

0.05

0.06

where the circles represent the exact solution, and the line the  n  = 2 numerical approximation. Amore 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.0286800.300000 0.040878 0.040890 0.040878

0.400000 0.050483 0.050638 0.050483

6

Page 7: me471_lec02

8/9/2019 me471_lec02

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

0.500000 0.056591 0.056818 0.056590

0.600000 0.058260 0.058452 0.058260

0.700000 0.054507 0.054564 0.054508

0.800000 0.044295 0.044178 0.044295

0.900000 0.026518 0.026315 0.026518

1.000000 0.000000 0.000000 0.000000

7