Formation of Organic Fouling during Membrane Desalination: The Effect of Divalent Cations and the Use of an Online Visual Monitoring Method

Reverse osmosis (RO) is the most popular technology for brackish, seawater and wastewater desalination. An important drawback of RO is membrane fouling, which reduces filtration effectiveness and increase the cost of produced water. This study addresses two important topics of membrane fouling: (i) the impact of different divalent ions on the formation of organic fouling and (ii) online monitoring and prediction of fouling formation. In the absence of divalent ions, dissolved organic matter had little effect on fouling formation, even at 3.5 mgC/L, in the upper range of groundwater concentration. Calcium, strontium and iron enhanced (organic) fouling formation, whereas barium had negligible effect. However, while iron affected fouling throughout the entire tested range (0–0.5 mg/L), calcium and strontium enhanced organic fouling only at high concentrations: more than 140 mg/L and 10 mg/L for calcium and strontium, respectively. An online system was developed for monitoring the formation of organic fouling, consisting of (i) an ex-situ RO cell with a transparent cover, (ii) a video camera continually monitoring the surface of the membrane and (iii) an algorithm which automatically identified changes in the color of the membrane caused by fouling, using a specially designed membrane spacer with colored reference dots. Changes in the color of the membrane surface were normalized to the reference colors, to eliminate all non-fouling related interference. The system was used to record and analyze changes in membrane color during numerous filtration tests. The data was successfully correlated to changes in specific flux (and subsequently to fouling formation rate) and can be applied to monitor and predict the formation of membrane fouling during desalination.


Introduction
Reverse osmosis (RO) desalination is a leading technology for the augmentation of potable water supply [1]. An important application of RO is brackish water desalination, which has experienced an exponential growth over the last 20 years, notably in arid regions of the world [2]. Brackish water typically refers to (ground)water with total dissolved solids (TDS) in the 1000-10,000 mg/L range (https://water.usgs.gov (accessed on 2 April 2022)). In the US, for example, over 77 percent of desalination plants in 2013 were fed by brackish groundwater, mostly in dry states like Florida, Texas, California and New Mexico [3]. In Israel is currently operating several brackish water desalination plants, producing up to 87 million m 3 /year, approximately 12% of total desalinated water (Israel Water Authority).
One of the main challenges in RO desalination is membrane fouling, caused by the deposition of suspended or dissolved material on membrane surface. Fouling reduces permeate flux, increases energy demand, forces frequent membrane cleaning, reduces membrane lifetime and in general increases RO operational cost [4][5][6]. Membrane foulants in brackish groundwater mainly comprise of inorganic ions, suspended and colloidal solids and low levels of natural organic matter-NOM [7]. The relative contribution of each component may vary significantly, depending on the groundwater source and RO pretreatment. Important ions, which may form insoluble salt precipitates (scaling), include calcium (Ca 2+ ), magnesium (Mg 2+ ), barium (Ba 2+ ), strontium (Sr 2+ ), sulphate and carbonate [3]. Karime et al. [8] showed that insoluble salts such as CaSiO 3 , Fe 3 O 4 , AlPO 4 and CaSO 4 were key membrane foulant agents in a brackish water desalination plant, working since 1999 in Tunisia. On the other hand, Yang et al. [7] showed that organic substances are dominant foulants, at least in the first stage of brackish water desalination. Ruiz-García et al. [9] autopsied membrane elements of a full-scale brackish groundwater desalination plant, after 11 years of operation, and found that fouling consisted of a biofilm (mainly in the first elements of the RO system) and inorganic foulants of calcium carbonate and aluminosilicates. Reducing scaling can be done through the application of anti-scalants, which improve membrane recovery but increase treatment cost [10][11][12][13][14].
A different fouling formation mechanism which involves inorganic ions (in addition to scaling) is the synergistic effect of cations and organic matter. Interaction of NOM with (divalent) cations may result in metal-NOM complexation and/or the formation of "bridges" between carboxylic groups of organic molecules, which promotes the formation of membrane fouling [15]. Lee et al. [16] found that calcium ions significantly enhanced membrane fouling during RO treatment of alginate, a model polysaccharide in secondary wastewater effluent. The increase in fouling was attributed to the formation of calcium alginate complexation and crosslinking (bridging). Magnesium ions on the other hand had little effect on fouling formation under similar conditions. Zaho et al. [17] showed that RO membrane fouling, caused by humic acid, was largely aggravated in the presence of calcium, causing a significant flux decline. Their analysis revealed that addition of calcium increased particles size of humic acid. A similar phenomenon was demonstrated by other researchers for calcium and magnesium [18][19][20], yet no study has ever examined the impact of other relevant cations such as strontium and barium, despite their proven bridging potential and frequent presence in brackish groundwater [21]. Strontium was detected in the vast majority of US groundwater aquifers at concentrations typically below 1 mg/L, but levels higher than 4 mg/L (and even peaks of >30 mg/L) were also observed, principally in aquifers with Sr-bearing rocks [22]. Barium also naturally occurs in many groundwaters, at levels typically lower than 1 mg/L, but may reach as high as 20 mg/L in specific locations [23].
Another aspect of membrane fouling, which has attracted growing attention over the last years, is online monitoring, and the prediction of fouling formation rate [24][25][26]. Standard full-scale methods involve the indirect measurement of trans-membrane pressure or flux decline, and the setting of a threshold for membrane cleaning [4]. However, these parameters are relatively insensitive, and do not provide any future prediction. Other methods tested at small scale include the use of magnetic resonance measurements [27], electrical impedance spectroscopy [28] and ATP growth potential [29]. Recently, Cohen and his group [30] proposed a different approach, using an on-line ex situ plate-and-frame membrane cell, connected on a side stream of the RO feed and operating under similar conditions. The cover of the cell is transparent, and the exposed membrane surface is continuously monitored using a video camera and a surface image analyzer. This system was successfully applied for detecting mineral scaling formation and for the auto-initiation of a feed flow reversal system. However, since the system is based on the identification of distinctive geometrical shapes (particles), its application is limited for detecting mineral scaling. Organic or microbial fouling will mostly lead to changes in membrane color, rather than formation of particles. To widen the use of this approach, a method should be developed to identify changes in membrane color caused by (organic) fouling and correlate these to changes in hydraulic parameters such as flux and pressure.
The goals of this study were to (i) determine the effect of different divalent cations on the formation of organic fouling during brackish water desalination and (ii) develop an Membranes 2022, 12, 1177 3 of 13 online method for monitoring the formation of organic membrane fouling. This method makes use of an on-line plate-and-frame RO cell with a specially designed spacer, and an algorithm, which automatically identify changes in the color of the membrane surface caused by fouling.

Setup of the Lab-Scale RO System
Experiments were carried out using a lab-scale crossflow RO system, consisting of three membrane cell units connected in parallel (CF-16, Sterlitech). The cells are 12.7 × 10 × 8.3 cm in size, with an active membrane area of 20.6 cm 2 (each). They are fed by a high-pressure pump connected to a 50 L temperature-controlled feed container ( Figure 1). To maintain a constant feedwater flowrate, special nozzles were installed on the brine-side of the cells and feed pressure was continuously monitored using pressure gauges. Flowrate and conductivity of permeates and brines were measured and recorded four times a day. Membranes used for this study were brackish water thin film composite polyamides (SUEZ, AG, PA-TFC, Table S1 in Supplementary Materials).
on the formation of organic fouling during brackish water desalination and (ii) develo an online method for monitoring the formation of organic membrane fouling. Th method makes use of an on-line plate-and-frame RO cell with a specially designed space and an algorithm, which automatically identify changes in the color of the membrane su face caused by fouling.

Reagents and Chemicals
Suwannee River fulvic acid (SRFA) was obtained from the International Humic Su stances Society (www.ihss.gatech.edu (accessed on 23 April 2022)). NaCl, SrCl2, BrC CaCl2 and FeCl3 were obtained from Sigma-Aldrich and were at least analytical grad (>98%). All chemicals were used as received.

Setup of the Lab-Scale RO System
Experiments were carried out using a lab-scale crossflow RO system, consisting three membrane cell units connected in parallel (CF-16, Sterlitech). The cells are 12.7 × × 8.3 cm in size, with an active membrane area of 20.6 cm 2 (each). They are fed by a hig pressure pump connected to a 50 L temperature-controlled feed container ( Figure 1). T maintain a constant feedwater flowrate, special nozzles were installed on the brine-sid of the cells and feed pressure was continuously monitored using pressure gauge Flowrate and conductivity of permeates and brines were measured and recorded fo times a day. Membranes used for this study were brackish water thin film composite po yamides (SUEZ, AG, PA-TFC, Table S1 in Supplementary Materials).   For real-time monitoring of the membrane surface (feed-side), the upper part of one of the cells was replaced by a transparent acrylic block. A video camera attached to a monoscope was placed above the cell (HAYEAR Full HD 34MP Industrial Electronic Digital Video Microscope Camera) and focused on a small portion of the membrane surface. The camera was connected to a designated software (Hayer version ×64), allowing the consecutive recording of 72 h videos. Constant lightning was supplied from a ring of LED lamps connected to the camera.

Fouling Experiments
Experiments were carried out using synthetic (lab-made) brackish water, based on the analysis of feed water from Maagan Michael plant, Israel's largest brackish water desalination facility (detailed analysis in Supporting Information). In a typical experiment, the feedwater tank was first filled with tap water from the Environmental Technologies laboratory (Azrieli College Jerusalem). NaCl was then added from a stock solution to a final concentration of 3000 mg/L (conductivity of approximately 6400 µS/cm). Other constituents were then added from filtered stock solutions (fulvic acid, CaCl 2 , BaCl 2 , SrCl 2 , FeCl 3 ), depending on the experiment, and relevant quality parameters were measured: alkalinity, hardness, pH, DOC, conductivity. Membrane coupons were soaked in saline water for 12 h prior to installation. Water was circulated through the membrane cells at a constant flowrate of approximately 1 L/min (for each cell) and feed pressure of 18 bar. Sampling and image recording began after two hours of equilibration, for a total duration of 72 h.

Image Processing and Analysis
The real-time monitoring system consisted of a video camera mounted above a transparent cell, recording membrane surface and the accumulation of fouling (Figure 2 left). To differentiate between color changes of membrane due to fouling and changes resulting from lightning or other artifacts, a specially designed spacer was installed in the transparent cell, that featured dots of different colors according to a standard color chart: red, blue, green and black (Figure 2 right). An image analysis algorithm was developed to identify the colored dots automatically during filtration and normalize the membrane color to the pre-defined colors (the algorithm is further detailed in Section 3.2). Changes in the normalized color of the membrane during filtration were further correlated to changes in hydraulic parameters of the system. salination facility (detailed analysis in Supporting Information). In a typical experiment, the feedwater tank was first filled with tap water from the Environmental Technologies laboratory (Azrieli College Jerusalem). NaCl was then added from a stock solution to a final concentration of 3000 mg/L (conductivity of approximately 6400 μS/cm). Other constituents were then added from filtered stock solutions (fulvic acid, CaCl2, BaCl2, SrCl2, FeCl3), depending on the experiment, and relevant quality parameters were measured: alkalinity, hardness, pH, DOC, conductivity. Membrane coupons were soaked in saline water for 12 h prior to installation. Water was circulated through the membrane cells at a constant flowrate of approximately 1 L/min (for each cell) and feed pressure of 18 bar. Sampling and image recording began after two hours of equilibration, for a total duration of 72 h.

Image Processing and Analysis
The real-time monitoring system consisted of a video camera mounted above a transparent cell, recording membrane surface and the accumulation of fouling (Figure 2 left). To differentiate between color changes of membrane due to fouling and changes resulting from lightning or other artifacts, a specially designed spacer was installed in the transparent cell, that featured dots of different colors according to a standard color chart: red, blue, green and black (Figure 2 right). An image analysis algorithm was developed to identify the colored dots automatically during filtration and normalize the membrane color to the pre-defined colors (the algorithm is further detailed in Section 3.2). Changes in the normalized color of the membrane during filtration were further correlated to changes in hydraulic parameters of the system.

Analytical Methods
Conductivity was measured with a portable conductivity meter from Hach (HQ30D). Ions in the water were quantified by an ECO Ion Chromatograph (Metrohm, Switzerland), using EPA method 300.00. Dissolved organic matter (DOM) was measured using a TOC analyzer (Torch, TeledyneTekmar, OH, USA) after filtering the samples at 0.45 mm (APHA, method 5310B). Metals were quantified by Inductively Coupled Plasma Optical 143 Emission Spectrometry (ICP-OES, Spectro Genesis, Kleve, Germany).

Analytical Methods
Conductivity was measured with a portable conductivity meter from Hach (HQ30D). Ions in the water were quantified by an ECO Ion Chromatograph (Metrohm, Switzerland), using EPA method 300.00. Dissolved organic matter (DOM) was measured using a TOC analyzer (Torch, TeledyneTekmar, OH, USA) after filtering the samples at 0.45 mm (APHA, method 5310B). Metals were quantified by Inductively Coupled Plasma Optical 143 Emission Spectrometry (ICP-OES, Spectro Genesis, Kleve, Germany).

Results and Discussion
Results are presented in two parts. The first focuses on the impact of DOM and divalent ions on the formation rate of organic fouling; whereas the second demonstrates the online method for monitoring the formation of organic membrane fouling.

The Effect of DOM Concentration on Fouling Formation
Experiments in this section were carried out with tap water, spiked with NaCl and different concentrations of fulvic acid (0.5-3.5 mgC/L, in the upper range of groundwater) [31,32]. Background quality parameters of the water were: Alkalinity 155 ± 10 mg/L as CaCO 3 , Ca 42 ± 2, pH 8.3 and conductivity of 6210 ± 120 µS/cm. Formation rate of fouling was monitored over a period of 72 h, using specific flux as an indicator, flux divided by transmembrane pressure (Flux/TMP, LMH/bar) [33]. Increasing the concentration of organic matter had little effect on the rate of decrease of the specific flux: the slope of the exponential regression lines in Figure 3. This implies that, at the tested concentration range (≤3.5 mgC/L) and specific water chemistry, DOM makes little contribution to membrane fouling.
Literature data regarding the effect on DOM concentration on the formation of organic fouling is typically site-specific, and depends on the chemistry of the feedwater, hydraulic parameters and pretreatment. Miyoshi et al. [34], for example, did not find any correlation between TOC or DOC concentration in seawater and RO fouling formation rate (at TOC range ≤ 4 mgC/L). On the other hand, Koyuncu et al. [35] showed that reducing the concentration of DOC in surface water from 2.94 to 1.19 mg/L improved the rate of flux decrease during desalination by almost 30%. A possible explanation for these different effects could be the presence of calcium in the water. In the case of Koyuncu [35], calcium concentration was in the range of 79-106 mg/L (no calcium concentration was given by Miyoshi et al. [34]. The level of calcium in the water decreased during desalination, in parallel to the decrease in TOC. Koyuncu hence concluded that the impact of organic matter on membrane fouling at low concentration relates to its interaction with calcium. In our experiments the concentration of calcium was relatively low: 40 mg/L, which may explain the marginal effect of organic matter on fouling formation. This hypothesis is validated in the following section.  Literature data regarding the effect on DOM concentration on the formation of organic fouling is typically site-specific, and depends on the chemistry of the feedwater, hydraulic parameters and pretreatment. Miyoshi et al. [34], for example, did not find any correlation between TOC or DOC concentration in seawater and RO fouling formation rate (at TOC range ≤ 4 mgC/L). On the other hand, Koyuncu et al. [35] showed that reducing the concentration of DOC in surface water from 2.94 to 1.19 mg/L improved the rate of flux decrease during desalination by almost 30%. A possible explanation for these different effects could be the presence of calcium in the water. In the case of Koyuncu [35], calcium concentration was in the range of 79-106 mg/L (no calcium concentration was given by Miyoshi et al. [34]. The level of calcium in the water decreased during desalination, in parallel to the decrease in TOC. Koyuncu hence concluded that the impact of organic matter on membrane fouling at low concentration relates to its interaction with calcium. In our experiments the concentration of calcium was relatively low: 40 mg/L, which may explain the marginal effect of organic matter on fouling formation. This hypothesis is validated in the following section.

The Combined Effect of DOM and Calcium on Fouling Formation
In this section, DOM concentration was kept constant at 3.5 mgC/L and calcium concentration was increased up to 240 mg/L. Figure 4a illustrates the changes in specific  Figure 4b summarizes the decrease rates. Increasing calcium concentration up to 140 mg/L had little effect on the decrease rate of specific flux, hence on the formation rate of fouling. On the other hand, at higher concentration of 240 mg/L, calcium sharply increased fouling formation rate. This indicates Ca-DOM interaction as the dominant mechanism for fouling formation under these conditions. Previous work also observed a critical concentration of Ca, where DOM becomes insoluble and sharply affects membrane flux [36]. This phenomenon, typically noticed around 100 mg/L (depend on DOM concentration), was attributed to charge neutralization and subsequent precipitation of organic macromolecules [37]. Scaling of CaCO 3 is less plausible, as the water's CaCO 3 precipitation potential was calculated at −14.3 (using STASOFT 5).

The Combined Effect of DOM and Calcium on Fouling Formation
In this section, DOM concentration was kept constant at 3.5 mgC/L and calcium concentration was increased up to 240 mg/L. Figure 4a illustrates the changes in specific flux over time for the different calcium concentrations and Figure 4b summarizes the decrease rates. Increasing calcium concentration up to 140 mg/L had little effect on the decrease rate of specific flux, hence on the formation rate of fouling. On the other hand, at higher concentration of 240 mg/L, calcium sharply increased fouling formation rate. This indicates Ca-DOM interaction as the dominant mechanism for fouling formation under these conditions. Previous work also observed a critical concentration of Ca, where DOM becomes insoluble and sharply affects membrane flux [36]. This phenomenon, typically noticed around 100 mg/L (depend on DOM concentration), was attributed to charge neutralization and subsequent precipitation of organic macromolecules [37]. Scaling of CaCO3 is less plausible, as the water's CaCO3 precipitation potential was calculated at −14.3 (using STASOFT 5).  Similar results were found in previous studies [18,20,36,38], which largely validate the assumption in Section 3.1.1: the impact of organic matter at low levels on membrane fouling depends on the concentration of calcium, and possibly other divalent cations, in the water.

The Effect of Strontium, Barium and Iron on Formation of Organic Fouling
Unlike the well-documented impact of calcium, the effect of strontium and barium on organic fouling is unknown. The effect of iron was mostly documented in the context of flocculation, where it is added to increases in small organic colloids and produced removable flocs. This phenomenon, however, does not always take place in natural water, especially under conditions of dissolved organic matter and low levels of iron. Figure 5 presents the rate constants for the decrease in specific flux as function of strontium and barium concentrations, at levels up to 30 mg/L and 5 mg/L, respectively, (in the upper range of groundwater concentration) [23,39]. Interestingly, the two divalent ions exhibit different effects on fouling formation. Strontium up to 10 mg/L did not affect fouling, while at higher concentrations it promoted fouling formation. This effect is similar to the one observed for calcium (though to a smaller extent), and is likely the result of strontium-DOM interaction and the increase in the size of organic flocs. Barium, on the other hand, had marginal effect on fouling formation throughout the tested range. To verify that the negligible effect of barium was not concentration-dependent, we extended its tested range up to 30 mg/L (similar to Sr 2+ ). Even at this high range, barium did not promote fouling formation (results not shown), which suggest that its tendency to interact with DOM is lower than that of strontium (and calcium). It should be emphasized that sulphate was not detected in the water at any point, hence fouling could not be attributed to the insoluble SrSO 4 or BaSO 4 .
An explanation for the observed trends may be drawn from the work of Rios-Carvajal [21], which investigated (at nanometer scale) the interactions of different carboxylate functionalities in organic molecules with dissolved divalent cations. They found that carboxylates and dicarboxylates interact differently with different ions. For example, adhesion force of carboxylate with divalent ions increased in the order of Ba 2+ > Ca 2+ > Sr 2+ . On the other hand, in systems of dicarboxylate, interaction was weakest for barium (and stronger for strontium and calcium). The researchers concluded that the strong interaction of strontium with dicarboxylate functional groups resulted from a chelation bidentate interaction, rather than an intermolecular bridging. Our results therefore suggest that the applied DOM (fulvic acid) contained more dicarboxylate functional moieties than carboxylate, thus encouraging DOM interaction with calcium and strontium and discouraging the effect of barium. Similar results were found in previous studies [18,20,36,38], which largely validate the assumption in Section 3.1.1: the impact of organic matter at low levels on membrane fouling depends on the concentration of calcium, and possibly other divalent cations, in the water.

The Effect of Strontium, Barium and Iron on Formation of Organic Fouling
Unlike the well-documented impact of calcium, the effect of strontium and barium on organic fouling is unknown. The effect of iron was mostly documented in the context of flocculation, where it is added to increases in small organic colloids and produced removable flocs. This phenomenon, however, does not always take place in natural water, especially under conditions of dissolved organic matter and low levels of iron. Figure 5 presents the rate constants for the decrease in specific flux as function of strontium and barium concentrations, at levels up to 30 mg/L and 5 mg/L, respectively, (in the upper range of groundwater concentration) [23,39]. Interestingly, the two divalent ions exhibit different effects on fouling formation. Strontium up to 10 mg/L did not affect fouling, while at higher concentrations it promoted fouling formation. This effect is similar to the one observed for calcium (though to a smaller extent), and is likely the result of strontium-DOM interaction and the increase in the size of organic flocs. Barium, on the other hand, had marginal effect on fouling formation throughout the tested range. To verify that the negligible effect of barium was not concentration-dependent, we extended its tested range up to 30 mg/L (similar to Sr 2+ ). Even at this high range, barium did not promote fouling formation (results not shown), which suggest that its tendency to interact with DOM is lower than that of strontium (and calcium). It should be emphasized that sulphate was not detected in the water at any point, hence fouling could not be attributed to the insoluble SrSO4 or BaSO4. An explanation for the observed trends may be drawn from the work of Rios-Carvajal [21], which investigated (at nanometer scale) the interactions of different carboxylate functionalities in organic molecules with dissolved divalent cations. They found that carboxylates and dicarboxylates interact differently with different ions. For example, adhesion force of carboxylate with divalent ions increased in the order of Ba 2+ > Ca 2+ > Sr 2+ . On the other hand, in systems of dicarboxylate, interaction was weakest for barium (and stronger for strontium and calcium). The researchers concluded that the strong interaction of strontium with dicarboxylate functional groups resulted from a chelation bidentate interaction, rather than an intermolecular bridging. Our results therefore suggest that the applied DOM (fulvic acid) contained more dicarboxylate functional moieties than carboxylate, thus encouraging DOM interaction with calcium and strontium and discouraging the effect of barium.
Iron (added as FeCl3) enhances fouling formation even at the lowest concentration tested ( Figure 6). These results are highly important, since iron is omnipresent in many brackish water sources in Israel and elsewhere [40] and its effect on organic fouling should be taken into consideration. Control tests of with iron (0.1 and 0.5 mg/L) but without DOM showed that iron alone have little effect on fouling formation rate. Iron (added as FeCl 3 ) enhances fouling formation even at the lowest concentration tested ( Figure 6). These results are highly important, since iron is omnipresent in many brackish water sources in Israel and elsewhere [40] and its effect on organic fouling should be taken into consideration. Control tests of with iron (0.1 and 0.5 mg/L) but without DOM showed that iron alone have little effect on fouling formation rate.

Online Visual Monitoring of Fouling Formation
The goal in this section was to develop an online monitoring system for predicting and alerting rapid fouling formation. The system combines online video recording of a membrane section and a video analyzing algorithm. Analysis consisted of two steps: (1) auto-identification algorithm of the reference-colored dots on the spacer and (2) scalar value normalization based on the given reference-colored dots.
Auto-identification of the colored dots and their fixation for the entire duration of the experiment was not straightforward, since the coordinates and the color of the dots varies continually, due to fouling accumulation and minor movements of the flow-cell. For that purpose, the SLIC (Simple Linear Iterative Clustering) algorithm was used on each image of the video to create compacts, nearly uniforms super-pixels by clustering image pixels in a color space of five dimensions (three color dimension and two space dimensions), resulting in a map of the super-pixels, as can be seen in Figure 7. Subsequently, the image processing method identified a central area of the membrane (marked with white dot in Figure 7), for analysis of membrane color change during filtration. Note that the first image of the video was utilized for locating the reference-colored dots, since the contrast between the dotes and the membrane was relatively high (no fouling accumulation yet).

Online Visual Monitoring of Fouling Formation
The goal in this section was to develop an online monitoring system for predicting and alerting rapid fouling formation. The system combines online video recording of a membrane section and a video analyzing algorithm. Analysis consisted of two steps: (1) auto-identification algorithm of the reference-colored dots on the spacer and (2) scalar value normalization based on the given reference-colored dots.
Auto-identification of the colored dots and their fixation for the entire duration of the experiment was not straightforward, since the coordinates and the color of the dots varies continually, due to fouling accumulation and minor movements of the flow-cell. For that purpose, the SLIC (Simple Linear Iterative Clustering) algorithm was used on each image of the video to create compacts, nearly uniforms super-pixels by clustering image pixels in a color space of five dimensions (three color dimension and two space dimensions), resulting in a map of the super-pixels, as can be seen in Figure 7. Subsequently, the image processing method identified a central area of the membrane (marked with white dot in Figure 7), for analysis of membrane color change during filtration. Note that the first image of the video was utilized for locating the reference-colored dots, since the contrast between the dotes and the membrane was relatively high (no fouling accumulation yet). The dots' location was further used during the rest of the experiment, with continuous adjustments between successive frames, to track the exact position of the colored and central super-pixels. Details of the SLIC algorithm is provided in the Supporting Information. experiment was not straightforward, since the coordinates and the color of continually, due to fouling accumulation and minor movements of the flow purpose, the SLIC (Simple Linear Iterative Clustering) algorithm was used of the video to create compacts, nearly uniforms super-pixels by clustering in a color space of five dimensions (three color dimension and two space resulting in a map of the super-pixels, as can be seen in Figure 7. Subsequen processing method identified a central area of the membrane (marked wit Figure 7), for analysis of membrane color change during filtration. Note th age of the video was utilized for locating the reference-colored dots, sinc between the dotes and the membrane was relatively high (no fouling accu The dots' location was further used during the rest of the experiment, wi adjustments between successive frames, to track the exact position of the co tral super-pixels. Details of the SLIC algorithm is provided in the Supportin The next step was the analysis of changes in membrane color attributed to fouling. For that, colors of all super-pixels were fragmented into their red-green-blue components, and the specific component in the central super-pixel was divided by its counterparts in the reference colored super-pixels. This was done continually during the entire duration of the experiment to eliminate color changes due to lightning and other artifacts. The three components underwent gray transformation to obtain a single representative value. The green super-pixel was eventually selected for comparison with the hydraulic data, based on its superior stability and visibility throughout the experiment. Changes in normalized color of the membrane vs. time were plotted in parallel to changes in specific flux for each experiment, as exemplified in Figure 8. Correlation between the hydraulic and visual parameter was tested using Equation (1). All experiments exhibited correlation higher than 0.8, with an average of 0.89, indicating high correlation between the two parameters.
Here, x and y are the sample means In the final stage, specific flux was plotted against the relative color intensity (Figure 9 as an example), and the linear regression was calculated for all experiments. Interestingly, all experiments involving DOM at ≥ 2 mgC/L exhibited correlation factors (the slop of the linear regression) in the narrow range of 0.09-0.11, whereas experiments with lower DOM concentrations showed high variability. These results suggest that (i) the main foulant in our system is organic matter and that (ii) the normalized color intensity can be applied for monitoring and predicting the formation of fouling in a variety of water quality. In other words, by monitoring the changes in normalized membrane color and applying a pre-measured correlation factor, we can predict the decrease in specific flux and the formation rate of membrane fouling, which can be used, for example, for coordinating a membrane backwash cycle. green super-pixel was eventually selected for comparison with the hydraulic data, based on its superior stability and visibility throughout the experiment.
Changes in normalized color of the membrane vs. time were plotted in parallel to changes in specific flux for each experiment, as exemplified in Figure 8. Correlation between the hydraulic and visual parameter was tested using Equation (1). All experiments exhibited correlation higher than 0.8, with an average of 0.89, indicating high correlation between the two parameters.
Here, ̅ and are the sample means In the final stage, specific flux was plotted against the relative color intensity ( Figure  9 as an example), and the linear regression was calculated for all experiments. Interestingly, all experiments involving DOM at ≥ 2 mgC/L exhibited correlation factors (the slop of the linear regression) in the narrow range of 0.09-0.11, whereas experiments with lower DOM concentrations showed high variability. These results suggest that (i) the main foulant in our system is organic matter and that (ii) the normalized color intensity can be applied for monitoring and predicting the formation of fouling in a variety of water quality. In other words, by monitoring the changes in normalized membrane color and applying a pre-measured correlation factor, we can predict the decrease in specific flux and the formation rate of membrane fouling, which can be used, for example, for coordinating a membrane backwash cycle.

Conclusions
Membrane fouling is a major drawback of RO desalination, affecting the operation of seawater and brackish water desalination facilities. This study addresses two important points in membrane fouling: (i) the impact of different divalent ions on organic fouling and (ii) the use of online visual monitoring and predicting of fouling formation. The following conclusions could be drawn from the experimental work:

Conclusions
Membrane fouling is a major drawback of RO desalination, affecting the operation of seawater and brackish water desalination facilities. This study addresses two important points in membrane fouling: (i) the impact of different divalent ions on organic fouling and (ii) the use of online visual monitoring and predicting of fouling formation. The following conclusions could be drawn from the experimental work: • When divalent ions are at low concentrations, organic fouling is insignificant, even when DOM is at the upper range of groundwater concentrations (3.5 mgC/L).

•
Of the divalent ions tested, calcium, iron and strontium were shown to enhance the formation of organic fouling, whereas barium did not affect fouling formation, likely due to its low affinity to dicarboxylate moieties in the DOM. • Visual online monitoring of fouling formation was successful, using reference colordots positioned on the spacer. In this system, membrane color change was continuously recorded and normalized to the reference color dots, thus eliminating interferences from lightning and other environmental factors.

•
The normalized color showed high correlation to the decrease in specific flux and can be used in the future to monitor and predict fouling formation during membrane desalination at full-scale.

Supplementary Materials:
The following supporting information can be downloaded at: https://www. mdpi.com/article/10.3390/membranes12121177/s1, Table S1. Specifications of the RO membranes used in the study; Table S2. Quality parameters of the brackish water from Maagan Michael desalination facility; Text S1: The pseudocode of the SLIC algorithm, with more details below. Institutional Review Board Statement: Not applicable.