Introduction

The oil and gas industry, a vital sector reliant on fossil fuels (the primary source of energy), necessitates meticulous management. Essential to this industry is completion and workover operations, which are critical for preparing the wellbore for production or enhancing well productivity. These operations employ specialized fluids designed with unique functions and properties tailored to meet the specific conditions and objectives of each well, ensuring efficient and effective extraction of these crucial energy resources (Bigdeli and Delshad 2023; Crumpton 2018). One of the most important types of fluids used in these operations is well completion fluid, which is a solid-free fluid that fills the wellbore during completion or workover operations. Well completion fluid has various functions, such as controlling formation pressure, protecting the formation from damage, reducing corrosion, and enabling well testing and evaluation (Civan 2007; Wan 2011). Another type of fluid that is essential for the longevity of a producing well is packer fluid, which is a type of completion fluid that fills the annulus between the tubing and casing above the packer. Packer fluid provides hydrostatic pressure, lowers differential pressure, seals any leaks, and protects metal surfaces from corrosion (Wang 2021). Well completion fluids and packer fluids can be made of various materials, such as salt brines, drilling fluids, solids-free fluids, or insulating fluids. The selection and formulation of these fluids should be done with care as they affect the performance and lifespan of a well (Kalatehno and Khamehchi 2021; Wang 2021).

Formate-based brines have been utilized for many years in the drilling and completion of oil and gas fields. Sodium, potassium, and cesium formates are the most crucial salts employed as heavy brine. Formate salts, characterized by high purity, are organic salts capable of elevating the brine density from 62.84 to 150 pcf (Berg et al. 2009; Bungert et al. 2000; Downs 2011; Downs 2010; Miksic et al. 2004; Nottveit 2003; Oswald, Knox, and Monem 2006; Qureshi, Ali, and Preining 2008; Saasen et al. 2002; Simpson et al. 2005; Simpson et al. 2009). Olsvik et al. (2013) evaluated the use of formate brines as non-damaging drill-in and completion fluids for eight HPHT gas condensate fields, and highlighted the advantages of cesium formate brine in open holes with sand screens (Olsvik, Howard, and Downs 2013). Fleming et al. (2016) investigated the potential formation damage and well productivity impairment in the Valemon HPHT gas/condensate field, where potassium/cesium formate was used as drilling and completion fluid for wells completed with stand-alone screens (Fleming et al. 2016). Jøntvedt et al. (2018) reported the successful drilling and completion of an open-hole reservoir in the Martin Linge field using a formate brine-based mud system, and noted that Statoil was the largest user of formate fluids in HPHT condensate gas fields in Norway (Jøntvedt et al. 2018).

Nitrate-based completion fluids are medium-density fluids that consist of various nitrate salts, such as sodium nitrate, potassium nitrate, and calcium nitrate. These fluids have several advantages over other types of completion fluids, such as high solubility in water, anti-corrosion properties, and the ability to achieve a maximum density of 110 pcf by mixing monovalent and divalent nitrate salts (Dong et al. 2018; Sangka and Budiman 2016). Moreover, nitrate completion fluids have been shown to improve the porosity and permeability of the formation, and have been successfully used in different well applications around the world (Sangka and Budiman 2016). One of the challenges in using nitrate completion fluids is to understand the phase behavior of the salt mixtures, especially when calcium nitrate and zinc nitrate are involved. Belova et al. (2017) conducted a thorough investigation of the phase equilibrium diagram of these two salts and determined the complete phase diagram. They also measured the density and pH values of the fluids at different temperatures, ranging from − 20 to 10 °C (Belova et al. 2017).

Phosphate-based fluids have emerged as a viable alternative to completion fluids traditionally employed in the oil and gas industry, such as formates, chlorides, and bromides. Phosphate-based fluids offer several advantages over their formate, chloride, and bromide counterparts. Phosphates exhibit greater compatibility with the environment compared to common formates, bromides, and chlorides. They also boast a more suitable density and are more cost-effective.

Several studies have reported the successful application of phosphate-based brines in oil and gas wells. Sangka and Budiman (2010) documented the use of these brines in some exploratory wells in Indonesia between 2008 and 2010 (Sangka and Budiman 2010). Falana et al. (2010, 2012a, b) developed a heavy phosphate-based brine with a density of 74.8 pcf, a viscosity of at least 5 MPa/s, and a corrosion inhibitor and a hydrated polymer as additives (Olusegun Matthew Falana, Hoxha, et al., 2012; Olusegun Matthew Falana, Marshall, and Zamora, 2012; Olusegun M Falana, Ugwu, Veldman, Zamora, and Gilmer 2010). Budiman and Hendra (2011) formulated a novel mixture of phosphate salts, including KH2PO4 and K2HPO4, that had high density, low corrosion, stability, and compatibility with the formation and environmental friendliness (Budiman 2011). Collins et al. (2014, 2015) attempted to complete a well using a phosphate brine composed of K3PO4 (TKP), water, NaBr, and a corrosion inhibitor, with a density of about 112.2 pcf (Collins and Thaemlitz 2014, 2015). Jia Hu et al. (2019) conducted a series of dissolution experiments to improve the density of potassium-based phosphate brines (K3PO4, K2HPO4, and K4P2O7) (Jia et al. 2019). Mahdavi Kalatehno and Khamehchi (2021) explored the development of a new packer fluid for well completion in high-temperature, high-pressure, and low-permeability reservoirs. The fluid, made of potassium hydroxide and phosphoric acid, was stable, environmentally friendly, and low in corrosion. The maximum density of the fluid was 106 pcf. The authors also evaluated the fluid’s temperature stability, viscosity control, and crystallization resistance. Their study suggested that the fluid could be a cost-effective and environmentally friendly solution for well completion (Kalatehno and Khamehchi 2021). Jinhua et al. (2023) and Huo Jinhua and Zhang Xing (2023) conducted two related studies on the development of environmentally friendly, high-density, and low-damage solid-free completion fluids based on compound phosphate. These fluids are designed to meet the challenges of high-temperature, high-pressure conditions in oil and gas wells. Both studies used zinc chloride, calcium bromide, and compound phosphate to create fluids with different densities (112.37, 106.13, and 100 pcf). They also optimized the fluid compositions and evaluated their performance in terms of solid-free characteristics, density stability, pH stability, and environmental compatibility. The main difference between the two studies is that Jinhua et al. (2023) focused on the role of solubilizers in enhancing the density stability and solubility of the fluids, while Huo Jinhua and Zhang Xing (2023) explored the effects of various chemical reagents, such as deoxidizers and corrosion inhibitors, on the fluids. Moreover, Jinhua et al. (2023) emphasized the compatibility of the fluids with other fluid systems, while Huo Jinhua and Zhang Xing (2023) aimed to meet the requirements of drill-in fluids, which are used to drill and complete the well in one step. Both studies indicated potential applications of compound phosphate-based fluids in high-temperature, high-pressure environments, highlighting their advantages over conventional completion fluids (Jinhua and Xing 2023; Jinhua et al. 2023).

In both land-based and offshore locations worldwide, oil and gas reserves are often found in reservoirs marked by high temperatures, elevated pressures, and limited permeability. These distinctive traits present substantial obstacles when it comes to finalizing well operations in these reservoirs. Therefore, a critical focus within the oil industry revolves around crafting a completion fluid that is free from solids, showcases remarkable density, and demonstrates outstanding resilience to high temperatures. This article presents the results of an experimental study on three types of completion fluids: potassium acetate, potassium formate, and a phosphate-based fluid. The study unfolded in three distinct phases. Initially, the density of potassium acetate/formate was increased using sodium/potassium nitrate, while phosphate-based brines were formulated to achieve densities over 100 pounds per cubic foot (pcf). The Taguchi method was employed to design and optimize these completion fluids, targeting high liquid density with pH values between 7 and 10.5.

Subsequently, the fluids underwent testing for corrosion, thermal stability, and formation damage potential, following the attainment of the desired densities. The experiments were meticulously conducted in adherence to the established guidelines of the National Iranian Drilling Company (NIDC). The final phase involved Coreflood Experiments on the phosphate-based fluid to assess formation damage in detail. Leveraging these data, two novel machine learning models were developed to predict fluid penetration depth into the core. These models utilized an artificial neural network (ANN) and genetic programming (GP) for their predictions.

The innovative aspects of this research are manifold. They include the development of a synthetic phosphate fluid composed of phosphoric acid and potassium hydroxide without a solubilizer, achieving a density of 114 pcf and complete transparency without solid particulates. Additionally, diammonium phosphate was introduced as a pH inhibitor, proving to be highly compatible with the phosphate-based fluid and effective in preventing clay swelling and formation damage due to high pH levels. The study also explored the use of both existing and novel inhibitors for enhanced corrosion and pH control of the phosphate-based fluid. Lastly, the research pioneered the creation of a machine learning model that predicts the depth of fluid penetration into the core, based on Coreflood Experiments data.

Materials

Brine

In this research, potassium acetate, potassium formate (synthesized from two substances, potassium hydroxide and formic acid), and phosphate-based fluid (synthesized from two substances, potassium hydroxide and phosphoric acid) were employed as base fluids for optimal completion fluid. Additives such as potassium/sodium nitrate, potassium vanadate, thiourea, aluminum powder, and diammonium phosphate were also utilized.

Formation fluid

The study entailed a comprehensive collection and preparation of formation water, crude oil, and condensate samples from a southern Iranian oil and gas field. A key parameter of the crude oil characterized by a density of 0.864 gr/cm3 at stock tank conditions and a temperature of 190℉. Samples were collected, transported to the laboratory, filtered, stabilized, and stored before analysis. Ionic constituents were determined using techniques such as ion chromatography, gas chromatography, and mass spectrometry. The results are presented in Tables 1, 2, and 3, respectively.

Table 1 Formation water compositions
Table 2 Condensate compositions
Table 3 Crude oil compositions

Cores and thin sections

A coreflood test was conducted on a core sample obtained from a carbonate reservoir in southern Iran, as depicted in Fig. 1. Thin sections, with a thickness of 0.08 inches and a diameter of 1.42 inches, were prepared from both the carbonate and sandstone components of the cores, as illustrated in Fig. 2.

Fig. 1
figure 1

Carbonate Core

Fig. 2
figure 2

Sandstone and Carbonate Thin Sections

Corrosion coupons

Steel samples made of L80 alloy were used to evaluate corrosion.

Methods

Density and pH

Completion fluids are essential in wellbore operations post-drilling, serving to control oil and gas flow and assist in equipment installation. They create hydrostatic pressure to counterbalance reservoir pressure. High-temperature and high-pressure conditions in oil and gas reservoirs necessitate the use of heavy-weight completion fluids to avert fluid influx and protect the formation. The density requirement of these fluids is contingent upon reservoir depth; shallow, high-pressure reservoirs require denser and more expensive fluids, often surpassing 100 pounds per cubic foot. In contrast, deep, low-pressure reservoirs can utilize medium-weight fluids, which are more economical due to the natural hydrostatic pressure exerted by greater depths (Kalatehno and Khamehchi 2021).

The pH level of the completion fluid stands as another critical factor influencing its performance and compatibility with the reservoir. Completion fluids with elevated pH levels have the potential to induce clay swelling, scale deposition, and corrosion, which, in turn, can compromise permeability and harm the formation. Conversely, completion fluids with low pH levels can incite corrosion and lead to the acidification of the formation (Al Moajil, Khaldi, Hamzaoui, Al-Rustum, and Al-Badairy 2017; Crumpton 2018; Bilel Hamzaoui and Moajil 2018). The optimal pH range for completion fluids should be between 7 and 10.5. Consequently, it becomes essential to either adjust or inhibit the pH of the completion fluid to conform to this prescribed range.

This section delves into a series of experiments undertaken to design and optimize a completion fluid, employing the Taguchi method. The primary goal was to attain a high fluid density while maintaining a pH value within the desired range. All experiments were carried out at a consistent temperature of 77°F and under standard atmospheric pressure. To measure fluid density, the pycnometer method was employed in accordance with ISO 13503-3-2006. Simultaneously, fluid pH measurements were conducted using a pH meter.

Corrosion

Corrosion significantly impacts oil and gas well operations, damaging well structures and pipes in brine-rich environments. Brine, the primary component in completion fluids, is essential for well finalization but can accelerate corrosion in metallic elements like L80 steel used in well piping. The corrosion rate depends on various factors such as salt type and concentration, temperature, pressure, and corrosive gases such as CO2 and H2S. Consequently, careful design and selection of brines are crucial to prevent corrosion and ensure the integrity of well components (Kalatehno and Khamehchi 2021; Xu et al. 2018).

To assess the corrosion rates of brines used in completion fluids, the weight loss method specified in API RP13 was employed. The corrosion testing was conducted under specific conditions, maintaining a temperature of 180°F and ambient pressure for a duration of 72 h, with the corrosion rate meticulously recorded at each stage. The findings derived from these corrosion tests play a pivotal role in determining the most suitable and compatible brine solutions for safeguarding well pipes and equipment. The optimal corrosion rate for completion fluids at 180°F should not exceed 4 milli-inches per year (mpy).

High-temperature stability

The thermal stability of completion fluids is crucial for maintaining formation pressure and integrity. These fluids, when exposed to the wellbore’s high temperatures, can experience changes in density and solubility, potentially leading to reduced effectiveness and well-related issues. It is essential to use fluids that exhibit minimal density changes (no more than 2 pcf) under thermal stress. To ascertain this stability, high-temperature tests are conducted on brine solutions within heat-resistant, sealed containers across temperatures ranging from 25 to 285 °C. These tests determine the most appropriate fluids for specific well conditions by monitoring density changes over time.

Formation damage

Fluid compatibility

This section examines the interactions between completion fluid and formation fluid within reservoir rocks, with a focus on preventing formation damage and emulsion formation. Formation damage is characterized by a reduction in permeability, resulting from chemical reactions that generate solids or emulsions, which obstruct the pores of the reservoir rock. These reactions are influenced by the concentrations of salts and ions in both fluids. For instance, seawater, commonly used as a completion fluid, has high sulfate ion levels and low calcium, barium, and strontium ion levels. In contrast, some formation fluids have high concentrations of calcium, barium, and strontium ions but low sulfate ion levels. Mixing these fluids can precipitate insoluble salts such as calcium sulfate, barium sulfate, or strontium sulfate, leading to pore blockage in the reservoir rock (Bigdeli, Thyne, and Ulyanov 2023a; Bigdeli, von Hohendorff Filho, and Schiozer 2023b; Civan 2023; Kalatehno and Khamehchi 2021; Keihani Kamal et al. 2024; Montgomery 2017). Additionally, this section underscores the significance of preventing water and oil emulsions, which markedly enhances the efficiency and integrity of oil and gas production and processing operations. The absence of emulsions simplifies the separation of oil and water phases, enabling more efficient oil extraction, reducing energy consumption, and decreasing operational costs (Goodarzi and Zendehboudi 2019; Hong et al. 2023).

To assess the compatibility of completion fluids with formation fluids, laboratory tests were performed to mimic downhole conditions and quantify the formation of solids or emulsions upon mixing the fluids. Three distinct completion fluids were tested, each mixed with three different formation fluids: formation water, crude oil, and condensate. Mixtures were prepared in ratios of 25:75, 50:50, and 75:25 and then heated in an oven at 150 degrees Fahrenheit for 72 h. The appearance properties of the fluids, including suspended and settled sediments, water, and hydrocarbon emulsion formation, were evaluated before and after oven exposure.

Wettability alteration

Wettability, the affinity of a fluid to adhere to a solid surface, significantly affects fluid flow in oil and gas reservoirs (Ahmed 2006; Kalatehno and Khamehchi 2021). Sandstone formations are typically water-wet, allowing hydrocarbons to migrate easily, while carbonate formations are often oil-wet, restricting fluid flow and reducing permeability. These wettability characteristics, which are usually permanent, play a crucial role in the recovery and productivity of wells (Kalatehno and Khamehchi 2021).

This section used the contact angle measurement method to evaluate the wettability properties of carbonate and sandstone thin sections. The method involved submerging the thin sections horizontally in formation water at first. Then, a small droplet of kerosene was gently placed on the underside of each thin section. Images of the contact interface between the kerosene droplet and the thin section were captured, and Digimizer software was used to calculate the contact angle relative to the thin section’s surface. After the initial contact angle measurement, the thin sections were immersed in brine solutions and exposed to 72 h of saturation in an oven set at 185°F. Upon completion, the thin sections were thoroughly cleaned with n-Heptane and water before being carefully dried. Finally, a second round of contact angle measurements was performed to measure any changes in wettability resulting from the exposure to brine solutions. Contact angle of 0–75 degrees is referred to as water-wet; a contact angle between 75 and 105 degrees is referred to as neutral; and a contact angle of 105–180 degrees is referred to as oil-wet (Dandekar 2013).

Clay swelling

Clay swelling, a significant issue in formation damage, occurs when water molecules interact with clay’s crystalline structure, leading to increased size and volume (Fink 2021). This can reduce the permeability of reservoir rocks, adversely affecting well performance and recovery (Anderson et al. 2010). Factors such as clay type, fluid pH, temperature, and salinity influence swelling, with certain clays like smectite being more susceptible. To mitigate this, maintaining fluid pH between 7 and 11 is crucial (BS Hamzaoui and Al Moajil 2018; Bilel Hamzaoui and Moajil 2018; Bilel Hamzaoui, Moajil, Yami, and Hazzazi 2018). The study assessed clay swelling potential using laboratory tests aligned with ASTM D5890 standards (ASTM 2006).

Coreflood experiments

Formation damage, a significant challenge in well operations, is often attributed to the compatibility between rocks and fluids (Kalatehno et al. 2023; Keihani Kamal et al. 2024). Completion and workover fluids, at times, contain suspended solids that can potentially obstruct pore throats and reduce permeability, underscoring the need for fluid compatibility with the formation (Dargi et al. 2024; von Hohendorff Filho et al. 2023). This study utilized a coreflood test with a carbonate core to assess permeability damage from a phosphate-based fluid, Test 83. The core’s initial saturation and permeability were measured, followed by a 60-min exposure to the fluid using a Vinci FDS 350 device, which recorded pressure data without actively pumping the fluid into the core. Post-exposure, the core’s return permeability was evaluated to determine the fluid’s impact on the porous medium.

Machine learning

Effective model performance is contingent upon the rigorous data preparation undertaken in this study. This process entailed comprehensive cleaning and preprocessing steps tailored to enhance data quality for our specific dataset. Data cleaning involves identifying missing values, outliers, and extraneous features (Ehsani et al. 2023, 2024; Jo 2019; Yousefmarzi et al. 2024; Zamani et al. 2023). Preprocessing procedures transform data into a format intelligible by machine learning algorithms, often involving scaling or normalization to ensure uniform feature scales. Normalization is a key technique in this process, reshaping variables or features to a new range, typically between 0 and 1 or − 1 and 1. This standardized format facilitates equitable comparison and amalgamation of variables, enhancing precision in analysis and modeling. The normalization process involves deducting the minimum value of each index from its actual value and dividing the outcome by the range of that index. This simplifies the comparison of indicators with diverse units or magnitudes and expedites the training process (Bigdeli et al. 2020; Dargi et al. 2023; Khamehchi et al. 2023).

This part aims to evaluate the penetration depth of Test 83 completion fluid into the core using data from the coreflood test. To estimate this parameter, this study uses two machine learning models, an artificial neural network (ANN) and a genetic programming (GP). ANN and GP models can identify intricate patterns and correlations between input and output variables, making them suitable for modeling complex relationships and capturing nonlinear patterns in data. Their reliability, accuracy, and unique characteristics make them popular choices for this purpose. The models were developed using 362 samples and input variables such as permeability, bulk volume, injection volume, and inlet–outlet pressure drops. This innovative methodology is the first to use machine learning to predict the penetration depth of completion fluid into the core using data from the coreflood test.

Figure 3 shows the effect of hidden layer sizes on the performance of the multilayer perceptron (MLP) model, which is a type of artificial neural network. The performance is measured by the R-square score, which is a statistical indicator of how well the model fits the data. A higher R-square score means a better fit and a lower error. In this figure, one line depicts the training score. The training score is the R-square score obtained when the model is trained on the same data that it is tested on. The training score increases as the number of neurons in the hidden layers increases. This means that increasing the number of neurons improves the ability of the model to learn from the data and capture the complex relationships between the input and output variables. However, the figure also shows that the training score reaches a peak at 5 neurons per hidden layer and then starts to decline. Therefore, the optimal number of neurons per hidden layer for the MLP model is 5.

Fig. 3
figure 3

Effect Of Hidden Layer Sizes On MLP Performance

Table 4 shows the hyperparameters used for the selected MLP model, which has 1 hidden layer and 5 neurons per hidden layer. The table also shows the activation function, the solver, the learning rate, and alpha for the model. These are other important parameters that affect the performance of the model.

Table 4 Hyperparameters used in the model

Results and discussion

Density and pH

Potassium acetate

The properties of a potassium acetate salt solution were investigated in this study. Three experiments were conducted using 100 mL of water to dissolve varying amounts of potassium acetate salt. The results are presented in Table 5.

Table 5 Test data of potassium acetate salt solution

The density results indicate that the solution’s density increased as the amount of potassium acetate increased. Test 3 yielded the highest density (85 pcf). The settling results show that none of the experiments exhibited any settling after 24 h, implying that the potassium acetate salt dissolved completely in water without forming any precipitates or sediments. This is desirable for a completion fluid, as it prevents clogging or damage to the wellbore or formation. The pH results reveal that the solution’s pH ranged from 8 to 9 in all experiments, indicating that the solution was slightly alkaline. This is also favorable for a completion fluid as it reduces corrosion and scaling problems. Based on these results, it can be concluded that potassium acetate salt can be used to prepare a completion fluid with moderate density and pH. However, since this study focuses on completion fluids with high density, potassium acetate salt alone cannot produce a fluid with a density greater than 85 pcf. Therefore, further experiments are necessary to increase the density by adding other materials that increase the fluid’s weight, such as nitrate salts.

Potassium acetate and nitrate salts: composition

This section presents the results of an experiment aimed at increasing the density of potassium acetate fluid to above 85 pcf by adding various nitrate salts. The experiment was designed using the Taguchi method, a statistical technique for optimizing process performance by varying parameters and levels in an orthogonal array. The experiment consisted of three phases, each comprising nine tests. In each phase, three factors were varied at three levels, resulting in an L9 orthogonal array. The factors and levels for each phase are detailed in Table 6.

Table 6 The level of various parameters necessary for the production of potassium acetate solutions and nitrate salts

In Phase 1, potassium acetate and potassium nitrate were varied at three levels each, and the results are presented in Table 7. The table reveals that the density increased only between Tests 10 and 11 with the addition of potassium nitrate. In other cases, the addition of potassium nitrate caused settling. The highest density achieved was 88 pcf in Test 4, using 30 mL of potassium acetate and 5 g of potassium nitrate.

Table 7 Results of potassium acetate/potassium nitrate salt solution density and pH

In Phase 2, potassium acetate and sodium nitrate were the only substances used. The results are shown in Table 8. The table demonstrates that the density increased only between Tests 16 and 17 and from Tests 19 to 20 with the addition of sodium nitrate. In other cases, the addition of sodium nitrate caused settling. The highest density achieved was 86.95 pcf in Test 20, where 50 mL of potassium acetate and 4 g of sodium nitrate were used.

Table 8 Results of potassium acetate/sodium nitrate salt solution density and pH

In Phase 3, potassium acetate, potassium nitrate, and sodium nitrate were varied at three levels each, and the results are displayed in Table 9. The table reveals that the density did not increase with the addition of more than a special amount of potassium nitrate and sodium nitrate; instead, these substances caused settling, which is undesirable for a completion fluid. The highest density achieved was 87.10 pcf in Test 29, using 38 ml of potassium acetate, 2 g of potassium nitrate, and 1 g of sodium nitrate.

Table 9 Results of potassium acetate/potassium nitrate/sodium nitrate salt solution density and pH

This experiment demonstrated that the liquid density of potassium acetate can be increased by adding different nitrate salts, although the increase is not substantial. The maximum increase in density was only 3 pcf, from 85 to 88 pcf. Additionally, adding these salts did not affect the pH of the solution, which remained at 9 in all tests. However, the addition of these salts increased the crystallization point of the solution, which ranged from -0.4°F to 60°F in all tests. This indicates that the solution would freeze at lower temperatures, which could pose challenges in cold environments.

Potassium formate

The experiment involved mixing 15% by weight of potassium hydroxide and 25% by weight of formic acid in water. The reaction was exothermic, meaning that it released heat and produced potassium formate and water as the products. The resulting fluid was clear and colorless, with no precipitates or sediments. The density of the fluid was found to be 96 pcf, which is higher than the density of water (62.4 pcf) or potassium acetate (85 pcf). The pH of the fluid was found to be between 7 and 8, which is neutral or slightly alkaline, which is favorable for a completion fluid as it reduces corrosion and scaling problems. Figure 4 left illustrates the synthesis of potassium formate, while Fig. 4 right displays the solution of potassium formate after reaction.

Fig. 4
figure 4

Potassium Formate Solution Reaction Set-Up

Potassium formate and nitrate salts: composition

This part shows the results of the experiments that were done to make the fluid density of potassium formate higher than 96 pcf by adding two nitrate salts. Similar to the preceding section, this experiment encompassed three phases, each of which featured nine tests. The specifics of the factors and their respective levels for each phase are comprehensively outlined in Table 10.

Table 10 The level of various parameters necessary for the production of potassium formate solutions and nitrate salts

Phase 1: In this phase, potassium formate and potassium nitrate were varied at three levels each. The results are shown in Table 11. The table shows that the addition of potassium nitrate led to an increase in density in solutions of 40 and 50 ml of potassium formate. However, it is important to observe that within a 30-ml solution, adding more than 5 g of potassium nitrate resulted in settling. The highest density obtained was 100.08 pcf in the Test 35, which used 40 ml of potassium formate and 7 g of potassium nitrate.

Table 11 Results of potassium formate/potassium nitrate salt solution density and pH

Phase 2: In this phase, potassium formate and sodium nitrate were varied at three levels each. The results are shown in Table 12. The table demonstrates that adding sodium nitrate to a 30-ml solution and adding more than 5 g to a 40-ml solution of potassium formate resulted in the solution settling. Nonetheless, the addition of sodium nitrate across three discrete levels (4, 5, and 6 g) to a 50-ml solution of potassium formate not only averted settling but also contributed to an increase in solution density. The pinnacle of density, reaching 99.78 pcf, was achieved in Test 44, where 40 ml of potassium formate and 5 g of sodium nitrate were judiciously combined.

Table 12 Results of potassium formate/sodium nitrate salt solution density and pH

Phase 3: In this phase, potassium formate, potassium nitrate, and sodium nitrate were varied at three levels each. The results are shown in Table 13. It is evident from Table 13 that within the 36-ml solution of potassium formate, density exhibited an upward trajectory as the quantities of potassium nitrate and sodium nitrate increased. However, in the remaining two solutions, exceeding a certain threshold of potassium nitrate and sodium nitrate precipitated settling. The highest density obtained was 100.13 pcf in the Test 57, which used 36 ml of potassium formate, 3 g of potassium nitrate, and 2 g of sodium nitrate.

Table 13 Results of potassium formate/potassium nitrate/sodium nitrate salt solution density and pH

The experiment shows that adding different nitrate salts in a planned way could make potassium formate's liquid density higher. Whether added individually or in combination, these materials facilitated an increase in density from the baseline of 96 pcf to a remarkable high of 100.13 pcf. Furthermore, it is worth noting that the pH values remained unaffected by the inclusion of these substances. However, the addition of these nitrate salts had the consequence of elevating the crystallization point. In summation, it is evident that the addition of these two nitrate salts to potassium formate results in enhanced density and an elevated crystallization point.

Phosphate-based fluid

This section presents the results of an experiment to synthesize phosphate-based fluid with a density greater than 100 pcf. The experiment was conducted by mixing potassium hydroxide and phosphoric acid in water. The reaction was exothermic, meaning that it released heat and produced phosphate-based fluid as a product. The experiment consisted of six tests, each with different amounts of potassium hydroxide and phosphoric acid. The results are shown in Table 14. Figure 5 left illustrates the synthesis of phosphate-based fluid, while Fig. 5 right displays the solution of phosphate-based fluid after reaction.

Table 14 Results phosphate-based fluid
Fig. 5
figure 5

Phosphate-Based Fluid Solution Reaction Set-Up

The results show that the density of the fluid varied from 94 to 114 pcf. The highest density achieved was 114 pcf in Test 63, which used 48% wt of potassium hydroxide and 37% wt of phosphoric acid. This combination met the goal of achieving a density greater than 100 pcf.

The results also show that the pH of the fluid ranged from 8 to 13.5. A pH range between 7 and 10.5 is considered acceptable for a completion fluid. However, a higher pH may cause problems such as clay swelling and formation damage. Therefore, it is necessary to correct the pH above 10.5 or use a suitable inhibitor to reduce the pH. The results also show that the crystallization point of the fluid was less than − 0.4°F in all tests, which means that the fluid would not freeze at low temperatures.

Based on these results, it can be concluded that phosphate-based fluid can be synthesized by reacting potassium hydroxide with phosphoric acid in water. The resulting fluid has a high density and a low crystallization point, which are desirable properties for a completion fluid. However, the resulting fluid also has a high pH, which can pose a risk for reservoir integrity and compatibility. Therefore, further experiments are needed to adjust the pH of the fluid or add inhibitors.

To fix the problem of the high pH, two acids—phosphoric acid and hydrochloric acid—and two salts—sodium bicarbonate and diammonium phosphate—were chosen to see how well they could lower the pH of the phosphate-based fluid from the Test 63. The findings of these experiments are presented in Table 15.

Table 15 Results of adjusting the pH of the phosphate-based fluid

The addition of phosphoric acid immediately led to precipitation and a reduction in density. As detailed in the table, various quantities of hydrochloric acid, ranging from 5 to 9 mL, were added to 100 mL of the Test 63 solution. In cases where 5 and 7 mL were added, the density decreased to 111.6 and 110.7, respectively, while the pH of both solutions remained at 11. However, the addition of 7–9 mL of hydrochloric acid resulted in the precipitation of the Test 63 fluid. Consequently, while hydrochloric acid did reduce the density, it did not effectively bring down the pH value to the acceptable range of 10.5. Thus, hydrochloric acid was deemed an unsuitable option for pH reduction in the Test 63 fluid.

Subsequently, sodium bicarbonate salt was explored as an alternative for lowering the pH of the Test 63 fluid. By dissolving 10 g of sodium bicarbonate in the solution, the pH decreased to 10.8. However, the density of the solution also decreased. Further investigation revealed that the decrease in density was attributable to the addition of aqueous sodium bicarbonate, and the solution experienced precipitation when more than 10 g were added.

In the final phase of the experiment, diammonium phosphate, a basic phosphate salt, was employed to address the high pH of the Test 63 fluid. Purification of this salt was necessary, and the purification process involved several steps (Fig. 6):

  1. 1.

    Dissolving diammonium phosphate granules in water, resulting in a completely turbid solution.

  2. 2.

    Filtration of the turbid solution to obtain a clear and yellow solution.

  3. 3.

    Drying the solution obtained from step 2 in an oven at 176 degrees Fahrenheit.

  4. 4.

    The dried and yellow salt was prepared for testing.

Fig. 6
figure 6

Purification of Diammonium Phosphate

After purification, diammonium phosphate was dissolved in varying quantities, ranging from 1 to 4 g, in the Test 63 fluid. This addition had no impact on the fluid’s density. However, the addition of 4 g of diammonium phosphate effectively reduced the pH from 13.5 to the acceptable range of 10.5. This outcome demonstrates the suitability of diammonium phosphate for reducing the pH of the Test 63 fluid without affecting its density. The results obtained from this study indicate that among the four additives tested, diammonium phosphate was found to be the most effective in reducing the pH of the phosphate-based fluid without compromising its density (Test 72).

Generally in the density and pH section, the investigation focused on the density and pH of three different fluids. The first and second fluids, based on potassium acetate and potassium formate, underwent attempts to enhance their density through the addition of nitrate salts while maintaining their pH levels within the acceptable range of 7–10.5. After a series of tests, the two fluids with the highest density in each category were identified. The Test 4 fluid, with a density of 88 pcf and a pH of 9, was selected as the representative for potassium acetate and potassium nitrate. In contrast, the Test 57 fluid, boasting a density of 100.13 pcf and a pH of 7.3, was chosen as the standout performer for potassium formate, sodium nitrate, and potassium nitrate. In pursuit of achieving a fluid with a density surpassing the 100 pcf benchmark, the exploration turned to a phosphate-based fluid. This effort resulted in the creation of a fluid with a remarkable density of 114 pcf, accompanied by a pH level of 10.5, as demonstrated by the Test 72. Consequently, three distinct fluids have been selected for further testing: Test 4, Test 57, and Test 72, each representing a different base fluid and showcasing unique attributes in terms of density and pH. These selected fluids will serve as the focal points for subsequent investigations and assessments.

Corrosion

This section involved the evaluation of corrosion tests for various fluids, including: (Test 3), (Test 4), synthesized potassium formate, (Test 57) and (Test 72). The corrosion results are presented in Table 16, while Fig. 7 illustrates the appearance of the coupons after undergoing the corrosion test.

Table 16 Corrosion rate results
Fig. 7
figure 7

Corrosion Coupons After the Test

The corrosion test results for Test 3 and Test 4 fluids revealed corrosion rates of 66.75 mpy and 45.64 mpy, respectively. These findings demonstrate that the addition of potassium nitrate to potassium acetate reduces the corrosion rate, although it remains above 4 mpy. Potassium acetate is inherently highly corrosive, and its use as a packer fluid can lead to substantial damage to pipes and equipment. Therefore, when using this fluid, it is imperative to incorporate suitable corrosion inhibitors.

Conversely, the corrosion test results for synthetic potassium formate and Test 57 fluids showed significantly lower corrosion rates of 1.80 mpy and 1.50 mpy, respectively. These rates are notably lower than those observed for Test 3 and Test 4 fluids, indicating that these fluids do not require corrosion inhibitors. Additionally, the results highlight that the inclusion of nitrate salts in potassium formate contributes to a reduction in the corrosion rate.

On the other hand, the corrosion results for Test 72 test fluid revealed a high corrosion rate of 130 mpy, signifying a need for corrosion control. Given the research objective of achieving a high-density fluid, various corrosion inhibitors, such as thiourea, aluminum powder, and potassium vanadate, were employed in different proportions to regulate the corrosion rate. The outcomes of Tests 78–80 indicated that the addition of thiourea in quantities of 0.02%, 0.05%, and 0.2% by weight resulted in a corrosion rate reduction to 95 mpy, although it remained above 4 mpy. Further increases in thiourea content caused solid particle to settle in the fluid. In the case of the Test 81, 0.09% by weight of aluminum powder was added to the Test 72 fluid. While the aluminum powder remained undissolved in the fluid, a corrosion test demonstrated a reduced corrosion rate of 67 mpy. However, the high corrosion rate and the powder's insolubility in the Test 72 fluid rendered this inhibitor unsuitable. In the final step, 82 and 83 tests incorporated potassium vanadate at two weight percentages: 0.02% and 0.05%. The results revealed a significant reduction in the corrosion rate, reaching 4.44 and 3.5 mpy, respectively. Consequently, the Test 83 fluid was deemed suitable for further tests due to its corrosion rate falling within an acceptable range.

The mechanism by which potassium vanadate exerts its inhibitory effect is likely through anodic protection. It is hypothesized to facilitate the formation of a vanadium oxide passivation layer, which acts as a barrier between the steel and its corrosive environment. This passivation layer is instrumental in slowing the anodic reaction—primarily the dissolution of metal.

From an industrial standpoint, the reduction of corrosion rates from an alarming 130 mpy to a manageable 3.5 mpy is of considerable significance. Such a reduction has the potential to greatly extend the operational lifespan of equipment, while simultaneously reducing the frequency and costs associated with maintenance.

High-temperature stability

In this part, the investigation focused on the relationship between temperature and density across various brine solutions, as demonstrated in Fig. 8. This figure delineates the density values for a spectrum of brine solutions at temperatures extending from 77 to 248°F.

Fig. 8
figure 8

High-Temperature Stability

The results indicate that all brine solutions experience density loss as the temperature increases. However, the degree of density loss varies among different brines. Among the three brine solutions derived from the 4, 57, and 83 tests, the Test 4 fluid, which is related to potassium acetate and potassium nitrate, showed the highest density loss due to temperature increase. As shown in Fig. 8, the density of this fluid decreased from 88 pcf at 77 °F to 85.37 pcf at 248 °F, resulting in a total density loss of 2.63 pcf. This value exceeds the maximum acceptable density reduction limit set by NIDC. On the other hand, the two brine solutions derived from 57 and 83 tests showed lower density loss due to temperature increases. The density of Test 57 fluid decreased from 100.13 pcf at 77 °F to 98.56 pcf at 248 °F, resulting in a total density loss of 1.57 pcf. The density of Test 83 fluid decreased from 114 pcf at 77 °F to 112.55 pcf at 248 °C, resulting in a total density loss of 1.45 pcf.

Density reductions exceeding 2 pcf due to temperature increases are deemed unsuitable for well completion operations. Such decreases may result in a hydrostatic pressure drop below the formation pressure, posing risks of well blowouts and fluid loss into the formation, potentially causing formation damage and reducing production efficiency. To avoid these risks, it is crucial to employ completion fluids that exhibit minimal density reduction when exposed to the high temperatures encountered within the wellbore. Consequently, test fluids 57 and 83 may prove beneficial for this purpose and are considered viable options for ensuring high-temperature stability.

Formation damage

Fluid compatibility

This section assesses the compatibility of three chosen brines, Test 83, Test 57, and Test 4, with formation water, crude oil, and condensate. The findings of the compatibility tests are presented in Figs. 9, 10, 11, and Table 17.

Fig. 9
figure 9

Solution of Test 83 Compatibility Test Samples Before and After

Fig. 10
figure 10

Solution of Test 57 Compatibility Test Samples Before and After

Fig. 11
figure 11

Solution of Test 4 Compatibility Test Samples Before and After

Table 17 Formation fluid compatibility test

Figure 9 elucidates the compatibility of Test 83 fluid with formation water, crude oil, and condensate, evaluated both before and after testing procedures. The phosphate-based nature of Test 83 fluid resulted in negligible visual alterations when combined with formation water. An initial observation of slight cloudiness was noted; however, this effect subsided following the testing phase. Subsequent to testing, the emergence of a minor sediment was recorded, which is postulated to stem from the interaction between calcium ions present in the formation water and phosphate ions originating from the Test 83 fluid. This interaction is believed to precipitate calcium/magnesium phosphate salts.

The reaction of calcium ions with phosphate leads to the formation of calcium phosphate precipitates. Such precipitates have the potential to diminish the permeability of the reservoir by obstructing pore spaces, which could impede fluid flow and hydrocarbon recovery.

It is imperative to acknowledge that visual inspections conducted post-mixing serve merely as preliminary indicators of fluid compatibility and fall short of quantifying the potential for formation damage. Hence, it is essential to undertake further evaluations through coreflood tests to ascertain the full scope of any damage. Additionally, these tests are instrumental in benchmarking the efficacy of phosphate-based fluids against conventional completion fluids within simulated reservoir conditions.

The interaction of potassium acetate or potassium formate with formation water initiates a series of chemical reactions between the potassium ions (K+) and the calcium (Ca2+) and bromine (Br) ions present in the formation water. Potassium ions have the potential to displace calcium from its native compounds, leading to the formation of calcium acetate or calcium formate. These compounds are prone to precipitation when their solubility thresholds are surpassed. Bromine, as a halogen, typically exhibits minimal reactivity with potassium salts; however, it can influence the overall ionic strength and reactivity of the solution.

The formation of precipitates such as calcium acetate or calcium formate can result in scaling, which poses a risk to the integrity of flow paths and can cause damage to equipment. Figures 10 and 11 provide visual evidence of these phenomena. Test 4 fluid, which is acetate-based, displayed a marked change in appearance upon mixing with formation water. After a period of 72 h, the fluids transitioned to a state of transparency and exhibited reduced turbidity. This initial turbidity is likely attributable to impurities within the formation water.

Conversely, Test 57 fluid, which is formate-based, showed no significant visual changes when mixed with formation water, suggesting compatibility and an absence of precipitation.

Overall, the experimental results indicate that both Test 4 and Test 57 fluids, when combined with formation water, do not result in sediment formation despite the potential for precipitation of calcium acetate or calcium formate. This observation suggests that the reaction between these materials and the formation water is unlikely to lead to significant sediment formation, thereby affirming the low probability of such an occurrence.

The experimental investigation into the emulsion-forming tendencies of three distinct fluids—potassium phosphate-based, potassium formate-based, and potassium acetate-based—when mixed with crude oil and condensate, yielded insightful results. The tests, as depicted in Figs. 9, 10 and 11, were meticulously designed to assess the emulsion stability under conditions that simulate the thermal environment of a wellbore.

Upon conducting the thermal stability test, a critical observation was made: No emulsion formed between the fluids and the hydrocarbon samples. All fluid samples remained in distinct phases post-testing. This outcome is particularly noteworthy as it suggests a high degree of compatibility between the tested fluids and the crude oil and condensate, which is a desirable attribute in well completion and stimulation fluids.

The absence of emulsion formation indicates that the interfacial tension between the oil and water phases was not sufficiently reduced to allow for the dispersion of one phase into the other. This can be attributed to the inherent properties of the base fluids used. Potassium phosphate, potassium formate, and potassium acetate are known for their stabilizing effects on water-based solutions, which likely contributed to the prevention of emulsion formation.

Furthermore, the thermal stability test results imply that these fluids possess a resilience to temperature-induced phase separation. It suggests that these fluids are resistant to changes in their structure (phase separation) when exposed to different temperatures. This resistance is important because if fluids degrade thermally, they can form emulsions—mixtures of oil and water that are difficult to separate. These emulsions can cause problems in the extraction process, such as clogging up equipment and contaminating the oil, making it harder to extract and process. Essentially, the fluids tested are stable and do not create such issues, which is beneficial for the efficiency of oil extraction operations.

Wettability alteration

This section evaluates the wettability of carbonate and sandstone thin sections after exposing them to selected fluids. The wettability is measured by the contact angle between the fluid and the thin section surface. Table 18 shows the contact angle measurements before and after aging for different test selected fluids. Figure 12 displays an example of contact angle measurement on thin sections using selected fluids.

Table 18 Evaluation of thin section wettability
Fig. 12
figure 12

An Example of Contact Angle Measurements on Thin Sections with Selected Fluids

The experimental data offer a compelling narrative regarding the alteration of wettability in rock thin sections following aging with various fluids. The observed detachment of kerosene droplets from the surface of these sections post-aging indicates a transition toward increased water-wetness. This shift is critical as it highlights the fluid–rock interactions that modify surface characteristics, thereby influencing the flow and distribution of fluids within the reservoir.

The aging process, entailing the prolonged exposure of rock surfaces to fluids, evidently influences the rocks’ wettability. Wettability is a measure of a fluid’s tendency to spread on or adhere to a solid surface in the presence of other immiscible fluids. In petroleum reservoirs, wettability is a key factor affecting oil recovery, as it governs the ease with which oil can be displaced by water.

Quantitative evidence of wettability alteration is provided through the analysis of contact angles. A lower contact angle signifies a more water-wet surface, which is generally advantageous for oil recovery processes. Our results show a more noticeable reduction in contact angles for carbonate thin sections as opposed to sandstone. This finding suggests that carbonate rocks are more amenable to wettability changes induced by fluid aging, likely due to their unique mineralogical composition and surface chemistry.

Carbonate reservoirs, characterized by their intricate pore structures and variable wettability, can greatly impact the efficacy of oil recovery methods. The observation that carbonate sections undergo greater wettability alteration than sandstone has significant implications for enhanced oil recovery (EOR) strategies.

Clay swelling

Formation damage resulting from clay swelling induced by the chosen fluids was assessed to gauge the impact of the completion fluid. This evaluation encompassed clay swelling tests conducted on three distinct fluids: Test 83, Test 57, and Test 4. A concise summary of the findings is presented in Table 19.

Table 19 Results of clay swelling test

Table 19 outlines the extent of clay swelling for Test 83, Test 57, and Test 4, registering measurements of 3, 4, and 3 ml/2 gr, respectively. These results demonstrate that the clay swelling rates for all three selected fluids remain below 5 ml/2 gr of clay, indicating that they do not cause substantial formation damage. It is worth noting that the substantial concentration of potassium ions in these brines is a probable explanation for the minimal clay swelling. Historically, potassium-containing salts, such as potassium chloride, were frequently incorporated into completion fluids as anti-swelling additives. In this current scenario, the brines themselves are potassium-based, rendering the inclusion of such additives redundant, while still effectively preventing clay swelling (Kalatehno and Khamehchi 2021).

Coreflood

In the section on fluid compatibility, as discussed earlier, a coreflood test is crucial to further investigate the potential formation damage caused by Test 83 fluid. This segment focuses on examining the penetration of Test 83 fluid into the rock matrix.

The pressure difference versus injection volume for the coreflood test using Test 83 fluid is depicted in Fig. 13. It illustrates the pressure difference at the inlet–outlet, Pressure Tab 1, and Pressure Tab 2, demonstrating how the fluid penetrates the core and influences flow resistance and pressure gradient along the core.

Fig. 13
figure 13

Coreflood Test

The graph indicates a significantly lower pressure difference at Pressure Tab 1 compared to the other two pressure tabs. This disparity is attributed to the fluid's entry point into the core, suggesting elevated flow resistance as the fluid enters. This may be due to interactions between the fluid, formation water, and the rock matrix, leading to the release of particles that obstruct some pores. The graph also illustrates the pressure differences at Pressure Tab 1 and Pressure Tab 2, with Pressure Tab 2 showing a higher value. This is because the fluid reaches Pressure Tab 2 before Pressure Tab 1, given its proximity to the fluid's entry point. The pressure difference at the inlet–outlet and Pressure Tab 2 exhibits an initial sharp increase, followed by a gradual decrease and a slight subsequent increase. This could result from the fluid initially infiltrating larger pores and encountering partially blocked smaller pores. Pressure Tab 1 follows a similar pattern but with a delay, indicating that the fluid takes time to reach and undergoes a comparable process as Pressure Tab 2.

The effect of Test 83 fluid on the permeability of the carbonate cores was investigated through coreflood experiments. The initial permeability of the cores was determined before injecting Test 83 fluid into the cores using formation water. The initial permeability was measured to be 34 mD. Following the completion of the coreflood test, the return permeability of the cores was determined after injecting Test 83 fluid into the cores using formation water in the same direction as the primary permeability. The return permeability was measured to be 18 mD. Comparing these return permeability values reveals that the penetration of the optimal completion fluid induced 47% damage to the formation. This degree of formation damage reduction is notably less than that caused by other fluids, such as drilling mud, which often leads to extensive formation damage. Consequently, this segment underscores that Test 83 fluid, characterized as a phosphate-based fluid, has indeed impacted permeability due to its interaction with the rock although this effect is within an acceptable range. Furthermore, as previously mentioned, Test 83 fluid was formulated with the goal of achieving a high-density completion fluid. One such completion fluid, known as packer fluid, is employed in the well's annulus space during its operational life. As such, Test 83 fluid emerges as a viable candidate for packer fluid application.

Machine learning

The performance of the machine learning models in predicting the penetration depth of the completion fluid into the core is illustrated in Fig. 14. It shows two scatter plots that compare the actual values of penetration depth to the predicted values of penetration depth. The first plot is for the ANN model, and the second plot is for the GP model. The plots indicate that both the ANN and GP models can predict the penetration depth with a high degree of accuracy. The regression lines are close to the diagonal lines, which means that the predicted values are close to the actual values. The blue markers represent the test data, and the red markers represent the train data. The plots provide a visual insight into the penetration depth prediction.

Fig. 14
figure 14

The Cross Plot of Modeling Prediction of Penetration Depth Versus Measured Data

The train data have a higher R-square score than the test data for both the ANN and GP models, which implies that the models fit the train data better than the test data. However, the difference between the train and test scores is not very large, which suggests that the models do not overfit the train data and can generalize well to new data. The R-square scores for the ANN and GP models are 0.9468 and 0.9140, respectively. This shows that the ANN model has a slightly higher accuracy than the GP model. The results demonstrate that the machine learning models are reliable and accurate tools for predicting the penetration depth of the completion fluid into the core. This is important, because the penetration depth affects the performance and efficiency of the completion fluid. During a coreflood test, obtaining the penetration depth is challenging, making it impossible to measure the penetration depth at any moment. However, a machine learning model can estimate the penetration depth.

Conclusion

This study introduces a novel phosphate-based completion fluid, showcasing significant advancements in well completion technology. The key conclusions are:

  • Innovative Density Enhancement: The integration of nitrate salts into potassium formate and acetate fluids increased their densities to 88 pcf and 100.13 pcf, respectively, while simultaneously reducing corrosion rates, with potassium formate achieving a rate below 4 mpy.

  • Novel Phosphate-Based Fluid: A new fluid was developed with a density of 114 pcf, achieved by combining potassium hydroxide and phosphoric acid and adjusting the pH with diammonium phosphate. The addition of 0.05% potassium vanadate significantly reduced its corrosion rate from 130 mpy to under 4 mpy.

  • Superior Temperature Stability: The novel fluid demonstrated enhanced thermal stability compared to acetate-based fluids, positioning it as a more reliable option in varying temperature conditions.

  • Wettability Improvement: All fluids were effective in altering wettability toward water-wetness, with the novel fluid showing promising results on both sandstone and carbonate thin sections.

  • Fluid Compatibility: The novel fluid displayed excellent compatibility with oil and condensate, with minimal formation water sedimentation, highlighting its suitability for diverse reservoir conditions.

  • Reduced Formation Damage: Coreflood tests indicated that the novel fluid caused only 47% formation damage, a substantial improvement over traditional drilling muds.

  • Machine Learning Model for Penetration Depth: The development of ANN and GP models to predict fluid penetration depth, with high R-square values of 0.9468 and 0.9140, respectively, underscores the potential for predictive analytics in optimizing fluid performance.

In summary, both acetate-based and formate-based fluids demonstrated limitations, such as high corrosion, poor temperature stability, and low density. In contrast, the novel phosphate-based fluid emerged as an optimized solution with a high density, making it a recommended choice for well completion fluids, particularly as a packer fluid.