TOUGH4 User Manual
  • Quick Entry to Keywords for Data Input
  • 1️⃣INTRODUCTION
    • About TOUGH
    • TOUGH Development History
    • TOUGH4 Implementation
    • Scope and Methodology
  • 2️⃣WHAT IS NEW IN TOUGH4
  • 3️⃣CODE COMPILATION AND INSTALLATION
    • Setup for Compilation
    • Code Compilation
      • 1. Compilation of TOUGH4 using Visual Studio
      • 2. Compilation of TOUGH4 on Linux-like platform
    • Installation
    • Running the Executable for Simulations
  • 4️⃣GOVERNING EQUATIONS
    • Mass-Balance Equation
    • Accumulation Terms
    • Flux Terms
    • Sink and Source Terms
    • Virtual Node Well Treatment
    • Semi-Analytical Conductive Heat Exchange
    • Drift Model
    • Non-Darcy Flow
  • 5️⃣NUMERICAL METHOD
    • Space and Time Discretization
    • Interface Weighting Schemes
    • Initial and Boundary Conditions
      • Initial Conditions and Restarting
      • Neumann Boundary Conditions
      • Dirichlet Boundary Conditions
      • Atmospheric Boundary Conditions
      • Constant Temperature Boundary Conditions
    • Parallel computing schemes
    • Linear Solvers
    • Python Functions
      • Relative Permeability
      • Capillary Pressure
      • Initial Condition Calculation
      • Fetching Output Data
      • Fetching Thermophysical Property Data From NIST Webbook
      • Coupling With Third-Party Software
  • 6️⃣SOFTWARE ARCHITECTURE
    • Program Design
    • Data Structure
    • Linear Equation Setup
  • 7️⃣PROCESS MODELING
    • EOS1
    • EOS2
    • EOS3
    • EOS4
    • EOS6
    • EOS7
    • EOS9
    • ECO2
    • EWASG
    • TMVOC
    • Tracers/Decay Chain
    • Biodegradation Reaction
    • Wellbore Flow
    • Non-Darcy Flow
    • Enhanced Coal Bed Methane
  • 8️⃣PREPARATION OF MODEL INPUT
    • Input Formatting
    • Keywords and Input Data
      • TITLE
      • BIODG
      • CBMDA
      • CHEMP
      • COFT
      • CONNE
      • COUPL
      • DIFFU
      • ELEME
      • ENDCY
      • ENDFI
      • FLAC
      • FNIST
      • FOFT
      • FORCH
      • GASES
      • GENER
      • GOFT
      • HYSTE
      • INCON
      • INDOM
      • MESHM
      • MODDE
      • MOMOP
      • MULTI
      • OUTPU
      • PARAM
      • ROCKS
      • ROFT
      • RPCAP
      • SELEC
      • SOLVR
      • SPAVA
      • TIMBC
      • TIMES
      • TRACR
      • WELLB
    • Inputs for Initial Conditions
      • EOS1
      • EOS2
      • EOS3
      • EOS4
      • EOS6
      • EOS7
      • EOS9
      • ECO2
      • EWASG
      • TMVOC
    • Geometry Data
      • General Concepts
      • MESHMaker
      • Multiple-continuum processing
    • Inputs for MESHMaker
      • Generation of radially symmetric grids
        • RADII
        • EQUID
        • LOGAR
        • LAYER
      • Generation of rectilinear grids
      • MINC processing for fractured media
    • Adjustment of Computing Parameters at Run-time
  • 9️⃣OUTPUTS
  • 🔟VALIDATION AND APPLICATION EXAMPLES
    • EOS1
      • Problem 1 - Code Demonstration
      • Problem 2 - Heat Sweep in a Vertical Fracture (rvf)
      • Problem 3 - Five-spot Geothermal Production/Injection (rfp)
      • Problem 4 - Coupled Wellbore Flow (r1q)
      • Problem 5 - Five-Spot Geothermal Production/Injection under extremely high temperature
    • EOS2
      • Problem 1 -Five-spot Geothermal Production/Injection (rfp)
    • EOS3
      • Problem 1 - Code Demonstration (eos3p1)
      • Problem 2 - 1D TH Problem with Heating and Gas Source (by Guanlong Guo)
      • Problem 3 - Heat Pipe in Cylindrical Geometry (rhp)
      • Problem 4 - 3D Thermal Consolidation Test, Coupling with FLAC3D Simulator (by Guanlong Guo)
    • EOS4
      • Problem 1 - Code Demonstration (eos4p1)
      • Problem 2 - Heat Pipe in Cylindrical Geometry (rhp)
    • EOS6
      • Problem 1-Validation with EOS2
      • Problem 2-Noble Gas Transport
    • EOS7
      • Problem 1-Multiphase and Nonisothermal Processes in a System with Variable Salinity (rf1)
      • Problem 2-Thermal and Tracer Diffusion (EOS7R/rdif7)
      • Problem 3-Contamination of an Aquifer from VOC Vapors in the Vadose Zone (EOS7R/rdica)
      • Problem 4-Density, Viscosity, Solubility, and Enthalpy of Real Gas Mixtures (EOS7C/SAM7C1)
      • Problem 5-CO2 Injection into a Depleted Gas Reservoir (EOS7C2/SAM7C2)
      • Problem 6- CO2 Injection into a Saturated System (EOS7C/SAM7C3)
      • Problem 7-Density, Viscosity, and Enthalpy of Real Gas Mixtures (EOS7CA/SAM7CA1)
      • Problem 8-CO2 Injection into a Shallow Vadose Zone (EOS7CA/SAM7CA2)
      • Problem 9-Non-Isothermal Compressed Air Energy Storage in Reservoir (by Julien Mouli-Castillo)
    • EOS9
      • Page 1
    • ECO2
      • Problem 1-Demonstration of Initialization Options (ECO2N/rtab)
      • Problem 2-Radial Flow from a CO2 Injection Well (ECO2N/rcc3)
      • Problem 3-CO2 Discharge Along a Fault Zone (ECO2N/r1dv)
      • Problem 4-CO2 Injection into a 2-D Layered Brine Formation (ECO2N/rtp7)
      • Problem 5-Upflow of CO2 along a Deep Fault Zone (ECO2M/r1d)
      • Problem 6-Migration of a CO2 Plume in a Sloping Aquifer, Intersected by a Fault (ECO2M/rwaf)
      • Problem 7-GCS/GHE with a double-porosity reservoir (Case6_50kg_DP/ECO2NV2)
    • EWASG
      • Problem 1 - Brine Density Calculation (dnh)
      • Problem 2 - Production from a Geothermal Reservoir with Hypersaline Brine and CO2 (rhbc)
    • TMVOC
      • Problem 1-Initialization of Different Phase Conditions (r7c)
      • Problem 2-1-D Buckley-Leverett Flow (rblm)
      • Problem 3-Diffusion of components (rdif2)
      • Problem 4-Steam Displacement of a NAPL in a Laboratory Column (rtcem)
      • Problem 5-Steam Displacement of a Benzene-Toluene Mixture in a Laboratory Column (rbt)
      • Problem 6 -Air Displacement of a NAPL from a Laboratory Column (rad)
      • Problem 7-NAPL Spill in the Unsaturated Zone (r2dl)
    • T4.Well
      • Problem 1-Steady-state two-phase flow upward
      • Problem 2-Non-isothermal CO2 flow through a wellbore initially full of water
  • CONCLUSION REMARKS
  • REFERENCES
  • ACKNOWLEDGEMENT
  • Appendix
    • ☑️A: RELATIVE PERMEABILITY FUNCTIONS
      • IRP=1 Linear function
      • IRP=2 Power function
      • IRP=3 Corey's curves
      • IRP=4 Grant's curve
      • IRP=5 Perfectly mobile
      • IRP=6 Fatt and Klikoff function
      • IRP=7 van Genuchten-Mualem Model
      • IRP=8 Verma function
      • IRP=10 Modified Brooks-Corey Model
      • IRP=11 Modified van Genuchten Model
      • IRP=12 Regular hysteresis
      • IRP=13 Simple hysteresis
      • IRP=31 Three phase perfectly mobile
      • IRP=32 Modified Stone's first 3-phase method
      • IRP=33 Three-phase Parker's function
      • IRP=34 Alternative Stone 3-phase
      • IRP=35 Power-law function
      • IRP=36 Faust for two-phase Buckley-Leverett problem
      • IRP=37 Another alternative to Stone function
      • IRP=40 Table lookup
      • IRP=41 User-Defined relative permeability function
    • ☑️B: CAPILLARY PRESSURE FUNCTIONS
      • ICP=1 Linear function
      • ICP=2 Function of Pickens
      • ICP=3 TRUST capillary pressure
      • ICP=4 Milly’s function
      • ICP=6 Leverett’s function
      • ICP=7 van Genuchten function
      • ICP=8 No capillary pressure
      • ICP=10 Modified Brooks-Corey Model
      • ICP=11 Modified van Genuchten Model
      • ICP=12 Regular hysteresis
      • ICP=13 Simple hysteresis
      • ICP=31 Parker et al 3-phase function
      • ICP=32 Parker 3-phase function, alternative 1
      • ICP=33 Parker 3-phase function, alternative 2
      • ICP=34 Parker 3-phase function, alternative 3
      • ICP=40 Table lookup
      • ICP=41 User-Defined capillary pressure function
    • ☑️C: ADDITIONAL PROGRAM OPTIONS
    • ☑️D: DESCRIPTION OF FRACTURED FLOW
      • Multiple Continuum Approaches
      • Active Fracture Modle
Powered by GitBook
On this page
  1. NUMERICAL METHOD

Space and Time Discretization

PreviousNUMERICAL METHODNextInterface Weighting Schemes

Last updated 10 months ago

TOUGH4 uses an integral finite difference method for space discretization, and first-order fully implicit time differencing. The resulting strongly coupled, nonlinear algebraic equations are solved simultaneously using Newton-Raphson iterations for each time step, which involves the calculation of a Jacobian matrix and the solution of a set of linear equations. Time steps are automatically adjusted during a simulation run, depending on the convergence rate of the iteration process. Newton-Raphson increment weighting can also be adjusted if the iterations oscillate.

The continuum equations Eq. (4-1) are discretized in space using the integral finite difference method (IFD; Edwards, 1972; Narasimhan and Witherspoon, 1976). Introducing appropriate volume averages, we have

∫VnMdV =Vn Mn∫_{V_n}MdV =V_n M_n∫Vn​​MdV =Vn​ Mn​ (5-1)

where M is a volume-normalized extensive quantity, and Mn is the average value of M over Vn. Surface integrals are approximated as a discrete sum of averages over surface segments AnmA_{nm}Anm​:

∫ΓnFκ•n dΓ = ∑mAnmFnm∫_{Γ_n}F^κ•n dΓ = ∑_mA_{nm} F_{nm}∫Γn​​Fκ•n dΓ = ∑m​Anm​Fnm​ (5-2)

Here, FnmF_{nm}Fnm​is the average value of the (inward) normal component of F over the surface segment AnmA_{nm}Anm​ between volume elements Vn and Vm. The discretization approach used in the integral finite difference method and the definition of the geometric parameters are illustrated in Figure 7.

The flow term FnmF_{nm}Fnm​ for phase β\betaβ is:

Fβ,nm=−   knm[krβ  ρβμβ]nm  [Pβ,n−Pβ,mDnm  −  ρβ,nmgnm]F_{\beta,nm}=-\;\ k_{nm}\left[\frac{k_{r\beta}\;\rho_\beta}{\mu_\beta}\right]_{nm}\;\left[\frac{P_{\beta,n}-P_{\beta,m}}{D_{nm}}\;-\;\rho_{\beta,nm}g_{nm}\right]Fβ,nm​=− knm​[μβ​krβ​ρβ​​]nm​[Dnm​Pβ,n​−Pβ,m​​−ρβ,nm​gnm​] (5-3)

Space discretization of diffusive flux in multiphase conditions raises some subtle issues. A finite difference formulation for total diffusive flux, Eq. (4-10), may be written as

(fκ)nm=−(Σlκ)nm(Xlκ)m−(Xlκ)nDnm−(Σgκ)nm(Xgκ)m−(Xgκ)nDnm(f^\kappa )_{nm}=-(\Sigma_l^\kappa)_{nm}\frac{(X_l^\kappa)_m-(X_l^\kappa)_n}{D_{nm}}-(\Sigma_g^\kappa)_{nm}\frac{(X_g^\kappa)_m -(X_g^\kappa)_n}{D_{nm}}(fκ)nm​=−(Σlκ​)nm​Dnm​(Xlκ​)m​−(Xlκ​)n​​−(Σgκ​)nm​Dnm​(Xgκ​)m​−(Xgκ​)n​​ (5-4)

This expression involves the as yet unknown diffusive strength coefficients Σlκ)nm\Sigma_l^\kappa)_{nm}Σlκ​)nm​ and Σgκ)nm\Sigma_g^\kappa)_{nm}Σgκ​)nm​ at the interface, which must be expressed in terms of the strength coefficients in the participating grid blocks. Invoking conservation of diffusive flux across the interface between two grid blocks leads in the usual way to the requirement of harmonic weighting of the diffusive strength coefficients. However, such weighting may in general not be applied separately to the diffusive fluxes in gas and liquid phases, because these may be strongly coupled by phase partitioning effects. This can be seen by considering the extreme case of diffusion of a water-soluble and volatile compound from a grid block in single-phase gas conditions to an adjacent grid block which is in single-phase liquid conditions. Harmonic weighting applied separately to liquid and gas diffusive fluxes would result in either of them being zero, because for each phase effective diffusivity is zero on one side of the interface. Thus total diffusive flux would vanish in this case, which is unphysical. In reality, tracer would diffuse through the gas phase to the gas-liquid interface, would establish a certain mass fraction in the aqueous phase by dissolution, and would then proceed to diffuse away from the interface through the aqueous phase. Similar arguments can be made in the less extreme situation where liquid saturation changes from a large to a small value rather than from 1 to 0, as may be the case in the capillary fringe, during infiltration events, or at fracture-matrix interfaces in variably saturated media.

TOUGH4 features a fully coupled approach in which the space-discretized version Eq. (5-4) of the total multiphase diffusive flux Eq. (4-10) is re-written in terms of an effective multiphase diffusive strength coefficient and a single mass fraction gradient. Choosing the liquid mass fraction for this we have

(fκ)nm=−{Σlκ+Σgκ(Xgκ)m−(Xgκ)n(Xlκ)m−(Xlκ)n}nm(Xlκ)m−(Xlκ)nDnm(f^\kappa )_{nm}=-\{\Sigma_l^\kappa+\Sigma_g^\kappa\frac{(X_g^\kappa)_m-(X_g^\kappa)_n}{(X_l^\kappa)_m-(X_l^\kappa)_n}\}_{nm}\frac{(X_l^\kappa)_m-(X_l^\kappa)_n}{D_{nm}}(fκ)nm​=−{Σlκ​+Σgκ​(Xlκ​)m​−(Xlκ​)n​(Xgκ​)m​−(Xgκ​)n​​}nm​Dnm​(Xlκ​)m​−(Xlκ​)n​​ (5-5)

where the gas phase mass fraction gradient has been absorbed into the effective diffusive strength term (in braces). As is well known, flux conservation at the interface then leads to the requirement of harmonic weighting for the full effective strength coefficient. In order to be able to apply this scheme to the general case where not both phases may be present on both sides of the interface, we always define both liquid and gas phase mass fractions in all grid blocks, regardless of whether both phases are present. Mass fractions are assigned in such a way as to be consistent with what would be present in an evolving second phase. This procedure is applicable to all possible phase combinations, including the extreme case where conditions at the interface change from single-phase gas to single-phase liquid. Note that, if the diffusing tracer exists in just one of the two phases, harmonic weighting of the strength coefficient in Eq. (5-5) will reduce to harmonic weighting of either Σlκ\Sigma_l^\kappaΣlκ​ or Σgκ\Sigma_g^\kappaΣgκ​. The simpler scheme of separate harmonic weighting for individual phase diffusive fluxes is retained as an option.

Substituting Eqs. (5-1) and (5-2) into the governing Eq. (4-1), a set of first-order ordinary differential equations in time is obtained:

dMnκdt=1Vn  ∑m  Anm  Fnmκ  +   qnκ\frac{dM_n^\kappa}{dt}=\frac{1}{V_n}\; \sum_{m}{\; A_{nm}\; F_{nm}^\kappa}\;+\; \ q_n^\kappadtdMnκ​​=Vn​1​∑m​Anm​Fnmκ​+ qnκ​ (5-6)

Time is discretized as a first-order finite difference, and the flux and sink and source terms on the right-hand side of Eq. (5-6) are evaluated at the new time level, tk+1=tk+Δtt^{k+1}=t^k+\Delta ttk+1=tk+Δt, to obtain the numerical stability needed for an efficient calculation of multiphase flow. This treatment of flux terms is known as “fully implicit,” because the fluxes are expressed in terms of the unknown thermodynamic parameters at time level k+1, so that these unknowns are only implicitly defined in the resulting equations (see, e.g., Peaceman, 1977). The time discretization results in the following set of coupled nonlinear, algebraic equations

Rnκ,k+1=Mnκ,k+1−Mnκ,k−ΔtVn{∑mAnmFnmκ,k+1+Vnqnκ,k+1}=0R_n^{\kappa,k+1}=M_n^{\kappa,k+1}-M_n^{\kappa,k}-\frac{\Delta t}{V_n}\{\sum_{m}{A_{nm}F_{nm}^{\kappa,k+1}}+ V_nq_n^{\kappa,k+1}\}=0Rnκ,k+1​=Mnκ,k+1​−Mnκ,k​−Vn​Δt​{∑m​Anm​Fnmκ,k+1​+Vn​qnκ,k+1​}=0 (5-7)

where we have introduced residuals Rnκ,k+1R_n^{\kappa,k+1}Rnκ,k+1​. For each volume element (grid block) Vn, there are NEQ mass and heat balance equations (k = 1, 2, ...., NEQ, where NEQ represents the number of equations per grid block). For a flow system with NEL grid blocks, Eq. (5-7) represents a total of NEL x NEQ coupled nonlinear equations. The unknowns are the NEL x NEQ independent primary variables {xix_ixi​; i = 1, ..., NEL x NEQ } which completely define the state of the flow system at time tk+1t^{k+1}tk+1. These equations are solved by Newton-Raphson iteration, which is implemented as follows. We introduce an iteration index p and expand the residuals Rnκ,k+1R_n^{\kappa,k+1}Rnκ,k+1​ in Eq. (5-7) at iteration step p + 1 in a Taylor series in terms of the residuals at index p.

Rnκ,k+1(xi,p+1)= Rnκ,k+1(xi,p)+ ∑i∂Rnκ,k+1∂xi∣p(xi,p+1−xi,p)+...=0R_n^{\kappa,k+1}\left(x_{i,p+1}\right)=\ R_n^{\kappa,k+1}\left(x_{i,p}\right)+\left.\ \sum_{i}\frac{\partial R_n^{\kappa,k+1}}{\partial x_i}\right|_p\left(x_{i,p+1}-x_{i,p}\right)+...=0Rnκ,k+1​(xi,p+1​)= Rnκ,k+1​(xi,p​)+ ∑i​∂xi​∂Rnκ,k+1​​​p​(xi,p+1​−xi,p​)+...=0 (5-8)

Retaining only terms up to first order, we obtain a set of NEL x NEQ linear equations for the increments (xi,p+1−xi,p)(x_{i,p+1}-x_{i,p})(xi,p+1​−xi,p​):

− ∑i∂Rnκ,k+1∂xi∣p(xi,p+1−xi,p)=Rnκ,k+1(xi,p)-\left.\ \sum_{i}\frac{\partial R_n^{\kappa,k+1}}{\partial x_i}\right|_p\left(x_{i,p+1}-x_{i,p}\right)=R_n^{\kappa,k+1}\left(x_{i,p}\right)− ∑i​∂xi​∂Rnκ,k+1​​​p​(xi,p+1​−xi,p​)=Rnκ,k+1​(xi,p​) (5-9)

All terms ∂Rn/∂xi\partial R_n/\partial x_i ∂Rn​/∂xi​ in the Jacobian matrix are evaluated by numerical differentiation. Eq. (5-9) is solved by the linear equations solver selected. Iteration is continued until the residuals Rnκ,k+1R_n^{\kappa,k+1}Rnκ,k+1​ are reduced below a preset convergence tolerance.

∣Rn,p+1κ,k+1Mn,p+1κ,k+1∣≤ε1\left|\frac{R_{n,p+1}^{\kappa,k+1}}{M_{n,p+1}^{\kappa,k+1}}\right|\le\varepsilon_1​Mn,p+1κ,k+1​Rn,p+1κ,k+1​​​≤ε1​ (5-10)

The default (relative) convergence criterion is ε1=10−5\varepsilon_1=10^{-5}ε1​=10−5. When the accumulation terms are smaller than ε2\varepsilon_2ε2​(default ε2=1\varepsilon_2=1ε2​=1), an absolute convergence criterion is imposed,

Rnκ,k+1≤ε1.ε2R_n^{\kappa,k+1} \le \varepsilon_1 . \varepsilon_2 Rnκ,k+1​≤ε1​.ε2​ (5-11)

Convergence is usually attained in 3 to 4 iterations. If convergence cannot be achieved within a certain number of iterations (default 8), the time step size Dt is reduced and a new iteration process is started.

It is appropriate to add some comments about this space discretization technique. The entire geometric information of the space discretization in Eq. (5-7) is provided in the form of a list of grid block volumes VnV_nVn​, interface areas AnmA_{nm}Anm​, nodal distances DnmD_{nm}Dnm​ and components gnmg_{nm}gnm​ of gravitational acceleration along nodal lines. There is no reference whatsoever to a global system of coordinates, or to the dimensionality of a particular flow problem, but special attention must be paid to the wellbore simulation which requires the z coordinates for calculation of potential energy. The discretized equations are in fact valid for arbitrary irregular discretizations in one, two or three dimensions, and for porous as well as for fractured media. This flexibility should be used with caution, however, because the accuracy of solutions depends upon the accuracy with which the various interface parameters in equations such as Eq. (5-3) can be expressed in terms of average conditions in grid blocks. A general requirement is that there exists approximate thermodynamic equilibrium in (almost) all grid blocks at (almost) all times (Pruess and Narasimhan, 1985). For systems of regular grid blocks referenced to global coordinates (such as r - z or x - y - z), Eq. (5-7) is identical to a conventional finite difference formulation (e.g., Peaceman, 1977; Moridis and Pruess, 1992).

where the subscripts (nm) denote a suitable averaging at the interface between grid blocks n and m (such as interpolation, harmonic weighting, and upstream weighting, which will be discussed in section for . Dnm=Dn+DmD_{nm}=D_n+D_mDnm​=Dn​+Dm​is the distance between the nodal points n and m, and gnmg_{nm}gnm​ is the component of gravitational acceleration in the direction from m to n.

In TOUGH4, we also adopt the maximum change of primary variables (the solutions of eq. (5-9)) as another convergence criterion. Convergence is attained once the maximum solutions of the eq. (5-9) is less than the given criterion. This approach is helpful for some specific situation, such as Mn,p+1κ,k+1M_{n,p+1}^{\kappa,k+1}Mn,p+1κ,k+1​ is very small. Different primary variables may have different criterion. In TOUGH4, three criteria are used for pressure type, saturation/mass fraction type, and temperature type primary variables, respectively (see input Record ).

5️⃣
Interface Weighting Schemes
PARAM.3
Figure 7. Space discretization and geometry data in the integral finite difference method.