Diffusion analysis with high and low concentration regions by the finite difference method, the adaptive network-based fuzzy inference system, and the bilayered neural network method

The diffusion of molecules in aqueous solutions in the domain of membrane technology is critical in the efficiency of chemical engineering and purification processes. In this study, the diffusion in high and low concentration regions is simulated with finite difference method (FDM), and then the results of numerical computations are coupled with adaptive network-based fuzzy inference system (ANFIS) and bilayered neural network method (BNNM). Machine learning (ML) approach can individually predict diffusion phenomena across the domain based on understanding of the machine instead of the discretization of an ordinary differential equation (ODE). The findings of the ML model confirm the FDM's simulation results. In addition to numerical computation, the error of the system is computed for different iterations. The results show that by increasing the number of iterations and training datasets, all errors reduce significantly for both training and testing. BNN method is also used to train the prediction process of diffusion for a more accurate comparison. This technique is similar to ANFIS method in terms of prediction capability. According to the findings, ANFIS approach predicts diffusion slightly better than BNN method. In this regard, ANFIS technique produces R > 0.99 while BNN method produces R around 0.98. Both ML methods are accurate enough to predict diffusion throughout the domain for different time steps. The computational time for both algorithms is less than that of FDM method to predict low and high concentrations in the domain.


Introduction
Microorganisms, plants, as well as animals are some examples that the role of diffusion of large and small molecules in aqueous solutions is inevitable. Aside from these, the process of diffusion has its own role in food processing as well as the drying of liquid mixtures and solutions. Examples include aroma as well as flavor components in tea and coffee during the process of evaporation. Moreover, diffusion occurs in the process of fermentation. In this process, sugar, oxygen as well as nutrients diffuse to products, microorganisms, and waste. In this regard, kidneys are responsible for taking away different products, including creatinine, urea, and other excess fluid from the blood. Additionally, kidney dialysis helps patients whose kidneys work improperly by removing waste products from their blood. During the process CONTACT Qian Zhang (20200420@wzu.edu.cn); Shahab S. Band (shamshirbands@yuntech.edu.tw) of hemodialysis, a dialyzer is applied, and in this process, blood is pumped; consequently, waste that exists in blood diffuses by a sort of membrane action so that only particular molecules can pass to the aqueous solution cleaning fluid. Membrane technology is also seen in the process of hemodialysis. Generally, in order to enter or leave a cell, dissolved or gaseous substances have to pass through the cell membrane. When particles start spreading, diffusion happens. Particles actually move from a region in which the concentration is high to a low concentration region. In the same vein, membrane technologies are applied for separating chemical constituents. Hence separation processes are designed according to membrane technology. This technology leads to a novel method not similar to the separation methods that have conventionally been used in different industries, for instance the purification industry. The purification method is used to separate various elements, and is applied in small-scale technologies rather than large-scale ones where conventional methods are more commonly applied. Comparing conventional purification methods for the separation process using membrane technology, the latter has some benefits. To name some, they include low cost separation as well as modular design. Also, high energy demand is not needed. This technology is frequently studied in different investigations to highlight the importance of purification and separation processes (Asadollahzadeh et al., 2018;Dai et al., 2016;Marjani et al., 2020;Padaki et al., 2015;Purkait & Singh, 2018;Razavi et al., 2016;Rezakazemi et al., 2012Rezakazemi et al., , 2017. In general, understanding the behavior of fluids in membrane technologies, particularly in membrane modules, is not easy, but by applying numerical methods it is possible to gain understanding by taking advantage of computational fluid dynamics (CFD). Nevertheless, the problem with the process of optimizing membrane technology using CFD is that it takes much time, and the costs regarding the computational procedure are high; therefore, researchers can take advantage of artificial intelligence (AI) together with CFD for the purpose of modeling the chemical processes. Membrane technology and phase separation are not exceptions to this Rezakazemi et al., 2017Rezakazemi et al., , 2019.
Nevertheless, regarding optimizing membrane technology via CFD, it is worth mentioning that the process is time-consuming, and the computational costs are not low. The chemical processes can be modeled using AI as well as CFD. Examples of such processes are phase separation and membrane technology. Using AI in addition to CFD makes learning possible by taking advantage of neural networks and point-by-point learning of CFD mesh elements, and the prediction process is possible through the fuzzy logic system Rezakazemi et al., 2017Rezakazemi et al., , 2019.
The current research study applies an adaptive neurofuzzy inference system (ANFIS) with various ANFIS parameters to learn the diffusion process. ANFIS can be considered a type of artificial neural network and, in this method, the principles of fuzzy logic and neural networks are applied. It has been used as an efficient and optimal method. Because of the capacity of fuzzy logic to decide output parameters and identify connections between input and output parameters, this technique is popular in AI numerical prediction methods. Furthermore, ANFIS architecture is often utilized in a wider variety of physical and real-world applications Rezakazemi et al., 2017Rezakazemi et al., , 2019.
In addition to the ANFIS method, the bilayered neural network (BNN) method is also used to predict the diffusion process across the domain for different time steps. The BNN method includes binary weights as well as activations and, by taking advantage of this method, the computational time can be reduced.
It is also worth mentioning that AI methods can be beneficial in order to enhance CFD modeling uses. This study indicates that the ANFIS and BNN models can be applied with CFD for the purpose of predicting fluid flow characteristics in different conditions and circumstances. Moreover, in this study, high as well as low concentration regions are simulated by using the FDM method. Afterwards, by taking advantage of machine learning methods, the distribution is stored in the domain. The computed concentration at FDM components is present in the ANFIS and BNN methods in two stages, including the testing as well as the training stages. Afterwards, for a better understanding of the process, the machine learning method using the FDM dataset is applied. Moreover, function analysis is used for determining the relationship regarding each of the input parameters on the concentration pattern of the study.
Different numbers of membership functions (MFs) for each input are also applied to test the prediction ability of the model. The focus of the study is considered novel owing to its emphasis on the influence of inputs on the output within the framework of the ANFIS method. This study examines the most significant influence that the inputs have on the output; therefore, the effective parameter is the focus of the study, and it can be found according to the influence of MFs on the output. Thus, the degree of MFs is studied as a function of each input parameter. Consequently, a simulation methodology that can be considered as having high-performance is provided in this study that was not present in other traditional models regarding chemical engineering. In addition, ANFIS is examined and compared with the BNN method to assess the level of prediction capability for different time steps and computation nodes.
Owing to the nature of numerical methods, computations using these methods are time-consuming; AI is applied and used in addition to numerical methods for predicting the process. Additionally, this study also uses ANFIS and BNN algorithms to predict the process by using AI. It is also worth mentioning that supervised machine learning methods are data driven. Therefore, the methods are trained based on the inputs and AI can predict other inputs that are in that particular range.

Methodology
In the present study, ANFIS is used to predict the diffusion process, and then different ANFIS parameters are used to train the process. The BNN technique, in addition to the ANFIS method, is used to forecast the diffusion process throughout the domain for various time steps.
ANFIS has the ability to predict accurately the performance of particular systems that have complex as well as nonlinear characteristics Najafi et al., 2018;Pishnamazi et al., 2020;Razavi et al., 2019;Rezakazemi et al., 2017;Sefeedpari et al., 2015;Yan et al., 2020). ANFIS can be considered a sort of artificial neural network, and its origin is from Takagi et al. (1985). Based on the mentioned works, there are three kinds of fuzzy reasoning and if-then rules that are run in the ANFIS structure. The following formula shows the function of the ith rule: In Equation (1), w i refers to the out-coming signal from the node of the second layer of the model. Additionally, µ Ai and µ Bi represent the incoming signals from MFs run on inputs to the node of the same layer regarding the mentioned model. In the next layer, i.e. the third, the relative value of each rule refers to the firing strength that is studied. In other words, it is equal to the weight of each layer over the whole quantity of firing strengths regarding all the rules. The node function is as shown in the following equation:  In Equation (2), p i , q i , r i and s i are the if-then rules parameters of the study. For the next machine learning method, the BNN method is used to train the structure of datasets, including computing nodes and time steps. This method is compared with the ANFIS method for the evaluation of the prediction ability of the ANFIS method. Three layers are considered in the method, and for each of them, the size of the layer is five.

Results
In the current research study, by taking advantage of the finite difference method, diffusion is studied. Furthermore, the results obtained are categorized as a function of time and the number of computing nodes. The categorized data are trained using the ANFIS and BNN algorithms, and they are predicted via the AI capability. In general, the AI framework is applied as a substitution method for the finite difference method. In the beginning, the combination of inputs and output in the method is considered. In this regard, two inputs and two MFs for each of the inputs are considered in the model. The structure has four rules, and this structure can model diffusion. In addition, 65% of the data are considered in the training phase, and then all of the datasets, including the 65% of the data used in the training phase and the remaining datasets, are used in the testing phase. Each step is evaluated separately, and after the evaluation, the model is prepared for the prediction process. Before the prediction, a sensitivity analysis for the tuning parameters of the ANFIS model is performed on a number of MFs for each of the inputs, the number of iterations for solving the equation, and the number of inputs. After optimizing all the parameters, the model is prepared for the final prediction.
As shown in Figure 1, the distribution of input number two functions is studied. As shown in the figure, the input number two functions have a suitable reaction. All functions can be studied in this model. The functions are also considered for input 1. This model is an adaptive system that learns to operate more efficiently by using connected nodes or neurons in a layered structure that resembles the human brain. Because of its capacity to learn from data, it has been shown that a neural network can be trained to recognize patterns, classify data, and predict future events (here, different concentrations as a function of time and location). The improvement of the functions is evident, and the function considered in this study is gaussmf. For the training phase of the method, 10 epochs are used, and a suitable level of training is achieved. After having studied the functions regarding the inputs, the ANFIS predicted data are studied and compared with the finite difference method results.
As shown in Figure 2, the ANIFS method has a high capability regarding the prediction and can forecast the behavior simulated by the finite difference method for the diffusion process. By considering these results, the ANFIS method can capture the diffusion behavior with two MFs, but more MFs are needed surrounding the membership functions for a better prediction. Alternatively, the surrounding boundary conditions need to be used by filtration methods so that ANFIS can predict them better. In this case, the ANFIS method can only train datasets far away from the critical boundary condition that impacts the numerical convergence and prediction capability. Figure 3 shows the surface area for diffusion. As shown in this figure, ANFIS can predict the whole diffusion domain. After the prediction by ANFIS, the R-value as well as R-square are studied.
As shown in Figure 4, R-values in testing and training are equal to 0.963,65 and 0.963,34, respectively. As shown in the figure, the testing and training data have similar overall patterns. Furthermore, ANFIS can predict both testing and training stages. Figure 5 shows a point-by-point data comparison between ANFIS and the finite difference method. As shown in the figure, ANFIS cannot capture the behavior at some points. Nevertheless, at most of the points and when a low level of the dataset is reached, ANFIS has in good prediction capability and can predict conditions similar to those predicted by the finite difference method. After having compared the data, the level of training the data is changed to investigate how the AI algorithm is capable of achieving intelligence. Figure 6 shows that, in the beginning, 1% of the data is used. As shown, the errors in both testing and training for MSE and RMSE criteria start to decrease. By increasing the iterations, specifically in testing, the criteria increase, meaning that this method cannot reach intelligence by using 1% of the data. Figure 7 indicates that the percentage of the data in training increases to 5%. As shown in both testing and training stages, the errors decrease and, after 50 iterations, the errors converge in both training and testing regarding both SME and RMSE. It is also worth mentioning that each iteration denotes a simulation, meaning that 50 iterations refer to the fact that 50 models are studied. Figure 8 shows that the percentage of data increases to 10% and, as shown, the errors decrease. Furthermore, again, in the beginning, the errors decrease in the first epoch or iteration. Furthermore, after 40-45 iterations or epochs, the final convergence is reached, and the method and prediction can be relied upon.
For a more accurate comparison, the BNN technique is also used to train the prediction of diffusion as a function of time and domain. In terms of prediction capabilities, this approach is comparable to the ANFIS method. In this instance, the ANFIS method includes four membership functions with 200 iterations, denoting the technique's best performance. This method is compared with the BNN method for the evaluation of the prediction capability. Figure 9 demonstrates that the ANFIS technique predicts diffusion slightly better than the BNN method. In this respect, the ANFIS method returns R > 0.99, while the BNN approach yields R around 0.98. For various time steps, both machine learning approaches are accurate enough to estimate diffusion throughout the domain. Figure 10 shows a comparison of the FDM, ANFIS and BNN methods. The results show   that the ANFIS method can accurately trace diffusion concentration throughout the domain. In addition, the BNN technique does not respond well to the boundary conditions, while the ANFIS method can estimate the concentration near the boundary condition properly. By increasing the number of layers in the BNN, this technique can achieve higher numerical precision.
In this research, all the ANFIS method parameters are chosen based on sensitivity analysis to determine the effect of each tuning parameter on the model's accuracy. For example, the number of iterations is determined based on MSE and RMSE computations, and the best model is picked based on a low RMSE. Furthermore, various amounts of data are chosen to test the model's  learning capacity, and it is found that, with just 10% of total datasets, this model is capable of predicting the process. A smaller number of datasets can have a detrimental effect on numerical computation convergence. The findings also indicate that this process's numerical datasets can be learned in an AI framework with a low rate of numerical instability.

Conclusions
In the current research, a combination of FDM and machine learning is used to predict the diffusion for low and high concentration flows across the domain for different time steps. This mathematical integration results in faster computation diffusion in the domain based on a machine learning algorithm. For the machine learning method, the ANFIS model is used for datasets. Three time-dependent input parameters are considered, and the final concentration is used as the output of the model. The results show that the machine learning model can present similar results to the FDM method with a lower computational time. There is good agreement between FDM and machine learning for low and high concentration domains and boundary conditions. With 5% of datasets, ANFIS can fully predict the diffusion phenomena. With 50 iterations, the ANFIS method can be fully trained to predict the diffusion for low and high concentrations. This numerical technology can be used to facilitate the diffusion of molecules in aqueous solutions in the domain of a membrane structure and to improve the efficiency of chemical engineering processes. To understand the membrane and diffusion process, more input parameters can be used for the training of machine learning methods.
For more accurate comparison, the BNN method is also utilized for training the prediction of diffusion processes. This technique is similar to the ANFIS method in terms of prediction capability. The findings show that the ANFIS approach outperforms the BNN method in predicting diffusion. In this regard, the ANFIS technique gives R > 0.99, while the BNN method yields R around 0.98. Both machine learning methods are accurate enough to predict diffusion throughout the domain for different time steps. The BNN approach does not perform well in the conditions at the boundary, while the ANFIS method accurately estimates the concentration in the conditions at the boundary.
Additionally, it is worth mentioning that AI can find the relationship between inputs and output, and determine which input has the primary influence on the output of the study to optimize the process. In future studies, AI and other methods can be used for faster predictions and optimization processes. Furthermore, the study also faces some limitations. Since supervised machine learning methods are data driven, the methods are trained based on the inputs, and AI can predict other inputs in that particular range. Thus, in the prediction phase, only conditions that are similar can be predicted; consequently, the relationship between inputs and output can be found via AI. AI can be used with other methods in different processes. This technology can be used whenever researchers face time and cost limitations. In conclusion, AI can be used as a complementary method in addition to numerical methods to make prediction faster.