7
Geothermics 00 (2013) 1–9 Geothermics Correct Energy Conservation in Geothermal Wellbore Simulation Mark J. McGuinness School of Mathematics, Statistics and Operations Research, Victoria University of Wellington, Wellington, New Zealand. [email protected] Abstract A fundamental error of interpretation of static steam dryness versus flowing steam quality in the coding of the simulator GWELL has been found, that means it does not correctly conserve energy or momentum. GWELL, or the energy and momentum subroutines from it, may have formed a basis for other geothermal wellbore simulator codes in existence, prompting this note on how to quickly check if your favorite geothermal wellbore simulator is actually conserving energy. The possible consequences of using a simulator that does not conserve momentum or energy as presumed, are also briefly explored. c 2013 Submitted to Geothermics, Elsevier Ltd, for publication. Keywords: Geothermal wellbore simulation, Energy conservation, Static versus flowing steam quality, Static versus flowing enthalpy, GWELL, coding errors, SwelFlo 1

Correct Energy Conservation in Geothermal Wellbore …swellflo.com/SwelFlo/Publications_II_files/EnergyConsGeothermics... · (2013) and in the GWELL manual (Aunzo, 1990; Aunzo et

Embed Size (px)

Citation preview

Geothermics 00 (2013) 1–9

Geothermics

Correct Energy Conservation in Geothermal Wellbore Simulation

Mark J. McGuinness

School of Mathematics, Statistics and Operations Research, Victoria University of Wellington, Wellington, New Zealand.

[email protected]

Abstract

A fundamental error of interpretation of static steam dryness versus flowing steam quality in the coding of the simulator GWELLhas been found, that means it does not correctly conserve energy or momentum. GWELL, or the energy and momentum subroutinesfrom it, may have formed a basis for other geothermal wellbore simulator codes in existence, prompting this note on how to quicklycheck if your favorite geothermal wellbore simulator is actually conserving energy. The possible consequences of using a simulatorthat does not conserve momentum or energy as presumed, are also briefly explored.

c© 2013 Submitted to Geothermics, Elsevier Ltd, for publication.

Keywords:Geothermal wellbore simulation, Energy conservation, Static versus flowing steam quality, Static versus flowing enthalpy,GWELL, coding errors, SwelFlo

1

M.J. McGuinness / Geothermics 00 (2013) 1–9 2

1. Introduction

A geothermal wellbore simulator is intended to nu-merically solve conservation of mass, momentum andenergy equations in the steady-state, for flow of vapourand liquid phases of water up a geothermal well. Thisnote is prompted by two discoveries, one made whileworking on Fortran code from the simulator GWELL,that the energy and momentum conservation subrou-tines in GWELL as coded in 1991 use static steam massfraction X where they should be using the flowing steamquality Xflo, and hence GWELL does not actually con-serve energy or momentum. The second discovery wasthat a commercially available geothermal wellbore sim-ulator was giving very different enthalpies to the simu-lator SwelFlo (2013) written by the author, and that thedifference could be explained by considering the pos-sibility that the commercial simulator was also usingstatic X where it should have been using flowing Xflovalues.

Note that the manual for GWELL is correct in its pre-sentation of these conservation laws. The error that wasmade is in the coding of GWELL, confusing static andflowing steam dryness values. Note also that informa-tion available for other wellbore simulators (for exam-ple, Garg and Pritchett (1978); Garg et al (20048);Gudmundsdottir et al (2013) )

has correctly phrased energy conservation equationsin all of the cases that the author has seen, but there isnot enough information published (for example, show-ing the variation of flowing enthalpy with depth from asimulation) to know if the coding of these simulators iscorrect or not. The only simulator this author has foundto be in error is a commercially available simulator.

The purpose of this note is to give a quick and easyway to test the code of a geothermal wellbore simulator,to see whether energy conservation is being correctlyimplemented or not, for a simulation of two-phase up-flow, without access to the source code. We also con-sider the possible impact on reservoir management de-cisions of using the incorrectly coded GWELL routines.

2. Conservation Laws

The steady-state conservation laws for a two-phaseflow, as described in Chisholm (1983), McGuinness(2013) and in the GWELL manual (Aunzo, 1990;Aunzo et al., 1991; Bjornsson, 1987), are as follows.Cross-sectional area A is taken to be constant in theseequations, and flow is averaged over ensembles for tur-bulent flow and over representative elementary volumes,

then over the wellbore cross-sectional area, before set-ting time derivatives to zero. Conservation of mass inthe absence of a feedpoint is given by

G = S ρvuv + (1 − S )ρlul , (1)

where G ≡ Q/A is the total mass flowrate per unit area,Q is the constant mass flowrate (kg/s), positive for pro-duction, S is saturation (the volume fraction occupiedby vapour phase, in the static sense of a snapshot of theflow at a given time), u is actual velocity of a phase(m/s), ρ is the density of a phase, and subscripts v and lrefer to vapour and liquid phase properties respectively.

Conservation of momentum is given by a combina-tion of friction, divergence of momentum flux, and grav-itational force terms, ignoring surface tension effects, toobtain the following form for the rate of change of pres-sure P down the well (Chisholm , 1983, p. 141)

dPdz

= φ2FL0

[dPdz

]FL0−

ddz

(Gum) + ρmg sin θ (2)

where z is depth (measured distance along the wellborefrom the wellhead), φ2

FL0 is a multiplier that converts theliquid frictional pressure change term[

dPdz

]FL0

=λG|G|4ρlr

to a two-phase frictional pressure change term, λ isthe Darcy friction factor, r is wellbore radius, um =

Xflouv + (1 − Xflo)ul is a weighted average flowing two-phase velocity, θ is the angle that the wellbore makeswith the horizontal, and ρm = S ρv + (1 − S )ρl is a two-phase density. The flowing steam quality is the steammass flowrate Qv = AS ρvuv (kg/s) expressed as a frac-tion of total mass flowrate,

Xflo =Qv

Q=

S ρvuv

S ρvuv + (1 − S )ρlul.

Conservation of energy may be written as a balancebetween flowing enthalpy, kinetic energy, and potentialenergy, as (Chisholm , 1983, p. 141)

ddz

[Xflohv + (1 − Xflo)hl + Xflou2

v/2 + (1 − Xflo)u2l /2]

= g sin θ , (3)

where h is specific enthalpy, and heat flow betweenwellbore and the surrounding country has been ignoredfor simplicity. In a simulation, the user can set the ther-mal conductivity of the country to zero, to replicate this.

2

M.J. McGuinness / Geothermics 00 (2013) 1–9 3

Note that the static steam mass fraction or dryness Xcan be expressed in terms of flowing steam quality Xfloor the (static) saturation as

X =Xfloul

Xfloul + (1 − Xflo)uv=

S ρv

S ρv + (1 − S )ρl.

The flowing enthalpy of the two-phase flow may be de-fined as

hflo = Xflohv + (1 − Xflo)hl ,

whereas static two-phase enthalpy is

h = Xhv + (1 − X)hl .

Flowing and static values of X and h are only equalwhen there is no slip between vapour and liquid phases.An average kinetic energy for the two-phase flow can bedefined as Ek = Xflou2

v/2 + (1− Xflo)u2l /2, so that energy

conservation in the absence of external sources or sinkstakes the form

ddz

[hflo + Ek] = g sin θ . (4)

Note that measurements of enthalpy at wellhead, forexample by using the James lip pressure method, aremeasurements of flowing enthalpy. Also note that en-ergy conservation at feed points is properly expressed interms of flowing enthalpies to and from the feed zone.For a single phase fluid, static and flowing enthalpiesare the same.

3. A Test for Energy Conservation

A close look at the Fortran coding of the energy,momentum, friction, choking, Armand correlation, andOrkizewski correlation subroutines of the simulatorGWELL as it existed in 1991 reveals that static drynessX is being used in place of flowing steam quality Xflo inthe conservation equations, the two-phase friction term,the calculation of when a flow is choked, and in the cor-relations. This is incorrect. Hence GWELL does notconserve energy or momentum, and does not have thecorrect friction, choking, or correlation calculations, un-less the vapor and liquid phases are flowing at the samespeed, as in mist flow or in homogeneous flow. The ap-pendix lists the subroutines in GWELL that are affectedby this bug.

Comparing differences recently in simulation resultsbetween SwelFlo and a commercially available geother-mal wellbore simulator, revealed a mismatch in thechange of simulated values of total fluid enthalpy downthe well, prompting the question whether the commer-cial simulator was also using incorrect conservation

equations, possibly due to a shared provenance withGWELL. In any case, it would be useful and reassuringto be able to check that a simulator is correctly conserv-ing energy, without access to the source code.

A simple test that the flowing enthalpy is being cor-rectly used to calculate energy terms is to consider avertical simulation in which the changes in kinetic en-ergy are negligible, compared to the change in potentialenergy. Then equation (4) is approximated as

dhflo

dz≈ g , (5)

which integrated over a length L of wellbore gives thechange in flowing enthalpy as

∆hflo ≈ gL . (6)

This provides the test, as follows: run the simulatorwith no heat loss to or from the country, and look at alength, say L = 1000m of vertical well, with a flowratethat is not too large but which has a significant amountof slip between vapour and liquid phase flowrates, sothat flowing and static enthalpies are quite different, butchanges in the kinetic energy term are negligible. Thenthe change in flowing enthalpy ∆hflo should be domi-nated by the change in potential energy gL, being about9.8 kJ/kg over 1000m.

Hence, if a simulator returns static enthalpies for atwo-phase upflow that change by an amount close to 9.8kJ/kg over a depth of 1000m (or 980 J/kg over 100m)at low flow rates and with no heat loss to the country,this is an indication that it is not correctly using flow-ing enthalpy, and is likely not conserving energy. Thevelocities of vapor and liquid phases need to be quitedifferent for this test to distinguish between flowing andstatic enthalpy.

4. An Example

An illustration of the simple test is shown in Ta-ble (A.1). Three simulators are tested in topdown mode— SwelFlo, GWELL (Aunzo, 1990; Aunzo et al., 1991;Bjornsson, 1987) and a commercial one. The SwelFloresults show the expected result that flowing enthalpychanges by 100g ≈ 980 J/kg over the depth of 100m,matching the change in potential energy as given bythe energy conservation equation, while static enthalpychange is significantly higher that this. Kinetic energychanges were observed to be less than 10 J/kg. GWELL,with its built-in confusion of flowing and static dryness,has the static enthalpy changing by 980 J/kg, and this isa reflection of the correctly stated but incorrectly coded

3

M.J. McGuinness / Geothermics 00 (2013) 1–9 4

energy conservation subroutine. The wellhead enthalpyof 1141 kJ/kg given by the commercial simulator out-put could be either flowing or static enthalpy. However,the stated wellhead pressure of 27 barg and temperatureof 229.16 at an elevation of 700m with XCO2 of 0.38weight% suggests that the enthalpy output by the com-mercial simulator is the static enthalpy. Disturbingly,then, the commercial simulator has the same changein static enthalpy as GWELL, which is using incorrectcoding.

5. Consequences

The effect on downhole pressure of confusing staticand flowing steam quality is in general highly depen-dent on the details of the simulation. Consequencesare small at low concentrations of carbon dioxide, sincepressure changes are then controlled by momentumconservation, which is dominated by the static grav-itational term ρmg sin θ, and the differences in satura-tion do not make enough difference in average densityto show up within graphical accuracy. At higher car-bon dioxide concentrations however, the differences be-tween static enthalpies obtained using correct versus in-correctly computed steam dryness, give significant dif-ferences in temperatures and velocities, because chang-ing the saturation changes the temperature, if pressureand carbon dioxide concentration are fixed. On the otherhand, if the correlation or setup is such that over mostof the wellbore vapour and liquid phases move at sim-ilar speeds, little difference is expected when using theincorrect coding.

We explore briefly here just one example showing thepossible consequences of using a simulator with incor-rectly coded conservation laws, on the downhole pres-sure P, temperature T, and average fluid velocity V, andon output curves.

We consider a vertical well with smooth casing of ra-dius 0.1m, 1000m deep, with a single bottomhole feed.Carbon dioxide concentration is 1% everywhere. Werun a topdown simulation using SwelFlo, with correcttreatment of flowing steam quality, and a wellhead pres-sure of 20 bara, production of 20 kg/s, at a flowing en-thalpy of 1300 kJ/kg. The resulting static enthalpy atwellhead is then 1197 kJ/kg. Orkiszewski correlationsare used in all simulations (Chisholm , 1983).

Note that topdown simulations have an advantageover bottom-up simulations: a steady-state solution al-ways exists to the full depth of the well for topdownsimulations (provided temperatures do not reach criti-cal), whereas for a bottom-up simulation it may be thecase that the solution ceases to exist partway up the

wellbore (e.g., Figures 4, 5 and 6 in Bilicki and Kestin(1982)).

The resulting enthalpy and wellbore pressure at bot-tomhole, assuming a reservoir pressure of 40 bara there,allow to calculate a productivity index and then to com-pute an output curve using bottom up simulations withvarious wellbore pressures at bottomhole, assuming thereservoir enthalpy there is the value calculated with thetopdown simulation to get a flowing enthalpy of 1300kJ/kg at the wellhead.

The results of this correct simulation are then used asdata, to compare with the results of running the simu-lator in “GWELL mode”, that is, with correlations andconservation laws as originally coded in GWELL withits confusion between flowing steam quality and staticdryness. The P, T and V values from three GWELL runsare shown together with the data in Fig. 1. The run la-belled GWELL 1 has static enthalpy matching the flow-ing enthalpy of 1300 kJ/kg and all other wellhead prop-erties unchanged from the correct simulation, the one la-belled GWELL 2 has static enthalpy matching the staticenthalpy of 1197 kJ/kg and all other wellhead proper-ties unchanged from the correct simulation (which thengives the most accurate match to wellhead conditionsbut a poor match elsewhere), and GWELL 3 has hadenthalpy, pressure and flowrate at the wellhead slightlyadjusted by hand in an attempt to more closely matchoverall values of downhole P, T and V.

It can be seen from Fig. 1 that it is difficult to matchall three of P, T and V with GWELL simulations usingincorrect energy computation. The differences in down-hole values can be significant for this case.

Then to illustrate the effect of using incorrect simu-lation on the output curve, the hand-fitted GWELL 3topdown simulation is used to calculate a bottomholeproductivity index and reservoir enthalpy, and theseare used to calculate (still using GWELL conservationlaws) an output curve. This is compared with the cor-rect simulation output curve in Fig. 2. Note that all sim-ulations use a twenty-one point trapezoidal rule to inte-grate the pseudopressure formulation that gives accuratefeedpoint viscosity (McGuinness , 2014).

The output curves show only small differences inflowing enthalpy, but because the productivity index forGWELL 3 is about twice the correct value, the GWELL3 output at maximum flowrate is about 40% more op-timistic at 56 kg/s than the correct simulation result of40 kg/s.

4

M.J. McGuinness / Geothermics 00 (2013) 1–9 5

Figure 1. Downhole simulations run from the top down, showing P, Tand average fluid V versus depth (m). Squares are the correct simula-tion results, treated as data for the GWELL runs. Simulation GWELL1 uses the correct wellhead flowing enthalpy as the wellhead enthalpy,and simulation GWELL 2 uses the static wellhead enthalpy as thewellhead enthalpy. Otherwise they use the same P, Q values as thecorrect run. GWELL 3 adjusts all wellhead values in an attempt toobtain a better overall match to P, T and V downhole.

Figure 2. Output curves, showing wellhead flowrates Q versus well-head pressure P, for the correct simulation and for the GWELL 3simulation. The correct output curve was obtained by using bottom-hole pressure, flowrate, and enthalpy from the topdown simulation, tocompute a productivity index. Also shown are the wellhead flowingenthalpies H computed, versus pressure in the first plot, and versusflowrate in the second plot.

6. Informed Decisions

Finally we explore a possible consequence of usinga simulator with the incorrect coding seen in GWELLwhen making management decisions. For example, itmight be desirable to simulate how much productionfrom a geothermal well would be improved if wellboreradius was doubled to 0.2m.

With this aim in mind, the correct and GWELL 3 sim-ulations were re-run with doubled radii, to obtain the re-sults shown in Fig. 3. Both predict substantial improve-ments in the maximum flowrate, although the GWELL 3simulation is much more optimistic with a flowrate thatis nearly double that in the narrower well, whereas theaccurate simulation forecasts a more conservative 50%improvement in flowrate. Both results indicate that theflow is wellbore limited, rather than feed productivitylimited. This depends strongly on the productivity in-dex, which with our choice of a 40 bara reservoir pres-sure in this model example is rather large.

7. Conclusions

An error of interpretation, so that static steam dry-ness was used in place of flowing steam quality in anumber of subroutines affecting energy conservation,momentum conservation, and correlations, invalidates

5

M.J. McGuinness / Geothermics 00 (2013) 1–9 6

Figure 3. Output curves, with wellbore radius doubled to 0.2m, show-ing wellhead flowrates Q versus wellhead pressure P, for the correctsimulation and for the GWELL 3 simulation.

conservation of energy and momentum to varying de-grees in the geothermal simulator GWELL. This non-conservation can alter simulated downhole values ofpressure, temperature and other fluid properties signif-icantly, particularly when slip velocities are high andwhen carbon dioxide concentrations are high enoughthat errors in saturation affect pressures significantly.

Any simulator that is based on the 1991 version ofGWELL might inherit this incorrect behaviour. A sim-ple test, using a topdown simulation to check that flow-ing enthalpy changes by an amount roughly equal tog times depth, provides a litmus test for checking thatthe correct flowing steam quality is being used in theenergy equation. A simulator that fails this litmus testmight then be suspected of containing other confusionsof steam quality, static dryness versus flowing quality.

Note that this litmus test can also be applied across aflashpoint — the flowing enthalpy above the flash depthshould only differ from the flowing enthalpy below theflash point by gL. The flowing enthalpy in the liquidregion below flash is of course the same as the static en-thalpy. This provides a test that a simulator is faithfullyconserving energy across a flashpoint, coping with theconsequent change in dependent variables in going frompure liquid phase to two phase flow.

Getting the conservation equations wrong in this wayhas consequences for simulator outputs that are in gen-eral unpredictable. Our simple example shows thatthe consequences might have a significant impact oninterpretation of downhole data, on anticipated outputcurves, and on management decisions based on what-ifwellbore simulation scenarios.

References

Aunzo, Z.P., 1990. GWELL : a multi-component multi-feedzonegeothermal wellbore simulator. M.S. Thesis, University of Cali-fornia, Berkeley. 250 pp.

Aunzo, Z.P., Bjornsson, G., Bodvarsson, G., 1991. Wellbore modelsGWELL, GWNACL, and HOLA User’s Guide. Lawrence Berke-ley Lab, University of California, Earth Sciences Division ReportLBL-31428, UC-251. 103 pp.

Bilicki, Z., and Kestin, J., 1982. Two-phase flow in a vertical pipe andthe phenomenon of choking: homogeneous diffusion model. PartI. Homogeneous flow models. Report No. GEOFLO/13, Univ. ofCalifornia, Los Alamos National Laboratory, LASL4-X60-6306P-1. 44 pp.

Bjornsson, G., 1987. A multi-feed zone wellbore simulator. MastersThesis, University of California, Berkeley. 102 pp,

Chisholm, D., 1983. Two-phase flow in pipelines and heat exchangers.Pitman Press, Bath. 304 pp.

Garg, S.K., Pritchett, J.W., 1978. Two-phase flow in geopressuredgeothermal wells. Energy Conversion, Vol. 18, pp. 45–51.

Garg, S.K., Pritchett, J.W., Alexander, J.H., 2004. A new liquid hold-up correlation for geothermal wells. Geothermics 33, pp. 795–817.

Gudmundsdottir, H., Jonsson, M.T., Palsson, H., 2013. The well-bore simulator FloWell. Proceedings, thirty-eighth Workshop onGeothermal Reservoir Engineering, Stanford University, Stanford,CA, Feb 11–13, 2013. SGP-TR-198. Nine pages.

McGuinness, M.J., 2013. The impact of varying wellbore area on flowsimulation. Proceedings, thirty-eighth Workshop on GeothermalReservoir Engineering, Stanford University, Stanford, CA, Feb11–13, 2013. SGP-TR-198. Six pages.

McGuinness, M.J., 2014. Feedpoint Viscosity in Geothermal Well-bore Simulation. Geothermics, 50 (April 2014) 24–29.DOI: 10.1016/j.geothermics.2013.07.007http://www.sciencedirect.com/science/article/pii/S0375650513000552

SwelFlo (2013). SwelFlo is a commercially available geothermal well-bore simulator developed by the author that allows topdown andbottom up steady-state simulations of production of two-phase wa-ter and noncondensible gas (or injection of liquid phase water), ina wellbore of varying radius, roughness and inclination angle, withmultiple feedpoints. It was originally based on GWELL, but is ex-tensively modified and rewritten in Fortran 90, and is blended witha GUI to run under the Microsoft Windows environment.

Appendix A. GWELL subroutines affected

In GWELL, the variable X is used to denote boththe static steam mass fraction solved for along withtemperature in two-phase regions, and the flowingsteam quality that appears in correlations, momen-tum conservation, energy conservation, friction cal-culations, and choking computations. The followingGWELL subroutines are affected by the confusion be-tween flowing steam quality and static steam fraction:ARMAND, CHOKED, ENERGY, FEED1, FEED2,FEED3, FRIC1, MOMENTUM, REGIME, RESMOM,and RESMOM2 (which also has the wrong sign on themomentum flux divergence term A1).

The change required to correct can be nontrivial.For example, in ARMAND, the correlation essentiallygives saturation in terms of flowing steam quality, which

6

M.J. McGuinness / Geothermics 00 (2013) 1–9 7

when written correctly has to be iterated to get flow-ing properties given the current static properties. InGWELL this subroutine is written in a contradictory andconfused way, by starting as if X is flowing not staticsteam mass fraction, then computing saturation fromthat through the correlation (but not properly iterating,just repeating twice and taking an average if necessary),and calculating a slip velocity where it should computea drift velocity. So correction of this subroutine involvesa complete rewrite.

depth SwelFlo GWELL commercial

hflo h hflo h h

0 1141.00 1063.4 1269.31 1141.00 1141.0025 1141.25 1065.9 1265.30 1141.25 1141.2550 1141.49 1068.3 1261.18 1141.49 1141.4975 1141.74 1070.8 1256.95 1141.74 1141.74100 1141.98 1073.4 1252.59 1141.98 1141.98

Table A.1. Enthalpy (kJ/kg) versus depth (m), from the first 100mof simulations using SwelFlo, GWELL, and a commercially availablesimulator. h is the static value of enthalpy, and hflo is the flowingenthalpy (kJ/kg). Wellhead pressure is set to 27 bars gauge, enthalpyto 1141 kJ/kg, and flowrate to 19 kg/s. Weight % of CO2 is set to0.38. Orkiszewski’s correlation is used in all simulations.

7