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. CODE COMPILATION AND INSTALLATION
  2. Code Compilation

2. Compilation of TOUGH4 on Linux-like platform

On Linux-like platforms (e.g., Linux, Mac, Cygwin, and WSL on Windows), TOUGH4 provides an automatic build system that utilizes CMake (http://www.cmake.org/) and a shell script configure.sh (in the working folder ./toguh4 ). CMake uses simple configuration files placed in each source directory (the CMakeLists.txt files) to generate standard build files. Compilation of third-party solver libraries may involve complex multi-step processes. If their compilations are fully integrated into the TOUGH automatic build system, the TOUGH build process may become too complex and lack robustness. The installation of the requested linear solver libraries is required before starting TOUGH4 compilation. The following are examples for installation of PETSC and TRILINOS. Users can always find more information online for installation of these two software or other linear solver libraries that are ready for TOUGH4.

(1) Installation of PETSC

The TOUGH4 needs a newer version of PETSC. We would suggest using the newest available stable version (the newer version seems to perform better). PETSC can be installed anywhere in your computer system. We would suggest installing it in your home directory. Following several options for configuring the PETSC installation may be helpful for late TOUGH installation:

--with-debugging=0, optimized library for better performance.

--download-mpich, if no MPI installed in your computer.

--download-fblaslapack, if no BLAS and LAPACK installed in your computer. They are also required by the TRILINOS installation.

--download-hypre, HYPRE package provides some efficient preconditioners.

--with-shared-libraries=0, will build static library.

--PETSC_ARCH=arch-t3, TOUGH default arch. If you use it, you do not need to specify the PETSC_ARCH when configuring TOUGH installation.

Following are the steps for PETSC installation:

(1) Copy installation package ‘petsc-lite-3.17.0.tar.gz’ to you home directory:

(2) Unzip and untar the compressed file:

· cd ~

· tar –xf ./petsc-lite-3.17.0.tar.gz

(3) Configure and build PETSC:

· cd petsc-3.17.0

· ./configure --with-debugging=0 --download-fblaslapack --with-shared-libraries=0 --PETSC_ARCH=arch-t3 --download-hypre

· make

You need to find out the installed PETSC directory (PETSC_DIR, can be found by typing pwd in ~/petsc-3.17.0) and name of build directory (PETSC_ARCH, it is arch-t3 if you specified it as PETSC_ARCH=arch-t3 during the configuration), which are needed in TOUGH installation.

(2) Installation of TRILINOS

TRILINOS is another well-known powerful tool for solving linear equations. Users can download it from github. Following are the steps for installation of TRILINOS:

(1) Unzip the downloaded package into folder ~/Trilinos-master

(2) Create a folder named “build” inside the ~/Trilinos-master

(3) cd ~/Trilinos-master/build, then type:

cmake \

-DTrilinos_ENABLE_Epetra=ON \

-DTrilinos_ENABLE_Ifpack=ON \

-DTrilinos_ENABLE_AztecOO=ON \

-DTrilinos_ENABLE_Teuchos=ON \

-DTrilinos_ENABLE_ML=ON \

-DTrilinos_VERBOSE_CONFIGURE=OFF \

-DTPL_ENABLE_MPI=ON \

-DBUILD_SHARED_LIBS=OFF \

-D Trilinos_ENABLE_OpenMP=ON \

-DCMAKE_VERBOSE_MAKEFILE=OFF \

-D TPL_ENABLE_MKL=OFF \

-D MKL_LIBRARY_DIRS="$MKL_LIB/intel64" \

-D TPL_ENABLE_BLAS=ON \

-D TPL_ENABLE_LAPACK=ON \

-DTPL_BLAS_LIBRARIES="~ /petsc-3.8.4/arch-linux2-c-opt/lib/libfblas.a" \

-DTPL_LAPACK_LIBRARIES="~/petsc-3.8.4/arch-linux2-c-opt/lib/libflapack.a" \

-DCMAKE_BUILD_TYPE=RELEASE \

-DCMAKE_INSTALL_PREFIX:PATH="../" \

../

The above lines are the parameters for cmake. It is required to input as one execution command. A simple way for users is to copy the whole chuck of the lines and then paste them to the Linux command line. For user convenience, a batch file (cmake_trilinos) is provided for executing this command in the TOUGH installation package. It is important to note that the parameters TPL_BLAS_LIBRARIES and TPL_LAPACK_LIBRARIES must be changed to the directories where libfblas.a and libflapack.a are located in your computer (if you installed the PETSC successfully, you may find these two files in the /lib directory). The two .a files are the compiled BLAS and LAPACK static library files.

(4) make –jn

n is the number of computing cores that will be used for the compilation. It should not be more than the number of cores that the working computer has.

(5) make install

If for some reason the compilation of TRILINOS is fail. You need delete the “build” folder and repeat the steps 2-5.

Once the installation of requested linear solvers is ready, the build of TOUGH4 is straightforward. Compilation and installation can be done by running the configure.sh script. If the PETSC is requested, two parameters, petsc-dir and petsc-arch must be provided. The parameter petsc-dir specifies the installed PETSC directory and petsc-arch gives the build name. The build name is the name of PETSC build directory. The default PETSC build directory can be found in the PETSC installation directory (see Figure 6).

If other solvers are requested, their installation directories must be provided through “dir” parameter, e.g the Trilinos, --trilinos-dir. Other directories for requested libraries can be inputted in the similar way, e,g, --opencl-dir provides the directory where the OPENCL library (libOpenCL.so) is located.

Following gives the examples of different installation options:

(1) For installation with only default linear solvers (AMGCL and/or VIENNACL)

./configure.sh --build-type=RELEASE --no-x11

(2) For installation with PETSC and TRILINOS linear solvers

./configure.sh --build-type=RELEASE --no-x11 --petsc-dir=$PETSC-DIR --petsc-arch=$PETSC-ARCH --trilinos-dir=$TRILINOS-DIR, such as:

./configure.sh --build-type=RELEASE --no-x11 --petsc-dir=/home/keniz/petsc-3.17.0 --trilinos-dir=/home/keniz/Trilinos-master

(3) For installation including VIENNACL linear solver with OPENCL (GPU) support.

./configure.sh --build-type=RELEASE --no-x11 –opencl-dir=$OPENCL-DIR

If you use arch-t3 as the build name during installation of PETSC, you do not need specifying --petsc-arch parameter. The installation options must be consistent with the definition in “toughSetUp.fi”. For example, if you designed in “toughSetUp.fi” to include the Trilinos in the TOUGH executable, but do not provide correct --trilinos-dir during compilation, the compilation will fail.

A list of available options can be displayed by executing “./configure.sh --help”. If TOUGH4 is successfully built, an executable named toughv4 will be created in the folder install/bin.

Previous1. Compilation of TOUGH4 using Visual StudioNextInstallation

Last updated 9 months ago

3️⃣
Figure 6. An example of PETSC installation, which has --petsc-dir= /home/keniz/petsc-3.7.4 and --petsc-arch=arch-linux2-c-debug.