Cover Page

Related Titles

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

Differential and Differential-Algebraic Systems for the Chemical Engineer

Guido Buzzi-Ferraris

Flavio Manenti

Solving Numerical Problems

Wiley Logo

Preface

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.

Outline of This Book

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.

Notation

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.

BzzMath Library Style

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:

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);

Basic Requirements for Using BzzMath Library

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).

How to Install Examples Collected in This Book

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.

A Few Steps to Install BzzMath Library

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.

Include the BzzMath Library in a Calculation Program

Whereas the previous paragraph describes an operation that should be performed only once, the following operations are needed whenever a new project is open:

  1. BzzMath.lib must be added to the project (see also the following paragraph).
  2. When at least an object of BzzMath library is used, it is necessary to select the appropriate compiler by choosing one of the following alternatives:
    • //default: Visual C++ 6.0 Windows without openMP #define BZZ_COMPILER 0//32 bit
    • //Visual C++ 9.0 (Visual 2008) Windows with openMP#define BZZ_COMPILER 1//32 bit
    • //Visual C++ 2010 Windows with openMP#define BZZ_COMPILER 2//64 bit
    • //Visual C++ 2012 Windows with openMP#define BZZ_COMPILER 3//64 bit
    • //INTEL 2013 with openMP#define BZZ_COMPILER 11//32 bit
    • //LINUX GCC with openMP#define BZZ_COMPILER 101//64 bit