# Introduction to Computations in Chemical Engineering

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

Dr. Vivek Utgikar presents the importance of computations and use of computational tools in chemical engineering. The classification of problems on the basis of their mathematical nature is also described.

Chemical engineering, like all engineering disciplines, is a quantitative field; that is, it requires accurate solutions of problems having high mathematical complexity. A chemical engineer must be able to *model*—develop quantitative mathematical expressions that describe the processes and phenomena—any system of interest, and *simulate*—solve the equations—the model. The solutions so obtained allow the engineer to design, operate, and control the processes. The courses described in Chapter 3, “Making of a Chemical Engineer,” provide the students with the theoretical basis for modeling the processes. The nature of the resulting equations and tools used for solving the equations are presented in this chapter.

## 4.1 Nature of Chemical Engineering Computational Problems

Chemical engineers deal with a multitude of equations ranging in complexity from simple linear equations to highly involved partial differential equations. The solution techniques accordingly range from simple calculations to very large computer programs. The classification of the problems based on the mathematical nature is presented in the following sections.

### 4.1.1 Algebraic Equations

Algebraic equations comprise the most common group of problems in chemical engineering. *Linear algebraic equations* are algebraic equations in which all the terms are either a constant or a first-order variable [1]. The straight line is represented by a linear algebraic equation. Linear algebraic equations are often encountered in phase equilibrium problems associated with separation processes. Figure 4.1 is a representation of one such separation operation, wherein a high-pressure liquid stream is fed to a flash drum where the system pressure is reduced, resulting in the formation of a vapor and a liquid stream that exit the drum. The compositions of the liquid and the vapor stream depend on the process conditions, and a chemical engineer has to calculate these compositions.

**Figure 4.1** Operation of a flash drum.

The governing equations for the system follow:

Equations 4.1 and 4.2 state that the mole fractions of all components, numbering *n*, in each phase add up to 1. *x _{i}* and

*y*represent the mole fractions of component

_{i}*i*in the outlet liquid and gas phases, respectively. The mole fractions in the feed stream are denoted by

*z*. (Typically,

_{i}*x*is used to represent the mole fraction when the phase is liquid, and

*y*is used when the phase is gaseous.) These two equations should be intuitively clear, as the mathematical statements of the concept that all fractions of any quantity must add up to the whole. Equation 4.3 is actually a system of

*n*equations relating the mole fraction of a component in the gas phase to the mole fraction of the same component in the liquid phase.

*K*is a characteristic constant for component

_{i}*i*and is dependent on pressure, temperature, and the nature of the component mixture. Solution of this system of equations allows us to calculate the compositions of the two different phases, which is necessary for designing the separation scheme for the mixture. Each term in the system of equations is linear (variables having power of 1) in

*x*or

*y*.

A similar system of equations is used to model a stagewise gas-liquid contactor, such as a distillation column, described in Chapter 3. Figure 4.2 represents a distillation column containing *N* equilibrium stages [2]; the vapor and liquid inlet and outlet flows can be seen in the figure for stage *k*.

**Figure 4.2** Distillation column—stagewise operation.

Source: Adapted from Wankat, P. C., *Separation Process Principles*, Third Edition, Prentice Hall, Upper Saddle River, New Jersey, 2012.

The material balances for each component yield the following system of *n* equations for stage *k*:

*V* and *L* represent the molar flow rates of the vapor and liquid stream, respectively. The subscripts for these flow rates represent the stage *from* which these flows exit. For example, *V _{k}* and

*L*are the vapor and liquid flow rates exiting stage

_{k}*k*, respectively.

*L*

_{k}_{+1}is the liquid flow rate exiting stage

*k*+ 1 and entering stage

*k*, and

*V*

_{k}_{−}

_{1}is the vapor flow rate exiting stage

*k*− 1 and entering stage

*k*. The mole fractions are doubly subscripted variables, the first subscript representing the component, the second one the stage. Equation 4.4 is the mathematical representation of the steady-state nature of the system for each component: the amount of component

*i*entering the stage through vapor and liquid flows is the same as the amount leaving through the exiting vapor and liquid flows. Each stage is assumed to be an equilibrium stage; that is, the exiting vapor and liquid flows are in equilibrium with each other. This allows us to utilize the equilibrium relationships of the form shown by equation 4.3 to complete the system description. The total number of equations for the entire column is

*N*×

*n*, which can be significantly large depending on the number of components present in the process stream and the number of stages needed to obtain the desired separation.

Algebraic equations encountered in chemical engineering can also be *polynomial equations*; that is, they can have variable orders greater than one. Equation 4.5 represents a typical polynomial equation of interest to chemical engineers:

This equation is an example of a *cubic equation of state*, *V* being the volume of the substance under the given conditions of temperature (*T*) and pressure (*P*). Constants *a*, *b*, *c*, and *d* are functions of the system pressure, temperature, number of moles, and fluid properties. An equation of state represents the relationship between the system temperature, pressure, and volume; the ideal gas law represented by the mathematical expression *PV* = *nRT* is the simplest of the equations of state. These equations of state are further used in thermodynamic calculations involving interconversion between energy and work, and phase equilibrium. It is readily apparent that an accurate equation of state is critical for superior process design and performance. Unfortunately, the volumetric behavior of most substances does not conform to the ideal gas law, and more complex equations are needed for accurately describing the *P*-*V*-*T* relationships for these substances. The cubic equations of state represent one of the developments addressing this need for improved accuracy. Equation 4.6 is an example of the cubic equation of state and is called the *van der Waals equation* [3].

In this equation, *a* and *b* are constants characteristic of the substance, and *n* is the number of moles present in the system.

Several other more complex equations have also been developed, many of them polynomial in nature. A chemical engineering student encounters polynomial equations in practically every subject described in Chapter 3.

### 4.1.2 Transcendental Equations

Many of the equations in chemical engineering involve functions of variables more complex than simple powers. An equation containing exponential, logarithmic, trigonometric, and other similar functions is not amenable to solution by algebraic means—that is, by simple addition, multiplication, or root extraction operations. Such equations “transcend” algebra and are called *transcendental equations* [4]. Equation 4.7, the *Nikuradse equation*, often used in fluid flow calculations, is an example of a transcendental equation [5].

*Re* in the equation represents *Reynolds number*, a dimensionless quantity of enormous significance in fluid mechanics and transport phenomena. The Nikuradse equation allows us to calculate *f*, the *friction factor*, a quantity that further leads to the estimation of pressure drop for a flowing fluid and, ultimately, the power requirements for material transfer.

Equation 4.8 is another example of a transcendental equation that is used in the design of chemical reactors [6].

*X _{A}* represents the conversion (extent of reaction) of the reactant A, τ the residence time (the time spent by the fluid in the reactor), and

*A*and

*E*the characteristic parameters that describe the rate of reaction. The equation can be used to calculate one of the three quantities

*X*, τ, or

_{A}*T*when the other two are specified.

Many processes involve consecutive chemical reactions that can be represented by the equation A → R → S. A is the starting reactant, which upon undergoing the reaction yields the specie R, which is often the desired product. However, R may undergo further reaction forming S. The typical concentration profiles for the three species in a reactor as a function of time are shown in Figure 4.3. As can be seen, the concentration of A decreases continuously, while that of S increases continuously. The concentration of the desired product R increases first, reaches a maximum, and then starts decreasing. The concentration-time relationship for R when both the reactions are first order^{2} with respect to the reactants is shown in equation 4.9 [7].

**Figure 4.3** Concentration profiles of species for the consecutive reaction scheme A → R → S.

Here, *C _{R}* is the concentration of R,

*C*

_{A}_{0}is the initial concentration of A, and

*k*

_{1}and

*k*

_{2}are the rate constants for the two reactions. Calculating the concentration of R at any specified time, when the rate constants and initial concentration of A are known, is straightforward. However, calculation of time needed to achieve a certain specified concentration of R is more challenging and requires use of techniques needed for the solution of transcendental equations.

### 4.1.3 Ordinary Differential Equations

Modeling—developing a set of governing equations—of systems of interest to chemical engineers often starts with defining a *differential element* of the system. This differential element is a subset of the larger system, but with infinitesimally small dimensions. All the processes and phenomena occurring in the larger system are represented in the differential element. The modeling approach involves writing conservation of mass and/or conservation of energy equations for the differential element. These equations yield ordinary differential equations when all the quantities are functions of a single independent variable. For example, equation 4.10 is a first-order differential equation relating the rate of change of concentration to time in a chemical reaction [6]. The equation indicates that the rate at which the concentration of species A, *C _{A}*, changes with time

*t*is linearly dependent on the concentration of A itself—an example of a first-order reaction. The parameter

*k*is called the rate constant.

Solution of this equation yields the concentration-time profile for the reactant A in the reaction, which provides the basis for the design of the reactor.

Higher-order differential equations are very common in chemical engineering systems. Figure 4.4 shows the cross-sectional view of a pipe conducting steam, the ubiquitous heat transfer medium in chemical plants. The pipe will inevitably be covered with insulation to minimize heat loss to the surroundings. Note that the heat loss can be reduced but not completely eliminated. Obviously, choosing proper insulation and determining the resultant heat loss is extremely important for estimating the energy costs. Heat loss can be calculated from the temperature-distance profiles existing in the system [5].

**Figure 4.4** Temperature profile for an insulated steam pipe.

The governing equation describing the heat transfer for a cylindrical pipe follows:

Equation 4.11 is a second-order ordinary differential equation that governs the relationship between temperature *T* and radial distance *r* from the center of the pipe. *k _{T}* is the thermal conductivity of the material, which depends on the temperature. As the temperature varies with respect to the radial position, the thermal conductivity is also a function of the radial position. Solution of this equation yields the temperature profile within that object, which in turn allows us to determine the heat lost to the surroundings.

The solution of differential equations requires specifying values of dependent variable(s) at certain values of the independent variable. These specifications are termed *boundary* conditions (at a specific location, with respect to dimensional coordinate) or *initial* conditions (with respect to time). Complete solution requires as many boundary/initial conditions as the order of the differential equation [4].

Frequently, modeling of a system leads to a set of ordinary differential equations, consisting of two or more dependent variables that are functions of the same independent variable. These equations need to be solved simultaneously to obtain the quantitative description of the system.

### 4.1.4 Partial Differential Equations

Properties of systems are frequently dependent on, or are functions of, more than one independent variable. Modeling of such systems leads to a partial differential equation [4]. Temperature within a rod, for example, may vary radially as well as axially. Similarly, concentration of a species within a system may depend on the location as well as vary with time. Figure 4.5 shows batch drying of a polymer film cast on a surface. The solvent present in the polymer diffuses through the film to the surface, where it is carried away by an air sweep.

**Figure 4.5** Drying of polymer film.

The concentration of the solvent within the film is a function of time as well as distance from the surface. Equation 4.12 is the fundamental equation^{3} for governing the solvent mass transport within the film, a partial differential equation that is first order with respect to time *t* and second order with respect to location *x*.

*D _{A}* is the diffusivity of solvent A in the polymer film, which depends on the properties of the system.

The solution of this (and other partial differential equations) requires an appropriate number of specifications (boundary and initial conditions) depending on orders with respect to the independent variables.

### 4.1.5 Integral Equations

The differential equations representing the behavior of the system are obtained by the application of conservation principles to a differential element. Integration of these differential equations leads to expressions that describe the overall behavior of the entire system. Many of the differential equations can be integrated analytically, yielding algebraic or transcendental equations. However, such analytical integration is not always possible, and numerical computation is necessary for obtaining the integrals [4]. The determination of reactor volume often involves equations of the following form [6]:

Here, *F _{A}*

_{0}is the molar flow rate of species A, and −

*r*is the rate of reaction, which is a function of conversion

_{A}*X*. Equation 4.13 is represented by Figure 4.6, where the shaded region represents the integral and is equal to the quantity

_{A}*V*/

*F*

_{A}_{0}.

**Figure 4.6** Determination of reactor volume.

When the reaction rate cannot be easily integrated analytically, the shaded region—the area under the curve—is evaluated numerically.

### 4.1.6 Regression Analysis and Interpolation

Chemical engineers routinely collect discrete data through various experiments, which they further use for design, control, and optimization. This often requires obtaining the value of the function (or dependent variable) at some value of the independent variable within the domain of experimental data where direct measurement is not available. Regression analysis involves fitting a smooth curve that approximates the data, yielding a continuous function [4]. It is then possible to interpolate—obtain the function value at any intermediate value of the independent variable. It is also possible to extrapolate—obtain the function value at a value of the independent variable that is *outside* the data range used for regression analysis. *Linear regression* involves approximating the data using a straight line, whereas *nonlinear regression* involves using polynomial or transcendental functions for the same purpose. *Multiple regression* involves performing regression analysis involving two or more independent variables that determine the value of the function. For example, equation 4.10 can be integrated to obtain the following mathematical relationship between concentration and time:

To determine the rate constant *k*, experiments are conducted obtaining the concentration-time data and a linear regression carried out between ln(*C _{A}*) and

*t*, as shown in Figure 4.7.

**Figure 4.7** Example of linear regression for determination of rate constant.

It can readily be seen that a chemical engineer must have skills to deal with and solve problems ranging from simple arithmetic calculations to those requiring highly sophisticated and involved algorithms. Further, the solution must be obtained fairly rapidly for the individuals and organizations to maintain their competitive edge and respond to changing conditions. Section 4.2 presents a brief overview of solution algorithms developed for numerical solutions of different types of problems. Section 4.3 describes the different tools including the machines and software available to chemical engineers to perform these computations.