Modeling_Simre3
Modeling_Simre3
Ali M. Sahlodin
Department of Chemical Engineering
AmirKabir University of Technology
1397 S.H
F, C1
Fixed inlet concentration
dC2 F
(t ) C1 C2 (t ) Ordinary-differential
F, C2
dt V equation
1
9/30/2019
Fully-implicit DAE
t ), t ) 0
F(x(t ), x( F
Singular
x
Implicit ODE F
Non-singular t ) f(x(t ), t )
x(
x
Semi-explicit DAE
t ), y(t ), t ) 0
F(x(t ), x( F
Non-singular
G(x(t ), y(t ), t ) 0 x
Conservation of mass/energy
Hydraulic relations
Reaction kinetics
Thermodynamic relations
Total volume
…
2
9/30/2019
FV
Fin P, T
FL
Q
Method of lines
Convert PDE to system of ODEs by discretizing
the space
T j T j 1 2T j T j 1
0, j 2,, N 1 ODE System
t ( x) 2
3
9/30/2019
Example 2:
y z 2 y
b 2
t x x
z
2
Discretization of the spatial derivative a
results in a DAE x 2
System of ODEs
t ) f(x(t ), y(t ), t , )
x(
Singular perturbation problem
y(
t ) g(x(t ), y(t ), t , )
4
9/30/2019
x x 2 x 3
What is stiffness?
No agreed-upon definition!
Depends on differential
equation, initial conditions,
and numerical method
t ) f(x(t ), y(t ), t , )
x( t ) f(x(t ), y(t ), t ,0)
x(
y(
t ) g(x(t ), y(t ), t , ) 0 g(x(t ), y(t ), t ,0)
5
9/30/2019
dx
Numerical solution of ODEs (t ) f ( x, t )
dt
h2
x(tk ) x(tk 1 ) hf ( xk 1 , tk 1 ) f ( xk 1 , tk 1 ) ...
2
•Forward Euler
x(tk ) x(tk 1 ) hf ( xk 1 , tk 1 ) O(h 2 )
•Backward Euler
x(tk ) x(tk 1 ) hf ( xk , tk ) O(h 2 )
6
9/30/2019
F, C1
Tank example: Case I
Dynamic Simulation problem (known input)
dC2 F
(t ) C1 (t ) C2 (t )
dt V F, C2
C1 (t ) (t )
F, C1
Tank example: Case II
Dynamic design problem (known output)
dC2 F
(t ) C1 (t ) C2 (t )
dt V F, C2
C2 (t ) (t )
Order of error O ( h)
7
9/30/2019
F, C1
Tank example: Case III
Tanks in series with known output
dC2 F
(t ) C1 (t ) C2 (t )
dt V F, C2
dC3 F
(t ) C2 (t ) C3 (t )
dt V
C3 (t ) (t )
F, C3
Order of error O (1)
F, C1
Tank example: Case I
dC2 F
(t ) C1 (t ) C2 (t )
dt V
C1 (t ) (t ) F, C2
dC1
Differentiate the system until (t ) appears.
dt
One differentiation is enough.
8
9/30/2019
F, C1
Tank example: Case II
dC2 F
(t ) C1 (t ) C2 (t )
dt V
C2 (t ) (t ) F, C2
dC1
Differentiate the system until (t ) appears.
dt
Two differentiations are needed.
F, C1
Tank example: Case III
dC2 F
(t ) C1 (t ) C2 (t )
dt V
dC3 F
(t ) C2 (t ) C3 (t ) F, C2
dt V
C3 (t ) (t )
dC1
Differentiate the system until (t ) appears.
dt F, C3
Three differentiations are needed.
9
9/30/2019
F0 : F(x(t ), x(
t ), t ) 0
d
F1 : t ), t ) 0
F(x(t ), x(
dt
d2
F 2 : t ), t ) 0
F(x(t ), x(
dt 2
d j 1
F j 1 t ), t ) 0
F(x(t ), x(
dt j 1
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech.
19
Find index
x
mxT 0
L
y
my mg T 0
L
x 2 y 2 L2 0
Wikipdia by Ruryk
10
9/30/2019
Semi-explicit DAE
t ), y(t ), t ) 0 F
F(x(t ), x( Non-singular
x
G(x(t ), y(t ), t ) 0
is index 1 IFF
g
Non-singular
y
Example: a CSTR with the rate equation
written separately.
11
9/30/2019
How to do it?
Successive differentiation
Change of variables
Regularization
12
9/30/2019
x2 x1 f1 0
x3 x2 f 2 0
x3 f3 0
13
9/30/2019
x1 x3 f1 0
x2 x1 f 2 0
x2 f3 0 1 apparent algebraic equation
14