# (287g) Efficient Solution of Multiple-Model, Multiple-Algorithm Problems in Undergraduate and Graduate Education

#### AIChE Annual Meeting

#### 2007

#### 2007 Annual Meeting

#### Education

#### Computing and Simulation in Che Curriculum

#### Tuesday, November 6, 2007 - 6:00pm to 6:25pm

Mathematical software packages such as Excel, MAPLE, MATHCAD, MATLAB, Mathematica and POLYMATH are commonly used for numerical problem solving in engineering education (Cutlip et al., 1998, Shacham and Cutlip, 1999). From the numerical solution perspective, it is convenient to characterize the various problems as Single Model-Single Algorithm (SMSA) problems or complex problems with some combination of Multiple Models and Multiple Algorithms. Typical examples of SMSA type problems include the following: 1. Steady State Operation of a Tubular Reactor. The model typically includes a system of ordinary differential equations and explicit algebraic equations. A single numerical integration algorithm (such as the 4th order Runge-Kutta) that can be used to solve the model. 2. Bubble-point Temperature Calculation for a Non-ideal Liquid Mixture. The model includes a system of implicit and explicit algebraic equation, and a non-linear equation solver algorithm (such as the Newton-Raphson technique) that can be used to solve the problem. 3. Regression of the Wagner Equation to Vapor Pressure Data. This type of representation of data utilizes using linear regression and nonlinear regression algorithms. The application of the mathematical software packages for solving SMSA problems has essentially replaced most other solution techniques as can be seen in many recent textbooks (see, for example, Fogler, 2005). However, for complex problem types, the solution process is often more involved. The types of models included in the "complex" category are: 1. Multiple Model Single Algorithm (MMSA) Problem. A typical example of such a problem is the cyclic operation of a semi-batch bioreactor (Cutlip and Shacham, 2007). The three modes of operation of the bioreactor (initialization, processing and harvesting) are represented by different models comprised of ordinary differential equations and explicit algebraic equations. All models can be solved by one numerical integration algorithm (such as the 4th order Runge-Kutta). 2. Single Model Multiple Algorithm (SMMA) Problem. An example of such a problem is parameter estimation in dynamic systems. In this case there is a model comprising of ordinary differential equations and explicit algebraic equations as well as parameters that should be determined by using regression techniques on given data. One option is to solve this system by integrating the differential equations with specified parameter values in an internal loop, and then minimizing the sum of squares of the difference between the calculated and the experimental values using an optimization algorithm in the outer loop. An additional example for a SMMA problem is the solution of two point boundary value ODE problem where the integration of the model is carried out in the inside loop and a nonlinear equation solver algorithm adjusts the boundary values in an outer loop. Another is the solution of differential-algebraic systems of equations where the same algorithms are used but in an opposite hierarchy. 3. Multiple Model Multiple Algorithm (MMMA) Problem. A typical example of such a problem is the optimization of the semi-batch bioreactor, described earlier, with respect with some of its operational parameters. An additional MMMA type problem is the modeling of an exothermic batch reactor where the two stages of operation (heating and cooling) require different models and different integration algorithms (stiff and non-stiff).

The solution of such complex problems can be rather cumbersome and time consuming even if mathematical software packages are used, as manual transfer of data from one model to another and consecutive manual reruns may be, often, required. However, the combined use of several software packages of various levels of complexity, flexibility and user friendliness, can reduce considerably the time and effort required for solving complex models. Following this premise, the models representing the various stages of the problems are coded and tested using a software package (for example, POLYMATH, a product of Polymath Software, http://www.polymath-software.com) that requires very little technical coding effort. After testing each of the modules separately, they are combined into one program using a programming language or a mathematical software package that supports programming (say, MATLAB, a trademark of The Math Works, Inc. http://www.mathworks.com ). The probability of introducing errors into the model equations can be minimized with the latest POLYMATH as the various modules can be automatically converted directly to MATLAB functions. All logical variables and intrinsic functions are translated. Thus MATLAB can handle the consecutive and repetitive calls to the various models, applying the appropriate solution algorithms and assigning the hierarchy of the computations.

In this paper, several examples of "complex" problems will be presented and the use of the POLYMATH-MATLAB software combination for efficient solution of these problems will be demonstrated. Our experience in improving the programming and the problem solving skills of the students using these tools will also be discussed.

References

1. Cutlip, M., Hwalek, J.J., Nuttall, H.E., Shacham, M., Brule, J., Widman, J., Han, T., Finlayson, B., Rosen, E. M. and Taylor, R., ?A Collection of Ten Numerical Problems in Chemical Engineering Solved by Various Mathematical Software Packages.? Comput. Appl. Eng. Educ., 6(3), 169-180 (1998) 2. Cutlip, M. B. and Shacham, M. Problem Solving In Chemical and Biochemical Engineering with Polymath, Excel and MATLAB. Prentice-Hall, Upper Saddle River, New-Jersey, 2007. 3. Fogler, H. S., Elements of Chemical Reaction Engineering, 4th Ed, Prentice-Hall, Upper Saddle River, New-Jersey, 2005. 1. Shacham, M. and M.B. Cutlip, ?A Comparison of Six Numerical Software Packages for Educational Use in the Chemical Engineering Curriculum?, Computers in Education Journal, IX(3), 9-15 (1999)

### Checkout

This paper has an Extended Abstract file available; you must purchase the conference proceedings to access it.

### Do you already own this?

Log In for instructions on accessing this content.

### Pricing

####
**Individuals**

AIChE Members | $150.00 |

AIChE Graduate Student Members | Free |

AIChE Undergraduate Student Members | Free |

Non-Members | $225.00 |