Mechanisms of heavy metal and oil removal from synthetic saline oilfield produced water by electrocoagulation

In the present study, an electrocoagulation process was applied to treat saline oilfield-produced water. The kinetics of simultaneous heavy metal and oil removal in the saline environment under different conditions including four-electrode materials of copper, zinc, iron, and aluminum, aeration and agitation rate, oil content, and salinity was investigated. The nature of the electro-generated species and possible abatement mechanisms were explored and compared by using FE-SEM/EDS, FTIR, XRD, and BET analyses. At low and high salinities, cadmium adsorption followed Langmuir and Freundlich models, suggesting the transformation of identical adsorption sites to heterogeneous ones. Cadmium removal efficiencies of 99/73% were obtained at low/high salinity with iron and 99.9 and 82% using copper and zinc electrodes in a saline environment. The cadmium adsorption capacity of different anode materials exhibited the order of copper > zinc > iron > aluminum. The adsorption capacity was considerably reduced in saline condition due to more crystalline structure and lower surface area and porosity of the particles while it was enhanced by the oil, caused by structural changes including more uniform pores, the elevated surface area, and porosity. The COD removal yield of 89% for low salinity and 80/73% at high salinity with/without aeration were achieved by iron. The highest COD removal yield of about 95% was achieved by the aluminum electrodes, compared to 85 and 87% for copper and zinc electrodes. The main removal mechanisms were outer- and inner-sphere complexation, and surface precipitation.


INTRODUCTION
Water supply challenges and the growing environmental concerns on wastewater discharge, make the two groups of hydrocarbons and heavy metals deserve more attention because of their high potential of toxicity and bioaccumulation 1 . It was widely demonstrated that both pollutants pose fatal hazards to humans and the environment. For instance, cadmium was proved to cause serious kidney, liver, and Wilson disease 2 . According to the recommendation of WHO for safe limits of Cd in wastewater and soil for agricultural purposes is 0.003 mg L −1 3 . The treatment of wastewaters in terms of organic matter is of great importance because upon its discharge into the environment, it will cause serious harm by soil, surface and groundwater contamination, and health hazards 4,5 . In most countries, the maximum allowable COD value for discharge into the environment is around 200 mg L −1 6 and the oil and grease of 10 mg L −1 7 .
Produced water (PW) is identified as the largest volume liquid by-product in the oil and gas industries. In recent years, more than 39.5 mm 3 per day of water were extracted from oil and gas operations worldwide, whereas a considerable portion was discharged into the environment 1,7 . Generally, other than organic pollutants, PW contains various amounts of heavy metals such as silver, copper, nickel, chromium, lead, and cadmium 8 . Technologies that are currently being used for PW treatment include physical, chemical, biological, and membrane processes 1,9 . The electrocoagulation (EC) can be recognized as a simple and efficient technique possessing essential characteristics of a sustainable water purification process, including fairly low operation costs, energy consumption, and environmental impact alongside considerable water recovery 10 . The EC is anticipated to be a promising method among wastewater treatment techniques in the future due to its potential to generate biocompatible ironbased adsorbents with high adsorption capacities compared to some adsorbents. Furthermore, it can be well introduced as an environmentally friendly technology because electricity, as its main energy requirement, can be entirely supplied from renewable energy sources.
The basis for EC is the dissolution of a sacrificial anode to generate corresponding metal ions 11 . They consequentially undergo hydrolysis to produce coagulating agents of polymeric oxyhydroxide nature. Based on the pH of the solution, electrochemical oxidation of an iron anode leads to the formation of monomeric particles of Fe(OH) 3 and polymeric polyhydroxide/ polyhydroxyoxide metallic complexes such as FeðH 2 OÞ 3þ 6 , FeðH 2 OÞ 5 ðOHÞ þ 2 , Fe 2 ðH 2 OÞ 6 ðOHÞ 4þ 4 , and Fe 2 ðH 2 OÞ 8 ðOHÞ 4þ 2 that exhibit potent coagulation affinity for dispersed species and counter ions 12 .
The mode of action of hydrolyzing metal salts which is also a basis for the electrocoagulation, consists of the two main mechanisms: charge neutralization of negatively charged colloids by cationic hydrolysis products and incorporation of contaminants in amorphous metal hydroxide precipitates (sweep flocculation) 13 .
Therefore, the prime difference between an EC process and conventional adsorption is continuous in situ generation of the adsorbent particles 14 which leads to the involvement of the sweep flocculation phenomenon. Meanwhile, the sweep flocculation has been described for the removal of colloidal particles, not heavy metal ions. Thus, in the case of the metallic ions and the dissolved organic species, the sweep flocculation itself should have involved the adsorption process because these species should be first somehow adsorbed onto the surface of the flocs and then become enmeshed in their growing porous structure. Therefore, the adsorption process can be considered the main mechanism for the abatement of heavy metals and ionic organic species.
Several researchers [15][16][17] have applied adsorption kinetic models to the EC process data previously. Therefore, in the present study, the adsorption kinetics was investigated upon the variation of each operating condition.
Cadmium removal 18,19 , oilfield PW and oil sand PW treatment by EC have been investigated 8,20,21 . However, to the best of our knowledge, the kinetics and mechanisms of heavy metal and oil removal from saline oily wastewater by EC has not been studied. Moreover, most previous studies discussed low salinities, and few articles 22,23 were found to explore saline cases with no study on the variation of salinity. Usually, the oilfield PWs contain high concentrations of various salts (up to 200 g L −1 of chloride and sodium ions) 9 . In particular, the salinities of some Iranian oilfield PWs are within the range of 75-170 g L −1 5 . Thus, here the aim was to provide an improved understanding of the trilateral interactions between heavy metals, organic species, and salts (43.5-120 g L −1 ) in an aqueous medium. Furthermore, using four-electrode materials of copper, zinc, iron, and aluminum and comparing the adsorption capacity and the structural properties of the corresponding produced adsorbents has not been performed before.
The purpose of the present research was to make progress towards understanding the real nature of the various phenomena occurring in an EC process for the removal of heavy metals and oil in a saline oily environment and to explain the possible involving mechanisms. The influence of several parameters on the removal efficiency and adsorption rate has been investigated in detail. The adsorption kinetic and equilibrium data were correlated by various models. In order to explore the nature of the electro-generated species, the removal mechanisms, and the involving interactions, analytic methods of BET, XRD, FTIR, and FE-SEM/EDS have been used extensively.

RESULTS AND DISCUSSION Adsorption dynamics
The amount of adsorbed cadmium at equilibrium may be calculated employing the following equations 16 : In which C 0 and C e represent initial and equilibrium cadmium concentrations (mg L −1 ) respectively, V is the volume of PW in the EC reactor (L), m is mass of the electro-generated flocs (g), I is the electrical current (A), t is time (s), M is the molar mass of anode material, Z is the number of electrons transferred, and F depicts Faraday's constant (C mol −1 ). The three most applied models have been presented in the following sections.

Pseudo-first-order model
The linear form of the pseudo-first order model is as follows 24 : In which q e and q t are the amount of solute adsorbed at equilibrium and time t, mg g −1 and k 1 is the equilibrium rate constant, min −1

Pseudo-second-order model
The pseudo-second-order kinetic model in its linear structure is 25 : In which k 2 is the rate constant of pseudo-second-order adsorption, g mg −1 min −1

Intraparticle diffusion model
Weber and Morris 26 introduced an equation to calculate the diffusion rate coefficient, k i , based on the intraparticle diffusion model: Where k i is the rate constant, mg g −1 min −0.5

Error analysis
In the present study, three different error functions of R 227 , nonlinear chi square (χ 2 ), and sum of errors squared (SSE), were examined to assess the fit of the theoretical kinetic model to the experimental data. The chi square is defined by the following correlation 16 : In which q cal e and q exp e represent the calculated and experimental adsorption capacity at equilibrium in mg g −1 . The sum of the errors squared (SSE) is calculated as follows 24 : Adsorption kinetic study In the following sections, the effects of various operating conditions on cadmium adsorption rate and removal efficiency will be discussed. For the sake of comparison, the contact time of 60 min has been considered for all EC experiments. The basic conditions for the EC experiments were pH 7, current density 25 mA cm −2 , salinity 43.5 g L −1 , and 10 mg L −1 cadmium initial concentration unless otherwise stated in the figure or table.

Effect of current density and pH
The results of conducting several EC experiments at different current densities are summarized in Table 1. Based on the criteria of the highest calculated values of R 2 , the lowest values of χ 2 , and SSE, it can be inferred that the pseudo-second-order model correlates the obtained data the best, as shown in Supplementary  Fig. 1b. This implies that more probably cadmium was adsorbed through chemisorption by exchanging or sharing the electrons between metal ions and the iron oxyhydroxide particles 28,29 . From q e values in Table 1 and the amount of the electro-generated iron hydroxides as 0.429, 1.288, and 2.145 g at current densities of 5, 15, and 25 mA cm −2 , the amount of the adsorbed Cd 2+ would be 2.499, 2.936, and 3.638 mg, respectively. These figures correspond to the removal yields of 50, 59, and 73%. The observed rising trend was due to more available adsorption sites. The k 2 constant is considered as a time-scaling parameter, meaning the greater the value, the shorter the time required to reach an equilibrium state 30,31 . The value of k 2 depends on the operating conditions of the experiments. From Table 1, it is evident that k 2 values raised as the current density increased since the higher the value of q e , the longer the time system needs to attain an equilibrium 31 . Besides, k 2 for the EC test with the current density of 25 mA cm −2 is almost five times that of 5 mA cm −2 , i.e., the adsorption process occurred five times faster with a 23% increase in the cadmium removal efficiency. Thus, the impact of rising the current density is to a greater extent on the adsorption rate rather than the adsorption capacity.
From Supplementary Fig. 1a, it can be observed that although there was a high correlation coefficient for the first-order model, the intercepts of the straight lines of log(q e − q t ) versus t did not result in figures equal or close to log(q e ) values. Therefore, the process was not probably a first-order reaction and followed a more complex mechanism. Supplementary Fig. 1c, clearly indicates that most of the experimental points are not close enough to the straight line of the model, but in all experiments, it seemed that intraparticle diffusion did play some influential role.
The cadmium adsorption capacity as a function of the pH of the medium is shown in Fig. 1a. According to the figure, the adsorption was increased up to pH of 9, although with slight raise from pH 7 to 9. The reason for such trend is that upon the increment of the pH, the deprotonation of the surface functional groups will increase, leading to the raised number of adsorption sites and enhanced cadmium uptake via inner-sphere surface complexation 32 .
Generally, pH influences metal adsorption either by causing the variation of the number of the available adsorption sites or by altering the concentration of the positively charged species of M 2+ , MOH + , and M(OH) 2 which were preferentially adsorbed 33 .
The amount of net surface charge on the surface of the iron oxyhydroxide particles in terms of zeta potential values was presented in Fig. 1b. Clearly, the pH pzc of the iron particles was 6.7 ± 0.1. Above this isoelectric point, the surface of the produced iron particles were negatively charged and both chemical and electrostatic interactions took part in the removal of cadmium. Below the pH pzc , the surface of the flocs were positively charged, leading to less favorable adsorption of the cadmium. Nevertheless, the iron oxide particles selectively adsorb the cadmium cations even at pH values well below the point of zero charge 33 due to the mechanism of the inner-sphere complexation which involves the surface deprotonation 32 . As shown in Fig. 2a, the flocs produced in saline PW, exhibit a porous structure with fine surface texture possessing no edges or only smooth ones and high sphericity. This is consistent with the description of noncrystalline particles, which are usually formed of submicroscopic spherical particles sticking to each other making a disordered mosaic 34 .
In Fig. 3a, the FTIR spectra of the flocs in Cd-free and Cdpolluted PW, the peak at 3417 cm −1 corresponds to the stretching vibration of the hydroxyl groups on the surface of the hydroxides. In the presence of cadmium, the peak of hydroxyl groups broadened up to lower wavenumbers and its intensity diminished compared to cadmium-free PW. This was indicative of the occurrence of an interaction between cadmium and surface hydroxyl groups. Furthermore, the appearance of the characteristic bands of goethite at 894 and 796 cm −1 12 implied the formation of surface complexes between cadmium and the surface functional groups of the iron compounds. The peaks of Cd-O vibrations were appeared in the range of 800-1400 cm −1 35,36 . In addition, in the spectrum of Cd-polluted PW, the intensity of the 1633 cm −1 peak, corresponding to the bending vibrations of O-H functional groups was increased which suggested the intercalation of cadmium ions into the interlayer 29 of the poorly crystalline iron oxyhydroxide structure. The shifting of stretching vibration of C≡C of alkynes at 2201 cm −1 to lower wavenumbers and the appearance of symmetric C-O stretching at 1404 cm −1 and vibrations of C-O and C-O-C at 1153 cm −1 37 could imply the formation of an interaction between cadmium and the functional groups of the organic species.

Effect of the agitation rate
The results of two EC experiments at different agitation rates were listed in Supplementary  Waals forces which reduces the adsorption yields due to limited access to the available adsorption sites. Therefore, mild mixing led to the increased surface area and the adsorption capacity by causing the decrease of the particle size 38 . Mechanical mixing may also alter the adsorption rate via influencing the transport of adsorbate through the boundary layer. At high stirring speeds, the thickness of boundary layer around the adsorbent particle diminishes, and less resistance to mass transfer leads to faster solute transport through it 26,39 . Depending on the applied shear rate, the floc growth and breakage reach a balance point where a steady-state floc size distribution can be achieved 13 . As shown in Supplementary Fig. 2, the alteration of the agitation rate slightly changed the slope of the pseudo-secondorder plot indicating its minor impact on the equilibrium adsorption capacity. Therefore, the external mass transfer did not play a major role in the adsorption of cadmium. It is worth mentioning that the rise of the agitation speed had a more significant impact on R 2 of the intraparticle model, as shown in Supplementary Fig. 2b, suggesting the enhanced pore diffusion. Table 2 encapsulates the impact of different rates of aeration on the EC performance. The equilibrium adsorption capacities were elevated from 1.409 to 1.921 mg g −1 . with the increment in the aeration rate. The aeration provides some degrees of turbulence, which leads to eventual fracturing or thinning of the liquid film surrounded the adsorbent particles, facilitating the reaching of the solute to the adsorbent surface. Thus, due to the high mass transfer coefficients, the adsorption rate was increased 39 . The other reason could be the conversion of ferrous ions to more stable ferric ions and more generation of iron(III) oxide, γ-Fe 2 O 3 , which has been proved to be an excellent heavy metal adsorbent 40 .

Effect of aeration
Supplementary Fig. 3 clearly shows that upon increasing the aeration rate, the slope of the pseudo-second-order model diminished which means the equilibrium adsorption capacity was enhanced considerably. SEM images of the produced flocs under no aeration condition in Fig. 2b, exhibited smaller pores and more corrugated surfaces implying higher surface areas. By comparing the EDS analyses, in Fig. 2a, b for two different aeration modes, the atomic ratios of iron and oxygen elements in the compounds implied the formation of mostly α-Fe 2 O 3 or Fe 3 O 4 rather than iron oxyhydroxides upon using aeration. The atomic ratios of oxygen to iron elements in the amorphous Fe(OH) 3 , lepidocrocite (γ-FeOOH), hematite (α-Fe 2 O 3 ), and magnetite (Fe 3 O 4 ) are equal to 3, 2, 1.5, and 1.33, respectively. Therefore, in the aeration mode, simultaneous lower iron percentage and the slight increase of the percentages of the oxygen and other elements compared to no aeration case, indicated more formation of the iron oxide compounds with lower oxygen to iron atomic ratios. Figure 3b depicts the FTIR spectra of flocs produced at different conditions of aeration. Lepidocrocite characteristic bands at 1153 and 1023 cm −1 12 and Fe-O vibration band 41 at 470 cm −1 were present in all spectra. For no aeration mode, the band at 891 and 796 cm −1 were goethite characteristics bands 42 . The yellowishbrown color of PW after this test supported the conclusion. Full aeration mode resulted in the appearance of a hematite band of 560 cm −1 43 , which indicated the conversion of goethite to hematite. The apparent evidence of such phenomenon was the final dark red color of PW. The two peaks related to O-H bond at 3411 and 1634 cm −1 became less intense, indicating lower concentrations of the hydroxyl-containing compounds while the intensity of the Fe-O vibration band was increased. This revealed that due to the abundant O 2 supply most hydroxide compounds were converted to oxide species. In other words, without aeration, various polymorphs of iron oxyhydroxides were generated, while upon applying aeration, the amount of those phases diminished and the iron oxides became the dominant precipitated species.
The sharp peak at about 27°and the small one at 33°and 36°in Fig. 1c, corresponded to the lepidocrocite phase 44 . From the graph and the textural properties tabulated in Fig. 4a, it can be seen that aeration led to almost doubled BET specific surface area and porosity while diminishing the pore size. The change in the structural characteristics of the iron compounds may be attributed to the conversion of iron oxyhydroxide phases with lath-shaped particles to the mostly hematite phase with a prismatic or steeply dipyramidal structure 45 . Therefore, the mixing of iron oxyhydroxides and oxides with different structures led to the increased surface area and porosity. In addition, the iron oxides consist of a close-packed O 2− anion lattice, while the octahedrally coordinated interstices in between are occupied by the smaller Fe 3+ cations 46 . This can be an indication of the role of the electrostatic interactions. In addition, the outer-sphere complexation mechanism could take part via the electrostatic attraction between the negative charge of O − in Cd-O bond formed on the surface of iron compound particles 47 .
Effect of the oil concentration According to Table 2, the values of q e were raised from 1.542 to 1.740 mg g −1 with the increment in the oil concentrations and k 2 was reduced. Supplementary Fig. 4, supported this trend and confirmed that the presence of oil made the cadmium adsorption process slower. Several researchers [48][49][50] have reported an enhanced adsorption of heavy metals on metal oxide or hydroxide adsorbents due to the presence of organic constituents.
The SEM images of the flocs produced from oil-free PW in Fig.  2c, exhibited particles tightly sticking to each other, being different from quite separate particles shown in Fig. 2a for oilpolluted PW. Obviously, such morphology led to the formation of fewer pores in the former case. In Fig. 3c, both bands at 2250 and 1457 cm −1 corresponding to the C≡C bonds in alkynes and C-H stretching vibration of CH 2 and CH 3 42 of the organic species in the crude oil were disappeared in the spectrum of oil-free PW. The XRD pattern for an oil-free PW in Fig. 1c, displayed a diffraction pattern suggesting the crystalline structure of mostly lepidocrocite and magnetite phases 12,44 . The diffraction peaks of these flocs were higher than oil-polluted PW revealing their higher crystallinity which can partly explain the lower metal uptake of the flocs for oil-free PW. The poorly crystalline structure of iron oxide particles in the presence of oil facilitated the migration of ions into their structure leading to the raised surface interactions 51 .
As depicted in Fig. 4b, the presence of oil in PW led to a much sharper pore size distribution curve, which means more uniform pores in the flocs. Moreover, the BET surface area and porosity were higher. It seemed that the oil increased the stability of iron oxyhydroxide particles under the influence of the elevated steric repulsions between them. In other words, a proportion of the oil inhibited the aggregation of the flocs by adsorbing onto the surface of the metal oxide particles and caused the increment of the steric hindrance 52,53 . Eventually, this led to the increased surface area and total pore volume by preventing the aggregation and further compaction of the freshly produced flocs. Furthermore, it is highly likely that the presence of oil introduced some organic functional groups to adsorbents' surface. In this case, two removal mechanisms of inner-sphere complexation and ion exchange could participate in the cadmium removal because it was demonstrated that -COH can be a good binding site for the cadmium on the surface of iron oxide particles 54 . High concentrations of Ca 2+ , Mg 2+ , and K + ions in the saline PW and their introduction to the surface functional groups, would make the ion exchange phenomenon probable. It was reported 55 that iron ions and oxygen-containing organic species form Fe-R-COOH and Fe-R-OH functional groups, which contribute to enhanced cadmium adsorption.
On the other hand, according to the result of a research done by Zhu et al. 34 , organic ligands can perturb the precipitation of iron species and this leads to the formation of non-crystalline or poorly crystalline iron precipitates which possess higher surface areas 12 . Moreover, the organic ligands can promote the stabilization of iron precipitates which is also favorable for the adsorption process 33 . Experimental conditions: pH 7, current density 25 mA cm −2 , salinity 43.5 g L −1 , and 10 mg L −1 cadmium initial concentration. q e (mg g −1 ), k 1 (min −1 ), k 2 (g mg −1 min −1 ), k i (mg g −1 min −0.5 ). Table 2   respectively. It means that upon the increase of salinity from 2 to 43.5 g L −1 , 37% decrease in the adsorption capacity was observed in the case of NaCl addition, while 57% decline was detected for calcium and magnesium salts. Thus, the presence of calcium and magnesium salts caused a greater negative impact on the metal uptake. This can be attributed to the competition between calcium and magnesium and cadmium ions for an adsorption site under the influence of electrostatic force and complexation 47 and the higher ionic strength 56 . According to Fig. 5a, the equilibrium adsorption capacity, q e drastically decreased due to the increment in the salinity of PW. For example, with the rise of salinity from 2 to 80 g L −1 , q e dropped from 2.303 to 1.258 mg g −1 meaning a 45% decline in the adsorption capacity. It has been demonstrated that the increase of the ionic strength may limit the transfer of heavy metal ions towards the solid surface by affecting their activity coefficient 56 .

Effect of salinity
The effect of the nature of salinity on the adsorption kinetics is illustrated in Fig. 5b, from which it is evident that the pseudosecond-order plot corresponding to 2 and 43.5 g L −1 NaCl concentrations are close to each other with a slight difference in the slopes. It means that the rise of NaCl concentration did not exhibit a strong negative impact on q e . This implied the strong interaction between cadmium and the iron hydroxide surface, in the form of inner-sphere complex formation because the chloride ions usually are weakly bound to the surface sites of iron hydroxides via outer-sphere complexation 57 . Similarly, a minor difference between the two plots relating to 80 g L −1 salinities with different nature (NaCl and mixture of calcium and magnesium salts) can be distinguished, with the graph of two-fold calcium and magnesium salt content possessing a bit greater slope.
According to Fig. 2d, the SEM images of the iron oxyhydroxides produced in low salinity PW depicts flakey particles with very coarse surface texture and lower sphericity compared to the saline case in Fig. 2a. This observation implied greater surface areas because, by the increase of surface angularity or irregularity, the particle surface area was raised 58 . In addition, the lower sphericity of the electro-generated particles in low salinity condition appeared to have a significant inverse impact on the settling velocity of the particles so that they could stay longer in the suspension 59 . This means longer contact time to interact with the pollutants and a favorable phenomenon for the adsorption.
In Fig. 3d, both O-H stretching and bending vibrations at 3414 and 1632 cm −1 became weak and shifted to lower wavenumbers for low salinity case. This, alongside some stronger peaks at the metal-oxygen bond region, was indicative of the formation of more oxide flocs rather than iron hydroxides with much lower molecular water. Such spectrum matched that of magnetite 43 . Therefore, based on FTIR analysis and the high atomic ratio of the iron to O 2 in Fig. 2d, in may be inferred that in low salinity case mostly magnetite particles were generated. In addition to Fe-O vibration bands at 470 and 560 cm −1 , the characteristic bands of goethite at 891 and 796 cm −1 and that of lepidocrocite at 1021 cm −1 were observed in both high salinity spectra. Although the absorption bands corresponding to iron oxyhydroxides, i.e., lepidocrocite and goethite became weaker by increasing the salinity from 2 to 80 g L −1 . This revealed the generation of the oxyhydroxides in lower concentrations in a more saline medium. These bands were disappeared in case of high chloride content in PW with 120 g L −1 salinitiy, and only the peaks at 470 and 560 cm −1 appeared that might be assigned to α-Fe 2 O 3 or hematite. This was supported by the final dark red color of the flocs. The weak absorbance band around 2918 cm −1 appeared, which can be assigned to C-H asymmetric stretching vibration in alkanes. One probable cause can be the oxidation of alkynes in PW by strong hypochlorite ions to some chlorinated saturated hydrocarbons.
According to Fig. 1c, the flocs in low salinity condition, possessed a poorly crystalline structure suggested by broadened peaks with low intensity and also small peaks of magnetite phase could be detected 12 . The broad peak at 10°can be indexed to lepidocrocite 44 . The presence of both phases was also confirmed by the FTIR spectra.
The strong influence of the salinity on the adsorption capacity can be explained in terms of the aggregation behavior of the produced iron compounds based on Derjaguin, Landau, Verwey, and Overbeak (DLVO) theory 60,61 . According to DLVO theory, upon the approaching of two particles, the electrical double-layer surrounding each particle imposes a repulsion force. Based on the correlation provided by DLVO theory, the electrostatic doublelayer potential is directly proportional to the ζ potential of the particles and the Debye length, which is the thickness of the double layer. Upon the increment of the ionic strength, the ζ potential remarkably declines because the Debye length is inversely proportional to the salt content 52 . Therefore, the repulsive force between the particles weakens, and van der Waals attraction forces will favor particles' aggregation. In addition, an enhanced aggregation of iron oxides in the presence of organic species and calcium ions was reported 61 and attributed to the formation of gel network promoted by calcium complexation that bridged the iron oxide clusters.
Overall, the significant effect of the salt content on the adsorption of cadmium is suggestive of the outer-sphere surface complex formation 29,32 because of the strong involvement of the electrostatic interactions in this mechanism. Effect of the type of heavy metal From Supplementary Table 2, it is evident that the kinetics of three heavy metals can be presented by the pseudo-second-order model. According to the results, q e for Pb 2+ and Cu 2+ was 90 and 42% more than the adsorption capacity of Cd 2+ .
As shown in Supplementary Table 2 and Supplementary Fig. 5, the order of the adsorption capacity of heavy metals were: Pb 2+ > Cu 2+ > Cd 2+ . Generally, q e depends on the size of the hydrated metal ions, their electronegativity 62 , electric charge, and hydrolysis constant 32 . The order of the electronegativity of the metals is 2.33, 1.90, and 1.69 for lead, copper, and cadmium. The greater electronegativity is responsible for the elevated specific adsorption tendency 32 because it leads to a highly polarized ionic bond between atoms with stronger electrostatic forces. The order of the hydrated radii of the metals are Cd 2+ > Cu 2+ > Pb 2+ . The affinity will be much higher for the metal ion with a smaller hydrated radius 63 .
Moreover, the larger ionic radius 64 of cadmium led to its limited adsorption in the interlayers of the oxyhydroxides due to steric hindrance and much less electrostatic attraction. Furthermore, it was demonstrated that in the aqueous medium, Cd 2+ exhibits a relatively weak tendency to form polymeric hydroxido-species in comparison to Cu 2+ and Pb 2+65 . For instance, the formation of polymeric Cd 2 (OH) 3+ was quite considerable when the concentration of Cd 2+ exceeded 10 −2 mol L −1 compared to 5 × 10 −4 and 10 −5 mol L −1 for Pb 3 ðOHÞ 2À 4 and Cu 2 ðOHÞ 2þ 2 , respectively. Thus, the enmeshment of the bulky polymeric species in the growing metal hydroxide agglomerates in accordance with the sweep flocculation mechanism can occur more easily.
Lastly, at pH values above 5, Cu 2+ and Pb 2+ ions begin to precipitate in the form of respective oxides and hydroxides, whereas Cd 2+ will mostly remain in solution up to pH 6 66 . Therefore, at pH 7, the surface precipitation mechanism to a greater extent contributed to the lead and copper removal.

Effect of the presence of competing ions
In practice, miscellaneous heavy metals are simultaneously present in PW. Therefore the investigation of the influence of the presence of different heavy metals on the kinetics of the other metals removal is crucial due to their competition for adsorption sites 67 . The results of the EC experiments with PW containing various heavy metals are listed in Supplementary Table 3.
As depicted in Supplementary Fig. 6, the presence of Pb 2+ in PW in equal quantities (each 10 mg L −1 ) caused the 60% drop in the equilibrium adsorption capacity of Cd 2+ for PW with a total metal content of 20 mg L −1 . Similarly, the presence of Pb 2+ and Cu 2+ in PW (each 10 mg L −1 ) led to a 70% reduction in q e for cadmium in PW containing 30 mg L −1 of metal ions. This means that in the case of three metal PW, Cd 2+ adsorption decreased 10% more than one-third of 4.737 mg g −1 for a single metal PW with the same metal concentration (30 mg L −1 ). Therefore, in a three-metal PW, the other two metals, i.e., Pb 2+ and Cu 2+ adsorbed preferentially more than Cd 2+ on the flocs. As discussed before, this observation can be attributed to the different sizes of the hydrated metal ions and their electronegativity 62 . Table 2 summarizes the results of conducting EC experiments using copper, zinc, iron, and aluminum electrodes. The amounts of dissolved material for copper, zinc, iron, and aluminum electrodes were 2.441, 2.512, 2.148, and 0.690 g, respectively. Based on q e values for each electrode, the amount of adsorbed cadmium out of initial 5 mg would be 4.994, 4.114, 3.638, and 3.634 mg, correspondingly. Consequently, the copper and zinc electrodes were substantially more effective in the adsorption of Cd 2+ than iron and aluminum. Besides, the performance of the iron and aluminum electrodes in terms of cadmium removal were almost the same. Figure 5c illustrates the apparent difference between the adsorption performances of miscellaneous electrode materials in terms of the slopes of the pseudo-second-order kinetic models.

Effect of the electrode material
The SEM images of the copper flocs in Fig. 2e revealed a corrugated structure with fewer pores compared to that of iron oxyhydroxides in Fig. 2a. The EDS analysis of the copper flocs in Fig. 2e indicated the formation of mostly copper hydroxides rather than oxides, based on the atomic ratio of copper to oxygen. In In the case of zinc electrodes, the 3400 cm −1 associated with O-H stretching vibration shifted to lower wavenumbers around 3217 cm −1 , which indicated the increment of the interlayer water due to the increased cadmium accumulation between the layers. Moreover, the bands between 506 and 409 cm −1 can be assigned to the Zn-O bond.
According to Fig. 1c, the iron and zinc XRD patterns exhibited less crystallinity than the copper pattern implied by their broad humps with low intensity which are the characteristics of poorly crystalline or amorphous phases. The better crystallization of copper hydroxide particles was reflected by the higher intensity of the peaks. The peaks in Fig. 1c for saline PW corresponded to the goethite phase 44 . The peaks at 16°and 34°and the ones at 34°, 40°, and 50°could be indexed to Cu(OH) 2 69 and CuO 70 , respectively. The diffraction peaks of Zn(OH) 2 and ZnO 71 could be identified in Fig. 1c. A much higher intensity of copper particles' peaks was evidence of their smaller size compared to iron and zinc particles.
As depicted in Fig. 4c, copper flocs exhibited one of the lowest BET-specific surface areas. The average pore size for copper and iron was almost the same, but the specific surface area and porosity of the copper-based particles were smaller. Thus, in the case of copper electrodes, a different mechanism should be responsible for the enhanced cadmium removal other than sweep flocculation, i.e., a kind of surface phenomenon rather than porebased one. Copper hydroxide has an orthorhombic crystal structure in the form of corrugated layers perpendicular to the b-axis that copper ion is surrounded by pentahedral built-up consisted of five OH − ions. Cudennec et al. 72 reported that in the presence of hydroxide ions, divalent copper ions dissolve in the form of tetrahydroxocuprate (II) anions, CuðOHÞ 2À 4 , at room temperature. Under the influence of the Jahn-Teller effect exhibited by the copper ion, this complex was stabilized. Therefore, for copper anodes, instead of the sweep flocculation mechanism and the enmeshment of the particles, to a greater extent, the electrostatic attraction mechanism was involved.

Equilibrium isotherms
The heavy metal adsorption data were modeled by using Langmuir and Freundlich models, which are presented as follows: Langmuir isotherm Langmuir isotherm model deals with homogeneous adsorption of heavy metal ions 16,29 . The linearized form of the Langmuir isotherm model can be written in the following manner: Where q max is the maximum adsorption capacity representing the monolayer capacity (mg g −1 ), K L is the Langmuir constant.

Freundlich isotherm
Freundlich isotherm model is an empirical equation, which is presented in the linear form as: Where K F stands for the Freundlich constant and n is the heterogeneity coefficient.
Based on the higher R 2 in Table 3, it can be deduced that the Freundlich model described the adsorption process better in all the three cases of the basic PW, PW without oil, and no aeration case. The dominance of the Freundlich model could imply the heterogeneous adsorption of cadmium ions onto the electrogenerated adsorbents 29,47 and the presence of diverse adsorption sites possessing different adsorption energy. Also, it suggested that the chemisorption mechanism played a significant role in the adsorption of the metal ions via inner-sphere surface complexation instead of the electrostatic attraction 29,42 . According to the Freundlich model, at first stage, the stronger binding sites will be occupied and the binding strength diminishes with the increment in the degree of the site occupation 50 , which can be the case here. The calculated values of more than one for n in all three cases proved the favorability of the cadmium onto the iron oxyhydroxides.
According to Table 3, the maximum cadmium adsorption capacity of the iron oxyhydroxides was 19.231 mg g −1 , which was suggestive of the relatively high adsorption affinity of the adsorbents to the cadmium ions. This capacity was comparable to some adsorbents including hematite (4.94 mg g −1 ) 73 , activated carbon (3.37 mg g −1 ) 74 , montmorillonite (14.2 mg g −1 ) 75 , and modified biochar (12.3 mg g −1 ) 37 .
The calculated n values from the Freundlich model confirmed that the oil presence and aeration promote the adsorption of cadmium and the adsorption intensity (1/n) was raised. The Langmuir isotherm model can adequately represent the adsorption of cadmium for low salinity case, as shown in Fig. 6a. This could be an indication of the existence of homogeneous active sites on the adsorbent particles and the occurrence of the monolayer sorption of Cd 2+ at low salinity 50 .
Such difference in the adsorption mechanisms revealed that increasing the salt concentration provoked changes in the surface characteristics of the adsorbents. In other words, the surface of the generated hydroxides became more heterogeneous. It seems that in saline conditions, high concentrations of Ca 2+ , Mg 2+ and K + ions and their introduction to the different surface functional groups within the scope of the ion exchange mechanism could be the source of such heterogeneity of the surfaces. As shown in Fig.  6b, c, the presence of oil and aeration caused no significant change in the slope of the Freundlich equation, in turn, these conditions led to the shift of the plots. Therefore, as demonstrated by the kinetic analysis, the oil content and air flow strongly affect the adsorption capacity.

Cadmium removal mechanisms
It is well known that for iron oxyhydroxides the amount of adsorbed contaminant strongly depends on the number of the available one-coordinated FeOH surface sites, the surface area, and the pH of the medium 76 . Based on the findings of this Experimental conditions: pH 7, current density 25 mA cm −2 , salinity 43.5 g L −1 , and 10 mg L −1 cadmium initial concentration. research including the strong effect of pH (Fig. 1a), zeta potential variation with pH (Fig. 2a), and the remarkable influence of the ionic strength ( Fig. 5 and Table 1) on the cadmium adsorption capacity, it can be deduced that both inner-sphere and outersphere surface complex formation were involved as main adsorption mechanisms because the former is highly pHdependent and the latter strongly depends on the ionic strength of the medium 29,32 . In other words, the cadmium adsorption occurred through the formation of the inner-sphere complexes that involved an ion exchange phenomenon, i.e., the replacement of bound protons of the surface functional groups on the surface of the iron oxyhydroxides by the adsorbed cadmium ions 33 .
It was demonstrated 77,78 by EXAFS spectroscopy analyses that cadmium sorption on the surface of goethite mainly have occurred via bidentate binuclear inner-sphere complexation. Some potential configurations have been proposed 48,57,79,80 for cadmium-iron oxide complexes, as exhibited schematically in Fig. 7.
According to a research by Lin et al. 54 , cadmium adsorption may occur via deprotonation of the organic functional groups of -COOH and -OH on the surface of the iron compounds and the formation of metal-ligand complexes, as exhibited in Eqs. (10) and (11). Furthermore, cadmium can form monodentate surface complexes with the hydroxyl functional groups on the surface of the iron oxyhydroxides, as shown in Eq. (12).
Moreover, based on the speciation of Cd 2+ 66,80 which exhibits the distribution of cadmium species as a function of pH of the medium with the total cadmium concentration of 50 μM, the precipitation of the cadmium ions as Cd(OH) 2 starts at pH values around 6 and reaches its peak at around pH 9. In conclusion, in this study at pH 7 which all the EC experiments have been carried out, the three adsorption mechanisms of inner-sphere, outersphere surface complexations, and surface precipitation mechanisms were involved in the cadmium removal.

Oil removal mechanisms
To investigate the oil removal efficiencies, COD values of the PW have been measured after each EC experiment. The COD removal efficiency of about 80% has been achieved in an EC test at the current density of 25 mA cm −2 , the salinity of 43.5 g L −1 , and pH 7 for basic PW. In the case of low salinity (2 g L −1 ), no aeration, and doubled oil content, 88.57%, 73.33%, 76.19% of COD removal yields were obtained, respectively. By utilizing copper, zinc, and aluminum electrodes in saline environment with aeration, COD abatement was 84.76%, 86.66%, and 94.28%. Therefore, the air flow rate and salinity exhibited considerable influence on the COD removal. The lower oil removal in saline environment can be to some extent attributed to the lower porosity of the iron oxyhydroxides. Furthermore, it can be justified by the fact that by the increase of the concentration of alkali metals the water absorbency of the adsorbent declines 81 . The reason for such phenomenon was explained in terms of the diminished osmotic pressure difference between the adsorbent and the surrounding environment caused by the rise of the salt content. Therefore, in saline medium, the iron oxyhydroxides contained less water molecules in their crystal structure which led to the lower pore volume. Within the concept of the sweep flocculation mechanism, less open structure led to the lower enmeshment of the pollutant particles.
With regard to COD abatement yields, it is worth mentioning that the stability of the organic constituents to oxidation by oxidizing species, determined by their molecular structure, strongly affects the COD removal yields. The chemicals such as phenol, isopropyl alcohol, glucose and similar compounds which do not react with the coagulants to form insoluble products remain in the aqueous medium 82 . Thus, the part of the COD that remained unremoved, could be attributed to the presence of phenolic and cyclic constituents in the PW.
With regard to the oil removal, various possible mechanisms can be presented. First, the electrostatic attraction between the negatively charged organic compounds and positive metallic ions and species, leading to their neutralization and subsequent precipitation 13 . Moreover, hydrophobic interactions and H-bonding via R-OH, OH, and COOH functional groups 83 can contribute to the removal of the organic compounds. In addition, physisorption through pore filling mechanism and van der Waals intermolecular attraction may take part in the removal of organic species 47 .
The excellent performance of the aluminum electrode for the abatement of the organic constituents may be attributed to the structural properties of the aluminum oxyhydroxide particles as layered double hydroxides (LDH) 29 . They can swell and raise the space between the layers to accommodate the dispersed organic species and the negatively charged dissolved ions. In other words, they are well capable of intercalating the ions into the interlayers. Moreover, the structure of the amorphous and gelatinous aluminum oxyhydroxides with lower rigidity provided the greater accessibility of reactive adsorption sites within their structure which led to the raised adsorption of species 51 .
In this article, heavy metals and oil pollutants have been removed to a great extent from severely polluted produced water using EC technique. By applying supplementary treatments, the water can be re-used for beneficial purposes or discharge into the environment harmlessly. The most noticeable results obtained as follows: • Based on the findings of this study, the three mechanisms of inner-and outer-sphere surface complexations and surface precipitation were mainly involved in cadmium and oil removal.
• The kinetic data under widely different conditions followed pseudo-second-order kinetics, which indicated that chemisorption was the main removal mechanism rather than van der Waals interactions or pore diffusion process.
• In saline environment, the Freundlich isotherm model described the equilibrium data well, suggesting the heterogeneity of the distribution of the binding sites and multilayer adsorption. The Langmuir model was proved to be more appropriate for low salinity condition, indicating the formation Fig. 7 The proposed configurations for cadmium adsorption. The schematic representation of the possible configurations for cadmium-iron oxide complex.
of identical homogeneous adsorption sites. Therefore, the salts caused changes in the characteristics of the surfaces of the produced iron compounds.
• Upon the increase of aeration load, a gradual change occurred in the nature of the produced precipitates from the mixture of polymorphs of iron oxyhydroxides to more stable iron oxides. Such mixture of iron oxyhydroxides and oxides with different structures led to the increased porosity and BET specific surface area and the eventual enhanced adsorption capacity. Furthermore, the outer-sphere complexation mechanism was involved due to the formation of Cd-O bonds, providing the negatively charged O − on the surface of the adsorbents.

•
The presence of oil in PW provoked some changes in the structure of the iron oxyhydroxides, including more uniform pores, the elevated BET surface area, and total pore volume. This can be explained by its role in preventing the aggregation of the iron compounds due to the increased steric hindrance. In addition, the crystallization of the hydroxide precipitates was probably inhibited and retarded by the organic ligands, leading to the formation of amorphous particles. Moreover, by the introduction of some organic functional groups to the surface of the adsorbents, the two adsorption mechanisms of surface complexation and ion exchange were involved in the elevated cadmium removal.

•
The cadmium adsorption was strongly inhibited by the salinity, while the nature of the salts imposed a greater negative impact. An increase in the salinity from 2 to 43.5 g L −1 led to a 37% and 57% decrease in the adsorption capacity for NaCl salt and calcium and magnesium-rich environment, respectively. This was justified by the poorly crystalline and mostly amorphous structure of the produced iron particles with higher surface area in low salinity condition.

•
The adsorption capacity for different anode materials exhibited the order of copper > zinc > iron > aluminum. A much larger cadmium adsorption capacity of the copper electrode was attributed to the different orthorhombic crystal structure of copper hydroxide particles. Based on the electrostatic attraction mechanism, the formation of tetrahydroxocuprate (II) anions, CuðOHÞ 2À 4 , in the presence of hydroxide ions and their stabilized structure because of the Jahn-Teller effect, was the principal reason for such observation.

•
The observed q e for Pb 2+ and Cu 2+ was 90% and 42% more than the adsorption capacity of Cd 2+ . Heavy metal type strongly affected the adsorption capacity. The order of the adsorption capacity of heavy metals by iron oxyhydroxides was: Pb 2+ > Cu 2+ > Cd 2+ . This was explained in terms of higher affinity for ions with smaller hydrated radius, the increased steric hindrance, and much less electrostatic attraction due to the larger ionic radius of cadmium, and the stronger involvement of the surface precipitation mechanism at pH 7 for Cu 2+ and Pb 2+ ions.

•
The COD removal efficiencies were remarkably affected by the aeration and salinity. For iron oxyhydroxides, it decreased from about 89% in low salinity case to 80% and 73% for saline PW with and without continuous air supply, respectively. The aluminum electrode exhibited the highest COD removal yield of about 95% compared to 85% and 87% for copper and zinc electrodes.

METHODS Materials
To rule out any interference by the additives present in real PW, synthetic PW was prepared according to real PW composition from Ahwaz 2 oilfield PW in Iran. The preparation procedure was to mix sweet crude oil and emulsifier with ratio of 8 to 1 (vv −1 ). At first, Tween 80 was stirred in deionized water and then fine drops of 0.5 mL of crude oil were added. The resulting mixture was stirred at 3000 rpm for 1 h. Then, the supporting salts which will be referred to as mixture of salts, including 24.609 g CaCl 2 ·2H 2 O, 15.877 g MgCl 2 ·6H 2 O, 1.504 g KCl, 0.5766 g NaBr, 0.5248 g MgSO 4 , 0.4123 g NH 4 Cl, thoroughly dissolved in deionized water, were added. Heavy metals were used as the corresponding chloride salts. The COD value for the obtained mixture was 2100 mg O 2 /L.

Experimental setup
The EC reactor was constructed of Plexiglas with dimensions of 18.8 cm × 8 cm × 19.8 cm. The electrodes were six iron plates with an effective surface area of 68 cm 2 , connected to a DC power supply in a monopolar configuration. The air flow was supplied by a compressor through a perforated glass tube installed at the bottom of the reactor. During EC experiments, the medium was agitated continuously using a mechanical stirrer at 1000 rpm.

Experimental procedure
The pH of the PW was adjusted with the addition of either 1 M NaOH or 1 M HCl. All experiments were carried out for 60 min at the ambient temperature of 25°C. Samples were taken out from the bottom of the reactor several times during each test and before the measurement of cadmium concentration or COD, centrifuged for 10 min at 4500 rpm. Each experiment was conducted in duplicate to prevent any uncertainty.

Analytical methods
Cadmium measurements were done using the ICP-OES technique (Varian-Inc.). The conventional calorimetric standard method cannot be applied for COD measurement in the case of saline PW, due to its limitation for chloride ion concentration 25 . A modified method proposed by Freire et al. 26 with dilution by 1:10 ratio was used. FTIR analysis was implemented by using a ThermoScientific spectrometer (Nicolet iS10) containing KBr pellets. A GNR Explorer diffractometer at 40 KV, 30 mA, and CuKα radiation of λ = 1.5406 Å was used for XRD analysis. The field emission-scanning electron microscopy (FE-SEM) images were produced by a MIRA3 TESCAN scanner (80 mA and 20 kV). A Quantachrome Autosorb1 analyzer was used to estimate the Brunauer Emmett Teller (BET) surface area, pore size distribution, and pore volume.