Académique Documents
Professionnel Documents
Culture Documents
SIMULATION
Once the D.O.F. for our flowsheet model have been satisfied, we must solve a
fully determined system of nonlinear algebraic equations:
f( y ) = 0
l≤y≤u
Is there some way to make the above problem easier? Will it help if can we
break it into a sequence of smaller problems? We have already seen that the
ideas of partitioning and precedence ordering facilitate this.
Motivations:
A B C D
⇓
Solve the unit operation model equations
⇓
To give values for the variables in the outlet streams
Subproblems may or may not require iterative solution of the unit model
equations - if iterative solution required, may be able to exploit specific physical
features of the subproblems.
Examples:
Features:
A B C D
1 2 3 5 6
This leads to three problems in setting up and solving flowsheets with recycles:
ii) what is the correct order in which to solve these subsets of units
(precedence ordering).
A B C D
1 2 3 5 6
A B C D
2 3 5
SOLVING THE PARTITIONS - TEARING
The Sargent and Westerberg algorithm for partitioning and precedence ordering
gives us the following data:
a) contain a single unit - unit model subroutine already solves this problem
S5
A B C
S1 S2 S3 S4
c) compare the calculated value of the torn stream with the guessed value,
and iterate until convergence.
If we choose to tear S5:
S5 S5'
A B C
S1 S2 S3 S4
Given S1 (from preceding partition or input to flowsheet):
1. Guess S5
2. Given S1 and S5, solve A for S2
3. Given S2, solve B for S3
4. Given S3, solve C for S4 and S5'
5. Given S5', update guess for S5
6. Repeat from step 2 until converged
(e.g., S5 = S5')
In general, if the torn stream makes the graph acyclic, the partitioning and
precedence ordering algorithm can be used to derive a unidirectional
computation sequence automatically.
a) how to select which stream(s) to tear in order to break the cycle(s) - e.g.,
how to derive the acyclic graph
b) how to update the guess for the torn stream(s) so that the iterative
process converges rapidly, and when to terminate the iterative process
CONVERGENCE ALGORITHMS
A B C
S5 S2 S3 S5'
S5© = g(S5)
and at the converged solution S5 = S5'. Therefore, converging the torn flowsheet
is equivalent to the mathematical problem:
x − g( x ) = 0
where,
Remarks:
¥ we only have to derive good initial guesses for a small subset of the
variables (the tear stream variables) - rather than all the variables in the
flowsheet!
The pages that follow discuss different strategies for converging these ÔtearÕ
equations.
SUCCESSIVE SUBSTITUTION
Idea: use last iteration to directly update torn stream (i.e., exploit the specific
functional form of the tear equations).
Iterative process:
( )
xk +1 = g xk (k = iteration number)
Note that this, and any other iterative process, is a difference equation, the
discrete analogue to a differential equation.
Advantages:
Disadvantages:
then
ek +1 ≤ α ek ( 0 < α < 1)
∂g1 ∂g1
∂x K
∂xn
1
M≡ M O M
∂gn K
∂gn
∂x1 ∂xn
{λ1 , λ2 ,K, λn }
The if:
max | λi |< 1 (spectral radius of M)
i=1Kn
and x 0 (the initial guess) is sufficiently close to the solution, the iterative
process will converge.
Idea: apply overrelaxation factor to weight the current and previous iterates and
move closer to the solution in a single step:
x k + 1 * = qx k + (1 − q )x k + 1
x k + 1 = qx k + (1 − q )g( x k )
If,
However, it is difficult to choose a good value for q in advance - for example, the
Dominant Eigenvalue Method (DEM) monitors the residuals (or right hand sides)
( )
of the equations (i.e., the difference x k − g x k ) from one iteration to the next in
order to derive a value for q.
For the iteration to remain stable, a rough lower bound of q is -1 (if acceleration
is applied at each iteration). This corresponds to an acceleration factor of 2 at
best. To obtain acceleration and stability, DEM only applies acceleration every
few successive substitution iterations.
DECOUPLED vs COUPLED VARIABLES
In flowsheeting problems, the iterate variables are neither all strongly coupled,
nor all decoupled:
c) with more than one tear stream, strong coupling between the flowrate of
a chemical species in each tear stream.
WEGSTEIN'S METHOD
Idea: treat each variable with the one dimensional secant method by driving it
with a uniquely associated function. This implies that interactions with other
variables are neglected.
Given: values of argument and function from two successive substitution steps
(i.e., x k = g(x k − 1 )):
{x k −1
}
, g(x k − 1 )
{x , g(x )}
k k
b) 1
qj =
1 − sj
c) x kj +1 = q j x kj −1 + (1 − q j )x kj
If Wegstein is applied to every step, it is also likely to suffer from instability (if q j
large and negative).
BOUNDED WEGSTEIN'S METHOD
a) compute q j as above
Alternatively, relax the lower bound, but apply Wegstein acceleration only every
few successive substitution steps. ASPENPLUS has options to control all these
parameters.
Remarks:
¥ Wegstein's method is very good for partitions with a single tear stream.
NEWTON'S METHOD
f(x) = x − g(x) = 0
where
Disadvantages
b) because functions g(x) are not known explicitly, must derive a numerical
approximation to J for each iteration - use finite difference
approximation.
In practice, one never inverts the Jacobian. Instead, the linear system:
Jp = −f(x k )
is solved, where:
p = x k +1 − x k
∆fi
J ij ≈
∆x j
Algorithm:
g( x k ) → f ( x k ) .
Therefore, N+1 passes through the flowsheet are required to get J before the
next step x k + 1 can be calculated. Meanwhile, Wegstein may have converged in
fewer than N+1 passes through the flowsheet! In practice, NewtonÕs method is
usually too expensive. It should only be used when no other method will
converge due to a high level of interaction of the iterate variables.
Iterative process:
x k + 1 = x k + W k f( x k )
During each iteration, update W k according to the formula (least change secant
update):
T
k +1 (pk + W k y k )pk W k
W =W − k
T
pk W k y k
where:
pk = x k +1 − x k
y k = f( x k + 1 ) − f( x k )
Advantages:
Disadvantages:
b) what W 0 to use?
i) −I
( )
−1
ii) − J x 0 - calculate by finite differences (N+1 flowsheet passes) and
then invert.
CONVERGENCE CRITERIA
f(x k ) = x k − g(x k ) ≤ ε
b) the iterate variables are not changing from one iteration to the next, e.g.:
x k +1 − x k ≤ ε r x k
x k +1 − x k ≤ ε a
x k +1 − x k ≤ ε r x k + ε a
x ≡ some norm of the vector x . Note these two approaches only equivalent
with successive substitution (e.g., x k + 1 = g(x k )).
i) criterion a) could imply the function is very close to zero, but does not
cross zero - e.g., an asymptote.
iv) convergence only within the specified tolerance - try again with a tighter
tolerance.
v) tear function may be converged, but individual unit calculations may not
be converged, or in error - check diagnostics generated by simulator
a) make sure you know what convergence criterion the simulator is using!
Consider the following flowsheet partition with two nested recycle loops:
S7
S5
A B C D
S1 S2 S3 S4 S6
One approach to solving this problem is to tear streams 5 and 7 and set up a
nested iteration. This is illustrated as a flowchart composed of unit operation
calculations in Figure 1.
o Update
x7
Stream 7
x1 A
B
Update
Stream 5
C
o
x5
D
Note the idea of a convergence block inserted in the calculation sequence: the
convergence block calculates an updated value for the tear stream (the output
stream from the block) from the current value of the tear stream calculated from
a (possibly partial) flowsheet pass (the input stream from the block). The
equation encapsulated by the convergence block and used to update the tear
stream may be any of the iterative methods discussed in the preceding sections.
So this leads to the following idea (which is one of the most intensively studied
academic problems in this area): can we select the tear streams so as to improve
the performance of the iterative procedure?
Simple example: select the tear stream in the above example so that nesting is
not necessary:
S7
S5
A B C D
S1 S2 S3' S3 S4 S6
Tearing S3 alone makes the flowsheet acyclic. Given a guess for S3, S3' can be
calculated from a single pass through the flowsheet.
SELECTING TEAR SETS
S8
S7
S1 S2 S3 S4 S5
S6
Algorithm:
We have already seen a couple of simple minded approaches for this step.
Efficient algorithms exist for this purpose.
Streams
S1 S2 S3 S4 S5 S6 S7 S8
C1 0 1 1 1 0 0 0 1
Cycles C2 0 1 0 0 0 1 0 1
C3 0 0 1 0 0 0 1 0
3. Introduce binary (i.e., they can only be either zero or unity) variables
( z j ∈ {0, 1} ) for each stream to indicate that:
zj = 1 if stream j is torn
= 0 otherwise
We can now formulate the constraint that the torn flowsheet must be acyclic
mathematically. Using the matrix M , determine z j that will satisfy the
inequality:
NStream
∑ Mij z j ≥ 1 ∀cycles i
j =1
In words: choose a set of streams to tear such that each cycle is opened at
least once. A flowsheet with all cycles opened at least once will be acyclic. This
is a set covering constraint, which is a standard constraint in combinatorial
optimization.
4. Given the acyclic digraph, determine the calculation sequence for the units in
the flowsheet.
a)
j {
j }
the set of tear streams to be torn Ð S : z = 1, j = 1K NStream is called a
tear set.
b) a valid tear set is one that opens each cycle at least once; i.e., the values of
z j satisfy the set covering constraint.
Remark c) is easily demonstrated for the flowsheet in Figure 2; valid tear sets
include:
{S4, S6, S7}, {S2, S3}, {S3, S6}, etc., etc. . . .
OPTIMAL TEAR SETS
So far we have only defined a feasibility problem that meets our primary objective
(derive an acyclic graph):
As there are always multiple solutions to this feasibility problem, we can take the
analysis one step further and pose an optimization problem:
Optimization problem: select the best valid tear set (search over the space of
valid (or feasible) tear sets for the best one according to a preselected criterion).
For the latter, we must define what we mean by the best tear set: a secondary
objective. Note that solving a steady-state simulation is also a feasibility problem,
but (we hope) it has a unique solution. Alternatively, we bound the solution
space to find the desired solution. This is the first of many optimization problems
that we shall see.
Table 1 summarizes some of the criteria that have been advocated in the
extensive literature on this subject. Remarks:
b) it has been shown that criterion 4 is equivalent to selecting a tear set that
opens each cycle the minimum number of times Ñ reasoning from the
properties of the successive substitution iteration.
Therefore, we can formulate this secondary objective and the constraints derived
from the primary objective as a constrained optimization problem: given the
cycle/stream matrix M and the stream weights w j , determine the binary
variables z j so as to:
NStream
(objective)
Minimize ∑ wjzj
j =1
NStream
(constraints)
Subject to : ∑ Mij z j ≥ 1 ∀cycles i
j =1
Table 1: Criteria for an 'Optimal' Tear Set
Reasoning Criterion
1. Nested iterations are problematic and Choose a tear set with the
obtaining good initial guesses is difficult minimum number of streams
(cardinality). Still may be
multiple solutions.
2. Different streams may have a different Choose a tear set with the
number of unknowns appearing in them minimum total number of
(especially if there are design specifications unknowns.
on internal streams). Hence, minimize the
number of equations in the tear iteration.
Remarks:
a) in general, set covering problems are difficult to solve (NP-complete).
Many special algorithms have been devised for the tearing problem
b) the weights are derived from the criterion chosen. For criterion:
1. wj = 1 ∀j = 1K NStream
NCycle
⇒ ∑ Mij
i =1
c) most modern simulators automate this task, but the user has the option
to intervene and specify a valid tear set if, for example, there is some
special characteristic of the current problem.
In some cases, a valid tear set containing only one stream does not exist. In this
case, it is inevitable that multiple streams must be torn.
Example:
S5
A B C D
S1 S2 S3 S4 S7
S6
Valid tear sets: {S2, S3}, {S6, S3}, {S2, S4}, etc.. All have cardinality > 1.
S5 S5'
A B C D
S1 S2 S3 S4 S7
S6 S6'
Algorithm:
x 5 − g 5 (x 5 , x 6 ) = 0
x 6 − g 6 (x 5 , x 6 ) = 0
Remarks:
c) user must usually define a convergence block and the tear streams to the
simulator in order to take advantage of this approach.
DESIGN SPECIFICATIONS
Example:
S8
B5
S1
A S7
S3 S4 S5
B1 B2 B3 B4
A + B -> C
S2 C
B S6
Problem: design the flowsheet so that molar ratio of reactants in the feed stream
to the reactor (S4) is R:
F4 , A
=R
F4 ,B
One extra equation => one less degree of freedom => must release a specification
on one variable. Adjust the flowrate of S2 to achieve this specification (the
manipulated variable).
xi
R
Idea: add controller block that adjusts the manipulated variable so as to satisfy
the design specification (analogy to feedback controller for regulatory control of
process dynamics).
S8
E
S1
S7
S3 S4 S5
A B C D
S2 F4,A
F4,B S6
F2
Controller
= information flow
R*
Disadvantages:
Algorithm:
START
Update
manipulated
variable
Converge
flowsheet
(simulation problem)
Evaluate
function that
defines
design specification
For outer iteration, use iterative method for a single equation in a single
unknown (e.g., secant method).
Advantages:
Note: this is the method that ASPEN PLUS defaults to. My experience indicates
that sometimes it tries to be a little more clever than always putting the
flowsheet convergence as the innermost iteration.
Idea: solve all the tear streams and all the design specifications simultaneously.
Example:
S8
E
S1
S7
S3 S4 S5
A B C D
S2
S6
x 7 − g 7 (x 7 , F2 ) = 0
f (x 7 , F2 ) = 0
where,
F4 , A (implicit function)
f (x 7 , F2 ) ≡ −R
F4 , B
Note that the design specification is not in the functional form required for
successive substitution and its variants.
We can extend this generalized executive controller approach to a powerful and
general formulation for the case where there are multiple tear streams and
multiple design specifications. Solve the system of simultaneous nonlinear
equations:
x j − g j (z, x j , j = 1KN ) = 0 ∀j = 1K N
f(z, x j , j = 1KN ) = 0
where,
Remarks:
g j (y,x j ) xj
x j − g j (y,x j ) = 0
f (y,x j ) = 0
A B C D
Advantages:
i) executive program very simple, due to the assumption that unit models
calculate outputs given inputs.
iii) large number of existing unit operation models that calculate outputs
given inputs. Further, solution methods can be tailored to a particular
unit operation: initialization of iterative calculations, use of ideal physical
property models to initialize calculations with more sophisticated ones,
special model specific procedures (e.g., flash calculations).
iv) intuitive solution strategy - easy for the users to understand (!).
vi) good heuristics for initialization and convergence. In practice very robust
(in comparison to equation oriented solution technologies).
Disadvantages:
i) unit models must be coded with their solution routines. Considerable
effort to add or modify models. Unit models only do one type of
calculation and extra code must be added for localized design calculations.
iii) design calculations much more difficult to set up and converge than
simulation calculations, and more computationally costly.
5. Schad R. C., ÒDonÕt Let Recycle Streams Stymie Your SimulationsÓ, Chemical
Engineering Progress, pp. 68-76, December 1994.
6. Strang G., ÒLinear Algebra and its ApplicationsÓ, chapter 7, 3rd edition,
Harcourt Brace Jovanovich, 1988.