- 4.1 Nature of Chemical Engineering Computational Problems
- 4.2 Solution Algorithms
- 4.3 Computational Tools-Machines and Software
- 4.4 Summary
- References
- Problems

## 4.3 Computational Tools—Machines and Software

The two components enabling the computations are the hardware—machines that perform the calculations—and the software—the instructions to run solution algorithms by the machines. Both these components are described in the sections that follow.

### 4.3.1 Computational Machines

A counting frame, or an *abacus*, is one of the earliest devices and has been used for more than three millennia for rapid calculations. This remarkable device continues to be used in various parts of the world to improve on manual hand calculations. Abaci are also popular as teaching tools in elementary schools. Calculations using an abacus involve physically moving beads on a wire, which clearly constrains the speed and type of calculations that can be performed.

A couple of tools developed in response to the ever-increasing demand for higher speeds worth mentioning are the *log table* and the *slide rule*. Figure 4.8 shows a page from the log table.

**Figure 4.8** A log table page.

A log table enables all calculations, including highly complex ones, to be reduced to additions/subtractions, which can then be easily done by hand. The use of log tables is illustrated for the simple case of calculating the circumference *C* of a circle of diameter *D*. The concept and steps in calculations are as follows:

Equations 4.21, 4.22, and 4.23 demonstrate how a multiplication operation can be performed as an addition operation using the log tables. Logarithms of π and diameter are looked up in the log tables and added to obtain logarithm of the circumference. The answer is obtained by looking up the antilog of the sum in another set of tables.

The calculation will work with logarithms to any base; however, generally the tables are those of common logarithms (to the base 10) rather than natural logarithms (to the base *e*). An impressive compilation of common logarithms up to 24 decimal places of numbers leading to 200,000 was available by the end of the 18th century through the efforts of a large number of individuals.

Such compilations and early calculating machines were hardly portable, a disadvantage that was overcome by the slide rule. This elegant device was the size of a ruler and small enough to fit in a shirt pocket; a couple of examples are shown in Figure 4.9. As seen from the figure, a slide rule has a central sliding part, and both the fixed and sliding parts are marked with several scales. Multiplication, division, and logarithmic as well as trigonometric calculations can be rapidly performed using the slide rule, which became an indispensable tool for engineers until it was supplanted by inexpensive scientific calculators in the mid-1970s.

**Figure 4.9** Slide rule—(a) closed, (b) open (sliding scale pulled out).

The advent of computers enabled engineers to perform highly complex, involved, repetitive calculations and improve the accuracy of solutions. Mainframe computers were ubiquitous by the 1950s, with engineers writing programs and submitting them as jobs to be run on the mainframes.

Rapid technological advances in memory and data storage, materials, and processors resulted in lowering the cost of computers, making them affordable to most people. By the mid-1990s, personal computers (PCs) had become ubiquitous and an essential accessory for an engineering student. Continual reduction in the cost and size of devices has resulted in the availability of portable devices such as laptops and tablets that allow us to perform practically all types of computations except for the most complicated ones that require the use of supercomputers.

### 4.3.2 Software

As previously mentioned, computing machines need to be given instructions for performing calculations. These instructions are codified in a well-defined structure—the programming language. All the computational steps are written according to the rules of the programming language, resulting in a program, which can then be compiled and executed by the computer [4].

Developed in the 1950s, *Fortran* (from *for*mula *tran*slation) became the dominant programming language for scientific computing, and even today remains the preferred language for highly intensive computations of large systems. Each line of the Fortran program used to be transferred onto a card using a keypunch machine. (An IBM punched card with 80 columns is shown in Figure 4.10. Each number, letter, and symbol was represented by a hole or holes punched in the column [11]). A deck of such punched cards would constitute a program, which along with the necessary data would be submitted to be run as a job on the mainframe computer. Subsequent developments eliminated the need for punch cards, and a Fortran program can now be run on a personal computer, similar to programs in other languages.

**Figure 4.10** An IBM punched card illustrating representation of numbers and letters by punched holes.

Source: Ceruzzi, P. E., *A History of Modern Computing*, Second Edition, MIT Press, Cambridge, Massachusetts, 2003.

A large number of program modules developed over the past 60 years have resulted in a valuable library of programs in Fortran, and these modules are used every day throughout scientific and engineering computations.

Although Fortran remains indispensable for advanced computing, a large number of advanced software programs are available on the PC to perform most of the chemical engineering computations. The ubiquitous availability of these software programs has essentially eliminated the need for individuals to write their own software codes for all but only very specific problems [12]. Following are descriptions of a few of these software packages.

#### 4.3.2.1 Spreadsheets

A spreadsheet program is an integral component of a software package for PCs, with Microsoft Excel being the dominant one. Spreadsheets store data in a grid of up to 1 million rows and 16,000 columns. Spreadsheets have built-in functions to perform practically all calculations, and also provide a programming capability to execute any other type of computations. The features of spreadsheet programs include, among others,

Tools for solving algebraic and transcendental equations

Graphing and regression tools

Tools for solving iterative calculations

Data and statistical analysis tools

Spreadsheets can be used to solve all types of computation problems, including differential and integral equations, described in section 4.1.

#### 4.3.2.2 Computing Packages

A number of software packages that provide a computing environment have become available over the past 30 years. These include MATLAB (Mathworks, Inc., Massachusetts, USA), Mathematica (Wolfram Research, Illinois, USA), Maple (Waterloo Maple, Ontario, Canada), Mathcad (MathSoft, Massachusetts, USA), and others. These packages typically offer, to varying degrees, an ability to perform numerical and symbolic computations, graphing, as well as programming. Each package has its characteristic *syntax*—rules for constructing instructions—and degree of user-friendliness. As with spreadsheets, practically all types of computational problems can be handled by these software packages that also provide an additional benefit of having built-in scientific/engineering constants and units. Appendix A presents a comparative discussion of some of these programs.

#### 4.3.2.3 COMSOL

COMSOL (Comsol Group, Sweden and USA) is a powerful software package specifically geared to solve coupled physics and engineering problems. Marketed as a multiphysics software, COMSOL offers a modeling and simulation environment for all engineering disciplines. The various modules available in COMSOL allow users to solve problems related to fluid flow, heat transfer, reaction engineering, electrochemistry, and many others.

#### 4.3.2.4 Process Simulation Software

Chemical process plants are complex structures consisting of a large number of units. The software systems previously described support computations related to a single step or a single unit. Several comprehensive process simulation software packages are used by the chemical industry to design, control, and optimize operations of chemical process plants. The computational power offered by these software systems enables a chemical engineer to obtain integrated plant design in a fraction of the time needed before their advent. Following are some prominent software examples:

Aspen Plus by AspenTech, Massachusetts, USA

PRO/II by Invensys, Texas, USA (a division of Schneider Electric)

ProSimPlus by ProSim, S.A., France

CHEMCAD by Chemstations, Inc., Texas, USA

All of these software systems offer similar capabilities and user interfaces. A design engineer will invariably be using one of these environments for designing an operation, a unit, or the plant. Appendix B illustrates the capabilities of one of these software programs—PRO/II—for solving a complex separation problem to provide an idea of the amazing computational power at our disposal.

In addition to these general-purpose software programs, some specialized software for specific applications is also available, such as FLOTRAN/ANSYS (ANSYS Inc., Pennsylvania, United States) for pipe flow/fluid dynamics computations. Open source software such as Modelica (JModelica.org) is also available for modeling and simulation of complex systems.