## 2 Mathematical Models
### Three-Phase Relative Permeability Hysteresis Model
The relative permeability of the water phase during the water injection stage:  
\[\Big{[}K_{rg}^{drain}\Big{]}_{n}=\bigg{\{}\Big{[}K_{rg}^{2 Ph}\big{(}S_{g} \big{)}-K_{rg}^{2 Ph}\Big{(}S_{g}^{init}\Big{)}\Big{]}\cdot\bigg{(}\frac{S_{w_{ j}}}{S_{w}^{init}}\bigg{)}^{a}\bigg{\}}_{n}+\Big{[}K_{rg}^{imb}\Big{(}S_{g}^{ init}\Big{)}\Big{]}_{n-1} \tag{82}\]1  
The relative permeability of the water phase during the gas injection stage:  
\[\Big{[}K_{rg}^{drain}\Big{]}_{n}=\bigg{\{}\Big{[}K_{rg}^{2 Ph}\big{(}S_{g} \big{)}-K_{rg}^{2 Ph}\Big{(}S_{g}^{init}\Big{)}\Big{]}\cdot\bigg{(}\frac{S_{w_{ j}}}{S_{w}^{init}}\bigg{)}^{a}\bigg{\}}_{n}+\Big{[}K_{rg}^{imb}\Big{(}S_{g}^{ init}\Big{)}\Big{]}_{n-1} \tag{82}\]2  
The relative permeability of the oil phase during the water injection stage:  
\[\Big{[}K_{rg}^{drain}\Big{]}_{n}=\bigg{\{}\Big{[}K_{rg}^{2 Ph}\big{(}S_{g} \big{)}-K_{rg}^{2 Ph}\Big{(}S_{g}^{init}\Big{)}\Big{]}\cdot\bigg{(}\frac{S_{w_{ j}}}{S_{w}^{init}}\bigg{)}^{a}\bigg{\}}_{n}+\Big{[}K_{rg}^{imb}\Big{(}S_{g}^{ init}\Big{)}\Big{]}_{n-1} \tag{82}\]3  
\[\Big{[}K_{rg}^{drain}\Big{]}_{n}=\bigg{\{}\Big{[}K_{rg}^{2 Ph}\big{(}S_{g} \big{)}-K_{rg}^{2 Ph}\Big{(}S_{g}^{init}\Big{)}\Big{]}\cdot\bigg{(}\frac{S_{w_{ j}}}{S_{w}^{init}}\bigg{)}^{a}\bigg{\}}_{n}+\Big{[}K_{rg}^{imb}\Big{(}S_{g}^{ init}\Big{)}\Big{]}_{n-1} \tag{82}\]4  
The relative permeability of the oil phase during the gas injection stage:  
\[\Big{[}K_{rg}^{drain}\Big{]}_{n}=\bigg{\{}\Big{[}K_{rg}^{2 Ph}\big{(}S_{g} \big{)}-K_{rg}^{2 Ph}\Big{(}S_{g}^{init}\Big{)}\Big{]}\cdot\bigg{(}\frac{S_{w_{ j}}}{S_{w}^{init}}\bigg{)}^{a}\bigg{\}}_{n}+\Big{[}K_{rg}^{imb}\Big{(}S_{g}^{ init}\Big{)}\Big{]}_{n-1} \tag{82}\]5  
\(k_{ro}\) is proportional to \(s_{o}^{2}\). If three-phase relative permeability data are not measured, one can utilize an existing three-phase relative permeability model such as the Stone or Baker model to generate input three-phase relative permeability data. (7) Aghabozorgi Model (2014)  
[PERSON] et al. estimated the fluid saturations at the end of the WAG experimental cycles based on new coefficients implemented in the three-phase relative permeability model, and finally, they estimated changes in water and gas relative permeabilities. The model successfully simulated the hysteresis observed in WAG experiments in sandstone. To calculate the final saturations for each injection cycle, a new parameter called the'relative difference' was defined based on experimental values of oil saturation at the end of the injection cycle. \[\Big{[}K_{rg}^{drain}\Big{]}_{n}=\bigg{\{}\Big{[}K_{rg}^{2 Ph}\big{(}S_{g} \big{)}-K_{rg}^{2 Ph}\Big{(}S_{g}^{init}\Big{)}\Big{]}\cdot\bigg{(}\frac{S_{w_{ j}}}{S_{w}^{init}}\bigg{)}^{a}\bigg{\}}_{n}+\Big{[}K_{rg}^{imb}\Big{(}S_{g}^{ init}\Big{)}\Big{]}_{n-1} \tag{82}\]6  
\[\Big{[}K_{rg}^{drain}\Big{]}_{n}=\bigg{\{}\Big{[}K_{rg}^{2 Ph}\big{(}S_{g} \big{)}-K_{rg}^{2 Ph}\Big{(}S_{g}^{init}\Big{)}\Big{]}\cdot\bigg{(}\frac{S_{w_{ j}}}{S_{w}^{init}}\bigg{)}^{a}\bigg{\}}_{n}+\Big{[}K_{rg}^{imb}\Big{(}S_{g}^{ init}\Big{)}\Big{]}_{n-1} \tag{82}\]7  
Here, \(\delta_{o}\) is the rate of change of oil saturation, \(S_{of}\) is the residual oil saturation, \(S_{of}^{n}\) is the residual oil saturation in the \(n\)-th cycle, and \(\delta_{o,ave}\) is the average rate of change in oil saturation. The main assumption in this model is that the water saturation fluctuates within a certain range of saturations, with known limits (water saturation at the beginning and end of the imbibition cycle). This assumption is applicable to systems where the decrease in water saturation is negligible (or assumed to be negligible). If the variation in water saturation is not negligible in the system, a relative difference term can also be defined for the water phase.