1 Introduction

Anaerobically digested dairy wastewater (ANDDW) contains various pollutants including nutrients, solid particles, and disease-causing microorganisms. If released without proper treatments, it can lead to detrimental environmental effects [1, 2]. Furthermore, with the increasing need for clean and safe water worldwide and the critical importance of human and environmental well-being, it is crucial to prioritize the treatment of highly contaminated ANDDW [3,4,5,6,7].

Considering the above, there are many technologies already applied to treat dairy waste streams to remove contaminants. The management of dairy wastewater entails the utilization of both physicochemical and biological treatment methods either as a stand-alone process or in combination [8]. Physicochemical techniques encompass the use of membrane technologies [9], coagulation-flocculation [10], vacuum thermal stripping [11], and similar approaches [12], while biological processes involve anaerobic digestion [13], activated sludge process [14,15,16], lagoons [17], sequencing batch reactors (SBRs) [18,19,20], and upflow anaerobic sludge blankets (UASB) [21]. Although biological treatment methods are commonly employed for dairy wastewater treatment [8, 20, 22], the biological treatment processes generate large amounts of sludge which further incurs substantial costs for sludge disposal and treatment. It also requires extended hydraulic retention times and is susceptible to sudden influxes of waste [23, 24]. Additionally, the effluent from biological treatment may contain harmful microorganisms, necessitating disinfection for safe reuse. While membrane bioreactors have gained attention for nutrient recovery, traditional membranes face limitations in dairy wastewater treatment due to issues like poor nutrient removal from excessive aeration and significant membrane fouling [9, 25]. To mitigate these challenges, researchers propose combining membrane bioreactors with advanced oxidation techniques like ozone, electrochemical oxidation, and ultrasound [26, 27]. Therefore, there is a growing interest in finding user-friendly processes like electrochemical approaches for efficient treatment and reuse of ANDDW.

Among different electrochemical treatment processes, electrocoagulation (EC) is most commonly used to treat dairy wastewater [28]. Several studies have been conducted to treat dairy wastewater using the EC process where aluminum (Al) and iron (Fe) made electrodes are used as anode and cathode materials [29,30,31]. However, there are some issues identified for the EC process including decay of electrode materials, sludge generation, replacement of electrodes, increase in operational costs [28, 32].

To overcome these drawbacks, the electrochemical oxidation (EO) process could be used to treat dairy effluents which employs two distinct mechanisms [33, 34]. The initial process involves direct anodic oxidation, wherein contaminants migrate from the bulk solution to the anode surface and are subsequently eradicated through direct charge transfer. In the alternate mechanism, known as indirect reaction, a mediator is introduced, and an oxidant is generated through electrochemical means to facilitate oxidation within the liquid [35, 36]. It is worth noting that both pathways can operate simultaneously during the oxidation process [37]. The necessary equipment and procedures are generally straightforward and cost-effective [38]. However, there are various factors such as reactor design and experimental conditions including the choice of electrode material, current density, flow dynamics, pH level, and the presence of mediators need to be considered during the EO process to maximize efficiency [39,40,41]. The electrochemical oxidation process is adaptable and robust, allowing for the treatment of various pollutants and different wastewater volumes [42,43,44]. Additionally, the reaction can be swiftly stopped by terminating the energy supply and resumed again easily in case of operational issues [39]. Unlike incineration and supercritical oxidation systems, EO does not require high temperatures and pressures. Furthermore, it can be conveniently automated as the electrical parameters are user-friendly for data collection, process automation, and control [45,46,47,48].

Recent advancements in electrochemical engineering have highlighted the critical role of anode materials in shaping the outcomes of electrochemical reactions and improving pollutant removal efficiencies in wastewater treatment [1, 49]. Notably, materials like carbon, graphite, various metals, and metal oxides have been increasingly utilized in this field. Among these options, metal oxides stand out as the most widely employed due to their impressive catalytic performance [50,51,52]. Typically, metal oxide anodes are created by depositing a thin layer of metal oxides onto substrates like titanium, gold, platinum, or stainless steel. This thin oxide layer is often fabricated using transition metals such as lead (Pb), ruthenium (Ru), iridium (Ir), and tin (Sn). Popular examples of metal oxide anodes include Ti/PbO2, Ti/SnO2, Ti/RuO2, and Ti/IrO2, which have found extensive applications [1, 47, 53,54,55]. Among the metal oxide electrodes, Ti/PbO2 possesses several advantages including excellent conductivity, a high oxygen evolution over potential, robust stability in acidic environments, and cost-effectiveness [49, 56].

Examining the feasibility of a wastewater treatment method is crucial, but the optimization of process parameters and design criteria is equally vital for predicting its economic viability and process performance during commercialization [57]. Regarding process optimization, the response surface methodology (RSM) is a widely accepted statistical approach using empirical models to enhance process performance effectively [58]. The primary goal of RSM is to fine-tune the response surface and establish the connection between input parameters and response variables. Two prominent approaches of RSM are central composite design (CCD) and box behnken design (BBD). The CCD offers better exploration near the center of the design space and greater flexibility in adapting to various experimental scenarios compared to BBD. Additionally, CCD is rotatable, ensuring unbiased exploration in all directions within the design space [59,60,61].

To the best of our knowledge, no studies have been conducted on removal of different pollutants from ANDDW using the EO process. Therefore, this study aimed to remove contaminants including chemical oxygen demand (COD), ammonia nitrogen (NH3–N), total phosphorus (TP), orthophosphate (OP), total nitrogen (TN), and total Kjeldahl nitrogen (TKN) from ANDDW employing the EO process. To determine the optimal removal of pollutants, a RSM-based CCD model has been applied by considering four independent variables, i.e., current density, electrolyte concentration, treatment time, and mixing speed. Moreover, a kinetic model was also introduced to understand the degradation rate of contaminants during electrochemical treatment of ANDDW.

2 Materials and methods

2.1 Sampling and characterization of wastewater

ANDDW was collected from a local dairy farm in Southern Idaho, USA. The liquid manure was stored at 4 °C before use in experiments. The characterization of the collected sample is shown in Table 1.

Table 1 Characteristics of the collected sample

2.2 Experimental setup

A batch mode electrochemical reactor was constructed for this study (Fig. 1). A lead dioxide (PbO2) coated titanium (Ti) mesh type electrode (anode) and a stainless steel (SS, cathode) were positioned in a 600 mL glass beaker for electrolysis of 400 mL sample. The dimensions of both anode and cathode were 10 cm × 6 cm × 0.3 cm with an effective surface area of 24 cm2. The gap between the anode and cathode was kept at 2 cm and a DC power supply system (Dr. Meter, PS-305DM, China) was used to supply electricity to the electrodes. Then, the beaker was placed on a magnetic stirrer to maintain sample homogeneity during the treatment. At the time of each run, NaCl was added to increase electrolyte concentration. The electrodes were washed with deionized water after finishing each experiment and kept at room temperatures for drying [62]. All experiments were conducted at room temperatures (25 ± 1 °C).

Fig. 1
figure 1

Design of the lab scale electrochemical reactor

2.3 Experimental design and model development

A four-factor, five-level CCD based RSM was used to determine the effects of four independent parameters (i.e., current density, electrolyte concentration, treatment time, and mixing speed) on the removal of COD, NH3–N, TP, OP, TN, and TKN as responses. The independent parameters were chosen based on former research [1, 2, 43, 50]. The independent factors and their levels are represented in Table 2. Design expert software package version 13.0.5 (Stat-Ease, Inc. Minneapolis, MN, USA) was used to analyze the data. The CCD serves as a reliable experimental framework that showcases how independent variables interact with each other with a minimal number of experiments together with creating a quadratic surface model [63]. Additionally, CCD-driven experimental methods furnish the necessary data to assess the model's lack of fit, meanwhile conducting an appropriate number of trials. Furthermore, this experimental design aids in grasping fundamental concepts like orthogonal blocking and rotatability, which are crucial elements in the optimization of processes [12]. The following Eq. (1) was used to determine the number of experiments in a CCD [64].

$$N={2}^{k}+2k+c$$
(1)

where N stands for the total number of experiments, k indicates the total number of independent variables, and c denotes the total number of central points. This exhibits four variables, a total of 30 runs which includes 16 factorials, 8 axial, and 6 central points. The central points within an experimental design play a crucial role in assessing experimental errors [59]. All the experiments were performed in triplicate, and the resulting data means were employed in the data analysis process. To predict the relationship between independent and response variables, a second-order polynomial model was developed. The model is represented in Eq. (2).

$$Y={\beta }_{o}+{\beta }_{1}A+{\beta }_{2}B+{\beta }_{3}C+{\beta }_{4}D+{\beta }_{12}AB+{\beta }_{13}AC+{\beta }_{14}AD+{\beta }_{23}BC+{\beta }_{24}BD+{\beta }_{34}CD+{\beta }_{11}{A}^{2}+ {\beta }_{22}{B}^{2}+{\beta }_{33}{C}^{2}+{\beta }_{44}{D}^{2}$$
(2)

where, \({\upbeta }_{{\text{o}}}\) signifies intercept, \({\upbeta }_{1}\), \({\upbeta }_{2}\), \({\upbeta }_{3}\), and \({\upbeta }_{4}\) represent linear coefficients, \({\upbeta }_{12}\), \({\upbeta }_{13}\), \({\upbeta }_{14}\), \({\upbeta }_{23}\), \({\upbeta }_{24}\), and \({\upbeta }_{34}\) denote the interaction coefficients, and \({\upbeta }_{11}\), \({\upbeta }_{22}\), \({\upbeta }_{33}\), and \({\upbeta }_{44}\) depict the quadratic coefficients, respectively. Y indicates the predicted response (COD, NH3-N, TP, OP, TN, and TKN), and A, B, C, and D exhibit independent variables (current density, electrolyte concentration, treatment time, and mixing speed). Analysis of variance (ANOVA) was used to analyze experimental data and model terms were assessed by the p-value of 95% confidence level. Contour plots of the response surface were utilized to illustrate interrelation between the independent parameters and their influence on the desired outcome.

Table 2 Independent parameters and their levels used in CCD design

2.4 Kinetic modeling

The selected approach was further explored through a kinetic analysis to ascertain the degree of nutrient decrease achieved during the procedure. In this research, the elimination rates of COD, NH3–N, TP, OP, TN, and TKN were examined over time by employing a first-order kinetic model as shown in Eqs. (3), (4) [65].

$$-\frac{d\left[C\right]}{dt}=k[C]$$
(3)
$$ln\frac{{C}_{t}}{{C}_{0}}=-kt$$
(4)

where t is the treatment time (min), C0 and Ct are the initial and final concentrations (mg L−1), respectively, and k is the first-order kinetic coefficient (min−1).

2.5 Analytical methods

Before and after the EO treatment, 5 mL samples were withdrawn and COD, NH3–N, TP, OP, TN, and TKN concentrations were determined using a HACH spectrophotometer (DR 5000, Hach company CO, USA). For the determination of COD concentration, a COD reactor (HI 839800, HANNA, USA) was used following the digestion method (HACH 8000). A digestor (DRB 200, Hach, USA) was used to determine TP, TN, and TKN concentrations following the ascorbic acid method (Hach 10209), persulfate digestion method (Hach 10208), and simplified TKN method (Hach 10242), respectively. Moreover, the concentration of ammonia nitrogen (NH3-N), total solid (TS), total suspended solid (TSS), and total dissolved solid (TDS) of ANDDW were determined by the salicylate method (Hach 10031) and the APHA standard methods [66], respectively.

The removal efficiency of COD, NH3-N, TP, OP, TN, and TKN were determined via the following Eq. (5).

$$\mathrm{Removal Efficiency}\left(\mathrm{\%}\right)=\frac{({C}_{0}-{C}_{t})}{{C}_{0}} \times 100$$
(5)

where Co is the initial nutrient concentration (mg L−1), and Ct is the final nutrient concentration (mg L−1) at treatment time t.

3 Results and discussion

3.1 Statistical analysis and interpretation

In this study, pollutants removal (COD, NH3–N, TP, OP, TN, and TKN) from ANDDW by EO process under combined conditions of four operating parameters including current density, electrolyte concentration, treatment time, and mixing speed (Table 2) in batch mode was investigated. The following quadratic model Eqs. (611) were established to demonstrate the relationships among the independent variables and responses:

$$\begin{aligned} {\text{COD removal }}\left( \% \right) = & 72.22 + 3.50{\text{ A}} + 0.1288{\text{ B}} + 5.46{\text{ C}} - 0.9863{\text{ D}} + 0.3673{\text{ AB}} - 1.82{\text{ AC}} \\ + 0.8048{\text{ AD}} + 1.40\,{\text{BC}} - 1.75{\text{ BD}} - 1.20{\text{ CD}} - 2.64{\text{ A}}^2 - 1.15{\text{ B}}^2 - 2.56{\text{ C}}^2 \\ - 0.8099{\text{ D}}^2 \\ \end{aligned}$$
(6)
$$\begin{aligned} {\text{NH}}_3 - {\text{N removal }}\left( \% \right) = & 44.67 + 5.49{\text{ A}}-1.05{\text{ B}} + 9.55{\text{ C}}-3.11{\text{ D}} - 0.0223{\text{ AB}} + 0.1006{\text{ AC}} + \\ 0.3244{\text{ AD}} + 0.0931{\text{ BC}}-0.7890{\text{ BD}}-0.3361{\text{ CD}} + 0.1714{\text{ A}}^2 - \\ 0.5527{\text{B}}^2 + 0.3002{\text{ C}}^2 -0.1498{\text{ D}}^2 \\ \end{aligned}$$
(7)
$$\begin{aligned} {\text{TP removal }}\left( \% \right) = & 76.23 + 3.57{\text{ A}}-0.9099{\text{ B}} + 4.08{\text{ C}}-4.54{\text{ D}} + 0.2190{\text{ AB}}-0.1627{\text{ AC}} - \\ 0.1356{\text{ AD}} + 0.8519{\text{ BC}}-0.6735{\text{ BD}}-0.1102{\text{ CD}} + 0.0993{\text{ A}}^2 -0.6248 \\ {\text{B}}^2 - 0.0382{\text{ C}}^2 -0.2848{\text{ D}} \\ \end{aligned}$$
(8)
$$\begin{aligned} {\text{OP removal }}\left( \% \right) = & 74.14 + 3.84{\text{ A}}-0.0500{\text{ B}} + 3.41{\text{ C}}-4.13{\text{ D}} - 0.9362{\text{ AB}} + 0.0200{\text{ AC}} + \\ 0.4483{\text{ AD}} + 1.84{\text{ BC}} + 0.0917{\text{ BD}} - 1.30{\text{ CD}} + 0.5753{\text{ A}}^2 + 1.18{\text{ B}}^2 + \\ 1.41{\text{ C}}^2 + 1.61{\text{ D}}^2 \\ \end{aligned}$$
(9)
$$\begin{aligned} TN \, removal \, \left( \% \right) = & 49.57 + 7.48{\text{ A}} + 0.4640{\text{ B}} + 3.87{\text{ C}}--1.64{\text{ D}} + 0.9031{\text{ AB}}-2.30{\text{ AC}} \\ + 1.14{\text{ AD}} + 2.45{\text{ BC}}-3.08{\text{ BD}}-3.53{\text{ CD}} - 1.11{\text{ A}}^2 - 0.9616{\text{ B}}^2 - \\ 0.6620\,{\text{C}}^2 -0.9004{\text{ D}}^2 \\ \end{aligned}$$
(10)
$$\begin{aligned} {\text{TKN removal }}\left( \% \right) = & 50.76 + 8.78{\text{ A}} + 0.9349{\text{ B}} + 5.57{\text{ C}}-2.85{\text{ D}} + 2.21{\text{ AB}}-2.45{\text{ AC}} \\ + 0.5815{\text{ AD}} + 3.36{\text{ BC}}-4.89{\text{ BD}}-4.10{\text{ CD}}-0.0730{\text{ A}}^2 -0.3167{\text{ B}}^2 \\ + 0.0854{\text{ C}}^2 -0.3263{\text{ D}}^2 \\ \end{aligned}$$
(11)

The positive coefficients signified that the variables had a synergistic impact, whereas the negative coefficients denoted a counteractive influence between the variables. A higher coefficient value for each factor indicated the extent of its influence on a specific response variable [67]. According to the Eqs. (611), the coefficients reveal that the current density (A) and the treatment time (C), had a notably positive impact on pollutant removal. In contrast, mixing speed (D) showed a negative effect on contaminants removal. The electrolyte concentration (B) exhibited moderate impact on pollutants removal. In most cases, the interaction between electrolyte concentration and treatment time (BC) had a notable and beneficial linear influence on pollutants elimination. On the other hand, the interaction between treatment time and mixing speed (CD) resulted in adverse linear impacts on pollutants elimination. Some moderate positive interactive effects were found among current density and electrolyte concentration (AB), and current density and mixing speed (AD). Therefore, most influential parameters were identified as current density (A) and treatment time (C), whereas electrolyte concentration (B) and mixing speed (D) showed moderate or less influence on the response of different pollutants removal efficiency from ANDDW.

The predicted and experimental results for 30 runs by applying EO process to treat ANDDW are presented in Table 3. In each run, the variations of operating parameters resulted in different responses. The findings showed that the experimental and estimated outcomes were not significantly different, which was a positive sign to prove the precision of the experiment [11].

Table 3 Experimental and predicted values of operational factor

The analysis of variance (ANOVA) test was employed to assess the statistical significance of the ratio between the variation in mean squares attributed to regression and the residual error mean square [63]. In Tables 4, 5, 6, 7, 8, 9, ANOVA was used to assess the validity of the model developed for the removal of COD, NH3-N, TP, OP, TN, and TKN. These suggested that the Eqs. (611) accurately portrayed the connection between the response and the significant variables. Moreover, based on Tables 4, 5, 6, 7, 8, 9, it appeared that the Fisher (F) values for all regressions were notably elevated. The F-values for COD, NH3-N, TP, OP, TN, and TKN removal were 99.98, 72.20, 141.41, 322.08, 71.80, and 312.60, respectively. These substantial F values signified that significant portions of the response variations can be accounted by the regression equations. The corresponding p-value was utilized to determine if the magnitude of F signified statistical significance [59]. The p-value for each model was less than 0.05 which indicated the significancy of the selected model for individual response [51]. Observing the p-value from lack of fit is another way to judge a good model. In every response, the lack of fit (p-value) was greater than 0.05 that implied lack of fit was not significant relative to the pure error, which proposed that, with a confidence level of 95%, the quadratic model effectively accounted for the reduction of COD, NH3–N, TP, OP, and TKN through the EO process from ANDDW. Non-significant lack of fit is good for the model [68]. Therefore, for COD removal, the linear impact of coefficient A, C, and D, i.e., current density (p < 0.0001), treatment time (p < 0.0001), and mixing speed (p < 0.0001) were highly significant (Table 4). Likewise, within binary interactions, the combined impact of current density and treatment time (p < 0.0001), current density and mixing speed (p < 0.0077), electrolyte concentration and treatment time (p < 0.0001), electrolyte concentration and mixing speed (p < 0.0001), treatment time and mixing speed (p < 0.0003), and other quadratic terms (A2, B2, C2, D2) were also significant. This implies that even slight alterations in these variables will influence the efficiency of COD removal. Model terms with p-value exceeding 0.05 are deemed insignificant. Therefore, the effect of electrolyte concentration (p = 0.5559) and interaction of current density and electrolyte concentration (p = 0.1810) did not exert a significant influence on COD removal efficiency. In case of NH3-N removal, the four independent variables were found significant (p < 0.05) but other interactive effects were demonstrated insignificant (p > 0.05) (Table 5). Moved to TP removal, the individual impact of current density, electrolyte concentration, treatment time, mixing speed were strongly significant (p < 0.0001) and interactive effective of electrolyte concentration and treatment time, and electrolyte concentration and mixing speed were significant (p < 0.05) (Table 6). On the other hand, the interactive effect of current density and treatment time, current density and electrolyte concentration, current density and mixing speed, treatment time and mixing speed were identified as insignificant (p > 0.05). For OP removal, insignificant terms (p > 0.05) were found as electrolyte concentration, and interactive effect of current density and electrolyte concentration, and electrolyte concentration and mixing speed; except these all-other terms were significant (Table 7). For TN removal, apart from the effect of electrolyte concentration (p > 0.05), all remaining terms were significant (Table 8). However, only quadratic terms (A2, B2, C2, D2) have no significance (p > 0.05) on TKN elimination (Table 9).

Table 4 ANOVA results for COD removal
Table 5 ANOVA results for NH3-N removal
Table 6 ANOVA results for TP removal
Table 7 ANOVA results for OP removal
Table 8 ANOVA results for TN removal
Table 9 ANOVA results for TKN removal

The coefficient of determination (R2) illustrates the proportion of variation in the predicted response explained by the model. It is calculated as the ratio of the sum of squares regression (SSR) to the total sum of squares (SST). A higher R2 value, approaching 1, is preferred, and it should closely align with the adjusted R2 (Adj. R2). R2 serves as an indicator of the fitness of the second-order polynomial model, reflecting its quality [19, 51, 60]. According to the responds in this study, R2 values for all pollutants were close to 1, which indicated there was a strong connection between experimental and estimated findings [69]. The difference between predicted and adjusted R2 was less than 0.2 which indicated that the independent variables had good impact on pollutants removal. Bashir et al. [70] found that elevated R2 values indicate a strong agreement between the experimental data and the model estimations. Consequently, the high R2 values and their alignment with Adj. R2 values in this research emphasized substantial significance of the model.

The adequate precision (AP) value for individual response greater than 4 indicates the sufficient signal to navigate the design space [71]. In this research, the AP value in each case was greater than 4 indicating adequate signal to navigate the design space (Tables 4, 5, 6, 7, 8, 9). This suggests the presence of a substantial signal and strong predictive capacity of the model for forecasting the outcomes. Furthermore, the low coefficient of variation (CV) and standard deviation (SD) along with these AP values, collectively demonstrated that the experiments were characterized by high levels of accuracy and reliability [67]. A normal probability plot was used to determine if the residuals conform to a normal distribution; when they do, the points on the plot align along a straight line. When the data points on the plot are reasonably near this straight line, it suggests that the data follows an even distribution [72]. The distribution of normal probability and externally studentized residuals for COD, NH3-N, TP, OP, TN, and TKN are illustrated in Figs. 2a–f. The diagrams depict a pattern where the points form a straight line, indicating consistent variance and adherence to a normal distribution. The points align closely to an almost straight line, and it is not unusual to observe some scattered points in a normally distributed dataset [60]. Additionally, the effectiveness of the model can be assessed by examining predicted versus actual value plots [65]. Figures 3a–f illustrate a strong correlation between predicted and actual values, depicted as a linear distribution and validated the accuracy of the models in forecasting the elimination of these six contaminants.

Fig. 2
figure 2

Normal plots of residuals for the removal of a COD, b NH3-N, c TP, d OP, e TN, and f TKN

Fig. 3
figure 3

Actual vs predicted plots for a COD, b NH3-N, c TP, d OP, e TN, and f TKN removal by EO process

In general, the statistical analysis of the outcomes demonstrated that the polynomial quadratic models derived are effective in forecasting COD, NH3–N, TP, OP, TN and TKN removal from ANDDW through the application of EO process.

3.2 Effects of variables on COD, NH3–N, TP, OP, TN, and TKN removal efficiency

A 3-D surface plot illustrates the impact on responses concerning the interaction between independent variables [73, 74]. The independent variables chosen for representation in Figs. 4, 5, 6, 7, 8 were those exhibiting significant interaction coefficients (p-value < 0.05). Current density, treatment time, and electrolyte concentration played a substantial role in the elimination of each pollutant. Conversely, mixing speed exerted a lesser influence on nutrient removal. The findings revealed that either by increasing or decreasing the current density at a specific time, along with adjusting electrolyte concentration and/or mixing speed, the efficiency of pollutants removal from ANDDW could be enhanced. In the EO process, augmenting the applied current density reduced the required time to eliminate an equivalent quantity of contaminants at a specific mixing speed or NaCl dosage [43, 50].

Fig. 4
figure 4

3D surface plots for COD removal illustrating the effect of a current density and treatment time, b current density and mixing speed, c electrolyte concentration and mixing speed, d electrolyte concentration and treatment time, and e treatment time and mixing speed

Fig. 5
figure 5

3D surface plots for TP removal illustrating the effect of a electrolyte concentration and treatment time, and b electrolyte concentration and mixing speed

Fig. 6
figure 6

3D surface plots for OP removal illustrating the effect of a current density and mixing speed, b current density and electrolyte concentration, c treatment time and mixing speed, and d electrolyte concentration and treatment time

Fig. 7
figure 7

3D surface plots for TN removal illustrating the effect of a current density and electrolyte concentration, b current density and treatment time, c current density and mixing speed, d electrolyte concentration and treatment time, e electrolyte concentration and mixing speed, and f treatment time and mixing speed

Fig. 8
figure 8

3D surface plots for TKN removal illustrating the effect of a current density and electrolyte concentration, b current density and treatment time, c electrolyte concentration and treatment time, d electrolyte concentration and mixing speed, e current density and mixing speed, and f treatment time and mixing speed

The current density and treatment time showed a significant effect on the removal of pollutants from ANDDW by the EO process. A positive interaction is illustrated in Fig. 4a for COD elucidating a rise in removal efficiency from 70 to 75% with the increase of current density and treatment time from 60 to 90 mA cm−2 and 120 to 180 min, respectively. An increment of around 13% was observed in the case of TN removal (Fig. 7b) and around 17% for TKN removal (Fig. 8b). There were no significant interactions found between current density and treatment time for NH3–N, TP, and OP removal efficiencies (Tables 4, 5, 6, 7, 8, 9) (p > 0.05). In general, increasing current density and treatment time create favorable environment for better degradation of pollutants present in wastewater [75]. As evident from these illustrations, an escalation in current density and treatment time led to an augmentation in pollutants removal efficiencies, especially up to a current density of 90 mA cm−2. This phenomenon can be ascribed to the influence of elevated voltage and the deposition of metal hydroxides on the electrode surfaces [63, 76].

There was no significant interaction effect found between current density and electrolytic concentration for COD, NH3–N, and TP removal, respectively (p > 0.05). In the case of OP removal efficiency, up to 7% elevation was observed when current density was raised from 60 mA cm−2 to 90 mA cm−2, and NaCl concentration was changed from 0.04 to 0.08% (Fig. 6b). For TN and TKN, the removal increments were observed as 18% (Fig. 7a) and 23% (Fig. 8a), respectively.

Figure 4b shows around 73% COD removal happened with increasing current density from 60 to 90 mA cm−2 and decreasing mixing speed from 600 to 400 rpm. OP removal efficiency increased from 65.5% to 84% (Fig. 6a) and for TN removal found in the the range of 37 to 55% (Fig. 7c). Upto 62% TKN removal efficiency (Fig. 8e) was observed in this study. The interaction between electrolyte concentration and treatment time showed significant effects with an ascending trend on the removal of COD, TP, OP, TN, and TKN, respectively. The change of electrolyte concentration from 0.04 to 0.08% and treatment time from 120 to 180 min increased the removal of pollutants. Those changes were found with 76% in COD removal (Fig. 4d), 79% in TP removal (Fig. 5a), 82% in OP removal (Fig. 6d), 55% in TN removal (Fig. 7d), and 61% in TKN removal (Fig. 8c). As depicted in Figs. 4d, 7d, and 8c, the most effective duration for COD, TN, and TKN removal was found to be 180 min, with optimal electrolyte concentrations of 0.08%, which resulted in removal efficiencies of 76.98, 65.76, and 80.1% for COD, TN, and TKN, respectively. These changes might happen due to NaCl addition as an electrolyte which increased wastewater pH and ultimately accelerated pollutants removal from ANDDW [77].

In this study, the interaction between electrolyte concentration and mixing speed was found significant (p < 0.05) for COD, TP, TN, and TKN removal efficiencies (Tables 4, 5, 6, 7, 8, 9). Figure 4c illustrates around 73% removal for COD. Similarly, increases in removal efficiencies up to 79, 53, and 58% were observed for TP (Fig. 5b), TN (7e), and TKN (Fig. 8d), respectively. Figure 4e illustrates an COD removal from 63 to 77% happened by the interaction of the treatment time (from 120 to 180 min) and mixing speed (from 600 to 400 rpm). Furthermore, a significant increment of around 15, 10, and 15% was noticed in OP (Fig. 6d), TN (Fig. 7f), and TKN (Fig. 8f) removal, respectively. The homogeneity of the wastewater sample was maintained to improve pollutant removal efficiency by setting a specific mixing speed of the magnetic stirrer. Nevertheless, the impact of the mixing speed on the efficiency of pollutant removal was relatively minor when compared with other factors like current density, electrolyte concentration, and treatment time. Similar phenomena were also reported in other studies [43, 78].

The EO process involves the production of reactive species like hydroxyl radicals (⋅OH) and chlorinated active species such as Cl2, HOCl, and ClO, which accelerate contaminant oxidation (Eqs. 1214) [45]. Lower current density can limit the availability of reactive species, affecting pollutants removal efficiency.

$${\text{Cl}}_2 + {\text{H}}_2 {\text{O}} \to {\text{HOCl}} + {\text{H}}^+ + {\text{Cl}}^-$$
(12)
$${\text{HOCl}} \to {\text{H}}^+ + {\text{OCl}}^-$$
(13)
$${\text{Organics}} + {\text{OCl}}^- \to {\text{CO}}_2 + {\text{H}}_2 {\text{O}} + {\text{Cl}}^-$$
(14)

In highly acidic conditions, strong oxidants are generated, facilitating direct oxidation of contaminants. As pH increases, initially generated ⋅OH radicals transform into lower oxidation potential oxidants like H2O2 and HO2 (Eqs. 1516) [33, 61]. Alkaline conditions favor the dominance of chlorinated active species, leading to COD removal primarily through mediated oxidation. Increasing current density enhances oxidant production and consequently improves pollutants removal [39]. Addition of NaCl increases electrolyte concentration, indirectly enhancing pollutant removal through electrolysis-generated oxidants. Chloride compounds generated during electrolysis contribute to organic compound breakdown, especially when combined with hydroxyl radicals [37].

$${2} \cdot {\text{OH}} \to {\text{H}}_{2} {\text{O}}_{2}$$
(15)
$$\cdot {\text{OH}} + {\text{H}}_2 {\text{O}}_2 \to {\text{HO}}_2 \cdot + {\text{H}}_2 {\text{O}}$$
(16)

The conversion of ammonia into nitrate and nitrogen gas occurs during the EO process, primarily facilitated by electrogenerated hypochlorous acid. Neutral electrolyte conditions favor NH3–N removal efficiency due to oxidation into N2 gas (Eq. 17) [57].

$$2{\text{NH}}_4^+ + 3{\text{HClO}} \to {\text{N}}_2 + 3{\text{H}}_2 {\text{O}} + 5{\text{H}}^+ + 3{\text{Cl}}^-$$
(17)

3.3 Optimization and validation of the experimental conditions

To determine the most effective operational parameters for treating ANDDW through the EO process, a synchronized optimization approach was employed. This involved simultaneously fine-tuning multiple responses in terms of COD, NH3-N, TP, OP, TN, and TKN. Specifically, the values of process parameters such as current density (A), electrolyte concentration (B), treatment time (C), and mixing speed (D) were chosen within a specified range, with responses set to their maximum values. The optimized parameter values were determined as follows: A = 90 mA cm−2, B = 0.08%, C = 180 min, and D = 400 rpm, which resulted in an overall desirability score of 0.980. Under these optimized conditions, the predicted values for the removal efficiency of COD, NH3–N, TP, OP, TN, and TKN according to RSM-based CCD were 77.23, 62.50, 88.49, 91.93, 65.90, and 79.78%, respectively (Table 10). To validate the adequacy of the optimization, actual experiments were conducted in triplicate, and the average values for responses COD, NH3-N, TP, OP, TN, and TKN at the optimum condition were measured as 78.36, 63.93, 87.41, 92.39, 67.01, and 81.42%, respectively. The experimental values were very close to the predicted values and within the range of 95% confidence interval (CI) (Table 10). This demonstrated a strong correlation between experimental results and predicted values, affirming the reliability of the modeling using RSM and CCD [11].

Table 10 Experimental and predicted values under optimum conditions for model validation

3.4 Reaction kinetics model

The experimental data under the optimal conditions were tested to assess its compatibility with both first and second-order kinetic models. It was observed that the second-order model did not provide as good a fit as the first-order kinetic model. In a batch reaction, the rate expression is formulated based on the initial rate of pollutant removal, particularly when the reaction environment is intricate [79]. Hence, this research employed a streamlined integral method, assuming that a kinetic model can be characterized in relation to the concentration of the pollutants [77]. The reaction kinetics of different pollutants in terms of COD, NH3–N, TP, OP, TN, and TKN at optimum operating conditions are illustrated in Fig. 9. There were distinctive reaction rates for different pollutant removals (Table 11), which followed the first-order kinetic reaction model. The reaction rate of each contaminant was determined at a 30-min time interval based on validation experiment results. The residual concentrations of COD, NH3–N, TP, OP, TN, and TKN followed straight lines under the circumstances investigated, as shown in Fig. 9. The reaction rate (k) and coefficient of determination (R2) values are presented in Table 11. The maximum and minimum degradation rates were found to be 0.0206 min−1 and 0.0073 min−1 for OP and NH3-N removal, respectively.

Fig. 9
figure 9

First-order kinetic model at optimal condition for nutrients removal from ANDDW

Table 11 Reaction rate (k) and coefficient of determination (R2) values for different responses at 90 mA cm−2 current density, 0.08% electrolyte concentration, 180 min treatment time and 400 rpm mixing speed

The lower degradation rate of NH3-N compared to phosphorus can be attributed to several factors. Firstly, the presence of phosphate negatively affected ammonia removal due to the occurrence of oxygen evolution [80]. This led to a sustained low removal rate of NH3–N when substantial phosphate concentrations were presented in the reactor. However, once the majority of the OP was eliminated, the removal of NH3-N reached higher levels [81]. Secondly, the extended detention time needed for effective ammonia removal may be attributed to the slower reaction rate between ammonia and HOCl [81]. Thirdly, phosphate allowed more electric current to flow compared to Cl because it has a higher electric charge. This led to a decrease in the production of HOCl, which in turn slowed down the process of oxidizing ammonia by HOCl [80, 81]. However, it was clear that R2 values for all contaminants were near to unity (Table 11). This confirmed the first-order kinetic model was a good fit to remove COD, NH3–N, TP, OP, TN, and TKN from ANDDW.

4 Conclusions

The optimization of ANDDW treatment utilizing the EO method with Ti/PbO2 and stainless-steel electrodes was performed in this study. The optimal values for the process parameters were determined to be current density of 90 mA cm−2, electrolyte concentration of 0.08%, treatment time of 180 min, and mixing speed of 400 rpm. Experimental trials conducted under these optimal conditions yielded removal efficiencies of 78.36, 63.93, 87.41, 92.39, 67.01, and 81.42% for COD, NH3–N, TP, OP, TN, and TKN, respectively. The ANOVA analysis revealed that current density and treatment time had the most significant effect, whereas electrolyte concentration and mixing speed exhibited less effect on pollutants removal from ANDDW. The correlation within the model suggested that employing a second-order polynomial model could be beneficial for optimizing the EO treatment process. Additionally, the rate of reaction constant was determined using a first-order kinetic model for the removal of COD, NH3–N, TP, OP, TN, and TKN. The model accuracy was confirmed through high values of R2 (close to 1). The findings of this research demonstrated that the EO process can be used to remove pollutants efficiently from ANDDW.