9/22/2021
Ali M. Sahlodin
Department of Chemical Engineering
AmirKabir University of Technology
1397 S.H
Solving recycle loops (cont’d)
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 2
1
9/22/2021
Line search
Obtain the optimal step length
1
x ( k 1) x ( k ) J ( x ( k ) ) f ( x(k ) ) 0 1
Line search by optimization is expensive.
( k 1)
Instead find α such that f ( x ) f ( x( k ) )
For complex flowsheets: Broyden’s method with line search
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 3
Turton et al. Analysis, Synthesis, and Design of Chemical Processes
Newton method: converged in
fewest iterations, but highest
cost per iteration
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 4
2
9/22/2021
Solution times
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 5
Nested: inner loop is solved and converged
at each iteration of the outer loop.
Simultaneous: all loops are solved
simultaneously
Advantageous when interactions among loop are
strong
Turton et al. Analysis, Synthesis, and Design of Chemical Processes
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 6
3
9/22/2021
Infeasible flowsheet: no steady-state solution exists
Missing purge stream
Missing makeup stream
Wrong stream/unit specifications
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 7
Done as an inner iteration loop
Bubble point at given T
Bubble point at given P (iterate on T)
Dew point at given T
Dew point at given P
Flash at given P and T (PT)
heaters/coolers
Flash at given P and H (PH)
Valves, heaters/coolers
Handling of phase changes
Trial and error (assume phase regime, solve,
repeat if no feasible solution)
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 8
4
9/22/2021
Optimization creates an outer iteration loop
Analytical first- and second-order derivatives
not available
Must be obtained by perturbation
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 9
Pros
Easy modeling (problem formulation)
Customizable solvers for each block (e.g.,
columns)
Easy troubleshooting
Established software available
Cons
Efficiency/convergence issues in case of many
recycles and large interactions
Inefficient/unreliable for optimization (why?)
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 10
5
9/22/2021
Collect all equations and solve simultaneously
Process model
Design specs
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 11
Modify to avoid inverting Jacobian
x k 1 x k k d k
J k d k f ( xk )
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 12
6
9/22/2021
Idea: break a large problem into
smaller subproblems
Smaller subproblems are solved more
easily.
f1( x1,..., xn ) 0
M
f ( x ,..., x ) 0
n 1 n
Construct the incidence matrix
Find permutation matrices P and
Q s.t.
DAEPACK block Solver
Manual (J.E. Tolsma)
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 13
Choose appropriate solver for each block.
Quasi-Newton method
Bisection
Homotopy continuation
Write your own solver!
DAEPACK block Solver
Manual (J.E. Tolsma)
No derivative calculation needed for off-
diagonal entries faster solution
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 14
7
9/22/2021
Ind. Eng. Chem. Res., Vol. 39, No. 6, 2000
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 15
Solve the following system using BLT.
f1 : x1x2 x3 0
f 2 : x22 10 0
f3 : 2 x1 x3 0
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 16
8
9/22/2021
Minimize (norm of) the residual values
minn g ( x)
x
Apply Newton-type methods to
g '( x) 0
Advantages
State-of-the-art optimization algorithms
Systematic reduction of residuals to zero
Ability to handle bounds on variable
Facilitate convergence
Handle multiple steady-state solutions
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 17
Initialization
Good initial guesses being the biggest challenge
Typically an SM solution required.
Derivatives
Analytical differentiation is possible!
But not always
User-defined subroutines (black boxes)
unsupported blocks
Property packages/flash calculations (sometimes available)
Apply perturbation in these cases
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 18
9
9/22/2021
1. Use Aspen components/property package
2. Build EO case in subflowsheet (HYSYS)
3. Build the SM simulation (good initial guess)
4. Switch to EO ad solve again
5. Perform simulation, optimization, parameter estimation,
etc.
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 19
Pros
Suitable for highly interactive processes (many recycles
and design blocks)
Suitable for optimization and model calibration
Cons
is harder to troubleshoot
Needs more expertise
Needs good initial guess (solving very large system)
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 20
10
9/22/2021
Combine good features of SM and EO
No unique definition (different ways to combine)
Example I
Apply EO to highly interacting parts
Apply SM to other parts
Example II
Apply quasi-Newton for simultaneous solution of
recycles
Example III
Apply EO to external variables
Input/output streams, design specs
Apply SM to internal variables
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 21
Formulation I
Tear all streams
2( N C 2) N CS N d Eqs
Chen & Stadtherr (1985).
AlChE Journal Vol. 31, No.
11.
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 22
11
9/22/2021
Formulation II
Eliminate unnecessary eqs
Chen & Stadtherr (1985).
AlChE Journal Vol. 31, No.
11.
( NC 2) NCS N d Eqs
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 23
Formulation III
Only tear a subset of streams
Chen & Stadtherr (1985).
AlChE Journal Vol. 31, No.
11.
( NC 2) Nt N d Eqs
Copyright © Ali M. Sahlodin, Dept. of Chemical Engineering, AmirKabir Univ. of Tech. 24
12