1. CHEM2002 -Ahmed Al-Dallal - 2013-2014 1
CHAPTER FIVE
SIMULATION TO ASSIST IN
PROCESS CREATION
1
Contents
1. Analysis of Degrees of Freedom
2. Sequential Modular Flowsheeting
3. Partitioning and Precedence
Ordering
2
5.1 Analysis of Degrees of Freedom
3
Objectives:
1. Identify stream variables entering and leaving a
unit; identify variables that describe the unit.
2. Determine the number of independent equations
for each unit.
3. Calculate the degrees of freedom or number of
decision variables.
4. Specify the values of variables equal to the
number of degrees of freedom.
4
2. CHEM2002 -Ahmed Al-Dallal - 2013-2014 2
Posing the Problem
To obtain a solution to a process model, we need to
formulate a well-posed problem.
The degrees of freedom (DOF) are the variables in
a set of independent equations which must have
their values assigned.
DOF = # variables - # equations
Nd = Nv - Nc
Equations include material and energy balances,
unit constraints, composition constraints.
5
Important process variables
Temperature
Pressure
Mass (mole) component flow rates concentration and total
flow rates
Specific enthalpies
Heat flow
Work
Flow ratios (e.g. recycle, feed/product, reflux)
6
Defining Stream Variables
To define the state of a stream with Nsp species:
The number of variables to describe a stream is
given by:
Nv = Nsp +2
7
Constraints and balances
1. Independent material balances for each species or a total
flow balance and (Nsp-1) species balances
2. Energy
3. Phase equilibrium relationships that link the
compositions between phases
4. Chemical equilibrium relationships
5. Implicit constraints, e.g. a species concentration is zero
6. Explicit constraints, e.g. a given stream fraction is
condensing
8
3. CHEM2002 -Ahmed Al-Dallal - 2013-2014 3
Example - water heater
9
DOF- Water heater
10
Stream Splitter (adiabatic)
11
Mixer (not adiabatic)
12
4. CHEM2002 -Ahmed Al-Dallal - 2013-2014 4
Heat exchanger (not adiabatic) 1/2
13
Heat exchanger (not adiabatic) 2/2
Give example specification for a well-posed problem
for Nsp = 2.
• What would change in the model if the number of
components in each stream is not the same?
• Heat exchangers do have hydraulic pressure losses
on the shell and tube sides. How would we
incorporate this information into the model?
14
Pump
15
Flash tank (single phase streams)
16
1
3
2
3
={3( Nsp + 4
5. CHEM2002 -Ahmed Al-Dallal - 2013-2014 5
Reactions 1/2
If reactions are present, the number of variables stays the same, but
the number of material balances depends on the number of
independent material balances, not species.
(Assume Isothermal and isobar conditions)
17
Reactions 2/2
18
14
25
Nd = 29 - 25 = 4
Combinations of units: mixer and flash 1/2
19
3
4
Combinations of units: mixer and flash 2/2
20
10
+10} 2} = 2Nsp + 8-
8. CHEM2002 -Ahmed Al-Dallal - 2013-2014 8
Example: Ammonia Plant4/4
Overall view
Nv: 3(Nsp+2) +1 19
Nc:
Material balance (N, H, Ar) 3 (Atomic Species)
Energy balance 1
Feed stream (stream 1) 3 (T=50 C,P =100 atm,
NH3=0)
Ammonia product (Stream 4) 5 (T=50 C,P =100 atm,
H2=0, Ar=0, N2=0)
Purge stream (Stream 6) 3 (T=50 C,P =100 atm,
NH3 =0)
Nd = 4 29
5.2 Sequential Modular Flowsheeting
30
Sequential Modular Flowsheeting
Unit models are written to calculate output stream values,
given input stream values and unit parameters.
31
Defining features
Need to specify all incoming streams (Stream 1)
To calculate the outlet of the mixer - need to guess
the stream variable values for the recycle streams.
The recycle stream values are then calculated and
checked against the values guessed for that
iteration – if they agree within a tolerance, then the
flowsheet is converged.
This procedure is called tearing a recycle stream. 32
9. CHEM2002 -Ahmed Al-Dallal - 2013-2014 9
Tear the recycle
33
Follow the information flow
Tear stream 7, x, by guessing values for that
stream – mixer unit can be calculated
Calculate the reactor, separator, purge units
Check the calculated stream 7, |F(x) – x| <
tolerance, then converged.
If not, then use some combination of the guess (x)
and the calculated result (F(x)) to start another
iteration. 34
Notation – recycle iteration
For each iteration, k, use notation xk and F(xk).
We are really solving the explicit equation
X=F(X)
By iteration:
X k+1 = F(Xk)
Note that we could tear stream 7, 2, 3 or 5.
Q? What criteria would you use to decide which stream
should be teared (i.e. the values guessed)?
35
Important questions:
1. How do we analyze a process flowsheet to determine
whether there are recycles and which stream to tear
(guess)?
2. How do we handle many recycles, which may be nested?
3. How are calculated values for the recycle stream used for
subsequent iterations?
4. What solution procedure should be used if not all the
inputs to the process are known, but some outputs are
specified?
36
10. CHEM2002 -Ahmed Al-Dallal - 2013-2014 10
Ammonia reactor loop
Stream 1 is the process feed.
Stream 4 is the desired product.
Define a stream vector Xj
i where j is the stream number and i is the
component. We take Xj to mean the vector of all the stream
variables in stream j.
We have 4 components:
i=1 H2
i=2 N2
i=3 NH3
i=4 Ar
37
Write the Material balances
38
Write the Material balances
39
Degree of freedom analysis
Stream variables 7(4) = 28 (neglect T,P)
Reactor 1
Flash 4
Purge split 1
Total 34
Mixer equations 4
Reactor equations 4
Separator equations 8
Purge split equations 8
Total equations 24
10 degrees of freedom- which ones should we specify?
40
11. CHEM2002 -Ahmed Al-Dallal - 2013-2014 11
Example specifications for ammonia plant
X1 = {300, 100, 0, 1.2}
S = 0.012
χ = 0.2
K = {1, 1, 0, 1}
41
Convergence Block Schemes – Successive
Substitution
Let Xk be the guess for the tear stream variables at the kth
iteration.
Let F(Xk) be the calculated result for that tear stream’s values.
The simplest iteration scheme is successive substitution, or
fixed point iteration.
X k+1 = F(Xk)
The next guess on the tear stream is the newly calculated
variable values.
A more general, weighted form is: X k+1 = a F(Xk) + (1-a) Xk
Which is useful if the iterations start to oscillate, e.g. a=0.5
42
Successive substitution spreadsheet
43
Convergence Block Schemes –
Wegstein acceleration1/3
44
12. CHEM2002 -Ahmed Al-Dallal - 2013-2014 12
Convergence Block Schemes –
Wegstein acceleration2/3
45
Convergence Block Schemes –
Wegstein acceleration3/3
46
Summary
Sequential modular models – require all inputs and unit
parameters, then calculate outputs
Problems with recycles – we do not know one of the
inputs
Concept of tear stream allows us to guess stream value to
allow unit computation
Convergence blocks use previous and current iterations to
predict next guess:
– Successive substitution
– Wegstein acceleration
47
5.3 Partitioning and Precedence Ordering
48
13. CHEM2002 -Ahmed Al-Dallal - 2013-2014 13
Partitioning and Precedence Ordering
Partitioning: locate groups of units that must be
solved together
Precedence ordering: solve these groups of units
within a process in the proper computational order
A partition is unique, but the precedence ordering
is not
Partitions may exist where the order of the solution
may have groups of units calculated in serial or
parallel order.
49
Consider the imaginary flowsheet
50
Stream tables
Generally topology information in process
flowsheets is tracked through stream tables –
linkage of units by streams
e.g.
Unit MIX Streams IN: 1,7
Streams OUT: 2
STREAM 7 From: PURGE To: MIX
51
By inspection …. Recycle Groups
H
Partition and precedence order: ABCDE
FG
I
Can we automate the selection?
52
14. CHEM2002 -Ahmed Al-Dallal - 2013-2014 14
Sargent and Westerberg algorithm
1. Trace from an arbitrary starting unit to the next unit,
through a connecting stream, to form a string of units.
2. Continue, until:
a) A unit in the string reappears. Then all the units between the
repeated unit occurrences, including the repeat unit, is a group. A
group is treated as single unit.
b) A unit has no more outputs – place it at the top of a list of
groups/units and delete from the problem
The list will contain the groups in the correct precedence
order.
53
Example Problem 1/9
54
Example Problem 2/9
55
Example Problem 3/9
56
15. CHEM2002 -Ahmed Al-Dallal - 2013-2014 15
Example Problem 4/9
57
Example Problem 5/9
58
Example Problem 6/9
59
Example Problem 7/9
60
16. CHEM2002 -Ahmed Al-Dallal - 2013-2014 16
Example Problem 8/9
61
Example Problem 9/9
String 1: ABCDE-FG-I no output from I
Delete I
String 1: ABCDE-FG no output from FG
String 1: ABCDE no output from ABCDE
String 2: H no output from H
No units left
Precedence Order List:
H
ABCDE
FG
I
62
Tearing
There are a number of approaches to develop better
tearing strategies. However they require the
analysis of the number of components and
recycles.
Generally, try to minimize the number of tear
streams and the number of variables in the tear
streams.
63
Equation solving approaches
Model equations are written in the open form,
F(x,u) = 0
Where x are the stream variables and u are the unit
parameters.
All the nonlinear equations are assembled and solved
simultaneously. This can create a huge nonlinear equation
set: typically at least 103 to 105 equations.
The solution methodology is complicated because each
equation includes relatively few variables – the variables
in the unit and adjacent units. This is called a sparse set of
equations. 64
17. CHEM2002 -Ahmed Al-Dallal - 2013-2014 17
Equation-based Approach1/2
Advantage is that any parameter or stream
variable can be specified, if:
– The number of equations equals the number of
variables
– The equations are linearly independent
The problem must be nonsingular
65
Equation Based Approaches2/2
Tearing:
Find the minimum number of variables that need to be
guessed and iterate to find the rest of the variables and
group the equations to solve them in the right order –
e.g. a flash calculation.
Requires pre-analysis and does not generalize
Linearization:
Linearize the nonlinear set of equations using Newton-
Raphson - preferred method.
66
Problems with equation based strategy1/2
1. Difficult to use equations from existing sequential
modular packages
2. Equation management is complex
3. Large computer storage is required
4. Numerical problems include obtaining derivatives
and singularity
5. Need starting values
6. Interface to thermodynamics packages must
provide derivative information
67
Problems with equation based strategy2/2
7. Need to have backup plan in case solution fails to
converge
8. Need input data verification to prevent singular problems
( structural or numerical singularity)
9. Ordering of the equations affects the equation solution
time
BUT, equation based strategies remove the need for
convergence and control blocks and allow for more flexible
problem formulation Basis for all new simulators
currently being developed.
68
18. CHEM2002 -Ahmed Al-Dallal - 2013-2014 18
Simple Example 1 1/2
69
Simple Example 1 2/2
70
Simple Example 2
A B C D E
F
S1
• Partitioning: 3 unit groups, namely ABCD, E, and F
• Procedence Ordering: ABCD, then E, then F
• Actual computational sequence:
Tear S1 --> C --> D --> A --> B --> Update S1 --> E --> F
71
Partitioning Algorithm 1/2
Path Tracing algorithm by Sargent and Westerberg (1964)
- A simple algorithm for tracing unit outputs
- Basically, one traces from one unit to the next through the unit
output streams, forming a “string” of units.
This tracing continues until
(a) A unit in the string reappears.
All units between the repeated unit, together with the repeated unit,
become a group, which is collapsed together and treated as a single
unit, and the tracing continues from it.
(b) A unit or group of units with no more outputs is encountered.
The unit or group of units is placed at the top of a list of groups and is
deleted entirely from the problem.
72
19. CHEM2002 -Ahmed Al-Dallal - 2013-2014 19
Partitioning Algorithm 2/2
Algorithm:
1. Select a unit/group
2. Trace outputs downstream until
(a) a unit or a group on the path reappears. Go to step 3.
(b) a unit or a group is reached with no external outputs. Go to
step 4.
3. Label all units into a group. Go to step 2.
4. Delete the unit or group. Record it in a list. Go to step 2.
Sequence is from bottom to top of list! 73
Example of S & W’s Partitioning
Algorithm 1/4
A B C M E
I
F G H D L
JK
1. Start with unit A
A B C M E I J K
Delete K and Delete J, since no output List
K
J 74
Example of S & W’s Partitioning
Algorithm 2/4
2. Start with unit A again
A B C M E I L E
Loop => EIL is a group
A B C M E
I
D L
JK
F G H
75
Example of S & W’s Partitioning
Algorithm 3/4
EILD will be a group
3. A
B C M
4. Delete EILD since it has no more outputs
List
K
J
EILD
M
C
B
A
B C M EIL D EIL
5. A
Delete M
6. A B C
Delete C, B, and then A 76
20. CHEM2002 -Ahmed Al-Dallal - 2013-2014 20
Example of S & W’s Partitioning
Algorithm 4/4
Delete GH, and then delete F
List
K
J
EILD
M
C
B
A
GH
F
7. F G H G
F G H
Computational sequence is:
F GH A B C M EILD
K J 77