September 2, 2014 – Numerical Results with Rigorous Error Bounds

converter4x6 catalytic_converter001

Have you ever solved a problem numerically and wondered: How accurate is my answer? Oftentimes the only clue you have is how the solution changes (hopefully not much) as you refine the mesh and solve it with more degrees of freedom. I have posted some new problems and a few solutions that help with this problem.

The method is to use mathematical theorems that bound the error. Sometimes the error can only be bounded in an average sense – called the mean square error, which is the error squared, integrated over the domain, and then take the square root. The best situation, though, is when you can bound the difference between the exact solution and the approximate solution you’ve found at every point in the domain. That is called the point-wise error.

The book Method of Weighted Residuals and Variational Principles discusses these points in Chapter 11. While the book was first published in 1972, it has been republished by the Society for Industrial and Applied Mathematics, http://www.ChemEComp.com/MWR. Of course the mathematical proofs are still valid. But, back in 1972, you couldn’t solve many problems very accurately. However, now you can. Thus, the problems I’ve posted on the website use the theorems given or mentioned in the book and solve the problems using modern technology, and then compute the mean-square error bound and sometimes the point-wise error bound for the approximate solution. The solutions are sometimes found using MATLAB and sometimes found with Comsol Multiphysics.

Problems 7, 8, and 9 have just been posted. These refer to a problem called ‘effectiveness factor’ in chemical engineering. They compute the average reaction rate in a porous catalyst that is undergoing both diffusion and reaction. This is a classic problem in chemical reaction engineering. Problem 7 sets the stage – gives the theorems and equations that aren’t already in the book and solves the problem for a plane geometry using Hermite cubic polynomials in Comsol Multiphysics. Other parts use Lagrange quadratic polynomials and solve for both plane geometry and a spherical catalyst pellet. Problem 9 is for a non-linear problem. (You thought no error bounds would be available didn’t you!)

Posted in Chemical engineering computing | 1 Comment

Source Code for Examples is now Available

July 18, 2014

The source code for all the examples in the book has recently been made available by Wiley. They total 26 MB and can be downloaded by going to booksupport.wiley.com and searching on author: Finlayson (or, title or ISBN number). These would allow you to work all the examples in the book just by loading the source code into the requisite Excel, Matlab, Aspen, or Comsol. The problems at the end of the chapter you still must do yourself!

When I first wrote the book I thought that it was important for students to start from nothing and learn each program. However, I’ve realized that even if you do that, you learn only the things relevant to that example, and still have to learn some more. Now, by starting with an example, whose solution is in front of you, you can learn that problem faster, and, hopefully, continue that learning process when you tackle new problems.

 

The book web site, http://www.ChemEComp.com has links to the same file stored by Wiley. It has other downloads, as well, that might be useful. Don’t ignore the material on The Method of Weighted Residuals and Variational Principles, which is there, too. It deals with error bounds, and you may be willing to just accept your answer, but the bounds do give you confirmation and useful insight into the method of solution.

 

Posted in Chemical engineering computing | Leave a comment

April 4, 2014

         I’ve added a problem to the website http://www.ChemEComp.com for electrochemical polymerization in a series of stirred tanks. Solutions are given as derived in Excel and MATLAB. It is a simple problem with important insight and comes from the book Electrochemical Reaction Engineering, by K. Scott, Academic Press, New York (1991). The plot of conversion versus number of stirred tanks is shown here from the Excel solution.

Image

 

         I have also collected the figures from my book, Introduction to Chemical Engineering Computing. They are available to instructors who use the book as a text in class. Shortly I will have the programs that were used for illustration in the book so that instructors can run them without much hassle. You get these by contacting Wiley. The following web sites can be used to obtain material from Wiley. It includes the keys to the problems (useful to your Teaching Assistant), and the figures in the book (useful to you when you go to class). Go here to learn what is in the book:

http://www.wiley.com/WileyCDA/WileyTitle/productCd-1118888316.html

and here to fill out the form

http://www.wiley.com/WileyCDA/Section/id-821455.html

         The updated version of the 2nd edition should be available in the next few days. The parts on Aspen Plus have been updated to be consistent with Aspen Plus 8, which comes in Aspen Suite 8.4. The windows are the same, but how you get to them is different. The figures available from Wiley have the updated windows. This is the only textbook available now that has been updated for Aspen Plus 8.

Aside | Posted on by | Leave a comment

More problems/solutions with error bounds and help integrating in time in Comsol Multiphysics

Image

March 3, 2014

I’ve added some more problems to the website www.ChemEComp.com/MWR that goes along with the book pictured above.  Now there are six problems, for eigenvalue problems, boundary value problems in 1D, elliptic boundary value problems, and initial value partial differential equations. All of these first six problems have solutions with them, that can be downloaded from the website. They illustrate how variational principles are used to calculate error bounds, or sometimes just trends (always going up or always going down as the approximation improves).  See additional description in the Jan. 15th blog below.

I’ve corrected the page proofs for the revision of Introduction to Chemical Engineering Computing. It now is based on Aspen Plus User Interface 8.0, which comes with the Aspen Suite 8.4, the latest one. See the Jan. 15th blog below for further information. The new printing should be in April. If you order it, be sure to specify that the ISBN number is

ISBN 978-1-118-88831-5

After Aspen Tech made the changes in the Aspen Plus User Interface, there are a lot of books being revised!

 

Hints when the time integration is having difficulty getting started in Comsol Multiphysics. (I supplied these on LinkedIn in response to a query.)

1. If it is natural convection in an enclosed space, be sure you set the pressure at one point on the boundary. Otherwise the pressure will not be defined and the simulation won’t start.

2. Next, if some of your equations are not time dependent, it is possible for Comsol not to take those variables into account when it makes the error estimates in the time step. That is appropriate because those variables would adjust instantly to the others, and might change a lot in one time step. Otherwise you will have to take very small time steps. These problems are called quasi-static. To do this, unclick them in the “Equations to be solved for”.

3. You can set the initial time step to a smaller value. Then, in desperation, you can set the Absolute and/or Relative Tolerance to higher values.

4. Also, it might help, depending on your problem, if you could supply an initial guess of the solution – it doesn’t have to be right, or even close, but something non-zero sometimes helps. Be sure to check the box for Values of Dependent Values Solved for. Good luck – this is a common problem and not easy to solve (in my experience).

5. You can also set the error criterion for the error in a time step (or the changes from one time to another) to a larger value. This is called Scaling; the default is 0.01. For kicks, try something very much larger (like 1 or 10).

6. There are a variety of other options that have not always worked well for me, but they are in the Time-Dependent Solver: increase MUMPS (this has worked for me, under Direct – when you start, it may be changed by the program and listed on the Log or Progress, and if you see it increasing it is easier to just use the larger number when you start),. Also, you can change the way the Jacobian is solved (has never worked for me). Scaling of the variables differently permits you to essentially apply different error criteria to different variables, based on your expectation of which variables are the most important to have correct. This program has lots of options, and it is confusing even to one who has programmed many of them back in the days of FORTRAN. Another one that sometimes works is to clear the solution, clear the Study and recreate the Study. I don’t have to do that often (1/10,000) but it has worked for me (and was suggested by Comsol).

7. Finally, of course, is to send it to Comsol for help. I probably should have recommended that first!

Posted in Chemical engineering computing | Tagged | Leave a comment

A book in revision and an old book resurfaces!

January 15, 2014

I have revised the material in Introduction to Chemical Engineering Computing to be consistent with AspenPlus 8. The interface looks different when you start, but the ultimate windows where you define the problem are the same. It took me a bit to get used to, but I like the new version. One of the main things is that there are three tabs, and the ribbons (across the top) are different for each tab. Thus, if you want to define the chemicals or the thermodynamic model, you have to have selected the Properties tab or you won’t find the appropriate windows. Then when you define the process you must have chosen the Simulation tab in order to prepare the flowsheet. The thermodynamics are not there in the Simulation tab, so you may have to go back and forth. The third tab is Energy Analysis. The advantage of this format is that the things seen in the ribbon are all pertinent to the tab you have chosen, which makes for fewer options, but the right ones. This format is called a ribbon format and was introduced by Microsoft for Excel some time ago. Then Aspen changed to it, and Comsol just changed to it. Matlab also changed to it, but in my book most of the time I’m describing actual programs, not the icons. The revised book will be available in April, 2014, with a stamp on the front identifying that it uses Aspen Plus 8.

The next thing I have to report is the republication of my 1972 book, Method of Weighted Residuals and Variational Principles by the Society of Applied Mathematics (SIAM) as a SIAM Classic 73. (I’m 73th in the list of classic applied mathematics books chosen by them in their history. In 1972, computers were just beginning to make an impact on the solution of differential equations. The first part of it treats differential equations governing transport problems, of flow, heat, and mass, using approximate methods and a series of functions, but using only a few terms. The Galerkin, collocation, least squares, and integral methods were all subsumed under the phrase Method of Weighted Residuals. The second part describes variational principles (or not) for those problems and shows how to find them and use them to construct error bounds and create stationary principles. Finally, the variational principles are used to derive error bounds that can be calculated for some problems. This was important because the series used in the approximate methods for nonlinear problems could not be extended to a large number of terms without the use of a computer. Since then computers have advanced considerably and much more sophisticated numerical techniques are available, but the mathematical principles described in the book are still valid, and still useful.

Chapter 11 in particular gives error bounds for many problems. Examples are given in the book, but there is a need to expand the coverage to include higher approximations and numerical methods that are now possible. Thus, problems are being formulated and posted at www.ChemEComp.com/MWR that use the error bounds, but also use methods like the finite difference method and finite element method. Some of the problems are given with solutions, some with partial solutions, and some have no solutions on the website, but they are available to instructors via SIAM. Right now there are only two problems – a boundary value problem and an eigenvalue problem, but each problem has about four sub-problems. The areas covered are boundary value problems (1D), eigenvalue problems, elliptic partial differential equations, parabolic partial differential equations in 1D and 2D. In each type there will be one problem with complete solutions using a variety of methods so that everyone can get a good head start.  Additional problems will be added as time permits, but they do give good examples of the value of error bounds and make use of modern computational tools like MATLAB® and Comsol Multiphysics®, the finite difference and finite element methods (when applicable – sometimes the error bounds are derived with pretty stringent mathematical conditions). So check it out, and keep checking it out as I add problems.

Bruce Finlayson

Posted in Chemical engineering computing | Leave a comment

Introduction to Chemical Engineering

Introduction to Chemical Engineering

September 7, 2013
I have been updating the material on use of Aspen Plus to include version 8.0-8.2. The way you get to the various windows is somewhat different, although most of the operating windows look very similar. Thus, some changes are needed. These will be completed about October 1st and posted on the Wiley website, and perhaps elsewhere.

I also received a pleasant surprise recently – the Korean translation of the book. Shown above are various versions of Introduction to Chemical Engineering Computing, the first edition, Chinese and Korean translations of it, and the 2nd edition.

Image | Posted on by | Tagged | Leave a comment

July 31, 2013

Image

Last week I attended part of the Summer Institute run by the Center for Process and Analytical Chemistry (CPAC – but not the political one!) (www.cpac.washington.edu). While I didn’t attend all the sessions (one of the privileges of being retired), I did hear some interesting talks. Kurt VandenBussche, UOP Honeywell, talked about big data in the petroleum industry. Apparently, companies are collecting billions of data points per day. This is then analyzed to decide what are the most profitable products to make from a given source, crude oil or from a bio-refinery. Sometimes this is done using science (Composition Based Modeling, Stephan Jaffe, ExxonMobil) based on properties of molecular segments, but sometimes it is just based on statistics and probability, with no understanding of the underlying reason. So much for chemistry classes! I joked that UOP has become the NSA of refining, since they have so much data available. (Aside: My own suggestion to the NSA to avoid people taking data out of the building with flash drives is to walk around the building while chewing gum, and put gum in all the flash drive sockets.)

The trend worldwide is that crude is becoming, on average, heavier with more sulfur. Just the opposite is happening in North Dakota, where the crude is lighter and has less sulfur. 

Another talk by Ray Chrisman of Atochemis srl (Italy) talked about continuous micro-processing (i.e. where micrdofluidics plays a role), in which he is an expert. He emphasized the need to spend more effort on separation and purification in small, easily-reproducible devices for extraction, crystallization, distillation, membrane separation, and chromatography. 

Apparently when making isobutanol in a biorefinery, the broth must be removed and the isobutanol removed, and the broth recycled, since the isobutanol kills organisms. Thus, attention goes beyond the chemical reactor and includes the separation system as an integral part of the reactor.

There were a few references to some continuous microprocessor systems that have been scaled up by adding identical systems. The idea of microprocessors is that you learn how to make one small one that has all the mixing, reaction, and separation, then make many to run in parallel, taking advantage of the processing techniques developed by the computer chip manufacturers. This is the subject of a book that contains an article written with my undergraduate research students about transport in microfluidic devices.

Bruce A. Finlayson, Pawel W. Drapala, Matt Gebhardt, Michael D. Harrison, Bryan Johnson, Marlina Lukman, Suwimol Kunaridtipol, Trevor Plaisted, Zachary Tyree, Jeremy VanBuren, Albert Witarsa, “Micro-component flow characterization,” Ch. in Micro-Instrumentation, (M. Koch, K.Vanden Bussche, R. Chrisman (ed.), Wiley, 2007).

More info about my microfluidic work is on my University web site: http://faculty.washington.edu/finlayso/ and choose papers. See also the book website, http://www.ChemEComp.com/, since many chapters of the book are devoted to flow and mass transfer in microdevices.

Aside | Posted on by | Leave a comment