• No results found

ITERATIVE CONVERGENCE METHODS .1 Bisection Method (Interval Halving).1 Bisection Method (Interval Halving)

Numerical Methods

2.2 ITERATIVE CONVERGENCE METHODS .1 Bisection Method (Interval Halving).1 Bisection Method (Interval Halving)

Numerical Methods

2.1 INTRODUCTION

Mathematical modelling of most of the chemical processes leads to a system of complex model equations.

In order to investigate the process characteristics, it is necessary to solve the modelling equations. The solution of a system of nonlinear equations is one of the challenging tasks and it is well-known that no completely satisfactory method exists for it. However, there are at present two ways of finding solutions, namely, analytical method and numerical method. An analytical method produces, when possible, exact solutions usually in the form of general mathematical expressions (like ). For example, analytical solutions of differential equations give expressions for functions, which are distinct from discrete numerical values. Numerical methods, on the other hand, produce approximate solutions in the form of discrete values or numbers.

Realistic mathematical process models in chemical engineering field usually consist of ordinary differential equations (ODEs) coupled with nonlinear algebraic equations. The ODEs are generally derived making mass and energy balance, and the supporting algebraic equations usually correlate the parameters with the process variables. Let us take an example of a distillation column. An ODE is formed if a mass balance is made around a tray, whereas an algebraic equation correlates the vapour–liquid equilibrium coefficient with the phase composition, temperature and pressure.

The simplest of the equations mentioned above is a linear algebraic equation. The exact solution of this linear equation is immediate and consists of a single value or point. Algebraic quadratic equations can also be solved exactly, if solutions exist, leading to two solutions. In general, finding exact solutions to higher-order algebraic equations is not a feasible task and numerical methods must be employed to find approximate solutions. For a system having two or more coupled nonlinear algebraic equations, numerical methods are routinely employed to find approximate solutions.

Ordinary differential equations are in general much more difficult to solve exactly. Exact analytical solutions are available only for linear differential equations. For the case of nonlinear ODEs, explicit exact solutions are quite impossible and numerical methods are employed. Recall that for solving a partial differential equation (PDE), it is common to convert the PDE to a set of ordinary differential equations and the standard techniques are followed for solving those transformed ODEs.

In this book, the mathematical model of several chemical processes has been developed. The dynamic simulations of those models are also incorporated for detailed analysis of the process. Whenever we proceed to develop the dynamic process simulator after the mathematical model development, we must have good knowledge of the numerical methods. Now we will discuss some common numerical techniques that will be employed to solve the nonlinear differential and algebraic equations.

2.2 ITERATIVE CONVERGENCE METHODS 2.2.1 Bisection Method (Interval Halving)

Suppose that we would like to solve a nonlinear algebraic equation of the form:

y = f(x) = 0...(2.1)

We can use the following steps according to the Bisection method (Finlayson, 1980; Riggs, 1988).

Step 1: Find two guess values of x (say x1 and x2 at the first iteration), so that one where f(x) is negative (< 0) and another where f(x) is positive (> 0).

Step 2: Find the midpoint and then evaluate f(x) at that point. (For example, at the first iteration, the midpoint is x3 [= (x1 + x2)/2] and naturally, the function to be evaluated is f(x3)).

Step 3: Among the two guess values of x, one should be replaced by the value of x at midpoint. Replace the bracket limit that has the same sign as the function value at the midpoint, with the midpoint value.

[If the value of f(x1) has the same sign with the value of f(x3), then x1 will be replaced by x3, otherwise x2 will be replaced.]

Step 4: Check for convergence. If not converged, go back to Step 2.

This iterative process continues until the size of the interval shrinks below a convergence tolerance level. If the interval shrinks below a tolerance level, we have found an approximate value of the root. The Bisection method is also known as interval halving method since it can halve the size of the interval in each iteration. Figure 2.1 describes this numerical technique.

FIGURE 2.1 Illustration of the Bisection method.

The Bisection method actually locates a root by repeatedly narrowing the distance between the two guesses. When an interval contains a root, this simple numerical method never fails. However, the main drawback of the Bisection technique is the slow convergence rate. Also, it is not easily extended to multivariable systems.

2.2.2 Secant Method

Because of the slow convergence provided by the Bisection approach, the Secant method (Finlayson, 1980; Riggs, 1988; Burden and Faires, 1985) receives the attention as an alternative iterative technique.

Although this approach is similar to the Bisection method, instead of using the average of the interval endpoints to select the next root estimate, it is required to construct a secant line and find its x-intercept as the next root estimate.

Suppose we are looking for a root of Equation (2.1). Let xk–1 and xk are two approximations to the root. Now construct a straight line through the points (xk–1, fk–1) and

(xk, fk), where fk–1 = f(xk–1) and fk = f(xk). Note that this line is a secant (or chord) of the function f.

The slope of the straight line is:

...(2.2)

Now take the point of intersection of the straight line with the x-axis as the next approximation to the root.

To compute the next approximation xk+1, we need to form an equation of straight line as:

...(2.3)

For finding its x-intercept, let y = fk+1 = 0. Simplifying, one obtains ...(2.4)

Further simplifying, we get

...(2.5)

This is called the Secant or the Chord method and this approach involves iterating on this process until the guess is sufficiently close to the root. This numerical algorithm is illustrated graphically in Figure 2.2.

If the approximations are such that fkfk–1 < 0, then the approach, as represented by Equation (2.4) or Equation (2.5), is known as the False Position or Regula Falsi method. Similar to the Secant method, the False Position algorithm also uses a straight line to approximate the function in the local region of interest. This technique is illustrated in

Figure 2.3. Note that the main difference between these two convergence techniques is that the Secant method retains the most recent two estimates, while the False Position method keeps the most recent estimate and the next recent one which has an opposite sign in the function value. However, this approach may provide a lower and uncertain convergence rate compared to the

FIGURE 2.2 Illustration of the Secant method.

Secant method because the False Position approach sometimes retains an older reference point to

maintain an opposite sign bracket around the root.

FIGURE 2.3 Illustration of the False Position method.

2.2.3 Newton–Raphson Method

The Newton–Raphson method (Finlayson, 1980; Goldstine, 1977) is the most common and popular method for solving nonlinear algebraic equations. This iterative convergence algorithm, also known as Newton’s method, can be derived from Taylor series expansion of f(x):

...(2.6)

If we neglect all terms of order two and higher, Equation (2.6) yields:

...(2.7)

That means,

...(2.8)

where

We need to calculate the guess for x at iteration k + 1 as a function of the value at iteration k by defining:

xk+1 = xk+1 – xk...(2.9) As assumed fk = f(xk), Equation (2.8) gives:

...(2.10) From Equations (2.9) and (2.10), we obtain

...(2.11)

The above equation represents the Newton–Raphson convergence method for a single-variable problem.

Equation (2.11) may also be derived from the formula of the Secant method [Equation (2.4)] using the following finite difference approximation

...(2.12)

The graphical representation of the Newton’s method is shown in Figure 2.4.

FIGURE 2.4 Illustration of the Newton–Raphson method.

The extension of the Newton–Raphson algorithm to multivariable systems is fairly simple and straightforward. Let us consider a multivariable system represented by:

f(x) = 0...(2.13)

This equation consists of a set of n equations with n variables (x1, x2, ..., xn) as:

...(2.14)

The Taylor series gives for each fi after neglecting the second and higher-order derivative terms as:

...(2.15)

The above equation yields the following matrix form:

f(x) + Jx = 0...(2.16) where the Jacobian matrix

From Equation (2.16),

x = –J–1f(x)...(2.17)

To obtain the guess for x at iteration k + 1, Equation (2.17) gives:

xk+1 – xk = –Jk–1 f(xk)...(2.18) That is,

...(2.19)

Remember that xk is a vector of values at iteration k. For a single variable system, obviously Equation (2.19) yields:

...[from Equation (2.11)]

The Newton–Raphson method is very efficient iterative convergence technique compared to many other simple methods. However, at each step, this method requires the calculation of the derivative of a function at the reference point, which is not always easy. It also may sometimes lead to stability problems particularly if the function is strongly nonlinear and if the initial guess is very poor.

2.2.4 Muller Method

This is an iterative convergence method (Jain, Iyengar and Jain, 1995) based on second-degree (quadratic) equation. Let us consider a polynomial of degree 2:

p(x) = a0x2 + a1x + a2 = 0...(2.20)

where a0( 0), a1 and a2 are three arbitrary parameters. In this convergence approach, three values of the unknown x variable are guessed. Let, xk–2, xk–1 and xk are three approximations to the actual root r of f(x) = 0. To obtain a0, a1 and a2, we may use the following conditions:

...(2.21a) ...(2.21b) ...(2.21c)

and then substituting a0, a1 and a2 in Equation (2.20), finally we obtain

...(2.22)

In Equations (2.21a, 2.21b and 2.21c), pk–2 = p(xk–2), pk–1 = p(xk–1) and pk = p(xk). Equation (2.22) can be converted to:

...(2.23)

where g = x – xk, gk = xk – xk–1 and gk–1 = xk–1 – xk–2. Further assuming  = g/gk, k = gk/gk–1 and

k = 1 + k, Equation (2.23) gets the form:

...(2.24) where...

Dividing Equation (2.24) by 2, we obtain ...(2.25)

Solving this quadratic equation for 1/, we get

...(2.26)

The selection of the sign in the denominator in Equation (2.26) should be such that k+1 has the smallest absolute value.

Recall the assumption,  = g/gk. It implies, ...(2.27)

FIGURE 2.5 Illustration of the Muller method.

Rearranging,

...(2.28) Replacing x by xk+1,

...(2.29)

This equation represents the Muller method. It is illustrated in Figure 2.5. In this convergence approach, the next approximation xk+1 is obtained as the zero of the second-degree curve passing through the points (xk–2, fk–2), (xk–1, fk–1) and (xk, fk).

To obtain an approximate root of a nonlinear equation, the Muller method uses a polynomial of degree two (quadratic equation), whereas the Newton–Raphson method uses a straight line (linear equation).

Faster rate of convergence is achieved by the Muller method compared to the Newton–Raphson method when the functions are highly curvilinear.