Previewpdf
Previewpdf
for the
Chemical Engineer
Second Edition
A Numerical Primer
for the
Chemical Engineer
Second Edition
Edwin Zondervan
MATLABr is a trademark of The MathWorks, Inc. and is used with permission. The Math-
Works does not warrant the accuracy of the text or exercises in this book. This book’s use
or discussion of MATLABr software or related products does not constitute endorsement
or sponsorship by The MathWorks of a particular pedagogical approach or particular use
of the MATLABr software.
CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742
c 2020 by Taylor & Francis Group, LLC
CRC Press is an imprint of Taylor & Francis Group, an Informa business
No claim to original U.S. Government works
Printed on acid-free paper
International Standard Book Number-13: 978-1-138-31538-9 (Hardback)
This book contains information obtained from authentic and highly regarded sources. Rea-
sonable efforts have been made to publish reliable data and information, but the author
and publisher cannot assume responsibility for the validity of all materials or the conse-
quences of their use. The authors and publishers have attempted to trace the copyright
holders of all material reproduced in this publication and apologize to copyright holders if
permission to publish in this form has not been obtained. If any copyright material has not
been acknowledged please write and let us know so we may rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted,
reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other
means, now known or hereafter invented, including photocopying, microfilming, and record-
ing, or in any information storage or retrieval system, without written permission from the
publishers.
For permission to photocopy or use material electronically from this work, please access
www.copyright.com (http://www.copyright.com/) or contact the Copyright Clearance Cen-
ter, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-
for-profit organization that provides licenses and registration for a variety of users. For
organizations that have been granted a photocopy license by the CCC, a separate system
of payment has been arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trade-
marks, and are used only for identification and explanation without intent to infringe.
Introduction xiii
Preface xv
vii
viii Contents
3 Linear equations 21
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.2 MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3 Linear systems . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.4 The inverse of a matrix . . . . . . . . . . . . . . . . . . . . 22
3.5 The determinant of a matrix . . . . . . . . . . . . . . . . . 23
3.6 Useful properties . . . . . . . . . . . . . . . . . . . . . . . . 24
3.7 Matrix ranking . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.8 Eigenvalues and eigenvectors . . . . . . . . . . . . . . . . . 26
3.9 Spectral decomposition . . . . . . . . . . . . . . . . . . . . 27
3.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4 Elimination methods 31
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.2 MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.3 Gaussian elimination . . . . . . . . . . . . . . . . . . . . . . 31
4.4 LU factorization . . . . . . . . . . . . . . . . . . . . . . . . 36
4.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5 Iterative methods 41
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.2 Laplace’s equation . . . . . . . . . . . . . . . . . . . . . . . 41
5.3 LU factorization . . . . . . . . . . . . . . . . . . . . . . . . 44
5.4 Iterative methods . . . . . . . . . . . . . . . . . . . . . . . . 45
5.5 The Jacobi method . . . . . . . . . . . . . . . . . . . . . . . 46
5.6 Example for the Jacobi method . . . . . . . . . . . . . . . . 49
5.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6 Nonlinear equations 53
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.2 Newton method 1D . . . . . . . . . . . . . . . . . . . . . . 53
Contents ix
8 Numerical integration 81
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
8.2 Euler’s method . . . . . . . . . . . . . . . . . . . . . . . . . 81
8.3 The trapezoid method . . . . . . . . . . . . . . . . . . . . . 85
8.4 Simpson’s method . . . . . . . . . . . . . . . . . . . . . . . 86
8.5 Estimation of errors using numerical integration . . . . . . 87
8.6 The Richardson correction . . . . . . . . . . . . . . . . . . . 88
8.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
8.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
9.4 Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
9.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
9.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
12 Optimization 117
12.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
12.2 Linear programming . . . . . . . . . . . . . . . . . . . . . . 118
12.3 Nonlinear programming . . . . . . . . . . . . . . . . . . . . 120
12.4 Integer programming . . . . . . . . . . . . . . . . . . . . . . 122
12.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
12.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Bibliography 177
Index 181
Introduction
xiii
Preface
This book emphasizes the derivation and use of a variety of numerical methods
for solving chemical engineering problems. The algorithms are used to solve
linear equations, nonlinear equations, ordinary differential equations, and par-
tial differential equations. It also includes chapters on linear and nonlinear re-
gression, and on optimization. MATLAB R ∗ is adopted as the programming
environment throughout the book. MATLAB is a high-performance comput-
ing program. An introductory chapter on MATLAB basics has been added
and Excel users can find a chapter on the implementation of numerical meth-
ods in Excel. Worked-out examples are given in the case study chapter to
demonstrate the numerical techniques. Most of the examples were written in
MATLAB and are compatible with the latest versions of MATLAB.
It is important to mention that the main purpose of this book is to give
students a flavor for numerical methods and problem solving, rather than as
an in-depth guide to numerical analysis. The chapters end with small exercises
that students can use to familiarize themselves with the numerical methods.
The material in this book has been used in undergraduate and graduate
courses in the chemical engineering department of Eindhoven University of
Technology. To aid lecturers and students, course materials have also been
made available on the Web at http://www.crcpress.com/product/ISBN/
9781138315389.
Finally, the author would like to thank everyone who has been helpful and
supportive in the creation of this book, especially some of the PhD students
at Eindhoven University who have assisted during lectures and directly in-
fluenced the content of this book: Juan Pablo Gutierrez, Esayas Barega, and
Arend Dubbelboer.
Edwin Zondervan
January 2014
∗
MATLAB is a registered trademark of The MathWorks, Inc. For product informa-
tion, please contact:
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA 01760-2098 USA
Tel: 508 647 7000
Fax: 508-647-7001
E-mail: info@mathworks.com
Web: www.mathworks.com
xv
1
The role of models in chemical engineering
1.1 Introduction
The concept of a model has been around since ancient times. Models appear in
all branches of science and engineering. However, it is often said that modeling
is more art than science or engineering. In this chapter we will discuss general
aspects of models, and more specifically the models that describe (chemical)
process systems. It is not intended as an in-depth discussion.
Ultimately, this book is about solving the developed models in a numerical
fashion. We could consider Ptolemy’s Amalgest (150 BC) as one of the first
recorded studies on modeling and numerical analysis in which numerical ap-
proximations to describe the motions of the heavenly bodies with accuracy
matching reality sufficiently were developed (Figure 1.1). This is basically the
FIGURE 1.1
(Left) An image of Ptolemy; (Right) Ptolemy’s model of our solar system
1
2 A Numerical Primer for the Chemical Engineer
FIGURE 1.2
“The Treachery of Images” by Rene Magritte
The role of models in chemical engineering 3
TABLE 1.1
Model types and their classifications
image of a pipe. Models are similar. Models are not the reality, they are an
approximate description of reality. Eykhoff [20] defines an engineering model
as a representation of the essential aspects of an existing system (or a system
to be constructed) which presents knowledge of that system in a usable form.
This implies basically that a model is (always) a simplification of reality. A
model as such can give insight into the behavior of the system under study, but
it does not always mean that this insight is phenomenological. For example,
if an engineer develops a controller for a distillation tower, he would like to
know how the distillation tower behaves dynamically. Whether this knowledge
is based on first principles or not is not really relevant for his purposes. In
Table 1.1 the different model types are listed.
The mathematical forms of the different model types can involve linear alge-
braic equations, nonlinear algebraic equations, ordinary differential equations,
differential algebraic equations and partial differential equations. Each of the
equation forms requires special techniques for solution.
can often best be made by an expert. However there is some kind of agreement
on the four elementary steps in the modeling process: problem definition,
design, evaluation and application.
In the problem definition phase, the modeling problem and the goal of the
model are properly formulated. This formulation is based on performance and
structure requirements with respect to the application and on the modeling
expertise of the modeler. In the design phase, the structure and key variables
of the model are identified.
For mechanistic models, the structure of the model reflects the physical struc-
ture of the system. This often means that additional steps have to be taken
such as the formulation of physical and chemical laws and a proper translation
of the major assumptions made in the design stage.
Key in the process is the application of conservation principles for conserved
extensive quantities. Another important component is the development of con-
stitutive relations, which are normally used to complete the model.
The conservation principle holds for mass, energy and momentum, and states
that these quantities are neither destroyed or created but simply change form.
Conservation principles lead to typical gas-liquid-solid systems involving the
mass, component and energy balances. In particulate systems, particle number
balances for the generation of population balance equations are also consid-
ered.
Constitutive relations are normally algebraic equations. Constitutive equa-
tions describe five classes of relations in a model, the mass, energy/heat trans-
fer, the reaction rate expressions, the so-called property relations (thermody-
namic constants and relations), the balance volume relations which define the
connections between mass and energy, and the equipment and control con-
straints. For a detailed description of conservation and constitutive equations
the reader is referred to Hangos and Cameron [25].
In the evaluation phase the model is verified with respect to its structure and
the results of the model are validated with the real world situation. In this
phase also the requirements with respect to model structure as formulated
in the problem definition phase are evaluated. If all criteria are satisfied, the
model can be applied.
TABLE 1.2
Model types and solution strategies
6 A Numerical Primer for the Chemical Engineer
1. A process system
2. A modeling goal
3. Validation criteria
4. A mathematical model
The role of models in chemical engineering 7
FIGURE 1.3
Systematic model building steps
factors include (1) chemical reaction, (2) diffusion, (3) conduction of heat, (4)
forced convection heat transfer, (5) free convection heat transfer, (6) radiation
heat transfer, (7) evaporation, (8) turbulent mixing, (9) heat or mass transfer
through a boundary layer, and (10) fluid flow.
When modeling, we must understand that there is a set of process charac-
teristics that are never fully identified. We often only identify and include a
subset of essential characteristics in the model, which means that some es-
sential characteristics might be missing from our model description. It could
also very well happen that we include unnecessary complexity in our model
or include process characteristics that are actually not part of the system.
The issues sketched above are not easy to deal with and depend strongly on
our understanding of the system. Model validation is key here.
One cannot take all possible controlling mechanisms into account, and for that
reason, a filter should be applied when considering the following key elements:
freedom are satisfied. We must also try to avoid numerical problems, such
as high index systems. Lack of solution techniques may prevent a modeler
using a particular type of process model, and that can lead to additional
simplifications. This could be the case with distributed parameter process
models.
Step 6: Verify the model solution
Verification is determining whether the model is behaving correctly. Is it coded
correctly and giving you the intended answer? This is not the same as model
validation, where we check the model against reality. You need to check care-
fully that the model is correctly implemented. One aspect is the correct pro-
gramming practice, where a top-down algorithm design can help out. The
other component is to verify whether the model exhibits the right qualita-
tive characteristics; for example, if modeling a reactor, an increase in reactor
temperature should deliver an increase in conversion.
Step 7: Validate the model
Model validation concerns the determination of the quality of the model as
compared to independent observations or assumptions. Often only a partial
validation is carried out in practical cases, depending on the modeling goal.
There are several possibilities to validate a process model. The actual vali-
dation method strongly depends on the process system, the modeling goal,
and the possibilities of getting independent information for validation. These
possibilities include:
The tools to carry out this task include the use of sensitivity analysis to
identify the key controlling inputs or system parameters as well as the use
of statistical validation tests. They can involve hypothesis testing and the
use of various measures such as averages, variances, maxima, minima, and
correlation factors.
If the validation results show that the developed model is not suitable for a
modeling goal, then one has to return to Step 2 and perform the sequence
again. Usually validation results indicate how to improve the model. We can
often identify inadequate areas in our model development, and for that reason,
not all modeling efforts are lost. Once more, it is mentioned that often one
has to move up and down through the seven-step modeling hierarchy in an
iterative fashion.
10 A Numerical Primer for the Chemical Engineer
1.8 Summary
In this chapter the role of models in chemical engineering was briefly dis-
cussed. First, the basic definition of a model was introduced. Subsequently a
common way of model building was discussed, starting with a problem defi-
nition phase, followed by design, evaluation, and application. After the model
The role of models in chemical engineering 11
building phase, model analysis is done in two ways: the mathematical cor-
rectness of the model (model verification) and the numerical performance of
the model (model validation). In the final section, a short overview of model
solution strategies was given.
1.9 Exercises
Exercise 1
Exercise 2
Exercise 3
Review what kinds of models are used in a particular industry sector (select,
for example, the food, petrochemical, or pharmaceutical industries) and why
they are used. Discuss how the modeling efforts relate to the potential benefits
derived from their use?
Bibliography
13
14 A Numerical Primer for the Chemical Engineer
[12] Chen, W. S., B. R. Bakshi, et al. (2004). “Bayesian estimation via sequen-
tial Monte Carlo sampling: Unconstrained nonlinear dynamic systems.” In-
dustrial and Engineering Chemistry Research 43(14): 4012.
[13] Coimbra, M. D. C., C. Sereno, et al. (2004). “Moving finite element
method: Applications to science and engineering problems.” Computers and
Chemical Engineering 28(5): 597.
[14] Cruz, P., J. C. Santos, et al. (2005). “Simulation of separation processes
using finite volume method.” Computers and Chemical Engineering 30(1):
83.
[15] de Jong, M. C., R. Feijt, et al. (2009). “Reaction kinetics of the ester-
ification of myristic acid with isopropanol and n-propanol using p-toluene
sulphonic acid as catalyst.” Applied Catalysis A: General 365(1): 141.
[16] Des Costello (1992). Dynamic Modelling of a Small Scale Liquid-Liquid
Extraction Rig, Ph.D. thesis, Edinburgh University.
[17] Dormand, J. R. and P. J. Prince (1980). “A family of embedded Runge-
Kutta formulae.” Journal of Computational and Applied Mathematics
6(1): 19–26.
[18] Edgar, T. F., D. M. Himmelblau, et al. (2001). Optimization of Chemical
Processes, McGraw-Hill.
[19] Evangelista, F. (2005). “Dynamics of shell and tube heat exchangers: New
insights and time-domain solutions.” 7th World Congress of Chemical En-
gineering, GLASGOW2005, incorporating the 5th European Congress of
Chemical Engineering.
[20] Eykhoff, P. (1974). System Identification: Parameter and State Estima-
tion, Wiley & Sons.
[21] Floudas, C. A. and X. Lin (2004). “Continuous-time versus discrete-time
approaches for scheduling of chemical processes: A review.” Computers and
Chemical Engineering 28(11): 2109.
[22] Golub, G. H. and C. F. v. Loan (1996). Matrix Computations, The John
Hopkins University Press.
[23] Gritton, K. S., J. D. Seader, et al. (2001). “Global homotopy continuation
procedures for seeking all roots of a nonlinear equation.” Computers and
Chemical Engineering 25(7–8): 1003.
[24] Hahn, B.H. and Valentine, D.T. (2010). Essential MATLAB for Engi-
neers and Scientists, Academic Press.
[25] Hangos, K. and Cameron, I. (2001). Process Modeling and Model Analy-
sis, Academic Press.
Bibliography 15