Beruflich Dokumente
Kultur Dokumente
NUMERICAL METHODS
Numerical Methods
• Numerical Integration of Ordinary Differential Equation
– Euler’s Method
• Explicit and Implicit Methods + Numerical Stability of Explicit Method
– Runge-Kutta Method
• Second- and Fourth-Order Runge-Kutta Methods
– Computer-Based ODE Solution Techniques
• Matlab Integration Routines
– Ode23 and Ode45Study of transient behavior
Process Dynamics
• Case study: CSTR with first-order reaction kinetics
Types of System and Resulting Equations
X
Algebraic
Differential Differential Partial
Equations
Equations Equations Differential
Equations
Linear Non-Linear
Single Multi-
Variable Variable
Transient Lumped Parameter System
• For a constant density (ρ ) fluid of
density being flowed in and out of a
storage tank of uniform cross-
section area (A), the transient mass
balance (derived earlier in the class)
takes the following form: Fin
dh Fin Fout
= − Fout
dt A A
Note: The density parameter does not appear because it cancels out
Steady State Distributed Parameter System
dP 4 f ρv 2
=− ( )
dz D 2
Numerical Methods for Solving
Ordinary Differential Equations
Euler’s Method
Numerical Solutions for ODEs: The Euler Method
Let us consider a single-variable ODE by the following equation
x = f (x ) with the initial condition x(0) = x0
xk +1 = xk + ∆t ⋅ f ( xk +1 )
Clearly, the equation is implicit in the unknown xk+1 . Depending on the
non-linearity of f(x), an iterative solution may be required
Stability of Explicit Method
Explicit Euler’s Method: Stability
• Tutorial#5 problem illustrates that explicit Euler’s Method may result in a
solution that generates oscillatory solution.
• For Euler’s explicit method, both the instability and oscillation are the result
of step-size chosen for integration.
• From mathematical theory, the conditions for stability can be found. Here,
we provide you with that condition (the derivation is beyond the scope of
this course).
Explicit Euler’s Method: Stability
The general form of solution for Explicit Euler Method is as follows:
x k +1 = x k + ∆t ⋅ f ( x k )
Let us denote the RHS of the above equation as a function g(xk). The
requirement for stable solution is as follows:
g ' ( xk ) < 1
• Explicit Euler Method is easy to implement due to explicit nature of the equation
but numerical stability can be a problem
• Smaller steps sizes are always desirable because they lead to increased accuracy.
However, small step-size come at the cost of increased computation time.
• Implicit Euler Method for non-linear equations require an iterative solution such
as Newton’s method.
m1 = f ( xk )
• Estimate the value of state variable at a mid-point, i.e. x(t+∆ t/2).
∆t ∆t
xk +1/ 2 = xk +
m1 xk +1/ 2 = xk + f ( xk )
2 2
• Calculate the slope or derivative at this mid-point
m2 = f ( xk +1/ 2 )
• Estimate the value of state variable at next time step, i.e. xk+1 using slope at
mid-point:
xk +1 = xk + ∆t ⋅ m2
• Calculate the slope or derivative (m2) at this mid-point to estimate new mid-
point state variable x΄k+1/2 ∆t
k +1 / 2 = xk +
'
m2 = f ( xk +1/ 2 ) x m2
2
m4 = f ( x ' k +1 )
• A final slope (m4)is evaluated at the end of the step
4th Order Runge-Kutta Method (Cont.)
m1 m2 m3 m4
xk +1 = xk + [ + + + ] ⋅ ∆t
6 3 3 6
Multi-variable RK method
RK Methods: Closing Remarks
–
–
–
–
–
–
–
Case Study: CSTR Transient Behavior
Study of SS & Transient Behavior of a CSTR
• Objective: Apply differential mass and mole balance to a CSTR to study
transient effects, i.e. to investigate the process dynamics of the system.
• Problem description: Consider the following CSTR system wherein a
chemical reaction following first-order rate kinetics is being carried out.
Fin = 0.15( L / s)
C A0 = 10(m ol/ L)
Fout = 0.15( L / s)
C A = ?(m ol/ L)
V =10 (L)
Fundamental Balance Equations for a CSTR
1. Differential Mass Balance Equation
Accumulation = Input Rate – Output Rate
d ( ρV )
= ρ ⋅ Fin − ρ ⋅ Fout
dt
d (V )
⇒ for constant density system (e.g. liquids) = Fin − Fout
dt
d (VC A )
= Fin ⋅ C A0 − Fout ⋅ C A + 0 − (k ⋅ C A ) ⋅ V
dt
dC A C A Fin
+ = ⋅ C A0
dt τp V
Thus, we have
C A, s Fin Fin
0+ = ⋅ C A0 ⇒ C A, s = τ p ( ) ⋅ C A0
τp V V
− τ p ⋅ ln( −C A + C A,s ) = t + C1
Applying the initial condition (at t=0, CA= CA,initial ) to the above equation, we
get
− τ p ⋅ ln( −C A,initial + C A,s ) = C1
Transient Behavior of the CSTR
The solution can therefore can be derived as follows:
− τ p ⋅ ln( −C A + C A, s ) = t − τ p ⋅ ln( −C A,initial + C A, s )
Dividing by -τ p
t
ln( −C A + C A, s ) = −( ) + ln( −C A,initial + C A, s )
τp
Rearranging, we get
(C A − C A , s ) t (C A − C A, s ) t
ln[ ] = −( ) = exp (− )
(C A,initial − C A, s ) τp (C A,initial − C A, s ) τp
Finally, ∆ CA
t
C A (t ) = C A, s + (C A,initial − C A, s ) ⋅ exp(− )
τp
Case Study: Graphical Representation of the
Solution
8
5
CA (mol/L)
0.993 ∆ CA
0.865 ∆ CA
0.633 ∆ CA
∆ CA
3
1
t=τ p
t = 2τ p t = 5τ p
0
0 50 100 150 200 250 300 350 400
t (seconds)