1 Introduction

The harsh bottom conditions of high temperature, high salinity, and high condensate oil content have intensified the difficulties of exploitation with the progress of exploit of oil and gas fields into the middle and late stages. The wellbore fluid accumulation has a significant effect on productivity due to the large formation pressure drop and outcrop pressure difference in most gas wells in the late exploit stage, resulting in high abandonment pressure and low final recovery rate [1]. If the fluid accumulation in the well is not addressed as soon as it arises, then it will have a continuous effect on industrial production, causing a gradual decline in natural gas production. In severe cases, this phenomenon will stop production and harm the environment [2, 3]. The gas well output will be greatly increased when the effluent in the wellbore is discharged using a process technology. The currently commonly used drainage gas production processes include gas lift drainage gas recovery, foam drainage gas recovery, optimal pipe string drainage gas recovery, and conventional rod pump drainage gas recovery [4, 5]. The foam drainage gas recovery process is not only simple in terms of equipment and structure but also inexpensive and efficient. This process can effectively increase the output of gas wells and extend their self-injection cycle. Moreover, this process is widely used in oil and gas field production across the world [6]. The addition of a foam drainage agent can not only increase the bubbling height of the bubble flow state and minimize gas slip loss but also reduce the surface tension of the liquid, the density of the gas–liquid mixture, the friction loss in the tubing of the blowout well, and the gravity gradient in the well [7,8,9]. Foam drainage technology uses surface-active foaming agents to contact the effusion in the well. The density of the effusion is lowered, the surface tension of the formation water is reduced, and the bottom effusion is transformed into a foamy fluid when the natural gas flow is agitated. To achieve the purpose of drainage and gas recovery [10,11,12], the foam drainage process is relatively simple compared with the other drainage processes, and it can achieve the goal of drainage without using large-scale equipment.

Foam drainage gas recovery technology has been used for the drainage and gas recovery of gas fields in developed countries, such as the USA and the Soviet Union since the 1980s [13]. Later, a large number of researchers studied this technology. At present, research on foam drainage agents is mainly focused on the synthesis of surfactants and the compounding of foaming agents and other additives [14,15,16]. Liu and others[17] developed temperature, salt, and oil-resistant foam drainage agent FDA1 for the S75 well block of the Sulige Gas Field. The average daily gas production on site increased by 35.2%. Lai and others [18] used 3-chloro-2-hydroxypropane sulfonate sodium, oleic acid amidopropyl dimethyl tertiary amine, and 1,2-dibromoethane as raw materials to synthesize betaine gemini foam drainage agent M-66. This agent shows good performance under 250 g/L salinity, 20% methanol solution, and 30% condensate oil hydrate. Xiong and others [19] used gemini surfactants as additives and nanoparticles as foam stabilizers to develop a foam drainage agent that can withstand a high temperature of 160 °C and a salinity of 250 g/L. The average single well output of natural gas after construction increased by 62.48%, and the oil jacket pressure difference is reduced by 18.9%. Qu and others [20] combined the anionic surfactant SDS, zwitterionic surfactant CHSB, and fluorocarbon surfactant PFBS to form oil-resistant foam drainage agent COT.

The salinity of the wellbore fluid, condensate oil, methanol, and fluid temperature directly affect the performance of the foam drainage agent [21]. Therefore, the foam drainage agent used on site is required to have better temperature resistance, salinity resistance, anti-condensation oil, and anti-methanol properties [22, 23].

Betaine-type zwitterionic surfactants do not accept or release protons. These molecules exist in the form of internal salts. Accordingly, these molecules have the ability to stabilize hydrophilic groups under high salt conditions, which maintains the oil–water balance and eventually exhibits salinity tolerance [24, 25]. The introduction of sulfonic acid groups (–SO3–) can improve the temperature resistance of surfactants. The betaine synthesized in this study has a structure of two ether bonds (–COC–) and two hydroxyl groups (–OH). The role of ether bonds in a solution is to complex the high-valent metal ions, such as Ca2+, Mg2+, and Fe3+; accordingly, the hydrophilic group sulfonic acid group in the molecular structure avoids precipitation due to the interference of high-valent metal ions; meanwhile, the hydroxyl group is a nonionic group and is not interfered by high-valent metal ions; even if the high-valent metal ion complexes the sulfonic acid group in the molecule, the two hydroxyl group still has good hydrophilicity; thus, the betaine molecule is still soluble in water and has high surface activity [26]. Because betaine surfactant has these excellent characteristics, the foam drainage agent synthesized in this paper can have the properties of temperature resistance, salt resistance and condensate resistance. Compared with the existing foam drainage agent, it has more excellent foaming and foam stability performance and can be better applied to drainage gas production in gas fields.

2 Materials and Methods

2.1 Materials

Tables 1 and 2.

Table 1 Experimental equipment
Table 2 Experimental drugs

2.2 Methods

2.2.1 Synthesis of LGE

Approximately 18.63 g of 1-dodecanol, 46 g of toluene solvent, and 1.29 g of catalyst TBAB were added into a three-necked round-bottomed flask. Then, a condenser and a thermometer were set up. The solution was stirred at 50 °C for 30 min and slowly dropped with a dropping funnel. Subsequently, 12.03 g of MSDS was added. The solution was allowed to react for 4 h before thoroughly reacted with 40% NaOH solution to separate liquids to obtain a light yellow liquid. The crude product is suction filtered to remove the solids when cooled to below the melting point of dodecanol and repeatedly washed to pH = 7. Rotary steaming is performed to remove toluene and MSDS to obtain a light yellow liquid LGE. 1-Dodecanol reacts with MSDS in the presence of NaOH and TBAB to produce LGE after dehydrochlorination [27, 28]. The reaction formula is as follows:

(1)

2.2.2 Synthesis of DED

Approximately 13.37 g of DMEA and 60% sodium hydride were placed in a three-necked flask. Then, a condenser and a thermometer were set up. The solution was stirred at 70 °C until all solids are dissolved. The water bath was heated to 80 °C. Thereafter, the solution was slowly dropped with a dropping funnel. Subsequently, 27 g of LGE was added and allowed react for 12 h to obtain a dark yellow liquid. The product was added to 75% dichloromethane system, extracted, and then separated. The organic layer was dried with an anhydrous magnesium sulfate, and the anhydrous sulfuric acid was removed by suction magnesium. The obtained filtrate was rotary evaporated to remove dichloromethane, and the excess DMEA was distilled off under reduced pressure at 140 °C to obtain brown liquid DED. The product from the reaction of DMEA with NaH reacts with LGE to produce DED [29]. The reaction formula is as follows:

(2)

2.2.3 Synthesis of DEA (Foam Drainage Agent XY-1)

Approximately 10.74 g of CHPS-Na and an appropriate amount of 75% ethanol were added into a three-necked flask. Then, a condensing device and a thermometer were set up. The solution was then stirred at 50 °C for 30 min. Subsequently, 3.00 g of DED was slowly added and allowed to react for 8 h. The pH (test with PH test paper) was adjusted to 8–9 with sodium bicarbonate. Thereafter, the solution was cooled to room temperature and remove the solid by suction filtration. To obtain the filtrate was rotary evaporated to remove excess solvent to obtain a viscous yellow–brown liquid. After an appropriate amount of acetone was added, the solution was thoroughly stirred and washed, and a white powdery solid was obtained by suction filtration, which was dried under reduced pressure to obtain the product DEA. DED reacts with CHPS-Na in 75% ethanol to produce DEA [30,31,32]. The reaction formula is as follows:

(3)

2.2.4 Test Methods

  1. (1)

    Test of Foaming and Foam Stability

    The test method refers to the standard SY/T 6465–2000 “Evaluation Method of Foam Discharge Agent for Foam Drainage and Gas Recovery” and GB/T13173-2008 “Test Method for Surfactants and Detergents” to evaluate the foam performance of the product by the Ross–Miles foam method. The experimental steps of the Ross–Miles foam method are as follows: A foam drainage agent solution is prepared. Then, the solution is subjected to aging in a water bath at the experimental setting temperature for 30 min. Subsequently, the foam tube is filled with a 50 mL foam drainage agent solution. Next, the dropper is filled with a 200 mL foam drainage agent solution. Thereafter, the solution is discharged. The plunger of the dropper is opened, and the solution is dripped from the mouth of the bubbling tube, causing impact foaming. The foam height of 0, 3, and 5 min (the experiment was repeated three times) and the foam stabilization rate (stabilization rate = 5 min foam height/0 min foam height × 100%) are recorded. [33]. The experimental setup is shown in scheme 1.

    Scheme 1
    scheme 1

    Ross–Miles foam instrument (1-dropper, 2-metering tube, 3-jacket insulation tube)

  2. (2)

    Infrared Characterization

    Use potassium bromide and experimental samples to mix and press into thin sheets, put the pressed sheets into the sample rack of the sample bin, and scan with an infrared spectrometer.

  3. (3)

    Surface Tension Test

    Use the German KRUSS interface parameter integrated measurement system to measure the surface tension, use a syringe to absorb the foam system solution (be careful not to generate bubbles), and inject it into the test pipe of the instrument. Use the microsampling probe to suck up the methane gas and inject it into the test tube (it is sufficient to generate bubbles, and the smaller the bubbles, the more accurate). Seal the test tube and put it into the interface tension meter, and use the computer to adjust the instrument temperature and other relevant parameters (the experiment was repeated three times).

  4. (4)

    Coarse Behavior Test

    Use Waring stirrer to stir 200 mL of solution at a certain speed for 2 min, extract foam and inject it from the inlet of the visualization device. When the visualization device is filled, take photographs of foam coarsening behavior at different times for different foam systems through optical microscope, and analyze the images after taking photos.[34]

  5. (5)

    Liquid-Carrying Capacity

    Approximately 40 g/L simulated formation water was prepared and added with a 0.5% foam drainage agent. The solution was stirred well, add 190 mL foam drainage agent solution and 10 mL petroleum ether to the foaming tube, and keep the temperature at 90 °C for 10 min. Nitrogen was introduced into the test solution at a pressure of 0.05 MPa and a flow rate of 290 mL/min. The liquid carried by the foam was then collected in the collecting tube. The volume of the liquid carried by the foam was measured after 15 min, and the experiment was repeated three times.[35] The diagram of the experimental device is shown in scheme 2.

    Scheme 2
    scheme 2

    Liquid-carrying capacity test device (1-measuring cup, 2-constant temperature water bath, 3-foam collector, 4-foam tube, 5-flowmeter, 6-pressure gauge)

3 Results and Discussion

3.1 Reaction Conditions and Optimization

According to the research on the synthesis of single-long-chain alkyl betaine, the main factors affecting the synthesis reaction may include the reactant feeding ratio, temperature, and reaction time.[31] Single-factor experiments with these three influencing factors must be conducted in the final step to explore the optimal reaction temperature, feed ratio, and reaction time.

3.1.1 Effect of Reaction Temperature on Foaming Performance

DED dosage is 1 g under fixed conditions. The molar ratio of DED to CHPS-Na is 1:7. The amount of solvent 75% ethanol is 50 mL, and the reaction time is 8 h. The reaction temperature is changed to synthesize the experiment, and the foaming performance of the product is then evaluated. The experimental results are shown in Fig. 1.

Fig. 1
figure 1

The effect of reaction temperature on the foaming performance of the product

Figure 1 shows that the reaction temperature has a significant effect on the foaming performance of the product. The foaming performance of the product significantly decreases with the increase in temperature. Meanwhile, the foam stabilization performance slightly decreases. The reaction temperature for the best product performance is 50 °C. The experiment shows that a considerably high temperature is not conducive to the synthesis of foam drainage agent XY-1.

3.1.2 Influence of Feed Ratio on Foaming Performance

DED is changed under fixed conditions (50 mL solvent 75% ethanol, reaction temperature 50 °C, and reaction time 8 h). The feed ratio (molar ratio) of alcohol and CHPS-Na was used for the synthesis experiment. Then, the foaming performance of the product was evaluated. The experimental results are shown in Fig. 2.

Fig. 2
figure 2

The influence of the feed ratio on the foaming performance of the product

It can be seen from the results in Fig. 2 that the feeding ratio has a great impact on the foaming performance of the product. With the increase in the proportion of CHPS-Na, the foaming ability and foam stability of the product gradually increase. When the feeding ratio is 1:7, the product performance reaches the best. With the continuous increase in sodium CHPS-Na, the performance of the product decreases, so the optimal feeding ratio is 1:7.

3.1.3 Effect of Reaction Time on Foaming Performance

The molar ratio of DED to CHPS-Na is 1:7 under fixed conditions. The amount of solvent 75% ethanol is 50 mL, and the reaction temperature is 50 °C. The reaction time is changed, and the synthesis experiment is carried out. Then, the foaming performance is evaluated. The experimental results are shown in Fig. 3.

Fig. 3
figure 3

The effect of reaction time on foaming performance

Figure 3 shows that the foaming and foam stabilization performance of the product show an increasing trend with the increase in the reaction time. When the reaction time is longer than 8 h, the foaming performance gradually stabilizes. After the reaction time exceeds 9 h, the foam stabilization performance slightly decreases. Therefore, the optimal reaction time is 8 h.

In summary, DED and sodium CHPS-Na are the best. The reaction temperature is 50 °C, the best feed ratio is 1:7, and the best reaction time is 8 h.

3.2 Infrared Characterization

The structures of the final product DEA (foaming agent XY-1) and intermediate LGE and DED were characterized by Fourier transform infrared spectroscopy. The results are shown in the following figures.

It can be seen from Fig. 4 that there is a strong broad peak at 3415 cm−1, which is the peak generated by the stretching vibration of the associated hydroxyl O–H, and the peak at 1062 cm−1 indicates that there is a primary alcohol structure, which indicates that there may be an incompletely reflected dodecanol, and the molecules are associated with each other with hydroxyl groups; the strong double peaks at 2927 and 2856 cm−1, the strong peak at 1463 cm−1, and the peaks at 1380 cm−1 and 1344 cm−1 indicate that there are methyl, methylene, and methylene structures in the molecule; the peaks at 1257 and 848 cm−1 indicate the existence of epoxy structure in the molecule; the peaks at 1114 and 912 cm−1 indicate that saturated aliphatic ether structure exists in the molecular structure, indicating that dodecanol reacts with epichlorohydrin to form saturated aliphatic ether; the peak at 723 cm−1 indicates that there is a long-chain alkyl group in the molecule.[27] It indicates that LGE synthesis is successful.

Fig. 4
figure 4

Infrared spectrogram of LGE

It can be seen from Fig. 5 that there are strong broad peaks at 3453 cm−1 and 3419 cm−1, which are the peaks generated by O–H stretching vibration, indicating that there are associated hydroxyl groups in the molecule, and the peak at 1122 cm−1 is the peak generated by C-O stretching vibration of saturated secondary alcohols, indicating that there is a saturated secondary alcohol structure in the molecule; the strong double peaks at 2925 and 2857 cm−1, the strong peak at 1461 cm−1, the peak at 1369 cm−1, and the peak at 777 cm−1 indicate that there are methyl, methylene, and methylene structures in the molecule; the peak at 854 cm−1 indicates that there may be a small amount of epoxide in the molecule; the peaks at 2784, 1270 cm−1, and 1079 cm−1 indicate the existence of fatty tertiary amine structure in the molecular structure; the peak at 960 cm−1 indicates that the saturated aliphatic ether structure in the molecular structure may be a small amount of unreacted LGE; the peak at 721 cm−1 indicates that there is a long-chain alkyl group in the molecule.[29] To sum up, the infrared spectrum of DED reflects its characteristic functional groups, indicating that the synthesis of DED is successful (Fig. 6).

Fig. 5
figure 5

Infrared spectrogram of DED

Fig. 6
figure 6

Infrared spectrum of DEA

The spectrum of DEA demonstrates a strong and broad stretching vibration peak of the associated hydroxyl groups at 3250–3750 cm−1, C–H deformation vibration peaks of the bonded secondary alcohols near 1421 cm−1, and secondary alcohols near 1292 cm−1 flexural vibration peak. Methylene C–H stretching vibration double peaks near 2921 and 2852 cm−1, a methylene flexural vibration peak near 1469 cm−1, and N,N-dimethyl near 2736 cm−1 can be observed. The stretching vibration peaks of the base, the three peaks near 1238, 1184, and 1045 cm−1, are the C–N stretching vibration peaks in the (CH3)2-N-CH2-structure. A sulfonic acid structure can be also observed near 1342 cm−1 The C–S stretching vibration peak in C-SO2OH has a stretching vibration peak of S–O near 622 cm−1, which can prove that the substance has a sulfonic acid structure. A C–O–C stretching vibration peak of saturated fatty ether exists near 1099 cm−1 [32]. In summary, the infrared spectrum shows that the foam drainage agent XY-1 was successfully synthesized.

3.3 Performance Evaluation of Foam Drainage Agent

3.3.1 Surface Tension

Surface tension can reflect whether the substance has surface activity and the foaming properties of the foam drainage agent to a certain extent [36, 37]. In the experiment, the surface tension of different concentrations of foam drainage agent XY-1 solution was measured with the German KRUSS integrated measurement system for interface parameters. The experimental results are shown in Fig. 7.

Fig. 7
figure 7

Surface tension

The surface tension value can effectively reflect not only the foaming performance of the foam drainage agent but also the stability of the foam [38]. The lower the surface tension value, the more stable the foam. When the surface tension is sufficiently low, and the foam is impacted from the outside, the self-healing ability will be stronger. Figure 7 show that the surface tension of the foam drainage agent solution continues to decrease with the increase in the concentration of the foam drainage agent. When the concentration of foam drainage agent XY-1 is greater than 0.01 mol/L, the surface tension of the solution drops below 25 mN/m. The experiment shows that foam drainage agent XY-1 has better surface activity.

3.3.2 Coarse Behavior Analysis

The microscopic morphology of the foam can be well observed under a microscope. The change of the microscopic morphology of the foam can well reflect the foam performance. In the experiment, 150 mg/L of mineralized water (NaCl preparation for laboratory) was used to prepare a 0.5% foam drainage agent XY-1 solution. The foam drainage agent was stirred at 1500 r/min with a Waring agitator for 1 min, and the change of foam shape with time was observed under an optical microscope. The structure is shown in Fig. 8.

Fig. 8
figure 8

The microstructure of the foam (from left to right are 5, 10, 15 min)

The average diameter and polydispersity of foams (polydispersity coefficient p) can be described by the following formula:[34]

$$\overline{d} = \frac{{\sum_{i = 1}^{n} d_{i} }}{n}$$
(4)
$$p = \frac{{\sqrt {\overline{{d^{2} }} - \overline{d}^{2} } }}{{\overline{d}}}$$
(5)

where \(d_{i}\) is the diameter of a single foam and \(n\) is the total number of foams in the fixed field of view.

According to formulas (1) and (2), the average foam diameters are 220, 290, and 440 µm at 5, 10, and 15 min, respectively. The average foam diameter increases from 220 to 440 µm in 5–15 min, and the increase rate is relatively fast. This finding indicates that the foam system will undergo more rupture processes during the coarsening. Thus, adjacent foams instantly merge, and the overall scale of the foam is improved.

3.4 Influencing Factors of the Foam Drainage Agent

The Ross–Miles foam method was used to evaluate the foam performance of foam drainage agent XY-1 synthesized according to the optimized synthesis conditions.

3.4.1 Influence of Using a Concentration on Foam Performance

A foam drainage agent solution with mass fractions of 0.1, 0.2, 0.3, 0.4%, and 0.5% was prepared with the mineralized water described in the standard. The foam performance was evaluated when the experimental temperature was 40 °C. The experimental results are shown in Fig. 9.

Fig. 9
figure 9

The effect of concentration on the performance of foam drainage agent

Figure 9 shows that the foaming and foam stabilization performance of the foam drainage agent have been greatly improved with the increase in the concentration of the foam drainage agent solution. The foaming performance was gradually stable when the concentration is greater than 0.5%. Meanwhile, the foam stabilization performance begins to stabilize when the concentration is greater than 0.3%. Therefore, considering the foam performance and cost, the optimal concentration of foam drainage agent XY-1 is determined to be 0.5%.

3.4.2 Influence of Temperature on Foam Performance

The temperature at the bottom of the gas well is usually high, so the temperature resistance of the foam drainage agent is also an important indicator for evaluating the performance of the foam drainage agent. The standard mineralized water is prepared, the foam drainage agent is set into 0.5% foam drainage agent solution with mineralized water, and the solution is at 50 °C, according to the standard SY/T 6465–2000 “Evaluation Method of Foam Drainage Agent for Foam Drainage and Gas Recovery”. The performance of the foam drainage agent was tested after aging in a 60, 70, 80, and 90 °C water bath for 30 min. The experimental results are shown in Fig. 10.

Fig. 10
figure 10

The influence of temperature on the performance of foam drainage agent

Figure 10 shows that the foaming performance of the foam drainage agent has been significantly improved with the increase in temperature. However, the foam stabilization performance has been greatly reduced. The water evaporation rate in the foam drainage agent solution becomes faster due to the temperature rise, which has the effect of blowing foam and significantly improves the foaming performance of the foam drainage agent. Moreover, the increase in temperature reduces the viscosity of the solution. The thermal movement rate of the molecules is improved, the foam discharge rate is accelerated, the foam liquid film is thinned and ruptured, and the foam stability is significantly reduced.[39, 40]

3.4.3 Influence of Salinity on Foam Performance

The degree of salinity also has a significant impact on the foam drainage agent [40]. A mineralized water with degrees of mineralization of 10, 20, 30, 40, and 50 g/L was used to prepare a 0.5% foam discharge. The agent solution was evaluated by using the pouring method at 40 °C. The result is shown in Fig. 11.

Fig. 11
figure 11

The influence of salinity on foam drainage agent

Figure 11 shows that the foaming performance of the foam drainage agent slightly decreases when the salinity increases from 10 to 40 g/L. The foam stabilization performance first increase and then decreases. When the salinity is higher than 40 g/L, the foaming and stabilizing abilities of the foam drainage agent begin to significantly decline. Meanwhile, the foam performance of the foam drainage agent has a significant decreasing trend compared with the foam performance when the salinity is 40 g/L. This finding shows that foam drainage agent XY-1 can withstand the maximum salinity of 40 g/L.

3.4.4 Influence of Condensate Oil on Foam Performance

The condensate in the gas well also has a great influence on the foam drainage agent [41]. We evaluated the foam drainage agent performance when the condensate content was 0, 5, 10, 15, and 20% using petroleum ether to simulate the condensate oil. The result is shown in Fig. 12.

Fig. 12
figure 12

The influence of condensate oil on foam drainage agent

Figure 12 shows that the addition of condensate oil will reduce not only the foaming performance of the foam drainage agent but also the foam stabilization performance; however, it has a certain resistance to 5–15% condensate oil. In this interval, the foaming and foam stabilization performance of the foam drainage agent are relatively stable. When the condensate oil content continues to increase to 20%, the foam performance of the foam drainage agent will significantly drop. Therefore, foam drainage agent XY-1 can withstand 5–15% of condensate oil; beyond this range, its foaming performance and foam stabilization performance will be greatly reduced.

3.4.5 Effect of Methanol on Foam Performance

In natural gas wells, methanol is generally added to prevent the formation of hydrates. The indoor experiment explores the effect of methanol on the performance of the foam drainage agent by adding different mass concentrations of methanol. The methanol concentrations are set to 0, 5, 10 and 15, 20, 25%. The experimental conditions are described in the standard SY/T 6465–2000 “Evaluation Method of Foam Drainage Agent for Foam Drainage and Gas Recovery.” The concentration of the foam drainage agent is 0.5%. The experimental results are shown in Fig. 13.

Fig. 13
figure 13

The effect of methanol on foam drainage agent

Figure 13 shows that the foaming and foam stabilization performance of the foam drainage agent will decrease to a certain extent when the methanol mass fraction is between 5 and 15%, but the overall change is not large. The foaming and foam stabilization performance of the foam drainage agent are greatly reduced when the methanol content exceeds 15%. The hydrocarbon structure in the methanol molecules participates in the formation of the micelles of the foaming agent, the critical micelle concentration decreases, and the foaming of the foam drainage agent is enhanced when the methanol concentration is low. Furthermore, the methanol molecules use hydrogen bonds adsorbed on the surface of the foam film when the methanol concentration continues to increase, thereby reducing the stability of the foam film.[42]

3.4.6 Influence of pH on Foam Drainage Agent

The pH of the flowback fluid will also have a greater impact on the performance of the foam drainage agent. Experiments are carried out under the conditions of the reference standard, and the foam performance of the foam drainage agent XY-1 is measured when the pH (test with PH test paper) values are 4, 5, 6, 7, 8, and 9. The experimental results are shown in Fig. 14.

Fig. 14
figure 14

The effect of pH on foam drainage agent

Figure 14 shows that the pH has little effect on the foaming performance of foam drainage agent XY-1, and the foaming performance of the foam drainage agent only slightly decreases in acid and alkali environments. However, the acidic environment affects the foam drainage agent XY-1. The foam stabilization performance of 1 has a greater impact. This performance will decrease when pH = 4. Meanwhile, the foam stabilization performance of the foam drainage agent will first increase and then decrease when the pH is 5–9. In summary, pH has little effect on the foaming performance of foam drainage agent XY-1, but it has a great impact on the foam stabilization performance.

3.5 Formation Condition Test

The foaming performance, foam stabilizing performance, and liquid-carrying capacity of the foam drainage agent can comprehensively reflect the quality of a foam drainage agent and its adaptability in a certain gas reservoir. In this work, synthesized foam drainage agent XY-1 was tested under the formation conditions of the gas well in Weiyuan X block. The formation temperature is 90 °C, the salinity is 40 g/L, and the content of condensate oil (replaced with petroleum ether) is 5%. The agent in this study is compared with the two foam drainage agents (HYX-4A and UT-5D) used on site.

3.5.1 Foaming Experiment under Formation Conditions

The experiment was carried out with the Ross–Miles foam instrument under the above conditions, and the experimental results are shown in Fig. 15.

Fig. 15
figure 15

Formation condition experiment

Figure 15 shows that the three foam drainage agents have been tested under formation conditions. The foaming and foam stabilization performance of foam drainage agent XY-1 are significantly better than those of foam drainage agents HYX-4A and UT-5D. The figure shows that foam drainage agent XY-1 still has good applicability under the conditions of high temperature, high salt, and condensate oil.

3.5.2 Liquid-Carrying Capacity Experiment Under Formation Conditions (参考文献)

The results of the experiment are shown in Fig. 16.

Fig. 16
figure 16

Liquid-carrying experiment under formation conditions

Figure 16 depicts that the liquid-carrying capacity of the three foam drainage agents is more than 150 mL, and the liquid-carrying rate (liquid-carrying rate = liquid-carrying amount/total liquid amount × 100% [42]) is above 75%. The liquid-carrying rate of the foam drainage agent XY-1 is significantly higher than that of the foam drainage agents HYX-4A and UT-5D used on site. This finding shows that foam drainage agent XY-1 has excellent performance and can be used for foam drainage in the gas reservoirs.

4 Conclusion

  1. (1)

    A temperature- and salt-tolerant betaine-type foam drainage agent was synthesized through a two-step etherification and one-step quaternization. The synthesis conditions were optimized, and the best reaction temperature was 50 °C. The best feed ratio of DED to CHPS-Na is 1:7, and the best reaction time is 8 h.

  2. (2)

    Foam drainage agent XY-1 has been successfully synthesized through infrared characterization and surface tension measurement. The surface tension and microscopic morphology measurement have proved that the agent has good surface activity.

  3. (3)

    The optimal use concentration of the foam drainage agent was determined by evaluating the foaming and foam stabilization performance of the different concentrations of foam drainage agent solutions.

  4. (4)

    The effects of temperature, salinity, condensate oil, methanol, and pH on the performance of the foam drainage agent have been tested. The foam drainage agent has been proven to have a good foaming effect and a certain foam stabilization effect under the condition of 90 °C. The foam performance is good when the salinity is 40 g/L. Meanwhile, the foam performance is relatively stable when the condensate content is 5–15%. The foaming and stabilizing performance are still good when the methanol content is 5–15%. When the pH is 5–9, it has little effect on the performance of the foam drainage agent.

  5. (5)

    In the experiment of formation conditions, the foaming, stabilizing, and liquid-carrying performance of the foam drainage agent XY-1 are better than the two commonly used foam drainage agents in the field. The study proved that the agent has good adaptability in high temperature and high salt gas reservoirs and can be used for bubble drainage and gas recovery of gas reservoirs.