Two-Stage Geothermal Well Clustering for Oil-to-Water Conversion on Mature Oil Fields

: There are numerous oil ﬁelds that are approaching the end of their lifetime and that have great geothermal potential considering temperature and water cut. On the other hand, the oil industry is facing challenges due to increasingly stringent environmental regulations. An example of this is the case of France where oil extraction will be forbidden starting from the year 2035. Therefore, some oil companies are considering switching from the oil business to investing in geothermal projects conducted on existing oil wells. The proposed methodology and developed conversions present the evaluation of existing geothermal potentials for each oil ﬁeld in terms of water temperature and ﬂow rate. An additional important aspect is also the spatial distribution of existing oil wells related to the speciﬁc oil ﬁeld. This paper proposes a two-stage clustering approach for grouping similar wells in terms of their temperature properties. Once grouped on a temperature basis, these clusters should be clustered once more with respect to their spatial arrangement in order to optimize the location of production facilities. The outputs regarding production quantities and economic and environmental aspects will provide insight into the optimal scenario for oil-to-water conversion. The scenarios differ in terms of produced energy and technology used. A case study has been developed where the comparison of overall ﬁelds and clustered ﬁelds is shown, together with the formed scenarios that can further determine the possible conversion of petroleum assets to a geothermal assets.


Introduction
Geothermal heat has been traditionally extracted at locations characterized by hydrogeological anomalies, but recent advances in engineering have enabled the development of alternative approaches such as enhanced geothermal systems (EGS) and borehole heat exchangers (BHE) [1][2][3]. Both technologies can enable harvesting Earth's heat without any (or little) location constraints. EGS systems are used to produce energy by enhancing in situ permeability and harvesting heat from hot rock reservoirs [4]. The connection between production and injection wells in EGS is engineered by various stimulation techniques. The viability of an EGS project is mostly influenced by brine flow rate and production temperature, where higher flow rates and temperatures support electricity generation and lower values support direct usage of hot water, i.e., heating power production. Regarding fluid flow rates, the increase in low rates could be achieved by applying reservoir stimulation, whereas temperatures can be increased only by drilling deeper wells [5]. BHEs harvest geothermal energy without direct interaction of flowing fluid with the soil or rock. Different from the EGS, the efficiency of deep BHEs strongly depends on heat exchanger configurations and the host rock thermal properties [6]. The economic viability of both technologies, especially considering high depths (>3 km), depends on emerging technologies, drilling technologies, reservoir technologies, etc. tion with different production technologies are developed with the main goal of comparing different options for heat and/or electricity production and to choose the optimal one. One of the main features of the conversion is temperature and spatial clustering, which clusters the wells according to the geothermal fluid temperature into a different end-use group and, once again, clusters the wells into spatial groups according to the distance between each well. Spatial clustering enables the user to include all wells on the field with high water cut in the conversion in order to upscale production quantities and to decrease piping connection cost. Additionally, three submodules are developed to calculate the power consumption of the production pump, injection pump, and deep borehole heat exchanger pump. After entering the input data for each scenario, the conversion tool will calculate four main outputs: produced energy quantities, LCOE or LCOH, NPV, and avoided CO 2 emissions. Based on these results, the user can decide which conversion option is optimum for a given petroleum asset.

Developed Scenarios
The methodology for an economic evaluation of end-of-field life conversion is a decision-making framework that uses different input data in which the main goal is to compare different options for heat and/or electricity production and to choose the most suitable option. The main purpose of the methodology is to offer the optimal scenario for converting the petroleum asset to a geothermal one. Based on the input data of mature or abandoned petroleum fields, economic or environmental parameters, and technological features, five scenarios are modelled, and the result is output data. The output data, based on the extensive and thorough calculations, provide insight into the economic and environmental aspects of the geothermal project for each scenario.
One of the key benefits of the proposed work is the avoidance of decommissioning the cost of wells and surface facilities and generating income through electricity and heat production by repurposing the mature oil field into a geothermal asset. One of the main contributions of the methodology is two-stage clustering that enables the temperature and spatial arrangement of the wells and, among the oil wells, also includes the wells from the field that were previously flooded and were not producing oil or newly drilled wells in terms of upscaling geothermal energy production. Two-stage clustering is an optimization process because it clusters the wells according to the temperature of the end-use and according to the spatial distribution so that the position of the geothermal plant can be determined along with the inclusion of the wells in the gathering system corresponding to the shortest distance from the geothermal plant.
The developed methodology should serve as a pre-feasibility study of converting a petroleum field to a geothermal one. The methodology provides guidelines in terms of retrofitting mature or abandoned petroleum fields to geothermal energy exploitation and user-friendly environment for which its outputs could encourage possible users to invest in geothermal projects. In the following bulleted list, the developed scenarios are described.

•
Scenario 1-"Do nothing" This scenario refers to plugging and dismantling all the wells and surface facilities and can represent hundreds of thousands of Euros of abandonment cost per well required by mining law. The operating life of an oil field has a certain limitation, and when reaching the end of its viable life, the next step is strategy planning for plugging and abandonment operations. This is dependent on factors such as well location and depth, type of the surface and subsurface facility, number and weight of structures needed to be removed, removal method, transportation, and disposal options, etc [32].
• Scenario 2-"Heat doublets" The developed scenario concerns heat production from production wells and the injection of geothermal fluid into the reservoir by using the injection wells. The main challenge that concerns the geothermal industry is associated with capital-intensive costs of drilling Geosciences 2021, 11, 470 5 of 28 geothermal wells; hence, the utilization of abandoned petroleum wells is encouraged. The aforementioned wells can potentially be harnessed for geothermal energy for direct usage depending on the temperature of geothermal water [3,22,33]. This scenario consists of two sub-scenarios: Temperature range sub-scenario and Heat needs sub-scenario. The Temperature range sub-scenario is the scenario where heat production is based on utilizing the temperature range of geothermal fluid (production temperature and fixed injection temperature). The latter scenario, Heat needs sub-scenario, is based on satisfying the heat demand of the end-user. The heat demand is set as the user's input, or it is calculated based on the heat demand of three different type of buildings.
• Scenario 3-"Heat via BHE" The modelled scenario regards heat production using one well, i.e., the borehole heat exchanger. Borehole heat exchangers are used to extract heat without producing geothermal fluid from wells, i.e., with running circulation fluid through the wellbore. The usage of abandoned wells in such a manner can decrease gas emissions with respect to the atmosphere and the energy needed for reinjection. The circulating fluid is injected through annular space and produced at the wellhead through production tubing or vice versa [1, 23,34]. This scenario consists of two sub-scenarios, Temperature range sub-scenario and Heat needs sub-scenario, which is the same as described in Scenario 2.
• Scenario 4-"ORC power production" This scenario represents electric power generation using the Organic Rankine Cycle (ORC). Electricity can be produced by using production and injection wells or using a deep borehole heat exchanger. The power capacity is determined primarily by the production rate, temperature of produced water, ambient temperature, water salinity, conversion efficiency of the geothermal power plant, heat transfer efficiency between the reservoir rocks and circulating fluid, etc. [3,8,17,21,35,36].

•
Scenario 5-"Combined power and heat" The developed scenario refers to combined heat and power production (CHP) with parallel configuration modes [37]. The total geothermal fluid flow is divided into two branches as follows: Primarily, heat demand is satisfied, and electric power is then produced with the residual flow. Two sub-scenarios are developed: the first one with the production and injection wells and second one with BHE. The well for BHE is the well with the highest temperature according to the wells clustered by the "electricity" end-use [3,8,[21][22][23]34].

Input Data
The main input data used in the methodology for calculations and clustering process are shown in Table 1.
Even at very high water cut, an oil field often displays mixed flow, meaning that a given geological layer produces both oil and water. It is, therefore, expected to produce both water and oil after conversion. Since the oil cut is very low, it is expected that gravity separation in water tanks will take place. Yearly water-cut increment is a linear percentage value of the annual average water-cut increase, based on historical data. Yearly thermal dropdown is defined as the annual average temperature decline rate for petrothermal reservoirs, as the reservoir is expected to be cooled down by colder fluid injection. Additionally, at the beginning of calculations, it should be determined if the production pump is already installed and running or not. If the pump is already installed, additional input regarding the pump power is required, which is used afterwards to calculate pump consumption power, i.e., parasitic load. In both cases, if the pump is already installed or not yet installed, the user should proceed with the calculation related to the electric submersible pump (ESP) design in order to either design the required new pump that should be installed or to estimate pump consumption for the already installed pump. Temperature loss along the wellbore is also stated as the user's input, and it is automatically subtracted from the reservoir temperature to calculate the wellhead's temperature, i.e., production temperature.
The rest of the input data follows the developed scenario's data and will be set as the default or calculated with the possibility of user's input.

Materials and Methods
At the end of its economic life, a certain spatial footprint of oil field exists. Based on the development history of the oil fields, well pads are made of several wells drilled from the same surface location and are connected to the main facilities by flowlines [38]. Each of the wells on the oil field has different surface flow rates and temperatures. When converting the oil field to geothermal usage, the wells on the field are optimized and the wells that deliver the most suitable flow rate and temperature are kept. The example of temperature and spatial clustering was shown in [39], where the author used the Cluster and Outlier Analysis tool for spatial and temperature well clustering for deep borehole heat exchanger (DBHE) geothermal systems, which solves for the Anselin Local Moran's "I" statistic of spatial association. The statistic was used to identify the aggregation of wells with high bottomhole temperatures. Temperature data of 42,601 wells were collected, and areas with significant densities of oil and gas wells with the accompanying high temperatures were outlined. The described approach could result in an increase in system efficiency and economic viability of the geothermal projects, which are based on the already built subsurface infrastructure of oil and gas fields. The main advantage of clustering methods is the possibility of selecting clusters and/or wells that are already connected to built surface piping infrastructure or are near existing power distribution infrastructure. Moreover, the ability to connect new wells that so far have not produced any oil and gas and have high water cut to a gathering system would result in upscaling the overall capacity of geothermal energy production.
The basis of the developed methodology and the supporting tool is the clustering of the wells, both in terms of temperature and spatial clustering. For both clustering layers, the Python programming language is used with integrated pre-made libraries.
In the first layer of clustering, i.e., temperature clustering, the production wells are sorted into the temperature groups according to their well temperature, and each well is sorted into groups for one or more end-uses. The well that has more than one end-use is used in calculations for more than one scenario. The second layer of clustering is spatial clustering where the used method of clustering sorts the wells in certain number of clusters based on their distances between each other. Spatial clustering enables the inclusion of unused wells on the field in further calculations that have a high water cut that is suitable for geothermal energy production; the wells that were not previously included in oil production; and newly drilled wells that have a high water cut and are drilled for geothermal purposes on the mature or abandoned oil field. Spatial clustering also defines the data point (centroid, most commonly an imaginary point), which is in the middle of the cluster and the well (existing data point that is nearest to the centroid) upon which the new thermal or power plant should be built with minimum cost of a new pipeline system.

Temperature Clustering
The temperature clustering layer is based on Lindal's diagram [31] with minor modifications. Minor modifications of Lindal's diagram and the possible applications of geothermal energy made for the purpose of the methodology concern the expansion of temperature ranges for end-uses. The main modification is the expansion of temperature range for electricity production using Organic Rankine Cycle (ORC) smart mobile units, which is one on the main goals of the MEET project, i.e., enhancing heat-to-power conversion at low temperature (60 • C-90 • C). The temperature ranges for different end-uses are shown in Figure 1. The temperature spans from 0 • C to 200 • C with the heat pump, heat generation, and electricity generation as the end-uses. Electricity generation end-use covers electricity production by using smart mobile ORC units and electricity production in binary systems (ORC). The temperature range for heat pump is stated here as the informational data, and it does not proceed to further calculations for the purposes of methodology and tools.

Spatial clustering
The method used in the developed methodology and case study is the Density-Based Spatial Clustering of Applications with Noise or DBSCAN, which is an unsupervised machine learning algorithm. Unsupervised machine learning algorithms are used to allocate

Spatial Clustering
The method used in the developed methodology and case study is the Density-Based Spatial Clustering of Applications with Noise or DBSCAN, which is an unsupervised machine learning algorithm. Unsupervised machine learning algorithms are used to allocate unlabelled data. DBSCAN method examines the clusters as high-density regions separated by low-density regions; therefore, the clusters found by DBSCAN method can be of any shape [40].
For the mentioned clustering method, a few important parameters need to be predetermined: • Epsilon, as the maximum distance between two data points for one to be considered as in the neighbourhood; • Minimum samples, as the number of data points (or total weight) in a neighbourhood for a point to be recognized as a core point and includes the point itself; • Metric, as the metric used when calculating the distance between instances in the array.
DBSCAN creates a circle of Epsilon radius around every data point and classifies them into core point, border point, and noise point. A data point is a core point if the circle around it contains at least a number of Minimum Samples points. If the number of points is less than the Minimum Samples number, then it is classified as a border point, and if there are no other data points around any data point within the epsilon radius, then it is treated as a noise point [41]. The Epsilon value can be calculated as the average distance between each point in the data set and its Minimum samples number of nearest neighbours. The average distance is then plotted by ascending value where the sorted values produce an elbow plot that indicates the maximum curvature on the point, which is the Epsilon value.
The main advantage of the considered method is the determination of outlier points and the selection of clusters according to the different shapes of the data set. The main weakness of the method is that it does not work well with the data set that has different densities (different distances between the points), and due to the fact that Epsilon is a fixed value, it will characterize the points with different densities as outlier points.

Outputs
When two-layer clustering is conducted, the number of clusters in the specific field is obtained, and the filtering option is enabled. Namely, various filtering options are possible: filtering of the individual wells, filtering the number of end-uses for each well, filtering desired end-uses to be included in further calculations, filtering regarding the wellhead temperature, and filtering according to the number of the cluster in which the well is located. This type of listing and filtering later enables the calculation of results for each scenario, including both heat and electricity generation, and provides the user with an option to include or exclude a particular well or cluster from further calculations and scenario development.

Energy Production Quantities
Regarding energy production, the quantities of produced electricity and/or heat are calculated for each modelled scenario. For both electricity and heat generation scenarios, when using the production-injection wells, the temperature of the mixed fluids, density of the mixed fluids, and specific heat capacity of the mixed fluids are all computed from all wells from the field, which are filtered after the clustering process. The temperature of filtered wells is calculated by using Richmann's rule of mixing [42], shown in Equation (1): where the T represents the fluid's temperature ( • C), . m is the mass flow (kg/s), c is the specific heat capacity (J/kg • C) of the geothermal fluid from each well, and n is the number of wells. Moreover, the density of the mixed fluid [43] from the geothermal water from all wells used in the methodology is calculated by using Equation (2): where ρ f represents the density of the geothermal water (kg/m 3 ) from a specific well, and . m is the mass flow (kg/s) from the well. The specific heat capacity of the mixed fluid is determined by using Equation (3) [44]: where the c p refers to the specific heat capacity of geothermal fluid (J/kg • C), and . m is the mass flow (kg/s).
For the scenarios with heat production, thermal energy production concerns the exploitation of a fixed temperature range between geothermal fluid production temperature and fixed outlet temperature from the plant where heat can be delivered to multiple endusers during the entire year or serves as the base load thermal power plant. The installed capacity (Q th ) is a direct function of specific heat capacity of geothermal fluid, density of geothermal fluid, fluid flow, and the temperature difference between the temperature inlet and outlet in the thermal power plant, as shown in Equation (4): where c p is the specific heat capacity of the geothermal fluid (J/kg • C), ρ f represents the density of the geothermal water (kg/m 3 ), q is the fluid flow (m 3 /s), T i is the wellhead temperature ( • C), i.e., the temperature at the inlet of the thermal power plant, and T o is the temperature ( • C) at the outlet of the thermal power plant. The produced heat is calculated by using Equation (5): where the t is time (hours) in which the thermal power plant is operating, and η HE is the efficiency (%) of the heat exchanger between the geothermal (circulating) fluid and the working fluid in the secondary loop (end user side). For Scenario 3, i.e., heat production using the borehole heat exchanger, heat transfer between the reservoir rocks and the circulating fluid is quantified by using the temperature ratio (X TR ). Temperature ratio is the number that represents heat transfer correlation between the reservoir rock and circulating fluid, including the heat transfer through cement, casing, tubing, and tubing isolation, i.e., the ratio of the temperature outlet from the deep borehole heat exchanger and bottomhole temperature. It is assumed that the reservoir temperature is the same as the temperature of the reservoir (geothermal) fluid and that the changes in reservoir porosity and thermal conductivity do not change significantly in the reservoir. The theoretical lower limit of X TR is zero, which means that there is no heat transfer between the fluid and the rock, and the theoretical upper limit is one, which means that heat transfer from the reservoir rock to circulating fluid happened completely. The temperature ratio is derived from the database of several real and simulated cases of deep borehole heat exchanger performances provided in Appendix A. The temperature ratio should imply how much heat is lost in the transfer process by using circulating fluid rather than geothermal fluid. The maximum ratio is 0.864, which means that more than 86% of heat from geothermal reservoir is transferred on the circulating fluid. The minimum ratio is 0.240, which means that only 24% of heat from reservoir rock is transferred to the circulating fluid. The generated temperature ratio enables the simplified estimation of heat transfer without the need for simulation or measurements on the field. General knowledge about favorable technical and geological parameters and configuration is of key importance. The explained factor, X TR , is included in Equations (6) and (7) for the calculation of the installed capacity and heat production as the factors, which are multiplied with reservoir temperature: where X TR is the temperature ratio used to describe the heat transfer between the reservoir and the circulating fluid (-), T r is the reservoir temperature, and T o is the injection temperature ( • C) which is the temperature at the outlet of the thermal power plant. For the scenarios with electricity production using Organic Rankine Cycle (ORC) technology to assess heat exchange performances of the used binary power plant, thermal efficiency is analysed and calculated by using the following equations. For the wellhead temperatures higher than 120 • C, the method proposed by the Massachusetts Institute of Technology [3] is used. Namely, regression Equation (8), based on the data from fourteen ORC power plant, is used to calculate thermal efficiency (%): where T inlet ( • C) represents the production temperature in the scenario with the production and injection wells, and in the BHE scenarios, it represents the product of temperature ratio and the reservoir temperature at a certain depth. The installed power is calculated by using Equation (9) [3].
The produced energy is a direct function of installed power, thermal efficiency, and operating time, as shown in Equation (10).
Additionally, for wellhead temperatures lower than 120 • C, the approach from the Deliverable D7.1, based on the data provided from ENOGIA for the purposes of the EU Horizon 2020 project MEET [45], was applied in order to evaluate the ORC power plant production. The following parameters should be considered: • DT-temperature difference on primary side of dedicated heat exchanger; • η ORC -net ORC power plant efficiency as function of geothermal brine extraction temperature (circulating fluid temperature in case of BHE) and DT.
As observed, both η ORC are a function of two variables. In addition, there was a limited number of ORC operating points available from ENOGIA. For that reason, the "MATLAB Curve Fitting Tool" was used to approximate these three-dimensional relationships. Polynomial approximation including third degree was performed.
Equation (11) represents the functional relationship between net ORC power plant efficiency (z), geothermal water extraction temperature, or circulating fluid temperature in case of BHE (y) and DT (x).
It should be noted that relationship from Equation (11) between these variables is best suited for brine extraction temperature values in the range from 80 • C to 120 • C and for DT values in the range from 0 • C to 40 • C. In cases when Equation (11) is used for values outside of the suggested ranges, slightly less accurate results can be expected.
Finally, installed power and produced electricity are calculated according to Equations (9) and (10) with corresponding power plant efficiencies.

Levelized Cost of Energy
The levelized cost of electricity or heat (LCOE or LCOH) is defined as the total discounted lifetime costs of an energy project divided by the total discounted amount of energy it either produces or saves in its lifetime [46].
The approach used in this methodology is based on a discounted cash flow (DCF) analysis. Additionally, it must be emphasized that the LCOE/LCOH metric should be considered rather as an informing measure for investment decisions than an absolute decision metric. Actual system and project planning should also consider reliability issues and other factors. Namely, the availability factor of the power plant, i.e., the time that the plant is available for running influences the produced amount of electricity in a specific period.
In Equations (12) and (13), TPL represents the total lifetime of the project [years], r represents the nominal discount rate (%/100), I t represents investment costs in year t, S t represents incentives or subsidies in year t, OM t represents operation and maintenance costs in year t, TR represents effective tax rate, EE t represents generated electricity in year t, and EH t represents produced heating energy in year t. Total investment costs I t for specific year t in Equations (12) and (13) are calculated as shown in Equation (14): where I exp,est t represents yearly exploration and establishment costs (summarizes the cost of concession or lease acquisition of oil field, permissions, environmental studies, civil work, support facilities, surface exploring, shallow drilling, make-up well deepening, and pre-feasibility and feasibility studies), I prod,inje t represents yearly production and injection wells and system costs (includes mobilization, drilling, logging, testing, production piping, separators, water tanks, injection piping, production and injection pumps, and corrosion inhibitor systems), I ppinst t represents yearly power plant installation costs (it includes power plant design and engineering, procurement procedures and complete phase of construction, testing and controlling, grid connection, and transmission), I admi,man t represents yearly administration and management costs (it includes project management, project and company administration, insurance costs, and different financing fees), and I other,t represents yearly other investment costs not included in any of the aforementioned categories. Additionally, operation and maintenance costs OM t in year t are calculated according to Equation (15): where FO&M t represents yearly fixed O&M (including labor costs, maintenance of field and/or wells and/or power plant) in Euros, O&M production pump t (€) represents yearly production pump variable costs that depend on the installed power of the pump, working hours and electricity price, O&M injection pump t (€) represents yearly injection pump variable costs that depend on the installed power of the pump, working hours, and electricity price, and O&M other t (€) represents yearly variable costs that were not covered by other defined categories.
The nominal discount rate, r, is calculated from the real discount rate, r r , and inflation rate, i, according to Equation (16).
For combined heat and power (CHP) applications, more complex equations are used, dependent on what the main product is. Namely, the LCOE is used if the decision maker chooses the main product of interest as electricity; consequently, when calculating the LCOE for CHP plant, revenues from heat sales must be deduced, and if the main product is heat, when calculating the LCOH for CHP plant, revenues from electricity sales must be deduced (Equations (17) and (18)): where RHS t represents revenues from subsidized heating power sales in year t, RHM t represents revenues from the market heating power sales in year t, RES t represents revenues from subsidized electricity sales in year t, REM t represents revenues from the market electricity sales in year t, and TS represents the duration of subsidized price of electricity or heating power.

Net Present Value
The NPV metric is in this methodology is calculated as shown in Equation (19): where S t is the balance of cash flow (inflows minus outflows) at time t, a t is the financial discount factor chosen for discount at time t, and r is the nominal discount factor. The nominal discount factor is calculated according to Equation (16). Inflows include revenues obtained from electricity and/or heat sells. Outflows include investment costs, which are calculated according to Equation (14) and operating costs, which are further calculated according to Equation (15) but also include yearly tax payments.

Avoided CO 2 Emissions
In order to assess the environmental impact of such conversion projects and, consequently, to approximate the money savings based on this indicator, calculation of avoided CO 2 emissions during operational phase of the plant is proposed and calculated in this methodology. The avoided emissions during operational phase are calculated based on the comparison with the production of the same services with the reference electricity mix and reference heat mix, respectively. The reference mixes are country specific and represent business-as-usual developments until 2019 for each country.
For scenarios with only electricity generation, the amount of avoided CO 2 emissions (tons) is calculated as stated in Equation (20): where t op represents the duration of the operational phase of the plant, . E p is the net electricity production by system at the operating conditions of period p (MWh e ), and e CO 2 ,elemix is the specific CO 2 emissions of electricity production from the reference electricity mix (kgCO 2 /MWh e ).
For scenarios with only heating power production, the amount of avoided CO 2 emissions (tons) is calculated as stated in Equation (21): where t op represents the duration of the operational phase of the plant, . Q p is the produced heat energy to cover heating requirement during period p (MWh th ), and e CO 2 ,heatmix is the specific CO 2 emissions of heating production from a heat mix (kgCO 2 /MWh th ).

Case Study
A case study was formed, i.e., mature oil field with high water-cut production served as the basis for forming the case and conduction of two-layer clustering. The oil field formed for the case study was slightly altered from the existing oil field for the purposes of retaining realistic parameters needed for the conduction of further calculations. The remaining required input data were modelled in such manner as to replicate geothermal systems that could be found in reality regarding technology, modelling of the developed scenarios, environmental and economic data such as the market price of electricity, emission factors, share of fossil fuels in total energy mix for each country, weather data for each country, etc. The rest of the input data for the purposes of the heat demand calculation and variable operational cost of production pumps, injection pumps, and BHE pumps are based on proxy values and can be replaced with the user's input.
In order for the outputs of methodology to be comparable with the outputs from other scenarios, it is desirable for the input data to be similar, referring to data such as heat needs, temperature difference, downtime, etc.
Regarding the heat production, the heat produced by exploiting the default temperature range will be shown. The calculation of heat demand is based on the building's heating system, i.e., heating curve [47]. The operational cost of production pumps is based on [48], where inserting data is required with respect to the well's geometrics for each well, well fluids parameters, productivity, and the associated pressures such as dynamic pressure, differential pressure, hydrostatic pressure, pump intake pressure, etc. For the wells that are newly included in the production of geothermal water, at the start of the calculation there is a short check up to verify if there is a need for production pump installation; if the outcome is positive, the well with its parameters enters the above-mentioned calculation. For the selection of the production pump, an optimization process of selection based on the Schlumberger catalogue [49] is developed where the pump with highest efficiency at the corresponding flow is chosen while satisfying the minimum velocity check-up and operating range check-up. The operational cost of injection pump is based on the performance curves of injection pumps installed at the facilities for geothermal exploitation. The operational cost of BHE pump is estimated by calculating the pump's head loss and Darcy-Weisbach friction factor by using Colebrook's equation [50]. For operational costs, it is assumed that the electricity from the grid is used at the market price and electricity generated from the power plant is sold at the subsidized price.
For the purposes of the case study, the oil asset will be called "Reservoir 1," and it is determined to be in France in the Aquitaine basin. The temperatures in the basin are mainly between 65 • C and 90 • C. The reservoir is characterized with tidal and fluvial sandstones interbedded with clays with thermal conductivity of 3 W/m/K. Reservoir 1 for the conversion to geothermal field consists of 26 production wells and 10 injection wells. The choice for performing deep borehole technology can be any well from the field with suitable production temperature of circulating fluid. The well chosen for Scenario 3 will be the well with the maximum temperature of the geothermal fluid at the wellhead. All injection wells are considered to be of suitable properties for the injection of overall fluid flow. In Figure 2, the spatial distribution of production wells is shown. The main input parameters with respect to Reservoir 1 are shown in the Table 2. Most of the data are shown as the average of all wells taken into calculation. The wells on the field were all oil production wells with no newly added wells, and the data used for further clustering and calculations are more detailed and well specific. Depending on well depth, wells on the field range from 22 °C to 97 °C with respect to the temperature of geothermal water at the wellhead. Depending on the distance from the gathering station, pipe material, and insulation, temperature loss from gathering lines from the wellhead also varies from 0.2 °C to 2 °C overall. The yearly thermal dropdown explains the annual decline rate of reservoir temperature, and the yearly water-cut increment represents annual linear water-cut increase. For the simplification of the calculations, two mentioned values are taken as constant during the duration of project.

Modelling of the Heat Production Scenarios
The input data for modelling heat production scenarios for all wells on the field are presented in Table 3. Scenario 1, which is about decommissioning oil assets, has no input parameters regarding the production, and it will not be shown in this subchapter or the following one. The downtime presents the yearly percentage of time when the well, plant, The main input parameters with respect to Reservoir 1 are shown in the Table 2. Most of the data are shown as the average of all wells taken into calculation. The wells on the field were all oil production wells with no newly added wells, and the data used for further clustering and calculations are more detailed and well specific. Depending on well depth, wells on the field range from 22 • C to 97 • C with respect to the temperature of geothermal water at the wellhead. Depending on the distance from the gathering station, pipe material, and insulation, temperature loss from gathering lines from the wellhead also varies from 0.2 • C to 2 • C overall. The yearly thermal dropdown explains the annual decline rate of reservoir temperature, and the yearly water-cut increment represents annual linear water-cut increase. For the simplification of the calculations, two mentioned values are taken as constant during the duration of project.

Modelling of the Heat Production Scenarios
The input data for modelling heat production scenarios for all wells on the field are presented in Table 3. Scenario 1, which is about decommissioning oil assets, has no input parameters regarding the production, and it will not be shown in this subchapter or the following one. The downtime presents the yearly percentage of time when the well, plant, and other surface facilities were not operating. It could be due to disruption in production, maintenance, or similar reasons. The outlet temperature is the temperature of the fluid at the outlet of the plant. In Scenario 5, a parallel configuration model was applied where heat demand is calculated based on input data stated in Table 3 needed for heating curve performance computation and, consequently, the building's heat demand. The pipeline temperature coefficient corresponds to temperature loss caused by transmission pipelines from the plant to the end-user. It ranges from 0 to 1, where 1 means all the heat is transferred through the pipeline, and 0 corresponds to total temperature loss. The presented value is dependent on the pipeline material and geometry.

Modelling of the Electricity Production Scenarios
The input data for modelling electricity production scenarios for all wells on the field are presented in Table 4. The outlet temperature is the temperature of the fluid at the outlet of the ORC power plant.

Environmental and Economic Input Parameters
For further calculations of the outputs, it is important to define environmental and economic parameters that will be used for calculating avoided CO 2 emissions, levelized cost of electricity or heat, and net present value. The stated outputs are dependent on production quantities and will have the same input parameters except the specific costs that are related to the installed power.
Economic input parameters used in calculations are shown in Table 5. For the market price of electricity, the ARIMA model developed in MATLAB was used to predict the market price of electricity for the time of the project duration based on the historical values [51]. The input values regarding the environmental aspects are stated in the Table 6. The share of each fossil fuel in total fossil fuel electricity or heat generation is taken here as the default value and is based on the data from [52] for a chosen country. The emission factors of each fossil fuel for each energy type, i.e., electricity or heat, are obtained from [53] and will not be publicly shown due to legal reasons. Table 6. Environmental parameters used in calculation.

Input Data Value Unit
Share of coal in total fossil fuel electricity generation 23 % Share of oil in total fossil fuel electricity generation 12 % Share of natural gas in total fossil fuel electricity generation 65 % Share of coal in total fossil fuel heat generation 7 % Share of oil in total fossil fuel heat generation 11 % Share of natural gas in total fossil fuel heat generation 82 %

Results
After conducting two-stage clustering, the results of temperature and spatial clustering are shown in the Table 7. The column "Number of end-uses" represents how many enduses are possible for the conversion of each well based on the wellhead temperature, respectively. The first eight wells have low temperature for district heating and electricity generation but are adequate for the installation of heat pump systems; as such, they are automatically excluded from further calculations. The remaining wells from the field, i.e., eighteen wells in total, were chosen for further calculations of methodology outputs. The first subcase "Whole field" includes all eighteen wells. Furthermore, after applying the DBSCAN method for spatial clustering, the wells were sorted into two clusters, "Cluster 1" and "Cluster 2," without outlier wells. Namely, eighteen wells in total were chosen for further calculations of methodology outputs for sub-cases as follows: • Whole field-18 production wells; • Cluster 1-16 production wells; • Cluster 2-2 production wells. The input data for the subcases Whole field and Cluster 1 remain the same, as described in Sections 4.1 and 4.2. For Cluster 2, the data are changed in order to have realistic scenarios and meaningful production and are shown in Table 8. The spatial representation of conducted clustering of production wells is shown in Figure 3.

Calculated input values.
After the two-stage clustering, the values described in Section 3.3.1. are calculated and shown for each scenario, i.e., subcase in Tables 9-12: calculated input values for Scenario 5. The calculated values, together with the required input data, are substituted into further calculation of methodology outputs.  Figure 3. Graphical results of the two-stage clustering.

Calculated Input Values
After the two-stage clustering, the values described in Section 3.3.1. are calculated and shown for each scenario, i.e., subcase in Tables 9-12: calculated input values for Scenario 5.
The calculated values, together with the required input data, are substituted into further calculation of methodology outputs. Contrary to greenfield geothermal projects, end-of-life oil wells conversion into geothermal ones enables omitting more than a half of the costs related to drilling and stimulation. The values for CAPEX and OPEX are for the purpose of this study estimated based on real data collected by the authors. CAPEX is represented with specific investment costs in Euro per kilowatt and consists of costs included in Equation (14), which depend on the analysed scenario. For each scenario, OPEX is calculated according to Equation (15). Additionally, tax rates are country specific, the discount rate was calculated according to Equation (16) where annual inflation rate for France at the moment of the analysis was 2.3% [54], and the discount rate was considered to be 6.5% [55,56].
CAPEX and OPEX for each scenario and "Whole field" case and additional subcases "Cluster 1" and "Cluster 2" are shown in Table 13.

Methodology Outputs
The graphical results for each subcase and its outputs for each scenario are shown for the first year of operation. The production quantities of heat and electricity scenarios are shown in Figures 4 and 5.     The differences between the production quantities are due to number of wells included in each subcase; thus, fluid flow and the temperature varies. In Scenario 3, the production quantities between each subcase are directly dependent of the fluid's temperature, since the remaining input data are the same; hence, heat production is the greatest for Cluster 2. In Scenario 5, the heat production quantities are similar for all three subcases since it is required in order to satisfy the heat demand first. The electricity production temperatures are directly dependent on fluid flow and thermal efficiency of the ORC turbine, which is conditioned by the geothermal fluid temperature at the inlet of the The differences between the production quantities are due to number of wells included in each subcase; thus, fluid flow and the temperature varies. In Scenario 3, the production quantities between each subcase are directly dependent of the fluid's temperature, since the remaining input data are the same; hence, heat production is the greatest for Cluster 2. In Scenario 5, the heat production quantities are similar for all three sub-cases since it is required in order to satisfy the heat demand first. The electricity production temperatures are directly dependent on fluid flow and thermal efficiency of the ORC turbine, which is conditioned by the geothermal fluid temperature at the inlet of the power plant and the temperature difference between the mentioned temperature and the outlet temperature from the power plant. The levelized costs of heat and levelized costs of electricity are shown in Figures 6 and 7.    The levelized cost of heat is greater that the levelized cost of electricity since the production of electricity is significantly lower than the production of heat, according to the set case study. The net present value is generally negative since it is required in investing in the conversion to geothermal assets, and due to the great investments in the first year of the operation period, the expenses exceed revenues. The net present value for each scenario of three subcases is shown in Figure 8. The levelized cost of heat is greater that the levelized cost of electricity since the production of electricity is significantly lower than the production of heat, according to the set case study. The net present value is generally negative since it is required in investing in the conversion to geothermal assets, and due to the great investments in the first year of the operation period, the expenses exceed revenues. The net present value for each scenario of three subcases is shown in Figure 8. The CO emissions that are avoided in the production of geothermal energy are directly dependent of the energy production quantities, since the emission factors and the share of each fossil fuel in the fossil fuel mix are the same and are, as said, country specific. The avoided CO emissions for each scenario of the three sub-cases are shown in Figure  9. The CO 2 emissions that are avoided in the production of geothermal energy are directly dependent of the energy production quantities, since the emission factors and the share of each fossil fuel in the fossil fuel mix are the same and are, as said, country specific. The avoided CO 2 emissions for each scenario of the three sub-cases are shown in Figure 9.
The CO emissions that are avoided in the production of geothermal energy are directly dependent of the energy production quantities, since the emission factors and the share of each fossil fuel in the fossil fuel mix are the same and are, as said, country specific. The avoided CO emissions for each scenario of the three sub-cases are shown in Figure  9.

Discussion
When comparing the production of energy in each scenario and for each subcase, the production directly depends on fluid flow and the inlet temperature of the geothermal

Discussion
When comparing the production of energy in each scenario and for each subcase, the production directly depends on fluid flow and the inlet temperature of the geothermal fluid or circulating fluid. When producing heat, in Scenario 2, for the Whole field and Cluster 1 subcases, the quantities are nearly the same; the greater inlet temperature in Cluster 1 compensates for the part of the lower flow that is caused by the lower number of production wells compared to Whole field. In Scenario 3, heat production using the borehole heat exchanger produces the most heat in Cluster 2 since the wellhead temperature is higher by more than 3 • C compared to rest of the subcases. In Scenario 5, subcases Whole field and Cluster 1 with similar inlet temperatures and flow of geothermal fluid managed to satisfy the heat needs where the remaining available flow was directed to the electricity production facility. Regarding Cluster 2, the changed input parameter of the outlet temperature, i.e., the greater exploitable temperature range, delivered enough heat to satisfy head demand, and more than 60% of the available flow was directed to the electricity production facility. Regarding electricity production, subcase Whole field produced more electricity than Cluster 1, where greater fluid flow in Whole field compensated for greater wellhead temperature and thermal efficiency of ORC turbine in Cluster 1. Cluster 2, with its two production wells, the wellhead temperature of 72.93 • C, and a low thermal efficiency of the ORC turbine (2.35%), produced about 90% less electricity than Whole field and Cluster 1, even with decreased outlet temperature from the ORC power plant. As stated before, in line with the objectives of MEET 2020 for enhancing heat-to-power conversion, the modelled case study uses low temperature (60 • C-90 • C) at the inlet of the power plant where smart mobile Organic Rankine Cycle units can be used for electricity production. Using mobile ORC greatly enlarges the potential sites that could be exploited together with the use of abandoned oil wells. Such usage of low temperature sources can result in uneconomic scenarios with respect to lower energy production quantities, but existing oil wells can minimize capital investments and increase cost competitiveness.

Economic Results
The levelized cost of electricity or heat and net present values are the main indicators for investment. For the modelled case study and associated subcases, the mentioned outputs quite differ depending on each subcase and scenario.
For the Whole field subcase, LCOH varies from 59.41 €/MWh in Scenario 3 to 301.36 €/MWh in Scenario 5 for heat generation, and the LCOE varies from 1365.82 €/MWh in Scenario 4 up to 1532.94 €/MWh in Scenario 5 for electricity production. Such variations can be explained by the different costs of capital investment, operational costs, and produced energy. It can be observed in the scenarios of electricity generation that lower thermal efficiency greatly affects production where revenue from selling electricity cannot exceed the cost of capital investment and high operational cost of running the production pumps. The operational cost of running the production pumps corresponds to the changes in electricity market price since the electricity from the grid is used to power pumps.
For the Cluster 1 subcase, LCOH varies from 59.41 €/MWh in Scenario 3 up to 465.76 €/MWh in Scenario 5, and as for LCOE, it varies from a minimum of 1052.14 €/MWh in Scenario 5 up to 1143.25 €/MWh in Scenario 4. Different values between two mentioned subcases can be explained with the difference in the number of production wells where there are 18 production wells in Whole field and 16 production wells in Cluster 1. For Scenario 3, a similar value of LCOH results from the fact that the same well was chosen to be converted into the borehole heat exchanger.
For subcase Cluster 2, there are two production wells, and LCOH ranges from 42.76 €/MWh in Scenario 3 to 100.21 €/MWh in Scenario 5, and LCOE ranges from 1307.08 €/MWh in Scenario 4 to 1664.96 €/MWh in Scenario 5. The lower values of LCOH in this subcase can be explained by lower pump operation costs and higher inlet temperatures in Scenario 3 for the borehole heat exchanger.
As for the entire case study, Cluster 2 has the lowest values of LCOH. In Scenario 3, Whole field and Cluster 1 have the same LCOH, but they slightly differ in Scenario 2. The largest difference is in Scenario 5 where the LCOH of Cluster 1 exceeds the LCOH of Whole field since the calculation of LCOH counts for the overall investment cost of combined heat and power, and the revenue from the electricity generation is subtracted. The LCOE values are the lowest for Cluster 1 in both scenarios and for Scenario 4; for the subcases Whole field and Cluster 2, the LCOE is slightly lower in the latter subcase due to lower thermal efficiency. In Scenario 5, Cluster 2 has the highest LCOE due to lower electricity production quantities and the result of subtracting revenues from selling heat.
As for the net present value of the case study, the values range from −7.616 M€ for Scenario 5 up to −0.116 M€ for Scenario 3 in the Whole field subcase, from −6.351 M€ for Scenario 5 up to −0.116 M€ in Scenario 3 in the Cluster 1 subcase, and from −1.263 M€ in Scenario 4 to 0.063 M€ in Scenario 3 in sub-case Cluster 2. The negative values of the net present value are the result of the investment cost of the plant at the beginning of the project and the replacement cost of the production pumps in year 15 of the project duration. Another reason for the negative NPV values is the high operating costs of production pumps and injection pumps that depend upon the electricity market price and the running time of the facility. In general, the lowest net present value for all scenarios is the Whole field followed by Cluster 1 where the differences are manifested from the production pump investment and operational cost of the pumps, among other associated costs. Cluster 2 has higher net present values since it consists of only two production wells and one injection well. Scenario 3 for all subcases has the highest net present value since the investment consists of plant and well configuration costs. For subcase Cluster 2, Scenario 3 has a positive net present value since the revenue from the heat produced exceeds the investment costs.
In general, the heat production scenarios are more economically feasible than the electricity generation scenarios due to low production quantities of electricity. The greater heat production quantities cover the initial investment cost of the oil-to-water conversion, but pump replacement lowers the cumulative cash flow of each scenario, along with the operational cost of each pump.

Environmental Results
Although almost all the scenarios of subcases are not economically feasible, it is important to elaborate about their environmental footprint regarding the potentially produced CO 2 emissions. The CO 2 savings during the operational period are shown as the avoided CO 2 emission, which is substituted with the geothermal exploitation. The quantity of the avoided emissions is directly correlated with energy production, emission factors of each fossil fuel, and the share of fossil fuel type in the total share of fossil fuels. The latter two are the same for all scenarios performed; thus, the only influencing value is the energy produced. The avoided CO 2 emissions range from 49.94 to 2837.73 t of CO 2 eq/year for Whole field, from 49.64 to 2783.77 t of CO 2 eq/year for Cluster 1, and it ranges from 29.54 to 637.01 t of CO 2 eq/year for Cluster 2. It can be concluded that the highest production generates the greatest CO 2 savings, and it cannot stand alone as the output based on which decisions will be made.

Conclusions
The presented methodology and the demonstrated case study offer solutions for the conversion of mature or abandoned oil fields to a geothermal asset and, for this reason, extend the production life of the reservoir. The comprehensive methodology takes into account production technology, economic and environmental parameters, and, together with the presented two-stage clustering, provides various options for further converting petroleum to a geothermal facility while regulatory and policy aspects of such action are left with the knowledge of the user or potential investor, since this is highly country and project specific.
One of the main features of the conversion is bi-level clustering, which facilitates firstly clustering of the wells according to geothermal fluid temperature into a different end-use group, and secondly, clustering of the wells into spatial groups according to the distance between each well. This approach allows optimal conversion and usage of the cumulative production flow from the production wells, simultaneously minimizing the costs for piping infrastructure and power plant spatial positioning and avoiding the decommissioning and abandonment costs of an oil field. An extensive review of input parameters and calculated values such as wellhead temperature, geothermal water flow, specific heat capacity, and density of geothermal fluid produced a thorough background for creating the different scenarios for conversion.
The methodology was applied to the modelled Reservoir 1, which replicates the petroleum reservoir that could be found in reality, in order to evaluate the best conversion scenario for the Whole field or the given clusters for the modelled case study. The outputs indicate that the best scenarios for the oil-to-water conversion were heat production scenarios due to highest production and avoided CO 2 emission quantities, which are directly related. The calculated economic parameters, LCOE, LCOH, and NPV, indicate that the optimal scenario for conversion was Scenario 3 for performing the deep borehole heat exchanger in all three subcases due to its lowest investment and operating costs, followed by Scenario 2 where production and injection wells are used to generate heat. Temperature clustering enabled considering a greater number of wells in heat production calculation rather than in electricity generation scenarios that had influence on the cumulative flow and the temperature of the geothermal fluid. The clustered wells showed different outputs in each cluster, which considered pipeline costs due to spatial clustering, and since there were no newly added wells, the pipeline cost was reduced to a minimum.
The mentioned scenarios resulted in the different main outputs such as production quantities, levelized cost of electricity, levelized cost of heat, and net present value which served as the peculiar roadmap towards the optimal oil-to-water conversion. [