University of Florida/Eml5526/s11.team2.reiss.HW3 HW3

From testwiki
Jump to navigation Jump to search

Obtaining Solution to the Weak Form from a Trial Solution


Given

ddx(AEdudx)+2x=0 on 1<x<3

(10.1)

σ(1)=(Edudx)x=1=0.1

(10.2)

u(3)=0.001


(10.3)


where the weak form is

13dwdxAEdudxdx=0.1(wA)x=1+132xwdx w with w(3)=0

(10.4)

A trial solution for u(x) is suggested as

u(x)=α0+α1(x3)+α2(x3)2

(10.5)

with w(x) of the same form.

1) determine the solution to the weak form. 2) verify that the solution satisfies the equilibrium equation of the strong form 3) verify that the natural boundary condition is satisfied

Solution 3.10.1

From the given information the equations for u(x) and w(x) are as follows

u(x)=α0+α1(x3)+α2(x3)2

(10.5)

w(x)=β0+β1(x3)+β2(x3)2

(10.6)

Using the initial condition w(3)=0

w(3)=β0+β1(33)+β2(33)2w(3)=0=β0

(10.7)

Using the condition that u(3)=0.001

w(3)=α0+α1(33)+α2(33)2u(3)=0.001=α0

(10.8)

The partial derivatives of u(x) and w(x) are

du(x)dx=α1+2α2(x3)

(10.8)

dw(x)dx=β1+2β2(x3)

(10.9)

Replacing, the weak form becomes

AE13[β1+2β2(x3)][α1+2α2(x3)]dx=0.1(β14β2)A+132x[β1+2β2(x3)]dx

(10.10)

After integration the equation becomes

AE[β1(2α14α2)+β2(4α1+103α2)]=0.1(β14β2)A+8β1623β2

(10.11)

Rearranging we get

β1[AE(2α14α2)+0.1A8]+β2[AE(4α1+103α2).4A+623]=0

(10.12)

The β0 and β1 values must be arbitrary, the solutions to this equation are dependent on the bracketed terms equaling zero. The solution for this, in matrix form, is

AE[244103][α1α2]=[0.1A8.4A20.666]

(10.13)

The solution to the weak form becomes

[α1α2]=[244103]1[0.1A80.4A20.666](AE)1

(10.14)

Giving the solution of

[α1α2]=[.2071+11.7132a0.1286+7.8566a]E1

(10.15)

Problem 3.7: Rework Problem 3.1 without using a shift in the given polynomial basis.

Given

2d2udx2+3=0

(7.1)

Boundary Conditions:

u(x=1)=0

(7.2)

dudx(x=0)=4

(7.3)

bj=(x)j

(7.4)

The exact solution to Eq.3.1:

u(x)=34x24x+194

(7.5)

Find

We want to find an approximation to Eq.3.5 in the form of

uh(x)=i=0naibi

(7.6)

as well as investigate how the accuracy of our approximation changes with n going from 2 to 4 and then 6.

Case:n=2

First let's expand Eq.3.6 out to n=2 terms.

uh(x)=a0b0+a1b1+a2b2

(7.7)

Now consider Eq.7.4, and substitute the appropriate terms into Eq.7.7.

uh(x)=a0(1)+a1(x)+a2(x)2

(7.8)

Let's rewrite this equation in terms of a product between 2 vectors.

uh(x)=[1x(x)2][a0a1a2]

(7.9)

In order for us to solve for the unknown ais in Eq.7.9, we must have 3 linearly independent equations describing linear combinations of the ais.Two of the equations are easily obtained directly from the given boundary conditions in Eq.7.2 and Eq.7.3. It only makes practical sense that if we want our approximation to closely resemble our exact solution, we must require identical behavior between Eq.7.5 and Eq.7.8 at the boundaries.

uh(x=1)=a0(1)+a1(1)+a2(1)2=0a0(1)+a1(1)+a2(1)2=0

(7.10)

a0+a1+a2=0

(7.11)

dudx(x=0)=a1+a22(0)=4

(7.12)

a1=4

(7.13)

Now we just need one more linearly independent equation and we can then readily solve for the ais. To develop another set of equations which are linearly independent of Eq.7.11 and Eq.7.13, we take the inner product between our approximation of u(x), Eq.7.9 and our basis set of functions Eq.7.4. Before getting to the inner product first, let's define our linear differential operator as the following

P()=d2dx2+32=0

(7.14)

Now, using our operator in Eq.7.14, we can now operate on our approximation in Eq.7.9.

P(uh)=d2dx2[1x(x)2][a0a1a2]+32=0[002][a0a1a2]+32=0

(7.15)

Which we can then rewrite Eq.7.15 as

[002][a0a1a2]=32

(7.16)

Therefor

2a2=32

(7.21)

Using Eq.7.11 and Eq.7.13, we can form the following matrix equation.

[111010002][a0a1a2]=[043/2]

(7.21)

Let's solve for the inverse of the matrix in Eq.7.21 using the Gauss-Jordan Method. Letting the matrix above in Eq.7.21 equal 𝐊, we can find 𝐊𝟏 by

𝐊𝐈=[111100010010002001]=[100111/2010010002001]=[100111/2010010001001/2]

(7.22)

𝐊𝟏=[111/2010001/2]

(7.23)

Now using Eq.7.23, we can solve Eq.7.21 for our unknown ais.

𝐊𝟏𝐊[a0a1a2]=𝐊𝟏[043/2]

(7.24)

[a0a1a2]=[111/2010001/2][043/2]

(7.25)

[a0a1a2]=[19/443/4]

(7.26)

Solution

uh(x)=1944(x)34(x)2

(7.27)

Now. let's check the absolute error between our approximate solution above in Eq. 7.26 and our exact solution in Eq.7.5.

Comparing uh(x), 7.27, to u(x), 7.5, we can see that using this basis gives an exact solution to u(x)

uh(x)=1944(x)34(x)2

(7.27)

u(x)=1944(x)34(x)2

(7.5)

Graphical Comparison Between Exact and Numerical Approximate Solutions

File:WRPlot n=2 case.jpg

Case:n=4

We will follow exactly the same methodology as we have above, leaving out the explanations for each step.

uh(x)=a0b0+a1b1+a2b2+a3b3+a4b4

(7.32)

uh(x)=a0(1)+a1(x)+a2(x)2+a3(x)3+a4(x)4

(7.33)

uh(x)=[1xx2x3x4][a0a1a2a3a4]

(7.34)

Using our given boundary conditions to obtain our first 2 linearly independent equations.

uh(x=1)=a0(1)+a1(1)+a2(1)2+a3(1)3+a4(1)4=a0+a1+a2+a3+a4

(7.35)

a0+a1+a2+a3+a4=0

(7.36)

duhdx(x=0)=0+a1+0+0+0

(7.37)

a1=4

(7.38)

Using our predefined linear differential operator in Eq.7.14.

P(uh)=d2dx2[1xx2x3x4][a0a1a2a3a4]+32

(7.39)

Because this time we have 5 unknown ais, we will have to choose 3 equations from our inner product operation.

bi,P(uh)=01biP(uh)=0

(7.40)

01[1xx2x3x4][0026(x)12(x)2]dx[a0a1a2a3a4]=3201[1xx2x3x4]dx

(7.41)

01[0026(x)12(x)2002(x)6(x)212(x)3002(x)26(x)312(x)4002(x)36(x)412(x)5002(x)46(x)512(x)6]dx[a0a1a2a3a4]=3201[1xx2x3x4]dx

(7.42)

[0023400123002/33/212/5001/26/52002/5112/7][a0a1a2a3a4]=[3/23/43/63/83/10]

(7.43)

Now we can use the bottom three rows of Eq.7.43, along with Eq.7.36 and Eq.7.38 to develop a system of equations

[1111101000002/33/212/5001/26/52002/5112/7][a0a1a2a3a4]=[043/63/83/10]

(7.44)

Solving this system using MATLAB, the solution becomes

[a0a1a2a3a4]=[19/443/400]

(7.45)

Solution

uh(x)=1944(x)34(x)2

(7.46)

We can see from above in Eq.7.46 that our solution did not improve at all by an increase in n from 2 to 4. This should have been intuitive from the start since we showed earlier that using n=2 gives us an equivalent u(x)

Graphical Comparison Between Exact and Numerical Approximate Solutions

File:WRPlot n=4 case.jpg

Egm5526.s11.team-2.langpm 14:38, 14 February 2011 (UTC)

Case:n=6

uh(x)=a0b0+a1b1+a2b2+a3b3+a4b4+a5b5+a6b6=a0+a1x+a2x2+a3x3+a4x4+a5x5+a6x6

(7.47)

Using the given boundary conditions in Eq.7.2 and Eq.7.3 we have the following to restrictions on our approximated solution.

uh(x=1)=a0+a1+a2+a3+a4+a5+a6=0a0+a1+a2+a3+a4+a5+a6=0

(7.48)

a0+a1+a2+a3+a4+a5+a6=0

(7.49)

duhdx(x=0)=0+a1+0+0+0+0+0

(7.50)

a1=4

(7.51)

Using the same linear differential operator as we have for the past 2 cases, Eq.7.14 we have the following.

P(uh)=d2dx2[1xx2x3x4x5x6][a0a1a2a3a4a5a6]+32

(7.52)

Forming the inner product.

bi,P(uh)=01biP(uh)dx=0

(7.53)

01[0026(x)12(x)220(x)330(x)4002(x)6(x)212(x)320(x)430(x)5002(x)26(x)312(x)420(x)530(x)6002(x)36(x)412(x)520(x)630(x)7002(x)46(x)512(x)620(x)730(x)8002(x)56(x)612(x)720(x)830(x)9002(x)66(x)712(x)820(x)930(x)10]dx[a0a1a2a3a4a5a6]=3201[1x(x)2(x)3(x)4(x)5(x)6]

(7.54)

[00234560012345002/33/212/510/330/7001/26/5220/715/2002/5112/75/210/3001/36/73/220/93002/73/44/31/230/11][a0a1a2a3a4a5a6]=[3/23/43/63/83/103/123/14]

(7.55)

We take the bottom 5 rows from Eq.7.55 and build a system of equations with Eq.7.49 and Eq.7.51.

[11111110100000002/33/212/510/330/7001/26/5220/715/2002/5112/75/210/3001/36/73/220/93002/73/44/31/230/11][a0a1a2a3a4a5a6]=[043/63/83/103/123/14]

(7.56)

As in the n=4 case, we use a MATLAB to determine the unknown ais adn to determine the final form of our approximation to the solution of the differential equation 7.1.

[a0a1a2a3a4a5a6]=[19/443/40000]

(7.57)

Solution

uh(x)=1944(x)34(x)2

(7.58)

We can see from above in Eq.7.58 that our solution did not improve at all by an increase in n from 2 to 6 as was expected. Comparing this to the results from problem 3.1 we can see that the shift is not necessary for this basis function. It will return an exact solution with or without the shift.

Graphical Comparison Between the Exact and Numerical Solutions

File:Plot n=6 case.jpg

Template:CourseCat