0% found this document useful (0 votes)
54 views3 pages

AE305 Chapter 2

The document discusses numerical solutions of ordinary differential equations (ODEs). It covers: 1) Euler's method for solving first-order ODEs, which uses a first-order Taylor series expansion to approximate the solution at each time step. 2) The discretization of independent variables, such as spatial or time steps, which is required for numerical solutions of ODEs. 3) An example of using Euler's method to solve the first-order ODE describing the velocity of a falling body, where the slope is given by the ODE itself.

Uploaded by

Irzum Malik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views3 pages

AE305 Chapter 2

The document discusses numerical solutions of ordinary differential equations (ODEs). It covers: 1) Euler's method for solving first-order ODEs, which uses a first-order Taylor series expansion to approximate the solution at each time step. 2) The discretization of independent variables, such as spatial or time steps, which is required for numerical solutions of ODEs. 3) An example of using Euler's method to solve the first-order ODE describing the velocity of a falling body, where the slope is given by the ODE itself.

Uploaded by

Irzum Malik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CHAPTER 2

NUMERICAL SOLUTIONS OF
ORDINARY DIFFERENTIAL EQUATIONS
• Solutions of 1st order ODEs
• Euler’s method
• Improved Euler Method
• Runge Kutta (RK) Methods
• Adaptive stepping
• Stability of RK methods
• Solutions of 2nd and higher order ODEs
• Solutions of coupled ODEs
• Solutions of boundary value problems

İ.H. TUNCER & Y. ÖZYÖRÜK 21 AE305 - Numerical Methods in Aerospace Engineering @ 20201

Differential Equations
An equation which is composed of an unknown function and its derivatives with respect to
independent variables is called a differential equation .

• When the function involves one independent variable, it is called an


Ordinary Differential Equation, ODE .

E.g. Airplane accelerating on ground :


W dV
= T − D(V ) − kfric [W − L(V )]
g dt

• This is in contrast to a Partial Differential Equation, PDE that involves two or more
independent variables.
E.g. Unsteady heat diffusion through a 1-D bar :
∂T ∂2T
=α 2
∂t ∂x

İ.H. TUNCER & Y. ÖZYÖRÜK 22 AE305 - Numerical Methods in Aerospace Engineering @ 20201

Differential Equations (cont’d)


• Differential equations are also classified according to their order : The highest derivative
determines the order of the differential equation. A second order eqn. would include a
second derivative, and so on so forth.
First-order examples
dI (t) P − I (t)
A Covid-19 spread model : =β I (t), P : population, I : infected # of people
dt P
W dV
A/C velocity on ground : = T − D(V ) − kfric [W − L(V )], T : thrust, D : drag, L : lift
g dt
∂u ∂u
Convection equation : +a = 0, u : quantity convected, a : convection speed
∂t ∂x

Second-order examples
d 2x dx
Mass-spring-damper : m +c + kx = 0, m : mass, c : damping cons, k : spring cons
dt 2 dt
2 2
∂ y ∂ y
Wave equation for a string : − a2 2 = 0, y : discplacement, a : wave speed
∂t 2 ∂x

İ.H. TUNCER & Y. ÖZYÖRÜK 23 AE305 - Numerical Methods in Aerospace Engineering @ 20201
Solution of ODEs - Boundary Conditions
For the solution of an nth order ordinary differential equation, n conditions are required to
obtain a unique solution.

• If all the conditions are specified at the beginning of the solution domain, then the
problem is called an initial-value problem, IVP .
2
m ddt x2 + c dx
dt + kx = 0 2nd-order ODE
Conditions:
x|t=0 = x0 −→ IC #1
dx
dt |t=0 = v0 −→ IC #2
(illustration : wiki)

• In boundary-value problems, BVP, the conditions are specified at both ends of the
solution domain.
2
Equation : ddxT2 + kq̇ = 0 2nd-order ODE
Boundary Conditions:
T |x=0 = T0 −→ BC #1
−k dT |
dx x=L
= qL00 −→ BC #2

İ.H. TUNCER & Y. ÖZYÖRÜK 24 AE305 - Numerical Methods in Aerospace Engineering @ 20201

Solution of ODEs - Variable Discretization

• Numerical solutions can only be obtained for discrete values of the independent variables
• Consider a function y (x), where x is the spatial coordinate. y is the dependent variable,
and x is the independent variable.
• Then, treating the problem numerically requires discretization of the independent variable
first, and assigning indices to the discrete points.

• If spacing between two consequtive discrete


points is fixed and equal to ∆x:
xi = xo + (i − 1)∆x, i = spatial index 1..N
• The dependent variable at the discrete point
(i) is then denoted by yi ≡ y (xi ) yi ≡ y (xi )

• If the indepenent variable is time, the


convention is to use n as the index: tn and
y n ≡ y (tn ).

İ.H. TUNCER & Y. ÖZYÖRÜK 25 AE305 - Numerical Methods in Aerospace Engineering @ 20201

Solution of 1st Order ODEs - Euler’s Method


• A first order ordinary differential equation forms an initial value problem and is of the form
dy
y0 ≡ = f (x, y )
dx

• Numerical methods to solve an initial value problem is based on the first order Taylor
Series Expansion, which is known as Euler’s method :

dy
y (x + ∆x) = y (x) + ∆x + O(∆x 2 )
dx (x,y )
y (x + ∆x) = y (x) + ∆x y 0 (x, y )
y (x + ∆x) = y (x) + ∆x f (x, y )
yi+1 = yi + ∆x f (xi , yi )

which is of the form Next-Value = Previous-Value + Step-Size × SLOPE≡ODE


• Note that the slope in TSE is provided by the ODE itself. This formula can be applied
step by step to compute the solution along the independent variable.
İ.H. TUNCER & Y. ÖZYÖRÜK 26 AE305 - Numerical Methods in Aerospace Engineering @ 20201
Solution of 1st Order ODEs - Euler’s Method (cont’d)
Example: Free-falling body motion

• The velocity of a free falling body may be modeled by


Newton’s second law - Conservation of Momentum • This is a 1st order ODE in the form of
equation: v 0 = f (t, v )
~
~ = m~a or d~v = F
F
dt m • Fortunately, the analytical solution may
where F~ is the net force on the body, which is be obtained by change and separation of
composed of gravitational force F ~ G and the upward variables (y = mgm−cv ).
force due to air resistance F~R . For a zero initial velocity of the object,
the solution is given by
~
F = ~G − F
F ~R
gm
= (mg − cv )êz v (t) = (1 − e −(c/m)t )
c
• Air resistance, drag, can be formulated in a variety of
ways. Above is a simple one which is linearly
proportional to velocity, where c is the drag coefficient. • However, many mathematical models
may not be solved analytically, such as
• The governing equation for downward velocity then when FR = cv 2 is assumed!.
becomes
dv mg − cv c
= =g− v
dt m m

İ.H. TUNCER & Y. ÖZYÖRÜK 27 AE305 - Numerical Methods in Aerospace Engineering @ 20201

Solution of 1st Order ODEs - Euler’s Method (cont’d)

• If the initial condition for the velocity is given at time t1 , the velocity of the object at a
later time t2 = t1 + ∆t. The new value is in turn employed to extend the computation to
the next time step t3 = t2 + ∆t and so on.
NewValue = OldValue + StepSize × Slope
= OldValue + StepSize × ODE
time step # time velocity update
n =1 t = t1 v = v 1 Initial condition
n =2 t2 = t1 + ∆t v 2 = v 1 + ∆t g − mc v 1 
n =3 t3 = t2 + ∆t v 3 = v 2 + ∆t g − mc v 2 
n =4 t4 = t3 + ∆t v 4 = v 3 + ∆t g − mc v 3
... ... ... 
n tn = tn−1 + ∆t v n = v n−1 + ∆t g − mc v n−1
n+1 n c n
n+1 tn+1 = tn + ∆t v = v + ∆t g − m v

• Note that the slope in Euler method is evaluated at the beginning of the interval, which does not
represent the average slope over the interval!

İ.H. TUNCER & Y. ÖZYÖRÜK 28 AE305 - Numerical Methods in Aerospace Engineering @ 20201

IVPs - Euler Method (cont’d)

!−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
! . . A SIMPLE EULER SOLVER f o r ODEs ! . . Solution loop
! . . AE305 − N u m e r i c a l Methods do w h i l e ( time . l t . finaltime )
!−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− time = time + stepsize
Module f r e e _ f a l l i n g _ b o d y _ d a t a velocity = velocity + ODE ( velocity )∗stepsize
grav = 9 . 8 1 w r i t e ( 1 , ” ( 2 f 1 2 . 3 ) ” ) time , velocity
fric = 1 2 . 5 enddo
xmass = 7 0 .
End module ! . . Close the output file
close (1)
Program EULER
c h a r a c t e r ∗40 fname ! . . P l o t t h e s o l u t i o n w i t h ” x g r a p h ” , ” xmgr ” o r ” g n u p l o t ” on←-
L i n u x X−windows
! . . Read t h e s t e p s i z e ! c a l l SYSTEM( ” xg v e l o c i t y . d a t &”)
p r i n t ∗,” ” ! c a l l SYSTEM( ” xmgr v e l o c i t y . d a t &”)
p r i n t ∗, ” E n t e r S t e p S i z e and F i n a l T i m e :> ” ! c a l l SYSTEM( ” g n u p l o t p l o t . g p l ” )
r e a d (∗ ,∗) stepsize , finaltime
stop
! . . open t h e o u t p u t f i l e End
p r i n t ∗ , ” E n t e r t h e o u t p u t f i l e name [ v e l o c i t y . d a t ] : ”
r e a d (∗ , ” ( a ) ” ) fname !−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
i f ( fname . eq . ” ” ) fname = ” v e l o c i t y . d a t ” ! . . D e f i n e t h e ODE a s a f u n c t i o n
open ( 1 , f i l e =fname , form=” f o r m a t t e d ” ) F u n c t i o n ODE ( vel )
use free_falling_body_data
! . . S e t t h e I n i t i a l C o n d i t i o n s and o u t p u t them ODE = grav − fric / xmass ∗ vel
time = 0. return
velocity = 0 . End
w r i t e ( 1 , ” ( 2 f 1 2 . 3 ) ” ) time , velocity

İ.H. TUNCER & Y. ÖZYÖRÜK 29 AE305 - Numerical Methods in Aerospace Engineering @ 20201

You might also like