0% found this document useful (0 votes)
123 views35 pages

Numerical Solution Methods

The document outlines numerical solution methods for initial value problems involving ordinary differential equations. It discusses explicit and implicit integration methods, including the Euler, trapezoidal, and backward Euler methods. Stability and stiffness of problems are also covered. Interpolation, quadrature, and their use in deriving integration formulas are explained. Predictor-corrector and Runge-Kutta methods are listed as topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views35 pages

Numerical Solution Methods

The document outlines numerical solution methods for initial value problems involving ordinary differential equations. It discusses explicit and implicit integration methods, including the Euler, trapezoidal, and backward Euler methods. Stability and stiffness of problems are also covered. Interpolation, quadrature, and their use in deriving integration formulas are explained. Predictor-corrector and Runge-Kutta methods are listed as topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Numerical Solution Methods

(Initial Value Problems)

Chemical Engineering Department


School of Engineering
2019-I
Outline
7.1 Introduction
7.2 Type of Method
7.3 Stability
7.4 Stiffness
7.5 Interpolation and Quadrature
7.6 Explicit Integration Methods
7.7 Implicit Integration Methods

2
Outline
7.8.1. Predictor-Corrector Methods
7.8.2. Runge-Kutta Methods
7.9 Extrapolation
7.10 Step Size Control
7.11 Chemical Engineering Problem
7.13 References

3
7.1 Introduction
In the chapter consider
numerical methods for Modeling of process
solving ordinary equipment often
differential equations requires a careful
(ODEs) of initial value inspection of start-up
type, in where the problems that lead to
conditions are specified differential equations of
at one boundary in time Batch Reactor initial value type
or space.

Plug-flow tubular reactor

4
7.1 Introduction
The initial conditions are  
The general form of the model equations of the previous examples can be
given when the process written as first order equations:
starts at t = 0, that is,
before the reactions are
allowed start.

The initial conditions for the above equations are values of () for an initial
Mathematical problems instant of time (usually, t=0).
related to these
conditions are called
initial value problem.

5
7.1 Introduction
 
The problem it can redefine, for such a case, we simply introduce one more dependent variable by replacing t
with, a new dependent variable, for which the differential equation is defined as:

And

Or in the general case,

 
Thus, we see that the new “dependent variable” is exactly equal to t. Therefore,

The new set now has N + 1 coupled ordinary differential equations. Thus, the standard form of Eq. (1) is
recovered, and we are not constrained by the time appearing explicitly or implicitly

6
7.2 Type of Method
The computation methods are generally of two types: explicit and implicit

  explicit methods, we mean that if we


By  The implicit methods, however, involve
know the value of y at the instant of solving equations for the unknown value
time , the calculation of the vector y at of the vector y at the time .
the next time requires only the known
values of the vector y and its derivatives
at the time and previous times.
The example of the implicit type is
the trapezoidal methods.

The example of the explicit type is


the Euler method.

7
7.2 Type of Method
 
The formula to calculate the vector y at time Euler method is
 

Here, we have presented the differential with

Where

To simplify the notation, the explicit Euler formula is rewritten

8
7.2 Type of Method
  example of the implicit formalism is the trapezoidal method. Here, the derivative at the time is
An
calculated using the Trapezoidal rule; that is,
 

The recursive formula for for the Trapezoidal rule is obtained by replacing as before

So that:

Equation (9) represents a set of N nonlinear algebraic equations, which must be solved by a trial and
error method such as Newton-Raphson or successive substitution for .

9
7.3 Stability
A stable problem is a problem for which small changes in the initial conditions elicit only small
changes in the solution.

Stability of numerical methods consider the model problem for λ ≤ 0 only. Even though we will study
only stability with respect to the model problem, it can be shown that the results of this analysis also
apply to other linear (and some nonlinear) problems.

A typical pattern for systems exhibiting decay behavior; that is, the maximum allowable step size
increases as time progresses. This is, indeed, a salient feature utilized by good integration packages
on the market, that is, to vary the step size in order to reduce the total number of steps to reach a
certain time. This increases computation speed.
Table 1: Comparison of Stability Behavior
Stable and No Stable and
Method Oscillation Oscillation Unstable
Euler 0<h<1 1<h<2 h>2
Trapezoid
Trapezoid 0<h<2 2<h<ꝏ none
none
Backward
Backward Euler
Euler 0<h<ꝏ none
none none
none
10
7.4 Stiffness
• A problem is stiff if it contains widely varying time scales, that’s mean, some
components of the solution decay much more rapidly than others.
• A problem is stiff if the step size is dictated by stability requirements rather than
by accuracy requirements.
• A problem is stiff if explicit methods don’t work, or work only extremely slowly.
• A linear problem is stiff if all of its eigenvalues have negative real part, and the
stiffness ratio (the ratio of the magnitudes of the real parts of the largest and
smallest eigenvalues) is large.
• More generally, a problem is stiff if the eigenvalues of the Jacobian off differ
greatly in magnitude

11
•• Considering,
   At the beginning the solution is controlled by the fast
exponential term .
And after a very small period (), this transitory part will finish
and the system is controlled by the slow exponential term .

If , the analytical solution is: The values -1 and -1001 are the roots of equation.

 To ensure the stability of an explicit method such as Euler, the


step size should be:

Where is the maximum eigenvalue (or root) of the system.


Then, in this case, the step size has to be 0,0019.
Although the transitory part appears only in a small fraction of
the integration interval, it controls the maximum allowed step
size.

12
7.5 Interpolation and Quadrature
Interpolation and quadrature are numerical approximations to integration. They
can be very useful to calculate values of a function when we have few points. For
the application of these methods it is necessary that the points are equally spaced.
 
Consider n+1 points tn-1, tn, tn+1 and the coresponding values yi = f(ti). The forward
difference in finite difference terms is: and can be related to the first order
derivative:  𝑑𝑦 ∆ 𝑦 𝑛 𝑦 𝑛+1 − 𝑦 𝑛
≈ = (11)
𝑑𝑡 ∆𝑡 h
 )

 we can write the Newton backward interpolation formula:

13
•  Knowing the values of we can calculate the derivative with respect to tn. Equation
(13) can be used to calculate higher order derivatives and integrals. In addition,
we can write this formula in terms of derivatives (equally spaced times) for
functions of higher order.
7.6 Explicit Integration Methods
In the explicit methods we can calculate the value of y for a time tn+1, knowing the
values of y and its derivatives in the time tn and previous times. Which means that
the solution is done sequentially.
 Starting from and performing some mathematical manipulations we can get to:

  (14)

This formula is simply the explicit Euler method. The local truncation error is of
order of O(h2). This is a linear interpolation method, in which the local error is
proportional to the square of the step size.
14
7.7 Implicit Integration Methods
  derive implicit integration methods, we start with the Newton backward difference interpolation formula
To
starting from the point backward rather than from the point backward as used in the generation of the
explicit methods.
 

Or
Where with h

Using the incremented interpolation formula for the function y' Eq. 1(3), we substitute it into Eq. (16)

Using the incremented interpolation formula for the function y' Eq. (13), we substitute it into Eq. (16) and carry
out the integration with respect to a to obtain
 

15
7.7 Implicit Integration Methods
 Equation (17) is the implicit Euler method, which is in a similar form to the explicit Euler
method, except that the evaluation of the function f is done at the unknown point .

 
Like the implicit Euler method Eq. (17), Eq. (18) is a nonlinear algebraic equation and it must
be solved by trial methods to find . This representation in Eq. (18) is called the trapezoidal
method or Crank-Nicolson method, and is also sometimes called the second order implicit
method.

16
7.7 Implicit Integration Methods
 If
we truncate up to the fourth term in the RHS of Eq. , we obtain the following
fourth order Adams-Moulton method.
 

 The common factor in the implicit Euler, the trapezoidal (Crank-Nicolson), and
the Adams-Moulton methods is simply their recursive nature, which are
nonlinear algebraic equations with respect to and hence must be solved
numerically; this is done in practice by using some variant of the Newton-
Raphson method or the successive substitution technique.

17
8.1. Predictor-corrector methods
•The
  relation between explicit and implicit methods is the predictor-
corrector technique, where an initial is obtained with explicit method
and, then, is used in the implicit formula.
Adams-type predictor-corrector method is used to solve linear and non-
linear system
The Adams-Bashford:
Adams-Moulton for prediction and correction

18
8.2.Runge-Kutta methods
 The Runge-Kutta is an iterative method used to solve DOEs, which was proposed in 1900. But
several modifications have been established [6]. The Eq. (22) to (25) shows the second order
Runge-Kutta integration formula.  

Where w1, w2, c and a are constants.

Using a Taylor series is obtained.

19
 

 
The general formula for Runge-Kutta is presented in Eq. (31) and (32).

 
Where, P is the order of Runge-Kutta method. The difference between Runge-Kutta and predictor-
corrector methods is that the second uses a set of tn+1 value, while Runge-Kutta uses several points
evaluated in a function.

20
9. Extrapolation
• 
Truncation error may be used to obtain an exact solution of yn+1. Using Euler method, the yn+1 in
terms of truncation and step size is obtained:

Multiplying Eq. (34) for two and subtracting to Eq. (33), the Eq. (35) is obtained, which is the exact
solution at t=tn+1. The error is proportional to h2.

Similarly, for trapezoidal rule Eq. (36) to (38) are determinate, which is a better for estimate t=t n+1

21
10. Step size control
•   control of step size could be addressed by several techniques. For Bailey
The
method (see Eq. (72)) the difference between y(tn+1) and y(tn) is used to establish
some rules.  

When the is less that 0.001, the rules are: 

In another cases, the step size is retained. Bailey is applicable to all order methods.
For a specified order, other methods could be used. For example, Michelsen
method is used in third order cases and could be used to determinate the tolerance
of the step.
22
7.11 Chemical Engineering Problem
Ethylene production from ethane pyrolysis
  this example, the ethane pyrolysis in a PFR will be evaluated. To do this, the products distribution
In
through to the reactor volume and the effect of temperature on the ethylene production will be assessed.
The information to carry out the exercise was obtained from [8].

Elementary reactions for the process are presented in Eq. (40) to (43).

23
 
Thus, the rate expressions are given in Eq. (44) –(47).
 

 
Rate constants were reported by [8] (see Table 3), where

24
 
The reaction take place in gas phase in an isothermal PFR (see Figure 2). Initially, temperature was fixed at
1000 K.

Figure 2: Process diagram for ethane pyrolysis in PFR. Based in information presented by [8].

Assuming ideal gas, concentration for all species could ascribe to Eq. (48) – (50).

 
 
 
25
 
Replacing, verifying units and organizing Eq. (81) in rate expressions (Eq. (51)-(54)), rate expressions in terms
of mole flow are obtained.
 

For a PFR the mass balance is given by Eq. (55) and (56), which is an ODEs equation.
 

26
 
The mass flow for each specie in the outlet stream of the reactor is given by Eq. (57) – (63).
 

In the inlet of PFR, the mole flow of each species is:

27
 

Therefore, the ODEs system is given by Eq. (71) – (77).


 

28
 Where,

Defining,
 

We have an ordinary differential equation system with seven equations and unknown variables.

29
Matlab code
function Nip= ethanepyrolysis(V,Ni)

NA= Ni(1); %C6H6 concentration


NB= Ni(2); %NO concentration
NC= Ni(3); %C2H5 concentration
ND= Ni(4); %HNO concentration
NE= Ni(5); %H concentration
NF= Ni(6); %C2H4 concentration
NG= Ni(7); %H2 concentration
T=1000; %Reaction temperature
k1=(7*10^5)*exp(-2617/T); %Rate constant for ethane pyrolysis
ka=(4*10^3)*exp(-253/T); %Rate constant for ethane pyrolysis ka=k-1 (inverse reaction)
Definition of the
k2 =(3*10^4)*exp(-1984/T); %Rate constant for ethane pyrolysis
k3 =(2*10^5)*exp(-3429/T);%Rate constant for ethane pyrolysis
k4 =(8*10^3)*exp(-397/T);%Rate constant for ethane pyrolysis
differential
kb =(4*10^4)*exp(-2502/T); %Rate constant for ethane pyrolysis kb=k-4 (inverse
reaction)
Y=(14872*10^-8)/(T^2); %Defined parameter Y=[P/(RT)]^2
equation system
X=(12195*10^-6)/(T); %Defined parameter X=P/(RT)
NT=NA+NB+NC+ND+NE+NF+NG; %Total mol
Nip1=-(Y)*((k1*NA*NB)/(NT^2)-(ka*NC*ND)/(NT^2)+(k3*NE*NA)/(NT^2));%dNA/dt
in Matlab
Nip2=-Y*(k1*(NA*NB)/(NT^2)-ka*(NC*ND)/(NT^2)+k4*(NE*NB/(NT^2)))-kb*X*(ND/NT); %dNB/dt
Nip3=Y*(k1*(NA*NB)/(NT^2)-ka*(NC*ND)/(NT^2)+k3*(NE*NA)/(NT^2))-X*k2*(NC/NT);%dNC/dt
Nip4= Y*(k1*(NA*NB)/(NT^2)-ka*(NC*ND)/(NT^2)+k4*(NE*NB)/(NT^2))-kb*X*(ND/NT); %dND/dt
Nip5=-Y*(k3*(NE*NA)/(NT^2)+k4*(NE*NB)/(NT^2))+X*(-kb*(ND/NT)+k2*(NC/NT));%dNE/dt
Nip6=X*k2*(NC/NT);%dNF/dt (Desired product: Ethylene)
Nip7=Y*k3*(NE*NA)/(NT^2);%dNG/dt

Nip=[Nip1;Nip2;Nip3;Nip4;Nip5;Nip6;Nip7]%Solution vector

end
30
[V,Ni]=ode113(@ethanepyrolysis,[0 500],[0.0016463,0.0020122,0,0,0,0,0]);
plot(V,Ni(:,3))%, V,Ni(:,2),
V,Ni(:,3),V,Ni(:,4),V,Ni(:,5),V,Ni(:,6),V,Ni(:,7));
grid on
title('Ethane Pyrolysis');
xlabel('V (mL)');
ylabel('Ni (mol)');
 
 

Solver execution
in Matlab

31
Results
A. B. A. ODEs Solution (ODE113:
Adams-Bashforth-Moulton PECE)
B. ODE Solution (ODE45: Runge-
Kutta- (4,5) pair of Dormand-
Prince).
C. ODE Solution (ODE23s:
Rosenbrock).
D. ODE Solution (ODE23: Runge-
C. D. Kutta (2,3) pair of Bogacki and
Shampine).

32
a. b. Solution for C2H5
by:
a. ODE23
b. ODE23s
c.ODE113 and
c. d.
d.
.
d. ODE45
With a variable
d.

step.

33
a. c.
b. Solution for C2H5 by ODE45 with:
a. Step size=1; b. Step size=10 and
c. Step size=100.

d. f. Solution for C2H5 by ODE23 with:


e.
d. Step size=1; e. Step size=10 and
f. Step size=100.

g. i. Solution for C2H5 by ODE113


h.
with: g. Step size=1; h. Step
size=10 and i. Step size=100.

34
12. References
[1] Gear, C. W. (1971). Numerical initial value problems in ordinary differential equations [2] Wanner, G.,
& Hairer, E. (1991). Solving ordinary differential equations II. Stiff and Differential-Algebraic Problems.
[3] Kenneth J. Beers. Numerical Methods for Chemical Engineering: Applications in MATLAB. 2 nd Edition.
2007.
[4] Rice, R. G., & Do, D. D. (2012). Applied mathematics and modeling for chemical engineers. John Wiley &
Sons.
[5] K. Diethelm, N.J. Ford, A.D. Freed, A predictor-corrector approach for the numerical solution of
fractional differential equations, Nonlinear Dyn. 29 (2002) 3–22.
[6] E. Hairer, M. Roche, C. Lubich, The Numerical Solution of Differential-Algebraic Systems by Runge-Kutta
Methods, Springer-Verlag, 1989. 
[7] V. Arutyunov, N. Pogosyan, M. Pogosyan, L. Tavadyan, O. Shapovalova, L. Strekova, Production of olefins
by the conjugated oxidation of light hydrocarbons, Chem. Eng. J. 329 (2017) 231–237.
[8]I. G. Kevrekidis, S. Y. Shvartsman, Chemical Reactor Analysis and Design Fundamentals, Nob Hill
Publishing, 2004.
 
35

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy