Solving Model Equations

Process Modeling has summarized how IPSE GO represents a process mathematically by a system of nonlinear equations. This section explains how the standard calculation kernel of IPSE GO solves the resulting equation system.

Depending on the specifications that are made for a project, different types of mathematical problems have to be solved. In the context of process simulation, the probably most common type of problem is to solve a defined nonlinear algebraic equation system where the number of variables is equal to the number of model equations. This is the case for a process operating at steady-state conditions. For such a problem type, IPSE GO has a built-in standard calculation kernel.

Solution Method

All solution methods for systems of nonlinear equations are based on the iteration of an initial value. The convergence of the procedure depends to a high degree on the selection of the initial values. Therefore, for large systems of equations the selection of initial values represents a major problem.

IPSE GO avoids solving the system of equations directly. Instead it uses an approach similar to the one employed by engineers making their calculations of processes with "pen and paper". In this approach variables are grouped together, so that each group can be calculated one after the other. The variables of each group are chosen in such a way that the size of the group is minimized. This means that the number of equations solved simultaneously is also minimized. In practice, it turns out that very frequently a group only contains a single variable/equation. Thus, the problems of convergence are usually confined to single equations or to systems of equations with only a few variables.

To solve a system, IPSE GO adopts a two-phase approach:

  • System analysis. In the analysis phase IPSE GO determines the optimum solution method for the equation system. It analyses the order in which it can treat the variables of a model. If IPSE GO must solve several equations simultaneously, it combines them into groups. During the analysis phase IPSE GO also chooses the optimum numerical method for each group.

  • Numerical solution. When calculating the numerical solution of the system, IPSE GO solves the equations in the order pre-established by the analysis, and uses the numerical methods that also have been chosen in the analysis phase.

System Analysis

During system analysis the solver checks the structure of the system of equations that has to be solved. It identifies and reports structural errors of the system and determines the optimum strategy for solving the system equations.

IPSE GO gives users an enormous level of flexibility by allowing them to prescribe any combination of process variables as long as the selected values make the process model defined. However this flexibility also comes with the challenge to select the appropriate variables as settings. Two parts of the system analysis help the user with this choice:

  • Settings Analysis. Whenever a system is underspecified the settings analysis identifies possible settings and displays them in the flowsheet. Possible settings are also marked in the dialog for entering data. It is the task of the user to set one of the possible settings in order to reduced the level of under-specification.

  • Conflict Analysis. It identifies settings which are in conflict with each other both for underspecified as well as for overspecified systems and displays them in the flowsheet. Conflicting Settings are also marked in the dialog for entering data. It is the task of the user to choose one of the conflicting settings and to eliminate it in order to reduce the level of overspecification.

It is important to notice that in order to follow the suggestions of settings analysis and conflict analysis you have to change one single setting at a time. After changing the setting the solver must be run again.

Numerical Solution

For the numerical solution IPSE GO uses the Newton-Raphson method for finding solutions. The Newton-Raphson method starts from starting values and approximates the system functions by their linearization at starting value. Using the linearized system a new starting value is calculated. This process is repeated until a sufficiently accurate solution is reached.

Two variants of the Newton-Raphson method are available:

  • Undamped Newton method

  • Damped Newton method

In the case of the undamped Newton method, a value \(\text{Δx}\) which is the difference between the starting value and the solution of the linearized system is calculated. \(\text{Δx}\) is then added as a correction to the starting value in order to obtain a new starting value for the next iteration step. This is illustrated in Figure 1.

image
Figure 1. Undamped Newton-Raphson Method
image
Figure 2. Damped Newton-Raphson Method

In the case of the damped Newton method, \(\text{Δx}\) is calculated in the same way as in the case of the undamped Newton method. However, instead of adding the full correction, \(\text{Δx}\) is multiplied by a damping factor \(\alpha\) where \(0.0 < \alpha \leq 1.0\). With a damping factor 1.0, the results are identical to those obtained with the undamped Newton method. This is illustrated in Figure 2.

IPSE GO only applies damping if an undamped step fails. This means, the initial damping factor is 1.0. If the step fails, IPSE GO decreases the damping factor by multiplying it with a decrease factor until the step is successful or a minimum damping factor is reached.

There are several reasons for IPSE GO to classify an iteration as failed:

  • The error for all equations does not decease, but increases over an iteration step.

  • One or more errors occur while taking an iteration step.

  • The iteration step is in principal correct, but calculating function values or derivatives at the next intermediate solution fails.

IPSE reports all errors and warnings that occur during a failed iteration step as “recovered”.

During the numerical solution the variables of the system are iterated until one of the following two criteria are satisfied:

  • The relative change in each variable is less than a certain threshold.

  • The difference between the left and the right side of each equation, also called the function residual, is less than a certain threshold.

IPSE GO uses a total error for all variables, the x-tolerance \(E_{x}\), and a total error for all equations, the y-tolerance \(E_{f}\). Based on the assumption that each variable contributes equally to the system solution and the total number of variables in the system abbreviated by n, the error permitted for a single variable is:

\[\varepsilon_{x} = \frac{E_{X}}{\sqrt{n}}\]

The error permitted for a single equation is

\[\varepsilon_{f} = \frac{E_{f}}{\sqrt{n}}\]

If an error occurs while the system is being solved, IPSE GO terminates the solution process and issues an error message. The following errors can occur:

  • The system of equations is structurally singular. Structural singularities are the consequence of invalid prescribed values. To fix this problem you have to check those variables that you have prescribed.

  • The system of equations is numerically singular. The reason for numerical singularities is, most frequently, the fact that particular equations become singular. For example, the function \(t = f(p,h)\), which determines the temperature, has a horizontal tangent for wet steam. Applying the Newton method, this causes an error.

  • The system of equations does not converge within the given number of solution steps.

  • Errors in the built-in or external numerical functions. For example, the attempt to calculate the square root of a negative value causes such an error.

Refer to Error and Warnings for more details about the error messages that can occur during the system solution.

Possible Problems During the Solution

Process models can contain various errors that inhibit the system solution. These problems usually have a physical background, that is, the model is physically invalid. The errors can manifest themselves in different ways Additionally, convergence problems can appear in valid models, if the starting values for the iteration are badly chosen. In the following section, different reasons for such problems are explained.

Structural Singularities

image
Figure 3. Structural singularities

Figure 3 shows a simple process model, containing a sink and a source for a stream. The stream contains three variables: mass flow, pressure and temperature. These variables can be defined both in the source and in the sink. In order to fully define the model, three of these variables must be prescribed. The choice of variables is free, as long as they are physically possible. For instance, depending on the problem to be solved, the variables \(m_{f}\), \(p_{f}\) and \(T_{f}\), or \(T_{f}\), \(p_{d}\) and \(m_{s}\) can be chosen. However, it is not possible to choose \(p_{f}\), \(T_{f}\) together with \(T_{s}\), \(p_{s}\) or \(p_{d}\). These variables are not independent from each other. If these variables are chosen, the problem becomes structurally singular.

An example of a structurally singular system of equations is shown below.

\[f(x_{1},x_{2},x_{3})= \begin{matrix} f_{1}: & x_{1} & +x_{2} & & = & 2.0 \\ f_{2}: & x_{1} & & & = & 1.0 \\ f_{3}: & & x_{2} & & = & 1.0 \\ \end{matrix}\]

In this system of equations, \(x_{3}\) can not be calculated. Equations \(f_{2}\) and \(f_{3}\) determine \(x_{1}\) and \(x_{2}\). Notice that variable \(x_{3}\) can not be calculated, and \(f_{3}\) is superfluous. This error is found during the system analysis, and an error message is issued.

IPSE GO can not decide which values you actually should choose. Even the simple system of Figure 3 already allows 27 valid combinations of variables and another 57 combinations are invalid.