Introduction

Material deterioration or decay has been a significant problem for human society since ancient times till this current industrial period. Such a metal and alloy decaying phenomenon is corrosion that has been a significant problem in factories and plants over the years. Corrosion is a chemical reaction that occurs between a substance, most often a metal, and its surroundings. The environment is comprised of anything in the vicinity of the substance that comes into contact with it. In this process, metal or metal alloys are oxidized and transformed into oxides or hydroxides, which are more stable and known as rust. During the corrosion process, metal goes through series of electrochemical (oxidation and reduction) reactions and eventually gets deteriorated. When a metal (M) is immersed in the solution, electrostatic charge differences at the metal–liquid interface leads to surface ionizations and the neutral metal is oxidized at anodic zone (Eq. 1) (Nazal and Jafar Mazumder 2019).

$${\text{M}} \to {\text{M}}^{n + } + ne^{ - }$$
(1)

The oxidation depends on the oxidation state. As for example, during the corrosion of iron, iron ions are oxidized as follows:

$${\text{Fe}} \to {\text{Fe}}^{2 + } + 2e^{ - }$$
(2)

When it comes to the cathodic reaction, there are a number of possible reactions depending on the environment. One of the important practical factors in the natural aquatic environment is pH and dissolved oxygen. In an acidic medium or low pH where the hydrogen ion (H+) concentration is high, the primary reactions are as follows depending upon the presence of dissolved O2 in media:

$${\text{O}}_{2} + 4{\text{H}}^{ + } + 4e^{ - } \to 2{\text{H}}_{2} {\text{O}}$$
(3)

In case of acidic media, the overall reaction follows a different path which can be portrayed combining Eqs. 2 and 3.

$$2{\text{Fe}} + {\text{O}}_{2} + 4{\text{H}}^{ + } \to 2{\text{Fe}}^{2 + } + 2{\text{H}}_{2} {\text{O}}$$
(4)

The risk associated with the control of corrosion damages has risen dramatically over time, necessitating a substantial financial commitment as well as the strictest safety precautions for successful handling. There are mainly three categories of corrosion related losses, such as (1) waste of energy and material, (2) economical loss, and (3) impact on environment and health. Approximately half of the steel production of the world is utilized to replace rusted steel (Javaherdashti 2000). Due to corrosion and water degradation, 30 percent of treated drinkable water is lost in Tehran each year. Corrosion has a significant impact on the economy, with estimates ranging from 2 to 4% GDP of a country. Corrosion of metallic materials is one of the most pressing issues in modern industry. Corrosion of metals costs the USA $450 billion annually. It is reasonable to anticipate that this kind of pollution will increase in frequency along with the quantity and length of pipelines that carry oil, gas, water, and sewage. Between the years 1994 and 2000, internal corrosion was the cause of 15% of all pipeline accidents in the USA. During the same time period, the number of pipeline incidents caused by internal corrosion in Alberta, Canada, averaged out to approximately one per day. Corrosion on bridges, parking structures, buildings, electrical towers, roads, and other infrastructure may put public safety at risk and cause large maintenance expenses. A rusted part might lead to calamity if they fall (Javaherdashti 2000; Hansson 2011; Esmailzadeh et al. 2018; Kamaruzzaman et al. 2022). Among the various reasons, usage of acid solution in the industries for chemical cleaning, descaling, and pickling is very likely to cause corrosion on the metal parts of the industries. Generally, HCl and H2SO4 are two commonly used acids in the industries for such uttered purposes, which are pernicious to the metal parts as they induce metal oxidation by containing a high concentration of H+.

Various approaches have been applied over the years to avoid this undesirable metal loss. Across all the approaches, use of inhibitors is one of the most practical and viable approaches for protecting metallic surfaces from corrosion in acidic media and reducing acid intake during the corrosion process (Haruna and Saleh 2021; Naghi Tehrani et al. 2021). For the last few decades, both inorganic and organic commercial inhibitors have been synthesized and widely used in industries. In the industries, various inorganic inhibitors such as PO43−, NO3−, and CrO2− compounds and organic inhibitors like long-chain carbohydrates, imidazole, amines, and their derivative compounds have been used to mitigate corrosion. These inhibitors are effective even in very aggressive acid solutions, but the main problems associated with inhibitors are their toxic nature and production cost. So it has become essential to find out the less toxic or non-toxic inhibitor which will be eco-friendly and cheap with zero impact on the environment (M’hiri et al. 2016). Hence, the idea of green corrosion inhibitors emerged in the last few decades to counter the environmental detriments. The green corrosion inhibitors are nothing, but plant extract consists of various organic compounds. These biodegradable plant extracts are low-cost and environment-friendly, so the research on these green corrosion inhibitors is significant due to economic and environmental benefits. In the last few years, numerous extracts have been used from various biomass of plants (Ji et al. 2015; M’hiri et al. 2016; Prabakaran et al. 2016; Aribo et al. 2017; Ali Asaad et al. 2018; Anuchi and Ngobiri 2018; Bhuvaneswari et al. 2018; Verma et al. 2018c) as an efficient natural corrosion inhibitor. Some innovative and new approaches like oxidation/polymerization reactions were used to enhance the efficiency of the Nettle bio extract. Nettle extract was modified by oxidation in alkaline conditions. Some of the components of the Nettle extract, like serotonin and histamine, were polymerized or dimerized and showed better adsorption capability on steel (Keramatinia et al. 2019). It has been established that flowers, leaves, and peel contain a higher amount of polyphenols which shows higher antioxidant and corrosion inhibition. Extract of leaves, flowers, and stems of Cistus monspeliensis L. was tested to inhibit the corrosion of carbon steel in acidic media. It was observed that the plant mass, which contains a high amount of polyphenols (flowers and leaves), shows better antioxidant activity and better inhibition efficiency. (Mechbal et al. 2021). Raphanus sativus L. was also found as an effective inhibitor and antiscalant for mild steel, even in tap water. The anti-scaling efficiency was tested using chronoamperometry and thermal scaling techniques. The scaling inhibition efficiency was determined from the changes in hardness using the titration technique. From the experiments, it was observed that the hydroxyl and carboxyl functional groups of the extract compounds interact with cations like Ca2+. The polyphenols also chelate the cations. It was discovered that the scaling inhibition efficiency was improved by five times in the presence of the extract (Vasyliev et al. 2020). The peach pomace extract was investigated for corrosion inhibition on carbon steel in chloride-induced corrosion (NaCl medium). The volatile organic compounds of the extract were explored GC–MS and HPLC. The study showed that longer exposure to extract increase the inhibition efficiency (Vorobyova and Skiba 2021).

These environmentally friendly corrosion inhibitors are often composed of a variety of organic components such as amino acids, polysaccharides, lignin, and polyphenols. Among the investigated compounds, those having heteroatoms (N, O, and S) in their functional groups and delocalized π electrons in their structure are expected to be effective inhibitors (Ji et al. 2015; Salghi et al. 2017; Liao et al. 2018). The fundamental mechanism of the inhibitors to inhibit the corrosion in metal or any alloy surface is to form a protective barrier on the surface of the metal. So, the efficacy of the organic inhibitors to protect the metal surfaces is determined by their absorbability on the surface. Now, it has been established from various resources that adsorption is influenced by the structure of a molecule, electrolyte type, and metal surface charge. Actually, inhibitors in an aqueous solution are adsorbed on the surface by replacing water molecules that have previously been adsorbed. For this reason, it is desirable to have more precedent electrostatic interaction between an inhibitor molecule than the electrostatic interaction between metal and water molecules. The primary variables for such interactions in an inhibitor are the electron densities of various functional groups, as well as their polarizability and electronegativity (Ali and Mahrous 2017). Functional groups comprising heteroatoms (N, O, and S) are crucial in establishing such interactions by forming a coordinate bond. On the basis of historical precedent, it is believed that S has a stronger inclination to form the coordinate bond than N and O (Mourya et al. 2013; Srivastava et al. 2017, 2018; Feng et al. 2018). So in the last few years, researchers have been exploring plant-derived biomaterials as a source of organic corrosion inhibitory molecules with suitable structures and properties.

On the other hand, the increasing amount of waste from different sources has certainly become a concern in the current time. So the reusability of the wastes has become significant from the waste management perspective. On that note, one of the major waste resources is the domestic and industrial kitchen which is piling up day after day. Conversely, these wastes include significant bioactive compounds with different uses, increasing economic viability and minimizing environmental stress. (Skoronski et al. 2016; Bong et al. 2018). Recent studies have employed olive, pomegranate, apple, and grape food waste to synthesize phenolic and other beneficial compounds. (El-Etre 2007; Gu et al. 2018; Verma et al. 2018a). In this regard, it has been observed that the onion is one of the most widely used ubiquitous crops which has enormous applications in our daily life. But the concern is the increasing amount of generated waste each year across the globe. It has been reported that only the developed countries produce 100,000–500,000 tons of waste per year (Sharma et al. 2016). Interestingly, recently scientists have found onion waste as a potential source of phenolic compounds and can be used in numerous applications like the synthesis of biosenols and nanoparticles, therapeutic purposes, etc. (Sharma et al. 2016; Chia et al. 2018; Santhosh et al. 2020). The onion waste is a potential source of various organic compounds like flavonoids, carbohydrates, fatty acids, vitamins, amino acids, etc. (Jang et al. 2013; Celano et al. 2021). Among these bio-organic compounds, quercetin is one of the most valuable compounds, which has a wide range of therapeutic novelties, high antioxidant activity, ability to form a complex with metal (Xu et al. 2019). Even recently, scholars have predicted the therapeutic potential of quercetin against COVID-19 disease, which is caused by a coronavirus (Derosa et al. 2021).

Considering the outlook of industrial application and the therapeutic potential of quercetin, onion peel, and boiler quality steel was chosen as the material of interest. This work focuses on using onion peel extract as an eco-friendly inhibitor and testing its efficiency in acidic environments. However, there are some lacunae in the literature on onion waste extract as natural corrosion inhibitor, especially on BQ steel in both HCl and H2SO4 media (James and Akaranta 2011). This study mainly focuses on the efficiency of onion peel extract (OPE) to mitigate corrosion of boiler quality steel in acidic media. To accomplish this study, few objectives were set, which start with the preparation and characterization of the OPE. Specifically, to determine the inhibition efficiency of OPE, gravimetric analysis, potentiodynamic polarization tests (PDP) (Tafel polarization), and EIS studies were employed. To investigate the impact of OPE on the microstructure of BQ, field emission scanning electron microscopy (FESEM), energy-dispersive X-ray spectroscopy (EDX), and atomic force microscope (AFM) were used. To further understand the interactions between the OPE molecules and the BQ steel surface, quantum chemical calculations are accomplished using density functional theory.

Experimental

Test specimen preparation

The BQ steel (ASTM A-537 grade B) having a composition of C: 0.24%; Mn: 1.72%; Si: 0.55%; S: 0.025%; P: 0.025%, Cu: 0.38% was used with two different dimensions, such as for the gravimetric analysis (3 × 3 × 1 cm3) and electrochemical experiments (2 × 2 × 1 cm3). The surfaces of metal coupons used to be abraded with 320, 600, 1000, 1200, and 1500 grades of emery papers successively and polished with a disk polisher (Make: Ms. Chennai Metco Pvt Ltd., India; Model: Bainpol-VT). Before each test, the specimens were cleaned with double distilled water and acetone. (Ali Asaad et al. 2018; Pal and Das 2020).

Preparation of extract

The onion peels were obtained from the kitchen wastes of Brahmaputra Hostel, Indian Institute of Technology, Guwahati, India (26.1445° N, 91.7362° E). The peels were then dried in a drying oven at 60 °C for 10 h until the moisture contents were 4–5% (w/w) and powdered using a mixer grinder. To obtain the ethanolic extract, 20 g of dried onion peels was mixed with 200 mL of 70% (v/v) ethanol and heated for 3 h at 60 °C in a water bath. After carrying out two extractions of the same slurry, filtrate was collected using a Whatman No. 2 filter paper (Whatman, UK). Later, the filtrate was evaporated using a rotary evaporator and lyophilized using freeze-dryer for 24 h and the remaining solid residue was preserved at − 20 °C, which was later used as a natural inhibitor (OPE) (Lee et al. 2014).

Characterization of OPE

The OPE was characterized using liquid chromatography–mass spectrometry (LC/MS, 1260 Infinity LC, and 6410 Triple Quadrupole MS, Agilent Technologies, USA) to detect the phenolic compounds in the onion peel. One g of dried extract powder was dissolved in 10 mL of Milli-Q water (resistivity: 18.2 MΩ cm), and kept in the ultrasonic bath for 15 min. Then, the solution was filtered using a nylon filter (0.2 μm) and diluted. The sample was passed through the ZORBAX C18 column (2.1 × 50 mm2, 3.5 μm) column (maintained at 35 °C) using mobile phase A (water + 0.1% formic acid) and mobile phase B (100% water) at a flow rate of 200 µL min−1. The elution gradient profile was used as following: 2% B (0–3 min), 2–13% B (3–5 min), 13% B (5–9 min), 13–18% B (9–12 min), 18% B (12–13 min), 18–30% B (13–17 min), 30–50% B, (17–21 min), 50–98% B (21–22 min), 98% B (22–27 min). After elution, the mass spectra of the analytes were obtained by scanning m/z ratio from 50 to 950 in negative ionization mode at 300 °C of capillary temperature (Bedrníček et al. 2020; Celano et al. 2021).

Gravimetric analysis

The corrosion rate was roughly determined using the weight loss method. The weight loss was measured using weighing balance (Make: Sartorius; Model: BSA4S-cW) after immersing the BQ coupons for 72 h in 1 (M) HCl and 0.5 (M) H2SO4 at ambient temperature (28 ± 2 °C) without and with OPE inhibitor (50 mg L−1 to 200 mg L−1). To reduce the experimental error, the specimens were cleaned before and after each experiment with water and acetone. All the experiments were conducted in triple sets and the calculated standard deviation was mentioned in the results. The corrosion rate was calculated using the following formula:

$${\text{CR}} = \frac{87600W}{{\rho At}}$$
(5)

where corrosion rate (millimeter per year or mmpy) is denoted by CR; weight loss (g) of the BQ is denoted by W; ρ and A are the density (g cm−3) and exposed area (cm2) of BQ coupon, respectively; and exposure time (h) was expressed as t. The value of ρ was assumed as 7.86 cm−3 (density of iron) (Ali Asaad et al. 2018; Saxena et al. 2018a).

The inhibition efficiency (\(\mu_{{{\text{CR}}}} \%\)) of OPE was calculated using by Eq. 6, where \(w_{o}\) (g) and \(w_{i}\) (g) are the weight of the specimen in absence and presence OPE, respectively (Pal and Das 2020).

$$\mu_{{{\text{CR}}}} \% = \frac{{w_{o} - w_{i} }}{{w_{o} }} \times 100$$
(6)

Electrochemical studies

To perform the electrochemical experiments, a three-electrode electrochemical cell was fabricated with connections for a working electrode (BQ steel coupon), a counter electrode (platinum wire), and a reference electrode (Ag–AgCl, saturated with 3 M KCl). The experimental setup is depicted schematically in (Fig. S1) of the Supplementary Materials. To perform the experiments, the electrochemical cell was connected with potentiostat/galvanostat (Autolab, PGSTAT302N). In order to obtain the error-free results, each electrode was cleaned with water and acetone as well as polished with sandpaper before each experiment, as described in Sect. 2.1. To observe the inhibition efficiencies, all the tests were done in 1 M HCl and 0.5 M H2SO4 solution in both the absence and presence of different OPE concentrations (Pal and Das 2022).

OCP measurements

The average open-circuit potentials (OCP) were measured by exposing the working electrode to the electrolytic solutions (acidic solution without and with OPE) for 60 min, without any interruption and external current. The OCP was measured before each PDP and EIS test to use the values in the respective experiments (Singh and Quraishi 2016).

Potentiodynamic polarization tests

Tafel polarization curves were obtained at a scan rate of 1 mV s−1 in the range of − 250 mV versus Ag/AgCl to + 250 mV versus Ag/AgCl with respect to OCP or corrosion potential. The extrapolation method was used to obtain various Tafel curve parameters, such as corrosion potential \((E_{{{\text{corr}}}} )\), corrosion current density \((i_{{{\text{corr}}}} )\), cathodic Tafel slope \(\left( {b_{{\text{c}}} } \right)\), and anodic Tafel slope \(\left( {b_{{\text{a}}} } \right)\), from the experimental curve (Tafel curve). The Tafel curve equation is explained in the Supplementary Materials.

The inhibition efficiency \((\mu_{p} \%\)) for various concentrations of OPE from the corrosion current density was calculated by the given equation:

$$\mu_{P} \% = \frac{{I_{{{\text{corr}}}}^{o} - I_{{{\text{corr}}}}^{i} }}{{I_{{{\text{corr}}}}^{o} }} \times 100$$
(7)

where \(I_{{{\text{corr}}}}^{i}\) and \(I_{{{\text{corr}}}}^{o}\) are corrosion current density of BQ steel with and without applying OPE, respectively.

EIS measurements

The EIS measurements were carried out using alternating current at OCP keeping frequency range from 0.01 to 10,000 Hz with a signal amplitude perturbation of 10 mV (peak to peak). The frequency responses are represented by Nyquist plot and Bode plot. To measure all of the impedance parameters, the Nyquist plots were fitted to a suitable electrochemical circuit using the Zsim 3.22 program (Zheng et al. 2014; Ji et al. 2015).

The inhibition efficiencies were also calculated from charge transfer resistance by the given expression:

$$\mu_{{{\text{R}}_{{{\text{ct}}}} }} \% = \frac{{R_{{{\text{ct}}}}^{i} - R_{{{\text{ct}}}}^{0} }}{{R_{{{\text{ct}}}}^{i} }} \times 100$$
(8)

All the electrochemical experiments were done in triple sets and the calculated standard deviation was mentioned the in the results.

Adsorption studies

Some of the commonly used isotherms Langmuir, Temkin, and Frumkin were used to determine the thermodynamic parameters, such as the adsorption equilibrium constant \((K_{{{\text{ads}}}} )\) and the adsorption free energy \((\Delta G^\circ_{{{\text{ads}}}} )\) and to comprehend the type of adsorption process. The isotherms of adsorption are represented by the following equations (Shabani-Nooshabadi and Ghandchi 2015):

$${\text{Langmuir}}\;{\text{isotherm}}\;{:}\;\theta /\left( {1 - \theta } \right) = K_{{{\text{ads}}}} C$$
(9)
$${\text{Temkin}}\;{\text{isotherm}}:\log \frac{\theta }{C} = LogK_{{{\text{ads}}}} - g\theta$$
(10)
$${\text{Frumkin}}\;{\text{isotherm}}:\log \frac{\theta }{{\left( {1 - \theta } \right)C}} = \log K_{ads} + g\theta$$
(11)

In these equations, OPE concentration (C) and surface coverage (\(\theta\)) were employed to draw straight lines and to obtain the intercept (\(K_{{{\text{ads}}}}\)) (De Souza et al. 2012; Shabani-Nooshabadi and Ghandchi 2015). Surface coverage (\(\theta\)) was calculated from \(\mu_{{{\text{R}}_{{{\text{ct}}}} }} \%\) by the following relationship:

$$\theta = \frac{{\mu_{{{\text{R}}_{{{\text{ct}}}} }} \% }}{100}$$
(12)

Characterization of surface

FESEM-EDX

The steel specimens were immersed in HCl and H2SO4 acid solutions without and with an effective concentration of OPE (200 mg L−1) for 24 h. Then, using FESEM (Sigma, Zeiss), microscopic images were taken of the surface to observe the changes that had occurred. The EDX analysis was carried out under the same conditions as FESEM analysis (Thomas et al. 2020).

AFM

To assess morphological changes on the BQ steel by OPE, the specimens were dipped into the solutions for 3 h, and observed under AFM (Bruker Dimension Icon SPM) using the tapping mode with a frequency of 302 kHz in the air to get pictures of 20 μm × 20 μm area (Ji et al. 2015; Haruna and Saleh 2021).

Theoretical studies by quantum chemical calculations

A semiempirical QC analysis using Gaussian 09 W tools was implemented to determine the optimal structures and electron clouds of the OPE compounds. To optimize the frequencies as well as the structures, density functional theory (DFT) was used, employing the hybrid functional B3LYP and the 6-311++G (d,p). The energy of the frontier molecular orbitals (FMOs) was computed along with some other quantum chemical parameters. The energy gap between the lowest unoccupied molecular orbital (LUMO) and the highest occupied molecular orbital (HOMO) was calculated using Eq. 13 (Feng et al. 2018; Ganash 2018; Verma et al. 2018b, 2018c).

$$E_{{{\text{LUMO}}}} - E_{{{\text{HOMO}}}} = \Delta E$$
(13)

The following equations were used to compute the other quantum chemical parameters ionization potential \(\left( I \right)\), electron affinity \(\left( A \right)\), electronegativity \(\left( \chi \right)\), global hardness \(\left( \eta \right)\), and the fraction of electron transferable from inhibitor molecules to iron \(\left( {\Delta N} \right)\):

$$- E_{{{\text{HOMO}}}} = I$$
(14)
$$- E_{{{\text{LUMO}}}} = A$$
(15)
$$\chi = - \frac{1}{2}\left( {E_{{{\text{LUMO}}}} + E_{{{\text{HOMO}}}} } \right) = \frac{I + A}{2}$$
(16)
$$\eta = \frac{1}{2}\left( {E_{{{\text{LUMO}}}} - E_{{{\text{HOMO}}}} } \right) = \frac{I - A}{2}$$
(17)
$$\sigma = \frac{1}{\eta }$$
(19)
$$\Delta N = \frac{{\chi_{{{\text{Fe}}}} - \chi_{{{\text{inh}}}} }}{{2\left( {\eta_{{{\text{Fe}}}} + \eta_{{{\text{inh}}}} } \right)}}$$
(20)

where theoretically, the work-function value \(\chi_{{{\text{Fe}}}}\) was considered 7 eV and \(\eta_{{{\text{Fe}}}}\) was 0 eV. (Ganash 2018; Srivastava et al. 2018; Verma et al. 2018c).

The Fukui indices, \(f_{{\text{k}}}^{ + }\) and \(f_{{\text{k}}}^{ - }\), are indicators of electrophilic and nucleophilic sites of reactivity. The Fukui function was calculated using the finite difference (FD) approach and the equations are given below:

$$f_{{\text{k}}}^{ + } = q_{{\text{k}}} \left( {N + 1} \right) - q_{{\text{k}}} \left( N \right)$$
(21)
$$f_{{\text{k}}}^{ - } = q_{{\text{k}}} \left( N \right) - q_{{\text{k}}} \left( {N - 1} \right)$$
(22)

In the above equations, the \(q_{{\text{k}}} \left( {N + 1} \right)\), \(q_{{\text{k}}} \left( N \right)\), and \(q_{{\text{k}}} \left( {N - 1} \right)\) represent the electron densities of any \(k\) atom in \(N + 1\), \(N\), and \(N - 1\) electron system, respectively. Mulliken gross charge was in place of electron densities. A second Fukui function \(\left( {f_{{\text{k}}}^{2} } \right)\), which is also known as a dual descriptor, also provides information regarding chemical reactivity which can be calculated by the following equation:

$$f_{{\text{k}}}^{2} = f_{{\text{k}}}^{ + } - f_{{\text{k}}}^{ - }$$
(23)

Results and discussion

Characterization of the compound in OPE

The LC–MS is a potential and widely accepted tool for qualitative and quantitative analysis of the polyphenols in biomass. The qualitative profile of OPE was analyzed by LC–MS, and the chromatogram of the extract is displayed in Fig. 1. The mass spectrum of the extract was obtained in negative ionization mode. From the spectrum, it was noticed that maximum intensity was observed for the m/z value of 301.0. From the literature, it was found that in negative ionization mode, the m/z value of 301.0 indicates the presence of quercetin (Chen et al. 2015; Celano et al. 2021). Some early works have also supported the abundance of quercetin in onion peel (Singh et al. 2009; Bedrníček et al. 2020; Celano et al. 2021). The presence of quercetin makes the OPE an efficient inhibitor because of its antioxidant property and ability to make a complex with iron (Xu et al. 2019; Bedrníček et al. 2020).

Fig. 1
figure 1

Mass spectra of OPE

Gravimetric analysis

The gravimetric method is an easy and commonly used method for evaluating the inhibitory capability of various compounds. This approach was employed to assess the inhibitory efficiency of OPE, and the results revealed that when specimens were immersed in acid solutions, they lost a significant amount of weight. However, the presence of OPE slowed the dissolving of BQ steel in acidic conditions. In both media, the corrosion rate (CR) and inhibition efficiency (\(\mu_{{{\text{CR}}}} \%\)) of OPE were determined using Eq. 5 and 6. To observe the effect of OPE concentration, various OPE concentrations (50 mg L−1 to 200 mg L−1) were incorporated in both HCl and H2SO4 media. Table 1 and Fig. 2 clearly indicate that OPE is an effective corrosion inhibitor for BQ steel as the CR decreases and the \(\mu_{{{\text{CR}}}} \%\) increases with increased OPE concentration.

Table 1 Variations in corrosion rate and inhibition efficiency of BQ steel at different concentrations of OPE in 1 (M) HCl and 0.5 M H2SO4
Fig. 2
figure 2

Variations in corrosion rate and inhibition efficiency of BQ steel at different concentrations of OPE in (a) 1 (M) HCl and (b) 0.5 M H2SO4

It is apparent from Fig. 2a, b that even at lowest concentrations of OPE, there is a considerable efficiency. This increase in OPE inhibition efficiency is due to the redox reaction rate being depleted during corrosion. During the corrosion process, two types of reactions occur that have a substantial impact on the intensity of the corrosion process. These are the anodic reaction, in which iron is oxidized into Fe2+ (Eq. 24), and the cathodic reaction, which results in hydrogen being reduced into H2 gas (Eq. 25) (Mourya et al. 2014; Ali Asaad et al. 2018). The use of OPE reduces the anodic reaction and cathodic reduction reaction rates, which ultimately result in the reduction of iron oxidation. Table 1 shows that the efficiency is roughly comparable in both acidic situations at the highest dosages. In contrast, at 50 mg L−1 (lowest), the efficiency of OPE in HCl is slightly higher than in H2SO4. As SO42− is lesser adsorbable than Cl, the surface in SO42− media is negatively charged. Adsorption of the protonated organic molecules is more suited for a higher negatively charged surface than a lower negatively charged surface. So at the lower concentration, Cl ions make a difference from the SO42− as they attract the protonated inhibitory molecules more aggressively than SO42−. The interaction between the anions and the inhibitory molecules might be physical or chemical or mixed, which is discussed in the following sections.

$${\text{Oxidation}}\,:\,{\text{ Fe}}\, \to \,{\text{Fe}}^{{2 + }} \, + \,2e^{ - }$$
(24)
$${\text{Reduction}}\,:\,2{\text{H}}^{ + } \, + \,2e^{ - } \, \to \,2\left( {\text{H}} \right)_{{{\text{ads}}}} \, + \,{\text{H}}_{2}$$
(25)

Electrochemical measurements

Different electrochemical investigations are required to analyze the corrosion rate and other electrochemical kinetics of BQ steel in a specific electrolytic condition to evaluate the inhibition efficiency. In particular, these investigations are concerned with the manifestation of the inhibition efficiency, corrosion current density, \(i_{{{\text{corr}}}}\), charge transfer resistance \(R_{{{\text{ct}}}}\), and many other electrochemical parameters.

OCP measurements

The open-circuit potential (OCP) (\(E_{{{\text{oc}}}}\)) is the developed potential between the electrolyte and the working electrode when no external current is applied. As no external current is applied, OCP is sometimes referred to as zero-current potential. The term OCP is also interchangeable with corrosion potential. OCP is an important parameter in electrochemical operations since it indicates the stability of the system, which is significant for any perturbation-based experiments. The system under investigation should attain a steady-state by allowing OCP to be stabilized before proceeding with any subsequent electrochemical studies. Once the OCP has achieved stability, it is assumed that the steady state has been reached, the perturbation-based experiments can be performed. The time required for establishing the stable OCP might range from a few minutes to several hours, depending on the reaction. For the purpose of experimentation, an automated system records the OCP values over a period of time until the average OCP becomes stable. Once the stability of the system is confirmed, then the system is ready for any perturbation-based experiment (Shabani-Nooshabadi and Ghandchi 2015).

To achieve stability in the system, the average OCP values were obtained by recording the OCP values for 60 min. Different OPE concentrations were applied in both acidic media and were compared with the control solution. The variations in OCP with regard to time are shown in Fig. 3a, b. It is apparent from the figures that, when inhibitors are present, the OCP tends toward positive values as compared to when inhibitors are absent. More importantly, when the concentrations increase from 50 to 200 mgL−1, the plots begin to shift in a more positive direction. The changes of OCP in the positive directions are considered as an improvement in the OCP due to the establishment of the stable, protective layer on BQ (Singh and Quraishi 2016; Salinas-Solano et al. 2018; Naghi Tehrani et al. 2021). The formation of protective layer is accomplished in two step process. The first physical adsorption occurs and then chemical transformation (polymerization) leads the molecule to adsorb on the surface (Vorobyova and Skiba 2021).

Fig. 3
figure 3

OCP curves for BQ steel without and with different concentrations of OPE in (a) HCl and (b) H2SO4

Potentiodynamic polarization tests

Understanding the electrochemical kinetics of surface corrosion necessitates a potentiodynamic polarization or Tafel polarization study. Tafel graphs for OPE in HCl and H2SO4 media are shown in Fig. 4a, b, respectively, to illustrate the effects of polarization. The various corrosion parameters, including the density of corrosion current (\(i_{{{\text{corr}}}}\)), corrosion potential (\(E_{{{\text{corr}}}}\)), cathodic (\(b_{{\text{c}}}\)) and anodic (\(b_{{\text{a}}}\)) slopes, were obtained using extrapolation method and are shown in Table 2 along with inhibition efficiency (\({\text{IE}}\)).

Fig. 4
figure 4

Tafel polarization curves for BQ steel without and with different concentrations of OPE in (a) HCl and (b) H2SO4 media

Table 2 Electrochemical parameters obtained from Tafel polarization at different concentration OPE in HCl and H2SO4

The potentiodynamic studies show that the OPE reduces the anodic and cathodic currents, indicating a decrease in the corrosion rate. In the absence of OPE, both anodic and cathodic currents increase. This is owing to increased anodic metal dissolution and cathodic hydrogen evolution in both acidic media. It is also noticed that in the presence of OPE, the Tafel curves shift toward positive on anodic sides in both the acidic media. Although the curves shift toward the anodic site, it is not an anodic inhibitor as the shift is less than 85 mV. So, it is considered as mixed-type inhibitor. Also, \(i_{{{\text{corr}}}}\) and the Tafel constants \(b_{{\text{c}}}\) and \(b_{{\text{a}}}\) were affected by the addition of inhibitors. So it is clearly seen that OPE acts as mixed-type of inhibitor (Verma et al. 2018b).

It can be seen in Table 2 that the \(b_{{\text{a}}}\) is consistently greater than the \(b_{{\text{c}}}\) in every trial, indicating that the inhibitors are more effective at reducing anodic current than cathodic current. A further demonstration of the impact of OPE on the decrease of corrosion reactions is provided by \(i_{{{\text{corr}}}}\) measurement. In the presence of OPE in both HCl and H2SO4 environments, the values of \(i_{{{\text{corr}}}}\) have reduced significantly, and the reduction is even more in the presence of higher concentrations of OPE. The low \(i_{{{\text{corr}}}}\) values at high concentrations of OPE suggest that the corrosion rate is decreased, which is consistent with the fact that the corrosion rate is directly related to \(i_{{{\text{corr}}}}\). Furthermore, it is also found that the \(R_{{\text{P}}}\) values decreased with increase in OPE concentrations. In both acidic media, the decreasing \(i_{{{\text{corr}}}}\) and increasing \(R_{{\text{P}}}\) suggest that the OPE protects the BQ surface from corrosion by establishing a strong barrier that prevents the active reaction site of corrosion from being formed. Additionally, the values of inhibitory efficiency \(\left( {\mu_{P} \% } \right)\) indicates that a high concentration of OPE inhibitor significantly increases the \(\mu_{P} \%\) (Okafor et al. 2010; Prabakaran et al. 2016).

EIS measurements

EIS is a commonly used method for analyzing corrosion, passivation, and charge transfer processes at the electrode/electrolyte interface. The EIS study uses Nyquist and Bode charts to illustrate the impedance responses to the frequencies. The Nyquist and Bode plots are represented in Figs. 5 and 6, respectively, in both HCl and H2SO4 media in the absence and presence of different doses of OPE. The Nyquist plots of uninhibited and inhibited solutions have similar patterns. However, the semicircle plots are slightly depressed because of the surface heterogeneity on BQ steel. The shapes and patterns are similar, suggesting that the OPE inhibitors have no effect on the corrosion mechanism in both acidic media. These semicircles are distinguished by the presence of a big capacitive loop at higher frequencies and an inductive loop at lower frequencies. The capacitive loop is usually associated with the charge transfer in the double layer of the surface, and the inductive loop is resulted from the relaxation of the intermediate products in the corrosion process. The absence of the inductive loop in the presence of OPE is often considered a “degradation” event for EIS, suggesting full inhibitor molecule coverage on the steel surface (Zheng et al. 2014). These geometries, together with the patterns of Nyquist plots and the Bode plots, imply that the metal–surface interactions are mainly controlled by charge transfer reactions. As a result, the generated resistance on the surface is likewise regulated by the charge transfer resistance \((R_{{{\text{ct}}}} )\). The value \(R_{{{\text{ct}}}}\) was by measuring the diameters of the capacitive loops or semicircles. The existence of single-time constant in the electrochemical process is indicated by semicircle in Nyquist plots and single narrow peak in Bode plots (phase angle plots) (Fig. 6a, b). The phase angles of Bode plots (90° or 0°) imply capacitive or resistive characteristics of the surface–solution interface. No pure capacitive behavior was observed from any of the plots since the phase angles were all less than 90°. But the increased peak heights certainly at higher inhibitor concentrations suggest a stronger capacitive response of the metal solution interface, which is consistent with previous findings. The peak points of the phase angle plots are also not fixed on a single frequency, so the capacitance varies accordingly. The changes in values of impedance with OPE concentration in Bode modulus curves match with the trend of semicircle diameter variation of the Nyquist plots (Mourya et al. 2014; Saxena et al. 2018c; Pal and Das 2022). The Nyquist plots in Fig. 5a, b show that the diameters of the semicircles become larger as the OPE concentration increases, indicating a greater charge transfer resistance \((R_{{{\text{ct}}}} )\). At higher OPE dose, the higher values of logz∣ at lower frequencies indicate resistance in both acidic conditions by adsorbed OPE inhibitors on the surface of the surface.

Fig. 5
figure 5

Nyquist plots of BQ corrosion in acidic media without and with different concentration of OPE: (a) HCl and (b) H2SO4 media

Fig. 6
figure 6

Bode plots of BQ corrosion in acidic media without and with different concentration: (a) HCl and (b) H2SO4 media

An equivalent circuit model was used to fit EIS spectra and numerous parameters, including solution resistance \(\left( {R_{{\text{s}}} } \right)\), charge transfer resistance \((R_{{{\text{ct}}}} )\), and constant phase element (CPE) were computed to understand how the inhibitor inhibits corrosion on the metal surface (Fig. 7). For the fitting, a basic Randles circuit was employed, which is made up of \(R_{{\text{s}}}\) in series with \(R_{{{\text{ct}}}}\) and CPE, a replacement for an ideal double-layer capacitance of dispersed frequency with \(R_{{{\text{ct}}}}\) and CPE in parallel. There are many different electrical components like a capacitor, resistor, and inductor, which help to explain the physical electrochemistry of any solution–surface interface. Conventionally if the surface is not homogeneous, then the capacitor is replaced by a constant phase element (CPE) to simulate the heterogeneity of the surface. The impedance in CPE can be expressed using the following formula below:

$$Z_{{{\text{CPE}}}} = \frac{1}{{Y_{O} \left( {j\omega } \right)^{n} }}$$
(26)

where impedance of the CPE is denoted as, is a proportional factor and also referred as admittance, \(n\) is CPE exponent (or phase shift) which provides the information about in-homogeneity of surface, \(j\) represents the imaginary number, and \(\omega\) denotes angular frequency (\(\omega = 2\pi f\)) in rad s−1. The CPE represents different elements depending on the value of \(n\), like when \(n = 0\), \(Y_{o} = R\) (resistance); \(n = 1\), \(Y_{o} = C\) (capacitance) or \(Y_{o} = L\) (inductance), and \(n = 0.5\), \(Y_{o} = W\) (Warburg impedance). The double-layer capacitance \(\left( {C_{{{\text{dl}}}} } \right)\) of CPE belonging to the modeled circuit on the BQ steel/electrolyte can be evaluated from \(Y_{o}\), \(\omega_{\max }\), and \(C_{{{\text{dl}}}}\) (Eq. 27).

$$C_{{{\text{dl}}}} = \frac{{Y_{o} }}{{\left( {\omega_{\max } } \right)^{n - 1} }}$$
(27)
Fig. 7
figure 7

Model of an equivalent circuit for fitting the impedance data points and its physical significance on corrosion BQ steel in the presence of inhibitors

\(\omega_{\max }\) (rad s−1) is considered as the angular frequency at which the imaginary part of the impedance is maximum in the Nyquist plot (M’hiri et al. 2016; Srivastava et al. 2018; Verma et al. 2018b).

Both the Nyquist plots and the Bode plots show that in acidic environments, higher OPE concentrations result in increased surface resistance. By showing the variations in impedance parameters at various concentrations of OPE, Table 3 draws the attention to learn more about the surface behaviors of BQ steel in the presence and absence of inhibitors in both acidic media. In both the HCl and H2SO4 medium, it is evident that the values of \(R_{{{\text{ct}}}}\) increase as the concentration of OPE increases, while the CPE values are dropped as the concentration of OPE increases. These changes in EIS values suggest that inhibitor chemicals have accumulated at the metal–acid contact, resulting in the formation of a thin protective layer. This layer restricts the charge flow from the bulk electrolyte to BQ surface by blocking the corroding agents, which induces local sites of corrosion. The thickness of the layer grows as OPE concentration rises, further decreasing corrosion risk. So, the more BQ steel surface is covered, the less chance of corroding components coming into touch with the steel surface. (Ji et al. 2015; Wang et al. 2019).

Table 3 Impedance parameters for the corrosion of BQ steel in HCl and H2SO4 solutions containing different concentrations of OPE

Adsorption studies

The findings of electrochemical experiments have already confirmed the occurrence of adsorption on the BQ surface and shed insight on the mechanism of electrochemical interaction between BQ steel surface and inhibitory compounds. Therefore, it is necessary to understand the kind of adsorption, which may be either physisorption, chemisorption, or a combination of the two types. Three widely used adsorption isotherms, Langmuir (Fig. 8a, b), Temkin (Fig. 8c, d), and Frumkin (Fig. 8e, f), were used to determine the type of adsorption. These isotherms establish relationships between inhibitor concentration (C), surface coverage (\(\theta = \mu_{{{\text{R}}_{{{\text{ct}}}} }}\) 100−1), and the adsorption equilibrium constant (\(K_{{{\text{ads}}}}\)). After computing the slopes, intercepts, and regression coefficients (\(R^{2}\)) for all of the isotherms tested, the Langmuir model (Fig. 8a, b) was shown to have the best fit.

Fig. 8
figure 8

(a, b) Langmuir, (c, d) Temkin, (e, f) Frumkin adsorption isotherm plots using OPE in HCl and H2SO4

The Langmuir isotherm can be expressed in the straight-line equation as the given equation:

$$\frac{C}{\theta } = \frac{1}{{K_{{{\text{ads}}}} }} + C$$
(28)

To obtain the value of \(K_{{{\text{ads}}}}\) (Lg−1) \(\frac{C}{\theta }\) was plotted against \(C\) (gL−1)r. \(K_{{{\text{ads}}}}\) is the adsorption equilibrium constant from which the adsorption free energy, also known as standard Gibbs free energy (\(\Delta G_{{{\text{ads}}}}^{^\circ }\)), can be calculated using the following expression:

$$\Delta G_{{{\text{ads}}}}^{^\circ } = - RT\ln \left( {C_{{{\text{water}}}} K_{{{\text{ads}}}} } \right)$$
(29)

where \(R\) is universal gas constant (8.314 Jmol−1 K−1), \(C_{{{\text{water}}}}\) represents the concentration of water (1000 gL−1), and \(T\) is temperature (298.15 K). The derived linear regression coefficient \((R^{2} )\) from the Langmuir plot, as well as \(\Delta G_{{{\text{ads}}}}^{^\circ }\) and \(K_{{{\text{ads}}}}\) is shown in Table 4 with the other variables.

Table 4 Parameters of adsorption isotherm for OPE in HCl and H2SO4

The earlier studies have revealed that the value of \(\Delta G_{{{\text{ads}}}}^{0}\) indicates the nature of adsorption. The negative values of \(\Delta G_{{{\text{ads}}}}^{0}\) indicate the spontaneous adsorption of inhibitory compounds of OPE on the BQ plate. When \(\Delta G_{{{\text{ads}}}}^{0} { }\) value is around − 20 kJmol−1 or less negative, then the interaction is only electrostatic then the adsorption is considered as physisorption. On the other hand, when \(\Delta G_{{{\text{ads}}}}^{0}\) value is equal or more negative than − 40 kJmol−1, then the interaction is associated with charge transfer, i.e., chemisorption (Azmi and Soedarsono 2018; Verma et al. 2018b). The values of \(\Delta G_{{{\text{ads}}}}^{0}\) in Table 4 indicate that the adsorption in this study is actually physicochemical, as the values in both acidic media lie between − 20 kJmol−1 and − 40 kJmol−1.

Characterization of surface

FESEM-EDX

The FESEM tests were carried out in both acidic media with and without OPE to assess surface morphology and validate interpretations gained from gravimetric and electrochemical investigations. FESEM pictures in Fig. 9a, b show the changes on the BQ surface when OPE (200 mgL−1) was applied to HCl solution. Similarly, Fig. 9c, d depicts the changes on the BQ surface upon applying OPE in 0.5 (M) H2SO4 solution. Without OPE, the surface was corroded due to aggressive anodic and cathodic reactions, which produced fractures and pits. However, when OPE was incorporated in both acidic media, such severely damaged structures were not visible on the surface. The incorporation of OPE brought a significant change in the microstructure of BQ, which was observed in both acidic media. The adsorption of the phenolic compounds of OPE on BQ surface developed a protective layer, which then blocked the active reaction sites and slowed down corrosion response. As a consequence, in the presence of OPE, fewer fractures and pits are visible on the surface (Zheng et al. 2014).

Fig. 9
figure 9

FESEM images of BQ steel sample after corrosion (a) without OPE in 1 M HCl, (b) in the presence of OPE (200 mg L−1) in 1 M HCl, (c) without OPE in 0.5 M H2SO4, and (d) in the presence of OPE (200 mg L−1) in 0.5 M H2SO4

The elementary changes of BQ surface by OPE were investigated using EDX, and the spectrums are shown in Fig. 10. Figure 10a demonstrates the lower iron (62.0%) and higher chloride (9.3%) weight percentage in the absence of OPE than the iron (68.7%) and chloride (0.9%) in the presence of OPE (Fig. 10b). Same way, in the case of H2SO4 media, the lower iron (69.7%) and higher sulfur (6.2%) weight percentage in the absence of OPE (Fig. 10c) than the iron (89.9%) and sulfur (1.4%) weight percentage in the presence of OPE (Fig. 10d) are observed. For various redox reactions to occur, the Fe2+ on the surface electrostatically attracts the Cl, resulting in Cl being adsorbed on the surface. In contrast, since SO42− is less electronegative than Cl, the likelihood of sulfur being adsorbed on the surface in the H2SO4 medium is lower than that of Cl. So the increase in iron weight % indicates that the surface is protected by the inhibitor layer and is more resistant to the aggressive attacks by corrosive components (Naghi Tehrani et al. 2021).

Fig. 10
figure 10

EDX spectra of BQ steel sample after corrosion (a) without OPE in 1 M HCl, (b) in the presence of OPE (200 mg L−1) in 1 M HCl, (c) without OPE in 0.5 M H2SO4, and (d) in the presence of OPE (200 mg L−1) in 0.5 M H2SO4

AFM study

The AFM investigation of a 20 × 20 µm2 area from the steel surface demonstrated the adsorption of OPE in both HCl and H2SO4 solutions. The 3-D AFM images of the steel surfaces show the differences in the average surface roughness between the uninhibited and the inhibited surface in both the acidic solutions (Fig. 11). It is apparent from Fig. 11 that the presence of OPE (200 mgL−1) made a significant reduction in average surface roughness. In the control HCl media, the average surface roughness was 284.4 nm (Fig. 11a), while the addition of OPE reduced the roughness (19.83 nm) (Fig. 11b). Similarly, in H2SO4 media, the average surface roughness was 278.7 nm without OPE (Fig. 11c), and 15.17 with OPE (Fig. 11d). The decrease in roughness is mostly due to the adsorption of the organic compounds in OPE on the surface of the material (Prabakaran et al. 2016; Singh and Quraishi 2016; Srivastava et al. 2018).

Fig. 11
figure 11

3D AFM images obtained for the surface morphology of BQ steel sample after corrosion (a) without OPE in 1 M HCl, (b) with OPE (200 mg L−1) in 1 M HCl, (c) without OPE in 0.5 M H2SO4, and (d) with OPE (200 mg L−1) in 0.5 M H2SO4

Theoretical studies by quantum chemical calculations using DFT

The fundamental corrosion prevention mechanism of OPE on BQ steel was examined electrochemically. To know the molecular mechanism of inhibition, one must comprehend the relationship between corrosion inhibition and inhibitory molecule structures. Quantum level simulations provide crucial insights into the relationship between structure and inhibition efficiency if inhibitory molecules (Mourya et al. 2014).

Quantum chemical parameters

Molecular orbital theory (FMO) is one of the most widely used approaches for performing quantum chemical computations. As per the FMO theory of chemical reactivity, the formation of a transition state is dependent on the interactions between FMOs (HOMO and LUMO). Therefore, the HOMO and LUMO are considered significant indicators to analyze any adsorption or chelation process. As inhibition of corrosion is based on the principle of adsorption, the analysis of HOMO and LUMO is significant with respect to the efficiency of the inhibitor (Mourya et al. 2014). HOMO locations are known to be electron donors and adsorption sites due to the abundance of electrons in π bonds, benzene rings, and also various heteroatoms, while LUMO areas are known to be electron acceptors (Ganash 2018). It is well known that ionization potential \(\left( I \right)\) indicates the donation capability of a compound to d-orbitals of the metal and electron affinity \(\left( A \right)\) indicates the electron acceptance propensity from the metal. So these two parameters can also be significant indicator of an efficient inhibitor (Hsissou et al. 2021). All the parameters were determined in the gas phase as well as in the aqueous phase since the phenomenon of corrosion occurs mostly in humid conditions.

Quercetin has been identified as a significant inhibitor compound based on LCMS findings. Figure 12 shows pictures of the optimized structure and the FMO sites of the detected inhibitory compound from OPE. The electronegativity characteristics and the presence of π electron clouds of the compound are reflected in the colored lobes, which are green and red. The more electronegative areas are depicted by red lobes, while the green lobes represent the less electronegative areas (Nofrizal et al. 2012). The delocalization of electrons from both HOMO–LUMO regions is occurred to build an optimum interaction involving most of the areas of molecule (Fig. 12) (Verma et al. 2018b). As a result, substantial atoms from such HOMO–LUMO areas make stable interaction with the BQ steel. These interactions are mostly dependent on the ability of different single atoms, phenyl rings, and functional groups of the HOMO–LUMO regions either to donate electrons onto the steel surface or from the steel surface (Ganash 2018). For the quercetin molecule, the energy values of HOMO and LUMO), as well as the related quantum chemical parameters, were determined and reported in Table 5.

Fig. 12
figure 12

The electron density distribution of quercetin monomer

Table 5 Various quantum parameters of quercetin molecule in gas and aqueous phase

It is well known that a larger \(E_{{{\text{HOMO}}}}\) shows a greater proclivity to transfer electrons to a lower-energy orbital level. As a result, a larger \(E_{{{\text{HOMO}}}}\) value improves the interaction between the surface and molecule, resulting in better adsorption of the molecule on the surface. Lower \(E_{{{\text{LUMO}}}}\) value indicates that the molecule is more likely to receive an electron from higher-energy orbitals, making it also more efficient to be adsorbed on the surface (Liao et al. 2018). Table 5 shows that quercetin has a LUMO value (− 1.964 eV) and HOMO value (− 5.744 eV). According to the literature, the energy gap (\(\Delta E\)) is a reactivity and stability indicator. Low \(\Delta E\) causes the molecule to be more reactive when interacting with another one because it takes less energy to move electrons from one orbital to another. It was observed that quercetin in the aqueous phase is more reactive than the gas phase as the energy gap (\(\Delta E\)) in the aqueous phase (3.732 eV) is slightly lower than in the gas phase (3.780 eV) (Table 5) (Verma et al. 2018b). Furthermore, its electronegativity, softness, and global hardness were also computed. It had been observed from Table 5 that the quercetin molecule was less hard in the aqueous phase (1.866 eV) than the gas phase (1.890 eV). When it comes to hardness, it is basically the resistance to distortion or polarization of the electron cloud of atoms, ions, or molecules when a chemical reaction is perturbed by a little amount (Verma et al. 2018b; Hsissou et al. 2021). In addition, the fraction of transferable electrons (from the inhibitor is higher than zero in both phases, which suggests that the quercetin molecule is efficient enough to transfer the electrons to the metallic surface. However, the value of is slightly higher in gas phase (0.832) than in the aqueous phase (0.790) but the difference is negligible (Belghiti et al. 2019).

The Fukui indices of quercetin were investigated in order to identify local reactive sites. These indices help to detect the electrophilic and nucleophilic sites of the investigated molecules. Because of the adsorbed anions on the positively charged surface of the BQ, the surface of the BQ may be negatively charged, or it may be positively charged in an acidic medium. The molecule is prone to nucleophilic attack where values are large as those sites can stabilize supplementary electrons. Conversely, the electrophilic attack is more likely to be initiated at the sites where values are large (Ganash 2018; Liao et al. 2018; Verma et al. 2018b; Belghiti et al. 2019; Naghi Tehrani et al. 2021).

Table 6 lists some of the highest (electrophilic) and (nucleophilic) values obtained from these atoms. According to Table 6, C3, C9, C15, O23, H28 with the highest values are electrophilic where the nucleophilic attack occurs (back donation from the metal surface to the molecule), whereas C1, C4, C6, O31, O32 atoms (electron donator or nucleophilic) with are the sites for an electrophilic attack. Table 6 displays the values of a which show the atoms with > 0 are electrophilic (C3, C9, C15, O23, H28), and the atoms with < 0 are nucleophilic (C1, C4, C6, O31, O32) (Liao et al. 2018; Hsissou et al. 2021). The order of the electrophilic sites is C3>C9>C15>O23>H28 and the nucleophilic sites are C1>C4>C6>O31>O32> (Fig. 13) (Belghiti et al. 2019).

Table 6 Fukui function with highest \(f_{{\text{k}}}^{ + }\), \(f_{{\text{k}}}^{ - }\), and \(f_{{\text{k}}}^{2}\), values of some atoms from quercetin
Fig. 13
figure 13

Graphical representation of the dual descriptors of some electrophilic and nucleophilic sites from quercetin

Mechanism of inhibition

According to the results of the Tafel polarization experiments, the amplitude of the anodic shifts is not similar in both media. As the anodic dissolution occurs in the absence and presence of an inhibitor, it may be described by the process of anodic dissolution. The anodic processes in H2SO4 and HCl environments have separate mechanisms, as discussed below.

Anodic reaction

The electro-dissolution of iron in acidic sulfate solution is mainly influenced by the adsorption intermediated FeOHads, which are formed throughout the dissolving process. The iron dissolution in HCl media differs from the dissolution of iron in the H2SO4 medium. The (FeCl)ads are responsible for anodic dissolution in HCl, whereas the (FeOH)ads are responsible for anodic dissolution in H2SO4. When the inhibitor is applied to an acidic media, several reaction phases occur depending on the electrolyte and the anodic dissolution mechanism. As a result, the variation in the anodic curve of Tafel slopes is due to the different anodic dissolution processes. The detailed reaction mechanism and the differences in the mechanism are shown in Supplementary Material.

Cathodic reaction

The cathodic reactions (hydrogen evolution) are mainly influenced by the H+ and protonated inhibitor (InhH+). These two species compete for the same active site of the BQ steel surface to be adsorbed on the surface. The Tafel plots (Fig. 4) portray that cathodic curves are approximately parallel, indicating the cathodic activation-controlled nature of the reaction. From the activation-controlled nature of the cathodic reactions in the above equations, the first step is likely to be the rate-controlling step (Mourya et al. 2013).

In addition to dissolving Fe2+, the anodic reaction also creates hydrogen gas. Whenever inhibitors are added to an acidic medium, they are protonated and begin to adsorb on the charged surface. The adsorbed Cl of the surface attracts the protonated inhibitor (physisorption) (Fig. 14). At high inhibitor concentration, the protonated inhibitors may compete with other cationic species to bind onto nucleophilic sites (Al-Moubaraki 2015). The protonated inhibitors return to their neutral form once they accept electrons from metallic surfaces. Then, the lone pair electrons of the heteroatoms in the inhibitory molecules initiate chemical adsorption (Srivastava et al. 2018). As the surface gets completely saturated with electrons, it becomes negatively charged. In order to surplus, the excess electrons from the surface the “d” orbital electrons of iron are may get transferred to the empty π (antibonding) orbital of the OPE molecules via the mechanism of retrodonation, which leads to more strong adsorption of the inhibitor onto the BQ surface (Saxena et al. 2018d, 2018b; Srivastava et al. 2018).

Fig. 14
figure 14

Schematic representation of corrosion inhibition mechanism in acidic medium

It is also necessary to explore the energy difference between the LUMO of iron and the HOMO of quercetin \(\left( {E1} \right)\), as well as the difference between the LUMO of quercetin and the HOMO of iron (\(E2\)), to understand the inhibitory function (Fig. 15). In Fig. 15, it has been observed that the \(E1\) value (3.996 eV) is higher than \(E2\) (3.116 eV) value which suggests that the flow of electrons from the iron to quercetin molecule is easier than from the quercetin to iron. So from these pieces of information, it can be concluded that quercetin molecules were attracted to a BQ steel surface by electrostatic interactions. Following that, quercetin molecules formed a chemical bond with iron molecules by donating electrons to iron and accepting electrons from iron (back donation) (Srivastava et al. 2017; Khanra et al. 2018).

Fig. 15
figure 15

Schematic representation of HOMO and LUMO energy levels of iron and quercetin

Conclusions

It is possible to infer from the current experimental and computational studies that the OPE, which was isolated from a kitchen waste (onion peel), is a viable green inhibitor that is both environmentally benign and effective. Experimental studies in 1 (M) HCl and 0.5 (M) H2SO4 on the BQ surface, as well as theoretical research compound of OPE, were carried out in order to determine the efficacy of OPE as green corrosion inhibitors. The following conclusions have been drawn after doing all of the experiments:

  1. 1.

    Quercetin was identified as the most abundant compound in OPE by LCMS analysis.

  2. 2.

    The studies of Tafel polarization have revealed that the OPE acts as a mixed-type inhibitor on the BQ steel surface. It also disclosed that the corrosion current \((i_{{{\text{corr}}}} )\) was 179.06 µA cm−2 and 180.25 µA cm−2 in 1 (M) HCl and 0.5 (M), respectively, in the absence of OPE. The minimum corrosion current \((i_{corr} )\) was found as 16.80 µA cm and 17.48 µA cm−2 at 200 mg L−1 of OPE in 1 (M) HCl and 0.5 (M) H2SO4. The polarization resistance (\(R_{{\text{P}}}\)) was also changed from 101.17 to 993.68 Ω cm2 and from 104.62 to 873.81 Ω cm−2 in HCl and H2SO4 medium on the addition of OPE.

  3. 3.

    The protectiveness of OPE was further proved by EIS measurements as the presence of OPE has reduced the charge transfer resistance. The charge transfer resistance \((R_{{{\text{ct}}}} )\) was found as 89.72 Ωcm2 and 85.08 Ω cm2 in 1 (M) HCl and 0.5 (M) H2SO4 media without incorporating inhibitor. However, with OPE (200 mg L−1) \(R_{{{\text{ct}}}}\) was increased in both HCl (1031.80 Ωcm2) and H2SO4 media (916.18 Ωcm2). The inhibition efficiency calculated \(R_{{{\text{ct}}}}\) was found maximum 91.30% and 90.71% after incorporating 200 mg L−1 of OPE in both media.

  4. 4.

    The inhibition of corrosion was caused by adsorption of OPE, as the value of Kads (47.55 L g−1 in HCl and 38.87 L g−1 in H2SO4) and ∆G°ads (− 19.53 kJ mol−1 in HCl and − 19.02 kJ mol−1 in H2SO4) has also supported. The Langmuir isotherm was identified for OPE adsorption on BQ steel. The Kads and ∆G°ads values showed thermodynamic adsorption favorability.

  5. 5.

    As shown by investigations in FESEM, EDX, and AFM, the development of a protective layer by OPE on the BQ steel significantly reduced the rate of corrosion.

  6. 6.

    Quantum chemistry calculations revealed that quercetin had a shorter energy gap in the aqueous phase than in the gaseous phase, resulting in a more potent inhibitory effect.