Docsity

Solving Ordinary Differential Equations: Boundary-Value Problems, Study notes of Differential Equations

Partial preview of the text

Download Solving Ordinary Differential Equations: Boundary-Value Problems and more Study notes Differential Equations in PDF only on Docsity!

INTRODUCTION Cho,^ Hyoung KyuCho,^ Hyoung KyuDepartment^ of^ Nuclear^ EngineeringDepartment^ of^ Nuclear^ EngineeringSeoul^ National^ UniversitySeoul^ National^ University

TO

NUMERICAL

ANALYSIS

11.^ ORDINARY^ DIFFERENTIAL EQUATIONS:BOUNDARY‐

VALUE^ PROBLEMS

11.1^ Background11.2^ The^ Shooting^ Method11.3^ Finite^ Difference^ Method11.4^ Use^ of^ MATLAB^ Built

‐In^ Functions^ for^ Solving^ Boundary

Value^ Problems

11.5^ Error^ and^ Stability^

in^ Numerical^ Solution^ of^ Boundary

Value^ Problems

11.1^ Background

^ Example^ of^ BVP^ ^ Modeling^ of^ temperature

distribution^ in^ a^ pin^ fin^ used

as^ a^ heat^ sink^ for^ cooling^ an

object

ܶ^ :^ temperature^ of^ the^ surrounding௦^

air ܽ^ andܽ^ :^ coefficientsଵ^ ଶ ^ Boundary^ conditions:ܶ^ and஺^

^ Problem^ statement^ of^

a^ second‐order^ boundary value^ problem

^ Domain:ܽ^ ܾ൑ ݔ ൑ ^ Dirichlet boundary^ conditions ^ Neumann^ boundary^ conditions ^ Mixed^ boundary^ conditions

Possible^ to^ have^ nonlinear^ boundary

conditions^!

11.1^ Background

^ BVP^ of^ higher^ order^ ODEs^ ^ Require^ additional^ boundary

conditions  Typically the values of higher^ derivatives^ of^ ݕ

^ For^ example,^ ^ The^ differential^ equation

that^ relates^ the^ deflection^ of^ a^ beam,

ݕ,^ due^ to^ the^ application^ of^ a distributed^ load,^ ሻݔሺ݌,^ is:  Four^ boundary^ conditions^ are^ necessary.

ܧ:^ elastic^ modulus^ of^ the^ beam's

material

ܫ:^ area^ moment^ of^ inertia^ of

the^ beam's cross‐sectional area

11.2^ The^ Shooting^ Method

^ Shooting^ method^ ^ Boundary^ value^ problem

^ initial^ value^ problem  For example, a BVP involving^ an^ ODE^ of^ second‐order  A system of two first‐order^ ODEs  Solution procedure  BCs given at the first point:^ initial^ conditions^ for^ the^ system  Additional initial conditions^?^ Guessed^!  The system can be solved!  Solution can be obtained^ at^ the^ end^ point^ of^ the^ domain.  Compare them with the^ BCs^ at^ the^ end^ point^ of^ the^ domain.  Check the error  The guessed initial values^ are^ changed^ then^ the^ system

is^ solved^ again. ^ Repeated^ until^ the^ numerical

solution^ agrees^ with^ the^ BCs.

11.2^ The^ Shooting^ Method

^ Shooting^ method^ for^ a

two‐point^ BVP  BVP with a Second‐order^ ODE  Step (^1)  Step 2: first guess for^ the^ initial^ value  Step 3: Second guess

No^ initial^ condition

11.2^ The^ Shooting^ Method

^ Estimating^ the^ slope^ at

ܽൌ ݔ  Starts by guessing two^ values^ for^ the^ slope^ of^ ሻݔሺݕ

at^ the^ first^ point^ of^ the^ domain

^ Two^ solutions^ with^ two^ guesses ^ Estimate^ new^ value ^ Linear^ interpolation ^ Bisection^ method ^ Secant^ method

11.2^ The^ Shooting^ Method

^ Example^11 ‐1:^ Temperature

distribution^ in^ a^ pin^ fin.^ Solving

a^ second‐order^ ODE^ (BVP) using^ the^ shooting^ method.

11.2^ The^ Shooting^ Method

^ Example^11 ‐1:^ Temperature

distribution^ in^ a^ pin^ fin.^ Solving

a^ second‐order^ ODE^ (BVP) using^ the^ shooting^ method. % Solving Example 11-1clear alla=0; b=0.1; TINI=473; wINI1=-1000; h=0.001; Tend=293;wINI1=(TINI-Tend)/(a-b);[x, T1, w] = ...Sys2ODEsRK2(@odeChap11Exmp1dTdx,@odeChap11Exmp1dwdx,a,b,h,TINI,wINI1);n=length(x) ;fprintf('The temperature at x=0.1 is %5.3f, for initial value of dt/dx= %4.1f\n',...T1(n) ,wINI1)wINI2=0.5*wINI1;[x, T2, w] = ...Sys2ODEsRK2(@odeChap11Exmp1dTdx,@odeChap11Exmp1dwdx,a,b,h,TINI,wINI2);fprintf('The temperature at x=0.1 is %5.3f, for initial value of dt/dx= %4.1f\n',...T2(n) ,wINI2)plot (x, T1,x,T2);hold on;

11.2^ The^ Shooting^ Method

^ Example^11 ‐1:^ Temperature

distribution^ in^ a^ pin^ fin.^ Solving

a^ second‐order^ ODE^ (BVP) using^ the^ shooting^ method. Told=T1(n);Tnew=T2(n);error=abs(Tend-Tnew);while (error>1.0e-5)wINI3 = wINI1 + (Tend - Told) * (wINI2 - wINI1) / (Tnew - Told);[x, T3, w] =...Sys2ODEsRK2(@odeChap11Exmp1dTdx,@odeChap11Exmp1dwdx,a,b,h,TINI,wINI3);fprintf('The temperature at x=0.1 is %5.3f, for initial value ofdt/dx= %4.1f\n', ...T3(n) ,wINI3)Told=Tnew;Tnew=T3(n);wINI1=wINI2;wINI2=wINI3;error=abs(Tend-Tnew);plot (x, T3);hold on;end

11.2^ The^ Shooting^ Method

^ Shooting^ method^ using

the^ bisection^ method  Withܹ ݕܻ൐ (^) ு ௕,ு ௕  Withܹ ݕܻ൏ (^) ௅ ௕,௅ ௕  At new iteration

11.2^ The^ Shooting^ Method

^ Shooting^ method^ using

the^ bisection^ method % Solving Example 11-1clear alla=0; b=0.1; TINI=473; wH=-1000; h=0.001; Tend=293;[x, T1, w] = ...Sys2ODEsRK2(@odeChap11Exmp1dTdx,@odeChap11Exmp1dwdx,a,b,h,TINI,wH);n=length(x) ;fprintf('The temperature at x=0.1 is %5.3f, for initial value of dt/dx= %4.1f\n',...T1(n) ,wH)wL=-3500;[x, T2, w] = ...Sys2ODEsRK2(@odeChap11Exmp1dTdx,@odeChap11Exmp1dwdx,a,b,h,TINI,wL);fprintf('The temperature at x=0.1 is %5.3f, for initial value of dt/dx= %4.1f\n',...T2(n) ,wL)plot (x, T1,x,T2);hold on;

11.2^ The^ Shooting^ Method

^ Shooting^ method^ using

the^ bisection^ methodThe temperature at x=0.1^ is^ 536.502,^ for^ initial^ value

of^ dt/dx=^ ‐1000.

The^ temperature^ at^ x=0.1^ is^ 198.431,

for^ initial^ value^ of^ dt/dx=^ ‐3500.

The^ calculated^ temperature^

at^ x^ =^ 0.1^ is^ 293.000^ K.

The^ solution^ was^ obtained^ in

21 iterations.

11.2^ The^ Shooting^ Method

^ Shooting^ method^ using

the^ secant^ method  ܧݕ ൌܻെ (^) ௜ିଵ ௕,௜ିଵ ௕  ܧݕ ൌܻെ (^) ௜ ௕,௜ ௕  ܧs from the previous two^ iterations^ can be both positive, negative,^ or they can have opposite^ signs ^ Additional^ comments^ ^ BVPs^ with^ derivative,

or^ mixed,^ boundary^ conditions  When derivative boundary^ conditions^ are^ prescribedat the endpoint, the calculated^ value^ of^ the^ derivative must be evaluated numerically.