# Sustainable Energy Solutions: Utilising UGS for Hydrogen Production by Electrolysis
## 3 Mathematical Model Description
### Integration of Turboexpander in Mathematical Model, and Case Scenario Definition  
The technological process of gas flow and pressure reduction through TE was simulated with the GCAP 9.3 software [41]. The model assumed that the gas reduction valve inside the gas reduction station was replaced by a turboexpander-generator device. In the software the expander and generator were combined in an equipment model shown in Figure 7.  
The required input parameters are entered for material stream \"1\", and the simulation results for steady gas flow are shown in stream \"4\" and \"q100\". The input parameters consists of the following:  
* Gas inlet pressure, MPa;
* Gas inlet temperature, K;
* Mole fraction of individual gas component, -;
* Gas flow rate, kg/h.  
The model in GCAP assumed a fixed pressure drop value of 2 MPa across a turboexpander. Considering that the model results for the fixed pressure drop and variable gas flow of the selected TE showed an almost linear dependence between the TE power generated and the gas inlet volume flow, the TE model was integrated in the GAP 13.5 model for simplicity via programme code using the \"Inline Programmable Element\" option describing the linear dependency of the gas flow and the available power and TE (Figure 8). The model was configured for a fixed pressure value before the turboexpander at 5.5 MPa and the last node separator pressure of 3.5 MPa.  
Figure 7: Expander and generator model in GCAP 9.3 software.  
The RESOLVE(r) 13.5 programme (Petroleum experts 13.5 Ltd. (Edinburgh, UK) [42]) was used as a platform for managing and integrating the individual models. After integration, the logic of each simulation step was programmed within the RESOLVE in terms of adhering to the model restrictions and the achievement of the simulation objective. The possibility of transferring the data from one application (individual model) to another facilitated dynamic communication between all individual models (wells, surface network, and reservoir).  
The following input settings and restrictions applied in the RESOLVE model for calculating the amount of hydrogen produced per withdrawal cycle:  
* Last system node pressure (gas separator pressure) = 3 MPa;
* Number of active withdrawal wells = 22;
* Maximum drawdown available at each well = 3 MPa;
* Maximum allowable gas production = 220,000 Sm\({}^{3}\)/h;
* Fixed pressure upstream of the turboexpander (IGPE) = 5.5 MPa;
* Maximum permitted gas rate for injection = 160,000 m\({}^{3}\)/h;
* Limit value for withdrawal gas rate = 240,000 m\({}^{3}\)/h;
* Minimum average reservoir pressure = 8 MPa;
* Maximum average reservoir pressure = 19.6 MPa;
* Minimum permissible pressure at the wellhead = 5.5 MPa;
* Maximum permissible downhole pressure value = 21 MPa;
* The withdrawal cycle began on the first of October and ended at the beginning of April. The injection cycle began on the first of April and ended at the beginning of October.  
Depending on the reservoir pressure drop, the productivity index of the wells in operation, and the pressure drop due to the hydraulic resistance of the well string and the process equipment, the output data of the model provided values for the maximum possible gas production from the storage, the current water production, and the available electric power at the electrolyser required for hydrogen production at any given time. A graphical representation of the results obtained is provided in Section 4. The RESOLVE 13.5 model integration is shown in Figure 9.  
Figure 8: Integration of turboexpander and UGS mathematical model.