1 Introduction

Due to its superior mechanical qualities and affordable price, carbon steel (C-steel) is used in a variety of sectors. It has widespread application in construction throughout many industries, as well as in water cooling systems, heat exchangers, and oil and gas transport pipes. However, it suffers from corrosion when it meets many corrosive solutions [1,2,3,4,5]. As a result, applying corrosion inhibitors is thought to be one of the most popular techniques used to improve metal shielding and durability against corrosion. The inhibitor molecules adhere to the metallic surface, creating a barrier that prevents the corrosive atmosphere from reaching the outermost layer of the metal. The most effective technique for protecting metal from corrosion across all possibilities is the use of corrosion inhibitors, which have a high level of effectiveness, financial benefits, and a broad range of applications [6,7,8,9,10,11,12]. Considering their compatibility with the environment, organic molecules are receiving a lot of research attention as corrosion inhibitors. Many corrosion inhibitors like expired drugs, plastic waste, and polymeric materials have recently been considered as environmentally eco-friendly inhibitors [13,14,15,16,17,18,19,20,21,22,23]. The main factor impacting the adsorption of such compounds on metal surfaces is the existence of heteroatoms, such as oxygen, nitrogen, and sulfur, in the molecules of these compounds as functional groups like carboxyl, amines, etc., as electron-donating groups, polar groups, and π electrons [24,25,26,27,28,29,30,31,32,33,34,35]. Ionic Liquids are water soluble and potential inhibitors for metal corrosion, and also have many advantages as environmentally friendly corrosion inhibitors, since there has been an increase in ecological awareness and a change in the regulations that govern the toxicological effects of effective corrosion inhibitors, these substances need attention [36,37,38].

Straight-chain aliphatic compounds including carboxylic acid groups can inhibit the corrosion of C-steel corrosion especially that has a larger number of carbon atoms in the molecules. It has been investigated how Fe corrodes in sulfate solutions when monocarboxylic acids with 6–10 carbon atoms are present [39]; The findings indicated that, if the concentration is more than a particular minimum value, the effectiveness of corrosion prevention grows by increasing the number of carbon atoms. A brief review of the inhibition effect of some ionic liquids, ILs, as inhibitors for corrosion carbon steel in HCl solution, was recently reported by Souza et al. [40]. The authors explained that ILs are capable of inhibiting C-steel corrosion in HCl solution and all the examined ILs were mixed-type inhibitors that can easily adsorb on the surface of C-steel [40,41,42]. Mighaed et al. used imidazolium ionic liquids to inhibit the corrosion of C-steel in deep oil well formation water [43]. Their study indicated that 500 ppm of 1-(2-aminoethyl)-1-dodecyl-2-heptadecyl-4,5-dihydro-1H-imidazol-1-ium gives an inhibition efficiency of 94.68%. Although we are aware that there is no study about the use of ILs as inhibitors in diluted formation water little work was done on the synthetic and concentrated oil field formation water [43,44,45].

Furthermore, the addition of inorganic halide ions such as I is one of the most effective methods to enhance the organic inhibitor's efficiency and increase the adsorption tendency by forming interconnecting bridges between the organic inhibitor and the charged active centers on the metal surface [46, 47]. So, synergism is a potential approach to enhance the inhibitor's performance or reduce their injection dosage [48, 49].

This work aims to study some factors that affect the inhibitive effect of the synthesized ionic liquids such as the chain length of C atoms in each ionic liquid, IL, the molecule of the aliphatic chain of fatty acids. The effect of temperature on the inhibition efficacy, and the effect of the addition of I ions towards the corrosion mitigation and synergism phenomena on the surface of C-steel in oil field-produced water.

2 Materials and methods

2.1 Materials and chemicals

2.1.1 Carbon steel

The used carbon steel C1018 samples were obtained from General Petroleum Company, and are described before [3, 5] with elemental analysis estimated as weight percent listed in Table 1. C-steel specimens of chemical composition tabulated in Table 1 with dimensions 7.5 × 1.2 × 0.1 cm with two holes of radius 0.4 cm (exposed surface area 17.5 cm2) were used for weight loss measurements. Before carrying experiment, the steel surface was polished using abrading emery papers with different grades. The prepared C-steel specimens were degreased with acetone, washed with double-distilled water, and then air-dried.

Table 1 Chemical composition of the carbon steel coupon (wt%)

2.1.2 Chemicals

Diethanolamine with purity ≥ 98%, butanoic acid with purity ≥ 99%, octanoic with purity ≥ 98%, and decanoic acid with purity ≥ 99% were purchased from Sigma-Aldrich company (United States) without any further purification. These materials are required for preparing the different ionic liquids.

2.1.3 Formation water

The oil field produced water, formation water-free of oils and greases, FW, was utilized as the corrosive solution in the current study. Samples of formation water were taken from General Petroleum Company well, Egypt, in western desert fields, Northeast Sannan, NES-4 in a depth of 2415–2435 m underground that was associated with crude oil. The test solution was prepared by diluting the oil-field-produced water into, 10%, 50%, and 90% of the formation water using distilled water for dilution. The physical and chemical analysis of the oil-field-produced water, formation water was listed in Table 2 [3].

Table 2 Physical and chemical analysis of the oil-field-produced water, at 25°C

2.1.4 Synthesis of inhibitors

Diethanolamine (0.1 mol) was added to a 100 ml two-necked spherical bottom flask supplied with a magnetic stirring device. This equipment included a reflux condenser and constant, vigorous mixer under nitrogen, then, 0.1 mol from the fatty acid is added to the equipment. The required fatty acids butanoic, octanoic, and decanoic acids, were injected into the system individually and slowly poured for 15 min. The solution was mixed overnight at 50 °C before being washed with acetone to eliminate any contaminants. The whole last three products were vacuum evaporated at the same temperature for 24 h to get bis(2-hydroxyethyl) ammonium butanoate (IL-4), bis(2-hydroxyethyl) ammonium octanoate (IL-8), and bis(2-hydroxyethyl) ammonium decanoate (IL-10) with yields of 89, 87.6 and 85%, successively. Table 3 shows the studied molecular structure and molecular formulas of such synthesized inhibitors. The molecular structure of such compounds was confirmed using different spectroscopic techniques. The prepared ionic liquids were easily soluble in the formation water.

Table 3 Molecular structures of the synthesized IL inhibitors

2.2 Weight loss measurements

Weight loss experiments were carried out when the C-steel samples were immersed in the investigated solutions for 8 h in diluted formation water (FW) such as 10%, 50%, and 90%. The influence of temperature was performed on 10% FW in the absence and presence of different additions of IL inhibitors varied between 50 and 500 ppm. The temperature influence was studied at 25, 35, 45, and 55 °C. Moreover, the synergistic effect of iodide ions was examined when 0.02 M KI was added, at 25 °C. After the exposure time, the C-steel sheets were carefully taken to wash with distilled water, and acetone, dried, and weighed. Such measurements are performed using a digital balance with an accuracy of ± 0.1 mg and an open-air electric water bath supported by a temperature controller.

3 Results and discussion

3.1 Effect of FW concentration

Figure 1 illustrates the change of weight loss (in mg cm−2) with the immersion time for C-steel when immersed in FW (10, 50, and 90%) throughout an exposure period extended to 8 h, at 25 °C. It is observed that the loss in weight is increased as the immersion time is increased, besides the decrease in the dilution of the FW.

Fig. 1
figure 1

Wight loss-time curves for C-steel immersed in different diluted formation water, at 25 °C

The 10% FW was chosen to investigate the inhibition influence of the synthesis ionic liquids (IL4, IL8, and IL10) on the corrosion of C-steel samples. The inhibitor concentration varied between (50–500 ppm) as depicted by curves of Figs. 2 for IL-10, at 25 °C. Similar curves are carried out for IL-4, and IL-8 (curves not shown). The data show a decline in weight loss with an increase in the inhibitor concentration. The data also indicate the loss in weight loss was less in the case of IL-10, which confirms the higher efficacy of IL-10.

Fig. 2
figure 2

Wight loss-time curves for C-steel in 10% FW in the absence and presence of different additions of IL-10, at 25 °C

The protection efficacy was concentration-dependent. To carry out a comparative view between the utilized ILs, the corrosion rate (CR) was computed using the equation [50, 51]:

$${C}_{R }= \frac{{W}_{b}- {W}_{a }}{t A}$$
(1)

where Wb and Wi represent the loss in weight for the C-steel sample before and after immersion in the examined solution, t is the immersion time, and A is the area of the C-steel sample. The inhibition efficacy, IE %, for the different ILs was computed utilizing the equation [50, 51]:

$$IE=\frac{{C}_{R (b)}- {C}_{R(i) }}{{C}_{R(b) }}\times 100$$
(2)

where CR(b) and CR(i) are corrosion rates in the absence and presence of an inhibitor, respectively. Table 4 lists the corrosion rate, CR, surface coverage,\(\theta ,\) and protective efficacy, IE %, of the different inhibitors for corrosion of C-steel in 10% FW, at 25 °C. The data of Fig. 1 and the similar curves, as well as the data listed in Table 4, indicated that:

Table 4 Corrosion parameters were obtained from weight loss of C-steel in 10% formation water solutions containing various concentrations of ILs at different temperatures
  1. (i)

    In the inhibitor-free FW the corrosion rate, CR, is decreased as the percent of dilution is increased due to the lowering in the concentration of the corrosive ions, Cl, S2−, and SO42−. These ions induced pitting corrosion for C-steel in the FW, as indicated recently by pitting current measurements [3].

  2. (ii)

    The corrosion rate, CR, is increased by increasing the immersion time and decreased by increasing the IL concentration.

  3. (iii)

    The surface coverage,\(\theta ,\) and protective efficacy, IE%, are increased by increasing the inhibitor concentration due to the formation of an adsorbed film through active centers located on the IL molecules.

  4. (iv)

    At a comparable inhibitor concentration, the values of \(\theta \), and IE% are increased in the following order: IL-4 < IL-8 < IL-10.

  5. (v)

    The effectiveness of such compounds towards the corrosion protection of C-steel in 10% FW, at 25 °C, is decreased in the order: IL-10 > IL-8 > IL-4.

3.2 Effect of temperature

The effect of temperature on the corrosion rate, CR, of C-steel samples immersed in 10% FW in the absence and presence of different concentrations of ionic liquids, ILs is studied at temperatures ranging from 25 to 55 °C, utilizing the gravimetric technique. The data indicated that the corrosion rate, CR increased with an increase in the temperature due to the acceleration of the corrosion reaction. Temperature increases the mobility of the ions which increases the chance of aggressive ions attacking the oxide film on the metal surface initiating localized pitting corrosion [52,53,54]. The surface coverage, θ, and the protection efficacy, IE % are computed and listed in Table 4. The rise in the inhibitor concentration reduced the rate of corrosion and increased the inhibition efficacy, IE %. The decrease in the protection efficiency values, IE %, for the examined ILs at high temperatures could be related to the desorption of several of the ILs molecules from the C-steel surface. Such behavior emphasizes the physically adsorbed molecules on the C-steel surface [55].

The values of CR are used to compute some of the activation thermodynamic parameters for the corrosion inhibition process. The energy of activation, Ea, is computed utilizing the Arrhenius equation [56]:

$$\mathrm{ln }{\mathrm{C}}_{\mathrm{R}}=\mathrm{B}-\frac{{E}_{a}}{RT}$$
(3)

where B is the Arrhenius pre-exponential constant and R is the universal gas constant. The slope (Ea/R) obtained from the Arrhenius plot, Fig. 3, in 10% FW in the absence and presence of different concentrations of IL-4 is used to calculate the activation energy (Ea) that is listed in Table 5. Similar Figures are obtained when IL-8 and IL-10 are used (curves not shown). It is found that the energy of activation, Ea*, increased with the increase in inhibitor concentration, and this is owing to the strong adsorption of the inhibitor molecules on the C-steel surface [57, 58].

Fig. 3
figure 3

Arrhenius curves for carbon steel with the addition of different concentrations of IL-4

Table 5 Activation parameters for the corrosion of carbon steel in 10% formation water solutions containing various concentrations of ILs

The enthalpy and entropy of activation for the carbon steel corrosion and corrosion inhibition are expressed using the transition state Eq. (4) [57, 59, 60]:

$${\mathrm{C}}_{\mathrm{R}}=\frac{RT}{Nh}\mathrm{exp }\left(\frac{{\Delta S}^{*}}{R}\right)\mathrm{exp }\left(\frac{{-\Delta H}^{*}}{RT}\right)$$
(4)

where h is Plank’s constant and N is Avogadro’s number. The slope of the straight lines gave \(\frac{{-\Delta H}^{*}}{R}\) and the straight lines gave intercept = ln\(\left(\frac{R}{Nh}\right)\) + \(\frac{{\Delta S}^{*}}{R}\), Fig. 4, in 10% FW in the absence and presence of different concentrations of IL-8. Similar Figures are obtained when IL-4 and IL-10 are used (curves not shown). The change in enthalpy of activation (∆H*) gave positive signs that reflect the endothermic nature of the metal dissolution process [59, 60]. The large negative values of entropy of activation (∆S*) in the absence and presence of an inhibitor imply that the activated complex in the rate-determining step represents an association rather than dissociation [61]. The change in the free energy of activation (ΔG*) for the corrosion process was calculated at 298 K by applying the well-known thermodynamic equation:

$$ \Delta {\text{G}}^{*} = \Delta {\text{H}}^{*} {-}{\text{T}}\Delta {\text{S}}^{*} $$
(5)
Fig. 4
figure 4

Transition state plots for C-steel in the absence and presence of different concentrations of IL-8

3.3 Adsorption isotherm

Different adsorption isotherms have been attempted for fitting the adsorption of the ionic liquid molecules IL-4, IL-8, and IL-10 on the C-steel surface in the FW. Langmuir model has shown the best fitting where it had the highest values of regression factor, R2, represented in Table 6, According to Langmuir isotherm C/θ was plotted against C to give a straight line, Fig. 5. The intercept equals the reciprocal of the adsorption–desorption equilibrium constant (Kads) according to Eq. 6 [27, 62]:

Table 6 Values of the linear correlation coefficient, R2, equilibrium adsorption constant, Kads and free energy of adsorption, ∆Gºads for ionic liquids on C-steel surface in 10% formation water, at 25°C
Fig. 5
figure 5

The Langmuir adsorption isotherm for different ionic liquids, IL-4, IL-8, and IL-10 on C-steel in 10% FW, 25 °C

$$\frac{{C}_{inh}}{\uptheta }=\frac{1}{{\mathrm{K}}_{\mathrm{ads}}}+{C}_{inh}$$
(6)

For all the studied concentrations, at 298 K, excellent linear fitting of the experimental data points (correlation coefficient, R2 from 0.992 to 0.998, and slope value within the range (1.07–1.05) that confirm the applicability of the model (Fig. 5) [63, 64]. From the values of the adsorption constant, Kads, the standard free energy of adsorption, ∆G°ads, are determined using the following equation [65,66,67,68]:

$$ \Delta {\text{G}}^{ \circ }_{{{\text{ads}}}} = - {\text{RT}}\ln \left( {1 \times 10^{6} {\text{K}}_{{{\text{ads}}}} } \right) $$
(7)

where 1 × 106 is the concentration of water molecules expressed in mg l–1, and R is the universal gas constant. The value of ∆G°ads for the studied inhibitor is given in Table 6. The values of ∆G°ads up to − 20 kJ mol−1 and less than − 40 kJ mol−1 are attributed to physical adsorption due to the low values of free energy of adsorption [69]. It is observed from the table that ∆Gºads takes more negative value in the case of IL-10 than that of IL-4 and IL-8, which confirms that the absorbability of such ionic liquids is increased in the sequence IL-4 < IL-8 < IL-10.

3.4 Synergistic effect

The effect of the addition of KI into the corrosion of C-steel in 10% FW as a corrosive solution ILs in the presence of IL-4 is displayed in weight loss data as shown in Fig. 6. Similar curves are obtained when IL-8 and IL-10 are added (curves not shown). As shown in Fig. 5 and the likes, further reduction in the weight loss of C-steel coupons in the formation water is observed for all studied IL concentrations. As shown before the presence of 0.02 M KI, the inhibitor decreases the corrosion rates to an extent that is more than that of the inhibitor alone, due to a synergistic effect. As shown in Table 4 the inhibition efficacy in 10% FW at 500 ppm of IL-10 is 85.47%. This value is raised to 90.52% in the presence of 0.02 M, as shown in Table 7. This behavior indicates that the addition of KI improves corrosion inhibition due to the synergistic effect.

Fig. 6
figure 6

Weight loss-time curves of C-steel in formation water in the absence and presence of different concentrations of IL-4, at 25 °C with adding 0.02 M KI

Table 7 Synergism parameters of carbon steel in 10% formation water, at (25 °C) with adding 0.02 M KI to IL-4, IL-8, and IL-10

The synergistic effect is discussed through the synergism parameter, Sθ, which is calculated using the equation [70, 71]:

$$ {\text{S}}_{\uptheta } = \left( {1 - \uptheta_{1 + 2} } \right)/\left( {1 - \uptheta^{\prime}_{1 + 2} } \right) $$
(8)

where θ1+2 = (θ1 + θ2) − (θ1⋅θ2), θ1 is the surface coverage by anion, θ2 is the surface coverage by cation and θ′1+2 is the surface coverage by both anion and cation. Since most of the calculated Sɵ values (~ 1) are in Table 7, and most of them are slightly higher than the one, we can conclude that there is a synergistic interaction between ionic liquids and KI that is responsible for the improvement in inhibition efficiency by KI addition. In regards to the mechanism, it is proposed that I is initially adsorbed on the surface, followed by the protonated form of the inhibitor being adsorbed by the interaction of coulomb with already adsorbed I on the metal surface. Following this procedure, the inhibitor in its neutral form shares its electron with the metal surface, i.e. chemisorption [70].

3.5 Inhibition mechanism of corrosion inhibitors

According to the previous literature study, several ionic liquids have demonstrated efficacy as corrosion inhibitors for C-steel in various electrolytic environments [71, 72]. The investigated ionic liquids IL-4, IL-8, and IL-10 are used to suppress the metallic corrosion by adsorption process preventing it from direct attack to the aggressive ions in the FW solution [39].

It is known that Fe dissolution in aqueous aggressive solutions involves the transfer of electrons, and it is controlled by the pH of the solution. The feasible mechanism of the inhibition process was explained by the physical adsorption phenomenon, which occurred due to the presence of the active functional group of the carboxylate anion (COO) in fatty acids. The organic moieties could show electrostatic binding with a positively charged C-steel surface [73]. The fatty acid-based ionic liquid lubricants interface with the steel surface to create a thin, low-shear-strength coating that decreases friction and shields against unwanted wear [74]. The carboxylate anion of fatty acid molecules may interact with Fe2+ for the formation of the metal-inhibitor complex and therefore decrease the dissolution of the metallic surface showing the bond formation with the carbon steel surface. In addition, the binding of high-molecular-weight fatty acids over carbon steel decreases the available surface that is exposed to the aggressive solution due to steric hindrance, addressing the declination of corrosion.

The basis of anti-corrosion properties of the aliphatic amine compounds is their adsorption on the surface of the protected metal, causing the formation of a hydrophobic film, which significantly reduces the access of both water and aggressive ions, delaying the anodic electrochemical corrosion processes of the metal [75], and their protection efficiencies of metals due to the electrostatic interactions which depending on their structure. So, these substances interact by adhering to the surface of the metal and electrolyte, where they utilize coordination bonds to produce an inhibitive coating. The inherent polarity of the ionic liquids makes it easier to quickly engage with carbon steel surface under boundary lubrication and create a stable chemical thin coating that lowers wear and friction.

4 Conclusions

Three different alkyl chains related to the fatty acid of the ILs were examined by gravimetric technique as good inhibitors towards the corrosion of C-steel in diluted formation water utilizing the gravimetric method. The inhibition efficiency is found to reach about 52.21% at 500 ppm of IL-10 which increases to reach 90.52%, in the presence of 0.02 M KI. The existence of KI induces a synergistic effect on the inhibition process. The inhibition mechanism was dependent on an adsorption process that obeys Langmuir's isotherm. The physisorption mixed with chemisorption processes was suggested to occur.