An experimental investigation on the impact of divalent ions on the emulsification of oil: Comparison of biodegradable (green) and petroleum-based surfactants

Emulsification of oil with surfactants often yields in complex colloidal systems which require understanding their physicochemical properties prior to their use in industry. This study aims to investigate the effects of divalent ions (calcium and magnesium) on the emulsification performance of biodegradable (green) surfactants of Triton ™ CG-110 (alkyl polyglycoside, APG) and GreenZyme (GZ) at two temperature conditions (25 ◦ C and 70 ◦ C). For this purpose, the phase behaviour, interfacial tension (IFT), stability, droplet size distribution and rheological properties of APG and GZ microemulsion were evaluated. The outcomes were then compared with the emulsification performance of petroleum-based (synthetic) surfactants of alpha-olefin sulfonate (AOS) and cetyltrimethylammonium bromide (CTAB). Furthermore, the impacts of alkalis (ethanolamine and sodium carbonate) on microemulsions and the demulsification performance of a zwitterionic demulsifier (cocobetaine) were explored. The results show that only APG and CTAB could produce water in oil (W/O) microemulsions in the presence of divalent ions. The stability of APG and CTAB microemulsions was affected by divalent ions since the water segregation rate (WSR) index of these microemulsions went up from ≈ 21% to ≈ 85% as salinity increased up to 15 wt%. Also, the average droplet size of these microemulsions went up from 50-64 nm to 220 – 255 nm as salinity increased to 9 wt%. This is because the negative charge density on the microemulsion droplet surface decreases as the salinity increases, thus the electrostatic repulsive force between the droplets becomes weaker. In addition, APG and CTAB microemulsions showed a shear thinning behaviour, and their viscosity value increased with the increase in salinity. It is speculated that the presence of divalent ions generates more friction between the molecules, which causes an increase in the viscosity of the microemulsions.


Introduction
Typically, an average of 35%-50% of the original oil in place (OOIP) in a conventional reservoir can be extracted and the remaining oil is trapped in porous media (Kumar and Mandal, 2016;Mariyate and Bera, 2021).The applied differential pressure alone may not overcome the high capillary pressure to displace the trapped oil in pore spaces.Nevertheless, surfactant flooding as a chemical enhanced oil recovery process can reduce the IFT at the oil/water interface, lowering the capillary pressure, thus allowing water to displace the trapped oil (Pal et al., 2019;Alsabagh et al., 2021;Bashir et al., 2022a).Moreover, the adsorption of the surfactants on the oil/water interface produces various types of microemulsions, which their characterisation is key for designing an immiscible displacement process (Mariyate and Bera, 2022).
The phase behaviour of microemulsions depends on several factors such as salinity, water content, and the concentrations of surfactant and cosurfactant (Bera and Mandal, 2015).Salinity significantly impacts the relative phase volume and the solubilisation ratios of oil and water in microemulsions.As the salinity increases, surfactants are driven out of the brine by salt ions causing changes in the droplet size and shape.Therefore, higher salinity decreases the water solubilisation parameter and increases the oil solubilisation parameter (Shehzad and Elraies, 2018;Bashir et al., 2022b;Bera et al., 2014).
The effect of salinity on the phase behaviour of the microemulsions using NaCl has intensively been discussed (Bera et al., 2014;John and Rakshit, 1994;Ghosh et al., 2019;Hosseini-Nasab and Zitha, 2017).Bera et al. (2014) studied the impact of salinity on the phase behaviour of microemulsions containing SDS/NaCl/propan-1-ol/.Their study indicated that microemulsions transitioned from Type I to Type II through Type III as NaCl concentration increased.They found that the highest water solubilisation was achieved at 4 wt% NaCl.Similarly, John and Rakshit (1994) investigated the phase behaviour of sodium dodecyl sulfate (SDS)/propanol/cyclohexane/water microemulsions in the presence of NaCl.They reported that the formation of three types of Winsor microemulsions (Winsor I, II, and III) was observed as NaCl concentration increased.They also indicated that Type III appeared at an optimum concentration of 1 mol/L.Ghosh et al. (2019) explored the impact of NaCl on microemulsion phase behaviour using a surfactant formulation containing internal olefin Sulfonate (IOS), tristyrylphenol propoxy ethoxy carboxylate (TSPC) and ethylhexanol propoxy sulfate (EPS).The experimental analysis indicated that Type III microemulsion was generated at optimum salinity of 68,500-78,500 mg/L, in which the IFT value was at its lowest value of 0.001 mN/m.Hosseini-Nasab and Zitha (2017) used NaCl to investigate the phase behaviour of the produced microemulsions using IOS as a surfactant.It was observed that the formation of Type III microemulsion with ultra-low IFT was achieved at the optimum salinity of 3.2 wt%.
A study by Maaref and Ayatollahi (2018), which evaluated the impact of different water salinities on the water in oil microemulsion stability, showed that the stability of microemulsions is inversely proportional to NaCl concentration and total dissolved solids (TDS).This can be attributed to the fact that high salt concentrations can cause the surfactant molecules to aggregate, forming larger droplets and ultimately phase separation.
Most of the past studies have only considered monovalent salts to investigate the impact of salinity on the phase behaviour of microemulsions and to determine the optimum salinity that leads to the generation of Type III microemulsions with the lowest IFT values.Nevertheless, the composition and salinity of the injected brine can significantly affect the stability of the microemulsion and the droplet size distribution.The impact of salinity on microemulsion stability may also depend on the type and valency of ions used, as different ions can have different effects on the surfactant and the interfacial properties of the system (Nisja, 2015;Kazemzadeh et al., 2019a).Nisja (2015) investigated the effect of ion type (Ca 2+ and Na + ) on the stability of O/W microemulsions through zeta potential analysis.It was observed that the destabilisation effect of Ca 2+ was stronger than the impact of Na + .The author believes that the higher valency of Ca 2+ contributes more to the compression of the electrical double layer of the emulsion droplets.
On the other hand, Kazemzadeh et al. (2019a) indicated that the surfactant solution with magnesium chloride (MgCl 2 ) showed a better performance in terms of emulsion stability than NaCl.They claimed that Mg 2+ in MgCl 2 salt could better adsorb asphaltene molecules than Na + , and these asphaltene molecules act as emulsifiers at the oil/water interface.Rayhani et al. (2022) addressed the influence of three divalent ions (Mg 2+ , Ca 2+ , SO 4 2− ) on the stability of W/O emulsions at 80 .This is because of the higher tendency of divalent cations to bond with crude oil polar components such as asphaltene (Kazemzadeh et al., 2019b).
One of the properties that can affect the success of microemulsion flooding is the rheological properties of the microemulsion system.These properties control the frontal stability (mobility control) of the microemulsion at low (0.1-10 s − 1 ) and high shear rates (500-6000 s − 1 ) in porous media (Bennett et al., 1980).The viscosity of a microemulsion varies with salinity since the phase type and microstructure of a microemulsion depend on the electrolyte environment.Several published articles have evaluated the change in microemulsion viscosity with salinity.However, there was no unifying explanation for such variations.(Tagavifar et al., 2018).Bennett et al. (1981) studied the rheological properties of microemulsions produced by two surfactants (petroleum sulfonate and sodium 4-(l-heptyl nonyl) benzenesulfonate) for a range of shear rates between 1 s − 1 and 1000 s − 1 .They observed two distinct maxima for microemulsion viscosity trend at a fixed shear rate (100 s − 1 ) as NaCl concentration increased.The first maximum was near the transition region from the O/W phase to the middle phase, and the second maximum was near the transition region from the middle phase to the W/O phase.In contrast, Tagavifar et al. (2018) tested the rheological properties of IOS microemulsions at different concentrations of NaCl, for a range of shear rates between 0.1 s − 1 and 100 s − 1 .They reported that one distinct maximum located in the Winsor type III region was observed at a very low value of shear rate.In comparison, a less-distinct maximum was reported by Kiran and Acosta (2010) at shear rates of 80-180 s − 1 when they used sodium dihexylsulfosuccinate (SDHS) as a surfactant and NaCl as a source of salt.It was argued that such discrepancy could be due to the use of different types of the oleic phase (Tagavifar et al., 2018).For example, Bennett et al. (1981) used octane in their study, whilst crude oil (Tagavifar et al., 2018) and toluene (Kiran and Acosta, 2010) were used in the other studies.Therefore, a further investigation into the impact of salinity on microemulsion viscosity is required.
As of yet, there is no study that investigated the impacts of divalent ions on the emulsification properties (phase behaviour and stability) of microemulsions produced by green surfactants and organic alkalis.Also, the rheological properties of such microemulsion systems in the presence of divalent ions need to be explored.Thus, in this study, we evaluated the impact of two divalent salts: calcium chloride dihydrate (CaCl 2 ⋅2H 2 O) and magnesium chloride hexahydrate (MgCl 2 ⋅6H 2 O), on the emulsification ability of APG, GZ, AOS and CTAB, synergising with ethanolamine/Na 2 CO 3 .Furthermore, the effects of divalent ions on phase behaviour, interfacial tension, stability and rheological properties of the produced microemulsions were discussed.An attempt to produce a microemulsion rheological model for the four surfactants was carried out, considering salinity, temperature change and alkali type.The demulsification process of the produced microemulsions using a green demulsifier (cocobetaine) was explored.It should be noted that AOS and CTAB were selected to provide a comparative understanding for the performance of biodegradable surfactants.

Materials
APG and CTAB surfactants were purchased from Sigma-Aldrich, GZ was acquired from Apollo Separation Technologies and AOS was obtained from Primesurfactants.APG is a mixture of 58 wt% to 62 wt% of D-glucopyranose, oligomeric and decyl octyl glycoside; 38 wt% to 42 wt % water; less than 2 wt% decanol and less than 1 wt% octanol (Sigma-Aldrich, 2023).GreenZyme is a biological liquid enzyme, a non-living protein-based catalyst.It is synthesized by impregnating a high-protein nutrition solution with the DNA of selectively cultured living microbes (NIXUS International Corporation, 2020).Fig. 1 illustrates the molecular formula of APG, AOS and CTAB (Sigma-Aldrich, 2023; National Library of Medicine, 2023a; National Library of Medicine, 2023b).
Alkalis, including sodium carbonate (Na 2 CO 3 ) and ethanolamine, were supplied by Fisher Scientific.Na 2 CO 3 can considerably decrease IFT and increase microemulsion stability through their reaction with the acidic components of crude oil to generate in-situ soap (Pal et al., 2018;Yin et al., 2017).However, Na 2 CO 3 would not be a good choice of alkali as it might cause formation damage (Sharma et al., 2015;Bataweel and Nasr-El-Din, 2011;Zhao et al., 2015).Therefore, ethanolamine was selected to compare its performance with Na 2 CO 3 since it is an organic alkali that has shown stability in high-temperature, high-salinity (HTHS) conditions and can reduce the IFT (Bai et al., 2014(Bai et al., , 2017;;Tackie-Otoo et al., 2020).A demulsifier (Sodium Cocamidopropyl Betaine) known as cocobetaine was purchased from Primesurfactants.It was chosen because it is a biological and green demulsifier as it is a derivative of coconut oil (Saat et al., 2020).Two salts of CaCl 2 ⋅2H 2 O (98% purity) and MgCl 2 ⋅6H 2 O (≥99.0 purity) were obtained from Sigma-Aldrich.Heptane (99% purity) as an oil phase and isobutanol (99% purity) as a co-solvent were used in this study and they were purchased from Fisher Scientific.Heptanoic acid (98+% purity) was supplied by Alfa Aesar.In our study, heptanoic acid (0.25 wt%) was dissolved in heptane in order to have acidic components in the oil phase.

Surface tension
The surface tension of surfactant solutions at the air-aqueous interface was measured using Sigma tensiometer 703D based on the DuNouy ring method.Different surfactant concentrations were considered to estimate the critical micelle concentration (CMC) value of each surfactant at both room temperature and 70 • C. Each surface tension measurement was repeated three times, and then the average was calculated.At room temperature, the surface tension value of distilled water was measured as 71.9 mN/m.

Interfacial tension
IFT values between the oleic phase (heptane with heptanoic acid) and the aqueous solutions of two alkalis (ethanolamine and Na 2 CO 3 ) at different concentrations were also measured using Sigma 703D tensiometer.These measurements provided the optimum concentration of alkalis that gives the lowest IFT between the heptane and alkali solution.Each measurement was repeated three times at room temperature and 70 • C.

Surfactant aqueous stability tests
The main objective of these tests is to study the effect of divalent ions on the stability of four surfactant solutions (AOS, CTAB, APG and GZ) via measuring the amount of light that the sample absorbs using Jenway 6315 Spectrophotometer.Commonly, the water used for preparing surfactant solutions at the surface has low salinity (<10 wt%); however, the formation water in reservoirs can be highly saline (up to 30 wt%).Therefore, the surfactant solution might be stable at the surface but unstable when it is exposed to the formation water (Gupta et al., 2020).
In our experiments, firstly, the surfactants at a fixed concentration were mixed with brine at different salinities (3, 6, 9, 12 and 15 wt%) using a mixture of MgCl 2 and CaCl 2 salts (with a molar concentration ratio of 1:1).Secondly, all samples were kept in 10 ml airtight vials in an oven at 70 • C for 48 h.Finally, after 72 h, the absorbance value for each sample was estimated at a wavelength corresponding to the maximum absorbance for MgCl 2 and CaCl 2 (approximately 480 nm) (Kohn, 1969).

Emulsification experiments
To characterise the effects of the divalent ions on the emulsification of the four surfactant solutions, we experimentally investigated microemulsion properties such as phase behaviour, IFT of oil-microemulsion/ water-microemulsion, microemulsion stability, rheological properties, and the microemulsion droplets distribution pattern.Furthermore, we studied the effects of ethanolamine and Na 2 CO 3 on the aforementioned properties.Microemulsions were prepared by mixing 40 ml of heptane (that includes heptanoic acid in it) with 40 ml of brine vigorously using a mechanical stirrer at a rate of 2000 r/min for 30 min at room temperature, and then the bottles were allowed to equilibrate.The brine solutions consisted of surfactant/alkali/co-solvent and two divalent salts (CaCl 2 ⋅2H 2 O) and (MgCl 2 ⋅6H 2 O).The concentrations of surfactant and alkali were fixed based on the obtained values from CMC and IFT measurements.The surfactant to co-solvent ratio was 1:1 by weight in all microemulsions.The concentration of the salt mixture was varied (3, 6, 9, 12 and 15 wt%), and the molar concentration ratio of the two salts was 1:1 (Ghosh et al., 2019;Zhong et al., 2020).
In order to calculate the oil-microemulsion or water-microemulsion IFT, the oil and water solubilisation ratios were determined using the following equations (Pal et al., 2019;Shehzad and Elraies, 2018): Where, SP o is the oil solubilisation ratio, SP w is the water solubilisation ratio, V o is the volume of oil solubilised in microemulsion, V w is the volume of brine solubilised in microemulsion, and V s is the volume of the surfactant solution.
The IFT of the oil-microemulsions or water-microemulsion will then be estimated by applying the Huh equation (Pal et al., 2019;Shehzad and Elraies, 2018): Where, α ow is the oil/water solubilisation ratio.
The water segregation rate (WSR) index was used to evaluate the stability of microemulsions.WSR can be defined as the volume ratio of the precipitated water to that of the initial water, and it can be calculated by (Yin et al., 2017): Where, V iw is the initial volume of water, and V dw is the volume of water after separation.The percentage of separated water in emulsions was recorded at different times up to 72 h after the microemulsion was prepared.

Droplet size distribution
Understanding the droplet size distribution of the microemulsion is significantly essential for comprehending the mechanism leading to both the ability to penetrate porous media and microemulsion stability (Bera et al., 2012).To evaluate the impact of divalent ions on the droplet size distribution of microemulsions, we measured the size of the droplets before and after adding divalent ions (at the optimum salinity of 9 wt%).Also, we determined the size of microemulsion droplets in the absence of Ethanolamine/Na 2 CO 3 to investigate the influence of alkali on microemulsion stability.Malvern Zetasizer instrument was used to carry out these measurements by a Dynamic Light Scattering (DLS) technique at room temperature.

pH tests
To prevent any unwanted effects of acidity from the microemulsions that may lead to issues such as corrosion of pipelines, the impact of divalent ions on the acidity of the formed microemulsions was explored in this study.Therefore, the pH values of microemulsions were measured using a pH meter (Orion Versa Star Pro).

Rheological properties of microemulsions
The rheological properties of the produced microemulsions at different concentrations were determined.The viscosity of each microemulsion system was measured using TA Discovery HR-3 rheometer under varying shear rates of 0.1-2025 s − 1 and at two temperatures of 25 • C and 70 • C.

Demulsification experiments
The stability of a microemulsion is a desirable property inside the reservoirs.However, the demulsification process in surface facilities is critical, as microemulsions may cause high pumping costs, pipeline corrosion and scaling; consequently, productivity will be reduced, and the total cost of production will increase (Kokal, 2005;Fan et al., 2009;Xia et al., 2004).Therefore, in our experiments we aimed to study the use of a demulsifier for destabilising microemulsions.In graduated vials, cocobetaine at different concentrations was mixed with the prepared microemulsions.All the samples were left for 1 h to reach the equilibrium status.Then, the volume of water will be recorded in millilitres as a function of time (Kang et al., 2018;Sun et al., 2016).These tests were conducted at atmospheric pressure and ambient temperature, as it is likely that the demulsification process will be executed at the surface condition.

Surface and interfacial tension
The surface tension data of the four surfactant solutions at different concentrations and temperatures is illustrated in Fig. 2. It is shown that with the increase in the surfactant concentration, the surface tension value reduced gradually until it reached critical micelle concentration, beyond which no change in the surface tension value was observed.It was also observed that with the increase in temperature from 25 • C to 70 • C, the surface tension value was reduced because the kinetic energy of the surfactant molecules increases at the higher temperature; consequently, the intermolecular attraction forces between liquid molecules are reduced (Coker, 1995).To investigate the effects of ethanolamine and Na 2 CO 3 on IFT at the alkali solution/heptane interface, several IFT experiments were conducted at various concentrations of alkalis using Sigma 703D tensiometer.Fig. 3 indicates that the IFT decreased to a particular value as ethanolamine/Na 2 CO 3 concentration increased.Owing to the hydrolysis of alkali into OH − , in which the produced OH − reacted with the carboxylic acids present in the oleic phase, producing soap which acted as a surfactant.The concentration of the produced soap increased with the increase of alkali concentration.Thus, the IFT was reduced due to the arrangement of the soap molecules at the alkali solution/heptane interface.However, beyond a specific alkali concentration, the value of IFT did not change as the concentration of heptanoic acid in the oil phase was limited (Yin et al., 2017).According to Fig. 4, Na 2 CO 3 reduced the IFT to a lower value compared to ethanolamine.The IFT decreased dramatically from 42.45 mN/m to 21.45 mN/m when the Na 2 CO 3 concentration increased from 0 wt% to 1 wt% at 25 • C. While ethanolamine reduced the IFT from 42.45 mN/m to 24.05 mN/m at 25 • C when its concentration increased from 0 wt% to 1.2 wt%.Also, the increase in temperature caused a further reduction in the IFT values for both alkalis.

Surfactant aqueous stability tests
The main purpose of this test was to evaluate the stability of the surfactant solutions in the presence of two salts, (CaCl 2 .2H 2 O) and (MgCl 2 .6H 2 O) with different concentrations (3-15 wt%) at two temperatures (25 • C and 70 • C).Visually, it can be indicated that APG, GZ and CTAB formed clear transparent solutions at different salinities and temperatures.Nevertheless, AOS showed incompatibility with the divalent salts, which produced some precipitations at salinities of 9 wt% and above at 25 • C, and salinities of 12 wt% and above when the solutions were heated up to 70 • C.This is because the interaction between the divalent ions and surfactant molecules can reduce micelle formation, leading to a considerable number of free monomers which bind with the divalent ions, resulting in precipitations (Syed et al., 2019).
Based on absorbance results from the spectrophotometry, the divalent ions had no impact on the stability of APG, GZ and CTAB solutions at both temperatures since the absorbance values did not change significantly.On the other hand, the stability of AOS solutions was affected by divalent ions at the salinity values more than 6 wt% at 25 • C and at the salinity values more than 12 wt% at 70 • C, as shown in Fig. 5.

Emulsification tests
These experiments were conducted to investigate the effects of two divalent salts (MgCl 2 .6H 2 O) and (CaCl 2 .2H 2 O) with different concentrations on the emulsification ability of the surfactants, their phase behaviour, the IFT of oil-microemulsion/water-microemulsion, stability, rheological properties, and the oil droplets distribution pattern.It also aimed to compare the effects of ethanolamine and Na 2 CO 3 on these properties.

Emulsification ability and phase behaviour
The four surfactants were able to generate microemulsions at zero salinity and 25 • C, however, only APG and CTAB could produce microemulsions at salinities of 3, 6, 9, 12 and 15 wt% at 25 • C (shown in Figs. 6 and 7).AOS and GZ were unable to form microemulsions in the presence of divalent ions, which means that their emulsification ability in the presence of divalent ions is relatively weak.Thus, these two  (0, 3, 6, 9, 12 and 15 wt%).surfactants will not be considered for further analysis, and in the rest of this study, the investigations will be focused on APG and CTAB.
As shown in Figs. 6 and 7, the type of the produced microemulsions was Winsor Type II (water in oil), suggesting that all oil was solubilised in the microemulsion phase with low water solubilisation (Gupta et al., 2020).Also, it was detected that temperature had no effect on the phase behaviour of microemulsions when all samples were placed in an oven at a temperature of 70 • C. Finally, the two alkalis performed similarly and helped to produce microemulsions with the same phase behaviour.

Water-microemulsion interfacial tension
IFT is a key factor for assessing the efficiency of a surfactant in displacing the trapped oil in the reservoir.Fig. 8 shows a comparison of the IFT values for APG and CTAB.In the presence of ethanolamine/Na 2 CO 3 , the water-microemulsion IFT values were further decreased compared with those given in the absence of alkalis, which indicated that saponification reaction impacts the IFT reduction.Also, it was observed that Na 2 CO 3 was slightly better than ethanolamine in reducing the IFT in APG and CTAB microemulsion systems.
As shown in Fig. 8, the IFT values of water-microemulsion were directly proportional to the salinity.This could be justified by the charges on the divalent ions that drive the surfactant molecules out of the microemulsion phase and trap them in the water phase, thereby, the number of surfactant molecules at the oil/water interface will be decreased.This phenomenon can be justified by the salting-out mechanism.Due to the salting-out effect, the water molecules are attracted towards the salt ions, which leads to reducing the interactions between the water molecules and surfactant molecules.Thus, the latter precipitate due to the hydrophobic interactions among the non-polar tails of surfactant molecules, which arise from the hydrophobic effect (Pal et al., 2019).It can be stated that the IFT of the different systems experienced a slight increase when salinity increased up to 9 wt%.In contrast, a considerable increase in IFT value was observed as salinity increased from 9 to 15 wt%.Thus, the working optimum salt can be up to 9 wt%.

Microemulsion stability
The stability of the produced microemulsions was estimated by calculating the water segregation ratio (WSR).It represents the proportion of the water separation from the microemulsion.The stability of microemulsion is an essential property as the dispersed microemulsions often collide during the process of microemulsion seepage in porous media (Zhou et al., 2019).The interfacial film strength of a microemulsion is the crucial factor that impacts its stability.If the interfacial  film strength is poor, the microemulsions might quickly coalesce and the oil displacement will become ineffective (Pei et al., 2017).The molecular structure and properties of the emulsifier are among the important parameters that affect the interfacial film strength (Kole and Bikkina, 2017).According to Fig. 9, CTAB has relatively higher microemulsion stability, at zero salinity, than APG since its WRS was only 27% with ethanolamine and 24% with Na 2 CO 3 after three days.Whereas the WSR of APG mixed with ethanolamine and Na 2 CO 3 were 29% and 34%, respectively, after three days.
It can also be seen from Fig. 9 that the stability of microemulsions formed by CTAB with ethanolamine/Na 2 CO 3 and APG with ethanolamine/Na 2 CO 3 are inversely affected by the increase in salinity.This is because the impact of negative charge density on the microemulsion droplet surfaces decreases as the salinity increases, and hence the electrostatic repulsive forces between the droplets become weaker (Yang et al., 2015).It could also be due to the reduced number of surfactant molecules adsorbed on the microemulsion layer (salting-out effect), which increased the water-microemulsion IFT and weakened the interfacial film strength; consequently, the produced microemulsions are unstable (Pal et al., 2019;Hirasaki et al., 2011).In addition, Na 2 CO 3 has shown a slightly better performance than ethanolamine in terms of microemulsion stability because Na 2 CO 3 could further reduce the IFT of the system as discussed earlier, and the lower the IFT, the easier it is to produce stable microemulsions.

Droplet size distribution
In our study, the size of microemulsion droplets was measured, and the results confirmed the tendency of the microemulsion droplets to    11, the mean size of APG microemulsion droplets was around 68 nm at zero salinity, while it was 108-220 nm at the optimum salinity of 9 wt %.The mean size of microemulsion droplets formed by CTAB was approximately 50-64 nm at zero salinity, and it reached 190-255 nm at the optimum salinity of 9 wt%.
These findings confirm the results from the stability of microemulsion experiments; the larger the size of the droplets, the less microemulsion stability.In other words, the smaller the aggregation and coalescence rate of droplets, the more stable a microemulsion is (Zhou et al., 2019).Also, it was observed that the presence of alkali had an impact on the stability of the microemulsion.Alkali reduced the mean size of APG microemulsion droplets from around 164 nm-68 nm, and the mean size of microemulsion droplets formed by CTAB was reduced from 190 nm to 50-64 nm.The type of the alkali did not significantly affect the size of droplets as ethanolamine and Na 2 CO 3 performed similarly in these tests.

pH testes
These tests were conducted to evaluate the effect of CaCl 2 ⋅2H 2 O and MgCl 2 ⋅6H 2 O on the pH value of the microemulsions.As shown in Fig. 12, Na 2 CO 3 showed relatively lower alkalinity compared to ethanolamine (stronger base).Moreover, the results show that the pH value of the surfactant solutions decreased with increasing the salinity.It can be argued that calcium chloride and magnesium chloride absorbed the hydroxide ions in the water and left free protons behind.This lowers the pH of the solution and makes it more acidic (Brennan and Bolland, 1998;Kazemzadeh et al., 2019a).Also, the results revealed that at the salinities of 9-15 wt%, the pH values of microemulsions formed by APG or CTAB in the presence of Na 2 CO 3 were below 7. Therefore, it can be concluded that the mixture of green chemicals (APG and ethanolamine) or CTAB with ethanolamine can produce microemulsions with higher alkalinity at high concentrations of Mg 2+ and Ca 2+ .

Rheological properties
The rheological properties of the microemulsion systems were studied to understand the variation of viscosity and shear stress against shear rate at different salinity and temperature conditions.The viscosity of microemulsions was tested for a range of shear rates from 0.1 to 2025 s − 1 at two temperatures (25 • C and 70 • C).
The results indicated that the viscosity was decreasing, and the shear stress was increasing with the increase in the shear rate.It can be concluded that all microemulsions exhibited a shear thinning behaviour within the range of shear rates applied.The non-Newtonian behaviour of the microemulsion slug is important for mobility control purposes to maximise the sweep efficiency (Pal et al., 2019).
At a shear rate of 0.1 s − 1 , the microemulsion viscosity of APG and CTAB were 1.05 Pa s, and 0.45 Pa s, respectively.Viscosities decreased to 0.0195 Pa s and 0.0135 Pa s, respectively, at a shear rate of 2025 s − 1 .This difference in viscosity values between the two surfactants at lower shear rates could be attributed to the intermolecular forces that play a larger role at lower shear rates.Hence, stronger attractions between molecules lead to a stronger resistance to flow.Moreover, the molecule size could contribute towards stronger attractions between molecules causing higher friction.However, we believe the shear forces become the dominant forces at higher shear rates and they overcome the effect of the intermolecular force, and hence the difference in viscosity of surfactants is lower.Fig. 13 shows that microemulsions formed by APG recorded a slightly higher viscosity value than those formed by CTAB at lower shear rates at 25 • C, while the difference in the viscosity values becomes smaller at higher shear rates.
According to Figs. 14 and 15, it was noted that salinity influenced the viscosity of microemulsions.The increase in salinity led to an increase in the viscosity value, especially at lower shear rates.When salinity increased from 0 wt% to 15 wt% at a shear rate of 0.1 s − 1 , the viscosity of APG microemulsion system increased from 0.37 Pa s to 16.50 Pa s, while at a shear rate of 2025 s − 1 , the viscosity value raised from 0.020 Pa s to 0.045 Pa s.Similarly, at a shear rate of 0.1 s − 1 , the viscosity of CTAB microemulsion system went up from 0.35 Pa s to 3.77 Pa s, while at a shear rate of 2025 s − 1 , the viscosity value increased from 0.011 Pa s to 0.096 Pa s.The presence of divalent ions creates more friction between the molecules, which increases the viscosity of the microemulsions as the salinity increases (Ronningsen, 1995).
Also, the measurements at the higher temperature show that oil molecules and microemulsions gain higher kinetic energy at 70 • C; therefore, they become less viscous, and hence they can flow easily in the porous media (Brennan and Bolland, 1998).

Microemulsion rheology and power-law model (n and K)
In this study, since all microemulsions exhibited a shear thinning behaviour, we used a power-law model to predict the effect of temperature change and salinity on the viscosity of microemulsion.The viscosity and shear stress of a microemulsion at any shear rate are given by, where μ is viscosity, τ ω is shear stress, γ ω is shear rate, n is the power-law index and K is the consistency index.The least squares method was used to calculated n & K.
Figs. 16 and 17 demonstrate the effects of temperature and salinity on the microemulsion rheological model where n and K of each microemulsion system are presented.The power-law index decreases with increasing in salinity and it increases at high temperature.While the K value increases with increasing salinity and decreases at high temperature.These models could be used to predict the rheological properties of the microemulsion systems formed by the surfactant solutions investigated in this study.
By using Equation ( 5), the viscosity of microemulsions was calculated to compare them with the experimental viscosities measured by the TA Discovery HR-3 rheometer.According to the observations from Fig. 18, it can be stated that the viscosity values of the model were significantly close to the values measured experimentally.

Demulsification tests
To separate oleic and aqueous phases at the surface effectively, microemulsions need to be broken down.In our study, we investigated the demulsification behaviour of the produced microemulsion in section 2.2.4.For this purpose, cocobetaine was used as a demulsifier at various concentrations (0.01, 0.025, and 0.05 wt%) to determine the optimum concentration that separates the brine from heptane.Results revealed that cocobetaine could not completely destabilise the APG microemulsions, however, as shown in Fig. 19, at a concentration of 0.025 wt %, it performed better than 0.01 wt%.At the concentration of 0.025 wt %, cocobetaine separated the brine from heptane at an efficiency between 77% and 86%.According to Fig. 20, the water separation rate was 77% in the absence of divalent ions after 24 h.Furthermore, at salinities of 3, 6, 9, 12, and 15 wt%, the water segregation rates were 81%, 83%, 84%, 84% and 86%, respectively.Using 0.05 wt% of cocobetaine did not lead to any further separation; thus, 0.025 wt% was considered as the  As illustrated in Fig. 21, cocobetaine at a concentration of 0.01 wt% separated the brine from heptane in the CTAB microemulsions.When the salinity increased to 3, 6, 9, 12, and 15 wt%, the water segregation rates of 80%, 94%, 96%, 98% and 98% were recorded respectively after 24 h.When cocobetaine is dissolved in the bulk aqueous solution, a fraction of betaine molecules ionise to negatively charged hydroxyl group (OH − ).These ions are attracted to the positively charged surfaces of the microemulsion drops, making the pH of the surface greater than the pH of the bulk solution.Thus, the ionised hydroxyl groups reduce the surface charge density and the stability of microemulsions (Fan et al., 2009;Yang et al., 2015).Additionally, 0.01 wt% was the optimum concentration of the demulsifier to separate CTAB microemulsions since the increase in cocobetaine concentration did not improve the separation process.

Conclusions
This study investigated the effects of divalent ions of Ca 2+ and Mg 2+ on the emulsification performance of green surfactants (APG and GZ), and compared them with the performance of AOS and CTAB.The results indicated that only APG and CTAB could produce microemulsions in the  presence of divalent ions.Moreover, it was found both AOS and GZ did not form microemulsions in the presence of divalent ions, and they were not considered for further analysis.Additionally, the effects of ethanolamine and Na2CO3 on microemulsions, and the demulsification performance of cocobetain were explored.
The presence of Ca 2+ and Mg 2+ negatively affected the stability of APG and CTAB microemulsions as they increased the mean droplet size of the microemulsions and expedited their rate of coalescence.Ethanolamine and Na 2 CO 3 further reduced the IFT values of the microemulsions, indicating that the saponification reaction impacts IFT reduction.Also, the addition of ethanolamine and Na 2 CO 3 reduced the mean droplet size of microemulsions.
The viscosity of AGP microemulsions was higher than CTAB microemulsions at lower shear rates due to the dominance of intermolecular forces, whilst the difference became insignificant at higher shear rates where shear forces dominated.Moreover, the presence of Ca 2+ and Mg 2+ created more friction between the molecular layers which led to higher viscosity of microemulsions at higher salinities.Cocobetaine was effective in demulsifying the microemulsions generated by APG and CTAB, with better performance observed with CTAB microemulsions because a fraction of betaine molecules ionise to hydroxyl groups and become negatively charged.These ions are attracted to the positively charged surfaces of the microemulsion droplets, which reduces both the surface charge density of droplets and the repulsive force between them.
Therefore, we concluded in the presence of divalent ions (Ca 2+ and Mg 2+ ), APG and ethanolamine can be used as green chemicals in oil recovery processes.These chemicals demonstrated good IFT reduction and emulsification performance, comparable to the performance of CTAB (petroleum-based surfactant) and Na 2 CO 3 (inorganic alkali).
At a concentration of 0.1 wt% (CMC), APG and AOS showed surface tension values of 38.25 mN/m and 36.88 mN/m at 25 • C, respectively, and 31.78mN/m and 29.19 mN/m at 70 • C. On the other hand, GZ surface tension reached 42.77 mN/m and 38.19 mN/m at 25 • C and 70 • C, respectively, with a CMC of 0.4%.CTAB has shown a slightly better performance than other surfactants as the surface tension decreased to 34.76 mN/m and 28.89 mN/m at 25 • C and 70 • C, respectively, with a CMC of 0.2 wt%.

Fig. 3 .
Fig. 3. IFT versus alkali concentration at the interface of heptane with ethanolamine/Na 2 CO 3 aqueous solution at 25 • C and 70 • C.

Fig. 8 .
Fig. 8. IFT of water-microemulsions produced by two surfactants and two alkalis versus salinity.

Fig.
Fig. PH value versus salinity for different microemulsion systems. μ

Fig. 16 .
Fig. 16.n&K for APG microemulsions at different temperatures and salinities: a) n for ethanolamine at 25 and 70 • C, b) K for ethanolamine at 25 and 70 • C, c) n for Na 2 CO 3 at 25 and 70 • C, d) K for Na 2 CO 3 at 25 and 70 • C.

Fig. 17 .
Fig. 17. n&K for CTAB microemulsions at different temperatures and salinities: a) n for ethanolamine at 25 and 70 • C, b) K for ethanolamine at 25 and 70 • C, c) n for Na 2 CO 3 at 25 and 70 • C, d) K for Na 2 CO 3 at 25 and 70 • C.

Fig. 18 .
Fig. 18.Comparisons between the experimentally measured viscosity and the calculated viscosity at different temperatures and salinities.

Fig. 19 .
Fig. 19.a) Phase separation of the APG microemulsions after 24 h with a demulsifier concentration of 0.01 wt%, b) Phase separation of the APG microemulsions after 24 h with a demulsifier concentration of 0.025 wt%.

Fig. 21 .
Fig. 21.a) Phase separation of the CTAB microemulsions after 24 h with a demulsifier concentration of 0.01 wt%, b) Water segregation rate (%) of CTAB microemulsions vs time (min) after adding 0.01 wt% of the demulsifier.