Electrochemical Recovery of Phosphorus from Simulated and Real Wastewater: Effect of Investigational Conditions on the Process Efﬁciency

: The development of recovery processes has become essential in recent years as a strategy to minimize environmental pollution while boosting circular economy and sustainable development. Due to the exponential growth in agricultural production and the increased pollution of waterbodies, the production of fertilizers from recovered phosphorus has become an alternative to phosphate rock-based production. In this work, the effect of different operational parameters in the efﬁciency of the electrochemical recovery of phosphorus, from organic and inorganic sources, was investigated. Among the studied variables, the most signiﬁcant was the electrode material utilized in the system. The use of magnesium sacriﬁcial electrodes, as AZ31 alloys, led to phosphorus removal from solution of above 90%, allowing the recovery of both orthophosphates and organic phosphorus (glyphosate) as struvite, brucite, and other amorphous compounds. Since there is a lack in the literature about the use of magnesium electrodes in real wastewater electrochemical treatment, system efﬁciency was also evaluated using a sanitary landﬁll leachate, reaching 96% of phosphorus recovery. The speciﬁc energy consumption and faradaic efﬁciency of the phosphorus recovery process were also assessed.


Introduction
The world population growth in the last few millennia has been strongly related to the agricultural development: initially, 12,000 years ago, with the First Agricultural Revolution; more recently, with the utilization of synthetic fertilizers [1,2].According to the literature, the world population in 2015 would have been less than four billion if the use of nitrogen synthetic fertilizers had not been implemented in the 20th century [3].
The use of synthetic fertilizers, despite the benefits to agricultural development, poses some environmental issues, like the excess of nutrients applied in soils.This excess is not absorbed and runs off into waterbodies.The excessive application of phosphorus in soils is a worldwide concern, achieving 25-50 kg of P per hectare of soil in Chile, China, and Iraq, or even 50-100 kg per hectare in countries like Japan, New Zealand, Saudi Arabia, and South Korea [4].The runoff of high concentrations of nitrogen and phosphorus can induce eutrophication in waterbodies, which has become more frequent due to the increase in nutrients application in soils [5][6][7][8][9].This may lead to the loss of biodiversity in ecosystems, causing economic costs and increased difficulty in treating water for public supply [10].In addition to phosphorus in fertilizers, the phosphorus extant in waste produced by phosphate rock mining, a major phosphorus source for industry, also contributes to the contamination of waterbodies [11].This kind of contamination includes not only phosphorus but also heavy metals, as shown in a study carried out in 2015, which Sustainability 2023, 15, 16556 2 of 15 associated the bioaccumulation of zinc, copper, and cadmium in fishes with the activity of a phosphate fertilizer plant [12].
Directive 91/271/EEC establishes that the parametric value of phosphorus in effluents from urban wastewater treatment plants to be discharged in waterbodies sensitive to eutrophication is between 1 and 2 mgP L −1 , depending on the population size served by the plant [13,14].The increasing environmental concerns and regulations have led to the development of technologies for phosphorus removal [15], especially as the possibility of a phosphate rock shortage has boosted research into phosphorus recovery technologies [16][17][18][19].Among the many technologies currently available for phosphorus recovery [20], electrochemical methods are the most promising due to their efficiency and economic feasibility, as the solids obtained can be utilized as fertilizers without requiring post-treatment [21].Nevertheless, the extant research mainly focuses on orthophosphate, since it is easier to recover than other forms of phosphorus, despite organic phosphorus being the main fraction in some ecosystems [22,23], and its eutrophication potential cannot be neglected [24].
Among the organic phosphorus sources that can be found in the environment, the organophosphate pesticides should be highlighted [25].Glyphosate, or N-(phosphonomethyl) glycine, is a pesticide discovered in 1970 that acts on plants and microorganisms by inhibiting one of the enzymes involved in aromatic amino acid synthesis [26].Despite the potential negative effects of glyphosate on animal health, its use increased from 16 kton in 1994 to 79 kton in 2014, being the most used pesticide worldwide [27,28].Glyphosate has been detected in farmworkers at concentrations above 200 µg L −1 and up to 7.6 µg L −1 in the general population [29,30].Despite its low acute toxicity (LD 50 of 5000 mg kg −1 ), many studies have reported: (1) its chronic effects-International Agency for Research in Cancer of World Health Organization (IARC/WHO) classified glyphosate as "potentially carcinogenic" in 2016; (2) the toxicity of auxiliary compounds present in commercial products containing glyphosate; and (3) the toxicity of glyphosate derivatives produced in the environment [31][32][33].
The conversion of organic phosphorus to orthophosphate can be carried out in many ways, e.g., through ozone, microwaves, ultraviolet radiation, electrochemical oxidation, etc. [34][35][36][37].In the particular case of electrochemical oxidation, the organic phosphorus is oxidized to orthophosphate, which can then be recovered [21].This process is based on the generation of hydroxyl radicals (OH•), which present one of the highest standard oxidation-reduction potentials (2.8 V vs. SHE) [38].Despite the two-step process, phosphorus recovery needs only a single reactor, as the oxidation of organic phosphorus occurs at the anode and the orthophosphate precipitation occurs at the cathode (Figure 1) [39,40].According to the literature, this recovery can supply about 15% of the phosphorus demand for fertilizer production [41].contamination includes not only phosphorus but also heavy metals, as shown in a study carried out in 2015, which associated the bioaccumulation of zinc, copper, and cadmium in fishes with the activity of a phosphate fertilizer plant [12].Directive 91/271/EEC establishes that the parametric value of phosphorus in effluents from urban wastewater treatment plants to be discharged in waterbodies sensitive to eutrophication is between 1 and 2 mgP L −1 , depending on the population size served by the plant [13,14].The increasing environmental concerns and regulations have led to the development of technologies for phosphorus removal [15], especially as the possibility of a phosphate rock shortage has boosted research into phosphorus recovery technologies [16][17][18][19].Among the many technologies currently available for phosphorus recovery [20], electrochemical methods are the most promising due to their efficiency and economic feasibility, as the solids obtained can be utilized as fertilizers without requiring posttreatment [21].Nevertheless, the extant research mainly focuses on orthophosphate, since it is easier to recover than other forms of phosphorus, despite organic phosphorus being the main fraction in some ecosystems [22,23], and its eutrophication potential cannot be neglected [24].
Among the organic phosphorus sources that can be found in the environment, the organophosphate pesticides should be highlighted [25].Glyphosate, or N-(phosphonomethyl)glycine, is a pesticide discovered in 1970 that acts on plants and microorganisms by inhibiting one of the enzymes involved in aromatic amino acid synthesis [26].Despite the potential negative effects of glyphosate on animal health, its use increased from 16 kton in 1994 to 79 kton in 2014, being the most used pesticide worldwide [27,28].Glyphosate has been detected in farmworkers at concentrations above 200 µg L −1 and up to 7.6 µg L −1 in the general population [29,30].Despite its low acute toxicity (LD50 of 5000 mg kg −1 ), many studies have reported: (1) its chronic effects-International Agency for Research in Cancer of World Health Organization (IARC/WHO) classified glyphosate as "potentially carcinogenic" in 2016; (2) the toxicity of auxiliary compounds present in commercial products containing glyphosate; and (3) the toxicity of glyphosate derivatives produced in the environment [31][32][33].
The conversion of organic phosphorus to orthophosphate can be carried out in many ways, e.g., through ozone, microwaves, ultraviolet radiation, electrochemical oxidation, etc. [34][35][36][37].In the particular case of electrochemical oxidation, the organic phosphorus is oxidized to orthophosphate, which can then be recovered [21].This process is based on the generation of hydroxyl radicals (OH•), which present one of the highest standard oxidation-reduction potentials (2.8 V vs. SHE) [38].Despite the two-step process, phosphorus recovery needs only a single reactor, as the oxidation of organic phosphorus occurs at the anode and the orthophosphate precipitation occurs at the cathode (Figure 1) [39,40].According to the literature, this recovery can supply about 15% of the phosphorus demand for fertilizer production [41].Although biological-based technologies for phosphorus removal are possible, their limitations, like high hydraulic retention time and narrow temperature interval for functioning, are drawbacks in comparison to electrochemical methods, such as electrosorption, electrocoagulation, and electro-induced precipitation [6].In the later, it is possible to precipitate salts with a high phosphorus bioavailability, allowing their utilization as fertilizers [18].Of these salts, the main ones are calcium phosphates and struvite [18].Despite the precipitation of calcium phosphates being easier when ammonium and magnesium concentrations are low, struvite precipitation has the advantage of being able to simultaneously remove nitrogen and phosphorus [42][43][44].Moreover, since struvite is less soluble than calcium phosphates, it can gradually release the phosphorus into the soil, enhancing the phosphorus absorption by the plants and reducing the amount of phosphorus that reaches the waterbodies [45].In fact, struvite can either be used as direct fertilizer or in complex formulations, where it acts like a long-term fertilizer [46].
In struvite-based phosphorus electrochemical recovery, the addition of chemicals represents a significant part of the process costs and, thus, the correct choice of the chemicals to be used is essential to reach economic feasibility [47,48].Since most wastewaters present low concentrations of magnesium, magnesium source is a key factor [49].A possible way to supply magnesium is the use of magnesium consumable electrodes, which have been studied due to their ability to supply suitable amounts of magnesium, regulate pH, produce higher purity struvite, and favor control and automation at an industrial scale [50,51].Of the metals applied in engineering, magnesium has one of the most negative standard reduction potentials (−2.37 V vs. SHE), being largely used as sacrificial metal to protect materials based on aluminum, zinc, iron, and others [52].Pure magnesium electrodes are expensive, but the use of magnesium alloys is similar in price to the use of magnesium chloride [53], although magnesium alloys that are corrosion-resistant should be avoided [49].Previous research has shown that the alloy AZ91 (with 9% of aluminum and 1% of zinc) and AZ31 (with 3% of aluminum and 1% of zinc) are more easily corroded than pure magnesium, with the AZ31 alloy showing the best performance [54,55].
Despite the good research results on phosphorus recovery from solution, there are a lack of data in some fields, such as the performance of magnesium electrodes when treating real wastewater, the scale-up of the methods, and the systematic evaluation of operational parameters like pH, applied current or potential, and electrode material.In this work, three combinations of electrodes material, the effect of treatment time, applied potential, carbonate addition, glyphosate presence, and the treatment of a real wastewater were assessed.The solids obtained were analyzed using X-ray diffraction (XRD) and energy-dispersive X-ray spectroscopy (EDX).
The simplest simulated wastewater sample (SW1) was prepared through dissolution in distilled water of MgSO 4 •7H 2 O, KH 2 PO 4 and (NH 4 ) 2 SO 4 to obtain a solution with 3.85 mM of Mg 2+ , PO 4 3− , and NH 4 + .SW2 was obtained by adding Na 2 CO 3 to SW1 and was used to evaluate the influence of the carbonate ion.The concentration of carbonate was chosen to be 2 mM to obtain a simulated wastewater sample with a pH of around 7-8. SW3, used in the experiments performed with magnesium anodes, had a similar composition to SW2 but without MgSO 4 •7H 2 O. SW4 was obtained by adding glyphosate to SW3 and was used to evaluate the influence of organic phosphorus.SW5 had a similar ion composition to SW4 and was prepared to study the influence of the magnesium source on the precipitate composition.In SW4 and SW5, the glyphosate concentration was chosen to obtain a simulated wastewater with 10% of total phosphorus as organic phosphorus.The real wastewater used was a sanitary landfill leachate from an intermunicipal sanitary landfill facility in Portugal.The composition of the simulated wastewaters and the main parameters of the real wastewater are summarized in Table 1.
For the simulated wastewaters, experiments were performed at the applied potentials of 5, 7.5, or 10 V to produce a current intensity between 100-1000 mA, since previous assays demonstrated poor efficiency for current intensities below 100 mA.For the sanitary landfill leachate, due to its high electrical conductivity (EC), a 400 mV potential was enough to guarantee the intended current intensity.Treatment times were between 1-8 h, and the treated volume was 100 mL for all the experiments.Assays were performed in triplicate, and the results were expressed as medium values.
The electrochemical assays were performed using a Potentiostat-Galvanostat Autolab B.V., with NOVA 1.10 (2013) software (Reference 3526 KM Utrecht), purchased from Gomensoro Potencial Zero (Lisboa, Portugal), with an Ag/AgCl Radiometer 321 reference electrode (VWR International, Amadora, Portugal).The potential of this electrode is 0.197 V (vs.SHE), and all potentials mentioned in this work refer to the reference electrode potential.Boron-doped diamond (BDD, Neocoat, La Chaux-de-Fonds, Switzerland), mixed metal oxide (MMO, Insoluble Anode Technology BV, Oirschot, The Netherlands) of titanium coated with iridium and tantalum (Ti/Ir-Ta), and magnesium alloy AZ31 (Evek GmbH, Mülheim an der Ruhr, Germany) were used as working electrodes, and stainless steel (SS) was used as an auxiliar electrode in three different combinations: BDD/SS; MMO/SS; and AZ31/SS.For all the assays, the immersed area of each electrode was 9 cm 2 .The experimental setup is presented in the Supplementary Materials (Figure S1).
The vanadomolybdophosphoric acid method was followed to determine both orthophosphate and total phosphorus, using a Shimadzu UV-1800 spectrophotometer (Izasa Scientific, Carnaxide, Portugal), at a wavelength of 400 nm [56].A persulfate digestion was performed for total phosphorus determination [56].
Chemical oxygen demand (COD) was performed according to the closed reflux and titrimetric methods [56].Dissolved organic carbon (DOC) and inorganic carbon (IC) were determined in a Shimadzu TOC-VCPH analyzer (Izasa Scientific, Carnaxide, Portugal).EC and pH were measured with a Metler Toledo S20 and a Metler Toledo N154, respectively, both purchased from MT Brandão (Oporto, Portugal).
The mass of the solid was determined in two fractions: the suspended mass, i.e., the suspended solids in the solution that were retained by a glass fiber filter 1.2 µm in diameter after filtering the treated solution, and the adhered mass, collected from the electrodes' surface.

Influence of Applied Potential and Time
Utilizing the SW1 and the BDD/SS electrode combination, the influence of the applied potentials, 5, 7.5, and 10 V, and of the treatment time, 4 and 8 h, on the P recovery was evaluated.Table 2 presents the final pH, EC, and the solid mass obtained in these experiments.The final pH for 4 and 8 h assays is approximately 3, indicating that the decrease in pH occurs during the first 4 h of electrooxidation.When both cathode and anode are inert electrodes, hydroxide ions are formed at the cathode and hydronium ions are formed at the anode (Figure 1).Unlike hydroxide, hydronium ions are not consumed, and so pH decreases throughout the electrochemical process [6].Increasing the applied potential to 7.5 and 10 V had no significant effect on final pH.Regarding EC and solid masses recovered, no significant influence from applied potential and treatment time was observed.Figure 2 presents the removals of orthophosphate, ammonium, and magnesium utilizing SW1 and BDD/SS electrodes combination.Although orthophosphate removal increases with treatment time, a loss of efficiency can be noticed between 4 and 8 h assays, especially at 10 V.This loss of efficiency is likely due to the decrease in ion concentration.Ammonium removal was the most affected by the increase in the applied potential.In general, ammonium removal can be related to oxidation (Equations ( 1)-( 3)), precipitation (Equation (4)), or evolution (Equation ( 5)) [57,58].Since no nitrite or nitrate were detected in the solution at 10 V, Equations ( 2) and (3) are not likely.Also, ammonia evolution (Equation ( 5)) should not occur due to the low pH.For ammonium to be removed as struvite, an equimolar removal of magnesium, ammonium, and phosphate is required [6], which did not occur.So, although a fraction of ammonium removal could be due to struvite precipitation, the main mechanism, specially at 10 V, was probably ammonium oxidation to atmospheric nitrogen (Equation ( 1)).
At 5 V, magnesium and phosphorus removal was higher than that of ammonium, indicating that, although a small percentage of the solids could be struvite, the main compound produced was probably magnesium phosphate.Both magnesium and phosphate removal increased with treatment time at 5 V, and their removal at 5 V at 8 h is similar to that at 10 V at 4 h and 10 V at 8 h.Therefore, increasing the potential to 7.5 or 10 V has no positive effect on recovery.The increase in potential led to the ammonium oxidation to gaseous nitrogen forms and did not enhance magnesium or phosphate removal.These data suggest that 5 V-8 h are the best experimental conditions for this system.

Influence of Carbonate
The influence of the carbonate ion on the formation of the solid phase was evaluated by comparing the results from SW1 in MMO/SS system with the results from SW2 in the two systems, MMO/SS and BDD/SS.The performance of MMO and BDD was also compared.As BDD is an expensive material, which can hinder its application in industrialscale processes [59], it was intended to evaluate the replacement of BDD by other materials, like MMO.All the assays were carried out at an applied potential of 5 V and with a treatment time of 8 h. Figure 3 presents the main results obtained.A similar performance between BDD/SS and MMO/SS can be observed, indicating that MMO can replace BDD under the experimental conditions studied, without loss of process efficiency.The presence of carbonate allowed higher removal levels of ammonium, magnesium, and orthophosphate ions, particularly magnesium, probably due to the formation of magnesium carbonate (Figure 3a).The higher precipitated mass obtained with SW2 was possibly related to higher magnesium removal (Figure 3b).SW2 presented higher removals than SW1 for ammonium, magnesium, and orthophosphate, which could be due to the higher initial SW2 pH, which was around 7 due to At 5 V, magnesium and phosphorus removal was higher than that of ammonium, indicating that, although a small percentage of the solids could be struvite, the main compound produced was probably magnesium phosphate.Both magnesium and phosphate removal increased with treatment time at 5 V, and their removal at 5 V at 8 h is similar to that at 10 V at 4 h and 10 V at 8 h.Therefore, increasing the potential to 7.5 or 10 V has no positive effect on recovery.The increase in potential led to the ammonium oxidation to gaseous nitrogen forms and did not enhance magnesium or phosphate removal.These data suggest that 5 V-8 h are the best experimental conditions for this system.

Influence of Carbonate
The influence of the carbonate ion on the formation of the solid phase was evaluated by comparing the results from SW1 in MMO/SS system with the results from SW2 in the two systems, MMO/SS and BDD/SS.The performance of MMO and BDD was also compared.As BDD is an expensive material, which can hinder its application in industrial-scale processes [59], it was intended to evaluate the replacement of BDD by other materials, like MMO.All the assays were carried out at an applied potential of 5 V and with a treatment time of 8 h. Figure 3 presents the main results obtained.A similar performance between BDD/SS and MMO/SS can be observed, indicating that MMO can replace BDD under the experimental conditions studied, without loss of process efficiency.The presence of carbonate allowed higher removal levels of ammonium, magnesium, and orthophosphate ions, particularly magnesium, probably due to the formation of magnesium carbonate (Figure 3a).The higher precipitated mass obtained with SW2 was possibly related to higher magnesium removal (Figure 3b).SW2 presented higher removals than SW1 for ammonium, magnesium, and orthophosphate, which could be due to the higher initial SW2 pH, which was around 7 due to the presence of the carbonate ion.The precipitation of solids occurs in the vicinity of the cathode, where pH has high values due to the hydroxide ion formation (Figure 1).The constancy of the high pH near the cathode is favored by higher pH at the bulk, which benefits from the presence of carbonate [40].
the presence of the carbonate ion.The precipitation of solids occurs in the vicinity of the cathode, where pH has high values due to the hydroxide ion formation (Figure 1).The constancy of the high pH near the cathode is favored by higher pH at the bulk, which benefits from the presence of carbonate [40].

Influence of Magnesium Electrodes
Phosphorus recovery in SW2 (with magnesium in its composition) in the MMO/SS system (8 h) was compared to that in SW3 (without magnesium in its composition) using a Mg consumable anode and a SS cathode (2 h).Applied potential was 5 V for both systems.Results are presented in Figure 4. Orthophosphate was completely removed after 2 h in the Mg/SS system.Regarding ammonium removal, although it looks similar for both systems, with Mg/SS it was achieved in a quarter of MMO/SS treatment time.These results indicate that magnesium release in solution enhances the removal of both orthophosphate and nitrogen.When the adhered and suspended masses are analyzed, the difference between MMO/SS and Mg/SS systems is even more pronounced, showing the high ability of the Mg/SS system to form precipitates.Even if struvite was not obtained, which will be further discussed, different solid compounds could be formed by the association of magnesium, ammonium, and other ions like phosphate or hydroxide [46,49].
Figure 5 presents the evolution with time of the different parameters monitored during the assays performed with Mg/SS system.From the ions monitored, orthophosphate presented the highest removal rate (92% removal in the first 10 min).Since ammonium removal is slower and struvite precipitation requires the equimolar removal of ammonium and orthophosphate [6], it can be inferred that struvite is not the main compound of the solid obtained in these conditions.Magnesium concentration in solution, of up to 20

Influence of Magnesium Electrodes
Phosphorus recovery in SW2 (with magnesium in its composition) in the MMO/SS system (8 h) was compared to that in SW3 (without magnesium in its composition) using a Mg consumable anode and a SS cathode (2 h).Applied potential was 5 V for both systems.Results are presented in Figure 4.
the presence of the carbonate ion.The precipitation of solids occurs in the vicinity of the cathode, where pH has high values due to the hydroxide ion formation (Figure 1).The constancy of the high pH near the cathode is favored by higher pH at the bulk, which benefits from the presence of carbonate [40].

Influence of Magnesium Electrodes
Phosphorus recovery in SW2 (with magnesium in its composition) in the MMO/SS system (8 h) was compared to that in SW3 (without magnesium in its composition) using a Mg consumable anode and a SS cathode (2 h).Applied potential was 5 V for both systems.Results are presented in Figure 4. Orthophosphate was completely removed after 2 h in the Mg/SS system.Regarding ammonium removal, although it looks similar for both systems, with Mg/SS it was achieved in a quarter of MMO/SS treatment time.These results indicate that magnesium release in solution enhances the removal of both orthophosphate and nitrogen.When the adhered and suspended masses are analyzed, the difference between MMO/SS and Mg/SS systems is even more pronounced, showing the high ability of the Mg/SS system to form precipitates.Even if struvite was not obtained, which will be further discussed, different solid compounds could be formed by the association of magnesium, ammonium, and other ions like phosphate or hydroxide [46,49].
Figure 5 presents the evolution with time of the different parameters monitored during the assays performed with Mg/SS system.From the ions monitored, orthophosphate presented the highest removal rate (92% removal in the first 10 min).Since ammonium removal is slower and struvite precipitation requires the equimolar removal of ammonium and orthophosphate [6], it can be inferred that struvite is not the main compound of the solid obtained in these conditions.Magnesium concentration in solution, of up to 20 Orthophosphate was completely removed after 2 h in the Mg/SS system.Regarding ammonium removal, although it looks similar for both systems, with Mg/SS it was achieved in a quarter of MMO/SS treatment time.These results indicate that magnesium release in solution enhances the removal of both orthophosphate and nitrogen.When the adhered and suspended masses are analyzed, the difference between MMO/SS and Mg/SS systems is even more pronounced, showing the high ability of the Mg/SS system to form precipitates.Even if struvite was not obtained, which will be further discussed, different solid compounds could be formed by the association of magnesium, ammonium, and other ions like phosphate or hydroxide [46,49].
Figure 5 presents the evolution with time of the different parameters monitored during the assays performed with Mg/SS system.From the ions monitored, orthophosphate presented the highest removal rate (92% removal in the first 10 min).Since ammonium removal is slower and struvite precipitation requires the equimolar removal of ammonium and orthophosphate [6], it can be inferred that struvite is not the main compound of the solid obtained in these conditions.Magnesium concentration in solution, of up to 20 mg L −1 approximately, is in accordance with a precipitation-dissolution mechanism, as described in the literature [60].
As the collection of the precipitate is one of the main challenges of the electrochemical recovery of phosphorus [6], operational conditions that favor a higher fraction of precipitate in suspension should be sought.Figure 5b shows the evolution of both adhered and suspended mass during the Mg/SS assays, as well as the fraction of suspended solids.After 10 min of the assay, the fraction of suspended solids was above 95%, decaying to 69% after 30 min, and was below 50% after 2 h.These results, together with those of the magnesium and orthophosphate evolution (Figure 5a), suggest that 30 min is the optimal assay duration under the experimental conditions studied.mg L −1 approximately, is in accordance with a precipitation-dissolution mechanism, as described in the literature [60].
As the collection of the precipitate is one of the main challenges of the electrochemical recovery of phosphorous [6], operational conditions that favor a higher fraction of precipitate in suspension should be sought.Figure 5b shows the evolution of both adhered and suspended mass during the Mg/SS assays, as well as the fraction of suspended solids.After 10 min of the assay, the fraction of suspended solids was above 95%, decaying to 69% after 30 min, and was below 50% after 2 h.These results, together with those of the magnesium and orthophosphate evolution (Figure 5a), suggest that 30 min is the optimal assay duration under the experimental conditions studied. Figure 5c shows a strong increase in pH and a decrease in conductivity in the first 10 min of experiment.When the magnesium consumable electrode is oxidized, producing magnesium ions, it potentiates the formation of hydroxide ions, which increases the pH [49].Simultaneously, phosphate in solution reacts with magnesium precipitate [49].Ionic molar conductivities for hydroxide and phosphate are 198 and 278 cm 2 S mol −1 , respectively [61].In the first 10 min, pH changes from 7 to 11.5, i.e., hydroxide concentration increases 3.16 mM, while phosphate concentration decreases 3.54 mM (from Figure 5a).Therefore, phosphorus precipitation has a stronger effect in conductivity than hydroxide release, which explains the initial decrease.After the first 10 min, the release of hydroxide and magnesium into the solution continues.Some of them precipitate, but some of the fraction remains in solution, explaining the continuous increase in both pH and conductivity.

Influence of Organic Phosphorus
Since the Mg/SS system showed the best results of all the systems utilized, it was chosen to evaluate the feasibility of glyphosate degradation.The wastewater used was SW4, in which organic phosphorus (glyphosate) represents 10% of total phosphorus.The applied potential was 5 V and the treatment time was 1 h. Figure 6 shows the removal of Figure 5c shows a strong increase in pH and a decrease in conductivity in the first 10 min of experiment.When the magnesium consumable electrode is oxidized, producing magnesium ions, it potentiates the formation of hydroxide ions, which increases the pH [49].Simultaneously, phosphate in solution reacts with magnesium to precipitate [49].Ionic molar conductivities for hydroxide and phosphate are 198 and 278 cm 2 S mol −1 , respectively [61].In the first 10 min, pH changes from 7 to 11.5, i.e., hydroxide concentration increases 3.16 mM, while phosphate concentration decreases 3.54 mM (from Figure 5a).Therefore, phosphorus precipitation has a stronger effect in conductivity than hydroxide release, which explains the initial decrease.After the first 10 min, the release of hydroxide and magnesium into the solution continues.Some of them precipitate, but some of the fraction remains in solution, explaining the continuous increase in both pH and conductivity.

Influence of Organic Phosphorus
Since the Mg/SS system showed the best results of all the systems utilized, it was chosen to evaluate the feasibility of glyphosate degradation.The wastewater used was SW4, in which organic phosphorus (glyphosate) represents 10% of total phosphorus.The applied potential was 5 V and the treatment time was 1 h. Figure 6 shows the removal of orthophosphate and organic phosphorus, the mass of solids obtained, and the variation in pH and conductivity.Orthophosphate removal was above 95% and organic phosphorus removal reached 82%, which shows that this system is able to remove both inorganic and organic phosphorus.Also, the fraction of suspended solids after 1 h was above 50% (Figure 6b), indicating that the presence of organic phosphorus does not affect this parameter.The pH and electrical conductivity (Figure 6c) presented a similar behavior to the system without organic phosphorus (Figure 5c). in pH and conductivity.Orthophosphate removal was above 95% and organic phosphorus removal reached 82%, which shows that this system is able to remove both inorganic and organic phosphorus.Also, the fraction of suspended solids after 1 h was above 50% (Figure 6b), indicating that the presence of organic phosphorus does not affect this parameter.The pH and electrical conductivity (Figure 6c) presented a similar behavior to the system without organic phosphorus (Figure 5c).

Effect of a Real Matrix
In the treatment of the sanitary landfill leachate, the Mg/SS system was used for an applied potential of 400 mV and a treatment time of 1 h.Since the real wastewater had a higher EC than the simulated wastewaters (21 vs. 1-2 mS cm −1 , respectively), the applied potential was significantly lower in order to maintain a similar current intensity between the assays.
After 1 h of the assay, an orthophosphate removal of 96% was obtained, indicating that the leachate complex matrix did not affect the orthophosphate removal.In contrast, the matrix strongly affected the relationship between adhered (171.6 mg) and suspended mass (868.2 mg), increasing the suspended fraction to 83%, which facilitates the collection of the precipitate, as has been previously observed.Figure 7 shows the real wastewater before and after the treatment.A COD removal of 22% was attained.Although it is not a remarkable removal, the treatment time was just 1 h.Since the objective was to recover phosphorus, it was not worth extending the treatment time to reach higher COD removal, as this can be performed in a secondary electrochemical treatment, without magnesium consumable anodes [62].

Effect of a Real Matrix
In the treatment of the sanitary landfill leachate, the Mg/SS system was used for an applied potential of 400 mV and a treatment time of 1 h.Since the real wastewater had a higher EC than the simulated wastewaters (21 vs. 1-2 mS cm −1 , respectively), the applied potential was significantly lower in order to maintain a similar current intensity between the assays.
After 1 h of the assay, an orthophosphate removal of 96% was obtained, indicating that the leachate complex matrix did not affect the orthophosphate removal.In contrast, the matrix strongly affected the relationship between adhered (171.6 mg) and suspended mass (868.2 mg), increasing the suspended fraction to 83%, which facilitates the collection of the precipitate, as has been previously observed.Figure 7 shows the real wastewater before and after the treatment.
in pH and conductivity.Orthophosphate removal was above 95% and organic phosphorus removal reached 82%, which shows that this system is able to remove both inorganic and organic phosphorus.Also, the fraction of suspended solids after 1 h was above 50% (Figure 6b), indicating that the presence of organic phosphorus does not affect this parameter.The pH and electrical conductivity (Figure 6c) presented a similar behavior to the system without organic phosphorus (Figure 5c).

Effect of a Real Matrix
In the treatment of the sanitary landfill leachate, the Mg/SS system was used for an applied potential of 400 mV and a treatment time of 1 h.Since the real wastewater had a higher EC than the simulated wastewaters (21 vs. 1-2 mS cm −1 , respectively), the applied potential was significantly lower in order to maintain a similar current intensity between the assays.
After 1 h of the assay, an orthophosphate removal of 96% was obtained, indicating that the leachate complex matrix did not affect the orthophosphate removal.In contrast, the matrix strongly affected the relationship between adhered (171.6 mg) and suspended mass (868.2 mg), increasing the suspended fraction to 83%, which facilitates the collection of the precipitate, as has been previously observed.Figure 7 shows the real wastewater before and after the treatment.A COD removal of 22% was attained.Although it is not a remarkable removal, the treatment time was just 1 h.Since the objective was to recover phosphorus, it was not worth extending the treatment time to reach higher COD removal, as this can be performed in a secondary electrochemical treatment, without magnesium consumable anodes [62].A COD removal of 22% was attained.Although it is not a remarkable removal, the treatment time was just 1 h.Since the objective was to recover phosphorus, it was not worth extending the treatment time to reach higher COD removal, as this can be performed in a secondary electrochemical treatment, without magnesium consumable anodes [62].
The current intensity behavior is presented in the Supplementary Materials (Figure S2).The integration of the graph of I vs. time results in 2.26 kC, which is the total electrical charge transferred to the system.Since the applied potential was 400 mV, the electrical energy transferred to the system, E, is given by Equation ( 6).
The mean phosphorus concentration drop was 105 mg L −1 , corresponding to the removal of a phosphorus mass of 10.5 mg (Equation ( 7)).Specific energy consumption (SEC) can thus be calculated regarding the mass of phosphorus removed (Equation ( 8)) and the volume of treated wastewater (Equation ( 9 Morrissey et al.
[63] reported a SEC of 4.6 kWh kg struvite −1 , corresponding to 36.4 kWh kgP −1 .Values between 2.2 and 4399 kWh kgP −1 are found in the literature, including in simulated and real wastewater treatment [21].The value obtained in the present study, 23.9 kWh kgP −1 , is among the lowest reported, probably due to the high conductivity of the sanitary landfill leachate, indicating that this technology is suitable for this kind of wastewater.This is especially important since energy cost is one of the key factors that still limits industrial-scale processes based on electrochemical phosphorus recovery [64].
The Faradaic efficiency (F Ef ) of the process can be calculated through the magnesium alloy consumption.The magnesium anode lost 150.8 mg during the treatment.Since the utilized alloy has 96% (w/w) of magnesium, 144.8 mg of magnesium were dissolved.The electrical charge (Q) required to dissolve this mass can be calculated through Equation (10), where z, F, and M w are the module of magnesium ion electrical charge, the Faraday constant, and the magnesium molecular weight, respectively.The Faradaic efficiency is given by Equation (11).
The Faradaic efficiency can be enhanced by improving the selectivity of the treatment, which means finding the optimal conditions (i.e., applied potential or current intensity) that allow phosphorus recovery and avoid side reactions.This should be the focus of future research on electrochemical phosphorus recovery from wastewater with magnesium anodes.

Analysis of the Obtained Solids
To evaluate the influence of the organic phosphorus and of the anode material in the composition of the solid phase, and the solids produced in the experiments performed with SW3 (Mg/SS; 5 V), SW4 (Mg/SS; 5 V), and SW5 (MMO/SS; 5 V) were analyzed using EDX and XRD (Figure 8 and Figure 9, respectively).The main component of these solid phases is magnesium, and, in general, there was no difference in the atomic percentage of the different elements between adhered and suspended fractions.
The magnesium percentage in the solid phase slightly increased with the use of magnesium electrodes, which results from the dissolution-precipitation mechanism that rules sacrificial anodes dynamics, as described above [60].The atomic percentage of phosphorus was lower when using magnesium anodes, although there was a significant difference in the masses obtained: 26.2 mg for SW5 in 8 h (2% suspended), 1154.3 mg for SW3 in 2 h (48% suspended), and 397.7 mg for SW4 in 1 h (54% suspended).Thus, even with a smaller atomic percentage, phosphorus-removed mass was higher when magnesium electrodes were used, allowing higher recovery rates.
phosphorus was lower when using magnesium anodes, although there was a significant difference in the masses obtained: 26.2 mg for SW5 in 8 h (2% suspended), 1154.3 mg for SW3 in 2 h (48% suspended), and 397.7 mg for SW4 in 1 h (54% suspended).Thus, even with a smaller atomic percentage, phosphorus-removed mass was higher when magnesium electrodes were used, allowing higher recovery rates.The presence of glyphosate slightly increased the carbon atomic percentage in the solids, either adhered or suspended, as can be seen when comparing SW3 and SW4, suggesting that this system is able to oxidize organic carbon and remove it as inorganic carbon.Since no other effect was observed, solids obtained from both assays should be similar.This is supported by XRD data, presented in Figure 9.When experimental diffractograms were compared to a spectra database, the major crystalline compounds identified were brucite (SW3/SW4) and struvite (SW5).Since phosphorus and nitrogen removal were detected by analyzing the wastewaters SW3/SW4, the solids produced with these elements phosphorus was lower when using magnesium anodes, although there was a significant difference in the masses obtained: 26.2 mg for SW5 in 8 h (2% suspended), 1154.3 mg for SW3 in 2 h (48% suspended), and 397.7 mg for SW4 in 1 h (54% suspended).Thus, even with a smaller atomic percentage, phosphorus-removed mass was higher when magnesium electrodes were used, allowing higher recovery rates.The presence of glyphosate slightly increased the carbon atomic percentage in the solids, either adhered or suspended, as can be seen when comparing SW3 and SW4, suggesting that this system is able to oxidize organic carbon and remove it as inorganic carbon.Since no other effect was observed, solids obtained from both assays should be similar.This is supported by XRD data, presented in Figure 9.When experimental diffractograms were compared to a spectra database, the major crystalline compounds identified were brucite (SW3/SW4) and struvite (SW5).Since phosphorus and nitrogen removal were detected by analyzing the wastewaters SW3/SW4, the solids produced with these elements The presence of glyphosate slightly increased the carbon atomic percentage in the solids, either adhered or suspended, as can be seen when comparing SW3 and SW4, suggesting that this system is able to oxidize organic carbon and remove it as inorganic carbon.Since no other effect was observed, solids obtained from both assays should be similar.This is supported by XRD data, presented in Figure 9.When experimental diffractograms were compared to a spectra database, the major crystalline compounds identified were brucite (SW3/SW4) and struvite (SW5).Since phosphorus and nitrogen removal were detected by analyzing the wastewaters SW3/SW4, the solids produced with these elements seem to be amorphous.Also, ammonium simple salts are soluble.Thus, the association of phosphate and ammonium requires other ion(s), like magnesium, to precipitate [61], which can form amorphous struvite.Nevertheless, as previously demonstrated in the literature, amorphous struvite is capable of recrystallizing when in contact with a solution containing ammonium and phosphate [65].Therefore, most of the ammonium was probably oxidized to gaseous nitrogen (N 2 ), as a small fraction was precipitated as crystalline struvite.Phosphorus removal occurred mainly as amorphous magnesium phosphates.For SW5, most of the solids obtained seem to be amorphous, with a small percentage of crystalline struvite.Although further investigation is required, the use of magnesium electrodes seems to improve phosphorus recovery, even by producing phosphorus compounds other than struvite.
The brucite present in the obtained solids is probably due to the carbonate added in the simulated wastewaters.The solubility products (K SP ) for MgCO 3 and Mg(OH) 2 are, respectively, 3.5 × 10 −8 and 7.1 × 10 −12 [66], which means solubilities of 187 and 121 µM, respectively.Magnesium ions, released from the anode, can react with carbonate to produce MgCO 3 , which is then converted to Mg(OH) 2 , since it has lower solubility.All the mentioned salts (magnesium hydroxide, struvite, and magnesium phosphates) can be utilized as fertilizers [49,67].

Practical Implications of the Study
The objective of this work was to study phosphorus recovery from simulated and real wastewaters.Since this can reduce energetic costs in industry and avoid the eutrophication/pollution of waterbodies and the phosphate rock mining, this work is aligned with Goals 6, 12, 13, and 14 of The United Nations 2030 Sustainable Development Agenda (respectively, Clean Water and Sanitation, Responsible Consumption and Production, Climate Action, and Life Below Water) [68].
The analyzed parameters showed that phosphorus recovery during wastewater treatment is viable, even with real wastewater.Wastewater with organophosphorus compounds can also be treated, since it was demonstrated that anodic oxidation is a feasible way to convert them into orthophosphates that are readily precipitated.Although these studies may contribute to a more sustainable world, as they are recovery-based processes, they are scarce in the literature.
The electrode material was the most influent parameter, and the system with a stainless steel cathode and a magnesium alloy anode showed very good results, even when treating real wastewater.Also, MMO electrodes were able to replace BDD with the same performance in certain conditions.
The treatment process presented in this work had a specific energy consumption of 23.9 kWh kgP −1 , which is a low value when compared to most literature values.One of the by-products of this technology is H 2 [69], and its recovery should be considered in future research, since it is an important factor to improve treatment economic feasibility, especially for industrial-scale processes.Combining hydrogen production, wastewater treatment, and phosphorus recovery to produce fertilizers can be a priceless advantage for sustainable development in the coming years.

Figure 2 .
Figure 2. Removal of (a) orthophosphate, (b) ammonium, and (c) magnesium during the assays performed with different times and applied potentials using SW1 and BDD/SS electrodes.

Figure 2 .
Figure 2. Removal of (a) orthophosphate, (b) ammonium, and (c) magnesium during the assays performed with different times and applied potentials using SW1 and BDD/SS electrodes.

Figure 3 .
Figure 3. (a) Removals of ammonium, magnesium, and orthophosphate and (b) mass of solids formed during the assays performed at an applied potential of 5 V for 8 h, using different simulated wastewater samples and electrode materials.

Figure 4 .
Figure 4. Removal of (a) orthophosphate and ammonium and (b) mass of solids adhered and suspended during the assays performed with MMO/SS and Mg/SS systems, using SW2 and SW3, respectively, at an applied potential of 5 V.

Figure 3 .
Figure 3. (a) Removals of ammonium, magnesium, and orthophosphate and (b) mass of solids formed during the assays performed at an applied potential of 5 V for 8 h, using different simulated wastewater samples and electrode materials.

Figure 3 .
Figure 3. (a) Removals of ammonium, magnesium, and orthophosphate and (b) mass of solids formed during the assays performed at an applied potential of 5 V for 8 h, using different simulated wastewater samples and electrode materials.

Figure 4 .
Figure 4. Removal of (a) orthophosphate and ammonium and (b) mass of solids adhered and suspended during the assays performed with MMO/SS and Mg/SS systems, using SW2 and SW3, respectively, at an applied potential of 5 V.

Figure 4 .
Figure 4. Removal of (a) orthophosphate and ammonium and (b) mass of solids adhered and suspended during the assays performed with MMO/SS and Mg/SS systems, using SW2 and SW3, respectively, at an applied potential of 5 V.

Figure 6 .
Figure 6.(a) Removal of orthophosphate and organic phosphorus, (b) adhered and suspended mass, and (c) variations in pH and EC during the assay performed with SW4 and MG/SS system: applied potential-5 V; time-1 h.

Figure 6 .
Figure 6.(a) Removal of orthophosphate and organic phosphorus, (b) adhered and suspended mass, and (c) variations in pH and EC during the assay performed with SW4 and MG/SS system: applied potential-5 V; time-1 h.

Figure 6 .
Figure 6.(a) Removal of orthophosphate and organic phosphorus, (b) adhered and suspended mass, and (c) variations in pH and EC during the assay performed with SW4 and MG/SS system: applied potential-5 V; time-1 h.

Figure 8 .
Figure 8. Composition of the solids analyzed by EDX: A-adhered; S-suspended.

Figure 9 .
Figure 9. XRD data for the adhered solids.

Figure 8 .
Figure 8. Composition of the solids analyzed by EDX: A-adhered; S-suspended.

Figure 8 .
Figure 8. Composition of the solids analyzed by EDX: A-adhered; S-suspended.

Figure 9 .
Figure 9. XRD data for the adhered solids.

Figure 9 .
Figure 9. XRD data for the adhered solids.

Table 1 .
Composition and characterization of the simulated wastewater samples and sanitary landfill leachate.

Table 2 .
Characterization of the final samples collected in the assays performed with BDD/SS, using SW1. )