Mixing dynamics and recovery factor during hydrogen storage in depleted gas reservoirs

Large-scale hydrogen storage is strategically important for society and depleted gas reservoirs have been proposed as a potential solution. However, the mixing with remaining hydrocarbon gas during injection/production cycles and the impact of different reservoir parameters on the hydrogen recovery factor ( RF H 2 ) have not been fully understood. We investigate mixing dynamics and analyze the effects of initial hydrocarbon recovery factor, reservoir permeability, well perforation length, intelligent completion, and fractures on RF H 2 . Fine-grid gas reservoir models with compositional simulation were used to simulate cyclic hydrogen storage. Mixing of injected hydrogen with remaining hydrocarbon gas occurred in three distinct phases in each cycle: 1) displacement of remaining hydrocarbon gas through pressure-driven flow during hydrogen injection, 2) density-driven flow of gases during the idle time after hydrogen injection, and 3) pressure-driven flow of gases towards the production intervals during the hydrogen production phase. Higher RF H 2 s were obtained when the storage process was initiated at higher hydrocarbon gas recovery factors. Storing hydrogen in reservoirs with lower permeability also led to higher RF H 2 s, provided the well pressure limits were not an issue. In conditions of a 5 × to 15 × increase in permeability, the injected hydrogen moved upward and spread laterally, positioning it farther from the wellbore. This made hydrogen production more difficult and placed the mixing zone and hydrocarbon gas closer to perforations. Shorter perforation lengths at the top of the formation resulted in the best RF H 2 s. Additionally, intelligent completions (that closed perforations producing gas with low hydrogen content) improved RF H 2 by providing the possibility of purer hydrogen production. The presence of natural fractures significantly reduced hydrogen recovery, especially in the first few cycles. However, the influence decreased over time as highly conductive flow paths provided by fractures can contribute to the production of the accumulated unrecovered hydrogen from previous cycles.


Introduction
Hydrogen (H 2 ) is recognized as a low-carbon energy carrier with significant potential for the decarbonization of energy-intensive industries (Heinemann et al., 2021).Thus, interest in H 2 technology has increased in recent years as one of the approaches to mitigate greenhouse gas emissions and achieve net-zero emissions by 2050 (Pathak et al., 2023).However, despite the advancement of surface facilities for H 2 storage, their capacities are limited by the low volume density of H 2 (Hassanpouryouzband et al., 2021).
For large-scale H 2 storage, underground H 2 storage in geological formations such as salt caverns (Tarkowski and Czapowski, 2018;Williams et al., 2022), saline aquifers (Delshad et al., 2023;Lysyy et al., 2023), and depleted gas reservoirs (Amid et al., 2016;Ghaedi et al., 2023;Lysyy et al., 2021) have been proposed.Of these, the presence of infrastructure, large storage capacity, and the availability of reservoir characterization data make depleted gas fields a feasible and cost-effective option for H 2 storage (Saeed and Jadhawar, 2024;Zivar et al., 2021).Furthermore, the remaining hydrocarbon gas at the beginning of the H 2 storage operation can serve as cushion gas to support the required pressure, making depleted gas reservoirs an even more suitable option for H 2 storage.As a result, efforts have been made to investigate the potential of underground H 2 storage in different gas reservoirs.Examples include an Indian offshore depleted gas field, the Tapti gas field (Kiran et al., 2023), depleted gas fields along the Norwegian continental shelf (Emmel et al., 2023;Lysyy et al., 2021), European gas storage sites in depleted gas fields (Cavanagh et al., 2022), depleted shale gas laterals with a focus on Haynesville shale in the US (Singh, 2022), depleted gas fields in Western Australia (Craig et al., 2022), depleted gas reservoirs in UK (Diamantakis et al., 2024;Mouli-Castillo et al., 2021;Scafidi et al., 2021;Wallace et al., 2021), offshore gas fields in Brazil (Ciotta et al., 2023) and depleted gas reservoirs in Netherlands (Visser, 2020;Yousefi et al., 2021).
The mixing of injected H 2 with the remaining hydrocarbon gas poses a significant challenge and concern for H 2 storage in gas reservoirs (Hematpur et al., 2022;Navaid et al., 2023).For this reason, the need to enhance the purity of the produced H 2 to meet the required threshold for utilization on the surface facilities has been underscored (Salmachi et al., 2023).However, it is worth noting that surface processing of the produced H 2 may be necessary regardless of the degree of mixing, depending on the final application (Miocic et al., 2023).
Several studies have explored the mixing of injected H 2 with cushion gas during geological storage.Heinemann et al. (2021) highlighted that the severity of mixing between H 2 and the fluid existing in the reservoir, such as residual hydrocarbon gas and cushion gas, depends on the type of cushion gas, the cyclic rate, the injection and production rate, and the reservoir properties.Similarly, another study emphasized the impact of cushion gas type on H 2 mixing and, consequently, the purity of the produced H 2 (Muhammed et al., 2022).Additionally, Hassanpouryouzband et al. (2020) proposed an Excel-based tool to predict the thermophysical properties of gas mixtures containing H 2 .The tool is applicable to a wide range of temperatures (0.01-100 MPa) and pressures (200-500 K).Bo et al. (2024) explored the impacts of heterogeneities on the gas mixing in depleted natural gas reservoirs.Their results showed that macroscale geological heterogeneities can intensify gas mixing and potentially lead to a decrease in H 2 recovery by up to 15.8% over a 10-year period.Moreover, the effect of molecular diffusion on the mixing was shown to be negligible in large-scale H 2 storage (Terstappen, 2021).Sadeghi and Sedaee (2022) used numerical simulation to study the mixing of working and cushion gas in naturally fractured gas reservoirs.They concluded that the presence of fractures increases mixing in late production stages.In addition, strong mixing between H 2 and residual gas was reported, primarily due to the very low density and viscosity of H 2 in the gas-gas displacement process (Feldmann et al., 2016).Similarly, Wang et al. (2022) conducted two-dimensional vertical cross-section simulations, demonstrating that the less viscous H 2 can bypass the cushion gas during the injection phase.This can lead to the mixing of H 2 and cushion gas, causing a substantial reduction in H 2 purity during the back production period.Another study reported a 5% reduction in H 2 recovery due to the mixing with cushion gas (Bahrami et al., 2023).Furthermore, Ghaedi et al. (2024) demonstrated that mixing with base gas could decrease the maximum safe column height of H 2 .
In previous research, significant attention has been dedicated to the H 2 recovery factor (RF H2 ) as a crucial parameter for the successful implementation of H 2 storage in gas reservoirs.The quantity of H 2 recovered per cycle is influenced by reservoir structure, properties, and management techniques (Okoroafor et al., 2022).Moreover, H 2 leakage due to the low dynamic viscosity of H 2 can further reduce RF H2 (Epelle et al., 2022;Tarkowski and Uliasz-Misiak, 2022).An increase in the RF H2 over cycle numbers have been reported in previous studies (Lysyy et al., 2021;Sarı and Çiftçi, 2024;Zamehrian and Sedaee, 2022).Lysyy et al. (2022) explored seasonal H 2 storage in the Norne hydrocarbon field, offshore Norway.They suggested that H 2 injection into the thin gas zone yields a preferred recovery factor of 87% after four annual withdrawal-injection cycles followed by one prolonged withdrawal period.Additionally, Zamehrian and Sedaee (2022) simulated H 2 storage in partially depleted gas condensate reservoirs and reported that gas condensate reservoirs have higher H 2 recovery compared to dry gas reservoirs.They also found that nitrogen (N 2 ) is a better cushion gas option for purer H 2 production and naturally higher RF H2 .In another study, Safari et al. (2023) observed no considerable increase in the RF H2 of the Sekihara gas field, Japan if one period of N 2 and methane (CH 4 ) as cushion gas have been injected, compared to scenarios where no cushion gas was used.Liu et al. (2024) conducted a feasibility study for H 2 storage in a depleted shale gas reservoir and reported that an H 2 purity of approximately 80% and a RF H2 of 73% can be achieved during the last cycle of H 2 storage.Camargo et al. (2024) investigated the impacts of the injected gas composition, permeability anisotropy (the ratio of vertical to horizontal permeability), and perforation depth for H 2 injection during storage in a depleted gas reservoir.When perforating the bottom of the reservoir, a lower H 2 mass ratio in the injected stream leads to a higher RF H2 .Additionally, they suggested that lower permeability anisotropy ratios and locating the perforation near the top of the formation enhance the RF H2 .
Despite previous efforts, a proper analysis of H 2 mixing at various stages of a cyclic H 2 storage in gas reservoirs has been lacking.This work aims to study the mixing dynamics of H 2 and remaining hydrocarbon gas, with a particular focus on the mixing process over time.Furthermore, a proper understanding of the impacts of different storage parameters on the RF H2 is essential for selecting the best storage site.In this work, a detailed analysis is conducted to more clearly illustrate and enhance the understanding of the impacts of initial hydrocarbon gas recovery factor (RF init HC ), reservoir permeability, perforation lengths, intelligent completion, and local fractures on RF H2 .The rest of the paper maintains this structure: It starts with a theoretical discussion, followed by an overview of underground H 2 storage operation and a description of the reservoir model.The mixing behavior is then analyzed and the effects of various parameters on H 2 storage are examined.

Theory
Fig. 1 shows the process of H 2 storage in a depleted or partially depleted gas reservoir.The remaining hydrocarbon gas, along with possible other gases such as N 2 , can constitute the cushion gas necessary to maintain the required pressure during storage operations.The injected H 2 can displace the cushion gas and due to possible mixing (see Fig. 1), there could be different regions, including a pure H 2 region, a mixing zone of H 2 with cushion gas, and a region with the cushion gas.It is important to note that if a gas other than the remaining hydrocarbon gas is injected to serve as the cushion gas, mixing between these gases may also occur.
Various factors contribute to the mixing of fluids in porous media, including diffusion (Tartakovsky and Dentz, 2019), heterogeneity (Bonazzi et al., 2023), pressure-driven flow (Kou and Dejam, 2019), and density-driven flow (Kou and Dejam, 2019).Diffusion is a slow process, and at smaller diffusivity coefficients, is not sufficient to achieve mixing on a large scale and within a limited time frame (Dentz et al., 2023).During the H 2 injection and production phases in a cyclic H 2 storage operation, the pressure-driven flow can lead to gas-gas mixing in the porous media as part of the gas-gas displacement process.In addition, the density difference between the injected H 2 plume and the cushion or the remaining hydrocarbon gas can induce a density-driven flow, that further enhances the mixing process.Furthermore, heterogeneities such as local fractures can additionally support the mixing of the injected H 2 .
In a compositional reservoir simulation, the flowrate of component c, which is present in the gas phase (subscript g) and enters cell i from a neighboring cell j, F C g,ji , can be calculated as follows (GeoQuest, 2022): where T ji is the transmissibility between cells j and i, M C g is the generalized mobility of component c in the gas phase, and dΦ g,ji is the potential difference of gas phase between cells j and i.Here, T ji can be calculated using the following equation (Karimi-Fard et al., 2004): where A, K, and d are the average interface area, the permeability, and the distance to the interface area from the center block, in the direction of the flow, respectively.M C g , on the other hand, can be defined as: where y c g is the mole fraction of component c in the gas phase, k rg is the relative permeability of the gas phase, b m g and μ g are the molar density and viscosity of gas phase, respectively.dΦ g,ji can be calculated as: where g is the acceleration due to gravity, P is the pressure, D is the central depth of the cell, and ρ g,ji is the gas phase density at the interface of cells i and j given by: ρ g,ji = ρ g,i S g.i + ρ g,j S g,j S g.i + S g,j (5) Here, S g represents gas saturation.It is important to note that when dΦ g,ji is positive, cell j is the upstream cell, and the flow is from cell j to i, and vice versa.
The mixing of injected H 2 with the base gas can lead to H 2 losses, which reduces the H 2 content in the produced gas stream and ultimately, RF H2 is influenced by this mixing (Bo et al., 2024).RF H2 is a very important factor in an underground H 2 storage influencing both the economic viability and overall success of the H 2 storage process.It can be defined as: In this work, the evolution of the RF H2 for individual cycles are studied.

Reservoir model and storage operation
A three-dimensional fine-gridded reservoir model was considered to simulate the underground H 2 storage process.Table 1 illustrates the properties of the built model referred to as the base model.The model consisted of 41 × 41 × 100 blocks in the x, y, and z directions, respectively.The block size in the x and y directions was 20 m while the grids in the z direction had 1 m thickness.Eclipse 300 was used for the compositional numerical simulation (GeoQuest, 2022) and the Peng-Robinson equation of state was utilized for modeling of fluid properties (Peng and Robinson, 1976).To simplify the analysis, CH 4 was used as a representative for the hydrocarbon gas and potential bio-and geochemical reactions were ignored.
Fig. 2 depicts a three-dimensional view of the constructed reservoir model together with the injection/production well located in the center of the model.During the injection and production periods, the well was controlled at the constant rate given in Table 1.Furthermore, the maximum and minimum bottomhole pressures were set at 188.75 and 37.75 bar, respectively.These pressure constraints correspond to a 25% increase and a 75% decrease from the initial reservoir pressure.
As mentioned previously, besides the remaining hydrocarbon gas, other gases like N 2 can be injected as additional cushion gas.The primary reasons for using N 2 as a cushion gas are its availability, lower cost, and reduced reactivity with H 2 (Yousefi et al., 2023).Fig. 3 presents the scenario considered for underground H 2 storage.Initially, the gas field was depleted to reach to a certain recovery factor (RF init HC ) of 70%.Then, N 2 as the additional cushion gas was injected at the bottom of the reservoir for one year with a constant rate of 10838.5 Sm 3 /day followed by 5 months of idle time.The injection of H 2 and the production of gas were performed at a constant gas rate of 150668.8Sm 3 /day for a period of 3 months.Both the injection and production were followed by 3 months of idle time.It was assumed that the injection took place during  summer (in June, July, and August) and production in winter (in December, January, and February).The amount of H 2 injected per cycle was equivalent to 1170 tonnes, assuming a surface density of 0.0851 kg/m 3 for H 2 at standard conditions.

Results and discussion
This section presents the results obtained from underground H 2 storage in the described gas reservoir where the mixing process in the base model is first presented.Then, the impacts of RF init HC , reservoir permeability, production/injection perforation lengths, utilizing

H 2 mixing in the base model
In this study, during H 2 storage cycles, the H 2 in the blocks with a mole fraction of more than 99% in the gas phase, was regarded as pure H 2 .On the other hand, H 2 in the blocks with an H 2 mole fraction of less than 99% was considered as mixed H 2 .Fig. 4 shows the total mass and mixed mass of H 2 present in the reservoir together with the mole fraction of H 2 in the well production stream during cycles one and two.Fig. 5 provides a snapshot of the flow directions of H 2 and CH 4 along with the distribution of H 2 mole fraction around the wellbore during the first cycle and at middle of injection (Fig. 5a), middle of idle time after injection (Fig. 5b) and middle of production time (Fig. 5c).The arrows on the vector map provide information on the relative amount and direction of the H 2 and CH 4 flow.
During interval AB in Fig. 4 H 2 injection took place, with increased mass of H 2 inside the reservoir.The displacement of cushion gas by injected H 2 resulted in a considerable amount of mixing.Fig. 5a also shows an example of the directional flows of H 2 and CH 4 during the injection period.The pressure-driven flow during this period can generate distinct flux rates for gases in adjacent blocks, as indicated by Eq. ( 1).In the gas-gas displacement process, the gas compositions of adjacent blocks might be different, leading to possible variations in viscosity and density.Consequently, the fluxes of the blocks can differ, resulting in mixing over time.
Period BC represents the idle time following the injection and shows a slight increase in mixing during this phase.Fig. 5b depicts the flow directions of H₂ and CH₄ in the middle of this idle period.It should be noted that the gases exhibit an upward movement, and remarkably, a circulation pattern can be observed at the sides of the H₂ plume.These phenomena can be the reason for the subtle mixing observed during this period.When the injection ceases, gravity-driven flow, also known as buoyancy-driven flow, plays a role during the idle time.This results in upward and circulating motions of the gases on the sides of the plume.As Eq. ( 5) shows, the sign of dΦ g,ji between two adjacent blocks, denoted as j and i, determines the upstream block and subsequently influences the direction of the flow.The change in the sign of dΦ g,ji during pressureor gravity-driven flow explains the distinctive flow directions during these periods.
A further increase in the mass of the mixed H 2 is observed during the early period of H 2 production (period CD).This increase in the mixing can be attributed to the pressure-driven flow and the simultaneous movement of the cushion gas and H 2 toward the production wellbore.Fig. 5c shows the flow directions of H 2 and CH 4 during this period.At point D, all the H 2 in the reservoir was in a mixed state with the cushion gas.After this point, the mass of H 2 inside the reservoir due to the production decreased and all the H 2 in the reservoir existed as mixed with the cushion gas.
Fig. 4 also shows the mole fraction of H 2 in the production stream of the well.In cycles one and two, pure H 2 was initially produced for approximately 10 and 15 days, respectively.Subsequently, there was a decrease in the H 2 mole fraction due to the production of the cushion gas.The decrease in the H 2 mole fraction profile in cycle two is lower compared to cycle one, indicating more H 2 production in cycle two.This can be attributed to the fact that there were 296.24 tonnes more H 2 in the reservoir during this cycle.Fig. 6 illustrates the mass rates and mass fractions of various gases, including H 2 , CH 4 , and N 2 , plotted against time.As mentioned earlier, N 2 was injected at the bottom of the reservoir and, owing to its higher density compared to H 2 and CH 4 , it remained at the reservoir bottom, distant from the production well.Consequently, no N 2 was produced during the storage operations, as depicted in Fig. 6a.It should be noted that despite observing a considerably high mole fraction for H 2 , its mass fraction in the produced gas stream was much lower, attributed to its significantly smaller molecular weight compared to CH 4 , as shown in Fig. 6b.Fig. 7 presents the RF H2 together with the cumulative mass of injected H 2 during the ten cycles.As mentioned earlier, 1170 tonnes of H 2 were injected during each cycle.The figure shows an increase in RF H2 over the cycles.The hydrocarbon gas (CH 4 ) was pushed back to a greater distance from the production well during each H 2 injection cycle (See Fig. 1), leading to less CH 4 and more H 2 production.Furthermore, more H 2 accumulated in the system in subsequent cycles.Consequently, higher RF H2 values were achieved by increasing cycle numbers.The permeability in this study was homogeneous.For heterogeneous cases, the resulting RF H2 can be lower.For instance, as previously mentioned, a 15.8% reduction in RF H2 was reported due to heterogeneity in permeability by Bo et al. (2024).Furthermore, the impacts of bio-and geochemical reactions were ignored, which could potentially further reduce the RF H2 .

The impacts of initial hydrocarbon gas recovery factor
The underground H 2 storage in a gas reservoir can be initiated at ultimate hydrocarbon gas recovery factor (reservoir abandonment state) or at the time where still some recoverable hydrocarbons exist in the reservoir.Moreover, depending on the values of RF init HC , the pressure of the reservoir may differ at the beginning of the storage process.Thus, the impact of varying RF init HC can also be interpreted as the impact of different reservoir pressures.This section examines the impacts of RF init HC on the performance of underground H 2 storage.The RF init HC in the base model was 70%.Additionally, two other models were created with RF init HC s of 60 Fig. 8 presents the RF H2 plotted against cycle numbers at different RF init HC s.As can be seen in all cycles, by increasing the RF init HC , the RF H2 amounts enhance slightly as well.For example, RF H2 at the first cycle and for 50, 60, and 70% RF init HC s were 69.9, 72.0, and 74.3%, respectively.
Fig. 9 illustrates a cross-sectional view around the wellbore at the end of the injection of the first cycle for different RF init HC s.While the mass of the pure H 2 for three cases was almost the same and equal to 370 tonnes, the bulk volume occupied by the pure H 2 for 50, 60, and 70% RF init HC were 3.66 × 10 6 , 4.47 × 10 6 , and 6.49 × 10 6 m 3 , respectively.
Since at lower RF init HC s, the reservoir was at relatively higher pressures, the injected H 2 occupied less space in the reservoir.Moreover, as shown in Fig. 1, the injected H 2 appears in pure and mixing forms.Consequently, at higher RF init HC s, the pure H 2 zone expanded further around the wellbore which led to pushing the mixing and pure CH 4 zone to a greater distance from the wellbore.As a result, the production stream at higher RF init HC s contained relatively more amount of H 2 at different cycles which ended in higher RF H2 s.The results agree with a previous study suggesting that gas reservoirs with lower pressure at the start of H 2 storage could be better options (Okoroafor et al., 2022).As shown in Fig. 6 and mentioned before, the injected N 2 remained at the bottom of the reservoir, far from the production well, and was not produced.Therefore, the mixing zone shown in Fig. 9 mainly took place between H 2 and CH 4 .While slightly higher recovery factors were attained when H 2 storage was initiated at higher RF init HC s, it is important to note that the requirement for injecting additional cushion gas is less at lower RF init HC s.Furthermore, the produced CH 4 has its own energy value, and it can be used for example as the heat required for the gas reformer unit.Thus, a further comparison of cases can be made based on the amount of CH₄ production.The total amount of CH 4 produced at the end of the storage operation (cycle ten) for 50, 60, and 70% RF init HC were 1.96 × 10 4 , 1.73 × 10 4 , 1.49 × 10 4 tonnes, respectively.Assuming a surface density of 0.6788 kg/m 3 for CH 4 , these values are equivalent to 2.88 × 10 7 , 2.55 × 10 7 , and 2.20 × 10 7 Sm 3 , respectively.

The impacts of permeability
This section investigates the impacts of lateral and vertical reservoir permeabilities during underground H 2 storage.For this purpose, in addition to the base case (50 mD in x and y, 5 mD in z), two cases were considered: medium (250 mD in x and y, 25 mD in z) and high (750 mD in x and y, 75 mD in z).Thus, similar to the base case, a ratio of 0.1 was maintained between the vertical and lateral permeability values.Lower permeability ranges were excluded to avoid the impacts of bottomhole pressure limits (37.75-188.75 bar).
Fig. 10 illustrates the impacts of varying k x , k y , and k z on RF H2 at different cycles.Similar to the previous results, the RF H2 values were enhanced by increasing the number of cycles.This figure shows that there is a sharp decline in RF H2 by increasing the lateral and vertical permeability of the model.For example, RF H2 at the first cycle were 74.3, 61.9, and 40.7 %, for the base, medium and high cases, respectively.Fig. 11 shows cross-sectional views of the mole fraction distribution of H 2 in the gas phase around the injection/production well before and after the production process in the first cycle.As can be seen in this figure, at lower permeability values, the injected H 2 plume tends to concentrate vertically around the wellbore before the production phase.This concentration profile facilitated the H 2 production and led to a higher RF H2 .On the other hand, at higher permeability values, the injected H 2 plume moved upward and spread out laterally around the wellbore.Thus, H 2 was located laterally far from the production well and thus there was less chance to be produced during the production phase.The impact of permeability on the RF H2 agrees with a previous  study that found a negative relationship between permeability and RF H2 during H 2 storage in gas reservoirs (Terstappen, 2021).It is worth mentioning that caprock structure/curvature can restrict the lateral spread of injected H 2 , thereby to some extent mitigating the effect of permeability.Fig. 12 illustrates the horizontal and vertical H 2 mass flow rates for a block located 80 m from the production/injection well and 5 m from the top of the reservoir for the three models with different permeability values.In this figure, positive mass flow rates represent flow towards the well in horizontal flow or towards the top of the reservoir in vertical flow, while negative values indicate flow away from the well in horizontal flow and towards the bottom of the reservoir in vertical flow.Therefore, for example, during the H 2 injection phase, the horizontal mass flow rate was negative, whereas in the production phase, the horizontal mass flow rate was positive.
Based on Fig. 12a, the horizontal mass flow rate of H 2 had its highest values during the injection phase in the high permeability case which is in agreement with the fact that mass flux is affected by the permeability (Eqs.( 1) and ( 2)).Therefore, during the injection phase in the high permeability case, H 2 could travel a greater distance from the well compared to the base and medium cases.Moreover, much less H 2 mass transfer occurred for the base case in the idle time following the injection phase as the mass flow rate dampened so rapidly in this case.The sudden reduction in the mass flow rate during the idle time following the injection phase of the first cycle approximately amounted to 89.2, 67.6, and 53.7% for the base, medium, and high cases, respectively.Fig. 12b further shows the vertical mass flow directions of H 2 .The high permeability case exhibits the maximum amount of vertical mass flow rates at the beginning of the injection phases during both cycles 1 and 2. After some time, in both high and medium cases, there is a reversal in the vertical flow directions for the considered block.In these two cases, the initial vertical flow was so high that after some time, there was a circulation and upward movement of H 2 at the side of the H 2 plume.The significant upward movement of the plume due to gravity-driven flow in the idle time after the injection period, especially in the high case, is noticeable.This caused a considerable upward movement of the plume in this period (see Fig. 11e and f).Further upward movement for all cases can be found during the injection phase.Overall, the vertical and lateral flows show how the permeability can contribute to the vertical and lateral movement of the H 2 plume inside the reservoir.In summary, permeability plays a significant impact on the location of the H 2 plume during injection and the subsequent idle time.Higher permeability leads to conditions in which the mixing zone and cushion gas come closer to the perforation, primarily due to the vertical movement and lateral spread of H 2 .

The impacts of production/injection perforation lengths
The length of the perforation is a crucial factor in well design as it has impacts on the well productivity and directly influences the flow of fluids between the reservoir and the wellbore.Technologies like multizone completion design enable controlled injection and production from different zones with different perforation lengths (Yanez Hernandez et al., 2017).
To investigate the influence of production and injection lengths on the performance of an underground H 2 storage operation, we created 1225 models with various combinations of injection and production perforation lengths.In these models, it was assumed that injection could occur at a specific perforation length, which might differ from the perforation length used during the production phase in the same model, and perforation lengths were measured from the top of the reservoir.To create these models, the injection and production lengths were systematically varied by 1 m within the range of 5-100 m.To be reasonable and avoid the production of the cushion gas, the production length was always equal to or less than the injection length.The same amount of gas was injected and produced in all the models.Fig. 13 presents the map of RF H2 of the first cycle for 1225 models with different combinations of production and injection perforation lengths.Table 2 also compares the RF H2 of the first cycle for three special cases with the combination of maximum and minimum values of injection and production perforation lengths.Further details of H 2 mole fraction distributions before and after production in the first cycle for the three special cases of injection and production lengths are shown in Fig. 14.
The results suggest that higher RF H2 s were attained when injection and production perforation lengths were shorter.This finding aligns with a previous study suggesting that placing perforations near the top of the formation enhances RF H2 (Camargo et al., 2024).Furthermore, in conditions where pressure limits are serious concerns during underground H 2 storage, longer but similar lengths for injection and production perforation lengths are suggested.The worst conditions happened when the production lengths were much shorter than the injection lengths.For example, it is noteworthy that the RF H2 for a model with injection and production perforation lengths of 100 and 5 m, respectively, was 32.1% lower compared to a model with equal injection and production perforation lengths of 5 m.For shorter and equal production and injection perforation lengths (Fig. 14a and b), the mixing zone and remaining hydrocarbon were located at a greater distance from producing perforations, facilitating more H 2 production.Also, when the production perforation length was significantly shorter than the injection perforation length, the injected H 2 remained further away from the production zone, naturally resulting in a lower chance of H 2 production (Fig. 14e and f).In summary, depending on the energy demand and the volume of H 2 that needs to be stored, and considering well pressure limits, suitable lengths of well perforations should be selected during the design of underground H 2 storage operation.
Intelligent completion technology enables real-time reservoir monitoring and management.In this technology, the data gathered using the downhole sensors are analyzed and decisions are made and implemented using downhole production tools (Huiyun et al., 2020).This technology can be used to manage downhole perforations during underground H 2 storage, resulting in the production of purer H 2 .To analyze the effectiveness of intelligent completions, underground H 2 storage was compared with and without the use of this technology.In the intelligent completion scenario, at each timestep, if the H 2 mole fraction in the production stream was less than 0.7, the worst-performing perforation and all perforations below it were closed.Consequently, if necessary, the perforation length was modified during production.It should be mentioned that 0.7 is the economic limit for the Pressure Swing Adsorption unit, the most common method for H 2 purification (Becker et al., 2012;Spath et al., 2005).Also, to ensure that the same quantity of gas was produced with and without applying intelligent completion scenarios, longer injection and production perforation lengths of 50 m were used.Moreover, the performance of intelligent completions was examined in another model where reservoir thickness and injection/production perforation lengths were 300 and 150 m, respectively.
Fig. 15 compares RF H2 s for different cycle numbers with and without intelligent completion scenarios.A slight improvement in RF H2 values, specifically during the initial cycles can be seen.However, the differences are more significant in the case of greater reservoir thickness and  longer production/injection perforation lengths (see Fig. 15b).When the worst perforation and those below it were shut, purer H 2 from the top perforations was produced resulting in higher RF H2 values.In summary, closing the worst perforations increased the potential for purer H 2 production.Specifically, for a thicker formation, shutting worst perforations resulted in conditions where the low H 2 content gas stayed at a further distance from the top open perforations, reducing the chance of low H 2 content gas production.The results confirmed the possible applications of intelligent completions to enhance RF H2 .

The impacts of fractures
As mentioned previously, heterogeneities such as natural fractures can enhance the mixing process in the porous media.This section examines the impacts of local fractures during underground H 2 storage.Two distinct models were explored for this purpose.The first assumed one fracture in the model, placed 10 m from the top, while the second assumed two fractures in the model, located 7 and 13 m from the top.It was assumed that the fractures extended 200 m in both x and y directions around the wellbore resulting in a tenfold increase in permeability in x, y, and z directions for the blocks hosting fractures.It is worth noting that a fracture with a 175.4 μm opening can lead to such an increase in the average horizontal permeability of the block hosting the fracture.Except for the permeabilities of the blocks hosting fractures, the built models were similar to the base model.Furthermore, the fractures were within the production and injection perforation lengths, which extended 20 m from the top.
Fig. 16 compares RF H2 values versus cycles for the base model (no fracture), the model with one fracture, and the model with two fractures.As illustrated, fractures notably decreased the RF H2 , especially during the early cycles.For example, RF H2 values for the first cycle in the models with no fracture, one fracture, and two fractures were 74.3, 70.9, and 68.3 %, respectively.These differences were less in the cycle 10 as RF H2 values were 83.9, 82.6, and 81.5 % for no fracture, one fracture, and two fracture models, correspondingly.Moreover, similar to the previous cases, an increasing trend can be seen in RF H2 values by increasing the number of cycles.
Fig. 17 shows cross-sectional views of horizontal mass flow rates of H 2 around the wellbore in the middle of the injection and production phases during the first cycle.The visualizations include the base case and two fracture models.In this figure, positive mass flow rates indicate flow toward the well, while negative flow rates represent the outward flow from the well.As anticipated, the injected H 2 migrated far from the wellbore due to the high-flow paths created by local fractures (see Fig. 17a and b).Consequently, this led to lower values for RF H2 particularly during the early cycles.At the end of the injection phase of the first cycle, 78.3% of the injected H 2 appeared as the mixed in two fractures model whereas the corresponding value for the base case was 68.2%.Thus, compared to the base case, local fractures have increased the mixing by almost 10%.During the production phase, fractures served as the path to direct the migrated H 2 toward the production well (see Fig. 17c and d).In subsequent cycles, the accumulated H 2 in the reservoir was withdrawn, with the assistance of highly conductive flow paths created by fractures.This resulted in less difference in the RF H2 values during higher cycles when compared to the no fracture model.In summary, the results indicated that local fractures mainly decreased the RF H2 during the early cycles.However, in the next cycles, the impact of local fractures was mitigated as they facilitated the withdrawal of previously unproduced H 2 by providing highly conductive flow paths.
It is worth noting that the effects of fractures can be more significant in cases with higher fracture intensity or a more widespread fracture network, as these conditions can further enhance migration of the injected H 2 over a longer distance from the well.Furthermore, the roles of fractures in improving injectivity and productivity during H 2 storage, especially in tight formations, are important and should be noted.

Summary and conclusions
We studied the mixing dynamics and recovery factor of hydrogen storage in depleted or partially depleted gas reservoirs.In particular, the impacts of the initial hydrocarbon gas recovery factor, reservoir permeability, well perforation lengths, applying intelligent completion, and the presence of local fractures were assessed.For this purpose, compositional simulation was performed where the same amount of hydrogen and gas were injected and produced during each cycle, respectively.Moreover, the injection and production activities stayed within the allowed pressure limits for both the maximum and minimum bottomhole pressures.
Mixing between injected hydrogen and the cushion gas occurred throughout each cycle including pressure-driven flow during injection and production and also density-driven flow during the idle time following the injection.
Fairly higher hydrogen recoveries were obtained when the storage process commenced at higher hydrocarbon gas recovery factors (i.e., lower reservoir pressures).At higher hydrocarbon gas recovery factors, the pure hydrogen occupied a wider area around the well, resulting in pushing the mixing zone and cushion gas to a greater distance from the well.
Hydrogen storage in reservoirs with lower permeability resulted in higher recovery factors (provided the well pressure limits were not critical).In reservoirs with higher permeability, the injected hydrogen would move upward and spread out laterally, resulting in the injected hydrogen being situated at a greater distance from the wellbore and making the hydrogen production more challenging.
Higher hydrogen recoveries were achieved when production and injection lengths were kept the same and short at the top of the reservoir.At these conditions, the mixed hydrogen and hydrocarbon gas were at higher distances from the perforations.In the cases with injectivity and productivity issues, longer and similar production and injection perforation lengths should be considered, resulting in very good hydrogen recoveries.Additionally, the results show that using intelligent completions could enhance hydrogen recoveries, particularly for storage operations in thicker formations.When the worst-performing perforations were closed using intelligent completions, the gas with lower hydrogen content stayed away from the top open perforations.This resulted in production of gas with higher hydrogen purity.
Fractures could reduce hydrogen recovery during the early cycles by allowing hydrogen to migrate far from the wellbore.However, their impacts were reduced in subsequent cycles because fractures facilitated the withdrawal of unproduced hydrogen from previous cycles.The

Declaration of competing interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Fig. 1 .
Fig. 1.Schematic representation of H 2 storage in a depleted/partially depleted gas reservoir with pure and mixing H 2 zones.

Fig. 2 .
Fig. 2. A view of the three-dimensional reservoir model showing pressure distribution at the beginning of H 2 storage and the well at the center of the model (Note: Vertical exaggeration factor of 4 applied to the Z-scale for enhanced visibility).

Fig. 5 .
Fig. 5. Cross-sectional vector map of the flow directions of H₂ and CH₄, along with the distribution of H₂ mole fraction around the well during the first cycle: (a) middle of injection, (b) middle of idle time after injection, and (c) middle of production.

Fig. 6 .
Fig. 6. a) Mass rates and b) mass fraction of various gases, including H 2 , CH 4 , and N 2 , over time.

Fig. 7 .
Fig. 7. Results of RF H2 in the base case together with the cumulative mass of injected H 2 during ten cycles.Fig. 8. RF H2 versus cycles at different RF init HC s.

Fig. 9 .
Fig. 9. Cross-sectional views of the spread of pure and mixing H 2 zones at different RF init HC s after injection of the first cycle: (a) 50% RF init HC , (b) 60% RF init HC , and (c) 70% RF init HC .

Fig. 11 .
Fig. 11.Cross-sectional views of gas mole fraction distributions around the injection/production well in the first cycle and as a result of permeability variation for base, medium and high cases: (a) base, before the production, (b) base, after the production, (c) medium, before the production, (d) medium, after the production, (e) high, before the production, and (f) high, after the production.

Fig. 12 .
Fig. 12.The H 2 mass flow rate in a) horizontal direction and b) vertical direction for a block located 80 m away from the well and 5 m from the top of the reservoir for models with different permeability values during cycles 1 and 2.. (In horizontal flow, negative H 2 mass flow rates indicate an outward flow from the well, while positive values signify a flow towards the well.In vertical flow, negative rates indicate movement towards the top of the reservoir, and positive rates show a flow towards the bottom of the reservoir.)

Fig. 13 .
Fig. 13.Map of RF H2 in the first cycle for different combinations of production and injection perforation lengths.

Fig. 14 .
Fig. 14.Cross-sectional views of gas mole fraction distributions around the injection/production well in the first cycle and as a result of different injection and production lengths (a) injection and production lengths = 5 m, before production and (b), after production, (c) injection and production lengths = 100 m, before production (d), after production, (e) injection length = 100 m and production length = 5 m, before production (f), after production.

Table 1
Properties of the base model.
ParameterValue Unit Number of grids in x, y, and z directions, respectively.41,41, and 100 -Grid sizes in in x, y, and z directions, respectively.20, 20, and 1 m Permeability in x, y, and z directions, respectively.50, 50, and 5

Table 2
Comparing RF H2 in the first cycle for special cases of injection and production lengths.