Introduction

Fresh water is one of the most essential and vital necessities of human and other living creatures. However, less than one percent of available water is fresh, while 97% is in the oceans and 2% is in ice form (Clayton 2011). Models can act as a considerable amount of illustration for simplifying the complicated hydrogeological occurrences in water resources assessment strategy (Ehteshami et al. 1991; Salami Shahid and Ehteshami 2015, 2016; Ebrahimi et al. 2015; Ehteshami and Biglarijoo 2014). A possible solution to the shortage of fresh water is desalination of seawater or brackish water which is freely available nearby coastal lands (Zirakrad et al. 2013). Desalination processes produce a stream of freshwater, and a separate, saltier stream of water that requires disposal (Carter 2015; Crittenden et al. 2005; Zirakrad et al. 2013). Greenlee et al. (2009) studied system performance variation and impacts of using brackish or sea water for desalination by RO systems.

There are several different methods for desalination such as thermal and membrane methods. Thermal methods separate water by evaporation and condensation whereas membrane processes use semi-permeable membranes for the separation (Venkatesan 2014). Application of reverse osmosis membranes is the most viable method for desalination today. Furthermore, using RO membrane for wastewater treatment is swiftly expanding (Garud et al. 2011). Low cost, energy efficiency and versatility of the process, in comparison with other technologies are some of its advantages (Abraham 2005; Nakayama and Sano 2013; Stover 2013). RO systems also provide an adequate capability of strong separation (Pangarkar et al. 2011). Its concept is known and studied from 1748 by many scientists, however, as a feasible separation process, it is a relatively young technology (Williams 2003). In addition to desalination of sea and brackish water, RO systems also remove dissolved solids, organic, pyrogens, submicron colloidal matter, color, nitrate and bacteria from water/wastewater (Garud et al. 2011). System structure details of RO are briefly explained by many researchers such as (Crittenden et al. 2005; Hiroki 2010; Williams 2003). The RO systems efficiency, described as E in Eq. 1, depends on three main types of factors such as: design details of the plant and operation conditions, quantity and quality characteristics of influent So and outflow Se, and type of the membranes used in the RO system (Crittenden et al. 2005; Hiroki 2010; Williams 2003).

$$E(\% ) = 1 - \frac{{S_{e} }}{{S_{0} }}$$
(1)

This study focuses on the performance of eight different types of SWRO membranes with one pass and one stage in each pass. As it is shown in Fig. 1, no feed/back pressure is applied added before and after SWRO element.

Fig. 1
figure 1

Design of one stage one pass desalination system used in the study

Reverse Osmosis System Analysis (ROSA) software was used to produce data required for the study. ROSA software has been developed by Dow Chemical Company (ROSA 2010). Many researchers have used the software for modeling or comparing their models predictions with ROSA’s simulation results (Afrasiabi et al. 2009; Chen and Li 2005; Gedam et al. 2012). A correlation of 85% was obtained, comparing the developed model and ROSA software results (Jafar and Zilouchian 2002). Jiang et al. (2014) used several mathematical methods to find the relations between temperature and feed pressure and performance of a SWRO plant. They focused on and paid special attention to details of working parameters and differential changes in operational variables. Patroklou (2013) tried to model the effect of pH, temperature and pressure on boron concentrations at the end of RO processes, using RE4040-SR membrane, through a mathematical relation based on a solution of a diffusion model. Arulchinnappan, presented a multivariate fuzzy regression model to simulate RO process conditions (Arulchinnappan and Rajendran 2011). Artificial neural network (ANN) presented by (Libotean et al. 2009; Abbasi Maedeh et al. 2013) used numerous daily performance data as inputs to simulate permeate flux and salt passage. A two-dimensional (2-d) mathematical model (computational fluid dynamics and biofilm models) was used by Radu et al. (2010) to describe the negative effects of biofilm growth on the performance of a spiral-wound reverse osmosis which indicates the importance of RO system performance monitoring.

Almost all researchers in this field have faced the performance analyses such as the study done by Harrak et al. (2013). They suggested removing chlorination and sodium bisulfite addition steps from the pretreatment to reach an acceptable performance. Kumar and Saravanan (2011) and Gedam et al. (2012) compared the recovery rate, TDS reduction, energy consumption and investment cost of a ROSA type membrane, with a KOCH type membrane for treatment of effluent from knitted fabric dyeing and showed that the KOCH membranes work better. Stover, (2013) tried to show how better performances are accessible in a closed circuit or semi-batch RO techniques. Al-Mutaz (2003) and Abraham (2005) showed that coupled systems consist of RO and multi-stage flash (MSF) have the best wastewater desalination performance.

The main goal of this study is to represent mathematical equations and also artificial neural network (ANN) models for estimating effluent total suspended solids (TDS), fresh flow concentration, (Se), of a treated saline water with influent concentration of (S0), temperature (T), recovery percentage (Re) and influent flow (q). The developed models and equations are calibrated for 8 different types of sea water RO membranes (SWRO). Both methods of modeling (ANN and mathematical equation) have accurate and reliable results, while each method has its advantage that can be very useful for the application of SWRO systems.

Strategy and procedure

RO desalination procedure, SWRO membranes

Table 1 shows eight types of SWRO membranes that are used in this study and also the boundary conditions for each RO element. Maximum recovery percentage (Re) is limited to 15% and temperature is up to 46 °C for each element.

Table 1 SWRO membranes used and their limitations

Other researchers have tried to model the RO performance systems, like Altaee (2012) who presented a mathematical model for two types of SW30HRLE-440i and SW30HR-380 in TDS ranges of 32,000, 35,000, 38,000, and 43,000 mgL−1.

Efficiency (E) is the best parameter to indicate the system performance. The main goal of present study is to find a simple mathematical model/equation and ANN models for predicting Se by knowledge of S0, T, Re, and q. The highlight of this study is to present an equation and/or model(s) for 8 types of SWRO membranes, while the most of preceding research works include only one or two RO membrane types. The main parameters that affect the efficiency of RO systems are the properties of influent water, including: T, q, TDS and operational conditions such as the pressure, which has a major impact on RO performance (Gedam et al. 2012; Harrak et al. 2013).

Figure 2 shows pH has a negligible effect on Se. The results of pH analysis are not in agreement with the study done by (Gedam et al. 2012). They have concluded pH has a large impact on Se, ignoring the fact that the other parameters (such as T or S0) need to be fixed during the pH analysis. As Fig. 2 shows when the other parameters are kept at a constant level, the impact of changing pH on Se is practically negligible. The pH performances of the other 6 membranes are exactly similar to Fig. 2. The main effective parameters that can change the efficiency (E) are: T, q, Re and the type of membrane used. Table 2 shows the variation of the parameters in this study.

Fig. 2
figure 2

Se variations caused by changes in pH. a Membrane type is SW30-2540, T = 20 °C, q = 1.3 gpm, Re = 15%, S0 = 32,000. b Membrane type is SW30hrle-1725, T = 25 °C, q = 120 gpm, Re = 10%, S0 = 32,000

Table 2 The range and amount of changes and parameter limits

Data preparations

For each membrane type the first step is to adjust the feed water data, extracted from water library of ROSA under the name of “california.wat”, which is shown in Table 3. Water temperature is 17 °C and SDI (silt density index), assumed to be under 5 (SDI <5) and (except for pH) the units of all parameters in Table 3 are in mgL−1.

Table 3 Default sea water properties (mg/l) that are used in this study

After processing feed water data in ROSA software, the other input parameters are: feed water flow (q), set at (approximately) half of maximum possible value of q (see Table 1) and Re as 15%. Then recovery percentage (Re) are changed by 1% at each time step from 1 to 15% (Fig. 3 zone A) for covering all possible ranges of q-Re combinations, or “q” and “Re” variations, and individually (Fig. 3 zone B), which should not reach more values than the ones shown in Table 1 such as qe denoted as Eq. 2.

$$permeat.flow = effeluent.flow = q_{e} = \text{Re} \times q$$
(2)

It is noticeable that the different shapes which are seen in zone(s) B of Fig. 3 are caused by different or irregular/random q-Re values assigned for each membrane. For covering the range of temperature, parameters reset on the default mode and only T can change in each time step from 5 to 46 °C (Fig. 3 zone C).Then the properties will return to default mode again. The variation of TDS is form 10,000 to 45,000 (mgL−1). The concentrations of Na and Cl somehow are adjusted by relation between Na/Cl (in Table 3), so that the values are constant. To satisfy more practical conditions, temperature will change with TDS, while it can be calculated by Eq. 3. (Figure 3 zone D)

$$T = \left\{ \begin{array}{l} 15 \, ^\circ {\rm C} \leftarrow TDS = 10000 + 3k \times 1000 \hfill \\ 20 \, ^\circ {\rm C} \leftarrow TDS = 10000 + (3k + 1) \times 1000 \hfill \\ 25 \, ^\circ {\rm C} \leftarrow TDS = 10000 + (3k + 2) \times 1000 \hfill \\ \end{array} \right.$$
(3)

k is a natural number from 0 to 11. In each “step” input data such as S0, q, Re, T and Se are recorded in an EXCEL file. Figures 3, 4 show all the output data for 8 types of membranes. Table 4 shows the range of variation of the parameters that have been used for modeling and testing procedures.

Fig. 3
figure 3

The values of Se in different conditions for 4 SWRO membranes (2540, hrle4040, 4040, 3031 models)

Fig. 4
figure 4

The values of Se in different conditions for 4 SWRO membranes (hr380, hrle4040, hrle40i, hrle1725 models)

Table 4 The variation of parameters in each zone of Fig. 5

Figures 3, 4 show all membranes have the same parametric variation or behavior corresponding to the variation of input parameters. Therefore, to show the relation between Se and other parameters we will focus on one of the membranes. And after developing the simulation equations, we can proceed with the calibration of other membranes.

Mathematical modeling

In this study, the least squares method is used to solve the over constrained linear system to obtain the coefficients of the fitting polynomial (Venkatesan 2014). This method is based on linear algebra. Let y be the nth degree polynomial of x:

$$y_{i} = f(x_{i} ,n) = \sum\limits_{j = 0}^{n} {a_{j} \cdot x_{i}^{n} }$$
(4)

where a j (s) is coefficient of polynomial, Eq. 4 can be also expressed in form of a matrix:

$$\overbrace {{\left[ {\begin{array}{*{20}c} {a_{0} } & {a_{1} } & \cdots & {a_{n} } \\ \end{array} } \right].}}^{{A_{n + 1} }}\overbrace {{\left[ {\begin{array}{*{20}c} {x_{1}^{0} = 1} & 1 & \cdots & 1 \\ {x_{1}^{1} } & {x_{2}^{2} } & \cdots & {x_{i}^{2} } \\ \vdots & \vdots & \cdots & \vdots \\ {x_{1}^{n} } & {x_{2}^{n} } & \cdots & {x_{i}^{n} } \\ \end{array} } \right]}}^{{X_{n + 1,i} }} = \overbrace {{\left[ {\begin{array}{*{20}c} {y_{1} } & {y_{2} } & \cdots & {y_{i} } \\ \end{array} } \right]}}^{{Y_{i} }}$$
(5)

or

$$A_{n + 1} .X_{n + 1,i} = Y_{i} \;\;or\;A.X = Y$$
(6)

For every matrix X ∊ R n×m, a unique matrix X + ∊ R m×n, which is called generalized (right) inverse exists satisfying (Karampetakis 1997):

$$X.X^{ + } = I_{n}$$
(7)

I n : Identity matrix of size n. By multiplyingX + on (right hand of) both sides of Eq. 7 we have:

$$A.X.X^{ + } = A.I = A = Y.X^{ + }$$
(8)

And by this method ‘A’ which is a polynomial coefficients matrix, can be calculated. The analyses of the present study are performed using MATLAB software. The derived equation can be in the form of Eq. 4:

$$S_{e} = k.\frac{{S_{0} .\alpha }}{{(q.\text{Re} )^{\theta } }}$$
(9)

where k is a constant that depends on the type of the membrane; α, an “n” degree polynomial of T (Eq. 5); and θ, parameter that let us to calibrate the effect of (q.Re) for each membrane.

$$\alpha (T) = a_{0} + a_{1} .T + a_{2} T^{2} + \cdots + a_{n - 1} .T^{n - 1} + a_{n} .T$$
(10)

To evaluate k and θ for each membrane Eq. 6 is used, just when the temperature is equal to 17 °C (A, B zones in Fig. 3). In other words, we assume that α (17) = 1. In order to optimize the value ofθ, it can change from 0.50 to 2.00 by 0.01 steps to find out for what value of θ i (s), k i (s) has the relative minimum average absolute difference (RMAAD) with average k i (Eq. 1114).

$$k_{i} = \frac{{(q.\text{Re} )^{{\theta_{i} }} }}{{S_{0} }}$$
(11)
$$\theta_{i} = 0.50 + i \times 0.01$$
(12)
$$average.k_{i} = \overline{{k_{i} }} = \frac{{\sum_{j = 1}^{t} {k_{i,n} } }}{t}$$
(13)
$$RMADD_{i} = \frac{{\sum_{j = 1}^{t} {\left| {\overline{{k_{i} }} - k_{i,n} } \right|} }}{{t.\overline{{k_{i} }} }}$$
(14)

where i: A natural number between 1 and 150; t: Number of existed steps in A and B zones in Figs. 3, 4; and k i,n : k i for step number “n”, n varies between 1 and t. The best fit achieved and values of proper “i” and k for each membrane are shown in Table 4. Recognizing k and θ for each membrane and using data in zones C and D, the polynomial which best fits the T and α(T) is derived as Eq. 15, by MATLAB software. According to the calculations α will be in the form of Eq. 16:

$$\alpha (T) = \frac{{S_{e,T} .(q.\text{Re} )^{\theta } }}{{k.S_{0} }}$$
(15)

Se, T is the Se in temperature of T (°C); zones C and D of Figs. 3, 4.

$$\alpha = a_{0} + a_{1} .T + a_{2} .T^{2}$$
(16)

Values of a0, a1 and a2 for each membrane are shown in Table 5. The Se for each membrane is calculated by Eq. 16. Verification of Eq. 17 is shown in Table 8.

$$S_{e} = \frac{{k.S_{0} }}{{(q.\text{Re} )^{0.5 + i \times 0.01} }}.(a_{0} + a_{1} .T + a_{2} .T^{2} ).$$
(17)
Table 5 Values of k, i, a0, a1, a2 for each membrane

Neural network modeling

Artificial neural network (ANN) modeling is relatively a new method that is based on human’s brain function of learning algorithms (Yi-Ming et al. 2004). Its priority is flexibility and capability of learning complex nonlinear/linear relations. MLF (multilayer feed-forward) networks trained with back-propagation algorithm are the most popular types of networks (Kabsch-korbutowicz and Kutylowska 2008; Salgado-Reyna et al. 2013; Svozil et al. 1997). We used MLF networks to make ANN models. The details of ANN structures and algorithms are briefly discussed by Ehteshami et al. (2016), Abraham (2005), Menhaj (2008), Salgado-Reyna et al. (2013). Basic architecture consists of three types of neuron layers such as input, hidden, and output layers. Figure 5 shows a two layer network. The signals flow from input to output units through feed-forward ANN networks, strictly in a form of feed-forward direction (Abraham 2005; Yang et al. 2009). The hidden layers consist of different number of neurons. In Fig. 5 parameters such as “a” is the output of neuron and “p” is the input. Parameters “w” and “p” are weight and bias, respectively, and all parameters denoted as matrices, and can be expressed as:

$$a = f(net) = f(n) = f(w^{T} .p + b) = f\left( {\sum\limits_{i = 1}^{R} {w_{R}^{T} .p_{R} + b} } \right)$$
(18)
$$p = \left[ {p_{1} ,p_{2} , \ldots ,p_{R} } \right],w = \left[ {w_{1} ,w_{2} , \ldots ,w_{R} } \right]$$
(19)

Figure 6 shows the most common “f” function. It transfers output of each layer to a simpler/more useful expression for calibrating the wi and bi (s) in next layer/step.

Fig. 5
figure 5

A two layer feed-forward network

Fig. 6
figure 6

Transfer functions

In order to train the function correctly, we must continue and repeat the process of calibrating and optimizing wi, bi(s). The optimum of wi, bi(s) will result in minimizing the mean square of error (MSE) value. This process will continue until we reach the required precision. In the following procedure, weights and biases will change every time that the process is repeated. The calibration process for wi, bi(s) is as (Alnaizy et al. 2013; Menhaj 2008; Salgado-Reyna et al. 2013):

$$\mathop w\nolimits_{i,j}^{(l + 1)} = \mathop w\nolimits_{i,j}^{(l)} - \alpha \frac{\partial e(w,b)}{{\partial \mathop w\nolimits_{i,j}^{(l)} }}$$
(20)
$$\mathop b\nolimits_{i,j}^{(l + 1)} = \mathop b\nolimits_{i,j}^{(l)} - \alpha \frac{\partial e(w,b)}{{\partial \mathop b\nolimits_{i,j}^{(l)} }}$$
(21)
$$\frac{\partial e(w,b)}{{\partial \mathop w\nolimits_{i,j}^{(l)} }} = \left[ {\frac{1}{m}\sum\limits_{i = 1}^{m} {\frac{\partial }{{\partial \mathop w\nolimits_{i.j}^{(l)} }}} e(w,b;\mathop x\nolimits^{(i)} ,\mathop y\nolimits^{(i)} )} \right] + \alpha \mathop w\nolimits_{i,j}^{(l)}$$
(22)
$$\frac{\partial e(w,b)}{{\partial \mathop b\nolimits_{i,j}^{(l)} }} = \left[ {\frac{1}{m}\sum\limits_{i = 1}^{m} {\frac{\partial }{{\partial \mathop b\nolimits_{i.j}^{(l)} }}} e(w,b;\mathop x\nolimits^{(i)} ,\mathop y\nolimits^{(i)} )} \right] + \alpha \mathop b\nolimits_{i,j}^{(l)}$$
(23)

where α is the learning rate. Figure 5 shows that outputs of previous layers will be the inputs of the neurons in the next layer and the result(s) of the output layer will be compared to the target values. In this study mean square of error (MSE) is the criterion for comparing the outputs.

$$mse = \frac{1}{m}\sum\limits_{i = 1}^{m} {\mathop e\nolimits^{2} } = \frac{1}{m}\sum\limits_{i = 1} {(t - a_{i} )^{2} }$$
(24)

where ti is target (real) value data and ai is the network output.

Two feed-forward with back propagation learning rule (Eqs. 2023) are used to develop the models in MATLAB environment. Design parameters of the networks have been represented in Tables 6, 7.

Table 6 Training parameters
Table 7 Details of layers and neurons for each membrane

Data and models

Input data are parameters such as T, Re, q and target(output) data will be Se/S0. Table 7 shows the model properties for each membrane. To obtain a better precision, values shown in Figs. 3, 4 were multiplied by 10, with simple interpolation of existing data (Figs. 3, 4). Table 7 shows number of hidden layers and number of neurons in each layer.

Results and discussion

Table 8 shows the precision of equation (Eq. 17) for each membrane. Both (NN models) and Eq. 17 are verified by the initial input data (Fig. 3). The resulted or simulated \(\overline{{S_{e} }}\), are compared to Se values of (Figs. 3, 4). For a better understanding of both MAE and R, values are shown in Table 8.

$$MAE = \frac{{\sum_{i = 1}^{t} {\left| {S_{e} - \overline{{S_{e} }} } \right|} }}{t}$$
(25)
$$R = 100 \times \frac{{\sum_{i = 1}^{t} {\left[ {1 - \frac{{\left| {S_{e} - \overline{{S_{e} }} } \right|}}{{S_{e} }}} \right]} }}{t}$$
(26)
$$Error = \left(1 - \frac{{{\text{Model result}}\;}}{{{\text{Real}}\;{\text{data}}}}\right) \times 100$$
(27)

where t is the number of existing data for each membrane (Figs. 3, 4) and \(\overline{{S_{e} }}\) is the simulated Se with models and/or Eq. 17. The error values as calculated by Eq. 27 are shown in Fig. 6.

Table 8 Comparing models and Eq. 17 results to (existed) real data (Figs. 3, 4)

Table 8 shows that both models and Eq. 17 are reliably accurate and the ANN models even have a slightly higher precision comparing to Eq. 17. Figures 7, 8 illustrate the model verification results based on the simulated data. The dashed lines show mathematical models errors and simple lines show ANN models errors.

Fig. 7
figure 7

The errors of mathematical equations and models procedure for selected 4 SWRO membranes, (2540, hrle4040, 4040, 3031 models)

Fig. 8
figure 8

The errors of mathematical equations and models procedure for selected another 4 SWRO membranes (hr380, hrle4040i, hrle400i, hrle1725 models)

Conclusions

In this study an effective mathematical equation was developed as a simple expression, such as Eq. 17. Presented formula can be used/calibrated for other types of membranes. Both Eq. 17 and models are reliable to predict RO system performance, and design parameters such as S0, T, Re and p. Furthermore, it can be used to optimize the process of desalination systems. The effects of pressure and/or the other design and operating parameter(s) of membranes structure can be added by other researchers to the Eq. 17 and models. Therefore, the main highlight of this study was to develop a model to simulate 8 types of RO membranes that are able to cover a wide range of feed water and operational conditions. Main advantages of the mathematical modeling are: (1) simplicity of expression/proving and using them and (2) the form of solutions and its sensitivity toward two/multi parameter that can be observed and analyzed. The advantages of ANN modeling are: (1) ability of modeling of complex relationships which is not possible for model with ordinary mathematical methods; (2) in most cases ANN models have higher precision compared with mathematical methods; (3) ANN models can be adapted with new data and upgraded with them; (4) best combination of design parameters in ANN models can be achieved by try and error method. This process also revealed that the number of (hidden layers) and their neurons should be chosen wisely, both lack and excess of it, may decrease the model precision. One of the most important finding in this study is when the number of data is sufficient for modeling the precision of model is directly depended on (and limited by) data that are being used. In other word the most important uncertainty would be caused by uncertainty of input data. This means that even if we use the other methods of modeling (such as genetic algorithm, dynamic NN, etc.), better result will not be achieved because, errors depend on error of data that are used for making the models.