Buzzi-Ferraris, G., Manenti, F.
Fundamentals and Linear Algebra for the Chemical Engineer
Solving Numerical Problems
2010
Print ISBN: 978-3-527-32552-8
Buzzi-Ferraris, G., Manenti, F.
Interpolation and Regression Models for the Chemical Engineer
Solving Numerical Problems
2010
Print ISBN: 978-3-527-32652-5
Buzzi-Ferraris, Guido/Manenti, Flavio
Nonlinear Systems and Optimization for the Chemical Engineer
Solving Numerical Problems
2013
Print ISBN: 978-3-527-33274-8;
also available in digital formats
Velten, K.
Mathematical Modeling and Simulation
Introduction for Scientists and Engineers
2009
Print ISBN: 978-3-527-40758-3,
also available in digital formats
Solving Numerical Problems
All books published by Wiley-VCH are carefully produced. Nevertheless, authors, editors, and publisher do not warrant the information contained in these books, including this book, to be free of errors. Readers are advised to keep in mind that statements, data, illustrations, procedural details or other items may inadvertently be inaccurate.
Library of Congress Card No.: applied for
British Library Cataloguing-in-Publication Data
A catalogue record for this book is available from the British Library.
Bibliographic information published by the Deutsche Nationalbibliothek
The Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie; detailed bibliographic data are available on the Internet at http://dnb.d-nb.de.
© 2014 Wiley-VCH Verlag GmbH & Co. KGaA, Boschstr. 12, 69469 Weinheim, Germany
All rights reserved (including those of translation into other languages). No part of this book may be reproduced in any form – by photoprinting, microfilm, or any other means – nor transmitted or translated into a machine language without written permission from the publishers. Registered names, trademarks, etc. used in this book, even when not specifically marked as such, are not to be considered unprotected by law.
Print ISBN: 978-3-527-33275-5
ePDF ISBN: 978-3-527-66713-0
ePub ISBN: 978-3-527-66712-3
Mobi ISBN: 978-3-527-66711-6
oBook ISBN: 978-3-527-66710-9
This book is aimed at students and professionals needing to numerically solve scientific problems involving differential and algebraic–differential systems.
We assume our readers have the basic familiarity with numerical methods that any undergraduate student in scientific or engineering disciplines should have. We also recommend at least a basic knowledge of C++ programming.
Readers who do not have any of the above should first refer to the companion books in this series:
These books explain and apply the fundamentals of numerical methods in C++.
Although many books on differential and algebraic–differential systems approach these topics from a theoretical viewpoint only, we wanted to explain the theoretical aspects in an informal way, by offering an applied approach to this scientific discipline. In fact, this volume focuses on the solution of concrete problems and includes many examples, applications, code samples, programming, and overall programs, to give readers not only the methodology to tackle their specific problems but also the structure to implement an appropriate program and ad hoc algorithms to solve it.
The book describes numerical methods, high-performance algorithms, specific devices, and innovative techniques and strategies, all of which are implemented in a well-established numerical library: the BzzMath library, developed by Prof. Guido Buzzi-Ferraris at the Politecnico di Milano and downloadable from http://www.chem.polimi.it/homes/gbuzzi.
This gives readers the invaluable opportunity to use and implement their code in a numerical library that involves some of the most appealing algorithms in the solution of differential equations, algebraic systems, optimal problems, data regressions for linear and nonlinear cases, boundary value problems, linear programming, and so on.
Unfortunately, unlike many other books that cover only theory, all these numerical contents cannot be explained in a single volume because of their application to real problems and the need for specific code examples. We therefore decided to split the numerical analysis topics into several distinct areas, each one covered by an ad hoc book by the same authors and adopting the same philosophy:
This book proposes algorithms and methods to solve differential and differential–algebraic systems, whereas the companion books cover linear algebra and linear systems, data analysis and regressions, and nonlinear systems and optimization, respectively. After having introduced the theoretical content, all explain their application in detail and provide optimized C++ code samples to solve general problems. This allows readers to use the proposed programs to tackle their specific numerical issues more easily by using the BzzMath library.
This book deals with the solution of differential and differential–algebraic systems. Analogously to the aforementioned companion books, it proposes a series of robust and high-performance algorithms implemented in the BzzMath library to tackle these multifaceted and notoriously difficult issues.
Definite integrals are solved in Chapter 1. Existing methods and novel alternatives are proposed, implemented in the BzzMath library, and adopted to solve some well-established literature-based tests. Parallel computations are also introduced.
Ordinary differential equation systems are broached in Chapter 2. Conditioning, stability, and stiffness are described in detail by giving specific information on how to handle them whenever they arise. The BzzMath library also implements a wide set of algorithms to solve classical problems and chemical/process engineering problems.
Chapter 3 reports a collection of literature and industrial problems based on ordinary differential equation systems. The basics of the physical problem are described and the model behind it is given together as the initial conditions. Implementation tricks, special functions of the classes, and suggestions to improve the solution's accuracy and efficiency are provided through various examples.
Differential–algebraic systems are explored in greater depth in Chapter 4. Special algorithms to handle this family of problems are described and implemented in the BzzMath library. Classes to handle the sparsity and structure of such systems typical of chemical engineering are also described.
Literature-based examples and industrial case studies are collected in Chapter 5. Implementation tricks and useful functions to handle very large and sparse systems with/without parallel computing are introduced.
Chapter 6 also introduces a novel general class to solve boundary value problems. Very stiff problems, such as shock waves and peaks, are automatically identified and the solution strategy self-adapt to such a situation.
These books contain icons not only to highlight some important features and concepts but also to underscore that there is potential for serious errors in programming or in selecting the appropriate numerical methods.
In order to facilitate both implementation and program reading, it was necessary to diversify the style of the identifiers.
C++ is a case-sensitive language and thus distinguishes between capital letters and small ones. Moreover, C++ identifiers are unlimited in the number of chars for their name, unlike FORTRAN77 identifiers. It is thus possible, and we feel indispensable, to use these prerogatives by giving every variable, object, constant, function, and so on, an identifier that allows us to immediately recognize what we are looking at.
Programmers typically use two different styles to characterize an identifier that consists of two words. One possibility is to separate the word by means of an underscore, that is, dynamic_viscosity. The other possibility is to begin the second word with a capital letter, that is, dynamicViscosity.
The style adopted in the BzzMath library is described hereinafter:
Some good examples are MACH_EPS, PI, BZZ_BIG_FLOAT, and TOLERANCE.
Bad examples are A, Tolerance, tolerance, tol, and MachEps.
Some good examples are machEpsylon, tol, x, A, G, dynamicViscosity, and yDoubleValue.
Bad examples are Aa, AA, A_A, Tolerance, tOLerance, MachEps, and mach_epsilon.
Some good examples are MachEpsilon, Tolerance, Aa, Abcde, DynamicViscosity, and MyBestFunction.
Bad examples are A, F, AA, A_A, tolerance, TOL, and machEps.
Some good examples are BzzMatrix, BzzVector, BzzMinimum, and BzzOdeStiff.
Bad examples are A, matrix, and Matrix.
Another style-based decision was to standardize the bracket positions at the beginning and at the end of a block to make C++ programs easier to read.
In this case also, programmers adopt two alternatives: some put the first bracket on the same row where the block starts, while some others put it on the following line with the same indenting of the bracket that closes the block.
The former case takes to the following style:
for(i=1;i<=n;i++){
…
}
if(x>1.){
…
}
whereas the latter case takes to the following style:
for(i=1;i<=n;i++)
{
…
}
if(x>1.)
{
…
}
This latter alternative is adopted in the BzzMath library.
A third important style-based decision concerned the criterion to pass variables of a function either by value or by reference. In the BzzMath library, we adopt the following criteria:
The object C only is modified in the following statements:
Product(3.,A, &C);
Product(A,B, &C);
BzzMath library, release 7.0, was designed for a Microsoft Windows environment.
Thanks to the synergistic collaboration with Professor Wozny's research group at Technische Universitat Berlin, it will also be available in the Linux environment. The library is released for the following compilers:
openMP directives for parallel computing are available for all the above compilers except for Visual C++ 6.
Moreover, FORTRAN users can either adopt all the classes belonging to the BzzMath library using opportune interfaces or directly use pieces of C++ codes in FORTRAN, by means of the so-called mixed language (see Appendix A of Vol. 2, Buzzi-Ferraris and Manenti, 2010b).
The previous version of the BzzMath library (release 6.0) is updated until May 20, 2011 and will not undergo any further development. Moreover, the new release 7.0 has been extended quite significantly, particularly for classes dedicated to optimization and exploitation of openMP directives and to differential, differential–algebraic, and boundary value problems.
Also, MATLAB users can either adopt all the classes belonging to BzzMath library through opportune interfaces or directly use pieces of C++ codes in MATLAB by means of the so-called mixed language (see Appendix A of the present volume).
Download and unzip WileyVol4.zip from Buzzi-Ferraris's homepage (http://www.chem.polimi.it/homes/gbuzzi). Login is required, but download is free for non-profit uses.
Windows users must follow these general tasks to use the BzzMath library on a computer:
Please note that when a new directory is added to the PATH environment variable, the semicolumn ; must be included before specifying the new directory.
After having changed the PATH environment variable, you must restart the computer. At the next machine start, you can use BzzMath exe programs and/or the BzzMathTutorial.pps file, placed into the directory DIRECTORY\BzzMath\BzzMathTutorial.
Linux users will find gcc library file into DIRECTORY\BzzMath\Lib\Linux subdirectory.
Whereas the previous paragraph describes an operation that should be performed only once, the following operations are needed whenever a new project is open:
#include “BzzMath.hpp”
at the beginning of the program, just below the BZZ_COMPILER selection. For example, using the INTEL 2013 with openMP in the Windows environment, you must enter the following statements:
#define BZZ_COMPILER 11
#include “BzzMath.hpp”