Download Approximation for Solving Ordinary Differential Equations and more Slides Numerical Methods in Engineering in PDF only on Docsity!
CE 341/441 - Lecture 15 - Fall 2004
p. 15.
LECTURE 15APPLICATIONS OF FD APPROXIMATIONS FOR SOLVING ORDINARYDIFFERENTIAL EQUATIONSOrdinary Differential Equations Initial Value Problems • For Initial Value problems (IVP’s), conditions are specified at only one value of the
independent variable
→
initial conditions (i.c.’s)
- For example a simple harmonic oscillator is described by -^
= location
→
dependent variable
-^
= time
→
A independent variable
d
2 y^2 dt
B
dy ----- dt
-^
Cy
g t
y^
)^
y^ o
dy ----- dt
)^
V
o
=
y t
CE 341/441 - Lecture 15 - Fall 2004
p. 15.
Boundary Value Problems • For Boundary Value Problems (BVP’s) conditions are specified at two values of the
independent variable (which represent the actual physical boundaries)
- Example General Initial Value Problems • Any IVP can be represented as a set of one or more 1st order d.e.’s each with an i.c.• Example
and we can develop a system of 2 first order O.D.E.’s which are coupled
d
2 y d x
2
D
dy ----- dx
-^
Ey
h x
(^
y^
)^
y^ o
y L (
)^
y^ l
A
d
2 y^2 dt
B
dy ----- dt
-^
C
g t
y^
)^
y^ o
dy ----- dt
)^
v^ o
z^
dy ----- dt
dy ----- dt
-^
z =
y^
)^
y^ o =
dz ----- dt
B ---- A
–^
z^
C ---- A
–^
g t
( ) A
z^
)^
v^ o =
CE 341/441 - Lecture 15 - Fall 2004
p. 15.
Solution to a 1st Order Single Equation IVP
with specified i.c.
Euler Method • The Euler method is a 1st order method• We evaluate the o.d.e. at node
and use a forward difference approximation for
⇒
⇒
dy ----- dt
-^
f^
y t ,(
y t
o (^
)^
y^ o
j^
dy ----- dt
j
dy ----- dt
j
f^
y^
, j t^ j (^
y^
j^
1 +^
y^
j
t
-^
f^
y^
j^
t^ , j
(^
y^
j^
1 +^
y^
j^
t f
y^
j^
t^ , j
(^
CE 341/441 - Lecture 15 - Fall 2004
p. 15.
- Simply “march” forward in time - From time level
(time =
(time =
equals the slope at
simply add
to
j^
t^ j
j^
t^ j
1 +^
t^ j
t
yj+
yj
tj^
tj+
∆
t f (t
, yj
)j
f^
t^ j
y^
j , (^
)^
t^ j
y^
j^
1 +^
t f
t^ j
y j , (^
)^
y^
j
CE 341/441 - Lecture 15 - Fall 2004
p. 15.
- Discretize the o.d.e. at a general node• Approximate
using a forward difference approximation
⇒
Next Value = Previous Value + Run
Slope
- Equation relates a known time level
to the new time level
.^
This process is known
as “time stepping” or “time marching”
i dy ----- dt
i
y^ i
y i
=
dy ----- dt
i
y^ i
1 +^
y^ i
t
-^
y^ i
y i
=
y^ i
1 +^
y^ i
t y
i^
y^ i
×
i^
i^
CE 341/441 - Lecture 15 - Fall 2004
p. 15.
- The i.c. indicates that• Take 1st time step
⇒
where
in this case
at
at
y^ o
= i
i^
t^ i
i^
t^
t^ o
⋅^
i ∆
t
t^ o
y^1
y^ o
ty
o^
y^ o
y^1
×
×
y^1
t^1
i^
i^
y^2
y^1
t y
1
y^1
y^2
×
×
y^2
t^2
CE 341/441 - Lecture 15 - Fall 2004
p. 15.
at
at
- We can continue time marching
t
Numerical Solution using
and the Euler
Method
Numerical Solution using
and the Euler
Method
Exact
Solution
1.0000 (i.c.)
1.0000 (i.c.)
y^5
t^5
y^6
t^6
t^
t^
CE 341/441 - Lecture 15 - Fall 2004
p. 15.
General Observations for Solving IVP’s • Solution to o.d.e.’s can be very simple using finite difference approximations to repre-
sent differentiation
- Accuracy is dependent on the time step
! We need to understand the error behavior
, the solution gets better
- IVP’s are solved using a time marching process
→
Begin at one end and march forward
up to the desired point or indefinitely
- At each time step, we introduce a new unknown,
, which is solved for by writing
and solving the discrete form of the IVP at node
j.
Solutions to Boundary Value Problems • Boundary value problems must be 2nd order o.d.e.’s or higher• We apply FD approximations to the various terms in the differential equation to obtain
discrete approximations to the differential equations at points in space.
- Unknown functional values at the nodes will be coupled and require the solution of a
system of simultaneous equations
→
matrix methods.
t
t^
y^
j^
1
CE 341/441 - Lecture 15 - Fall 2004
p. 15.
equations (1 for each interior point and 1 for each boundary
node) to solve for the
unknowns:
... ...
n^
n^
y^0
y^2
y^1
-^
y^0
A
x (^
y
1
B
x (^
y^3
y^2
-^
y^1
A
x (^
y
2
B
x (^
y^
j^
1 +^
y^
j
-^
y^
j^
1
-^
A
x (^
y^
j
B
x (^
y^ n
y^ n
1
-^
y^ n
2
–^
A
x (^
y^
n^
1
B
x (^
y^ n
1 +^
y^ n
-^
y^ n
1
-^
A
x (^
y^
n
B
x (^
y^ n
1 +^
CE 341/441 - Lecture 15 - Fall 2004
p. 15.
- Collect coefficients of unknowns and write in matrix form:where
α
α
α
.^
.^
.^
.^
.^
.^
α
α
α
y^0 y^1 y^2 y^3 y^ n
1
1
B
x (^
B
x (^
B
x (^
B
x (^
B
x (^
α
–^
A
x (^
CE 341/441 - Lecture 15 - Fall 2004
p. 15.
- Solution strategies include:
- Iterative solution of algebraic equations puts the nonlinear term on the r.h.s. and iter-
ates until convergence. There may be convergence problems.
- Linearization of the nonlinear terms. Use Taylor series to approximate the nonlinear
terms.