Introduction

Oil is a vital economic resource for many nations due to the wide range of industries that rely on it and its byproducts. This includes the petrochemical and oil refining sectors (AlJaberi et al., 2020). During oil production, vast quantities of oily wastewater are discharged (Hassan et al., 2018). Oily wastewater from drilling sites, refineries, and petrochemical plants degrade the environment (Changmai et al., 2019). Releasing untreated or partially treated wastewater from petroleum refineries has adverse effects on the environment and wildlife, including contamination of amphibian biological systems, unwanted ecological difficulties, expensive effluent treatment, and a scarcity of farmland and fish (Mustapha, 2018). Oily wastewater treatment and reuse are crucial to the environmentally sustainable management of oil-producing zones and the economic growth of the petrochemical sector (Mohammed & AlJaberi, 2021;Yang et al., 2021).

Biochemical oxygen demand (BOD), total suspended solids (TSS), chemical oxygen demand (COD), total organic carbon (TOC), total dissolved solids (TDS), turbidity (TUR), ammonia, cyanide, and heavy metals are all examples of organic and inorganic components found in crude oil there is a wide range of oil concentrations in wastewater, from 1 to 40,000 parts per million, which is discharged annually in the form of billions of cubic meters (Ahmed et al., 2020). Thus, oily wastewater drained into the ocean is the primary cause of ecological damage to the ocean (Changmai et al., 2019). There is between 0.4 and 0.6% oily wastewater in crude oil (Jiang et al., 2019). The resources, shapes, consequences, and remedial advantages of oily wastewater are depicted in Fig. 1 (Mokif et al., 2022).

Fig. 1
figure 1

General diagram for oily wastewater sources, effects, physical forms, and advantages of remediation

Human health can be negatively impacted by oily wastewater because it is difficult to degrade. Therefore, different effluent sources require different treatments based on the amount and type of emulsified oily waste (Jabbar et al., 2020). This objective is treatable by cyclone separation, sorption, chemical precipitation, and electrochemical methods (Cheng & Gong, 2018). Removal capacity, treatment interaction time, optional pollutants created, building cost, and unit operation/maintenance determine the success of the applied procedures. Because of the growing expansion of industry and human requirements, a clever COD reduction method from wastewater and freshwater reuse is required (Ghanbari & Moradi, 2016). Wastewater discharge standard limit (COD < 100 mg/l) (Jain & Singh, 2003).

Electrochemical techniques such as electro-oxidation, electro-floatation, and electro-Fenton are extensively employed to treat many types of wastewater due to their ease of automation and application (AlJaberi, 2018). Electrocoagulation (EC) is a good way to clean oily wastewater deeply with electrochemical treatment. Redox processes are utilized in EC and occur when an electric current is transmitted between electrodes, which are often made of aluminum or iron. The cathode is the reduced electrode, and the anode is the oxidized one. As shown schematically in Fig. 2, aluminum cations (Al+3) released as a result of anode degeneracy create electro-coagulants (Al(OH)3). Both hydrogen gas (H2) and hydroxyl ions (OH) are generated at the cathode of an EC cell (Al-Zuheri & Mohammed, 2018; Almukdad et al., 2021).

Fig. 2
figure 2

Schematic illustration of a fundamental EC cell

The rate of organic and inorganic pollutant removal is strongly dependent on the amount of metal (electrode dissolve) that increases the electrocoagulation process’s overall treatment efficacy. Anode disintegration increases metal cation concentrations, such as Al3+ or Fe2+, whereas the cathode generates hydrogen gas (H2) and hydroxyl ions (OH) (Barzega et al., 2019; Papadopoulos et al., 2019). Different ions produced at both electrodes form electro-coagulants, which remove pollutants via adsorption without chemical additives (de Carvallho et al., 2015). Electro coagulants, such as Al(OH)3, are produced by chemical interactions between different ions (Eqs. 15) (AlJaberi et al., 2020).

$$\mathrm{Al_{(s)}\Rightarrow Al^{3+}_{(aq)}+3_e-}$$
(1)
$$\mathrm{2H_2O\Rightarrow O_2+4H^+ +4e^-}$$
(2)
$$\mathrm{2H_2O+2_e-\Rightarrow H_{2(g)}+2OH^-_{(aq)}}$$
(3)
$$\mathrm{Al^{3+}_{aq}+3OH^-\Rightarrow Al(OH)_3}$$
(4)
$$\mathrm{n\ Al(OH)_3\Rightarrow Al_3(OH)_{3n}}$$
(5)

The electro-coagulants produced through electrocoagulation, namely Al(OH)3, are more effective than chemical coagulants at removing pollutants from different types of wastewater. Similarly, they are more significant than chemical coagulants, resulting in minimal solubility within a specific pH range where they will rapidly separate (Jabbar et al., 2020). The metal, shape, arrangement of the electrodes, the mode of operation (batch or continuous), and the AC/DC supply all influence the design of electrocoagulation reactors (Mohammed & AlJaberi, 2018).

In this study, natural oily wastewater is treated using a continuous electrocoagulation reactor (ECR) to reduce COD and meet environmental laws. The aluminum electrodes in an (ECR) are positioned concentrically and wired to a DC power source in a monopolar-parallel configuration. The cathode was designed as a one-sided finned (1SF) cylindrical form that sits between the anodes, whereas an anode has a plane-cylindrical shape.

Recent research has focused on developing more effective electrocoagulation cells, as discussed in the review articles. However, studies have yet to be conducted on treating natural oily wastewater in an electrocoagulation reactor with tubular aluminum anodes encircling a one-sided finned (1SF) cylindrical aluminum cathode. Consequently, this research aims to use this unique reactor to lower the amount of chemical oxygen demand (COD) in the oily wastewater produced by the Al-Muthanna petroleum refinery and to quantify the energy and electrode consumption of this new method while adjusting for optimal operating factors (the applied current and reaction time). For experimental design, analysis, and optimization, the response surface methodology-central composite design (RSM-BBD) experimental design approach and the Minitab soft software were used.

Materials and methods

Natural oily wastewater characterization

Natural oily wastewater was taken from the downstream end of Al-Muthanna petroleum refinery wastewater and preserved at 4 °C until a continuous electrocoagulation reactor was used, as shown in Table 1. According to statistics supplied by the refinery’s management, the quantity of wastewater created by this plant daily was around 25 m3/day.

Table 1 Real-world oily wastewater characterization

Equation 6 was used to compute the percentage pollutants removal efficiency (Y) as follows (AlJaberi, 2020):

$$Y\%= \frac{{C}_{i}-{C}_{f}}{{C}_{i}} \times 100 \%$$
(6)

Ci and Cf are the concentrations of the pollutant at the beginning and end, in mg/l. Furthermore, the following equations were used to determine the theoretical consumption of electrodes (TCE), the actual consumption of electrodes (ACE), and the electrical energy consumption (EEC) of the continuous electrocoagulation process (Ahmed et al., 2020):

$$EEC=\frac{U\ I\ t*1000}{\left(\mathrm{Ci}-\mathrm{Cf}\right)* V}$$
(7)

where U represents the operating voltage (volt), I represents the applied current (Ampere), t is the electrolysis period (hours), and V represents the sample volume (liter) (AlJaberi et al., 2020).

$$TCE=\frac{I\ t\ M}{Z\ F}$$
(8)

where Z represents the number of electrons (for Al, it is 3), M represents the molecular weight of the electrodes’ metal (26.98 g/mol), and F represents the Faraday constant (96,485.34 Columb/mol).

$$ACE=W1-W2$$
(9)

where W1 represents the weight of the electrodes before the experiment, and W2 represents the weight of the electrodes following the experiment. We may determine the current efficiency value by comparing the theoretical and real electrode consumption numbers, as shown in Eq. (10) (AlJaberi, 2019):

$$\mathrm{Current\ efficiency= }(ACE/TCE.)*100\%$$
(10)

Electrocoagulation reactor

We employed DC power to maintain a constant current and allow real-time voltage changes (YX-305D, Yaxun, China). The electric flocculation tank was made of plastic and had a capacity of 2.5 l. The current study used an electrocoagulation reactor (Fig. 3) with three concentric electrodes made of aluminum tubes. The two tubes on each end were the anode electrodes, while the middle tube was the cathode. The physical composition of anode tubes was analyzed by EDS (energy-dispersive X-ray spectroscopy), which showed that the tubes include a wide range of chemicals. Table 2 and Fig. 4 show that the cathode is an aluminum one-side finned (1SF) tube with a surface area of 2185 cm2, dimensions of 3.4 cm by 8.8 cm, and 27 fins with a diameter of 2.5 cm by 8.8 cm. Tubular aluminum anodes surround the cathode with dimensions of (an outer anode of 12 cm 10 cm and an inner anode of 1.5 cm 10 cm) with a total surface of 425 cm2. These electrodes were submerged at a height of 7.5 cm when the wet volume was substantially smaller than the active area of the anodes. Wet volume here refers to the anodes’ submerged area.

Fig. 3
figure 3

A diagram depicting the electrocoagulation cell and electrode layout

Table 2 Aluminum tube characterization
Fig. 4
figure 4

Energy-dispersive detectors (EDS) of aluminum tube

The obtained active area of 319 cm2 was much more than the submerged volume of 861 cm3. The outer anode was 2 cm from the finned-side cathode, whereas the inner anode was 1 cm from the non-finned-side cathode. The electrocoagulation reactor’s core had these electrodes powered by an electrical source (0–30 V and 0–5 Amps). Figure 3 shows the electrocoagulation reactor and electrodes. This study examined COD. After each experiment, the electrodes were cleaned with sandpaper, washed with distilled water, dried, and weighed. The pH was measured using a digital pH meter (HNNA Instrument Inc, PH211, Romania). In contrast, an electronic conductivity and TDS meter were used to measure the conductivity and TDS (HM digital meter, model COM-100, Korea). Samples were collected, and COD values were determined using a thermos-reactor (RD-125, Lovibond) and a spectrophotometer (MD 200, Lovibond).

Experimental design

The electrocoagulation experiments were designed, analyzed, and optimized using response surface methodology (RSM) type Box-Behnken design (BBD) and a statistical program (Minitab-18). The mathematical connection between the responses and the operational variables is approximated by putting the replies into a second-order polynomial equation (Eq. 6). The higher the regression coefficient (R2) value, as well as the results of the analysis of variance (ANOVA), the higher the quality of the model constructed (AlJaberi, 2018; Mohammed & AlJaberi, 2018):

$$\mathrm{Y={B}_{0+}\sum\limits_{i=1}^{q}{B}_{i}{X}_{i}+\sum\limits_{i=1}^{q}{B}_{ii}{X}_{i}^{2}+\sum\limits_{i}\sum\limits_{j}{B}_{ij}{X}_{i}{X}_{j}}$$
(11)

where X1, X2, to Xq are the operational variables, q is the total number of operating variables, Bo to Bij are the regression coefficients, and Y is the researched answers, labeled as YCOD% for chemical oxygen demand removal efficiency.

In the current work, the influences of current density CD (X1: 0.630–5.00 mA/cm2.), electrolysis time (X2: 4–60 min), and the flow rate (X3: 50–150 ml/min) were investigated.

Design specialists offered 12 experiments with 3 center points, i.e., using RSM kind Box-Behnken design BBD with the Minitab statistical software program, to optimize the observed responses, namely chemical oxygen demand (COD) elimination. The study designs and experimental ranges for the operational variables are mentioned respectively in Tables 3 and 4.

Table 3 Operating experimental variable ranges
Table 4 Experiments design

Results and discussion

Table 5 shows the theoretical and practical COD removal efficiencies, tubular electrode usage, and current efficiency. As shown in Fig. 5, the observed range for COD elimination is 3.03–77.58%, which agrees well with the projected range of 4.18–76.43%.

Table 5 The investigated variables’ results
Fig. 5
figure 5

Predicted and observed values for chemical oxygen demand %

Mathematical relation of the investigated responses

Based on experimental data, the mathematical correlation (Eq. 12) in Table 6 depicts the interactions between operational factors in terms of actual parameters that impact COD removal efficiency. As said, COD models with high regression parameters and excellent agreement with adjusted response values are desirable (Schaep et al., 1998).

Table 6 Mathematical models of the investigated responses

Analysis of variance (ANOVA)

The Pareto diagram offered in Fig. 6 depicted the factors, the square of the factors, the most active interventions, and their interactions on the COD removal effectiveness response. The electrolysis period has the most impact, and then the electrolysis duration square is, respectively, according to the shape.

Fig. 6
figure 6

Pareto chart for COD removal efficiency

Analysis of variance (ANOVA) is used to evaluate the model fitted. Hence, it was used to fit the function to the data. If the models are not well specified, the findings may be deceptive (Ahmed et al., 2020; AlJaberi, 2020).

Influence of process parameters on the efficiency of COD removal

The analysis of variance for COD removal efficiency is shown in Table 7, with values less than 0.050 indicating that the model terms are significant and values more than 0.100 suggesting that the regression model is insignificant. The value of F for COD in the current investigation is 366.86, suggesting that the estimated model is significant. In addition, the high values of the response regression coefficients indicate that the model is significant and that the modified R2-adjusted value is satisfactory. According to the ANOVA findings, these models indicated the efficiency of the electrocoagulation method and that it could be utilized to remove contaminants from oily wastewater.

Table 7 Results of ANOVA test for COD removal efficiency

The influences of the current density

This is the most significant parameter in electrocoagulation since it controls pollutant removal rate, ion release from electrodes, and electro coagulant production (Jiang et al., 2019; Mohammed & AlJaberi, 2018). This parameter was adjusted among 0.630 and 5.000 mA/cm2 to explore the current density’s effect on the current reactor’s performance (voltage raised from 1.49 to 5.54 V). Figure 7 depicts the relationship between COD removal efficiency and current density at mean reaction time (32 min) and flow rate (100 ml/min). The results reveal that the COD removal effectiveness increased from 48.41% at 0.630 mA/cm2 to approximately 63.56% at 5.000 mA/cm2, resulting in a decrease in the final COD concentration in the treated water from 681 to 481 mg/l. According to the findings, removal efficiency improved as the current density value increased. The finned structure of the anode provides an adequate amount of adsorbent for cleaning the solution (AlJaberi, 2020). An excessively high rate of bubble generation at both electrodes and the growth of an oxide layer on the electrode reduce the destabilizing pollutant rate and removal efficiency, decreasing this behavior (AlJaberi, 2018; Hansen et al., 2019).

Fig. 7
figure 7

The influence of current density on COD removal effectiveness in actual oily wastewater with a COD of 1320 ppm (mg COD/l) (electrolysis time = 32 min and flow rate = 100 rpm)

The mathematical relation between COD removal response and current density for mean values of other variables is depicted in Eq. 12 below:

$$Y_{\mathrm{COD\%}}\ =\ 29.12\ X_1\ -\ 4.075\ X_1^2 \quad (\mathrm{R^2=71.5\%})$$
(12)

Effect of electrolysis time

Reaction time is an essential operational feature that directly impacts electrocoagulation reactor performance (Changmai et al., 2019). Creating enough electro-coagulants, Al(OH)3, for adsorption-based pollutant removal from oily wastewater requires some time. Thus, it is essential to look at how long the treatment process takes (AlJaberi et al., 2020). At mean current density and flow rate values of 2.815 mA/cm2 and 100 ml/min, it is clear that the response of COD removal efficiency increases rapidly with increasing electrolysis time, as shown in Fig. 8. When the response surpasses the mean value of the electrolysis period, hydrogen bubbles at the cathode may interfere with pollutant electro-deposition, causing the response to falling until the experiment’s conclusion (Ahmed et al., 2020). Furthermore, as shown in Eqs. 7 and 8, electrolysis time influences electrode value and energy consumption (Arellano et al., 2020).

Fig. 8
figure 8

The impact of electrolysis time on the removal efficiency of COD 1320 ppm (mg COD/L) real oily wastewater (current density = 2.815 mA/cm2 and flow rate = 100 ml/min)

Concerning the mean values of other variables, the mathematical relation of COD elimination response versus electrolysis time is indicated in Eq. 13 as follows:

$$Y_{\mathrm{COD\%}}\ =\ 2.379\ X_2\ -\ 0.02262\ X_2^2\quad (\mathrm{R^2=96.1\%})$$
(13)

As shown in Fig. 8, increasing the reaction duration from 4 to 60 min raised COD removal effectiveness from 10 to over 60% when using the current innovative electrocoagulation reactor. Since additional adsorption and desorption activities occur during prolonged electrolysis, the removal efficiency of these contaminants from the contaminated solution also increases with reaction time (AlJaberi et al., 2020).

The influence of the flow rate

Since the current design of electrodes featured a tubular-shaped anode and a finny-shaped cathode, the flow rate was chosen as an operating variable and ranged from 50 to 150 ml/min. The results for COD elimination efficiency are shown in Fig. 9 for the mean electrolysis time (32 min) and current density (2.815 mA/cm2). As seen, the response’s behavior as the flow rate changes. It has grown at low flow rates until they reach the mean value. However, it tends to decrease at high flow rates. This could be interpreted at low rates of flow, raising the flow raises the amount of coagulant generation, which raises the removal process; however, at high rates of flow, raising the rate of flow decreases the residence time of the substance inside the reactor (the occurrence of the bypass passage process), and it also rises the incidence of vortices between the electrodes, which diminishes the destabilization process between the atoms inside the reactor. This result is identical to AlJaberi et al. (2020) and Yang et al. (2021).

Fig. 9
figure 9

Flow rate influences COD 1320 ppm (mg COD/l) removal efficiency in real oily wastewater (electrolysis time = 32 min and current density = 2.815 mA/cm2)

The mathematical correlation of COD removal response against the flow rate in regard to mean values of other variables is displayed in Eq. 14 as follows:

$$Y_{\mathrm{COD\%}}\ =\ 1.112\ X_3\ -\ 0.00611\ X_2^3\quad (\mathrm{R^2=75.5\%})$$
(14)

Figure 10 depicts the significant impact of every couple of process variables on the effectiveness of COD removal, in which each couple is changed according to the designed range, and the remaining variable is held constant at the mean value, i.e., 2.815 mA/cm2 of current density, 32 min of electrolysis time, and 100 ml/min of flow rate, for each situation. The 3D plot of the COD% response indicated that the electrolysis time-flow rate pair has a stronger impact than the current density-electrolysis time couple and the current density-flow rate couple. These findings matched those gained by the ANOVA test, as shown in Table 7. The greatest removal is obtained when the influence of this couple of electrolysis period flow rate is at 1 h and 50 ml/min, whereas the current density electrolysis period couple has at 1 h and 5 mA/cm2 and a couple of the flow rate and current density at 50 ml/min and 5 mA/cm2.

Fig. 10
figure 10

The influence of each pair of the operating variables on the effectiveness of removing COD from actual oily wastewater. a Current density-electrolysis time pair, b current density-flow rate pair, and c electrolysis time-flow rate pair

Consumption of electrodes and electrical energy

The electrical energy consumption (EEC), theoretical consumption of electrodes (TCE), and actual consumption of electrodes (ACE) were estimated for the analyzed variables using Eqs. 7, 8, and 9 as illustrated in Figs. 11, 12, 13, and 14. In contrast to TCE, which is directly relevant to the electrolysis time and current density but exhibits different behavior with flow rate, the EEC is typically directly relevant to the electrolysis time, current density, and flow rate. The response of (TCE) increased with increasing flow rate until it was more than the mean value (100 ml/min), and then it tended to decrease. In the case of ACE, the reaction time correlates directly with the electrolysis time. However, its behavior changes with the current density and flow rate. The response of (ACE) increased with current density, and the flow rate increased until they exceeded the mean value (2.815 mA/cm2 and 100 ml/min, respectively), at which point they tended to decrease. At that point, they tend to reduce. The progressive increase and reduction in consumption might be explained by the active area offered by the revolutionary electrode’s current design and the electrical conductivity of oily wastewater. The lowest energy usage was 0.11 kWh/kg COD, 0.036 g theoretical electrode consumption, and 0.1 g actual electrode consumption.

Fig. 11
figure 11

The relationship between the electrical energy consumption (EEC) and operational factors during the electrocoagulation treatment of COD 1320 ppm (mg COD/l) actual oily wastewater

Fig. 12
figure 12

Electrical energy consumption (EEC) response vs. the contour plots of the studied variables

Fig. 13
figure 13

Electrocoagulation treatment of actual oily wastewater with a COD of 1320 ppm (mg COD/l): theoretical consumption of electrodes (TCE) vs the operational factors

Fig. 14
figure 14

Actual consumption of electrodes (ACE) compared to the operational factors during the electrocoagulation treatment of COD 1320 ppm (mg COD/l) natural oily wastewater

The significant effect of each couple of process variables on the electrical energy exhaustion response is depicted in Fig. 12, in which each couple is adjusted within the selected limits while the other variable is kept constant at the mean value. The current density-flow rate and the current density-electrolysis time couples have a bigger impact than the electrolysis time-flow rate couple, according to the contour plots of the electrical energy exhaustion response.

The irregular interplay between each couple of these parameters, illustrated in Fig. 15, may affect this variation in behavior between factors on response of (ACE) all along study, such as current density and flow rate on the one side and electrolysis time and flow rate on the other side.

Fig. 15
figure 15

Actual consumption of electrodes (ACE) response vs. the interaction among the operational variables

The mathematical correlations (Eqs. 16, 17, and 18) in Table 8 were created based on experimental findings and demonstrate the interactions between the operational variables in terms of actual parameters to determine the electrical energy consumption (EEC), theoretical consumption of electrodes (TCE), and actual consumption of electrodes (ACE).

Table 8 Mathematical models of the electrical energy consumption (EEC), theoretical consumption of electrodes (TCE), and actual consumption of electrodes (ACE)

Table 9 summarizes previous studies that addressed the use of electrocoagulation technology in the wastewater treatment process that includes various contaminants.

Table 9 Summarizes previous studies of electrocoagulation technology

Operating parameter optimization

The study’s major findings suggested that the novel design of the electrocoagulation reactor used to recover COD from oily wastewater was treatable. A statistical software application (Minitab-18) was used to estimate the optimization procedure. Figure 16 shows the precision of the findings obtained since the composite desirability (D) equals 1. The ideal electrolysis time, current density, and flow rate were 57.74 min, 5.000 mA/cm2, and 50 ml/min, respectively, achieving 82.8% COD elimination efficiency. Because fins offered a greater surface area, the ideal values of the operational variables were smaller than in the past study, especially electrolysis duration and current density. The chemical oxygen demand was reduced by 82.8% at the optimum operational variable values.

Fig. 16
figure 16

The ideal operational variable settings and investigated responses for the treatment of COD 1320 ppm (mg COD/l) actual oily wastewater

As shown in Fig. 16, the lowest flow rate was the desired value because any increase in this parameter increases the discharge of untreated solution due to a decrease in the residence time of the solution in the reactor, which affects the needed interaction between the ions in the solution. At the same time, a more excellent value of current density and electrolysis time would be beneficial to assure the release of various ions essential for the synthesis of electro-coagulants.

Conclusion

The performance of a new electrocoagulation reactor (ECR) in eliminating COD from Al-Muthanna petroleum refinery effluent was investigated. The electrolysis period, current density, and flow rate were determined to be best at 60 min, 5 mA/cm2, and 50 ml/min, respectively. COD elimination efficiency was 82% (the concentration of chemical oxygen demand was reduced from 1320 to 232 mg/L) under these conditions. Additionally, an energy consumption of 4.787 (kWh/kg COD) and an electrode consumption of 0.544 (g) were found. As previously stated, current density significantly impacts COD removal, followed by electrolysis time. Increasing the flow rate had a negative influence on COD removal efficiency. The analyses of data ANOVA and the higher regression coefficients indicate that the second-order polynomial model had been adjusted desirably. To determine the impact count of the operational variables on the studied answers, Pareto charts were used. As a rule of thumb, the oxidation process is faster than the reduction process throughout the electrochemical cell, which means that the release of aluminum ions from the anode is much than the release of hydroxyl ions at the cathode; therefore, we need to maximize the surface area of the cathode without excessive enlargement of the reactor’s volume. This study found the solution to this challenge through the use of fins at the cathode’s surface with a significantly small wet volume of the reactor. As a result, the amount of hydroxyl ions has been increased, more electro-coagulants are generated incorporated with aluminum ions, and consequently higher removal efficiency of pollutants is attained. Overall, the outcomes of the study demonstrated that the new design of the electrocoagulation reactor is reliable for the purgation of natural oily wastewater.