Domain’s Sweep, a Computational Method to Optimise Chemical and Physical Processes

Many of engineering’s problems are about to optimise equations, functions and process models equations which appear on common or even complex science’s cases. Most applied optimisation methods nowadays can only be used on particular cases, so the main objective of this article is to define a computational method that can optimise or even find target values for specified objective functions and variables, by just using computer effort. Chemical plants involve many differential equations and they can be optimised with more facility now. On this paper, there are shown as example, an optimisation for a chemical reactor, which is found the optimal temperature and volumetric flow rate of feed, for the given objective function being the composition of the desired product. Named Domain’s Sweep, it is an algorithm that evaluate given(s) mathematical function(s) and/or equation(s) by varying your(s) independent variable(s) through loops with a given step size and solving it after closing the degrees of freedom, and finally, with some condition statements, store all the optimum values of given or created objective functions with its respective independent variables. In another words, the user create an objective function and this method find the function’s maximum, minimum or a certain chosen target value, even if it does not have an inflection point in the given search interval of the independent variables.


Introduction
Numerical methods for optimisation of equations usually uses mathematical fundamentals and theories over each specific situation and on most of them, it is necessary a given stop criteria and these methods are just used to find the maximum and the minimum value of a function. Sometimes at some cases, specially the complex ones, these methods do not converge because of the given initial estimate or even the given search interval, or because it does not have a maximum or minimum in the function that is being optimised at a certain range of independent variables values. It is commonly used numerical methods to optimise because most of the problems do not have an analytical solution, like partial differential equations of 3 independent variables and some other non-linear equations that a linearization does not satisfy the specific case because the approximation would not give a true value [1]. So the computational intelligence on some cases is a good tool to be used to solve complex problems and to facilitate its solution.
The computational intelligence is evolving over the years, and it is functionally worth to deal with it on complex tasks that human being could not do by their own hands because of the hard work and the resolution time. With the developing of the CI and the search engineering, many discovered solutions are beyond the human engineer imagination [2]. CI is used to do a lot of tasks, but in some cases it is not preferred because of the difficulty of its architecture, but with the pass of the years it is changing. One of its uses is a linear search algorithm that seeks a collection and a target item and finds whether the target is in the collection, the run time is linear and the target is found by an organized order of searching through the items of the collection, stopping when it finds the target [3]. A several number of CI algorithms have been developed and published during the last years but as they were not unified, complicated the excellent use of this computational science [4]. With the CI, human being tasks (complex or even simple tasks) had been solved by a machine with the implementation of a computing algorithm on the machine`s software, so, the CI theories show interests in knowing how the problems (specified by human being) can be represented and solved by a machine [5].
On many years, chemical and physical processes were optimised based on objective functions, which were linked to the financial business. And instead of finding the operational conditions of a chemical plant's equipment based on its best performance (for example, the maximum conversion of a chemical reactor or the complete separation of a mixture on a column distillation), plants were constructed with clearance.
A degree of freedom (DOF) is the main analysis that must be done before solving any equation, as it is already known, an equation can only be solved if the DOF is equal to zero, which is the number of equations subtracted by the number of independent variables of each equation. The main idea for the algorithm presented in this paper is to close the degree of freedom of the user equation(s) by specifying values for its independent variables at order, through closed loops, and the objective of this paper is to show a computational method that find the optimum or desired value for chosen independents variables in equations, as users will, that flees the divergence problem and lead to the optimum stage of chemical and physical processes.

Methodology
Suppose it is required to find the amount of N optimum independent variables values that leads to the maximum, minimum or even a certain specified target value of a function (must be defined by the user) on a specified interval of the independent function's variables. It's only needed a computational algorithm that does the following: I) Specify values to store functions (its value is updated according the hike of the sweep) that will be compared into those ones found by III or IV, on posterior items V, VI and VII. A minimum store function value must have an initial estimated value of a high positive number, because thus the interval of possible values will be large and no problem will occur at storing the first minimum value.
On about storing a maximum store function value it is needed a high negative number as initial estimated value. The target store function value is determined by the user. it will have stored the independent variables values that lead to the specified target function's value with the given tolerance limits, and it is common on a function of more than one variable to have several points that gives the desired target function value, so, it must store all these values in a vector.
About the tolerance limits, it can be changed with the will of the user.
On some cases it is optionally to the user to put a condition statement in any of other loops (not necessary in the last loop), but remembering that it is not occasionally done in optimisation, because the need of sweep all the function's domain. User may choose which conditions statements will be used (V, VI and VII).

Algorithm's schema
Since ''Vi'' is any independent variable, a step scheme algorithm of the method for a function of N independent variables should be: Step 1: Function target value = input value; Step 2: Maximum store function = -10 32 ; Step 3: Minimum store function = 10 32 ; Step 4: Loop 1: Vary V1 with a given step to a given maximum range Step 5: Loop 2: Vary V2 with a given step to a given maximum range … And so on till loop N Step 6: Loop N: Vary VN with a given step to a given maximum range When the algorithm's run finishes, all the function(s) maximum, minimum and even a target value are stored with its respective independent variables. Remember that solutions found on step 8 must converge, so then computer will not enter on an infinite loop. Because of that, it can be optionally put another condition statement to warn if the problem is not converging or the function(s) value diverge, or even to ignore that and keep running.

Chemical reactor optimisation
This method is very useful in day-to-day on processes that can be described by algebraic equations. One application for example, is to find the optimum operational conditions in a chemical reactor by solving the process model equations for independent variables and creating an objective function, like the conversion of a specific reactant or even the exit's composition of a desired product and so on.
The table below shows the meaning of each variable used on this application: Then it was specified fixed parameters of the process model equations:   The refrigerant fluid used was the DOWTHERM-Q and your residence time is: As shown in Table 1, it was adopted a value of 40 . to the molecular weight of the equations it needs the value of the reactant "A" residence time inside the reactor, so it was written in the last loop of the code its formula: Note that the value of changes with the change of the feed volumetric flow of reactant A, so its value is updated at each iteration. Also in the last "loop" of the algorithm's code it was solved the balance equations using Runge-Kutta's method for ordinary differential equations (ODE), declared conditions statements to store the optimum values over the store functions and created the objective function of interest (The composition of product B). As the example was performed by MATLAB®, the command to do the loop, the conditional statements and to solve the system of ODES were "for" and "if" respectively, according to its programming language.
The simulation (Solving the balance equations) was done in the last "for" and it was done by setting initial conditions, based on feed properties: Table 3. Initial conditions for the simulation (Same values of Table 2).

T ( it is being varied)
As follows the Domain's Sweep algorithm and with the results in hands, the objective function The results of the simulation of the process model are shown. First it is shown an analysis of sensibility of the composition of product "B" with a fixed optimum value of 366.6 K for the feed temperature: Figure 1. Analysis of sensitivity: versus to show the consistence of the results.
As the found optimum values that give the maximum value for the composition of B were a feed temperature of 366.6 K and a feed volumetric flow of reactant A of 100 m 3 , then, if it is plotted a graph of XB versus Fe, the maximum value must be at the point (100, 0.1924) and as it can be seen in Figure   1, the composition of B has a maximum value at the found optimum operational conditions ( = 366.6 and = 100). But it is not enough at all, on a chemical process just to do the optimisation, so it is needed a proof that the process is real and stable, so since the simulation was done when it was also doing the optimisation, it is also plotted below the dynamic plot of the process variables of the system. Figure 2 and 3 show that the temperature and the concentration of the reactants and products remains with real values in the whole simulation and get a constant and real value as they reach the steady-state, proofing, that the system is real, stable and reachable.  Also, a 3D-plot and a contour graph were done to enhance the reader's understanding, as follow in Figure 4 and 5:

Conclusions
Of easy understanding and application, it is a method to find the optimum value as the user choices, remembering that according to the user's code, it can find the maximum, minimum or a determined function value and the accuracy of the found value compared to the real value is linked to the step's size criteria on about varying the independent variables of the function(s). Smaller the step size, higher the accuracy of the optimum value and higher the machine processing time. In respect of time, the Domain's Sweep algorithm's delay time to finish is proportional to step's size criteria, specified sweep's range and the number of functions independent variables.

Conflicts of Interest:
The author declares no conflict of interest.