applied numerical methods lec14

24
1 ODE 2 Boundary-Value Problems

Upload: ymaa1975ma

Post on 10-Aug-2015

70 views

Category:

Engineering


2 download

TRANSCRIPT

Page 1: Applied numerical methods lec14

1

ODE 2

Boundary-Value Problems

Page 2: Applied numerical methods lec14

2

Boundary-Value Vs. Initial-Value ODE

This is a 2nd-order ODE, so requires two known conditions to be solved.

• Initial-value problemThe two known conditions all occur at the same t.Example: at time t = 0, θ = π/3 and dθ/dt = 0.

• Boundary-value problemThe two known conditions occur at different t.Example: at time θ = π/3 at t = 0, and θ = -0.45π at t = 2.3.0=+ sinθ

l

g

dt

θd2

2

Why Need To Learn Boundary-value Problem?• There are many applications where the initial conditions are not known at a single point, but

rather are known at different values of the independent variable.

• Sometime, it is more convenient to observe certain types of conditions at different time rather than all the types at a same time (e.g. it is easier to observe and record the displacement θ at two different time than to record the angular velocity dθ/dt).

• Many physical problems are better or can only be formulated as boundary-value problems.

Page 3: Applied numerical methods lec14

3

Boundary-Value Vs. Initial-Value

Page 4: Applied numerical methods lec14

4

An Example of Boundary-Value Problem

( )( ) 2

10

TLT

TT

==

( ) 0h'dx

da2

2

=−+ TTT

Heat balance for a long, thin rod

( ) 20452353452373 1010 +−= − x.ex. .e.xT

analytical solution

At a steady state:

h’ is a heat transfer coefficient, and Ta is the temperature of the surrounding air.

Boundary-values:

Instance: L = 10, Ta =20, T1 = 40, T2 = 200, and h’ = 0.01

Page 5: Applied numerical methods lec14

5

The Shooting Method

( ) 0h'dx

da2

2

=−+ TTT

( )aTTh'dx

dz andz

dx

dT −==

( ) ( ) ( ) 690712379716820037971688980285

102010 ..

..c =−

−−+=0z

Covert to two 1st-order ODEs

Initial-value problem: T(0) = 40, z(0) = ???

L = 10, Ta =20, T(0) = 40, T(10) = 200, and h’ = 0.01

Shoot (guess)

(a) z(0) = 10 RK method T(10) = 168.3797

(b) z(0) = 20 RK method T(10) = 285.8980

z(0) and T(10) are linearly related (why?)

T

x

The shooting method is based on converting the boundary-value problem into an equivalentinitial-value problem. A trial-and-error approach is then implemented to solve theinitial-value version. The approach can be illustrated by an example

Page 6: Applied numerical methods lec14

6

The Shooting Method As A Roots Problem

FRK: the value of T(10) corresponding to the value of z(0) obtained by using 4th-order RK method

200 = FRK(z0) ���� z0 = 12.6907

T10 = T(10)

z0=z(0)

200

12.6907

FRK(z(0))

Page 7: Applied numerical methods lec14

7

Example of Using Roots Finding for Nonlinear ODE

ODE

ODE

Page 8: Applied numerical methods lec14

8

Finite-Difference Approach(An Example)

211 2

x∆+−

= −+

=

iii

xx2

2 TTT

dx

Td

i

( ) 0h'dx

da2

2

=−+ TTT

( ) 02

211 =−

∆+− −+

aiiii T-Th'

x

TTT

( ) aiii Txh'TTxh'T 21

21 2 ∆=−∆++− +−

Instance: Ta =20, T(0) = 40, T(10) = 200, and h’ = 0.01; use ∆x = 2

=

−−−

−−−

8200

80

80

840

042100

104210

010421

001042

4

3

2

1

.

.

.

.

.

.

.

.

T

T

T

T

[ ] [ ]2004795159538212477859396986540543210 ....=TTTTTT

Centered finite difference

Page 9: Applied numerical methods lec14

9

Comparison Between Shooting and Finite-Difference(The example of long and thin rod heat balance problem)

( ) 0h'dx

da2

2

=−+ TTT

L = 10, Ta =20, T(0) = 40, T(10) = 200, and h’ = 0.01

Page 10: Applied numerical methods lec14

Homework

10

1-

2-

3-

Page 11: Applied numerical methods lec14

11

Page 12: Applied numerical methods lec14

12

A steady-state heat balance for a rod can be represented as

Use the finite-difference approach with ∆x = 1 to solve the problem for 10 m rod with T(0) = 240 and T(10) = 150

Miscellaneous problems #1

Page 13: Applied numerical methods lec14

13

Page 14: Applied numerical methods lec14

14

Page 15: Applied numerical methods lec14

15

Miscellaneous problems #2

Page 16: Applied numerical methods lec14

16

Page 17: Applied numerical methods lec14

17

Page 18: Applied numerical methods lec14

Finite Difference Method

Example 1

The deflection y in a simply supported beam with a uniform load q and a tensile axial load T is given by

EI

xLqx

EI

Ty

dx

yd

2

)(2

2 −=− (E1.1)

where =x location along the beam (in) =T tension applied (lbs) =E Young’s modulus of elasticity of the beam (psi) =I second moment of area (in4) =q uniform loading intensity (lb/in) =L length of beam (in)

Figure 3 Simply supported beam for Example 1.

Given, 7200=T lbs, 5400=q lbs/in, in 75=L , Msi 30=E , and 4in 120=I , a) Find the deflection of the beam at "50=x . Use a step size of "25=∆x and approximate the derivatives by central divided difference approximation. b) Find the relative true error in the calculation of )50(y . Solution

a) Substituting the given values,

)120)(1030(2

)75()5400(

)120)(1030(

7200662

2

×−=

×− xxy

dx

yd

)75(105.7102 762

2

xxydx

yd −×=×− −− (E1.2)

Approximating the derivative 2

2

dx

yd at node i by the central divided difference

approximation,

q

y

L

x

T T

Page 19: Applied numerical methods lec14

Figure 4 Illustration of finite difference nodes using central divided difference method.

2

112

2

)(

2

x

yyy

dx

yd iii

∆+−≈ −+ (E1.3)

We can rewrite the equation as

)75(105.7102)(

2 762

11iii

iii xxyx

yyy−×=×−

∆+− −−−+ (E1.4)

Since 25=∆x , we have 4 nodes as given in Figure 3

Figure 5 Finite difference method from 0=x to 75=x with 25=∆x .

The location of the 4 nodes then is 00 =x

2525001 =+=∆+= xxx

50252512 =+=∆+= xxx

75255023 =+=∆+= xxx

Writing the equation at each node, we get Node 1: From the simply supported boundary condition at 0=x , we obtain 01 =y (E1.5) Node 2: Rewriting equation (E1.4) for node 2 gives

)75(105.7102)25(

222

72

62

123 xxyyyy

−×=×−+− −−

)2575)(25(105.70016.0003202.00016.0 7321 −×=+− −yyy

4321 10375.90016.0003202.00016.0 −×=+− yyy (E1.6)

Node 3: Rewriting equation (E1.4) for node 3 gives

)75(105.7102)25(

233

73

62

234 xxyyyy

−×=×−+− −−

)5075)(50(105.70016.0003202.00016.0 7432 −×=+− −yyy

4432 10375.90016.0003202.00016.0 −×=+− yyy (E1.7)

Node 4: From the simply supported boundary condition at 75=x , we obtain 04 =y (E1.8)

0=x 25=x 50=x

1=i 2=i 3=i 4=i

75=x

1−i i 1+i

Page 20: Applied numerical methods lec14

Finite Difference Method

Equations (E1.5-E1.8) are 4 simultaneous equations with 4 unknowns and can be written in matrix form as

×

×=

−−

0

10375.9

10375.9

0

1000

0016.0003202.00016.00

00016.0003202.00016.0

0001

4

4

4

3

2

1

y

y

y

y

The above equations have a coefficient matrix that is tridiagonal (we can use Thomas’ algorithm to solve the equations) and is also strictly diagonally dominant (convergence is guaranteed if we use iterative methods such as the Gauss-Siedel method). Solving the equations we get,

−−

=

0

5852.0

5852.0

0

4

3

2

1

y

y

y

y

"5852.0)()50( 22 −=≈= yxyy The exact solution of the ordinary differential equation is derived as follows. The homogeneous part of the solution is given by solving the characteristic equation 0102 62 =×− −m 0014142.0±=m Therefore, xx

h eKeKy 0014142.02

0014142.01

−+=

The particular part of the solution is given by CBxAxy p ++= 2

Substituting the differential equation (E1.2) gives

)75(105.7102 762

2

xxydx

ydp

p −×=×− −−

)75(105.7)(102)( 72622

2

xxCBxAxCBxAxdx

d −×=++×−++ −−

)75(105.7)(1022 726 xxCBxAxA −×=++×− −−

2756626 105.710625.5)1022(102102 xxCABxAx −−−−− ×−×=×−+×−×− Equating terms gives 76 105.7102 −− ×−=×− A 56 10625.5102 −− ×−=×− B 01022 6 =×− − CA Solving the above equation gives 375.0=A 125.28−=B 51075.3 ×=C

Page 21: Applied numerical methods lec14

The particular solution then is 52 1075.3125.28375.0 ×+−= xxy p

The complete solution is then given by xx eKeKxxy 0014142.0

20014142.0

152 1075.3125.28375.0 −++×+−=

Applying the following boundary conditions 0)0( ==xy 0)75( ==xy we obtain the following system of equations

521 1075.3 ×−=+ KK

521 1075.389937.01119.1 ×−=+ KK

These equations are represented in matrix form by

×−×−

=

5

5

2

1

1075.3

1075.3

89937.01119.1

11

K

K

A number of different numerical methods may be utilized to solve this system of equations such as the Gaussian elimination. Using any of these methods yields

×−×−

=

5

5

2

1

10974343774.1

10775656226.1

K

K

Substituting these values back into the equation gives xx eexxy 0014142.050014142.0552 10974343774.110775656266.11075.3125.28375.0 −×−×−×+−=

Unlike other examples in this chapter and in the book, the above expression for the deflection of the beam is displayed with a larger number of significant digits. This is done to minimize the round-off error because the above expression involves subtraction of large numbers that are close to each other. b) To calculate the relative true error, we must first calculate the value of the exact solution at

50=y .

)50(0014142.0552 10775656266.11075.3)50(125.28)50(375.0)50( ey ×−×+−=

)50(0014142.0510974343774.1 −×− e 5320.0)50( −=y The true error is given by tE = Exact Value – Approximate Value

)5852.0(5320.0 −−−=tE

05320.0=tE

The relative true error is given by

%100Value True

Error True ×=∈t

%1005320.0

05320.0 ×−

=∈t

%10−=∈t

Page 22: Applied numerical methods lec14

18

Special Problem 10

Page 23: Applied numerical methods lec14

Homework

19

1.

2.

3.

4.

Page 24: Applied numerical methods lec14

18

Special Problem 10