GTH: A Finite-Difference Simulator for Two-Phase Hydrothermal Fluid Flow in Porous Media

 

Introduction

Mathematical Model

Conservation equations

Constitutive relationships

Initial/boundary conditions

Sources and Sinks

Porous medium properties

Fluid Properties

Equation of state

Fluid viscosity

Two-phase boundary

Finite-Difference Model

Dependent variables

Control volume approach

Temporal discretization

Spatial discretization

Numerical Solution

Alternate-direction iteration

Coupling of pressure and enthalpy equations

Convergence criteria

Time-step control

Program Structure

General structure

Brief description of subroutines

Programming

Installation and compilation

Input files

Output files

Example Problems

Geothermal heat pipe

Expanding two-phase zone due to drainage

Cold Water Injection into a Vapor Reservoir

Appendices

Appendix A. List of symbols

Appendix B. Example of input file GXIN

Appendix C. Example of input file BC.DATA

Appendix D. Example of input file BGSOSI.DATA

References

 

Introduction

GTH is a numerical simulator developed at Georgia Tech to study liquid/vapor two-phase flow and heat transport in porous media, either uniform or fractured. The two-phase hydrothermal systems simulated by GTH may have non-uniform and time-dependent porous medium properties, such as porosity and permeability. Water properties are calculated using Haar et al.'s [1984] equation of state. GTH is capable of handling problems with pressures from 0.05 MPa to 1,000 MPa and temperatures from 0 C to 1200 C.

The mathematical model of GTH is based on Faust and Mercer's [1979] description of two-phase hydrothermal systems. The major assumptions employed by GTH are: (1) potential and kinetic energy are negligible; (2) thermal equilibrium exists among water, steam and porous media; (3) Darcy's law is applicable to individual phases in two-phase hydrothermal systems; and (4) capillary effects other than that on liquid or vapor residual saturations are negligible.

GTH was developed based on a control-volume-based finite difference method [Patankar, 1980]. Because of its conservative nature this method is suitable for numerical modeling of systems described by a differential equation set that involves at least one first-order hyperbolic equation. One such example is the equation set posed for the two-phase hydrothermal systems [e.g., Young, 1993; Xu, 1996].

This document briefly describes the mathematical model and numerical methods applied in developing GTH, and how to install, compile and run the program.

 

Mathematical Model

Symbols used in this document are defined in Appendix A.

Conservation Equations

Two-phase (liquid-vapor) fluid flow and heat transport in a porous medium can be described by a set of conservation equations [Xu and Lowell, 1998]. Conservation of mass and energy are expressed by

,(1)

and

,(2)

respectively. Conservation of momentum for each phase is accounted for by Darcy's Law. Thus:

(3)

and

.(4)

Constitutive Relationships

Bulk density r and bulk enthalpy h in equations (1) and (2) are defined as:

,(5)

and

,(6)

respectively. The volume saturation of the individual phases sums to unity. That is:

.(7)

Initial/Boundary Conditions

Pressure and enthalpy should be specified for the whole system that is to be simulated. For the pressure equation the boundary condition may be specified as fixed pressure or mass flux or their combination. For the enthalpy equation it may be fixed enthalpy or heat flux or their combination.

Sources and Sinks

In many circumstances a hydrothermal system is subject to certain type of injection or extraction operation. In-situ heat or mass sources may also present. These are represented by source/sink terms in equations (1) and (2). GTH is able to simulate the effect of time-dependent sources and sinks on a two-phase hydrothermal system.

Porous Medium Properties

GTH is designed to deal with problems with non-uniform porous medium properties such as porosity, permeability and thermal conductivity. The permeability handled by GTH can also be anisotropic, that is, at a given place permeability has non-identical values at different directions. Permeability may vary with time during the evolution of a hydrothermal system. Certain type of pre-described time-dependent permeability variation can be handled by GTH.

 

Fluid Properties

Equation of State

Thermodynamic properties are calculated at given pressure and enthalpy. Haar et al.'s [1984] equation of state, which is valid within a temperature range of 0-1200° C and a pressure range of 0.1-1,000 MPa, is used to calculate pure water properties within sub-cooled liquid, super-heated steam and super-critical regions. The equation of state is given by the Helmholtz free energy as a function of temperature and density

.(8)

Temperature, density, and their derivatives with respect to pressure and enthalpy were calculated as functions of pressure and enthalpy and were then organized to form a data file named TABLES.DATA. During each running of GTH this data file is read first. For a given pair of pressure and enthalpy, the property data at the nearest pressure-enthalpy points are first searched and the properties corresponding to the pressure-enthalpy pair are then calculated through a bilinear interpolation of the data at the nearest points [Press et al., 1986].

Fluid Viscosity

The calculation of dynamic viscosity of single-phase pure water is based on Kestin et al.'s [1984] formulation. The viscosity is expressed as a function of temperature and density

.(9)

The formulation is valid for the following range of pressure and temperature:

p £ 500 MPafor150 ° C ³ T ³ 0 ° C,p £ 350 MPafor600 ° C ³ T ³ 150 ° C,(10)p £ 300 MPafor900 ° C ³ T ³ 600 ° C.

Two-Phase Boundary

The properties of coexisting phases include the saturated density, enthalpy, temperature and viscosity of liquid and vapor. Among them temperature is the same for the two individual phases assuming thermodynamic equilibrium. The temperature data were fitted into a curve represented by a fourth order semi-logarithmic polynomial of pressure. The temperature and its derivative with respect to pressure are calculated along this curve. The other phase boundary data were treated as functions of pressure and made into lookup tables and put into a data file named PHASEBD.DATA. A searching and linear interpolation procedure [Press et al., 1986] is used for calculating them from the lookup tables as functions of pressure.

 

Finite-Difference Model

Dependent Variables

Pressure and enthalpy are used by GTH as dependent variables since they uniquely define the thermodynamic state of pure water under both single- and two-phase conditions. Within the two-phase region, pressure and temperature are related to each other according to the Clapeyron curve . In the two-phase region, therefore, the independent variables p and T are interchangeable, as are the other set of saturation S, enthalpy h, and density r .

Control Volume Approach

Before the discretization of the governing equations, Equation (1) is re-written, by utilizing equations (3) and (4) and taking derivatives of density with respect to pressure and enthalpy, as

(11)

Equation (2) is similarly re-written as

(12)

so that it becomes explicitly enthalpy-related. The two governing equations (11) and (12) are nonlinearly coupled. They are then discretized to produce two difference equations for pressure and enthalpy respectively using an approach that is similar to the method of Patankar [1980]. The finite difference equations thus obtained have the following forms:

(13)

(14)

In obtaining (13) and (14) from (11) and (12) the following two aspects need to be taken care of.

Temporal Discretization

For the sake of numerical stability, the discretization of the governing equations in time is fully implicit. That is, the discretized equations are solved for pressure and enthalpy iteratively. All coefficients of the discretized pressure and enthalpy equations are calculated according to the newly-obtained pressure and enthalpy after each iteration. This method has been commonly used in the numerical simulation of fluid flow and heat transfer problems [e.g., Patankar, 1980].

Spatial Discretization

The pressure equation is of diffusion type and was discretized by the well-known central-difference method. However, the enthalpy equation is an advection-diffusion equation in the single-phase region and a first-order hyperbolic advection equation in the two-phase region. It needs some special treatment especially for the advection-related term. GTH applies Patankar's [1980] method for all single-phase regions.

Within the two-phase region, the enthalpy equation reduces to a first-order hyperbolic equation because the heat conduction term becomes a function of pressure only and is independent of enthalpy. The calculation of the coefficient of the advection-related term at the interfaces between the adjacent control volumes is crucial in terms of numerical stability. There are many options in calculating the coefficient.

An effective way to approach numerical stability, which is adopted by GTH as one of the options, is to apply the so-called full-upstream weighting to the relative permeabilities [Aziz and Settari, 1979]. That is, the relative permeabilities at an interface between two adjacent control volumes are replaced by those of the control volume that is at the upstream-side of the interface as determined by the flow direction of the individual phases. This method has proved to be quite efficient in many circumstances and in most circumstances it is also sufficiently accurate.

There are several other options offered by GTH. The simplest one is central differencing. One may want to choose this option when the propagation of saturation disturbance is most concerned [Xu and Lowell, 1998]. However it is good only for fine grids and small time steps. A second one was obtained by formally applying Patankar's [1980] method to the two-phase region. While the approach is sometimes much better than the central differencing, it has been observed in some circumstances to suffer from numerical instability. A third way is to calculate the interface properties according to the pressure and enthalpy that are obtained by assuming a local steady-state one-dimensional configuration determined by the pressure and enthalpy of the two adjacent control volumes. This method has proved to be very accurate in obtaining the final steady states for one-dimensional problems. However, it may cause errors near discontinuous interfaces and when applied to strongly transient problems.

 

Numerical Solution

Alternate-Direction Iteration

In order to save computer space for multi-dimension problems, the two finite difference equations (13) and (14) are solved using a method that is commonly applied to one-dimensional problems [Patankar, 1980]. For a two-dimensional problem, for instance, the finite difference equations are first solved line-by-line in the X-direction using the Thomas algorithm. The same equations are then solved row-by-row in the Y-direction. This procedure is repeated several times or until the solutions are converged. When solving the equations the updated pressure and enthalpy values, whenever and wherever they are available, are utilized. The procedure may be repeated for several times during each iteration between the pressure and enthalpy equations. It is not necessary for the solutions to be convergent because they are the results of an intermediate step during a pressure-enthalpy iteration procedure.

Coupling of Pressure and Enthalpy Equations

The pressure and enthalpy equations are nonlinearly coupled. An iteration procedure was designed to obtain pressure and enthalpy solutions for each time step by solving (13) and (14) for pressure and enthalpy respectively. The pressure equation (13) is solved first for pressure and then the enthalpy equation (14) for enthalpy, and thus complete one solution of the iteration procedure. The coefficients of (13) and (14) are then calculated using the new pressure and enthalpy values and the equations are then solved for pressure and enthalpy again. Before solving the enthalpy equation (14) one may choose to or not to calculate coefficients b using new pressure values. The iteration procedure is repeated till it converges. A relaxation procedure is designed to help the convergence of the above iteration. The relaxation procedure is used by GTH to reduce the rate of pressure and enthalpy changes when strong variations occur and to accelerate the rate when it is slow during the iteration. The change rate is also slowed down by the relaxation procedure when phase change is taking place within some control volumes.

Convergence Criteria

The convergence criteria of the iteration procedure for the coupled pressure and enthalpy equations are given by

(15)

and

,(16)

where p and h are the solutions obtained during the current pressure-enthalpy iteration, p0 and h0 are those obtained during the last iteration, p0 and h0 are the values obtained at the last time step, and Ep and Eh are sufficiently small numbers. Usually Ep and Eh are set to be equal or less than 10-2. The iteration procedure is said to be convergent when both (15) and (16) are satisfied. Sometimes when phase change occurs within one or a few control volumes, the status of the control volume(s) tends to switch forth and back between two different phases during an iteration and the convergence is difficult to reach. An averaging algorithm is designed to help the convergence of the iteration procedure. Basically, when pressure and enthalpy variations during the switching are sufficiently small, averaged values of the pressure and enthalpy over the last several iterations, instead of the numbers obtained by the last iteration, are chosen as the values of the current iteration. This averaging approach has been proved to work well in improving the iteration convergence in most circumstances.

Time-Step Control

A maximum time-step interval is pre-set and may be changed during a GTH run. When the pressure-enthalpy iteration converged at the last time step and the time-step interval is smaller then the maximum interval the time-step interval for the next time step is automatically increased. If the pressure-enthalpy iteration does not converge then the time-step interval will be cut to a smaller value and redo the iteration.

 

Program Structure

General Structure

The main program is named GTH. A typical GTH run starts with reading tables of pre-calculated thermodynamic properties (tables.data) and phase boundary data (phasebd.data). GTH then read parameters of the physical problem, numerical model, initial conditions and program control parameters from gxin. Boundary conditions and source/sink information are read in separately from bc.data and bgsosi.data. When data input work are finished, GTH proceeds to solve the problem at each time step using a DO-loop.

For each time step, an input file named answers.data is read first. The data file contains parameters that control the program process and can be changed by the user during the programming to improve the program process. Finite difference pressure and enthalpy equations are solved using an iteration procedure that is represented by the pressure-enthalpy iteration DO-loop.

For each pressure-enthalpy solution a subroutine named PROPTY is called first to calculate thermodynamic and thermophysical properties of water at given pressure and enthalpy values and to insure phase equilibrium if liquid and vapor coexist in the problem domain. The subroutine INTERFACE is then called to calculate properties for each interface between adjacent control volumes. Flow rates are calculated applying Darcy’s law and various types of upstream weighting, if they are chosen, may be conducted for advection-related terms such as relative permeabilities. Results of above calculations, combined with pre-introduced model parameters, are used to form finite difference equations for pressure and enthalpy by calling EQTNP and EQTNH, respectively. Finally SOLVEQ is called to solve the equations for pressure and enthalpy, respectively. A relaxation procedure is employed to improve the convergence of the pressure-enthalpy iteration.

At the end of a successful pressure-enthalpy iteration the results are stored temporarily in G3pickup in high precision formats for restarting and continuing the program in cases of unexpected program termination as the result of a power failure, a computer down, or the difficulty in program continuation due to convergence problems. At times preset by the user results are also written into output files G3out1, G3out2, G3out3 and sometimes also G3out4.

GTH stops after it successfully completed the works for all time steps.

Brief Description of Subroutines

 

Programming

Installation and Compilation

GTH was written in FORTRAN-77. It has been run on PC, UNIX workstations and the SGI Origin 2000 supercomputer at Georgia Tech.

Users should first download all files listed in the section of Brief Description of Subroutines to a subdirectory of their computer. You may want to make changes to file GEOTH.PAR according to the size of the numerical model before compilation to save computer space. These FORTRAN files are then compiled using a FORTRAN compiler to create an executable file named GTH or whatever name you like. If you have a UNIX workstation you may want to use the provided file MAKEFILE to do compilation work. Before the compilation a subdirectory "run" should be created for running the program. The executable file created by compilation should be put in the "run" subdirectory as well all the data files needed for a program run.

Input Files

Input files are prepared for establishing look-up tables of thermodynamic properties, reading problem specifications, and adjusting program-control parameters.

Output Files

There are two output files, G3out0 and G3pickup, that are automatically produced by each GTH run. Users may also choose to have up to four other output files, namely G3out1, G3out2, G3out3, and G3out4.

 

Example Problems

Geothermal Heat Pipe

 

Expanding Two-Phase Zone due to Drainage

 

Cold Water Injection into a Vapor Reservoir

 

Appendices

Appendix A. List of Symbols

Symbols:

Symbol Meaning
a coefficient of finite difference pressure equations
A Helmholtz free energy
b coefficient of finite difference enthalpy equations
cr specific heat of rock
Eh convergence criterion for the enthalpy iteration
Ep convergence criterion for the pressure iteration
g acceleration due to gravity
h bulk enthalpy of fluid
hl enthalpy of liquid
hv enthalpy of vapor
k permeability of porous medium
krl relative permeability for liquid
krv relative permeability for vapor
p pressure
ql mass flow rate of liquid
qv mass flow rate of vapor
Qe source/sink of energy
Qm source/sink of mass
Qsh source/sink term of finite difference enthalpy equations
Qsp source/sink term of finite difference pressure equations
Sl volume saturation of liquid
Sv volume saturation of vapor
t time
T temperature
f porosity
l effective thermal conductivity
ml dynamic viscosity of liquid
mv dynamic viscosity of vapor
r bulk density of fluid
rl density of liquid
rr density of rock
rv density of vapor
Gl (krlrl)/ml
Gv (krvrv)/mv

Other Subscript:

Subscript Meaning
b beneath the control volume
e east of the control volume
n north of the control volume
o at the control volume
s south of the control volume
t above the control volume
w west of the control volume
0 value of the last iteration

Superscript:

Superscript Meaning
0 value of the last time step

Appendix B. Example of Input File GXIN

idim nx ny nz tmstr iyr(T/F) DIMENSIONS 13, 1, 1, 11, 0D0, T

tstepmx tmincr deltmin n-tmcut TIME STEP

9000000, 1.5D0, 1.D-6, 30

maximum number of ADI iteration ADI ITERATION

1

maximum number of line-by-line iteration L-BY-L ITERATION

1

itermx, nphasechg, tolpcp, tolpch, dptol, dhtol, dpit, dhit P-H ITER.

50, 100, 1.D0, 1.D0, 1.D2, 1.D5, 1.D8, 1.D10

relax0 relaxph attenu RELAXATION IN P-H ITERATION

1.D0, 1.D-1, 0.618D0

dpmax dhmax pmax hmax pmin hmin LIMITS IN P-H ITERATION

1.D10, 1.D12, 1.D9, 5.D10, 1.D5, 1.D6

kodrp[0=L,1=C,2=F] wsatn ssatn RELATIVE PERMEABILITY

11, 0.0d0, 0.0d0

heatcpty[erg/g/° C] rxden[g/cm3] thcrock(erg/cm/° C/sec) grav[cm/sec2] ROCK 1.0718D7 2.643D0 2.88D5 980.D0

plot wide long v-avg ssflx pnodes [-1=all,>0 IJK folw] PRINT 0, 1, 1, 0, 0, 0pres enth temp wsatn resdM resdE (G3OUT1) PRINT 1 - Envrn

1, 1, 1, 1, 0, 0

wden wvis wXvel wYvel wZvel wpotnl (G3OUT2) PRINT 2 - Water

0, 0, 0, 0, 1, 0

sden svis sXvel sYvel sZvel spotnl (G3OUT3) PRINT 3 - Steam

0, 0, 0, 0, 1, 0

** XSPA,YSPA,ZSPA,PORO,XPER,YPER,ZPER,THER,COND,TEMP/ENTH,PRES ** PARMS

*** FMT [udef/FREE/CONS/CALC - (XSPA,YPER,ZPER,COND,PRES, etc.)] ***

XSPACING (cm)

CONSTANT

1.D2

YSPACING (cm)

CONSTANT

1.D2

ZSPACING (cm)

FREE

10*5.D3,1.D2

POROSITY (unitless)

FREE

8.D-1

1.D-1

1.D-1

1.D-1

1.D-1

1.D-1

1.D-1

1.D-1

1.D-1

1.D-1

1.D-1

XPERMEABILITY (cm2)

CONSTANT

1.D-10

YPERMEABILITY (cm2)CONSTANT

0.D0

ZPERMEABILITY (cm2)

FREE

2.D-8

5.D-12

5.D-12

5.D-12

5.D-12

5.D-12

5.D-12

5.D-12

5.D-12

5.D-12

5.D-12

THERMAL CONDUCTIVITY OF FLUID (erg/cm/° C/sec)

CONSTANT

2.88D5

PRESSURE (dyne/cm2)

CONSTANT

1.D6

ENTHALPY (erg/g)

CONSTANT

80.D7

*** END OF TIME INTER., PRINTING FREQ., INTER. OF INITIAL TIME STEP ***

tchg[-1=stp] prfreq delt[-1=NC] TIME PERIOD 1

1.D5 1.D5 1.D0

tchg[-1=stp] prfreq delt[-1=NC] TIME PERIOD 2

-1 1.D-2 1.D-4

Appendix C. Example of Input File BC.DATA

1000000000211.D60.D0,0.D0,0.D010000000002180.D70.D0,0.D0,1.D3

Appendix D. Example of Input File BGSOSI.DATA

MASS SOURCES/SINKS (g/cm3/sec)

0,1.D100,0.D0,0

0.D0

0.D0

0.D0

0.D0

0.D0

0.D0

0.D00.D00.D0

0.D0

0.D0

FLOWING ENTHALPY ASSOCIATED WITH MASS SOURCES/SINKS (erg/g)

0,1.D100,0.D0,0

0.D0

0.D0

0.D0

0.D00.D00.D00.D00.D00.D00.D00.D0ENERGY SOURCES/SINKS (erg/g/sec)

0,1.D100,0.D0,0

0.D0

0.D0

0.D0

0.D0

0.D0

0.D0

0.D0

0.D0

0.D0

0.D0

0.D0

PERMEABILITY VARIATION (cm2)

0,1.D100,0.D0

 

References

Return to the Hydrothermal Group homepage