GEOPHIRES v2.0: updated geothermal techno-economic simulation tool

This paper presents a new version (v2.0) of the geothermal techno-economic simulation tool GEOPHIRES [GEOthermal energy for Production of Heat and electricity (“IR”) Economically Simulated]. GEOPHIRES combines reservoir, wellbore, and surface plant technical models with cost correlations and levelized cost models to estimate the capital and operation and maintenance costs, instantaneous and lifetime energy production, and overall levelized cost of energy of a geothermal plant. In addition to electricity generation, direct-use heat applications and combined heat and power or cogeneration can be modeled. Various upgrades have been implemented to develop GEOPHIRES v2.0, including: updating the built-in cost correlations, coupling to the external reservoir simulator TOUGH2, enhancing the built-in wellbore simulator, converting the programming language to Python, and making the code open-source. Users are encouraged to build upon the tool, e.g., by implementing their own correlations or coupling to other simulators. In this paper, we discuss the GEOPHIRES v2.0 objectives and history, and we present the software architecture as well as built-in models and correlations. We include two example simulations and quick-start guide on how to run a simulation.

The original version of GEOPHIRES (v1.0) was developed by one of the authors during the period 2012-2014 (Beckers et al. 2013. GEOPHIRES v1.0 was originally applied to assess the technical and economic performance of fracture-based enhanced geothermal systems (EGS) for electricity and direct-use heat applications. The capability to model matrix flow reservoirs was limited, and users could not alter the code to implement their own applications or couple to stand-alone models. To address these limitations, as well as to update the cost correlations, improve code readability, and add several new modeling features, a new version (v2.0) has been developed during the period 2017-2018. GEOPHIRES v2.0 is distributed as open-source under the permissive MIT license, i.e., others can build upon the framework for commercial and noncommercial purposes. A conference paper by Beckers and McCabe (2018) reported initial progress on the development of GEOPHIRES v2.0. This paper discusses in detail the overall model structure; built-in technical and cost correlations and sub-models; as well as options to couple to external simulators and implement user-provided code. We present two example simulations: the first one models a direct-use heat application with TOUGH2 (Transport of Unsaturated Groundwater and Heat v2) as an external reservoir simulator; the second example considers a hydrothermal reservoir for electricity production using an organic Rankine cycle (ORC) power plant.
Objective of GEOPHIRES v2.0 GEOPHIRES v2.0 has been designed to be a flexible, user-friendly, and robust computer tool for assessing technical and/or economic performance of a geothermal system with a wide possible level of simulation detail. By relying on built-in correlations and default values, a basic simulation can be performed with limited knowledge on subsurface, surface plant, and financing conditions. A more-experienced or knowledgeable user can perform a more in-depth analysis, e.g., by making use of the integration with the external reservoir simulator TOUGH2, or hard-coding in a specific surface plant application. The tool has built-in checks on each input parameter to ensure that the case modeled is realistic. A user guide and example cases are available to help a new user get familiar with the tool. Examples of cases that can be simulated with GEOPHIRES v2.0 are: investigating the payback period of a newly constructed geothermal power plant, sizing a geothermal district-heating system, assessing the impact of subsurface uncertainty (e.g., reservoir permeability, volume, and temperature) on overall geothermal plant performance, comparing different geothermal reservoir management strategies, estimating future electricity production using historical reservoir and plant operational data, and predicting the impact on future revenue of a system upgrade (e.g., drilling a new well or stimulating the reservoir).
Several analytical and numerical models have been developed to simulate specific components of a geothermal system (e.g., the reservoir or power plant); however, few tools exist that can perform an entire techno-economic simulation like GEOPHIRES. Advanced stand-alone reservoir simulators are plentiful, e.g., TOUGH2 (Pruess et al. 1999), FEFLOW (Diersch 2013), and CMG STARS (Computer Modeling Group Ltd 2007). These simulators can estimate the geothermal reservoir production temperature, but they need to be coupled to other models to calculate electricity production or investment cost. In GEOPHIRES, there are three different options for the reservoir

History of GEOPHIRES
The software tool GEOPHIRES has evolved out of previous research and models that date back to the Fenton Hill Hot Dry Rock (HDR) project at Los Alamos National Laboratory (Tester et al. 1979). The work in that project resulted in the techno-economic HDR model, which was presented in detail in "Heat Mining" by Armstead and Tester (1987). In the late 1980s, this model was updated to the MIT-HDR model (Tester and Herzog 1990), and in the 1990s, a Windows user interface was developed to make the tool more accessible to the geothermal community (Kitsou et al. 2000). That model became known as the MIT-EGS model and was used in the "Future of Geothermal Energy" study (Tester et al. 2006).
From 2012 to 2014, the MIT-EGS model was modified extensively by Beckers and other members of the Tester research group at Cornell University to develop GEOPHIRES v1.0. In addition to incorporating different end uses beyond electricity production (direct-use heat and cogeneration), the built-in capital and O&M cost correlations were updated and a new levelized cost model (standard discounted levelized cost model), reservoir model (percentage thermal drawdown model), and wellbore model (Ramey's heat transmission model) were implemented. Also, new heat-to-electricity conversion efficiency correlations for binary cycle (subcritical and supercritical) and flash (single and double) power plants were incorporated based on simulations in Aspen Plus (Tech Aspen 2009) and MATLAB (MathWorks 2012). GEOPHIRES v1.0 was introduced at the Stanford Geothermal Workshop (Beckers et al. 2013) and later described in detail in a journal article ) and dissertation (Beckers 2016). Various simulation examples are included in these papers. Other case studies using GEOPHIRES v1.0 include an analysis of the potential for deep geothermal district heating in New York and Pennsylvania (Reber et al. 2014) and at Cornell University , and an assessment of a hybrid geothermal-biomass cogeneration system for Cornell University . During the period 2017-2018, major upgrades were implemented to develop GEOPHIRES v2.0, with details and results presented in this paper. These upgrades include converting the source code from FORTRAN to Python, making the tool open-source, updating the cost correlations, enhancing the wellbore simulator, and directly coupling it to the external reservoir simulator TOUGH2.

Implementation
This section presents the GEOPHIRES software architecture, built-in correlations and models, and options for the user to integrate their own models. Additional information is provided in the user manual located in the GEOPHIRES GitHub project folder.

Software architecture
The GEOPHIRES software architecture is illustrated in Fig. 1. The green rectangles are GEOPHIRES model components, the orange rectangles refer to user interface components, and the blue rectangle refers to the external reservoir simulator TOUGH2. Rectangles with a solid outline are always executed during a simulation run; rectangles with a dashed outline refer to optional or user-provided components. When running a simulation, GEOPHIRES executes the following components in consecutive order: 1. Importing and validation of user-provided input data If a necessary parameter is missing, GEOPHIRES outputs a warning message and assumes a default value. Allowable value ranges for each parameter are included in the user manual. 2. Reservoir simulation GEOPHIRES calculates the production temperature over time either by using one of the built-in reservoir models, importing an external user-provided temperature data file, or by running the external reservoir simulator TOUGH2. 3. Wellbore simulation GEOPHIRES estimates the geofluid temperature change and the production and injection well pumping power. 4. Surface plant simulation GEOPHIRES calculates the amount of gross and net electricity and/or direct-use heat produced. 5. Cost calculations GEOPHIRES estimates the capital and annual O&M costs using built-in cost correlations or user-provided cost numbers. All costs in GEOPHIRES are expressed in US dollars ($). 6. Techno-economic metric calculation GEOPHIRES calculates as a default the technoeconomic metric LCOH or LCOE. The code can be modified easily to compute other metrics, e.g., payback time, net present value (NPV), and internal rate of return (IRR). All economic results in GEOPHIRES are expressed in US dollars ($) or cents (¢). 7. Printing of results and messages GEOPHIRES prints calculation results and warning and error messages to the console and a text file.
The GEOPHIRES input and output text files are self-explanatory, meaning that no other user interface tool is needed. However, users can provide their own user interface or master file, for example, to automate running batches of simulations or to visualize GEOPHIRES results.

End-use options
Five different end-use options are available in GEOPHIRES: 1. Electricity All produced geothermal fluid is used to generate electricity with either an ORC or flash power plant. 2. Direct-use heat All produced geothermal fluid is used to provide heating for a given application, e.g., a district-heating system or industrial process. 3. Cogeneration or combined heat and power (CHP) Both heat and electricity are produced. Three different cogeneration configurations are available: a.
Cogeneration topping cycle A power plant is followed by a direct-use heat application in series. Heat at high temperatures from the geothermal fluid is first converted into electricity. Any remaining heat in the geothermal fluid after leaving the power plant is supplied to a low-temperature direct-use heat application. b. Cogeneration bottoming cycle A direct-use heat application is followed by a power plant in series. In this less common configuration, the geothermal fluid first serves a high-temperature direct-use heat application. Any remaining heat in the geothermal fluid after leaving the direct-use heat process (at a user-specified temperature) is used to generate electricity. The heat-to-power conversion typically occurs with an ORC plant operating at low conversion efficiencies.

c.
Cogeneration parallel cycle A power plant operates in parallel with a direct-use heat application. The produced geothermal fluid is split into two streams, providing heat at the same temperature to a power plant and direct-use heat application. The user specifies the fluid flow fraction going to each process.

Geofluid
The built-in fluid property correlations in GEOPHIRES for density, heat capacity, viscosity and vapor pressure are for pure water. However, these fluid property correlations are separate Python function in the open-source GEOPHIRES code which can easily be modified by the user for a different fluid, e.g., brine.

Reservoir models
Six reservoir models are available in GEOPHIRES to calculate the transient reservoir production temperature: (1) multiple parallel fractures model, (2) 1-dimensional linear heat sweep model, (3) m/A thermal drawdown parameter model, (4) percentage temperature drawdown model, (5) generic user-provided temperature profile, and (6) TOUGH2 reservoir simulator. The user specifies the reservoir model in the input file, and validation of relevant parameters is then performed to ensure compatibility of the selected model with the specified parameters. The output of the reservoir simulation component is a production temperature profile over the life of the project. The first model-the Multiple Parallel Fractures Model (Gringarten et al. 1975)-is based on a linear model in which the reservoir is represented by an infinite series of parallel, equidistant, vertical fractures of uniform thickness. Due to the fracture-dominated nature of this model, it is intended primarily for EGS applications. In this model, heat transport occurs through thermal convection with 1-D water flow in the fractures and thermal conduction within the homogeneous, isotropic, and impermeable rock. The governing equations for the temperature of the rock and water in time and space are specified and solved in the Laplace domain and numerically converted back into the time domain. The dimensionless water temperature T WD (°C) is defined as: with T W ,D the water temperature (°C), T R,0 the initial reservoir temperature (°C), and T W ,inlet the water temperature at the reservoir inlet (°C). The full equation for the dimensionless temperature in Laplace space is given in Equation A17 in Gringarten et al. (1975). The model in GEOPHIRES is simplified by assuming that the temperature in the reservoir-and therefore, at the top and bottom of the fracture-is constant. With the simplification, the geothermal gradient is zero and the equation specifying the dimensionless water temperature in the Laplace space T W ,D is given as: (1) where s is the Laplace variable (s −1 ), ρ W is the density of the water (kg m −3 ), c W is the specific heat capacity of the water (J kg −1 K −1 ), Q is the volumetric flow rate per fracture per unit depth of the fracture (m 2 s −1 ), x is the half-width fracture separation (m), k r is the rock thermal conductivity (W m −1 K −1 ), and H is the height of the fractures (m). In GEOPHIRES v2.0, the conversion of this equation in Laplace space to the time domain is performed using the mpmath library (Johansson 2017). The second model-the 1-Dimensional Linear Heat Sweep Model (Hunsbedt et al. 1984)-also focuses on modeling fractured geothermal reservoirs and therefore may be best suited for EGS applications. The model assumes that the reservoir can be represented as a porous medium with fluid surrounding blocks of rock characterized by a lumped effective rock radius. Heat transport in this model occurs through 1-D linear heat sweep of water through the reservoir. The dimensionless water temperature is defined as: The full equation for the dimensionless temperature in Laplace space is given in Eqs. 2-7a in Hunsbedt et al. (1984). This model in GEOPHIRES is simplified by setting the recharge temperature parameter to − ∞ (which specifies the fluid temperature at the reservoir inlet to remain constant over the lifetime instead of slowly increasing due to injection wellbore heat gains) and the external heat transfer parameter to zero (which specifies zero heat flux at the reservoir boundary). Both assumptions reflect a conservative modeling approach and are recommended by Hunsbedt et al. (1984) for unknown reservoir conditions. Thus, the equation specifying dimensionless temperature at the production well is given as: where NTU and γ are the number of heat transfer units and the heat storage ratio, respectively. They are given as: and In these equations, φ is the rock porosity (-), ρ r is the rock density (kg m −3 ), c r is the rock specific heat capacity (J kg −1 K −1 ), t res is the residence time of water in the reservoir (s), and τ ef,r is the effective rock time constant (s), which is calculated as: In this equation, r ef,r is the effective rock radius representing the entire collection of rock blocks (m), α r is the rock thermal diffusivity (m 2 s −1 ), and Bi is the Biot number (-). The value 0.2 represents the typical ratio of conduction path length to r ef,r for spherical shapes (Hunsbedt et al. 1984). The effective rock radius and the Biot number are calculated as: and with V being the mean volume of the rock block (m 3 ) and h being the rock surface heat transfer coefficient (W m −2 K −1 ). The factor 0.83 in Eq. (9) is the Kuo sphericity and represents the typical mean sphericity of a distribution of irregularly shaped rock blocks found in geothermal reservoirs (Hunsbedt et al. 1984). More information on default/ assumed values for various parameters, including the heat transfer coefficient (h), was provided by Beckers (2016).
The third model-the m/A Thermal Drawdown Parameter Model-is discussed in detail by Armstead and Tester (1987). This model represents the reservoir as a single rectangular fracture of specified area with a uniform flow of fluid passing over the fracture surface. The mass loading parameter (m/A) is defined as the mass flow rate per unit area of a single side of the fracture (kg s −1 m −2 ) and is provided by the user, along with other rock properties. The dimensionless temperature is defined and calculated as: where erf is the error function and t is the time in seconds.
The fourth model-the Percentage Temperature Drawdown Model-expresses the thermal drawdown as a percentage temperature decrease per year. Previous iterations of this reservoir model used an exponential decline to model the drawdown over time. However, results from Snyder et al. (2017a) demonstrate that a linear decline with an annual temperature drop based on the percentage of the initial production temperature may fit measured production data more closely. Thus, the dimensionless temperature is defined and calculated as: where p is the percentage temperature decrease in units of years −1 and t is the time in years.
The fifth model-the Generic User-Provided Temperature Profile-allows the user to specify and import a generic reservoir production temperature profile, with temperature data from an external simulation tool or measured data from an operating geothermal plant. The format for providing a generic temperature profile is via column vectors in a text file. An example case study using this reservoir model is included in the GEOPHIRES GitHub folder (example 2). The sixth and final reservoir model-the TOUGH2 Geothermal Reservoir Simulatoris for nonisothermal multiphase flow in fractured porous media (Pruess et al. 1999). Its capabilities allow GEOPHIRES users a diverse set of options for modeling many types of subsurface conditions, including both matrix-dominated flow and/or fracture-dominated flow. In this GEOPHIRES reservoir model, the user either provides an external input file or uses a default input file and the TOUGH2 reservoir simulator is called within the Python code. The default input file is used when the user explicitly declares it or when the program is unable to find the user-specified input file in the working directory. The default model is a simple doublet case using a rectilinear permeable matrix reservoir structure and a single production and a single injection well. The production temperatures are taken directly from the TOUGH2 output files and processed to be compatible with the GEOPHIRES workflow. The user needs to have a license and executable for TOUGH2 to use this reservoir model.
The reservoir pressure drop is calculated by specifying an overall reservoir impedance, or productivity and injectivity index. When specifying a productivity and injectivity index, a reservoir hydrostatic pressure is either provided by the user or calculated using the built-in modified Xie-Bloomfield-Shook equation (DOE 2016). The reservoir pressure drop is combined with the wellbore pressure drop to estimate the pumping power, as discussed in "Wellbore model" section. While currently not implemented in GEOPHIRES, a third option to account for the reservoir pressure drop would be to directly import the pressure data from a TOUGH2 simulation.

Wellbore model
To account for production wellbore heat losses, the user can either specify a constant geofluid temperature drop or apply the built-in transient Ramey's Wellbore Heat Transmission model (Ramey 1962) to estimate the geofluid temperature drop over time. Ramey's model calculates the geofluid temperature drop in the production wells, T prod , using the following equation: with T r,0 as the initial rock temperature at the bottom of the well (°C), T w as the geofluid temperature at the bottom of the well (°C), ω as the average geothermal gradient (°C m −1 ), and L as the depth of the reservoir (m), equal to the length of the well assuming vertical wells. The parameter Γ is calculated assuming that the thermal resistances of the casing and cement are negligible: with m prod as the production wellbore flow rate (kg s −1 ) and f (t) as the time function for a line heat source given by: In this time function equation, d cas is the outer diameter of the casing (m). The time t is the cumulative time that the well has been producing, i.e., by accounting for the utilization factor. Ramey's model assumes the produced fluid is an incompressible, singlephase liquid with constant specific heat capacity. To calculate transient wellbore heat transmission for compressible or two-phase fluids, or to account for temperature and pressure dependency of fluid properties, a more advanced wellbore simulator should be implemented. To account for heat transmission in the injection wells, the user can specify a constant temperature gain. Ramey's model has not been implemented for the injection wells because the built-in reservoir models (1 to 4) require a constant reservoir inlet temperature.
The injection and production well pumping power is estimated in GEOPHIRES by calculating the frictional and hydrostatic pressure drop in the well and the reservoir pressure drop. When the user opts to specify an overall reservoir impedance, the production and injection wells are assumed to be in hydraulic communication, the geofluid operates in a closed loop, and no flashing is allowed in the production wells or at the surface. In this case, the same approach for calculating the total pressure drop and pumping power is followed as in GEOPHIRES v1.0 (Beckers 2016). When specifying a productivity and injectivity index, the production and injection wells are treated individually following the same approach as GETEM (DOE 2016). The production wellhead pressure is provided by the user or set to 344.7 kPa (50 psi) above the water vapor pressure at production temperature (DOE 2016). When simulating a flash power plant, pumping of injection wells is considered but not of production wells, because the produced fluid is generally in two-phase flow. For ORC plants and direct-use heat applications, pumping of both injection and production wells is the default. Line-shaft pumps are considered for pumping of production wells with the necessary depth to prevent cavitation calculated by GEOPHIRES. A warning message is issued if this calculated depth is greater than 600 m.
GEOPHIRES calculates at each time step the frictional pressure drop in each well ( P well,fr ) using the Darcy-Weisbach equation (Fox et al. 2004): with f as the Darcy friction factor (−), ρ w,well as the temperature-averaged density of the water in each well (kg m −3 ), v as the average water velocity in the well (m s −1 ), and d well as the wellbore diameter (m). For turbulent flow, the Darcy friction factor is calculated using the Colebrook-White equation (Fox et al. 2004): Re f , with e as the wellbore pipe surface roughness (default set to 0.0001 m) and Re as the Reynolds Number for flow in the wellbore (). The hydrostatic pressure in each well P well,hydro is calculated as follows: with g as the gravitational acceleration (9.81 m s −2 ). The difference in water density between production and injection well can cause a significant buoyancy effect that offsets some of the required pumping power. The water temperature profile along the well due to wellbore heat transmission causes a density profile along the wellbore. However, simulations using Ramey's model show that, after a few months of operation, the water temperature difference between top and bottom of each well is typically less than 10 °C resulting in a density difference of only a few percent. This justifies considering a temperature-averaged water density for each well. The built-in Ramey and frictional pressure drop models assume that all wells are vertical and of equal depth. In addition, all injection and production wells are assumed to have the same injection and production wellbore diameter, and the same injection and production fluid flow rate, respectively. The code can easily be modified to account for deviated and horizontal wells, as well as different diameters, depths, and flow rates for different wells. In case of non-vertical wells, the user should specify for each well the total vertical depth (TVD) along with a measured depth (MD). The bottom-hole temperature and hydrostatic pressure is calculated based on the TVD; frictional pressure drop loses and wellbore costs are based on the MD. The Ramey model should be deactivated for non-vertical wells, because that model is only valid for vertical wellbore geometry. Instead, a constant production wellbore temperature drop can be specified by the user to capture production wellbore heat losses. In case of wells with different diameters, depths, and/or flow rates, the user should calculate the frictional pressure drop, hydrostatic pressure, wellbore heat transfer, and well cost for each well individually and store the results in arrays. Pumping requirements should be evaluated for each well individually. The average production temperature can be calculated by lumping together the produced fluid from each well. The total well cost is calculated by adding up the well cost for each well.

Surface plant
If electricity is selected as the end-use product, then GEOPHIRES calculates the power production P (MW e ) by multiplying the utilization efficiency of the power plant η u with the exergy of the produced geothermal fluid B: The exergy is calculated based on the specific enthalpy h (J kg −1 ) and specific entropy s (J kg −1 K −1 ) of the geothermal fluid at the production (prod) and ambient conditions (0): with m tot as the total mass flow rate produced (kg s −1 ) and T 0 as the ambient temperature (K). GEOPHIRES has a built-in approximate correlation for calculating B for pure water. Alternatively, steam tables or user-provided correlations can be used. Correlations for the utilization efficiency as a function of geothermal fluid production and ambient (18) �P well,hydro = ρ w,well gL (Pa), temperature were developed using power plant models in Aspen Plus and MATLAB for sub-and supercritical ORC and single-and double-flash power plants (Beckers 2016). The correlations are shown in Fig. 2 and have been implemented in GEOPHIRES. When selecting electricity or cogeneration as end-use, the user chooses as input one of these 4 power plant types. The ORCs are single-pressure, have air-cooled condensers, and a recuperator is included. No superheating is assumed in the subcritical cycle. Twentyfive refrigerants were evaluated and listed by Beckers (2016). The ORC correlations in Fig. 2 assume at each geofluid temperature, the refrigerant that maximizes the utilization efficiency is selected. For ambient temperatures different than 5 °C, 15 °C, or 25 °C, the utilization efficiency is linearly inter-or extrapolated. Explicit equations and a more detailed discussion on power plant specifications were provided by Beckers (2016). Correlations for the geothermal fluid temperature leaving the power plant were also developed and are incorporated in GEOPHIRES (Beckers 2016). These correlations are used in cogeneration mode with a topping cycle to estimate the geothermal fluid temperature available for a direct-use heat application. GEOPHIRES does not consider scaling (or mineral precipitation); however, scaling may put constraints on plant operating conditions, especially for hydrothermal reservoirs. For example, scaling of silica, caused by a decrease in geothermal fluid temperature, may put a lower limit on the injection temperature or require installing a chemical scale inhibitor system.
Various geothermal direct-use heat applications are possible, e.g., space and water heating, greenhouses, aquaculture, and industrial heat uses. GEOPHIRES does not have built-in correlations for these various applications to estimate plant performance and re-injection temperature as a function of production temperature, time of the day and year, etc. Rather, GEOPHIRES allows users to specify a utilization factor and thermal efficiency factor of the direct-use heat application, suitable for simple calculations. For more advanced representation of the surface plant, users are encouraged to implement their own correlations obtained, for example, from direct measurements or advanced process modeling simulations.

Cost correlations (capital and O&M)
The method in GEOPHIRES to estimate capital cost is based on the following: (1) capital cost consists of costs for exploration, drilling, surface plant, field gathering system, and reservoir stimulation, (2) built-in cost correlations incorporate indirect costs and contingency, (3) cost of financing is accounted for by the levelized cost model, and (4) capital cost escalation and debt on interest during construction is captured by a lumped capital cost multiplier. This method is similar to the method applied in the 2006 Future of Geothermal Energy Report (Tester et al. 2006) and the 1990 Heat Mining Report (Tester and Herzog 1990). The capital cost ( C cap ) is calculated as follows: with C wells , C stim , C gath , C plant , and C expl as the total well cost, reservoir stimulation cost, field gathering system cost, surface plant cost, and exploration cost, respectively. GEOPHIRES has built-in correlations for each of these capital cost terms. Users can use these correlations directly, multiply them by a factor, or provide their own cost figures. The built-in capital cost correlations are as follows: • The total well cost ( C wells ) is calculated as the cost per well multiplied by the userprovided number of production and injection wells. GEOPHIRES considers all wells to have the same depth; however, this assumption can easily be modified to account for various well depths. Four correlations are implemented to estimate the drilling and completion cost per well based on the work by Lowry et al. (2017). These correlations include 15% contingency and 5% for indirect costs (project management and engineering costs) (DOE 2016). These correlations are for small well diameter  Fig. 3. Correlation 4 falls within 10% of both the large diameter well cost correlation implemented in GETEM (DOE 2016) and the geothermal well cost correlation developed by Lukawski et al. (2014). Correlation 2 follows closely (within 10%) the small diameter well cost correlation in GETEM. GEOPHIRES assumes as default a 100% well drilling success rate, which may overstate actual field drilling success rates. Sanyal and Morrow (2012) found an average success rate of 71%, based on drilling and production data in 52 geothermal fields. GETEM assumes as default a 75% drilling success rate for hydrothermal development wells and 90% drilling success rate for EGS development wells. To account for failed wells in GEOPHIRES, the user can assign a drilling cost multiplier (e.g., a multiplier of 2 for a 50% drilling success rate). • The built-in cost correlation for stimulating EGS-type reservoirs ( C stim ) is $1.25 M per injection well (Beckers and Young 2017) plus 15% contingency and 5% for indirect costs (DOE 2016). For traditional hydrothermal reservoirs, this cost parameter is set to $0. • The built-in cost correlation for estimating the field gathering system cost ( C gath ) follows the same approach as GETEM (DOE 2016). C gath includes the cost for surface piping from each well to the plant and pumps for production and injection wells. The length of the surface piping is assumed 750 m per well at a cost of $500 per meter (DOE 2016). The pumping cost for each pump in the production wells (line-shaft pumps) and a single pump for the injection wells is calculated with the same correlation as GETEM (DOE 2016). An additional 15% is added for contingency and 12% for indirect costs (DOE 2016). C gath does not include the cost of pipelines to an off-site heat user or a district-heating system. These costs are estimated at $750 per meter pipeline length  and can be manually added by the user to the pipeline distribution costs.  Verkís (2014). Figure 4 shows the power plant capital cost expressed in $ kW e −1 as a function of plant size and initial production temperature for subcritical ORC and double-flash power plants. The correlations in GEOPHIRES include 12% for indirect costs and 15% contingency. For the same plant size and production temperature, double-flash power plants are considered about 25% more expensive than single-flash power plants (Zeyghami 2010), and supercritical ORC plants are roughly 10% more than subcritical ORC plants (Astolfi et al. 2014). A wide range in power plant specific cost values is reported in academic and popular literature. The GEOPHIRES built-in surface plant cost correlations represent typical values. However, the user is recommended to provide their own power plant cost data if available for their case study. The ORC plant specific cost decreases only moderately at higher temperatures. The reasons are that when increasing the temperature, the ORC plant design also changes: (1) a different organic fluid is selected, (2) piping, pump, heat exchangers, and other equipment are designed to handle the higher temperature (and potentially also pressure), requiring thicker walls, potentially different materials, etc., and (3) additional components may be implemented, such as a heat recuperator, making the design and operation more complex. Unlike flash power plants, ORC plants are a small, niche market, typically case specific, and rely on relatively young technology, which has not been subject yet to decades of technological advancement.
The cost for direct-use heat applications is highly dependent on the type of application. A generic cost of $250 kW th −1 plus 15% contingency and 12% indirect costs is assumed in GEOPHIRES. However, users are encouraged to provide their own cost figures for their specific application. Beckers and Young (2017) collected several cost figures to estimate the surface equipment cost for geothermal district-heating systems. • The built-in exploration cost correlation ( C expl ) considers drilling of a slim-hole well at 60% of the cost of a regular well, $1 M for geophysical and field work, an additional 12% on the total cost for technical and office support (indirect costs) and 15% for contingency (Beckers 2016).
This capital cost method is comparable to the method in GETEM with a few simplifications. GETEM considers a more detailed exploration, development and construction scheme where capital costs can be distributed over different years, and different discount rates can be assigned to different years. In GEOPHIRES, we consider the capital costs occur overnight and a lumped capital cost multiplier is available to capture effects such as capital cost escalation and debt on interest during construction. Further, unlike GETEM, GEOPHIRES does not consider capital costs for leasing, permitting and transmission lines. However, they could be manually added by the user as an additional capital cost term. While GEOPHIRES v1.0 only considered 15% contingency on drilling costs, all capital cost terms in GEOPHIRES v2.0 now consider 15% to align with more standard practices (as in GETEM). Similar to GETEM, no process contingency is considered in GEOPHIRES v2.0. However, if deemed applicable to a project, the user can manually account for process contingency by assigning a multiplier to the capital cost correlations (e.g., 1.2 for 20% process contingency).   with C O&M, plant , C O&M,wells , C O&M,water , and C O&M, pump as the annual surface plant, wellfield, make-up water, and pumping O&M costs.
• GEOPHIRES estimates the annual surface plant O&M costs ( C O&M,plant ) as the sum of 1.5% of the total plant capital cost (for annual non-labor costs), and 75% of the annual labor costs, which is an approach similar to GETEM and GEOPHIRES v1.0 (Beckers 2016). The other 25% of the labor costs are assigned to the wellfield O&M cost. The labor costs are calculated internally in GEOPHIRES using the 2014 labor costs provided by Beckers (2016), indexed to 2017 using the Bureau of Labor Statistics (BLS) Employment Cost Index for utilities (BLS 2018). The original 2014 labor cost correlation expresses the labor costs as M$ year −1 as a function of the plant size (MW) using an approximate logarithmic curve fit to the built-in labor cost data in GETEM (Beckers 2016). • The built-in correlation for the wellfield O&M costs ( C O&M,wells ) is similar as the surface plant O&M costs: it assumes that C O&M,wells consists of 1% of the total well plus field gathering system costs (for annual non-labor costs) and 25% of the labor costs (the other 75% of the labor cost were assigned to the surface plant O&M cost). • To account for loss of water in the reservoir (especially in the case of EGS-type reservoirs), the user can provide a water loss rate. GEOPHIRES estimates the annual costs to buy make-up water ( C O&M,water ) using a water price of $3.5/1000 gallons. • If the end-use option is direct-use heat only, then electricity is purchased at a userprovided electricity rate to power the geothermal fluid circulation pumps ( C O&M,pump ).
In the case of electricity-only or cogeneration mode, the pumping power is considered auxiliary power and subtracted from the gross electricity generation.

Levelized cost models
with C cap as the total upfront capital investment (M$) and C O&M as the average annual O&M cost (M$ year −1 ; including cost for pumping power in direct-use heat mode). The parameter R is used in the CHP mode and represents the average annual income from the secondary product (M$ year −1 ), e.g., if electricity is the main product, then the levelized cost is calculated in LCOE, and R is the secondary revenue from selling heat. The parameter E is the average annual net amount of electricity or heat produced (kWh or MMBtu). The FCR is a user-provided parameter and represents the fraction of total capital cost that must be paid each year (i.e., annuity) to pay off the total investment. It is based on the uniform capital recovery factor (UCRF), which depends on lifetime and discount rate, and tax rates, tax credits, insurance costs, depreciation, etc. (Short et al. 1995). Either a nominal levelized cost (current dollar analysis) or real levelized cost (constant dollar or "price year" dollar analysis) is calculated depending on whether the UCRF is based on a nominal or real discount rate (Short et al. 1995). Real discount rates exclude inflation whereas nominal discount rates include inflation.
The Standard Levelized Cost model discounts future revenue and expenditures to today's dollars and calculates the levelized cost using the following equation (OECD/IEA 2015): with d as the real discount rate (−), LT as the plant lifetime (years), and C O&M,t , E t , and R t as the O&M cost (M$ year −1 ), energy production (kWh or MMBtu), and secondary CHP revenue stream (M$ year −1 ), in year t , respectively. In Eq. (24), C O&M,t and R t are not corrected for inflation; therefore, d is the real discount rate, and the levelized cost is calculated in constant dollars (Short et al. 1995). Alternatively, with a nominal discount rate in the denominator, the levelized cost is calculated in current dollars and accounts for inflation (Short et al. 1995). No taxes are considered in this levelized cost model.
The BICYCLE Levelized Life Cycle Cost model was developed at Los Alamos National Laboratory (Hardie 1981) and is the most detailed built-in levelized cost model in GEOPHIRES. It allows for accounting for variable debt/equity return rates, various tax rates (i.e., income, revenue, and property), and an investment tax credit (a tax credit as a percentage of the capital cost that is deducted from the income tax liability in the first year). All BICYCLE model equations implemented in GEOPHIRES were presented by Beckers (2016). The built-in version of the BICYCLE model requires as input the inflation rate and nominal discount rates (on equity and debt), and returns as output the real levelized cost in 2017 constant dollars. The BICYCLE model assumes linear depreciation of the invested capital over the plant lifetime with no salvage value.
All built-in cost correlations were either developed for 2017 constant dollars ($2017) or indexed from a previous year to $2017; therefore, the levelized cost results have the year 2017 as base year. Unlike for example GETEM, no cost index curves (e.g., for labor, wells, pumps, etc.) have been built-into convert the results into a different year. However, the user can either manually enter costs for a different year or implement their cost index correlations directly into the GEOPHIRES code.
(24) Time stepping GEOPHIRES assumes linear time discretization with a user-provided number of time steps per year over the lifetime of the plant. The default is four time steps per year, meaning a time step of 3 months. At every time step, GEOPHIRES calculates the reservoir output temperature, production wellhead temperature, direct-use heat and/or electricity power output (in MW), pressure drops and pumping power. On an annual basis, GEOPHIRES calculates the O&M costs and direct-use heat and/or electricity production (in GWh year −1 ). To investigate seasonal effects, e.g., to assess the impact of more geothermal heat demand for district heating in winter than in summer, the user can select a smaller time step, e.g., a month (or 12 time steps per year). For even shorter timescale effects, e.g., to account for an hourly varying ambient temperature or investigate the response in plant operation to a fluctuating revenue rate), the user can select an even smaller time step, e.g., 1 h (or 8760 time steps per year).

Open-source framework
In contrast to GEOPHIRES v1.0, the source code of GEOPHIRES v2.0 is made opensource under the MIT license. Users can (and are encouraged to) improve and expand upon the GEOPHIRES code by, for example: (1) adding new model features that are not built-in (e.g., optimization or Monte Carlo routine), (2) implementing their own models and correlations (e.g., to simulate a specific direct-use heat application), or (3) coupling to other simulators (e.g., IPSEPro to simulate the surface plant).
The GEOPHIRES source code has been converted from FORTRAN (in v1.0) to Python (in v2.0). The reasons for this conversion are numerous: (1) the original FORTRAN code had poor readability, was prone to bugs, and was difficult to modify due to having many GOTO statements ("spaghetti code"), ill-defined parameters, and global variables; (2) Python has a more active user community, is very well documented, and is supported by robust and not-for-profit compilers; and (3) Python has several built-in libraries such as numpy and mpmath that make certain algorithms and calculations straightforward (e.g., inverse Laplace transform for calculating produced temperature with multiple parallel fractures reservoir model).

Discussion
This section provides more information on how to use the tool by presenting a quickstart guide, discussing the user interface, and providing two example simulations. A discussion on planned future work is also included.

Quick-start guide
The following steps guide new users through the process of running their first simulation with GEOPHIRES v2.0:

Download and install Python If not already installed, the user should download
Python and the necessary libraries (math, datetime, numpy, time, os, sys) from http://www.pytho n.org and install on the computer. If unsure whether Python is already installed, typing "python" in a command window will return the Python version if installed. GEOPHIRES v2.0 has successfully been tested on Python 2.7 and 3.5.

Download and install advanced text editor or integrated development environment (optional)
A simple text editor (e.g., Notepad for Windows) is sufficient to modify python code. However, a more sophisticated text editor (e.g., Sublime Text) or integrated development environment (e.g., Spyder) facilitates writing and modifying Python code by providing functionalities such as automatic code completion, installing missing libraries, debugging, and even compiling. 3. Download GEOPHIRES v2.0 files The user should download the GEOPHIRES v2.0 files from the GEOPHIRES folder on GitHub. These files include the source code (GEOPHIRESv2.py), example input text files, and an example user-provided reservoir output temperature profile (ReservoirOutput.txt). These files should be located in the same folder. 4. Download TOUGH2 (optional) If the user would like to use the coupling with TOUGH2 (reservoir option 6), then a TOUGH2 executable should be provided in the GEOPHIRES folder. Downloading and running a TOUGH reservoir simulator requires the purchase of a license from Lawrence Berkeley National Laboratory (LBNL). 5. Run example file The user should run the included example files to get familiar with the input format and calculated output results. The various example files consider different reservoir and surface plant conditions and apply different GEOPHIRES built-in technical and levelized cost models. More information on the different example problems is included in the user manual. 6. Review user manual The user is recommended to review the GEOPHIRES v2.0 user manual, which provides additional information on the included example problems, the format required to enter input values, and a list of all input parameters with values. This information helps the user to set up a new input text file or modify an existing example input text file, and run the simulation correctly. The user manual is included in the GEOPHIRES GitHub folder.

User interface
Input parameters are specified in GEOPHIRES v2.0 using an input text file (see example in Fig. 5). Comments are allowed, input parameters names are unambiguous, and no specific order of input parameters is required. If a necessary parameter is missing or a provided parameter value seems incorrect, GEOPHIRES will print a warning message to the console and assume a default value. Users can easily set up a correct input text file for their application by reviewing the user manual, which lists the available input parameters and corresponding units and range of allowable values, and then modifying any of the example input text files. For running batches of simulations, users can generate input text files from a master script or can bypass the input text files altogether by providing the input parameter values directly in the GEOPHIRES python code. Simulation results are printed to the console and to a structured output text file.

Example simulations
Two example simulations are included to provide validation for the tool and give new and prospective users a sense of which input parameters are needed, what level of detail is considered, and what type of output results are calculated. The first example case study (see Table 1) considers a generic industrial direct-use heat application operating at relative high utilization factors (90%) using heat extracted from a sedimentary matrix-permeable geothermal reservoir at 2000 m depth and initial temperature of 120 °C. With a surface temperature of 15 °C, this reservoir depth and temperature corresponds to an average geothermal gradient of 52.5 °C. The well configuration is a doublet system with one vertical injection and one vertical production well. The geofluid is assumed to be pure water and is re-injected at a constant temperature of 80 °C. Typical reservoir dimensions and geological and physical properties are considered. No reservoir stimulation is applied. The coupled reservoir simulator TOUGH2 simulates the transient reservoir output temperature. Production wellbore heat losses are estimated using the built-in Ramey's model. Pumping requirements are estimated by assuming a typical productivity and injectivity index of 5 kg s −1 bar −1 . The LCOH is estimated with the BICYCLE model. A surface plant total capital cost of $5 M is specified for surface plant equipment direct cost (e.g., cost of heat exchanger and plant building) and project indirect cost (engineering and procurement). All other capital and O&M costs are calculated using the built-in correlations. Other economic input parameters (i.e., project lifetime, inflation rate, interest rates, bond/equity financing fraction, tax rates, and pumping power electricity rate) are based on previous case studies conducted by Tester et al. (2006) and Beckers (2016), as well as parameters used in the Geothermal Vision Study .
The simulated reservoir output and wellhead production temperatures, and the constant wellhead injection temperature over the lifetime of the plant are plotted in Fig. 6 Fig. 6 Reservoir output temperature (from TOUGH2), wellhead production temperature (using Ramey's model), and reservoir wellhead injection (user-specified constant) for example simulation 1 values for geothermal district-heating facilities are about 5 MWth in the United States (Snyder et al. 2017b) and about 18 MW th in Europe (EGEC 2016). Validating the LCOH is more complicated because the levelized cost of a direct-use heat site depends heavily on the type of end-use application, the amount of surface infrastructure necessary, and the economic parameters (such as discount rate) assumed. For example, a residential district-heating system requiring a large surface piping network and only operating for 50% of the time (i.e., winter) would have a significantly higher LCOH than a single industrial plant located near the wellhead using the heat year-round. Nevertheless, rough comparisons can be drawn. ; Dumas and Angelino 2015). This is expected because a surface piping network (which is not considered in this example simulation) increases the LCOH by roughly 10% to 40% (Reber 2013). Lower utilization factors for district heating (compared to the 90% in this example) would also increase the LCOH. A more comparable analysis was done with GEOPHIRES v1.0 by Beckers (2016), who estimated the LCOH for EGS industrial direct-use heat applications in the range of $14 to $28 MWh th −1 , depending on the technology level assumed. The LCOH in this example is on the high end of this range, as expected, because Beckers (2016) assumed a lower re-injection temperature of 50 °C (vs. 80 °C), a lower discount rate of 7% (vs. 8.8%), and a lower surface plant equipment cost of $150 kW th −1 (vs. $625 kW th −1 ). Example simulation 2 represents a hydrothermal reservoir at 175 °C and 2000 m depth, coupled to an ORC power plant for electricity generation. The thermal drawdown is linear at a rate of 0.5% year −1 (Snyder et al. 2017a). No seasonal ambient temperature changes are considered. The productivity and injectivity index are assumed constant at 5 kg s −1 bar −1 . The built-in cost correlations are applied for estimating all capital and O&M costs. The LCOE is calculated using the FCR model with 10.8% discount rate. All input parameters are listed in Table 3.
Main GEOPHIRES simulation results are presented in Table 4. Because of a small wellfield (only three production and three injection wells), the power plant output is rather small (average net electricity production of only 12.4 MW e ). Comparing with LCOE values reported in literature is not trivial, because different studies consider different Other case studies providing additional validation by comparing GEOPHIRES output with GETEM results and published levelized cost values were provided by Beckers et al. (2013) and Beckers (2016) for GEOPHIRES v1.0 and Beckers and McCabe (2018) for GEOPHIRES v2.0.

Future work
Planned future work for GEOPHIRES 2.0 includes implementing several enhanced simulating capabilities and running additional example cases. One of the planned enhancements is incorporating high-performance computing (HPC) capabilities. This would facilitate handling computationally intensive subsurface calculations and performing large batches of simulations, e.g., for Monte Carlo analyses or sensitivity studies. Some of the additional case studies planned are direct-use heat applications such as district heating, greenhouses, and industrial uses. These and other efforts and results will be documented in future publications. In addition, we hope that other researchers will take advantage of the open-source nature of GEOPHIRES v2.0 to incorporate their own models and correlations, and subsequently will make their results publicly available to benefit the wider geothermal community.

Conclusions
This paper presented the new version (v2.0) of the geothermal techno-economic simulation tool GEOPHIRES. Software architecture, built-in model equations and cost correlations, a quick-start guide, and two example case studies were provided. GEOPHIRES v2.0 combines built-in cost correlations and levelized cost models with reservoir, wellbore, and surface plant, technical models to assess the technical and economic performance of a geothermal plant. Simulation outputs include the installed capacity, lifetime electricity and/or heat production, upfront investment costs, and LCOE and/or LCOH. Major upgrades in v2.0 are updated cost correlations, more user flexibility in wellfield configuration and time stepping, an enhanced wellbore simulator, the option to import external reservoir output data (e.g., from measurements), direct coupling to the standalone reservoir simulator TOUGH2, and conversion of the source code from FORTRAN to Python. Unlike other geothermal techno-economic tools, GEOPHIRES can handle various end-uses (i.e., electricity generation, direct-use heat, and cogeneration of heat and electricity). In addition, the source code is publicly available in the GEOPHIRES GitHub folder, providing transparency and allowing users to modify the tool for their own purposes (e.g., to implement a specific direct-use heat application).

Availability and requirements
• Project name: GEOPHIRES • Project home page: e.g., https ://githu b.com/kfbec kers/GEOPH IRES • Operating system: Platform-independent • Programming language: Python 2.7/3.5 • Other requirements: The following Python libraries are required: numpy, math, datetime, os, and sys. For running TOUGH2, the TOUGH2 executable is required. • License: MIT license • Users can modify and distribute the software, and use for private, non-commercial and commercial purposes. A copy of the license and copyright notice must be included with the software. The full license is included in the GEOPHIRES GitHub folder.