## 3 Methodology  
The mathematical formulation of the material balance equation is adapted from [PERSON] et al. [22]. It is based on the mass conservation principle in an idealized representation of a gas reservoir as a container. For simplicity, methane (CH\({}_{4}\)) is considered the sole constituent of the natural gas in the reservoir. Also, we assume constant reservoir temperature in this study. Figure 1 shows a schematic representation of the system. The objective is to establish a macroscopic mass balance relationship using a zero-dimensional(tank) model, following the material balance frameworks described by [PERSON] and [PERSON] [4] and [PERSON] and [PERSON] [33]. This approach correlates the initial fluid in place volumes with variables such as reservoir pressure, injected fluids, aquifer influx, and the compressibility of rock and water. This is performed by using average properties and disregarding internal gradients of pressure and temperature, providing a simplified yet effective representation of the storage reservoir. The proposed analytical framework is implemented in Python and can be downloaded from the Supplementary Material. The in situ gas PVT (pressure, volume, temperature) properties are computed utilizing the Soave-Redlich-Kwong (SRK) [34] equation of state (EoS) from the open-source thermodynamic library CoolProp [35]. However, it is important to mention that the framework presented can be used with any other EoS or constitutive relation that provides the gas phase compressibility factor. A mass balance equation is formulated for each gas in the system on the following basis:  
* Moles of methane do not change during the storage: moles of methane initially in the depleted gas reservoir = moles of methane after hydrogen injection: \[n_{\text{CH}_{4}\text{dep}}=n_{\text{CH}_{4}\text{stor}}\] (1)
* To emphasize, all moles of hydrogen injected remain stored: moles of hydrogen injected at surface conditions = moles of hydrogen at reservoir storage conditions: \[n_{\text{H}_{2}\text{,sc}}=n_{\text{H}_{2}\text{,stor}}\] (2) where the subscript dep denotes depletion conditions, sc is for surface conditions, and stor is for reservoir storage conditions. Based on the real gas law (\(pV=ZnRT\)), the molar quantity of methane in Equation (1) can be written as  
\[n_{\text{CH}_{4}\text{,dep}}=\frac{p_{\text{dep}}V_{\text{CH}_{4}\text{,dep}}} {Z_{\text{CH}_{4}\text{,dep}RT_{\text{dep}}}} \tag{3}\]  
where \(p_{\text{dep}}\) is the depletion pressure [psi], \(V_{\text{CH}_{4}\text{,dep}}\) is the remaining gas volume at depletion conditions [ft\({}^{3}\)], \(Z_{\text{CH}_{4}\text{,dep}}\) is the gas compressibility factor at depletion conditions, \(T_{\text{dep}}\) is the reservoir temperature [\({}^{\circ}\)R], and \(R\) is the universal gas constant 10.73 [psi\(\cdot\)ft\({}^{3}\cdot\)bmol\({}^{-1}\cdot^{\circ}\)R\({}^{-1}\)]. The gas-bearing pore volume \(V\) [ft\({}^{3}\)], at any point in time, can be expressed as  
\[V=V_{i}[1-c_{\text{eff}}\ (p_{\text{i}}-p)]+5.615\ \big{(}W_{\text{p}}B_{ \text{w}}-W_{\text{e}}\big{)} \tag{4}\]  
where \(V_{i}\) is the initial pore volume [ft\({}^{3}\)], \(c_{\text{eff}}\) is the effective compressibility [1/psi], \(p_{i}\) is the initial reservoir pressure [psi], \(p\) is the reservoir pressure [psi] at any point in time, \(W_{p}\) is  
Figure 1: Schematic of the reservoir representation used for the material balance model. From left to right: initial gas and water volumes at the original pressure \(p_{i}\); remaining gas volume and expanded rock and bound water volume at depletion pressure \(p_{\text{dep}}\); addition of injected hydrogen at storage pressure \(p_{\text{stor}}\). the volume of produced water [STB], \(B_{\rm w}\) is the water formation volume factor [bbl/STB], \(W_{\rm e}\) is the water influx [bbl], and 5.615 is the unit conversion factor [ft3/bbl].