You are on page 1of 16

Introduction to Computational Methods in Chemical Engineering

by Santosh Ansumali and Kwak Sang Kyu

Ordinary Differential Equations


For most of the Chemical engineering problems in real life analytical solution is not possible!
We need to solve them numerically!

With Initial condition We can rewrite our equation as:

CH2007: Computational Methods in Chemical Engineering

Eulers Method

Where This method has an error of In general

Where

CH2007: Computational Methods in Chemical Engineering

Implicit Methods
Forward Euler Method:

Evaluation of (n+1)th stage depends only information on nth stage !


Backward Eulers Method:

In general, we would need an iterative scheme to advance further ! In general, implicit method allows for much larger time steps!

CH2007: Computational Methods in Chemical Engineering

Backward Euler Method: Linear Case


dy = ! y +1 dt
With Initial Condition

y (0) = 0

Which can be made explicit as

CH2007: Computational Methods in Chemical Engineering

Backward Euler Method: NonLinear Case

With Initial Condition

CH2007: Computational Methods in Chemical Engineering

Multi-Step Method
We Know from central difference formula:

Leap-Frog Method:

This is an example of 2-Step method!

Compare it with the trapezoidal rule result:

CH2007: Computational Methods in Chemical Engineering

Explicit Multi-Step Method


Explicit Adams-Bashforth Methods: 1 Step : 2 Step : 3 Step :

Accuracy is

for a r-step method !

CH2007: Computational Methods in Chemical Engineering

Implicit Multi-Step Method


1 Step:

2 Step:

3 Step :

Notice coefficient in front of f(y) add up to one.


Accuracy is
CH2007: Computational Methods in Chemical Engineering
9

Single step methods are self starting while multi-

Single-Step versus Multi-Step Method

step methods require some other method to start with. The time step can be changed at any stage in single step methods. Single step methods can work much better in presence of discontinuity. Higher order single step method may be more expensive due to evaluation of function too many time per time step.
CH2007: Computational Methods in Chemical Engineering
10

Accuracy
Eulers Method: Taylors Series:

CH2007: Computational Methods in Chemical Engineering

11

Stability:Forward Euler
dy = "100 y + 1 dt
Forward Euler Scheme:

Take

Method is unstable !!!


CH2007: Computational Methods in Chemical Engineering
12

Stability: Backward Euler

Both methods have similar error why forward Euler is unstable but Backward Euler is stable?

CH2007: Computational Methods in Chemical Engineering

13

Stability Analysis: Growth of Error


Eulers Scheme: Taylor Series for Exact Solution:

Subtracting the two equations give equation for error

as:

By taking absolute values on both sides:

CH2007: Computational Methods in Chemical Engineering

14

Stability Analysis
Which means: Or,

Thus, we can say that error is growing if:

So Method is stable or error is bounded with time if:

Or,

CH2007: Computational Methods in Chemical Engineering

15

Stability Analysis
Thus, forward Eulers method is stable only if:

Thus, we cannot take step size larger than this limit !


For Backward Euler:

Taking absolute magnitude, we see that:

So Method is stable for every value of h!


CH2007: Computational Methods in Chemical Engineering
16