# Introduction to Variational Methods and Finite Elements

date post

11-Oct-2015Category

## Documents

view

15download

2

Embed Size (px)

### Transcript of Introduction to Variational Methods and Finite Elements

Introduction to variational methods and nite elements

1.2.3. Variational formulations of BVP:

Problem: Sove ax = b x =ba

Reformulate the problem:Consider E = 12ax

2 + bxFind x : E(x) = min

xE(x)

ax b

x

x

1. Rayleigh-Ritz Method:

Consider a dierential equation

Au = u = f(x) (1a)u(0) = u(1) = (1b)

} Functionalan dimensionvector

Consider the functional: E[u] =10

12(u

)2 + fu dx potential energy functional.

Claim: If u : E[u] = minu

E[u] and u satises (1b) then u solves (1).

Proof:

Let u = u + (arbitrary) (0) = 0 = (1) and C2 so we have a 1 parameter family offunctions which are perturbations of u. The function

Nu

E() = E[u + ] =1

0

12

(u

+

)2+ f(u + ) dx

E(0) =1

0

(u+ ) + f dx

=0

=

10

(u) + f dx

= u10

10

(u

f) dx = 0

22

Since is arbitrary we could choose =(u

f)

u f = 0 Euler -Lagrange equation for E[u].

How is this useful? Let us assume that U(x) =N1k=1

kk(x)

basis functions

Then

E() =

10

12

[N1k=1

kk(x)

]2+ f(x)

Nk=1

kk(x) dx

For a min:

0 =E

j=

10

(N1k=1

kk

)j + f(x)j(x) dx

=N1k=1

k

10

kj dx+

10

f(x)j(x) dx, j = 1, . . . , N 1

A = b where Akj =1

0

kj dx bj =

10

f(x)j(x)dx.

Example : u = x2u(0) = 0 = u(1)

}u(x) =

x

12(1 x3)

Assume {j} ={1, x, x2, x3

}

U3(x) = c0 + c1x+ c2x2 + c3x3

U3(0) = c0 = 0 u3(1) = c1 + c2 + c3 = 0U3(x) = ax(1 x) + bx2(1 x)

= a{x x2}1

+ b {x2 x3}2

c2x+ c2x2 = c3x+ c3x3c2x(1 x)c2 = c1 c3

A11 =

10

(1 2x)2 dx =1

0

1 4x+ 4x2 dx = x 2x2 + 43x3

1

0

=13

A22 =

10

(2x 3x2)2dx =1

0

4x2 12x3 + 9x4 dx = 43x3 3x4 + 9

5x5

1

0

=20 45 + 27

15=

215

A12 = A21 =

10

(1 2x)(2x 3x2) dx = 16

b1 = +

10

x2(x x2) dx = 120

23

b2 =

10

x2(x2 x3)dx = 130

13 1616

215

a

b

=

120

130

a = 1

15b =

16

U3(x) =x

30(1 x)(2 + 5x)

Exact:

uex(x) =x

12(1 x3)

Natural and Essential B-C

Notice that the basis functions {i} were required to satisfy the BC u(0) = 0 = u(1). B-C that haveto be forced onto the trial solution are called essential B-C typically these involve the solutionvalues and not the derivatives. In the case of derivative B-C it is possible to build the B-C into theenergy functional to be minimized.

Consider{

u(0) = u(1) = u = f(x)

Old energy functional Boundary Condition

E[u] =

10

12(u)2 + fu dx u(1)

E[u] =

10

uu + fu dx u(1)

= uu10

10

(u f) u dx u(1)

= {u(1) }u(1)1

0

(u f)u dx = 0

u = f and u(1) = but says nothing about u(0)!

Dont have to enforce BC at this endpoint.

Eg. 2:

u = x = f uexact = 2 + 7x2 x3

6u(0) = 2 u(1) = 3

essential natural

Let: U(x) = 2 + x(a1 + a2x) = 2 + a1x+ a2x2

24

satises homogeneous version of essential BC

UN (x) = +N

i=1

aii(x) =N

i=0

aii(x) a0 = 1 0(x) = 2

E(a) =

10

12

(aii

)2+ f

(aii

)dx 3

(aii(1)

)

0 =E

aj=

10

(aii

)j + fjdx 3j(1)

0 =(i,

j

)ai + (f,j) 3j(1)

0 = Aa+ b

A11 =

10

dx = 1 A21 = A12 =

10

2x dx = 1 A22 =

10

4x2dx =43x3

1

0

=43

b1 =10

(x) x dx 3 = 313

b2 =10

(x)x2 dx 3 = 314[

1 11 4/3

] [a1a2

]=[

10/313/4

] a1 = 4312 a2 =

14

U2(x) = 2 +4312

x x2

4

x 0 0.2 0.4 0.6 0.8 1RR 2 2.707 3.393 4.060 4.707 5.333EX 2 2.699 3.389 4.064 4.715 5.333 Built in

2. General calculus of variations:

I[u] =

ba

F (x, y, y) dx y(a) = 0, y(b) = 0

0 = I =

ba

F

yy +

F

y(y) dx

= yF

y

b

a

b

a

[d

dx

(F

y

) F

y

]y dx

ddx

(F

y

) F

y= 0 Euler-Lagrange Eq.

Eg.1 (pu) + qu = fu(a) = u(b) =

I[u] =

ba

p(u)2 + qu2 2fu dx+ u

F = p(u)2 + qu2 2fuF

u= 2qu 2f

F

u= 2pu

x

(F

u

) F

u= 2

{(pu) qu + f} = 0

25

Eg. 2: Sturm-Lioville Eigenvalue problems:

u(a) = 0 = u(b); +(pu) + qu + ru = 0 (1)

Multiply by v and integrateba+(pu)v + quv dx +

baruv dx = 0

= I[u] =

bap(u)2 qu2 dx

baru2 dx

=I1I2

=I1I2 I1I2

I22=

1I2

(I1 I2)

=

ba2puu 2quu ruu dx

baru2 dx

=2

ba

[(pu) + qu + ru

]u dx

baru2 dx

= 0

= 0 the function u0 which minimizes I[u] is an eigenfunction of (1) and = I[u0] is its eigenvalue.

Higher eigenvalues: n = min(u,k)=0

k=1,...,n1I[u]

constrained minimization problem.3. Method of weighted residuals

What do we do for nonlinear or dissipative problems for which potential energy functionals dontexist or cannot be found easily?

Consider a BVP

Lu = f in = (a, b) (1a)u(a) = ; u(b) + u(b) = (1b)

An approximate solution U wont in general satisfy (1a) and we associate with U the so-calledresidual

r(U) = LU fNote that r(u) = 0

exact A whole class of methods are obtained by considering various ways to minimize the residual insome sense, usually:

ba

r(U)i dx = 0

test or weight functions

where U =N

i=1

aii(x) basis function

26

1. Collocation: weight functions = (x xi) basis functions polynomials:

Eg:

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

(A) Let i(x) =(xi+1 x)which satisfy the homogeneous B-C for the problem

U(x) = 1 x+ a1(x2 x)+ a2 (x3 x)

r(U) = {a12 + a26x} {a1 (2x 1) + a2

(3x2 1)}+ 1

= (3 2x) a1 a2(3x2 6x 1)+ 1

With x1 = 0 and x2 = 1 as collocation points we have(3 11 4

)(a1a2

)=( 11

) U1(x) = 1 x

(311

)(x2 x) 2

11(x3 x)

If we choose x1 and x2 are chosen to be the zeros of the 2nd degree Legendre polynomial

U2(x) = 1 x 14(x2 x)

(16

)(x3 x)

The exact solution is u(x) =(e ex)(e 1) .

x u(x) U1(x) U1 u U2 U2 u U3 U3 u1/4 0.834704 0.837750 3.05103 0.835938 1.23103 0.769965 6.47 1021/2 0.622459 0.636364 1.39 102 0.625000 2.54 103 0.506144 1.16 1013/4 0.349932 0.360795 0.351563 1.63 103 0.269965 8.00 102

(B) With dierent trial functions:

U(x) = 1 x+ a1 sinx+ a2 sin 3xr(U) = ( sinx+ cosx)a1 3(3 sin 3x+ cos 3x)c2U3(x) = 1 x+ 0.017189 sinx+ 0.011045 sin 3x

using zeros of 2nd degree Legendre polys.

Where to collocate?

What basis fucntions to use?

DeBoor, C. and Swartz, B. , Collocation at Gaussian points, SIAM J. Num. Anal. 10 (1973),582606.

27

2. Method of moments: weight functions i = xi.

Eg:

u + u + x = 0u(0) = 0 = u(1)

Let U(x) = a1x(1 x) + a2x2(1 x) + . . .r(U) = x+ a1(2 + x x2) + a2(2 6x+ x2 x3)1

0

r(U) 1 dx = 0 and1

0

r(U) x dx = 0

116 1112

1122

1920

a1

a2

=

12

13

U(x) = x(1 x)(122649

+110649

x

)

uex(x) =sinxsin 1

x

3. Galerkin method: Expand U(x) and w(x) in terms of the same basis functions.

u(x) =N

i=1

aii w(x) =N

i=1

bii

r

(N

i=1

aii

)(N

i=1

bii

)dx = 0

r

(N

i=1

aii

)j dx = 0

Since the bi are arbitrary.

Eg. u + u+ x = 0u(0) = 0 = u(1)

Let U(x) = a1x(1 x) + a2x2(1 x)r(U) = x+ a1(2 + x x2) + a2(2 6x+ x2 x3)1

0

r(u) 1(x)dx =1

0

{x+ a1

(2 + x x2)+ a2 (2 6x+ x2 x3)} x(1 x)x2(1 x) dx = 0

310

320

320

13105

a1

a2

=

112

120

a1 = 7369 a2 = 741

U(x) = x(1 x)(

71369

+741

x

)

ue(x) =sinxsin 1

x

28

Relationship between Rayleigh Ritz and Galerkin:

Rayleigh Ritz u + u = f = x u(0) = 0 = u(1)

I[u] =

10

u2 u2 + 2fu dx

0 = I =

10

2uu 2uu + 2fu dx

=[uu

]10

10

(u + u f) u dx

0 =1

0

(u + u f)u dx

=

10

r(u)u dx

I(a) =

10

(aii

)(aij

)(

aii)(

ajj

+2f

ajj dx

0 =I

ak= 2

{ai(i,

k)

ai(i,k)

+(f,k)}f = x

Rayleigh-Ritz and Galerkin methods are identical for this problem. true in general for linearproblems but not for nonlinear problems.

From WR to the weak form:

WR1

0

(u + u+ x)v dx = 0

u(0) = 0 = u(1) v satisfy homogeneous Dirichlet i.e. v(0) = 0 = v(1)

Say we wanted to express u in terms of functions that are not twice dierentiable then we integrateby parts to throw as many derivatives as needed from u to v.

10

(u + u + x)v dx = uv

1

0

+

10

uv + uv + xv dx = 0.

Now if we let u =

aii and v =

bii we have since v is arbitrary

i

ai(i,j) +

ai(i,j) + (x,j) = 0

Aa = b

where[A]jj = (i,

j) (i,j); b = (x,j)

Identical to Rayleigh-Ritz eqs.

29

What about a natural BC?

(S){

u + u+ x = 0u(0) = u(1) = .

10

(u + u+ x)v dx = 0 v H10