PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Similar documents
Ordinary Differential Equations (ODE)

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Finite Difference Method

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

General Linear Least-Squares and Nonlinear Regression

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

APPLICATIONS OF FD APPROXIMATIONS FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS

Review for Exam 2 Ben Wang and Mark Styczynski

Internal Forced Convection. Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Parallel Circuits. Chapter

Introduction to Heat and Mass Transfer. Week 8

1 Finite difference example: 1D implicit heat equation

Finite-Elements Method 2

2.29 Numerical Fluid Mechanics Spring 2015 Lecture 9

Fault Tolerant Computing CS 530DL

Elliptic Problems / Multigrid. PHY 604: Computational Methods for Physics and Astrophysics II

Finite Difference Methods (FDMs) 1

HEAT TRANSFER FROM FINNED SURFACES

PDE Solvers for Fluid Flow

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

MTF071 Computational Fluid Dynamics of Turbulent

5. FVM discretization and Solution Procedure

Chapter 5 HIGH ACCURACY CUBIC SPLINE APPROXIMATION FOR TWO DIMENSIONAL QUASI-LINEAR ELLIPTIC BOUNDARY VALUE PROBLEMS

Computational Fluid Dynamics Prof. Dr. SumanChakraborty Department of Mechanical Engineering Indian Institute of Technology, Kharagpur

Appendix F. + 1 Ma 1. 2 Ma Ma Ma ln + K = 0 (4-173)

Lecture 9 Approximations of Laplace s Equation, Finite Element Method. Mathématiques appliquées (MATH0504-1) B. Dewals, C.

Chapter 2 HEAT CONDUCTION EQUATION

Chapter 2 HEAT CONDUCTION EQUATION

Introduction to Heat and Mass Transfer. Week 9

MATH 333: Partial Differential Equations

Ordinary Differential Equations (ode)

2.29 Numerical Fluid Mechanics Fall 2009 Lecture 13

Chapter 3. Formulation of FEM for Two-Dimensional Problems

Chapter 1 INTRODUCTION AND BASIC CONCEPTS

Finite Difference Methods for

Chapter 5 Time-Dependent Conduction

13 PDEs on spatially bounded domains: initial boundary value problems (IBVPs)

Introduction to Heat and Mass Transfer. Week 7

Butcher tableau Can summarize an s + 1 stage Runge Kutta method using a triangular grid of coefficients

CHAPTER 7. An Introduction to Numerical Methods for. Linear and Nonlinear ODE s

Quasi-linear first order equations. Consider the nonlinear transport equation

Ordinary Differential Equations

Introduction to Partial Differential Equations

Preliminary Examination in Numerical Analysis

Weighted Residual Methods

Motion Along a Straight Line

Math 251 December 14, 2005 Answer Key to Final Exam. 1 18pt 2 16pt 3 12pt 4 14pt 5 12pt 6 14pt 7 14pt 8 16pt 9 20pt 10 14pt Total 150pt

CS545 Contents XVI. Adaptive Control. Reading Assignment for Next Class. u Model Reference Adaptive Control. u Self-Tuning Regulators

Minimizing & Maximizing Functions

Solving PDEs with Multigrid Methods p.1

Chapter 9: Differential Analysis

The family of Runge Kutta methods with two intermediate evaluations is defined by

Lecture 16 : Fully Developed Pipe flow with Constant Wall temperature and Heat Flux

WRT in 2D: Poisson Example

Methods for Computing Periodic Steady-State Jacob White

Chapter. Triangles. Copyright Cengage Learning. All rights reserved.

q x = k T 1 T 2 Q = k T 1 T / 12

7.5 Operations with Matrices. Copyright Cengage Learning. All rights reserved.

1. Nonlinear Equations. This lecture note excerpted parts from Michael Heath and Max Gunzburger. f(x) = 0

Characteristic finite-difference solution Stability of C C (CDS in time/space, explicit): Example: Effective numerical wave numbers and dispersion

What are Numerical Methods? (1/3)

Lecture 10: Finite Differences for ODEs & Nonlinear Equations

MB4018 Differential equations

Differential equations. Background mathematics review

Introduction to Partial Differential Equations

1D heat conduction problems

Physics 432, Physics of fluids: Assignment #1 Solutions

BOUNDARY VALUE PROBLEMS

qxbxg. That is, the heat rate within the object is everywhere constant. From Fourier s

Constructing Taylor Series

Numerical solutions of nonlinear systems of equations

Physics of Everyday Phenomena. Chapter 2

(A) Opening Problem Newton s Law of Cooling

inter.noise 2000 The 29th International Congress and Exhibition on Noise Control Engineering August 2000, Nice, FRANCE

Introduction. Finite and Spectral Element Methods Using MATLAB. Second Edition. C. Pozrikidis. University of Massachusetts Amherst, USA

Physics 606, Quantum Mechanics, Final Exam NAME ( ) ( ) + V ( x). ( ) and p( t) be the corresponding operators in ( ) and x( t) : ( ) / dt =...

Quiescent Steady State (DC) Analysis The Newton-Raphson Method

Fundamentals of Heat Transfer Muhammad Rashid Usman

M.A. Botchev. September 5, 2014

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 9

ASSUMPTIONS: (1) Homogeneous medium with constant properties, (2) Negligible radiation effects.

Efficient solution of stationary Euler flows with critical points and shocks


Mon Jan Improved acceleration models: linear and quadratic drag forces. Announcements: Warm-up Exercise:

SECTION 7: CURVE FITTING. MAE 4020/5020 Numerical Methods with MATLAB

A Hybrid Method for the Wave Equation. beilina

Lecture 9. Systems of Two First Order Linear ODEs

The Shooting Method for Boundary Value Problems

Iterative Methods for Linear Systems

ENERGY ANALYSIS OF CLOSED SYSTEMS

FIND: (a) Sketch temperature distribution, T(x,t), (b) Sketch the heat flux at the outer surface, q L,t as a function of time.

Second-Order Linear ODEs (Textbook, Chap 2)

Novel determination of dierential-equation solutions: universal approximation method

Chap. 20: Initial-Value Problems

ONE DIMENSIONAL TRIANGULAR FIN EXPERIMENT. Current Technical Advisor: Dr. Kelly O. Homan Original Technical Advisor: Dr. D.C. Look

Transcription:

Part 6 Chapter Boundary-Value Problems PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Chapter Objectives Understanding the difference between initial-value and boundary-value problems. Knowing how to express an n th order ODE as a system of n first-order ODEs. Knowing how to implement the shooting method for linear ODEs by using linear interpolation to generate accurate shots. Understanding how derivative boundary conditions are incorporated into the shooting method.

Objectives (cont) Knowing how to solve nonlinear ODEs with the shooting method by using root location to generate accurate shots. Knowing how to implement the finite-difference method. Understanding how derivative boundary conditions are incorporated into the finite-difference method. Knowing how to solve nonlinear ODEs with the finite-difference method by using root location methods for systems of nonlinear algebraic equations.

Boundary-Value Problems Boundary-value problems are those where conditions are not known at a single point but rather are given at different values of the independent variable. Boundary conditions may include values for the variable or values for derivatives of the variable. Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Higher Order Systems MATLAB s ODE solvers are based on solving first-order differential equations only. To solve an n th order system (n>1), the system must be written as n first-order equations: dt z dx dz ht dx dt h T T 0 dx T Each first-order equation needs an initial value or boundary value to solve.

The Shooting Method One method for solving boundary-value problems - the shooting method - is based on converting the boundary-value problem into an equivalent initial-value problem. Generally, the equivalent system will not have sufficient initial conditions and so a guess is made for any undefined values. The guesses are changed until the final solution satisfies all the boundary conditions. For linear ODEs, only two shots are required - the proper initial condition can be obtained as a linear interpolation of the two guesses. Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Example Steady-state temperature distribution for a long, thin rod positioned between two constant temperature walls. Solve T a dt h T T 0 dx x=0 L with L=10 m, h =0.05 m -, T =00 K, T(0) = 300 K, and T(10) = 400 K. Assume no radial temperature gradient. First - break into two equations: convection conduction T T b dt z dx dz 0.0500 T dx dt h T T 0 dx

Example Code Code for derivatives: function dy=ex30(x,y) %linear ODE boundary-value problem heat conduction/convection p. 547 Chapra dy=[y();-0.05*(00-y(1))]; Code for 1 st shot try z(0)=z a1 =-5 [x,y]=ode45(@ex30, [0 10], [300-5]); Tb1=y(length(y)) >>ans Tb1 =569.7539 Code for nd shot try z(0)=z a =-0 [x,y]=ode45(@ex30, [0 10], [300-0]); Tb=y(length(y)) >>ans Tb = 59.5131

Interpolation Because it s a linear ODE, use linear interpolation to solve for the exact z(0)=z a ( z z ) ( z z ) ( T T ) z z ( z z ) ( T T ) ( T T ) ( T T ) z a a a1 a a1 b b1 a a1 a a1 b b1 b b1 b b1 (400 569.7539) 5 ( 0 ( 5)) 13.075 K/m (59.5131 569.7539) Now solve for the T(x) distribution: [t,y]=ode45(@ex30,[0 10],[300-13.075]);

Boundary Conditions Dirichlet boundary conditions are those where a fixed value of a variable is known at a particular location. Neumann boundary conditions are those where a derivative is known at a particular location. Shooting methods can be used for either kind of boundary condition.

Example Shooting Method with derivative boundary conditions (p. 549) Same as previous, except convection is on the left side. Solve: dt h T T 0 dx T convection conduction h=1 J/(m K s), k = 00 J/ (s m K) First - break into two equations: dt h T T 0 dx convection T = 00 K x=0 L a b dt z dx dz 0.0500 T dx T b

Boundary condition at a: Solve for gradient =z a : Guess T a1 = 300K: function dy=ex30(x,y) %linear ODE boundary-value problem heat conduction/convection %p. 547 Chapra dy=[y();-0.05*(00-y(1))]; end dt hac( T T (0)) kac (0) dx dt h (0) ( T (0) T ) dx k dt 1 1 K za 1 (0) ( T (0) T ) (300 00) 0.5 dx 00 00 m First guess >> [x,y]=ode45(@ex30,[0 10],[300,0.5]); >> Tb1=y(length(y)) Tb1 = 683.5088 Result is higher than known T b = 400 K, so make a new guess.

nd guess T a = 150 K, z a = -0.5 [x,y]=ode45(@ex30,[0 10],[150,-0.5]); >> Tb=y(length(y)) Tb = -41.7544 First guess : Ta1 = 300K, za1 =0.5K/m Tb1=683.5088 K Second guess: Ta= 150K, za = -0.5 Tb=-41.7544 K So we know that Ta is in between 300 and 150K. Using linear interpolation, ( T T ) ( T T ) ( T T ) T T ( T T ) ( T T ) ( T T ) ( T T ) T a a a1 a a1 a a1 a a1 b b1 b b1 b b1 b b1 150 300 300 (400 683.5088) 41.3643K 41.7544 683.5088 And z a = 0.068 K/m.

Difference between Dirichlet and Nuemann BC problems Difference in the last two problems was that when the derivative B.C. is used, we don t know Ta. Therefore, must guess Ta and solve for za, and then run. In the first problem, Ta is known, so we guess za only.

The Shooting Method for Nonlinear ODEs For nonlinear ODEs, interpolation between two guesses will not necessarily result in an accurate estimate of the required boundary condition. Instead, the boundary condition can be used to write a roots problem with the estimate as a variable.

Example dt dx Solve with =.7x10-9 K -3 m -, L=10 m, h =0.05 m-, T =00 K, T(0) = 300 K, and T(10) = 400 K. d T dx h T T T 4 T 4 0 First - break into two equations: dt z 4 4 dx ht T T T 0 dz 0.05 00.710 1.610 dx 9 9 4 T T

Example Code Code for derivatives: function dy=dydxn(x,y) dy=[y(); -0.05*(00-y(1))-.7e-9*(1.6e9-y(1)^4)]; Code for residual: function r=res(za) [x,y]=ode45(@dydxn, [0 10], [300 za]); r=y(length(x),1)-400; Code for finding root of residual: fzero(@res, -50)%50 is the guess Code for solving system: [x,y]=ode45(@dydxn, [0 10], [300 fzero(@res, -50) ]);

Finite-Difference Methods The most common alternatives to the shooting method are finite-difference approaches. In these techniques, finite differences are substituted for the derivatives in the original equation, transforming a linear differential equation into a set of simultaneous algebraic equations.

Finite-Difference Example Convert: d T dx h T T 0 into n-1 simultaneous equations at each interior point using centered difference equations: dt Ti 1T i Ti 1 dx x Ti 1T i Ti 1 h T Ti 0 x T hx T T hx T i1 i i1 (.16)

Finite-Difference Example (cont) Since T 0 and T n are known, they will be on the right-hand-side of the linear algebra system (in this case, in the first and last entries, respectively): h x 1 1 h x 1 1 h x T 1 T T n1 h x T T 0 h x T h x T T n

Example of finite-difference method for linear ODE Use the finite-difference approach to solve the same problem as before. Use 4 interior nodes with segment length of x = m. For node 1: -T 0 +.T 1 T = 40 Substituting T 0 = 300 gives Assemble all the equations:.t 1 T = 340. 1 0 0 T 340 1 1. 1 0 T 40 0 1. 1 T3 40 0 0 1. T4 440

>> A=[. -1 0 0;-1. -1 0; 0-1. -1; 0 0-1.]; >> b=[340 40 40 440]'; >> T=A\b T = 83.660 83.1853 99.7416 336.46

Derivative Boundary Conditions Neumann boundary conditions are resolved by solving the centered difference equation at the point and rewriting the system equation accordingly. Use Chapra Tables p. 454-457. For example, if there is a Neumann condition at the T 0 point, dt T1 T 1 dt T 1 T1 x dx 0 x dx 0 T hx T T hx T 1 0 1 dt T1 x hx T0 T1 hx T dx 0 dt hx T0 T1 hx T x dx 0 Substitute T -1 into.16 (.18)

Example Incorporating Derivative Boundary Conditions Problem: Generate the finite-difference solution for a 10-m rod with x = m, h = 0.05 m -, T = 00 K, and the boundary conditions: T a = 0 and T b = 400 K. Note that the first condition means that the slope of the solution should approach zero at the rod s left end. Aside from this case, also generate the solution for dt/dx = -0 at x =0. Solution. Eq (.18) can be used to represent node 0 as.t 0 - T 1 = 0.05* *00-0=40

Write Eq.(.16) for the interior nodes. For example, for node 1, -T 0 +.T 1 T = 40 A similar approach can be used for the remaining interior nodes. The final system of equations can be assembled in matrix form as. T 40 0 1. 1 T 1 40 1. 1 T 40 1. 1 T 40 3 1. T 440 4

>> A=[. - 0 0 0;-1. -1 0 0; 0-1. -1 0;0 0-1. -1;0 0 0-1.]; >> b=[40 40 40 40 440] '; T=A\b T = 43.078 47.3306 61.0994 87.088 330.4946

For derivative at x = 0 is set to -0 K/m, the simultaneous equations are Solution: >>T = 38.710 301.0981 94.1448 306.004 339.100. T 10 0 1. 1 T 1 40 1. 1 T 40 1. 1 T 40 3 1. T 440 4

Plot of Soln to Example.6 (derivative boundary conditions)

Finite-Difference Method for Nonlinear ODEs Root location methods for systems of equations may be used to solve nonlinear ODEs. Another method is to adapt a successive substitution algorithm to calculate the values of the interior points. dt h T T T T 4 4 0 dx Ti 1T i Ti 1 0 h T T T T x Collecting terms, 4 4 T ( hx ) T T hx T x T T 4 4 i1 i i1 i

Solve for the left-side T i in terms of the nonlinear T i on the right side: T i hx T x T T T T 4 4 i i1 i1 hx Assume initial values of T i all = 0. Solve for T 1. Substitute this new value of T 1, and solve for T. Continue solving for all T n. This is one iteration. Now use these new values to complete a second iteration. Continue these iterations until tolerance is met for all T i.

Example of Finite-Difference Approach for Nonlinear ODEs Solve the previous convection/radiation problem using finiteelement and successive substitution. with =.7x10-9 K -3 m -, L=10 m, h =0.05 m-, T =00 K, T(0) = 300 K, and T(10) = 400 K. Use four interior nodes with a segment length of x = m. Recall that we solved the same problem with the shooting method in Example.4.

T T T T 9 4 4 0.05() 00.7 x 10 () (00 0 ) 300 0 1 159.43 9 4 4 0.05() 00.7 x 10 () (00 0 ) 159.43 0 9 4 4 0.05() 00.7 x 10 () (00 0 ) 97.9674 0 3 4 0 1 3 4 5 0.05() 0.05() 0.05() 97.9674 70.4461 9 4 4 0.05() 00.7 x 10 () (00 0 ) 70.4461 400 6.8704 0.05() Continue until converging to final result: T T T T T T 300 50.487 36.96 45.7596 86.491 400