diff --git a/doc/requirements.txt b/doc/requirements.txt index 0b15d3aa..618b6603 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -5,4 +5,5 @@ sphinx-argparse sphinx-gallery pydata-sphinx-theme sphinxcontrib-bibtex -pybtex-apa-style \ No newline at end of file +pybtex-apa-style +sphinx_subfigure \ No newline at end of file diff --git a/doc/source/_static/css/custom.css b/doc/source/_static/css/custom.css new file mode 100644 index 00000000..c105353b --- /dev/null +++ b/doc/source/_static/css/custom.css @@ -0,0 +1,9 @@ +html[data-theme="light"] { + --pst-color-link: #0274be; + --pst-color-primary: black; +} + +html[data-theme="dark"] { + --pst-color-link: #0274be; + --pst-color-primary: white; +} \ No newline at end of file diff --git a/doc/source/_static/logo.png b/doc/source/_static/logo.png new file mode 100644 index 00000000..be4a31e4 Binary files /dev/null and b/doc/source/_static/logo.png differ diff --git a/doc/source/conf.py b/doc/source/conf.py index c63e2143..e0e2fdca 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -42,8 +42,9 @@ "sphinx.ext.githubpages", "sphinx.ext.napoleon", "sphinxarg.ext", - # "sphinxcontrib.bibtex", + "sphinxcontrib.bibtex", "sphinx_gallery.gen_gallery", + "sphinx_subfigure", ] # Sphinx Gallery settings @@ -85,11 +86,14 @@ # napoleon_use_rtype = True # Numfig settings -numfig = False +numfig = True numfig_format = { "figure": "Figure %s", } +# BibTeX +bibtex_bibfiles = ["references.bib"] + # Add any paths that contain templates here, relative to this directory. templates_path = [ "_templates", @@ -120,13 +124,19 @@ # a list of builtin themes. # html_theme = "pydata_sphinx_theme" +html_logo = "_static/logo.png" html_theme_path = [ "_themes", ] +html_context = { + "default_mode": "light", +} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -# html_static_path = [ -# "_static", -# ] \ No newline at end of file +html_static_path = ["_static"] + +html_css_files = [ + "css/custom.css", +] \ No newline at end of file diff --git a/doc/source/guide/index.rst b/doc/source/guide/index.rst index 02ac76f0..dec9affd 100644 --- a/doc/source/guide/index.rst +++ b/doc/source/guide/index.rst @@ -5,4 +5,5 @@ User Guide :titlesonly: :maxdepth: 2 + installation input diff --git a/doc/source/guide/installation.rst b/doc/source/guide/installation.rst new file mode 100644 index 00000000..28e9afd8 --- /dev/null +++ b/doc/source/guide/installation.rst @@ -0,0 +1,12 @@ +Installation +============ + +**toughio** only requires a Python distribution to be installed. If you don't have any yet, we recommend to install the `Anaconda Distribution `_ with the default options. + +To install **toughio** and enable all its features, simply run the command in a terminal (e.g., Windows Terminal, Anaconda Prompt) or within an IPython shell: + +.. code-block:: + + pip install toughio[full] + +An IDE such as Spyder (automatically installed by Anaconda) or `VSCode `_ is strongly recommended to use **toughio**. \ No newline at end of file diff --git a/doc/source/index.rst b/doc/source/index.rst index 3519019a..b81c9435 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -8,3 +8,4 @@ guide/index examples/index api/index + tough3/index diff --git a/doc/source/references.bib b/doc/source/references.bib new file mode 100644 index 00000000..c7476b68 --- /dev/null +++ b/doc/source/references.bib @@ -0,0 +1,1055 @@ +@book{altunin1975thermophysical, + title={Thermophysical properties of carbon dioxide}, + author={Altunin, VV}, + year={1975}, + publisher={Wellingborough, Collets} +} + +@inproceedings{andersen1992accurate, + title={An accurate PVT model for geothermal fluids as represented by H2O-NaCl-CO2}, + author={Andersen, G and Probst, A and Murray, L and Butler, S}, + booktitle={Mixtures, Proceedings 17th Workshop on Geothermal Reservoir Engineering}, + year={1992}, + organization={Citeseer} +} + +@article{atkinson1980behavior, + title={Behavior of the Bagnore steam/CO2 geothermal reservoir, Italy}, + author={Atkinson, PG and Celati, R and Corsi, R and Kucuk, F}, + journal={Society of Petroleum Engineers Journal}, + volume={20}, + number={04}, + pages={228--238}, + year={1980}, + publisher={OnePetro} +} + +@techreport{aunzo1991wellbore, + title={Wellbore models GWELL, GWNACL, and HOLA user's guide}, + author={Aunzo, Zosimo P and Bjornsson, G and Bodvarsson, GS}, + year={1991}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@article{aziz1979petroleum, + title={Petroleum reservoir simulation. 1979}, + author={Aziz, Khalid and Settari, Antonin}, + journal={Applied Science Publ. Ltd., London, UK}, + year={1979} +} + +@article{balay2016petsc, + title={PETSc users manual (Tech. Rep. ANL-95/11-Revision 3.7)}, + author={Balay, Satish and Abhyankar, Shrirang and Adams, Mark F and Brown, Jed and Brune, Peter and Buschelman, Kris and Dalcin, Lisandro and Eijkhout, Victor and Gropp, William D and Kaushik, Dinesh and others}, + journal={Argonne National Laboratory}, + year={2016} +} + +@article{battistelli1997simulator, + title={The simulator TOUGH2/EWASG for modelling geothermal reservoirs with brines and non-condensible gas}, + author={Battistelli, Alfredo and Calore, Claudio and Pruess, Karsten}, + journal={Geothermics}, + volume={26}, + number={4}, + pages={437--464}, + year={1997}, + publisher={Elsevier} +} + +@article{battistelli2004modeling, + title={Modeling biodegradation of organic contaminants under multiphase conditions with TMVOCBio}, + author={Battistelli, Alfredo}, + journal={Vadose Zone Journal}, + volume={3}, + number={3}, + pages={875--883}, + year={2004}, + publisher={Soil Science Society of America} +} + +@inproceedings{battistelli2012improving, + title={Improving the treatment of saline brines in EWASG for the simulation of hydrothermal systems}, + author={Battistelli, Alfredo}, + booktitle={Proceedings of the TOUGH Symposium}, + pages={192--200}, + year={2012} +} + +@book{brooks1965hydraulic, + title={Hydraulic properties of porous media}, + author={Brooks, Royal Harvard}, + year={1965}, + publisher={Colorado State University} +} + +@book{carlslaw1959conduction, + title={Conduction of Heat in Solids, Oxford}, + author={Carlslaw, HS and Jaeger, JC}, + year={1959}, + publisher={Oxford University Press} +} + +@article{cass1984enhancement, + title={Enhancement of thermal water vapor diffusion in soil}, + author={Cass, A and Campbell, GS and Jones, TL}, + journal={Soil Science Society of America Journal}, + volume={48}, + number={1}, + pages={25--32}, + year={1984}, + publisher={Wiley Online Library} +} + +@techreport{charbeneau2007distribution, + title={Distribution and Recovery Model (LDRM) Volume 1: Distribution and Recovery of Petroleum Hydrocarbon Liquids in Porous Media}, + author={Charbeneau, Randall}, + year={2007}, + institution={American Petroleum Institute API} +} + +@inproceedings{coats1977geothermal, + title={Geothermal reservoir modelling}, + author={Coats, KH}, + booktitle={SPE Annual Fall Technical Conference and Exhibition}, + year={1977}, + organization={OnePetro} +} + +@techreport{coats1982effects, + title={Effects of grid type and difference scheme on pattern steamflood simulation results}, + author={Coats, KH and Ramesh, AB}, + year={1982}, + institution={Intercomp Resource Dev. and Engr. Inc.} +} + +@article{corey1954interrelation, + title={The interrelation between gas and oil relative permeabilities}, + author={Corey, Arthur T}, + journal={Producers monthly}, + pages={38--41}, + year={1954} +} + +@book{cygan1991solubility, + title={The solubility of gases in NaCl brine and a critical evaluation of available data}, + author={Cygan, Randall T}, + year={1991}, + publisher={Sandia National Laboratories Albuquerque} +} + +@article{dean1999lange, + title={Lange's handbook of chemistry. McGraw-Hill}, + author={Dean, John A}, + journal={New York}, + year={1999} +} + +@techreport{de1986quantitative, + title={Quantitative hydrogeology}, + author={De Marsily, Ghislain}, + year={1986}, + institution={Paris School of Mines, Fontainebleau} +} + +@article{doughty2007modeling, + title={Modeling geologic storage of carbon dioxide: comparison of non-hysteretic and hysteretic characteristic curves}, + author={Doughty, Christine}, + journal={Energy Conversion and Management}, + volume={48}, + number={6}, + pages={1768--1781}, + year={2007}, + publisher={Elsevier} +} + +@techreport{doughty2013user, + title={User's Guide for Hysteretic Capillary Pressure and Relative Permeability Functions in TOUGH2 Earth Sciences Division Lawrence Berkeley National Laboratory}, + author={Doughty, C}, + year={2013}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@article{driesner2007system1, + title={The system H2O--NaCl. Part I: Correlation formulae for phase relations in temperature--pressure--composition space from 0 to 1000 C, 0 to 5000 bar, and 0 to 1 XNaCl}, + author={Driesner, Thomas and Heinrich, Christoph A}, + journal={Geochimica et Cosmochimica Acta}, + volume={71}, + number={20}, + pages={4880--4901}, + year={2007}, + publisher={Elsevier} +} + +@article{driesner2007system2, + title={The system H2O--NaCl. Part II: Correlations for molar volume, enthalpy, and isobaric heat capacity from 0 to 1000 C, 1 to 5000 bar, and 0 to 1 XNaCl}, + author={Driesner, Thomas}, + journal={Geochimica et Cosmochimica Acta}, + volume={71}, + number={20}, + pages={4902--4919}, + year={2007}, + publisher={Elsevier} +} + +@article{edlefsen1943thermodynamics, + title={Thermodynamics of soil moisture}, + author={Edlefsen, N and Anderson, Alfred and others}, + journal={Hilgardia}, + volume={15}, + number={2}, + pages={31--298}, + year={1943}, + publisher={University of California, Agriculture and Natural Resources} +} + +@techreport{edwards1966trump, + title={TRUMP: A computer program for transient and steady-state temperature distributions in multidimensional systems}, + author={Edwards, Arthur L}, + year={1966}, + institution={Lawrence Radiation Lab., Univ. of California, Livermore} +} + +@misc{evans1982atomic, + title={The atomic nucleus. Reprint edition}, + author={Evans, RD}, + year={1982}, + publisher={Robert E. Krieger Publ. Co., Malabar, FL} +} + +@article{fatt1959effect, + title={Effect of fractional wettability on multiphase flow through porous media}, + author={Fatt, Irving and Klikoff, Waldemar A}, + journal={Journal of Petroleum Technology}, + volume={11}, + number={10}, + pages={71--76}, + year={1959}, + publisher={OnePetro} +} + +@article{faust1985transport, + title={Transport of immiscible fluids within and below the unsaturated zone: A numerical model}, + author={Faust, Charles R}, + journal={Water Resources Research}, + volume={21}, + number={4}, + pages={587--596}, + year={1985}, + publisher={Wiley Online Library} +} + +@article{finley1982swift, + title={Swift Self-Teaching Curriculum}, + author={Finley, NC and Reeves, M}, + journal={Report SAND81-0410, Sandia National Laboratory, Albuquerque, NM}, + year={1982} +} + +@techreport{garcia2001density, + title={Density of aqueous solutions of CO2}, + author={Garcia, Julio E}, + year={2001}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@book{garcia2003fluid, + title={Fluid dynamics of carbon dioxide disposal into saline aquifers}, + author={Garcia, Julio Enrique}, + year={2003}, + publisher={University of California, Berkeley} +} + +@article{ghezzehei2004modeling, + title={Modeling coupled evaporation and seepage in ventilated cavities}, + author={Ghezzehei, TA and Trautz, RC and Finsterle, S and Cook, PJ and Ahlers, CF}, + journal={Vadose Zone Journal}, + volume={3}, + number={3}, + pages={806--818}, + year={2004}, + publisher={Wiley Online Library} +} + +@article{grant1977permeability, + title={Permeability Reduction Factors at Wairakei, paper present at AICHE ASME Heat Transfer Conference}, + author={Grant, MA}, + journal={Am. Inst. of Chem. Eng., Am. Soc. of Mech. Eng., Salt Lake City, Utah, 1977}, + year={1977} +} + +@article{hadgu1990multi, + title={A multi-purpose wellbore simulator}, + author={Hadgu, T}, + journal={Geothermal Research Council. Trans.}, + volume={14}, + pages={1279--1286}, + year={1990} +} + +@article{hadgu1995coupled, + title={Coupled reservoir-wellbore simulation of geothermal reservoir behavior}, + author={Hadgu, Teklu and Zimmerman, Robert W and Bodvarsson, Gudmundur S}, + journal={Geothermics}, + volume={24}, + number={2}, + pages={145--166}, + year={1995}, + publisher={Elsevier} +} + +@article{haas1976physical, + title={Physical Properties of the Coexisting Phases and Thermochemical Properties of the H2O Component in Boiling NaCl solutions}, + author={Haas, John L}, + journal={USGS Bulletin}, + year={1976} +} + +@article{herbert1988coupled, + title={Coupled groundwater flow and solute transport with fluid density strongly dependent upon concentration}, + author={Herbert, AW and Jackson, CP and Lever, DA}, + journal={Water Resources Research}, + volume={24}, + number={10}, + pages={1781--1795}, + year={1988}, + publisher={Wiley Online Library} +} + +@article{himmelblau1959partial, + title={Partial Molar Heats and Entropies of Solution for Gases Dissolved in Water from the Freezing to Near the Critical Point}, + author={Himmelblau, DM}, + journal={The Journal of Physical Chemistry}, + volume={63}, + number={11}, + pages={1803--1808}, + year={1959}, + publisher={ACS Publications} +} + +@article{hirschfelder1964molecular, + title={Molecular theory of gases and liquids}, + author={Hirschfelder, Joseph Oakland and Curtiss, Charles F and Bird, R Byron}, + journal={Molecular theory of gases and liquids}, + year={1964} +} + +@article{ifc1967formulation, + title={Formulation of the Thermodynamic Properties of Ordinary Water Substance}, + author={IFC, A}, + journal={International Formulation Committee (IFC) Secretariat, Dusseldorf, Germany}, + year={1967} +} + +@techreport{jung2017user, + title={User's guide for biodegradation reactions in TMVOCBio}, + author={Jung, Yoojin and Battistelli, Alfredo}, + year={2017}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@article{klinkenberg1941permeability, + title={The permeability of porous media to liquids and gases}, + author={Klinkenberg, LJ}, + journal={Am. Petrol. Inst., Drilling and Production Practice}, + volume={2}, + pages={200--213}, + year={1941} +} + +@book{kruger1974stimulation, + title={Stimulation and reservoir engineering of geothermal resources}, + author={Kruger, Paul and Ramey, Henry J}, + year={1974}, + publisher={Stanford University Stanford, Calif} +} + +@article{lam1988analysis, + title={Analysis of the Stanford geothermal reservoir model experiments using the LBL reservoir simulator}, + author={Lam, ST and Hunsbedt, A and Kruger, P and Pruess, K}, + journal={Geothermics}, + volume={17}, + number={4}, + pages={595--605}, + year={1988}, + publisher={Elsevier} +} + +@article{land1968calculation, + title={Calculation of imbibition relative permeability for two-and three-phase flow from rock properties}, + author={Land, Carlon S}, + journal={Society of Petroleum Engineers Journal}, + volume={8}, + number={02}, + pages={149--156}, + year={1968}, + publisher={OnePetro} +} + +@article{lenhard1987model, + title={A model for hysteretic constitutive relations governing multiphase flow: 2. Permeability-saturation relations}, + author={Lenhard, RJ and Parker, JC}, + journal={Water Resources Research}, + volume={23}, + number={12}, + pages={2197--2206}, + year={1987}, + publisher={Wiley Online Library} +} + +@article{leverett1941capillary, + title={Capillary behavior in porous solids}, + author={Leverett, MoC}, + journal={Transactions of the AIME}, + volume={142}, + number={01}, + pages={152--169}, + year={1941}, + publisher={OnePetro} +} + +@article{liu1998active, + title={An active fracture model for unsaturated flow and transport in fractured rocks}, + author={Liu, HH and Doughty, C and Bodvarsson, GS}, + journal={Water Resources Research}, + volume={34}, + number={10}, + pages={2633--2646}, + year={1998}, + publisher={Wiley Online Library} +} + +@misc{loomis1928solubilities, + title={Solubilities of Gases in Water, in: International Critical Tables, Vol. III, E. W. Washburn}, + author={Loomis, AG}, + year={1928}, + publisher={McGraw-Hill Inc} +} + +@article{lorenz2000analytische, + title={Eine analytische Funktion zur Bestimmung der Enthalpie w{\"a}ssriger NaCl L{\"o}sungen, draft report}, + author={Lorenz, S and Maric, D and Rirschl, C}, + journal={Institut f{\"u}r Sicherheitstechnologie, K{\"o}ln, Germany}, + year={2000} +} + +@article{luckner1989consistent, + title={A consistent set of parametric models for the two-phase flow of immiscible fluids in the subsurface}, + author={Luckner, L and Van Genuchten, M Th and Nielsen, DR}, + journal={Water Resources Research}, + volume={25}, + number={10}, + pages={2187--2193}, + year={1989}, + publisher={Wiley Online Library} +} + +@book{mason1983gas, + title={Gas transportin porous media: the dusty-gas model}, + author={Mason, Edward Allen and AP, MALINAUSKAS}, + year={1983}, + publisher={Elsevier} +} + +@article{millington1961permeability, + title={Permeability of porous solids}, + author={Millington, RJ and Quirk, JP}, + journal={Transactions of the Faraday Society}, + volume={57}, + pages={1200--1207}, + year={1961}, + publisher={Royal Society of Chemistry} +} + +@article{milly1982moisture, + title={Moisture and heat transport in hysteretic, inhomogeneous porous media: A matric head-based formulation and a numerical model}, + author={Milly, P Christopher D}, + journal={Water Resources Research}, + volume={18}, + number={3}, + pages={489--498}, + year={1982}, + publisher={Wiley Online Library} +} + +@techreport{moridis1992tough, + title={TOUGH Simulations of the Updegraff's Set of Fluid and Heat Flow Problems}, + author={Moridis, George J}, + year={1992}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@techreport{moridis1995flow, + title={Flow and transport simulations using T2CG1, a package of conjugate gradient solvers for the TOUGH2 family of codes}, + author={Moridis, George J and Pruess, Karsten}, + year={1995}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@article{moridis1998t2solv, + title={T2SOLV: An enhanced package of solvers for the TOUGH2 family of reservoir simulation codes}, + author={Moridis, George J and Pruess, Karsten}, + journal={Geothermics}, + volume={27}, + number={4}, + pages={415--444}, + year={1998}, + publisher={Elsevier} +} + +@article{mualem1976new, + title={A new model for predicting the hydraulic conductivity of unsaturated porous media}, + author={Mualem, Yechezkel}, + journal={Water resources research}, + volume={12}, + number={3}, + pages={513--522}, + year={1976}, + publisher={Wiley Online Library} +} + +@inproceedings{murray1993toward, + title={Toward integrating geothermal reservoir and wellbore simulation: TETRAD and WELLSIM}, + author={Murray, L}, + booktitle={Proceedings of the 15th New Zealand Geothermal Workshop 1993}, + year={1993} +} + +@article{narasimhan1976integrated, + title={An integrated finite difference method for analyzing fluid flow in porous media}, + author={Narasimhan, TN and Witherspoon, PA}, + journal={Water Resources Research}, + volume={12}, + number={1}, + pages={57--64}, + year={1976}, + publisher={Wiley Online Library} +} + +@article{narasimhan1978numerical, + title={Numerical model for saturated-unsaturated flow in deformable porous media: 3. Applications}, + author={Narasimhan, Thiruppudaimarudhur N and Witherspoon, PA}, + journal={Water Resources Research}, + volume={14}, + number={6}, + pages={1017--1034}, + year={1978}, + publisher={Wiley Online Library} +} + +@techreport{oldenburg1995eos7r, + title={EOS7R: Radionuclide transport for TOUGH2}, + author={Oldenburg, Curtis M and Pruess, Karsten}, + year={1995}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@techreport{oldenburg2004eos7c, + title={EOS7C Version 1.0: TOUGH2 Module for Carbon Dioxide or Nitrogen inNatural Gas (Methane) Reservoirs}, + author={Oldenburg, Curtis M and Moridis, George J and Spycher, Nicholas and Pruess, Karsten}, + year={2004}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@techreport{oldenburg2015eos7ca, + title={EOS7CA Version 1.0: TOUGH2 module for gas migration in shallow subsurface porous media systems}, + author={Oldenburg, Curtis M}, + year={2015}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@article{o1985fluid, + title={Fluid and heat flow in gas-rich geothermal reservoirs}, + author={O'Sullivan, MJ and Bodvarsson, GS and Pruess, K and Blakeley, MR}, + journal={Society of Petroleum Engineers Journal}, + volume={25}, + number={02}, + pages={215--226}, + year={1985}, + publisher={OnePetro} +} + +@article{pan2014t2well, + title={T2Well—an integrated wellbore--reservoir simulator}, + author={Pan, Lehua and Oldenburg, Curtis M}, + journal={Computers \& Geosciences}, + volume={65}, + pages={46--55}, + year={2014}, + publisher={Elsevier} +} + +@article{pan2015eco2n, + title={ECO2N V2. 0: A TOUGH2 fluid property module for mixtures of water, NaCl, and CO2}, + author={Pan, Lehua and Spycher, Nicolas and Doughty, Christine and Pruess, Karsten}, + journal={Scientific report LBNL-6930E}, + year={2015} +} + +@article{parker1987model, + title={A model for hysteretic constitutive relations governing multiphase flow: 1. Saturation-pressure relations}, + author={Parker, JC and Lenhard, RJ}, + journal={Water Resources Research}, + volume={23}, + number={12}, + pages={2187--2196}, + year={1987}, + publisher={Wiley Online Library} +} + +@article{parker1987parametric, + title={A parametric model for constitutive properties governing multiphase flow in porous media}, + author={Parker, JC and Lenhard, RJ and Kuppusamy, T}, + journal={Water Resources Research}, + volume={23}, + number={4}, + pages={618--624}, + year={1987}, + publisher={Wiley Online Library} +} + +@techreport{patterson2012simple, + title={A Simple History-Dependent Nonwetting-Phase Trapping Model for the TOUGH Simulators}, + author={Patterson, Christopher G and Falta, Ronald W}, + year={2012}, + institution={Illinois State Geological Survey} +} + +@book{peaceman2000fundamentals, + title={Fundamentals of numerical reservoir simulation}, + author={Peaceman, Donald W}, + year={2000}, + publisher={Elsevier} +} + +@article{peaceman1983interpretation, + title={Interpretation of well-block pressures in numerical reservoir simulation with nonsquare grid blocks and anisotropic permeability}, + author={Peaceman, Donald W}, + journal={Society of Petroleum Engineers Journal}, + volume={23}, + number={03}, + pages={531--543}, + year={1983}, + publisher={OnePetro} +} + +@techreport{phillips1981technical, + title={A technical databook for geothermal energy utilization}, + author={Phillips, SL}, + year={1981}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@article{pickens1979finite, + title={Finite-element analysis of the transport of water and solutes in title-drained soils}, + author={Pickens, John F and Gillham, Robert W and Cameron, Douglas R}, + journal={Journal of Hydrology}, + volume={40}, + number={3-4}, + pages={243--264}, + year={1979}, + publisher={Elsevier} +} + +@article{potter1977volumetric, + title={The Volumetric Properties of Aqueous Sodium Chloride Solutions}, + author={Potter, JM and Brown, David L}, + journal={US Geological Survey, Bulletin}, + year={1977} +} + +@book{prausnitz1998molecular, + title={Molecular thermodynamics of fluid-phase equilibria}, + author={Prausnitz, John M and Lichtenthaler, Rudiger N and De Azevedo, Edmundo Gomes}, + year={1998}, + publisher={Pearson Education} +} + +@techreport{pritchett1981baca, + title={Baca geothermal demonstration project. Equation-of-state for water-carbon dioxide mixtures: Implications for Baca reservoir}, + author={Pritchett, JW and Rice, MH and Riney, TD}, + year={1981}, + institution={Systems, Science and Software, La Jolla, CA (USA)} +} + +@techreport{pruess1983gminc, + title={GMINC: A mesh generator for flow simulations in fractured reservoirs}, + author={Pruess, Karsten}, + year={1983}, + institution={Lawrence Berkeley Lab., CA (USA)} +} + +@techreport{pruess1987tough, + title={TOUGH user's guide}, + author={Pruess, Karsten}, + year={1987}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@techreport{pruess1991tough2, + title={TOUGH2: A general-purpose numerical simulator for multiphase nonisothermal flows}, + author={Pruess, K}, + year={1991}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@techreport{pruess1999tough2, + title={TOUGH2 user's guide version 2}, + author={Pruess, Karsten and Oldenburg, Curtis M and Moridis, GJ}, + year={1999}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@techreport{pruess2011eco2m, + title={ECO2M: a TOUGH2 fluid property module for mixtures of water, NaCl, and CO2, including super-and sub-critical conditions, and phase change between liquid and gaseous CO2}, + author={Pruess, Karsten}, + year={2011}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@article{pruess2004tough, + title={The TOUGH codes—A family of simulation tools for multiphase flow and transport processes in permeable media}, + author={Pruess, Karsten}, + journal={Vadose zone journal}, + volume={3}, + number={3}, + pages={738--746}, + year={2004}, + publisher={Wiley Online Library} +} + +@book{pruess2005eco2n, + title={ECO2N: A TOUGH2 fluid property module for mixtures of water, NaCl, and CO2}, + author={Pruess, Karsten}, + year={2005}, + publisher={eScholarship, University of California} +} + +@article{pruess1982fluid, + title={On fluid reserves and the production of superheated steam from fractured, vapor-dominated geothermal reservoirs}, + author={Pruess, KARSTEN and Narasimhan, TN}, + journal={Journal of Geophysical Research: Solid Earth}, + volume={87}, + number={B11}, + pages={9329--9339}, + year={1982}, + publisher={Wiley Online Library} +} + +@inproceedings{pruess1983seven, + title={A seven-point finite difference method for improved grid orientation performance in pattern steamfloods}, + author={Pruess, Karsten and Bodvarsson, FS}, + booktitle={SPE Reservoir Simulation Symposium}, + year={1983}, + organization={OnePetro} +} + +@article{pruess1985practical, + title={A practical method for modeling fluid and heat flow in fractured porous media}, + author={Pruess, Karsten and Narasimhan, TN}, + journal={Society of Petroleum Engineers Journal}, + volume={25}, + number={01}, + pages={14--26}, + year={1985}, + publisher={OnePetro} +} + +@techreport{pruess2002tmvoc, + title={TMVOC, a numerical simulator for three-phase non-isothermal flows of multicomponent hydrocarbon mixtures in saturated-unsaturated heterogeneous media}, + author={Pruess, Karsten and Battistelli, Alfredo}, + year={2002}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@techreport{pruess2002intercomparison, + title={Intercomparison of numerical simulation codes for geologic disposal of CO2}, + author={Pruess, Karsten and Garcia, Julio and Kovscek, Tony and Oldenburg, Curt and Rutqvist, Jonny and Steefel, Carl and Xu, Tianfu}, + year={2002}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@article{pruess2004code, + title={Code intercomparison builds confidence in numerical simulation models for geologic disposal of CO2}, + author={Pruess, Karsten and Garc{\'\i}a, Julio and Kovscek, Tony and Oldenburg, Curt and Rutqvist, Jonny and Steefel, Carl and Xu, Tianfu}, + journal={Energy}, + volume={29}, + number={9-10}, + pages={1431--1444}, + year={2004}, + publisher={Elsevier} +} + +@article{reeves1986theory, + title={Theory and implementation of SWIFT II, the Sandia waste-isolation flow and transport model for fractured media}, + author={Reeves, M and Ward, DS and Johns, ND and Cranwell, RM}, + journal={Rep. SAND83-1159. Sandia Natl Lab., Albuquerque, NM}, + year={1986} +} + +@article{richards1931capillary, + title={Capillary conduction of liquids through porous mediums}, + author={Richards, Lorenzo Adolph}, + journal={Physics}, + volume={1}, + number={5}, + pages={318--333}, + year={1931}, + publisher={American Institute of Physics} +} + +@article{sleijpen1993bicgstab, + title={BiCGstab (ell) for linear equations involving unsymmetric matrices with complex spectrum}, + author={Sleijpen, Gerard LG and Fokkema, Diederik R}, + journal={Electronic Transactions on Numerical Analysis.}, + volume={1}, + pages={11--32}, + year={1993}, + publisher={Kent State University} +} + +@article{span1996new, + title={A new equation of state for carbon dioxide covering the fluid region from the triple-point temperature to 1100 K at pressures up to 800 MPa}, + author={Span, Roland and Wagner, Wolfgang}, + journal={Journal of physical and chemical reference data}, + volume={25}, + number={6}, + pages={1509--1596}, + year={1996}, + publisher={American Institute of Physics for the National Institute of Standards and~…} +} + +@article{spycher1988fugacity, + title={Fugacity coefficients of H2, CO2, CH4, H2O and of H2O-CO2-CH4 mixtures: A virial equation treatment for moderate pressures and temperatures applicable to calculations of hydrothermal boiling}, + author={Spycher, Nicolas F and Reed, Mark H}, + journal={Geochimica et Cosmochimica Acta}, + volume={52}, + number={3}, + pages={739--749}, + year={1988}, + publisher={Elsevier} +} + +@article{spycher2003co2, + title={CO2-H2O mixtures in the geological sequestration of CO2. I. Assessment and calculation of mutual solubilities from 12 to 100 C and up to 600 bar}, + author={Spycher, Nicolas and Pruess, Karsten and Ennis-King, Jonathan}, + journal={Geochimica et cosmochimica acta}, + volume={67}, + number={16}, + pages={3015--3031}, + year={2003}, + publisher={Elsevier} +} + +@article{spycher2005co2, + title={CO2-H2O mixtures in the geological sequestration of CO2. II. Partitioning in chloride brines at 12--100 C and up to 600 bar}, + author={Spycher, Nicolas and Pruess, Karsten}, + journal={Geochimica et Cosmochimica Acta}, + volume={69}, + number={13}, + pages={3309--3320}, + year={2005}, + publisher={Elsevier} +} + +@article{stauffer2014joule, + title={Joule--Thomson effects on the flow of liquid water}, + author={Stauffer, Philip H and Lewis, KC and Stein, Joshua S and Travis, Bryan J and Lichtner, Peter and Zyvoloski, George}, + journal={Transport in porous media}, + volume={105}, + number={3}, + pages={471--485}, + year={2014}, + publisher={Springer} +} + +@article{stone1970probability, + title={Probability model for estimating three-phase relative permeability}, + author={Stone, HL}, + journal={Journal of petroleum technology}, + volume={22}, + number={02}, + pages={214--218}, + year={1970}, + publisher={OnePetro} +} + +@techreport{sutton1977boiling, + title={Boiling Curves at Broadlands Field, New Zealand}, + author={Sutton, FM and McNabb, A}, + year={1977}, + institution={CNRS} +} + +@article{thomas1981principles, + title={Principles of hydrocarbon reservoir simulation}, + author={Thomas, Gordon W}, + year={1981}, + publisher={IHRDC, Boston, MA} +} + +@techreport{tsang1990further, + title={Further modeling studies of gas movement and moisture migration at Yucca Mountain, Nevada}, + author={Tsang, YW and Pruess, K}, + year={1990}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@article{tuminaro1999official, + title={Official Aztec user's guide: Version 2.1}, + author={Tuminaro, Ray S and Heroux, Mike and Hutchinson, Scott A and Shadid, John N}, + journal={Sandia National Laboratories, Albuquerque, NM}, + volume={87185}, + year={1999} +} + +@article{udell1985heat, + title={Heat transfer in porous media considering phase change and capillarity—the heat pipe effect}, + author={Udell, Kent S}, + journal={International Journal of Heat and Mass Transfer}, + volume={28}, + number={2}, + pages={485--495}, + year={1985}, + publisher={Elsevier} +} + +@article{van1992bi, + title={Bi-cgstab: A fast and smoothly converging variant of bicg in the presence of rounding errors}, + author={van der Vorst, HA}, + journal={SIAM J. Sci. Statist. Comput}, + volume={13}, + pages={631--644}, + year={1992} +} + +@article{van1980closed, + title={A closed-form equation for predicting the hydraulic conductivity of unsaturated soils}, + author={Van Genuchten, M Th}, + journal={Soil science society of America journal}, + volume={44}, + number={5}, + pages={892--898}, + year={1980}, + publisher={Wiley Online Library} +} + +@book{vargaftik1975tables, + title={Tables on the thermophysical properties of liquids and gases}, + author={Vargaftik, Natan B}, + year={1975}, + publisher={Hemisphere Pub. Corp.} +} + +@incollection{vaughn1987analysis, + title={Analysis of permeability reduction during flow of heated, aqueous fluid through Westerly Granite}, + author={Vaughn, PJ}, + booktitle={Coupled processes associated with nuclear waste repositories}, + year={1987} +} + +@techreport{verma1985study, + title={A study of two-phase concurrent flow of steam and water in an unconsolidated porous medium}, + author={Verma, AK}, + year={1985}, + institution={Lawrence Berkeley National Lab.(LBNL), Berkeley, CA (United States)} +} + +@article{verma1988thermohydrological, + title={Thermohydrological conditions and silica redistribution near high-level nuclear wastes emplaced in saturated geological formations}, + author={Verma, A and Pruess, K}, + journal={Journal of Geophysical Research: Solid Earth}, + volume={93}, + number={B2}, + pages={1159--1173}, + year={1988}, + publisher={Wiley Online Library} +} + +@article{vinsome1980simple, + title={A simple method for predicting cap and base rock heat losses in'thermal reservoir simulators}, + author={Vinsome, PKW and Westerveld, J}, + journal={Journal of Canadian Petroleum Technology}, + volume={19}, + number={03}, + year={1980}, + publisher={OnePetro} +} + +@techreport{walker1981studies, + title={Studies of heat transfer and water migration in soils. Final report}, + author={Walker, Wynn R and Sabey, James D and Hampton, Duana R}, + year={1981}, + institution={Colorado State Univ., Fort Collins (USA). Solar Energy Applications Lab.} +} + +@article{warren1963behavior, + title={The behavior of naturally fractured reservoirs}, + author={Warren, JE and Root, P Jj}, + journal={Society of Petroleum Engineers Journal}, + volume={3}, + number={03}, + pages={245--255}, + year={1963}, + publisher={OnePetro} +} + +@techreport{webb1996gas, + title={Gas-phase diffusion in porous media: Evaluation of an advective-dispersive formulation and the dusty-gas model including comparison to data for binary mixtures}, + author={Webb, Stephen W}, + year={1996}, + institution={Sandia National Lab.(SNL-NM), Albuquerque, NM (United States)} +} + +@techreport{webb1998review, + title={Review of enhanced vapor diffusion in porous media}, + author={Webb, Stephen W and Ho, Clifford K}, + year={1998}, + institution={Sandia National Lab.(SNL-NM), Albuquerque, NM (United States)} +} + +@article{webb1998enhanced, + title={Enhanced Vapor Diffusion in Porous Media-LDRD Final Report}, + author={Webb, SW and Ho, CK}, + journal={Sandia National Laboratories Report SAND98-2772, Albuquerque, NM}, + year={1998} +} + +@article{wu1993buckley, + title={Buckley-Leverett flow in composite porous media}, + author={Wu, Yu-Shu and Pruess, Karsten and Chen, ZX}, + journal={SPE Advanced Technology Series}, + volume={1}, + number={02}, + pages={36--42}, + year={1993}, + publisher={OnePetro} +} + +@article{yanosik1979nine, + title={A nine-point, finite-difference reservoir simulator for realistic prediction of adverse mobility ratio displacements}, + author={Yanosik, JL and McCracken, TA}, + journal={Society of Petroleum Engineers Journal}, + volume={19}, + number={04}, + pages={253--262}, + year={1979}, + publisher={OnePetro} +} + +@techreport{zhang2008user, + title={User's guide for TOUGH2-MP-a massively parallel version of the TOUGH2 code}, + author={Zhang, Keni and Wu, Yu-Shu and Pruess, Karsten and others}, + year={2008}, + institution={Ernest Orlando Lawrence Berkeley National Laboratory} +} + +@article{zhang2011time, + title={A time-convolution approach for modeling heat exchange between a wellbore and surrounding formation}, + author={Zhang, Yingqi and Pan, Lehua and Pruess, Karsten and Finsterle, Stefan}, + journal={Geothermics}, + volume={40}, + number={4}, + pages={261--266}, + year={2011}, + publisher={Elsevier} +} \ No newline at end of file diff --git a/doc/source/tough3/eos/eco2n.rst b/doc/source/tough3/eos/eco2n.rst new file mode 100644 index 00000000..1fc8eb37 --- /dev/null +++ b/doc/source/tough3/eos/eco2n.rst @@ -0,0 +1,646 @@ +.. _eco2n: + +ECO2N +===== + +Injection of CO\ :sub:`2` into saline formations has been proposed as a means whereby emissions of heat-trapping greenhouse gases into the atmosphere may be reduced. +Such injection would induce coupled processes of multiphase fluid flow, heat transfer, chemical reactions, and mechanical deformation. +Several groups have developed simulation models for subsets of these processes. +The present report describes a fluid property module "ECO2N" for the general-purpose reservoir simulator TOUGH2 (:cite:label:`pruess1999tough2, pruess2004tough`), that can be used to model non-isothermal multiphase flow in the system H\ :sub:`2`\O - NaCl - CO\ :sub:`2`. TOUGH2/ECO2N represents fluids as +consisting of two phases: a water-rich aqueous phase, herein often referred to as "liquid", and a CO\ :sub:`2`-rich phase referred to as "gas". +In addition, solid salt may also be present. +The only chemical reactions modeled by ECO2N include equilibrium phase partitioning of water and carbon dioxide between the liquid and gaseous phases, and precipitation and dissolution of solid salt. +The partitioning of H\ :sub:`2`\O and CO\ :sub:`2` between liquid and gas phases is modeled as a function of temperature, pressure, and salinity, using the recently developed correlations of :cite:label:`spycher2003co2`. +Dissolution and precipitation of salt is treated by means of local equilibrium solubility. +Associated changes in fluid porosity and permeability may also be modeled. +All phases - gas, liquid, solid - may appear or disappear in any grid block during the course of a simulation. +Thermodynamic conditions covered include a temperature range from ambient to 100˚C (approximately), pressures up to 600 bar, and salinity from zero to fully saturated. +These parameter ranges should be adequate for most conditions encountered during disposal of CO\ :sub:`2` into deep saline aquifers. + + +Theoretical Background +---------------------- + +Fluid Phases and Thermodynamic Variables in the System Water-NaCl-CO\ :sub:`2` +****************************************************************************** + +In the two-component system water-CO\ :sub:`2`, at temperatures above the freezing point of water and not considering hydrate phases, three different fluid phases may be present: an aqueous phase that is mostly water but may contain some dissolved CO\ :sub:`2`, a liquid CO\ :sub:`2`-rich phase that may contain some water, and a gaseous CO\ :sub:`2`-rich phase that also may contain some water. +Altogether there may be seven different phase combinations (:numref:`fig:eco2n.1`). +If NaCl ("salt") is added as a third fluid component, the number of possible phase combinations doubles, as in each of the seven phase combinations depicted in :numref:`fig:eco2n.1` there may or may not be an additional phase consisting of solid salt. +Liquid and gaseous CO\ :sub:`2` may coexist along the saturated vapor pressure curve of CO\ :sub:`2`, which ends at the critical point (:math:`T_{crit}`, :math:`P_{crit}`) = (31.04˚C, 73.82 bar; :cite:label:`vargaftik1975tables`), see :numref:`fig:eco2n.2`. +At supercritical temperatures or pressures there is just a single CO\ :sub:`2`-rich phase. + +.. figure:: ../figures/figure_eco2n_1.png + :name: fig:eco2n.1 + :width: 50% + + Possible phase combinations in the system water-CO\ :sub:`2`. The phase designations are a - aqueous, l - liquid CO\ :sub:`2`, g - gaseous CO\ :sub:`2`. Separate liquid and gas phases exist only at subcritical conditions. + +The present version of ECO2N can only represent a limited subset of the phase conditions depicted in :numref:`fig:eco2n.1`. +Thermophysical properties are accurately calculated for gaseous as well as for liquid CO\ :sub:`2`, but no distinction between gaseous and liquid CO\ :sub:`2` phases is made in the treatment of flow, and no phase change between liquid and gaseous CO\ :sub:`2` is treated. +Accordingly, of the seven phase combinations shown in :numref:`fig:eco2n.1`, ECO2N can represent the ones numbered 1 (single-phase aqueous with or without dissolved CO\ :sub:`2` and salt), 2 and 3 (a single CO\ :sub:`2`-rich phase that may be either liquid or gaseous CO\ :sub:`2`, and may include dissolved water), and 4 and 5 (two-phase conditions consisting of an aqueous and a single CO\ :sub:`2`-rich phase, with no distinction being made as to whether the CO\ :sub:`2`-rich phase is liquid or gas). +ECO2N cannot represent conditions 6 (two-phase mixture of liquid and gaseous CO\ :sub:`2`) and 7 (three-phase). +All sub- and super-critical CO\ :sub:`2` is considered as a single non-wetting phase, that will henceforth be referred to as "gas". +ECO2N may be applied to sub- as well as super-critical temperature and pressure conditions, but applications that involve sub-critical conditions are limited to systems in which there is no change of phase between liquid and gaseous CO\ :sub:`2`, and in which no mixtures of liquid and gaseous CO\ :sub:`2` occur. + +.. figure:: ../figures/figure_eco2n_2.png + :name: fig:eco2n.2 + :width: 75% + + Phase states of CO\ :sub:`2`. + +Numerical modeling of the flow of brine and CO\ :sub:`2` requires a coupling of the phase behavior of water-salt-CO\ :sub:`2` mixtures with multiphase flow simulation techniques. +Among the various issues raised by such coupling is the choice of notation. There are long-established notational conventions in both fields, which may lead to conflicts and misunderstandings when they are combined. +In an effort to avoid confusion, we will briefly discuss notational issues pertaining to partitioning of CO\ :sub:`2` between an aqueous and a gaseous phase. + +Phase partitioning is usually described in terms of mole fractions of the two components, which are denoted by :math:`x` and :math:`y`, respectively, where :math:`x_1` = :math:`x_{H_2O}` and :math:`x_2` = :math:`x_{CO_2}` specify mole fractions in the aqueous phase, while :math:`y_1` = :math:`y_{H_2O}` and :math:`y_2` = :math:`y_{CO_2}` give mole fractions in the gas phase (:cite:label:`prausnitz1998molecular, spycher2003co2`). +We follow this notation, except that we add the subscript "eq" to emphasize that these mole fractions pertain to equilibrium partitioning of water and CO\ :sub:`2` between co-existing aqueous and gas phases. +Accordingly, we denote the various mole fractions pertaining to equilibrium phase partitioning as :math:`x_{1, eq}`, :math:`x_{2, eq}`, :math:`y_{1, eq}`, and :math:`y_{2, eq}`, while the corresponding mass fractions are denoted using upper-case X and Y. +Mass fractions corresponding to single-phase conditions, where water and CO\ :sub:`2` concentrations are not constrained by phase equilibrium relations, are denoted by :math:`X_1` (for water) and :math:`X_2` (for CO\ :sub:`2`) in the aqueous phase, and by :math:`Y_1` and :math:`Y_2` in the gas phase. + +In the numerical simulation of brine-CO\ :sub:`2` flows, we will be concerned with the fundamental thermodynamic variables that characterize the brine-CO\ :sub:`2` system, and their change with time in different subdomains (grid blocks) of the flow system. +Four "primary variables" are required to define the state of water-NaCl-CO\ :sub:`2` mixtures, which according to conventional TOUGH2 useage are denoted by :math:`X_1`, :math:`X_2`, :math:`X_3`, and :math:`X_4`. +A summary of the fluid components and phases modeled by ECO2N, and the choice of primary thermodynamic variables, appears in :numref:`tab:eco2n.1`. +Different variables are used for different phase conditions, but two of the four primary variables are the same, regardless of the number and nature of phases present. +This includes the first primary variable :math:`X_1`, denoting pressure, and the fourth primary variable :math:`X_4` which is temperature. +The second primary variable pertains to salt and is denoted :math:`X_{sm}` rather than :math:`X_2` to avoid confusion with :math:`X_2`, the CO\ :sub:`2` mass fraction in the liquid phase. +Depending upon whether or not a precipitated salt phase is present, the variable :math:`X_{sm}` has different meaning. +When no solid salt is present, :math:`X_{sm}` denotes :math:`X_s`, the salt mass fraction referred to the two-component system water-salt. +When solid salt is present, :math:`X_s` is no longer an independent variable, as it is determined by the equilibrium solubility of NaCl, which is a function of temperature. +In the presence of solid salt, for reasons that are explained below, we use as second primary variable the quantity "solid saturation plus ten", :math:`X_{sm}` = :math:`S_s` + 10. +Here, :math:`S_s` is defined in analogy to fluid saturations and denotes the fraction of void space occupied by solid salt. + +The physical range of both :math:`X_s` and :math:`S_s` is (0, 1); the reason for defining :math:`X_{sm}` by adding a number 10 to :math:`S_s` is to enable the presence or absence of solid salt to be recognized simply from the numerical value of the second primary variable. +As had been mentioned above, the salt concentration variable :math:`X_s` is defined with respect to the two-component system H\ :sub:`2`\O - NaCl. +This choice makes the salt concentration variable independent of CO\ :sub:`2` concentration, which simplifies the calculation of the partitioning of the H\ :sub:`2`\O and CO\ :sub:`2` components between the aqueous and gas phases (see below). +In the three-component system H\ :sub:`2`\O - NaCl - CO\ :sub:`2`, the total salt mass fraction in the aqueous phase will for given :math:`X_s` of course depend on CO\ :sub:`2` concentration. +Salt mass fraction in the two-component system H\ :sub:`2`\O - NaCl can be expressed in terms of salt molality (moles m of salt per kg of water) as follows + +.. math:: + :label: eq:eco2n.1 + + X_s = \frac{m M_{NaCl}}{1000 + m M_{NaCl}} + +Here :math:`M_{NaCl}` = 58.448 is the molecular weight of NaCl, and the number 1000 appears in the denominator because molality is defined as moles per 1000 g of water. +For convenience we also list the inverse of Eq. :math:numref:`eq:eco2n.1`. + +.. math:: + :label: eq:eco2n.2 + + m = \frac{1000 \frac{X_s}{M_{NaCl}}}{1 - X_s} + +The third primary variable X3 is CO\ :sub:`2` mass fraction (:math:`X_2`) for single-phase conditions (only aqueous, or only gas) and is "gas saturation plus ten" (:math:`S_g` + 10) for two-phase (aqueous and gas) conditions. +The reason for adding 10 to :math:`S_g` is analogous to the conventions adopted for the second primary variable, namely, to be able to distinguish single-phase conditions (0 ≤ :math:`X_3` ≤ 1) from two-phase conditions (10 ≤ :math:`X_3` ≤ 11). +In single-phase conditions, the CO\ :sub:`2` concentration variable :math:`X_2` is "free", i.e., it can vary continuously within certain parameter ranges, while in two-phase aqueous-gas conditions, :math:`X_2` has a fixed value :math:`X_{2, eq}` that is a function of temperature, pressure, and salinity (see below). +Accordingly, for single-phase conditions :math:`X_2` is included among the independent primary variables (= :math:`X_3`), while for two-phase conditions, :math:`X_2` becomes a "secondary" parameter that is dependent upon primary variables (:math:`T`, :math:`P`, :math:`X_s`). +"Switching" primary variables according to phase conditions present provides a very robust and stable technique for dealing with changing phase compositions. + +Initialization of a simulation with TOUGH2/ECO2N would normally be made with the internally used primary variables as listed in :numref:`tab:eco2n.1`. +For convenience of the user, additional choices are available for initializing a flow problem. + +.. list-table:: Summary of ECO2N. + :name: tab:eco2n.1 + :widths: 1 3 + :align: center + + * - Components + - | #1: water + | #2: NaCl + | #3: CO\ :sub:`2` + * - Parameter choices + - | (``NK``, ``NEQ``, ``NPH``, ``NB``) = + | (3, 4, 3, 6) water, air, oil, nonisothermal (default) + | (3, 3, 3, 6) water, air, oil, isothermal + | Molecular diffusion can be modeled by setting ``NB`` = 8 + * - Primary variables + - | Single-phase conditions (only aqueous, or only gas)*: + | (:math:`P`, :math:`X_{sm}`, :math:`X_3`, :math:`T`): (pressure, salt mass fraction in two-component water-salt system or solid saturation plus ten, CO\ :sub:`2` mass fraction in the aqueous phase or in the gas phase, in the three-component system water-salt-CO\ :sub:`2`, temperature) + | Two-phase conditions (aqueous and gas)*: + | (:math:`P`, :math:`X_{sm}` + 10, :math:`S_g`, :math:`T`): (pressure, salt mass fraction in two-component water-salt system or solid saturation plus ten, gas phase saturation, temperature) + +.. note:: + + \* When discussing fluid phase conditions, we refer to the potentially mobile (aqueous and gas) phases only; in all cases solid salt may precipitate or dissolve, adding another active phase to the system. + + +Phase Composition +^^^^^^^^^^^^^^^^^ + +The partitioning of H\ :sub:`2`\O and CO\ :sub:`2` among co-existing aqueous and gas phases is calculated from a slightly modified version of the correlations developed in (:cite:label:`spycher2005co2`). +These correlations were derived from the requirement that chemical potentials of all components must be equal in different phases. +For two-phase conditions, they predict the equilibrium composition of liquid (aqueous) and gas (CO\ :sub:`2`-rich) phases as functions of temperature, pressure, and salinity, and are valid in the temperature range 12˚C ≤ :math:`T` ≤ 110˚C, for pressures up to 600 bar, and salinity up to saturated NaCl brines. +In the indicated parameter range, mutual solubilities of H\ :sub:`2`\O and CO\ :sub:`2` are calculated with an accuracy typically within experimental uncertainties. +The modification made in ECO2N is that CO\ :sub:`2` molar volumes are calculated using a tabular EOS based on Altunin's correlation (:cite:label:`altunin1975thermophysical`), instead of the Redlich-Kwong equation of state used in (:cite:label:`spycher2005co2`). +This was done to maintain consistency with the temperature and pressure conditions for phase change between liquid and gaseous conditions used elsewhere in ECO2N. +Altunin's correlations yield slightly different molar volumes than the Redlich-Kwong EOS whose parameters were fitted by :cite:label:`spycher2005co2` to obtain the best overall match between observed and predicted CO\ :sub:`2` concentrations in the aqueous phase. +The (small) differences in Altunin's molar volumes cause predictions for the mutual solubility of water and CO\ :sub:`2` to be somewhat different also. However, the differences are generally small, see :numref:`fig:eco2n.3` to :numref:`fig:eco2n.5`. + +.. figure:: ../figures/figure_eco2n_3.png + :name: fig:eco2n.3 + :width: 75% + + Dissolved CO\ :sub:`2` mass fractions in two-phase system at :math:`T` = 30˚C for pure water (0m) and 4-molal NaCl brine. Lines represent the original correlation of :cite:label:`spycher2005co2` that uses a Redlich-Kwong EOS for molar volume of CO\ :sub:`2`. Symbols represent data calculated by ECO2N in which the molar volume of CO\ :sub:`2` is obtained from the correlations of :cite:label:`altunin1975thermophysical`. + +.. figure:: ../figures/figure_eco2n_4.png + :name: fig:eco2n.4 + :width: 75% + + H\ :sub:`2`\O mass fractions in gas in two-phase system at :math:`T` = 30˚C for pure water (0m) and 4-molal NaCl brine. Lines represent the original correlation of :cite:label:`spycher2005co2` that uses a Redlich-Kwong EOS for molar volume of CO\ :sub:`2`. Symbols represent data calculated by ECO2N in which the molar volume of CO\ :sub:`2` is obtained from the correlations of :cite:label:`altunin1975thermophysical`. + +.. figure:: ../figures/figure_eco2n_5.png + :name: fig:eco2n.5 + :width: 75% + + Concentration of water in gas and CO\ :sub:`2` in the liquid (aqueous) phase at (:math:`T`, :math:`P`) = (45˚C, 216.18 bar), for salinities ranging from zero to fully saturated. Lines were calculated from the correlation of :cite:label:`spycher2005co2` that uses a Redlich-Kwong EOS for molar volume of CO\ :sub:`2`. Symbols represent data calculated by ECO2N from a modified correlation in which the molar volume of CO\ :sub:`2` is obtained from the correlations of :cite:label:`altunin1975thermophysical`. + +For conditions of interest to geologic dispoal of CO\ :sub:`2`, equilibrium between aqueous and gas phases corresponds to a dissolved CO\ :sub:`2` mass fraction in the aqueous phase, :math:`X_{2, eq}`, on the order of a few percent, while the mass fraction of water in the gas phase, :math:`Y_{1, eq}`, is a fraction of a percent, so that gas phase CO\ :sub:`2` mass fraction :math:`Y_{2, eq}` = 1 - :math:`Y_{1, eq}` is larger than 0.99. +The relationship between CO\ :sub:`2` mass fraction :math:`X_3` and phase composition of the fluid mixture is as follows (see :numref:`fig:eco2n.6`): + +- :math:`X_3` < :math:`X_{2, eq}` corresponds to single-phase liquid conditions; +- :math:`X_3` > :math:`X_{2, eq}` corresponds to single-phase gas; +- intermediate values :math:`X_{2, eq}` ≤ :math:`X_3` ≤ :math:`Y_{2, eq}` correspond to two-phase conditions with different proportions of aqueous and gas phases. + +Dissolved NaCl concentrations may for typical sequestration conditions range as high as 6.25 molal. +This corresponds to mass fractions of up to :math:`X_{sm}` = 26.7% in the two-component system water-salt. +Phase conditions as a function of :math:`X_{sm}` are as follows: + +- :math:`X_{sm}` ≤ :math:`XEQ` corresponds to dissolved salt only; +- :math:`X_{sm}` > :math:`XEQ` corresponds to conditions of a saturated NaCl brine and solid salt. + +.. figure:: ../figures/figure_eco2n_6.png + :name: fig:eco2n.6 + :width: 75% + + CO\ :sub:`2` phase partitioning in the system H\ :sub:`2`\O - NaCl - CO\ :sub:`2`. The CO\ :sub:`2` mass fraction in brine-CO\ :sub:`2` mixtures can vary in the range from 0 (no CO\ :sub:`2`) to 1 (no brine). :math:`X_{2, eq}` and :math:`Y_{2, eq}` denote, respectively, the CO\ :sub:`2` mass fractions in aqueous and gas phases corresponding to equilibrium phase partitioning in two-phase conditions. Mass fractions less than :math:`X_{2, eq}` correspond to conditions in which only an aqueous phase is present, while mass fractions larger than :math:`Y_{2, eq}` correspond to single-phase gas conditions. Mass fractions intermediate between :math:`X_{2, eq}` and :math:`Y_{2, eq}` correspond to two-phase conditions with different proportions of aqueous and gas phases. + + +Phase Change +^^^^^^^^^^^^ + +In single-phase (aqueous or gas) conditions, the third primary variable X3 is the CO\ :sub:`2` mass fraction in that phase. +In single-phase aqueous conditions, we must have :math:`X_3` ≤ :math:`X_{2, eq}`, while in single-phase gas conditions, we must have :math:`X_3` ≥ :math:`Y_{2, eq}`. +The possibility of phase change is evaluated during a simulation by monitoring :math:`X_3` in each grid block. +The criteria for phase change from single-phase to two-phase conditions may be written as follow: + +- single-phase aqueous conditions: a transition to two-phase conditions (evolution of a gas phase) will occur when :math:`X_3` > :math:`X_{2, eq}`; +- single-phase gas conditions: a transition to two-phase conditions (evolution of an aqueous phase) will occur when :math:`X_3` < :math:`Y_{2, eq}` = 1 - :math:`Y_{1, eq}`. + +When two-phase conditions evolve in a previously single-phase grid block, the third primary variable is switched to :math:`X_3` = :math:`S_g` + 10. +If the transition occurred from single-phase liquid conditions, the starting value of :math:`S_g` is chosen as 10\ :sup:`-6`; if the transition occurred from single-phase gas, the starting value is chosen as 1 - 10\ :sup:`-6`. + +In two-phase conditions, the third primary variable is :math:`X_3` = :math:`S_g` + 10. +For two-phase conditions to persist, :math:`X_3` must remain in the range (10, 11 - :math:`S_s`). +Transitions to single-phase conditions are recognized as follows: + +- if :math:`X_3` < 10 (i.e., :math:`S_g` < 0): gas phase disappears; make a transition to single-phase liquid conditions; +- if :math:`X_3` > 11 - :math:`S_s` (i.e., :math:`S_g` > 1 - :math:`S_s`): liquid phase disappears; make a transition to single-phase gas conditions. + +Phase change involving (dis-)appearance of solid salt is recognized as follows. +When no solid salt is present, the second primary variable :math:`X_{sm}` is the concentration (mass fraction referred to total water plus salt) of dissolved salt in the aqueous phase. +The possibility of precipitation starting is evaluated by comparing :math:`X_{sm}` with :math:`XEQ`, the equilibrium solubility of NaCl at prevailing temperature. +If :math:`X_{sm}` ≤ :math:`XEQ` no precipitation occurs, whereas for :math:`X_{sm}` > :math:`XEQ` precipitation starts. +In the latter case, variable :math:`X_{sm}` is switched to :math:`S_s` + 10, where solid saturation :math:`S_s` is initialized with a small non-zero value (10\ :sup:`-6`). +If a solid phase is present, the variable :math:`X_{sm}` = :math:`S_s` + 10 is monitored. +Solid phase disappears if :math:`X_{sm}` < 10, in which case primary variable :math:`X_{sm}` is switched to salt concentration, and is initialized as slightly below saturation, :math:`X_{sm}` = :math:`XEQ` - 10\ :sup:`-6`. + + +Conversion of Units +^^^^^^^^^^^^^^^^^^^ + +The :cite:label:`spycher2005co2` model for phase partitioning in the system H\ :sub:`2`\O-NaCl-CO\ :sub:`2` is formulated in molar quantities (mole fractions and molalities), while TOUGH2/ECO2N describes phase compositions in terms of mass fractions. +This section presents the equations and parameters needed for conversion between the two sets of units. +The conversion between various concentration variables (mole fractions, molalities, mass fractions) does not depend upon whether or not concentrations correspond to equilibrium between liquid and gas phases; accordingly, the +relations given below are valid regardless of the magnitude of concentrations. + +Let us consider an aqueous phase with dissolved NaCl and CO\ :sub:`2`. For a solution that is m-molal in NaCl and n-molal in CO\ :sub:`2`, total mass per kg of water is + +.. math:: + :label: eq:eco2n.3 + + M = 1000 (g H_2 O) + m M_{NaCl} (g NaCl) + n M_{CO_2} (g CO_2) + +where :math:`M_{NaCl}` and M_{CO_2} are the molecular weights of NaCl and CO\ :sub:`2`, respectively (see :numref:`tab:eco2n.2`). +Assuming NaCl to be completely dissociated, the total moles per kg of water are + +.. math:: + :label: eq:eco2n.4 + + m_T = \frac{1000}{M_{H_2 O}} + 2m + n + +The :cite:label:`spycher2005co2` correlations provide CO\ :sub:`2` mole fraction :math:`x_2` in the aqueous phase and H\ :sub:`2`\O mole fraction :math:`y_1` in the gas phase as functions of temperature, pressure, and salt concentration (molality). +For a CO\ :sub:`2` mole fraction x2 we have :math:`n` = :math:`x_2 m_T` from which, using Eq. :math:numref:`eq:eco2n.4`, we obtain + +.. math:: + :label: eq:eco2n.5 + + n = \frac{x_2 \left( 2 m + \frac{1000}{M_{H_2 O}} \right)}{1 - x_2} + +CO\ :sub:`2` mass fraction :math:`X_2` in the aqueous phase is obtained by dividing the CO\ :sub:`2` mass in :math:`n` moles by the total mass + +.. math:: + :label: eq:eco2n.6 + + X_2 = \frac{n M_{CO_2}}{1000 + m M_{NaCl} + n M_{CO_2}} + +Water mass fraction :math:`Y_1` in the CO\ :sub:`2`-rich phase is simply + +.. math:: + :label: eq:eco2n.7 + + Y_1 = \frac{y1 M_{H_2 O}}{y1 M_{H_2 O} + \left( 1 - y_1 \right) M_{CO_2}} + +The molecular weights of the various species are listed in :numref:`tab:eco2n.2` (:cite:label:`evans1982atomic`). + +.. list-table:: Molecular weights in the system H\ :sub:`2`\O-NaCl-CO\ :sub:`2`. + :name: tab:eco2n.2 + :header-rows: 1 + :align: center + + * - Species + - Mol. weight + * - H\ :sub:`2`\O + - 18.016 + * - Na + - 22.991 + * - Cl + - 35.457 + * - NaCl + - 58.448 + * - CO\ :sub:`2` + - 44.0 + + +Thermophysical Properties of Water-NaCl-CO\ :sub:`2` Mixtures +************************************************************* + +Thermophysical properties needed to model the flow of water-salt-CO\ :sub:`2` mixtures in porous media include density, viscosity, and specific enthalpy of the fluid phases as functions of temperature, pressure, and composition, and partitioning of components among the fluid phases. +Many of the needed parameters are obtained from the same correlations as were used in the EWASG property module of TOUGH2 (:cite:label:`battistelli1997simulator`). +EWASG was developed for geothermal applications, and consequently considered conditions of elevated temperatures > 100˚C, and modest CO\ :sub:`2` partial pressures of order 1-10 bar. +The present ECO2N module targets the opposite end of the temperature and pressure range, namely, modest temperatures below 110˚C, and high CO\ :sub:`2` pressures up to several hundred bar. + +Water properties in TOUGH2/ECO2N are calculated, as in other members of the TOUGH family of codes, from the steam table equations as given by the International Formulation Committee (:cite:label:`ifc1967formulation`). +Properties of pure CO\ :sub:`2` are obtained from correlations developed by :cite:label:`altunin1975thermophysical`. +We began using Altunin's correlations in 1999 when a computer program implementingthem was conveniently made available to us by Victor Malkovsky of the Institute of Geology of Ore Deposits, Petrography, Mineralogy and Geochemistry (IGEM) of the Russian Academy of Sciences, Moscow. +Altunin's correlations were subsequently extensively cross-checked against experimental data and alternative PVT formulations, such as :cite:label:`span1996new`. +They were found to be very accurate (:cite:`garcia2003fluid`), so there is no need to change to a different formulation. + +Altunin's correlations are not used directly in the code, but are used ahead of a TOUGH2/ECO2N simulation to tabulate density, viscosity, and specific enthalpy of pure CO\ :sub:`2` on a regular grid of (:math:`T`, :math:`P`)-values. +These tabular data are provided to the ECO2N module in a file called +"CO2TAB", and property values are obtained during the simulation by means of bivariate interpolation. +:numref:`fig:eco2n.7` shows the manner in which CO\ :sub:`2` properties are tabulated, intentionally showing a coarse (:math:`T`, :math:`P`)-grid so that pertinent features of the tabulation may be better seen. +(For actual calculations, we use finer grid spacings; the CO2TAB data file distributed with ECO2N covers the range 3.04 ˚C ≤ :math:`T` ≤ 103.04 ˚C with :math:`\Delta T` = 2˚C and 1 bar ≤ :math:`P` ≤ 600 bar with :math:`\Delta T` ≤ 4 bar in most cases. +The ECO2N distribution includes a utility program for generating CO2TAB files if users desire a different (:math:`T`, :math:`P`)-range or different increments). +As shown in :numref:`fig:eco2n.7`, the tabulation is made in such a way that for sub-critical conditions the saturation line is given by diagonals of the interpolation quadrangles. +On the saturation line, two sets of data are provided, for liquid and gaseous CO\ :sub:`2`, respectively, and in quadrangles that include points on both sides of the saturation line, points on the "wrong" side are excluded from the interpolation. +This scheme provides for an efficient and accurate determination of thermophysical properties of CO\ :sub:`2`. + +.. figure:: ../figures/figure_eco2n_7.png + :name: fig:eco2n.7 + :width: 75% + + Schematic of the temperature-pressure tabulation of CO\ :sub:`2` properties. The saturation line (dashed) is given by the diagonals of interpolation rectangles. + +An earlier version of ECO2N explicitly associated partial pressures of water (vapor) and CO\ :sub:`2` with the gas phase, and calculated CO\ :sub:`2` dissolution in the aqueous phase from the CO\ :sub:`2` partial pressure, using an extended version of Henry's law (:cite:label:`pruess2002intercomparison`). +The present version uses a methodology for calculating mutual solubilities of water and CO\ :sub:`2` (:cite:label:`spycher2005co2`) that is much more accurate, but has a drawback insofar as no partial pressures are associated with the individual fluid components. +This makes it less straightforward to calculate thermophysical properties of the gas phase in terms of individual fluid components. +We are primarily interested in the behavior of water-salt-CO\ :sub:`2` mixtures at moderate temperatures, :math:`T` < 100˚C, say, where water vapor pressure is a negligibly small fraction of total pressure. +Under these conditions the amount of water present in the CO\ :sub:`2`-rich phase, henceforth referred to as "gas", is small. +Accordingly, we approximate density, viscosity, and specific enthalpy of the gas phase by the corresponding properties of pure CO\ :sub:`2`, without water present. + + +Density +^^^^^^^ + +Brine density :math:`\rho_b` for the binary system water-salt is calculated as in :cite:label:`battistelli1997simulator` from the correlations of :cite:label:`haas1976physical` and :cite:label:`andersen1992accurate`. +The calculation starts from aqueous phase density without salinity at vapor-saturated conditions, which is obtained from the correlations given by the International Formulation Committee (:cite:label:`ifc1967formulation`). +Corrections are then applied to account for effects of salinity and pressure. +The density of aqueous phase with dissolved CO\ :sub:`2` is calculated assuming additivity of the volumes of brine and dissolved CO\ :sub:`2`. + +.. math:: + :label: eq:eco2n.8 + + \frac{1}{\rho_{aq}} = \frac{1 - X_2}{\rho_b} + \frac{X_2}{\rho_{CO_2}} + +where :math:`X_2` is the mass fraction of CO\ :sub:`2` in the aqueous phase. +Partial density of dissolved CO\ :sub:`2`, :math:`\rho_{CO_2}`, is calculated as a function of temperature from the correlation for molar volume of dissolved CO\ :sub:`2` at infinite dilution developed by :cite:label:`garcia2001density`. + +.. math:: + :label: eq:eco2n.9 + + V_{\phi} = a + b T + c T^2 + d T^3 + +In Eq. :math:numref:`eq:eco2n.9`, molar volume of CO\ :sub:`2` is in units of cm\ :sup:`3` per gram-mole, temperature :math:`T` is in ˚C, and :math:`a`, :math:`b`, :math:`c`, and :math:`d` are fit parameters given in :numref:`tab:eco2n.3`. + +.. list-table:: Parameters for molar volume of dissolved CO\ :sub:`2` :math:numref:`eq:eco2n.9`. + :name: tab:eco2n.3 + :header-rows: 1 + :align: center + + * - Parameter + - Value + * - a + - 37.51 + * - b + - -9.585 × 10\ :sup:`-2` + * - c + - 8.740 × 10\ :sup:`-4` + * - d + - -5.044 × 10\ :sup:`-7` + +Partial density of dissolved CO\ :sub:`2` in units of kg/m\ :sup:`3` is then + +.. math:: + :label: eq:eco2n.10 + + \rho_{CO_2} = \frac{M_{CO_2}}{V_{\phi}} \times 10^{-3} + +where :math:`M_{CO_2}` = 44.0 is the molecular weight of CO\ :sub:`2`. + +Dissolved CO\ :sub:`2` amounts at most to a few percent of total aqueous density. Accordingly, dissolved CO\ :sub:`2` is always dilute, regardless of total fluid pressure. +It is then permissible to neglect the pressure dependence of partial density of dissolved CO\ :sub:`2`, and to use the density corresponding to infinite dilution. + +As had been mentioned above, the density of the CO\ :sub:`2`-rich (gas) phase is obtained by neglecting effects of water, and approximating the density by that of pure CO\ :sub:`2` at the same temperature and pressure conditions. +Density is obtained through bivariate interpolation from a tabulation of CO\ :sub:`2` densities as function of temperature and pressure, that is based on the correlations developed by :cite:label:`altunin1975thermophysical`. + + +Viscosity +^^^^^^^^^ + +Brine viscosity is obtained as in EWASG from a correlation presented by :cite:label:`phillips1981technical`, that reproduces experimental data in the temperature range from 10-350˚C for salinities up to 5 molal and pressures up to 500 bar within 2%. +No allowance is made for dependence of brine viscosity on the concentration of dissolved CO\ :sub:`2`. +Viscosity of the CO\ :sub:`2`-rich phase is approximated as being equal to pure CO\ :sub:`2`, and is obtained through tabular interpolation from the correlations of :cite:label:`altunin1975thermophysical`. + + +Specific Enthalpy +^^^^^^^^^^^^^^^^^ + +Specific enthalpy of brine is calculated from the correlations developed by :cite:label:`lorenz2000analytische`, which are valid for all salt concentrations in the temperature range from 25˚C ≤ :math:`T` ≤ 300˚C. +The enthalpy of aqueous phase with dissolved CO\ :sub:`2` is obtained by adding the enthalpies of the CO\ :sub:`2` and brine (pseudo-) components, and accounting for the enthalpy of dissolution of CO\ :sub:`2`. + +.. math:: + :label: eq:eco2n.11 + + h_{aq} = \left( 1 - X_2 \right) h_b + X_2 h_{CO_2, aq} + +:math:`h_{CO_2, aq} = h_{CO_2} + h_{dis}` is the specific enthalpy of aqueous (dissolved) CO\ :sub:`2`, which includes heat of dissolution effects that are a function of temperature and salinity. +For gas-like (low pressure) CO\ :sub:`2`, the specific enthalpy of dissolved CO\ :sub:`2` is + +.. math:: + :label: eq:eco2n.12 + + h_{CO_2, aq} (T, P, X_s) = h_{CO_2, g} (T, P) + h_{dis, g} (T, X_s) + +where :math:`h_{dis, g}` is obtained as in :cite:label:`battistelli1997simulator` from an equation due to :cite:label:`himmelblau1959partial`. +For geologic sequestration we are primarily interested in liquid-like (high-pressure) CO\ :sub:`2`, for which the specific enthalpy of dissolved CO\ :sub:`2` may be written + +.. math:: + :label: eq:eco2n.13 + + h_{CO_2, aq} (T, P, X_s) = h_{CO_2, l} (T, P) + h_{dis, l} (T, X_s) + +Here :math:`h_{dis, l}` is the specific heat of dissolution for liquid-like CO\ :sub:`2`. +Along the CO\ :sub:`2` saturation line, liquid and gaseous CO\ :sub:`2` phases may co-exist, and the expressions Eqs. :math:numref:`eq:eco2n.12` and :math:numref:`eq:eco2n.13` must be equal there. +We obtain + +.. math:: + :label: eq:eco2n.14 + + h_{dis, l} (T, X_s) = h_{dis, g} (T, X_s) + h_{CO_2, gl} (T) + +where :math:`h_{CO_2, gl} (T) = h_{CO_2, g} (T, P_s) - h_{CO_2, l} (T, P_s)` is the specific enthalpy of vaporization of CO\ :sub:`2`, and :math:`P_s = P_s (T)` is the saturated vapor pressure of CO\ :sub:`2` at temperature :math:`T`. +Depending upon whether CO\ :sub:`2` is in gas or liquid conditions, we use Eq. :math:numref:`eq:eco2n.12` or :math:numref:`eq:eco2n.13` in Eq. :math:numref:`eq:eco2n.11` to calculate the specific enthalpy of dissolved CO\ :sub:`2`. +At the temperatures of interest here, :math:`h_{dis, g}` is a negative quantity, so that dissolution of low-pressure CO\ :sub:`2` is accompanied by an increase in temperature. +:math:`h_{CO_2, gl}` is a positive quantity, which will reduce or cancel out the heat-of-dissolution effects. +This indicates that dissolution of liquid CO\ :sub:`2` will produce less temperature increase than dissolution of gaseous CO\ :sub:`2`, and may even cause a temperature decline if :math:`h_{CO_2, gl}` is sufficiently large. + +Application of Eq. :math:numref:`eq:eco2n.11` is straightforward for single-phase gas and two-phase conditions, where :math:`h_{CO_2}` is obtained as a function of temperature and pressure through bivariate interpolation from a tabulation of Altunin's correlation (:cite:label:`altunin1975thermophysical`). +A complication arises in evaluating :math:`h_{CO_2}` for single-phase aqueous conditions. +We make the assumption that :math:`h_{CO_2} (P, X_s, X_2, T)` for single-phase liquid is identical to the value in a two-phase system with the same composition of the aqueous phase. +To determine :math:`h_{CO_2}`, it is then necessary to invert the :cite:label:`spycher2005co2` phase partitioning relation :math:`X_2 = X_2 (P, T, X_s)`, in order to obtain the pressure :math:`P` in a two-phase aqueous-gas system that would correspond to a dissolved CO\ :sub:`2` mass fraction :math:`X_2` in the aqueous phase, :math:`P = P(X_2, X_s, T)`. +The inversion is accomplished by Newtonian iteration, using a starting guess :math:`P_0` for :math:`P` that is obtained from Henry's law. +Specific enthalpy of gaseous CO\ :sub:`2` in the two-phase system is then calculated as :math:`h_{CO_2} = h_{CO_2} (T, P)`, and specific enthalpy of dissolved CO\ :sub:`2` is :math:`h_{CO_2} + h_{dis}`. + + +Description +----------- + +Initialization Choices +********************** + +Flow problems in TOUGH2/ECO2N will generally be initialized with the primary +thermodynamic variables as used in the code, but some additional choices are available for the convenience of users. +The internally used variables are (:math:`P`, :math:`X_{sm}`, :math:`X_3`, :math:`T`) for grid blocks in single-phase (liquid or gas) conditions and (:math:`P`, :math:`X_{sm}`, :math:`S_g` + 10, :math:`T`) for two-phase (liquid and gas) grid blocks (see :numref:`tab:eco2n.1`). +Here :math:`X_3` is the mass fraction of CO\ :sub:`2` in the fluid. +As had been discussed above, for conditions of interest to geologic sequestration of CO\ :sub:`2`, :math:`X_3` is restricted to small values 0 ≤ :math:`X_3` ≤ :math:`X_{2, eq}` (a few percent) for single-phase liquid conditions, or to values near 1 (:math:`Y_{2, eq}` ≤ :math:`X_3` ≤ 1, with :math:`Y_{2, eq}` > 0.99 typically) for single-phase gas (:numref:`fig:eco2n.6`). +Intermediate values :math:`X_{2, eq}` < :math:`X_3` < :math:`Y_{2, eq}` correspond to two-phase conditions, and thus should be initialized by specifying :math:`S_g` + 10 as third primary variable. +As a convenience to users, ECO2N allows initial conditions to be specified in the full range 0 ≤ :math:`X_3` ≤ 1. +During the initialization phase of a simulation, a check is made whether :math:`X_3` is in fact within the range of mass fractions that correspond to single-phase (liquid or gas) conditions. +If this is found not to be the case, the conditions are recognized as being two-phase, and the corresponding gas saturation is calculated from the phase equilibrium constraint. + +.. math:: + :label: eq:eco2n.15 + + X_3 \left( S_l \rho_l + S_g \rho_g \right) = S_l \rho_l X_{2, eq} + S_g \rho_g Y_{2, eq} + +Using :math:`S_l = 1 - S_g - S_s`, with Ss the "solid saturation" (fraction of pore space occupied by solid salt), we obtain + +.. math:: + :label: eq:eco2n.16 + + S_g = A \left( 1 - S_s \right) + +and the third primary variable is reset internally to :math:`X_3` = :math:`S_g` + 10. +Here the parameter :math:`A` is given by + +.. math:: + :label: eq:eco2n.17 + + A = \frac{\left( X_3 - X_{2, eq} \right) \rho_l}{\left( X_3 - X_{2, eq} \right) \rho_l + \left( Y_{2, eq} - X_3 \right) \rho_g} + +Users may think of specifying single-phase liquid (aqueous) conditions by setting :math:`X_3` = 10 (corresponding to :math:`S_g` = 0), and single-phase gas conditions by setting :math:`X_3` = 11 - :math:`S_s` (corresponding to :math:`Sl` = 0). +Strictly speaking this is not permissible, because two-phase initialization requires that both :math:`S_g` > 0 and :math:`S_l` > 0. +Single-phase states should instead be initialized by specifying primary +variable :math:`X_3` as CO\ :sub:`2` mass fraction. +However, as a user convenience, ECO2N accepts initialization of single-phase liquid conditions by specifying :math:`X_3` = 10 (:math:`S_g` = 0). +Such specification will be converted internally to two-phase in the initialization phase by adding a small number (10\ :sup:`-11`) to the third +primary variable, changing conditions to two-phase with a small gas saturation :math:`S_g` = 10\ :sup:`-11`. + +Salt concentration or saturation of solid salt, if present, is characterized in ECO2N by means of the second primary variable :math:`X_{sm}`. +When no solid phase is present, :math:`X_{sm}` denotes :math:`X_s`, the mass fraction of NaCl referred to the two-component system water-NaCl. +This is restricted to the range 0 ≤ :math:`X_{sm}` ≤ :math:`XEQ`, where :math:`XEQ = XEQ(T)` is the solubility of salt. +For :math:`X_{sm}` > 10 this variable means :math:`S_s` + 10, solid saturation plus 10. +Users also have the option to specify salt concentration by means of molality :math:`m` by assigning :math:`X_{sm} = -m`. +Such specification will in the initialization phase be internally converted to :math:`X_s` by using Eq. :math:numref:`eq:eco2n.1`. +When salt concentration (as a fraction of total H\ :sub:`2`\O + NaCl mass) exceeds :math:`XEQ`, this corresponds to conditions in which solid salt will be present in addition to dissolved salt in the aqueous phase. +Such states should be initialized with a second primary variable :math:`X_{sm}` = :math:`S_s` + 10. +However, ECO2N accepts initialization with :math:`X_{sm}` > :math:`XEQ`, recognizes this as corresponding to presence of solid salt, and converts the second primary variable internally to the appropriate solid saturation that will result in total salt mass fraction in the binary system water-salt being equal to :math:`X_{sm}`. +The conversion starts from the following equation. + +.. math:: + :label: eq:eco2n.18 + + X_{sm} = \frac{XEQ \times S_l \rho_l \left( 1 - X_2 \right) + S_s \rho_s}{S_l \rho_l \left( 1 - X_2 \right) + S_s \rho_s} + +where the numerator gives the total salt mass per unit volume, in liquid and solid phases, while the denominator gives the total mass of salt plus water. +Substituting :math:`S_l = 1 - S_g - S_s`, this can be solved for :math:`S_s` to yield + +.. math:: + :label: eq:eco2n.19 + + S_s = \frac{B \left( 1 - S_g \right)}{1 + B} + +where the parameter :math:`B` is given by + +.. math:: + :label: eq:eco2n.20 + + B = \frac{\left( X_{sm} - XEQ \right) \rho_l \left( 1 - X_2 \right)}{\rho_s \left( 1 - X_{sm} \right)} + +The most general conditions arise when both the second and third primary variables are initialized as mass fractions, nominally corresponding to single-phase fluid conditions with no solid phase present, but both mass fractions being in the range corresponding to two-phase fluid conditions +with precipitated salt. +Under these conditions, Eqs. :math:numref:`eq:eco2n.16` and :math:numref:`eq:eco2n.19` are solved simultaneously in ECO2N for :math:`S_s` and :math:`S_g`, yielding + +.. math:: + :label: eq:eco2n.21 + + S_g = \frac{A}{1 + B - A \times B} + +.. math:: + :label: eq:eco2n.22 + + S_s = \frac{B \times \left( 1 - A \right)}{1 + B - A \times B} + +Then both second and third primary variables are converted to phase saturations, :math:`S_s` + 10 and :math:`S_g` + 10, respectively. + + +Permeability Change from Precipitation and Dissolution of Salt +************************************************************** + +ECO2N offers several choices for the functional dependence of relative change in permeability, :math:`\frac{k}{k_0}`, on relative change in active flow porosity. + +.. math:: + :label: eq:eco2n.23 + + \frac{k}{k_0} = f \left( \frac{\phi_f}{\phi_0} \right) \equiv f \left( 1 - S_s \right) + +The simplest model that can capture the converging-diverging nature of natural pore channels consists of alternating segments of capillary tubes with larger and smaller radii, respectively; see :numref:`fig:eco2n.8`. +While in straight capillary tube models permeability remains finite as long as porosity is non-zero, in models of tubes with different radii in series, permeability is reduced to zero at a finite porosity. + +.. subfigure:: AB + :name: fig:eco2n.8 + :layout-sm: A|B + :subcaptions: above + :gap: 32px + + .. image:: ../figures/pore_conceptual_model.png + :alt: Conceptual model + + .. image:: ../figures/pore_tubes_in_series.png + :alt: Tubes-in-series + + Model for converging-diverging pore channels. + +From the tubes-in-series model shown in :numref:`fig:eco2n.8`, the following relationship can be derived (:cite:label:`verma1988thermohydrological`) + +.. math:: + :label: eq:eco2n.24 + + \frac{k}{k_0} = \theta^2 \frac{1 - \Gamma + \frac{\Gamma}{\omega^2}}{1 - \Gamma + \Gamma \left( \frac{\theta}{\theta + \omega - 1} \right)^2} + +Here + +.. math:: + :label: eq:eco2n.25 + + \theta = \frac{1 - S_s - \phi_r}{1 - \phi_r} + +depends on the fraction :math:`1 - S_s` of original pore space that remains available to fluids, and on a parameter :math:`\phi_r`, which denotes the fraction of original porosity at which permeability is reduced to zero. +:math:`\Gamma` is the fractional length of the pore bodies, and the parameter :math:`\omega` is given by + +.. math:: + :label: eq:eco2n.26 + + \omega = 1 + \frac{\frac{1}{\Gamma}}{\frac{1}{\phi_r} - 1} + +Therefore, Eq. :math:numref:`eq:eco2n.24` has only two independent geometric parameters that need to be specified, :math:`\phi_r` and :math:`\Gamma`. +As an example, :numref:`fig:eco2n.9` shows the permeability reduction factor from Eq. :math:numref:`eq:eco2n.24`, plotted against :math:`\frac{\phi}{\phi_0} \equiv \left( 1 - S_s \right)`, for parameters of :math:`\phi_r` = :math:`\Gamma` = 0.8. + +.. figure:: ../figures/porosity_permeability.png + :name: fig:eco2n.9 + :width: 75% + + Porosity-permeability relationship for tubes-in-series model, after :cite:label:`verma1988thermohydrological`. + +For parallel-plate fracture segments of different aperture in series, a relationship similar to Eq. :math:numref:`eq:eco2n.24` is obtained, the only difference being that the exponent 2 is replaced everywhere by 3 (:cite:label:`verma1988thermohydrological`). +If only straight capillary tubes of uniform radius are considered, we have :math:`\phi_r` = 0, :math:`\Gamma` = 0, and Eq. :math:numref:`eq:ewasg.2` simplifies to + +.. math:: + :label: eq:eco2n.27 + + \frac{k}{k_0} = \left( 1 - S_s \right)^2 + + +Selections +---------- + +Various options for ECO2N can be selected through parameter specifications in data block **SELEC**. +Default choices corresponding to various selection parameters set equal to zero provide the most comprehensive thermophysical property model. +Certain functional dependencies can be turned off or replaced by simpler and less accurate models, see below. +These options are offered to enable users to identify the role of different effects in a flow problem, and to facilitate comparison with other simulation programs that may not include full dependencies of thermophysical properties. + +.. list-table:: Record **SELEC.1**. + :name: tab:eco2n.selec.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``IE(1)`` + - I5 + - set equal to 1, to read one additional data record (a larger value with more data records is acceptable, but only one additional record will be used by ECO2N). + * - ``IE(11)`` + - I5 + - | selects dependence of permeability on the fraction :math:`\frac{\phi_f}{\phi_0} = \left( 1 - S_s \right)` of original pore space that remains available to fluids: + | 0: permeability does not vary with :math:`\phi_f`. + | 1: :math:`\frac{k}{k_0} = \left( 1 - S_s \right)^{\gamma}`, with :math:`\gamma` = ``FE(1)``. + | 2: fractures in series, i.e., Eq. :math:numref:`eq:eco2n.24` with exponent 2 everywhere replaced by 3. + | 3: tubes-in-series, i.e., Eq. :math:numref:`eq:eco2n.24`. + * - ``IE(12)`` + - I5 + - | allows choice of model for water solubility in CO\ :sub:`2`: + | 0: after Spycher and Pruess (2005). + | 1: evaporation model; i.e., water density in the CO\ :sub:`2`-rich phase is calculated as density of saturated water vapor at prevailing temperature and salinity. + * - ``IE(13)`` + - I5 + - | allows choice of dependence of brine density on dissolved CO\ :sub:`2`: + | 0: brine density varies with dissolved CO\ :sub:`2` concentration, according to García's (2001) correlation for temperature dependence of molar volume of dissolved CO\ :sub:`2`. + | 1: brine density is independent of CO\ :sub:`2` concentration. + * - ``IE(14)`` + - I5 + - | allows choice of treatment of thermophysical properties as a function of salinity: + | 0: full dependence. + | 1: no salinity dependence of thermophysical properties (except for brine enthalpy; salt solubility constraints are maintained). + * - ``IE(15)`` + - I5 + - | allows choice of correlation for brine enthalpy at saturated vapor pressure: + | 0: after Lorenz et al. (2000). + | 1: after Michaelides (1981). + | 2: after Miller (1978). + +.. list-table:: Record **SELEC.2**. + :name: tab:eco2n.selec.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``FE(1)`` + - E10.4 + - parameter :math:`\gamma` (for ``IE(11)`` = 1); parameter :math:`\phi_r` (for ``IE(11)`` = 2, 3). + * - ``FE(2)`` + - E10.4 + - parameter :math:`\Gamma` (for ``IE(11)`` = 2, 3). diff --git a/doc/source/tough3/eos/eos1.rst b/doc/source/tough3/eos/eos1.rst new file mode 100644 index 00000000..16ad1c1d --- /dev/null +++ b/doc/source/tough3/eos/eos1.rst @@ -0,0 +1,78 @@ +.. _eos1: + +EOS1 +==== + +This is the most basic EOS module, providing a description of pure water in its liquid, vapor, and two-phase states. +All water properties (density, specific enthalpy, viscosity, saturated vapor pressure) are calculated from the steam table equations as given by the :cite:label:`ifc1967formulation`. +The formulation includes subregion 1 (subcooled water below T=350˚C), subregion 2 (superheated steam), and subregion 6 (saturation line up to T=350˚C). +In these regions, density and internal energy are represented within experimental accuracy. +Viscosity of liquid water and steam are represented to within 2.5% by correlations given in the same reference. +For details of the formulation, its accuracy and range of validity, refer to the original publication. +Vapor pressure lowering from capillary and adsorption effects is neglected; thus, in two-phase conditions vapor pressure is equal to saturated vapor pressure of bulk liquid. + + +Specifications +-------------- + +A summary of EOS1 specifications and parameters is given in :numref:`tab:eos1`. +The default parameter settings are (``NK``, ``NEQ``, ``NPH``, ``NB``) = (1, 2, 2, 6) for solving mass and energy balances for a single water component. +The option ``NEQ`` = 1 is available for running single-phase flow problems that involve only liquid water, or only superheated steam, under constant temperature conditions. +EOS1 also has a capability for representing two waters of identical physical properties, which contain different trace constituents. +This option can be invoked by specifying (``NK``, ``NEQ``, ``NPH``, ``NB``) = (2, 3, 2, 6) in data block **MULTI**. +With this option, two water mass balances will be set up, allowing separate tracking of the two components. +For example, one could specify the water initially present in the flow system as "water 1", while water being injected is specified as "water 2". +When the two waters option is chosen, molecular diffusion can also be modeled by setting parameter ``NB`` equal to 8. + +The primary variables are (:math:`P`, :math:`T``) for single-phase points, (:math:`P_g`, :math:`S_g`) for two-phase points. +For the convenience of the user it is possible to initialize two-phase points as (:math:`T`, :math:`S_g`); when the numerical value of the first primary variable is less than 374.15, this will automatically be taken to indicate that this represents temperature rather than pressure, and will cause variables to be converted internally from (:math:`T`, :math:`S_g`) to (:math:`P_{sat}(T)`, :math:`S_g`) prior to execution. +When the two waters option is used, primary variables are (:math:`P`, :math:`T`, :math:`X`) for single-phase points, and (:math:`P_g`, :math:`S_g`, :math:`X`) for two-phase points, where :math:`X` is the mass fraction of "water 2" present. +All thermophysical properties (density, specific enthalpy, viscosity) are assumed independent of the component mixture; i.e., independent of mass fraction :math:`X`. This approximation is applicable for problems in which the identity of different waters is distinguished by the presence of different trace constituents, which occur in concentrations low enough to not appreciably affect the thermophysical properties. + +.. list-table:: Summary of EOS1. + :name: tab:eos1 + :widths: 1 3 + :align: center + + * - Components + - | #1: water + | #2: "water 2" (optional) + * - Parameter choices + - | (``NK``, ``NEQ``, ``NPH``, ``NB``) = + | (1, 2, 2, 6) one water component, nonisothermal (default) + | (1, 1, 2, 6) only liquid, or only vapor; isothermal + | (2, 3, 2, 6) two-waters, nonisothermal* + | Molecular diffusion can be modeled by setting ``NK`` = 2, ``NB`` = 8 + * - Primary variables + - | Single-phase conditions: + | (:math:`P`, :math:`T`, :math:`[X]`): (pressure, temperature, [mass fraction of water 2]†) + | Two-phase conditions: + | (:math:`P_g`, :math:`S_g`, :math:`[X]`): (gas phase pressure, gas saturation, [mass fraction of water 2]†) + + +.. note:: + + | \* two waters cannot be run in isothermal mode, because in this case temperature is not the last primary variable. + | † optional, for ``NK`` = 2 only. + +The phase diagnostic procedures are as follows. +When initializing a problem, each grid block has two primary variables (:math:`X1`, :math:`X2`). +The meaning of :math:`X2` depends on its numerical value: for :math:`X2` > 1.5, :math:`X2` is taken to be temperature in ˚C, otherwise it is gas saturation. +Although physically saturation is restricted to the range :math:`0 \le S \le 1`, it is necessary to allow saturations to exceed 1 during the Newton-Raphson iteration. +If :math:`X2` is temperature, this indicates that single-phase conditions are present; specifically, for :math:`P` (= :math:`X1`) :math:`\gt P_{sat}(T)` we have single-phase liquid, otherwise we have single-phase steam. +Subsequent to initialization, the phase condition is identified simply based on the value of :math:`S_g` as stored in the *PAR* array: + +- 0: single-phase liquid +- 1: single-phase vapor +- :math:`0 \lt S_g \lt 1`: two-phase + + +Phase change is recognized as follows. +For single-phase points the temperature (second primary variable) is monitored, and the corresponding saturation pressure is compared with actual fluid pressure :math:`P`. +For a vapor (liquid) point to remain vapor (liquid), we require that :math:`P \lt P_{sat}` (:math:`P \gt P_{sat}`); if this requirement is violated, a transition to two-phase conditions takes place. +The primary variables are then switched to (:math:`P_g`, :math:`S_g`), and these are initialized as :math:`P_g = P_{sat}(T)`, :math:`S_g` = 0.999999 if the point was in the vapor region, and :math:`S_g` = 10\ :sup:`-6` if it was in the liquid region. +For two-phase points :math:`S_g` is monitored; we require that :math:`0 \lt S_g \lt 1` for a point to remain two-phase. +If :math:`S_g \lt 0` this indicates disappearance of the gas phase; the primary variables are then switched to (:math:`P`, :math:`T`), and the point is initialized as single-phase liquid, with :math:`T` taken from the last Newton-Raphson iteration, and :math:`P` = 1.000001 × :math:`P_{sat}(T)`. +For :math:`S_g \gt 1` the liquid phase disappears; again the primary variables are switched to (:math:`P`, :math:`T`), and the point is initialized as single-phase vapor, with :math:`T` taken from the last Newton-Raphson iteration, and :math:`P` = 0.999999 × :math:`P_{sat}(T)`. +Note that in these phase transitions we preserve temperature rather than pressure from the last iteration. +This is preferable because in most flow problems temperature tends to be more slowly varying than pressure. diff --git a/doc/source/tough3/eos/eos2.rst b/doc/source/tough3/eos/eos2.rst new file mode 100644 index 00000000..fef1d157 --- /dev/null +++ b/doc/source/tough3/eos/eos2.rst @@ -0,0 +1,53 @@ +.. _eos2: + +EOS2 +==== + +This is an updated version of the fluid property module originally developed by :cite:label:`o1985fluid` for describing fluids in gas-rich geothermal reservoirs, which may contain CO\ :sub:`2` mass fractions ranging from a few percent to occasionally 80% or more (:cite:label:`atkinson1980behavior`). +EOS2 accounts for non-ideal behavior of gaseous CO\ :sub:`2`, and dissolution of CO\ :sub:`2` in the aqueous phase with heat of solution effects. +According to Henry's law, the partial pressure of a non-condensible gas (NCG) in the gas phase is proportional to the mole fraction of dissolved NCG in the aqueous phase + +.. math:: + :label: eq:eos2.1 + + P_{NCG} = K_h x_{aq}^{NCG} + +The Henry's law coefficient :math:`K_h` for dissolution of CO\ :sub:`2` in water is strongly dependent on temperature. +The correlation used in the previous release of EOS2 had been developed by :cite:label:`o1985fluid` for the elevated temperature conditions encountered in geothermal reservoirs. +It is accurate to within a few percent of experimental data in the temperature range of 40˚C ≤ :math:`T` ≤ 330˚C, but becomes rather inaccurate at lower temperatures and even goes to negative values for :math:`T` < 30˚C (see :numref:`fig:eos2.1`). +Subroutine *HENRY* in EOS2 was replaced with a new routine that uses the correlation developed by :cite:label:`battistelli1997simulator`, which is accurate for 0˚C ≤ :math:`T` ≤ 350˚C. +The Battistelli et al. formulation agrees well with another correlation that was developed by S. White (1996, private communication). + +.. figure:: ../figures/figure_eos2_1.png + :name: fig:eos2.1 + + Henry's law coefficients for dissolution of CO\ :sub:`2` in water. + +The viscosity of vapor - CO\ :sub:`2` mixtures is described with a formulation due to :cite:label:`pritchett1981baca`; other thermophysical property correlations are based on the model of :cite:label:`sutton1977boiling`. + + +Specifications +-------------- + +A summary of EOS2 specifications and parameters is given in :numref:`tab:eos2`. +A more detailed description and application to geothermal reservoir problems are given in the paper by :cite:label:`o1985fluid`. +EOS2 has the parameter settings of (``NK``, ``NEQ``, ``NPH``, ``NB``) = (2, 3, 2, 6) for solving mass and energy balances for water and CO\ :sub:`2`. +Molecular diffusion can also be modeled by setting parameter ``NB`` equal to 8. + +.. list-table:: Summary of EOS2. + :name: tab:eos2 + :widths: 1 3 + :align: center + + * - Components + - | #1: water + | #2: CO\ :sub:`2` + * - Parameter choices + - | (``NK``, ``NEQ``, ``NPH``, ``NB``) = + | (2, 3, 2, 6) + | Molecular diffusion can be modeled by setting ``NB`` = 8 + * - Primary variables + - | Single-phase conditions: + | (:math:`P`, :math:`T`, :math:`P_{CO_2}`): (pressure, temperature, CO\ :sub:`2` partial pressure) + | Two-phase conditions: + | (:math:`P_g`, :math:`S_g`, :math:`P_{CO_2}`): (gas phase pressure, gas saturation, CO\ :sub:`2` partial pressure) diff --git a/doc/source/tough3/eos/eos3.rst b/doc/source/tough3/eos/eos3.rst new file mode 100644 index 00000000..8b58edf6 --- /dev/null +++ b/doc/source/tough3/eos/eos3.rst @@ -0,0 +1,59 @@ +.. _eos3: + +EOS3 +==== + +This module is an adaptation of the EOS module of the TOUGH simulator, and implements the same thermophysical properties model (:cite:label:`pruess1987tough`). +All water properties are represented by the steam table equations as given by the :cite:label:`ifc1967formulation`. +Air is approximated as an ideal gas, and additivity is assumed for air and vapor partial pressures in the gas phase, :math:`P_g = P_a + P_v`. +The viscosity of air-vapor mixtures is computed from a formulation given by :cite:label:`hirschfelder1964molecular`. +The solubility of air in liquid water is represented by Henry's law, as follows. + +.. math:: + :label: eq:eos3.1 + + P_a = K_h x_{aq}^a + +where :math:`K_h` is Henry's constant and :math:`x_{aq}^a` is air mole fraction in the aqueous phase. +Henry's constant for air dissolution in water is a slowly varying function of temperature, varying from 6.7 x 10:\ :sup:`9` Pa at 20˚C to 1.0 x 10\ :sup:`10` Pa at 60˚C and 1.1 x 10\ :sup:`10` Pa at 100˚C (:cite:label:`loomis1928solubilities`). +Because air solubility is small, this kind of variation is not expected to cause significant effects, and a constant :math:`P_a` = 10\ :sup:`10` Pa was adopted. + + +Specifications +-------------- + +A summary of EOS3 specifications and parameters is given in :numref:`tab:eos3`. +The default parameter settings are (``NK``, ``NEQ``, ``NPH``, ``NB``) = (2, 3, 2, 6). +The option ``NEQ`` = 2 is available for constant temperature conditions. +The choice of primary thermodynamic variables is (:math:`P`, :math:`X`, :math:`T`) for single-phase, (:math:`P_g`, :math:`S_g` + 10, :math:`T`) for two-phase conditions. +The rationale for the seemingly bizarre choice of :math:`S_g` + 10 as a primary variable is as follows. +As an option, we wish to be able to run isothermal two-phase flow problems with the specification ``NEQ`` = ``NK``, so that the then superfluous heat balance equation needs not be engaged. +This requires that temperature :math:`T` be the third primary variable. +The logical choice of primary variables would then appear to be (:math:`P`, :math:`X`, :math:`T`) for single-phase and (:math:`P_g`, :math:`S_g`, :math:`T`) for two-phase conditions. +However, both :math:`X` and :math:`S_g` vary over the range (0, 1), so that this would not allow a distinction of single-phase from two-phase conditions solely from the numerical range of primary variables. +By taking the second primary variable for two-phase conditions to be :math:`X2` = 10 + :math:`S_g`, the range of that variable is shifted to the interval (10, 11), and a distinction between single and two-phase conditions can be easily made. +As a convenience to users, we retain the capability to optionally initialize flow problems with TOUGH-style primary variables by setting ``MOP(19)`` = 1. +In TOUGH we have (:math:`P`, :math:`T`, :math:`X`) for single-phase conditions, (:math:`P_g`, :math:`S_g`, :math:`T`) for two-phase conditions. + +.. list-table:: Summary of EOS3. + :name: tab:eos3 + :widths: 1 3 + :align: center + + * - Components + - | #1: water + | #2: air + * - Parameter choices + - | (``NK``, ``NEQ``, ``NPH``, ``NB``) = + | (2, 3, 2, 6) water and air, nonisothermal (default) + | (2, 2, 2, 6) water and air, isothermal + | Molecular diffusion can be modeled by setting ``NB`` = 8 + * - Primary variables* + - | Single-phase conditions: + | (:math:`P`, :math:`X`, :math:`T`): (pressure, air mass fraction, temperature) + | Two-phase conditions: + | (:math:`P_g`, :math:`S_g` + 10, :math:`T`): (gas phase pressure, gas saturation plus 10, temperature) + +.. note:: + + \* By setting ``MOP(19)`` = 1, initialization can be made with TOUGH-style variables (:math:`P`, :math:`T`, :math:`X`) for single-phase, (:math:`P_g`, :math:`S_g`, :math:`T`) for two-phase. diff --git a/doc/source/tough3/eos/eos4.rst b/doc/source/tough3/eos/eos4.rst new file mode 100644 index 00000000..0a26acc6 --- /dev/null +++ b/doc/source/tough3/eos/eos4.rst @@ -0,0 +1,84 @@ +.. _eos4: + +EOS4 +==== + +This module is an adaptation of the :ref:`eos3` module, and implements vapor pressure lowering effects. +Vapor pressure :math:`P_v` is expressed by Kelvin's equation, +Eq. :math:numref:`eq:eos4.1` (:cite:label:`edlefsen1943thermodynamics`); it is a function not only of temperature, but depends also on capillary pressure, which in turn is a function of saturation. + +.. math:: + :label: eq:eos4.1 + + P_v (T, S_l) = f_{VPL} (T, S_l) P_{sat} (T) + +where + +.. math:: + :label: eq:eos4.2 + + f_{VPL} = \exp \left( \frac{M_w P_{cl}(S_l)}{\rho_l R \left( T + 273.15 \right)} \right) + +is the vapor pressure lowering factor. +:math:`P_{sat}` is the saturated vapor pressure of bulk aqueous phase, :math:`T` is temperature, :math:`S_l` is the liquid (water) saturation, :math:`P_{cl}` is the capillary pressure (i.e., the difference between aqueous and gas phase pressures), :math:`M_w` is the molecular weight of water, :math:`rho_l` is the liquid density, and :math:`R` is the universal gas constant. + + +Specifications +-------------- + +A summary of EOS4 specifications and parameters is given in :numref:`tab:eos4`. +The default parameter settings are (``NK``, ``NEQ``, ``NPH``, ``NB``) = (2, 3, 2, 6). +The option for single-component mode of water only, no air (``NK`` = 1) is available for nonisothermal conditions (``NEQ`` = 2). +The specification of thermophysical properties in this EOS differs from :ref:`eos3` in that provision is made for vapor pressure lowering effects. +The primary variables are (:math:`P`, :math:`T`, :math:`P_a`) for single-phase conditions and (:math:`P_g`, :math:`S_g`, :math:`P_a`) for two-phase conditions, where :math:`P_a` is the partial pressure of air. +Note that in two-phase conditions temperature is not among the primary variables. +It is implicitly determined from the relationship :math:`P_g - P_a = P_v`, with :math:`P_v = P_v(T, S_l)` as given in Eq. :math:numref:`eq:eos4.1`. + +It would be possible to use other sets of primary variables; in particular, temperature could be used also in two-phase conditions. +Our test calculations for a number of examples indicated, however, that the choice (:math:`P_g`, :math:`S_g`, :math:`P_a`) usually leads to better convergence behavior than the choice (:math:`P_g`, :math:`S_g`, :math:`T`). +The reason for the numerically inferior behavior of the latter set is in the air mass balance. +With the variables (:math:`P_g`, :math:`S_g`, :math:`T`), the amount of air present in a grid block becomes controlled by the difference between total gas pressure :math:`P_g` and effective vapor pressure :math:`P_v = P_{sat}(T) f_{VPL}(T, S_l)` (Eq. :math:numref:`eq:eos4.1`), which can be subject to very severe numerical cancellation. +From the applications viewpoint, however, initialization of a flow problem with the set (:math:`P_g`, :math:`S_g`, :math:`T`) may be much more physical and convenient. +EOS4 allows the initialization of two-phase points as (:math:`P_g`, :math:`S_g`, :math:`T`); this capability can be selected by specifying ``MOP(19)`` = 1. +When using ``MOP(19)`` = 1, the second primary variable upon initialization can also be relative humidity :math:`RH`, expressed as a fraction (0 < :math:`RH` ≤ 1); this choice is made by entering the second primary variable as a negative number, which will serve as a flag to indicate that it means (negative of) relative humidity, and will be internally converted to saturation in the initialization phase. +The conversion consists of iteratively solving Kelvin's equation for given :math:`RH = f_{VPL}(T, S_l)` for :math:`S_l`. +Users need to beware that relative humidity specifications must be within the range that is feasible for the capillary pressure functions used. +If maximum capillary pressures are not strong enough to accommodate a chosen value of :math:`RH`, a diagnostic will be printed and execution will terminate. + +.. list-table:: Summary of EOS4. + :name: tab:eos4 + :widths: 1 3 + :align: center + + * - Components + - | #1: water + | #2: air + * - Parameter choices + - | (``NK``, ``NEQ``, ``NPH``, ``NB``) = + | (2, 3, 2, 6) water and air, nonisothermal (default) + | (1, 2, 2, 6) water only (no air), nonisothermal + | ``MOP(20)`` = 1 optionally suppresses vapor pressure lowering effects + | Molecular diffusion can be modeled by setting ``NB`` = 8 + * - Primary variables*† + - | Single-phase conditions: + | (:math:`P_g`, :math:`S_g`, :math:`P_a`): (pressure, temperature, air partial pressure) + | Two-phase conditions: + | :math:`P_g`, :math:`S_g`, :math:`P_a`: (gas phase pressure, gas saturation, air partial pressure) + +.. note:: + + | \* By setting ``MOP(19)`` = 1, initialization of two-phase conditions can be made with (:math:`P_g`, :math:`S_g`, :math:`T`), or with (:math:`P_g`, :math:`-RH`, :math:`T`), where :math:`RH` is relative humidity (0 < :math:`RH` ≤ 1). + | † By setting ``MOP(19)`` = 2, initialization can be made with EOS3-style variables (:math:`P`, :math:`X`, :math:`T`) for single-phase (:math:`X` is air mass fraction), (:math:`P_g`, :math:`S_g` + 10, :math:`T`) for two-phase. + +As a further convenience to users, the choice ``MOP(19)`` = 2 allows EOS4 to be initialized with :ref:`eos3` variables of (:math:`P`, :math:`X`, :math:`T`) for single-phase, (:math:`P_g`, :math:`S_g` + 10, :math:`T`) for two-phase. +This way continuation runs with EOS4 can be made from :ref:`eos3`-generated conditions. +Note that, when using ``MOP(19)`` ≠ 0 options, data block or file INCON must terminate on a blank record. +If ``+++`` is encountered in *INCON*, it is assumed that primary variables are provided in agreement with internal usage; ``MOP(19)`` is then reset to zero and an informative message is printed. + +Vapor pressure lowering effects raise new issues because they make it possible for a liquid phase to exist under conditions where vapor partial pressure and gas phase total pressure are less than the saturation pressure. +What is the appropriate pressure at which liquid phase density, enthalpy and viscosity are to be evaluated? +We believe that a physically plausible choice is to take :math:`P_1 = \max(P_g, P_{sat})`, and this has been implemented in EOS4. +The implementation faces a difficulty, however, because temperature is not among the primary variables in two-phase conditions, so that :math:`P_{sat}` is only implicitly known; moreover, vapor pressure lowering effects are functionally dependent on liquid phase density, which is also a function of temperature. +This leads to a potentially unstable situation with regard to the choice of liquid phase pressure under conditions where :math:`P_g \approx P_{sat}`, which happens to be a common occurrence in boiling regions. In order to avoid this problem we evaluate liquid water density in the Kelvin equation for vapor pressure lowering (Eq. :math:numref:`eq:eos4.1`) always at :math:`P_l = P_{sat}`, which will be an excellent approximation due to the small compressibility of liquid water. +In all accumulation and flow terms the density of liquid water is evaluated at :math:`P_l = \max(P_g, P_{sat})`. +Vapor pressure lowering can be optionally suppressed by setting ``MOP(20)`` = 1. diff --git a/doc/source/tough3/eos/eos5.rst b/doc/source/tough3/eos/eos5.rst new file mode 100644 index 00000000..41801d0f --- /dev/null +++ b/doc/source/tough3/eos/eos5.rst @@ -0,0 +1,96 @@ +.. _eos5: + +EOS5 +==== + +The EOS5 fluid property module is developed to study the behavior of groundwater systems in which hydrogen releases take place. +For instance, in a number of waste disposal projects, corrosive metals are to be emplaced in geologic formations beneath the water table. +These will evolve a mixture of gases, with hydrogen being the chief constituent. +EOS5 is a close "cousin" of :ref:`eos3`, the main difference being that the air component is replaced by hydrogen, with considerably different thermophysical properties (see :numref:`tab:eos5.1` to :numref:`tab:eos5.3`). +The assignment and handling of primary thermodynamic variables in EOS5 is identical to :ref:`eos3` (see :numref:`tab:eos5.4`). +The main differences in the assignment of secondary parameters are as follows. +Density of gaseous hydrogen is computed from the ideal gas law. +Viscosity and water solubility of hydrogen are interpolated from the data given in Table 1. +For temperatures in excess of 25˚C, the solubility at 25˚C is used. + +.. list-table:: Density of hydrogen at :math:`P` = 1 bar. + :name: tab:eos5.1 + :header-rows: 1 + :align: center + + * - Temperature + - Experimental* + - Ideal gas law† + * - 280 K + - 0.086546 kg/m\ :sup:`3` + - 0.08660 kg/m\ :sup:`3` + * - 300 K + - 0.080776 kg/m\ :sup:`3` + - 0.08082 kg/m\ :sup:`3` + +.. list-table:: Viscosity* of hydrogen. + :name: tab:eos5.2 + :header-rows: 1 + :align: center + + * - Pressure + - :math:`T` = 0˚C + - :math:`T` = 100˚C + * - 1 bar + - 8.40 x 10\ :sup:`-6` Pa·s + - 10.33 x 10\ :sup:`-6` Pa·s + * - 100 bar + - 8.57 x 10\ :sup:`-6` Pa·s + - 10.44 x 10\ :sup:`-6` Pa·s + +.. list-table:: Solubility in water at :math:`P` = 1 bar\ :sup:`§`. + :name: tab:eos5.3 + :header-rows: 1 + :align: center + + * - Temperature + - Solubility + * - :math:`T` = 0˚C + - 1.92 x 10\ :sup:`-6` g H\ :sub:`2`/g H\ :sub:`2`\O + * - :math:`T` = 25˚C + - 1.54 x 10\ :sup:`-6` g H\ :sub:`2`/g H\ :sub:`2`\O + +.. note:: + + | \* from :cite:label:`vargaftik1975tables`, p. 39. + | † universal gas constant :math:`R` = 8314.56 J/mol/˚C; molecular weight of hydrogen 2.0160 kg/mol. + | \ :sup:`§` after :cite:label:`dean1999lange`; solubility at different pressures is computed from Henry's law. + + +Specifications +-------------- + +A summary of EOS5 specifications and parameters is given in Table :numref:`tab:eos5.4`. +The default parameter settings are (``NK``, ``NEQ``, ``NPH``, ``NB``) = (2, 3, 2, 6). +The option ``NEQ`` = 2 is available for constant temperature conditions. +The choice of primary thermodynamic variables is (:math:`P`, :math:`X`, :math:`T`) for single-phase, (:math:`P_g`, :math:`S_g` + 10, :math:`T`) for two-phase conditions. +As a convenience to users, we retain the capability to optionally initialize flow problems with TOUGH-style primary variables by setting ``MOP(19)`` = 1. +In TOUGH we have (:math:`P`, :math:`T`, :math:`X`) for single-phase conditions, (:math:`P_g`, :math:`S_g`, :math:`T`) for two-phase conditions. + +.. list-table:: Summary of EOS5. + :name: tab:eos5.4 + :widths: 1 3 + :align: center + + * - Components + - | #1: water + | #2: hydrogen + * - Parameter choices + - | (``NK``, ``NEQ``, ``NPH``, ``NB``) = + | (2, 3, 2, 6) water and hydrogen, nonisothermal (default) + | (2, 2, 2, 6) water and hydrogen, isothermal + | Molecular diffusion can be modeled by setting ``NB`` = 8 + * - Primary variables* + - | Single-phase conditions: + | (:math:`P`, :math:`X`, :math:`T`): (pressure, hydrogen mass fraction, temperature) + | Two-phase conditions: + | (:math:`P_g`, :math:`S_g` + 10, :math:`T`): (gas phase pressure, gas saturation plus 10, temperature) + +.. note:: + + \* By setting ``MOP(19)`` = 1, initialization can be made with TOUGH-style variables (:math:`P`, :math:`T`, :math:`X`) for single-phase, (:math:`P_g`, :math:`S_g`, :math:`T`) for two-phase. diff --git a/doc/source/tough3/eos/eos7.rst b/doc/source/tough3/eos/eos7.rst new file mode 100644 index 00000000..c066867a --- /dev/null +++ b/doc/source/tough3/eos/eos7.rst @@ -0,0 +1,163 @@ +.. _eos7: + +EOS7 +==== + +An extension of the :ref:`eos3` module for water/air mixtures, EOS7 represents the aqueous phase as a mixture of (pure) water and brine. +This approach is very useful for flow problems in which salinity does not reach saturated levels (:cite:label:`reeves1986theory, herbert1988coupled`). +The salinity of the aqueous phase is described by means of the brine mass fraction, Xb, and density and viscosity are interpolated from the values for the water and brine endmembers. +Salinity-dependent air solubility is also taken into account, but no allowance is made for reduction of vapor pressure with salinity. +The brine is modeled as NaCl solution, while the non-condensible gas is air, although the treatment could be adapted, with minor modifications, to other brines and gases. +The representation of the temperature and pressure dependence of thermophysical properties is somewhat more general than that of :cite:label:`reeves1986theory`, retaining the flexibility of the TOUGH3 formulation for nonisothermal processes. + +EOS7 can describe phase conditions ranging from single-phase liquid to two-phase to single-phase gas. +However, the approach of describing variably saline fluids not as mixtures of water and salt but as mixtures of water and brine has specific limitations which need to be considered in applications. +For example, in problems with significant boiling it would be possible for salinity to reach saturated levels, corresponding to brine mass fraction :math:`X_b` = 1 (supposing that the brine component was chosen as fully saturated salt solution). +Upon further boiling solid salt would precipitate, but solubility limits and solids precipitation are not taken into account in the approach used in EOS7 (these can be modeled with the EWASG module, see the addendum for EWASG). +As evaporation continues from a saline aqueous phase, eventually brine mass fraction would increase beyond :math:`X_b` = 1, in which case other mass fractions would become negative, and non-physical results would be obtained. +From a physical viewpoint brine mass fraction in the gas phase should always be equal to zero, but the only way the brine mass balance can be maintained during phase transitions from two-phase to single-phase vapor conditions is by allowing :math:`X_b`, gas to vary freely. +Users need to carefully examine problem setups and results to guard against unphysical results in applications that involve boiling. + +We now briefly summarize the treatment of thermophysical properties in EOS7. +The density of the aqueous phase is calculated from the assumption, shown to be very accurate by :cite:label:`herbert1988coupled`, that fluid volume is conserved when water and brine are mixed. +Mixture density :math:`\rho_m` can then be expressed in terms of water and brine densities as follows + +.. math:: + :label: eq:eos7.1 + + \frac{1}{\rho_m} = \frac{1 - X_b}{\rho_w} + \frac{X_b}{\rho_b} + +where :math:`\rho_w` and :math:`\rho_b` are water and brine density, respectively. +Eq. :math:numref:`eq:eos7.1` applies to densities at fixed pressure and temperature conditions. +In order to achieve a simple approximation for fluid density at variable temperatures and pressures, EOS7 takes compressibility and expansivity of brine to be equal to those of water. +This will provide a reasonable approximation at least for a limited range of temperatures and pressures around the reference conditions (:math:`P_0`, :math:`T_0`). +The default reference brine has a density of 1185.1 kg/m\ :sup:`3` at reference conditions of :math:`P_0` = 1 bar, :math:`T_0` = 25˚C, corresponding to an NaCl solution of 24.98 wt-%, or 5.06 molar (:cite:label:`potter1977volumetric`; cited after :cite:label:`finley1982swift`). +The user may specify different reference conditions and brine densities. +Effects of salinity on the enthalpy of the aqueous phase are ignored. + +Following :cite:label:`herbert1988coupled`, salinity effects on aqueous phase viscosity are modeled with a polynomial correction to the viscosity of pure water. +Mixture viscosity :math:`\mu_m` is represented as follows + +.. math:: + :label: eq:eos7.2 + + \mu_m (P, T, X_b) = \mu_w (P, T) f(X_b) + +where + +.. math:: + :label: eq:eos7.3 + + f(X_b) = 1 + \nu_1 X_b + \nu_2 X_b^2 + \nu_3 X_b^3 + +with default values of :math:`\nu_1` = 0.4819, :math:`\nu_2` = -0.2774, and :math:`\nu_3` = 0.7814. +Different values for the coefficients may be specified by the user. + +Gas (air) dissolution in the aqueous phase is modeled by Henry's law, as follows + +.. math:: + :label: eq:eos7.4 + + P_a = K_h x_{aq}^a + +where :math:`K_h` is Henry's constant and :math:`x_{aq}^a` is air mole fraction in the aqueous phase. +In saline solutions, gases are generally less soluble than in water ("salting out" effect). +For a 5 :math:`N` (molar) NaCl solution, nitrogen solubility is virtually independent of temperature in the range 0˚C ≤ :math:`T` ≤ 100˚C, and corresponds to a Henry's constant of :math:`K_h` = 4.0 x 10\ :sup:`10` Pa (:cite:label:`cygan1991solubility`). + +We retain the value of :math:`K_h` = 10\ :sup:`10` Pa for pure water, and represent air solubility (inverse of Henry's constant) as a linear function of mixture molarity :math:`N_m`, as follows + +.. math:: + :label: eq:eos7.5 + + \frac{1}{K_h} = 1.0 \times 10^{-10} + \frac{N_m}{5} \left( \frac{1}{4.0 \times 10^{10}} - 10^{-10} \right) + + +Specifications +-------------- + +A summary of EOS7 specifications and parameters appears in :numref:`tab:eos7`. +The default parameter settings are (``NK``, ``NEQ``, ``NPH``, ``NB``) = (3, 3, 2, 6). +The ``NK`` = 2 (no air) option may only be used for problems with single-phase liquid conditions throughout. +The primary variables are (:math:`P`, :math:`X_b`, :math:`X`, :math:`T`) for single-phase conditions and (:math:`P`, :math:`X_b`, :math:`S` + 10, :math:`T`) for two-phase conditions, where :math:`X` is air mass fraction. + +.. list-table:: Summary of EOS7. + :name: tab:eos7 + :widths: 1 3 + :align: center + + * - Components + - | #1: water + | #2: brine + | #3: air (optional)* + * - Parameter choices + - | (``NK``, ``NEQ``, ``NPH``, ``NB``) = + | (3, 3, 2, 6) water, brine, air, isothermal (default) + | (3, 4, 2, 6) water, brine, air, nonisothermal + | (2, 2, 2, 6) water, brine, isothermal* + | (2, 3, 2, 6) water, brine, nonisothermal* + | Molecular diffusion can be modeled by setting ``NB`` = 8 + * - Primary variables + - | Single-phase conditions: + | (:math:`P`, :math:`X_b`, :math:`X`, :math:`T`): (pressure, brine mass fraction, air mass fraction, temperature) + | Two-phase conditions: + | (:math:`P`, :math:`X_b`, :math:`S` + 10, :math:`T`): (gas phase pressure, brine mass fraction, gas saturation plus ten, temperature) + +.. note:: + + \* The ``NK`` = 2 (no air) option may only be used for problems with single-phase liquid conditions throughout. + + +Selections +---------- + +Users may specify parameters for reference brine in the TOUGH3 input file by means of an optional data block **SELEC**, as follows + +.. list-table:: Record **SELEC.1**. + :name: tab:eos7.selec.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``IE(1)`` + - I5 + - set equal to 2, to read two additional data records (a larger value with more additional data records is acceptable, but only the first two will be used by EOS7). + +.. list-table:: Record **SELEC.2**. + :name: tab:eos7.selec.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - :math:`P_0`\* + - E10.4 + - reference pressure (Pa). + * - :math:`T_0`\* + - E10.4 + - reference temperature (˚C). + * - :math:`\rho_b`\* + - E10.4 + - brine density at (:math:`P_0`, :math:`T_0`) (kg/m\ :sup:`3`). + +.. note:: + + \* If any of these parameters is entered as zero, default values of :math:`P_0` = 1 bar, :math:`T_0` = 25˚C, :math:`\rho_b` = 1185.1 kg/m\ :sup:`3` will be used. + For :math:`P_0` < 0, brine properties will be assumed identical to water. + +.. list-table:: Record **SELEC.3**. + :name: tab:eos7.selec.3 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - :math:`\nu_1`, :math:`\nu_2`, :math:`\nu_3` + - 3E10.4 + - coefficients for salinity correction of aqueous phase viscosity, see Eq. :math:numref:`eq:eos7.3`. diff --git a/doc/source/tough3/eos/eos7r.rst b/doc/source/tough3/eos/eos7r.rst new file mode 100644 index 00000000..b81337bd --- /dev/null +++ b/doc/source/tough3/eos/eos7r.rst @@ -0,0 +1,278 @@ +.. _eos7r: + +EOS7R +===== + +This is an enhanced version of the :ref:`eos7` module in which two additional mass components have been added, providing radionuclide transport capability for TOUGH3. +These components can undergo decay with user-specified half-life, with radionuclide 1 (Rn1 for short) being the "parent" and Rn2 the "daughter". +The radionuclides are considered water-soluble as well as volatile, but are not allowed to form a separate non-aqueous fluid phase. +Sorption onto the solid grains is also included. +The decaying components are normally referred to as radionuclides, but they may in fact be any trace components that decay, adsorb, and volatilize. +The decay process need not to be radioactive decay, but could be any process that follows a first-order decay law, such as biodegradation. +Stable trace components, such as volatile and water soluble organic chemicals (VOCs), can be modeled simply by setting half-life to very large values. +A detailed description of the mathematical model and numerical implementation used in EOS7R is available in a laboratory report, which also presents a number of illustrative problems, including verification against analytical solutions (:cite:label:`oldenburg1995eos7r`). +Here we highlight the main aspects of the thermophysical properties model. +Note that the current TOUGH3 does not include the dispersion module T2DM, therefore cannot simulate Fickian hydrodynamic dispersion. + +Radionuclide decay is described by + +.. math:: + :label: eq:eos7r.1 + + \frac{dM^{\kappa}}{dt} = -\lambda_{\kappa} M^{\kappa} + +where :math:`M^{\kappa}` is the mass of radionuclide :math:`\kappa` (= Rn1, Rn2) per unit volume, and the decay constant :math:`\lambda_{\kappa}` is related to the half-life by + +.. math:: + :label: eq:eos7r.2 + + T_{1/2} = \frac{\log(2)}{\lambda_{\kappa}} + +Adsorption of radionuclides on the solid grains is modeled as reversible instantaneous linear sorption, so that mass of radionuclide component :math:`\kappa` per unit reservoir volume is given by + +.. math:: + :label: eq:eos7r.3 + + M^{\kappa} = \phi \sum_{\beta} S_{\beta} \rho_{\beta} X_{\beta}^{\kappa} + \left( 1 - \phi \right) \rho_R \rho_{aq} X_{aq}^{\kappa} K_d + +where :math:`K_d` is the aqueous phase distribution coefficient (:cite:label:`de1986quantitative`, p. 256). + +In addition to adsorbing onto solid matrix grains, the radionuclide components may volatilize into the gas phase, if present. +Radionuclides partition between aqueous and gaseous phases according to Henry's law: + +.. math:: + :label: eq:eos7r.4 + + P_a^{\kappa} = K_h^{\kappa} x_{aq}^{\kappa} + +where :math:`P_a^{\kappa}` is the partial pressure in the gas phase of radionuclide :math:`\kappa`, :math:`K_h^{\kappa}` is Henry's constant and :math:`x_{aq}^{\kappa}` is the mole fraction of radionuclide :math:`\kappa` in the aqueous phase. +In EOS7R as in :ref:`eos7`, no solubility constraints are enforced for the brine. +Users need to be aware that there are inherent limitations in the ability of a water-brine mixture model to describe processes that involve significant vaporization. +Unphysical results may be obtained in thermal problems with strong vaporization effects. + +For the gas phase we assume ideal gas law for air and the radionuclides, and additivity of partial pressures. + +.. math:: + :label: eq:eos7r.5 + + P_{gas} = P_{air} + P_{vapor} + P_{Rn1} + P_{Rn2} + +Gas phase density is calculated as the sum of the partial densities of gaseous components, while gas phase viscosity and enthalpy are calculated from the same air-vapor mixing models used in :ref:`eos3`. +Apart from these approximations for gas phase viscosity and enthalpy, there is no restriction to "small" radionuclide concentrations in the gas phase, fully allowing gas phase radionuclide partial pressures. + +The thermophysical properties of the aqueous phase are assumed independent of radionuclide concentrations. +Implicit in this approximation is the assumption that aqueous radionuclide concentrations are small. +Users need to keep this limitation in mind, because EOS7R does not provide any intrinsic constraints on radionuclide concentrations. + + +Specifications +-------------- + +A summary of EOS7R specifications and parameters are given in :numref:`tab:eos7r`. +The default parameter settings are (``NK``, ``NEQ``, ``NPH``, ``NB``) = (5, 5, 2, 8). +The ``NK`` = 4 (no air) option may only be used for problems with single-phase liquid conditions throughout. +The primary variables are (:math:`P`, :math:`X_b`, :math:`X_{Rn1}`, :math:`X_{Rn2}`, :math:`X_{air}`, :math:`T`) for single-phase conditions and (:math:`P`, :math:`X_b`, :math:`X_{Rn1}`, :math:`X_{Rn2}`, :math:`S` + 10, :math:`T`) for two-phase conditions. + +.. list-table:: Summary of EOS7R. + :name: tab:eos7r + :widths: 1 3 + :align: center + + * - Components + - | #1: water + | #2: brine + | #3: Rn1 (radionuclide 1; "parent") + | #4: Rn2 (radionuclide 2; "daughter") + | #5: air (optional)† + * - Parameter choices + - | (``NK``, ``NEQ``, ``NPH``, ``NB``)\ :sup:`§` = + | (5, 5, 2, 8) water, brine, Rn1, Rn2, air, isothermal (default) + | (5, 6, 2, 8) water, brine, Rn1, Rn2, air, nonisothermal + | (4, 4, 2, 8) water, brine, Rn1, Rn2, no air, isothermal + | (4, 5, 2, 8) water, brine, Rn1, Rn2, no air, nonisothermal + | Molecular diffusion can be suppressed by setting ``NB`` = 6 + * - Primary variables\ :sup:`§` + - | Single-phase conditions: + | (:math:`P`, :math:`X_b`, :math:`X_{Rn1}`, :math:`X_{Rn2}`, :math:`X_{air}`, :math:`T`): (pressure, brine mass fraction, mass fraction of Rn1, mass fraction of Rn2, temperature) + | Two-phase conditions: + | (:math:`P`, :math:`X_b`, :math:`X_{Rn1}`, :math:`X_{Rn2}`, :math:`S` + 10, :math:`T`): (gas phase pressure, brine mass fraction, mass fraction of Rn1, mass fraction of Rn2, gas saturation plus ten, temperature)* + +.. note:: + + | † the no air option (``NK`` = 4) may only be used for problems with single-phase liquid conditions throughout. + | \ :sup:`§` parameter NKIN following NB may optionally be set to ``NKIN`` = ``NK`` - 2, in which caseradionuclide mass fractions will be omitted, and initialization will be made from only four :ref:`eos7`-style variables; radionuclide mass fractions will be initialized as zero. + | \* in two-phase conditions, :math:`X_{Rn1}` and :math:`X_{Rn2}` are mass fractions in the aqueous phase. + +The phase change diagnostics are as follows. +For single-phase liquid conditions, Henry's law is used to calculate the partial pressures that the non-condensible gases would have if a gas phase were present. +The total pressure that a gas phase would have if present is then calculated from Eq. :math:numref:`eq:eos7r.5`, using saturated vapor pressure at prevailing temperature. +This is compared with the aqueous phase pressure, and a transition to two-phase conditions is made when :math:`P_{gas}` :math:`P_{gas}` > :math:`P_{aq}`. +In two-phase conditions, the saturation variable is monitored. +A phase transition to single-phase liquid occurs when :math:`S_g` < 0, while for :math:`S_g` > 1 a transition to single-phase gas conditions is made. +For transitions from two-phase to single-phase liquid conditions, liquid pressure is initialized as :math:`P_{aq}` = (1 + 10\ :sup:`-6`) × :math:`P_{gas}`, with :math:`P_{gas}` given by Eq. :math:numref:`eq:eos7r.5`, while for transitions to single-phase gas conditions, pressure is initialized as (1 - 10\ :sup:`-6`) × :math:`P_{gas}`. +For single-phase gas conditions we monitor vapor pressure :math:`P_{vap} = P_{gas} - P_{air} - P_{Rn1} - P_{Rn2}`; a transition to two-phase conditions occurs when :math:`P_{vap}` > :math:`P_{gas}`. + + +Selections +---------- + +Brine and radionuclide properties are specified in the TOUGH3 input file by means of a data block **SELEC**, as follows. +Note that the current version of TOUGH3 does not include the dispersion module T2DM. + +.. list-table:: Record **SELEC.1**. + :name: tab:eos7r.selec.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``IE(1)`` + - I5 + - set equal to 6 to read six additional records with data for brine and radionuclides, and for hydrodynamic dispersion. The 7 input variables following ``IE(1)`` are for the dispersion module T2DM only and can be left blank if T2DM is not used. + * - ``NGBINP(1)`` + - I5 + - number of grid blocks in X (must always be equal to 1). + * - ``NGBINP(2)`` + - I5 + - number of grid blocks in Y. + * - ``NGBINP(3)`` + - I5 + - number of grid blocks in Z. + * - ``NFBL`` + - I5 + - number of the first ("left") column of grid blocks within the flow domain (defaults to 1 if zero or blank). + * - ``NFBR`` + - I5 + - number of the last ("right") column of grid blocks within the flow domain (defaults to ``NGBINP(2)`` if zero or blank). + * - ``NFBT`` + - I5 + - number of the first ("top") row of grid blocks within the flow domain (defaults to 1 if zero or blank). + * - ``NFBB`` + - I5 + - number of the last ("bottom") row of grid blocks within the flow domain (defaults to ``NGBINP(3)`` if zero or blank). + +.. list-table:: Record **SELEC.2**. + :name: tab:eos7r.selec.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - :math:`P_0`\* + - E10.4 + - reference pressure (Pa). + * - :math:`T_0`\* + - E10.4 + - reference temperature (˚C). + * - :math:`\rho_b`\* + - E10.4 + - brine density at (:math:`P_0`, :math:`T_0`) (kg/m\ :sup:`3`). + +.. note:: + + \* If any of these parameters is entered as zero, default values of :math:`P_0` = 1 bar, :math:`T_0` = 25˚C, :math:`\rho_b` = 1185.1 kg/m\ :sup:`3` will be used. + For :math:`P_0` < 0, brine properties will be assumed identical to water. + +.. list-table:: Record **SELEC.3**. + :name: tab:eos7r.selec.3 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - :math:`\nu_1`, :math:`\nu_2`, :math:`\nu_3` + - 3E10.4 + - coefficients for salinity correction of aqueous phase viscosity, following :cite:label:`herbert1988coupled`. + + .. math:: + :label: eq:eos7r.6 + + f(X_b) = 1 + \nu_1 X_b + \nu_2 X_b^2 + \nu_3 X_b^3 + + with default values of :math:`\nu_1` = 0.4819, :math:`\nu_2` = -0.2774, and :math:`\nu_3` = 0.7814. + Different values for the coefficients may be specified by the user. + +.. list-table:: Record **SELEC.4**. + :name: tab:eos7r.selec.4 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``ALPHAT`` + - E10.4 + - transverse dispersivity (m). + * - ``ALPHAL`` + - E10.4 + - longitudinal dispersivity (m). + +.. list-table:: Record **SELEC.5**. + :name: tab:eos7r.selec.5 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``FDDIAG(NP,NK)`` + - E10.4 + - ``NP`` = 1, 2; ``NK`` = 1, 2, 5 molecular diffusivities in units of m\ :sup:`2`/s; first the three gas phase diffusivities for water, brine, and air; then the three aqueous phase diffusivities for water, brine, and air. If a data block **DIFFU** is present, it will override the diffusivity specifications made in **SELEC**. + +.. list-table:: Record **SELEC.6**. + :name: tab:eos7r.selec.6 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``XHALF(3)`` + - E10.4 + - half-life of parent radionuclide (Rn1, component 3) (seconds). + * - ``XMW(3)`` + - E10.4 + - molecular weight of Rn1 (g/mol). + * - ``FDDIAG(NP,3)`` + - E10.4 + - molecular diffusivity of Rn1 in the gas phase in m\ :sup:`2`/s; followed by molecular diffusivity of Rn1 in the aqueous phase. If a data block **DIFFU** is present, it will override the diffusivity specifications made in **SELEC**. + * - + - 20X + - (void) + * - ``HCRN(1)`` + - E10.4 + - inverse Henry's constant :math:`K_h^{-1}` (see Eq. :math:numref:`eq:eos7r.4`) for parent radionuclide Rn1 (Pa\ :sup:`-1`). (The inverse Henry's constant can be thought of as an aqueous phase solubility). + +.. list-table:: Record **SELEC.7**. + :name: tab:eos7r.selec.7 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``XHALF(4)`` + - E10.4 + - half-life of parent radionuclide (Rn2, component 4) (seconds). + * - ``XMW(4)`` + - E10.4 + - molecular weight of Rn2 (g/mol). + * - ``FDDIAG(NP,4)`` + - E10.4 + - molecular diffusivity of Rn2 in the gas phase in m\ :sup:`2`/s; followed by molecular diffusivity of Rn2 in the aqueous phase. If a data block **DIFFU** is present, it will override the diffusivity specifications made in **SELEC**. + * - + - 20X + - (void) + * - ``HCRN(1)`` + - E10.4 + - inverse Henry's constant :math:`K_h^{-1}` (see Eq. :math:numref:`eq:eos7r.4`) for daughter radionuclide Rn2 (Pa\ :sup:`-1`). (The inverse Henry's constant can be thought of as an aqueous phase solubility). diff --git a/doc/source/tough3/eos/eos8.rst b/doc/source/tough3/eos/eos8.rst new file mode 100644 index 00000000..cd8987ee --- /dev/null +++ b/doc/source/tough3/eos/eos8.rst @@ -0,0 +1,176 @@ +.. _eos8: + +EOS8 +==== + +EOS8 is an enhanced version of :ref:`eos3`, and is developed from :ref:`eos3` by adding a third non-volatile, insoluble component, called "oil", which can only exist in a separate, immiscible phase. +This module provides a very basic and simple capability for modeling three fluid phases, including gaseous, aqueous, and oleic phases. +EOS8 can represent what in petroleum engineering is often referred to as a "dead oil", meaning a non-aqueous phase liquid that has no volatile or soluble components, so that it is present only in the non-aqueous phase. +The thermophysical property description related to the third (oil) phase is intentionally kept very simple and, although EOS8 may be applicable to some flow problems of practical interest as is, it should be considered a development platform rather than a realistic description of three-phase fluid systems. + +The relative permeabilities of the gas and aqueous phases are considered functions of their respective phase saturations only, :math:`k_{rg} = k_{rg}(Sg)`, :math:`k_{rl} = k_{rl}(S_{aq})`, and are specified through input data in the usual manner. +The oil phase is considered of intermediate wettability, and its relative permeability is described in a schematic fashion that is intended to serve as a template for users. + +.. math:: + :label: eq:eos8.1 + + k_{ro} = \frac{S_o - S_{or}}{1 - S_{or}} + +Here, :math:`S_{or}` is the residual oil saturation. +Oil phase capillary pressure is neglected. +Viscosity, density, and specific enthalpy of the oil phase are described as functions of pressure and temperature through low-order polynomials, with user-specified parameters entered through data block **SELEC**. +More specifically, viscosity is written as + +.. math:: + :label: eq:eos8.2 + + \mu_{oil} = a + b \left( P - P_1 \right) + c \left( P - P_2 \right)^2 + d \left( T - T_1 \right) + e \left( T - T_2 \right)^2 + +Oil density is + +.. math:: + :label: eq:eos8.3 + + \rho_{oil} = \rho_0 + C \left( P - P_0 \right) - E \left( T - T_0 \right) + +where :math:`\rho_0` is oil density at reference pressure and temperature conditions of (:math:`P_0`, :math:`T_0`). +Specific enthalpy of oil is assumed proportional to temperature (normalized to :math:`h_{oil}` = 0 at :math:`T` = 0˚C). + +.. math:: + :label: eq:eos8.4 + + h_{oil} = \zeta T + +All parameters appearing in the oil phase property description in Eqs. :math:numref:`eq:eos8.2`, :math:numref:`eq:eos8.3`, and :math:numref:`eq:eos8.4` are to be provided by the user through data block **SELEC**. +The property correlations are implemented through arithmetic statement functions at the top of EOS8 in a manner that should be transparent to users. +Users may also refer detailed comment statements in the EOS8 source code for instructions of preparing EOS8 input data. + + +Specifications +-------------- + +A summary of EOS8 specifications and parameters is given in :numref:`tab:eos8`. +The default parameter settings are (``NK``, ``NEQ``, ``NPH``, ``NB``) = (3, 3, 3, 6). +The choice of primary thermodynamic variables is (:math:`P`, :math:`X`, :math:`S_o`, :math:`T`) for single-phase, (:math:`P_g`, :math:`S_g` + 10, :math:`S_o`, :math:`T`) for two-phase conditions. +With EOS8 the user can optionally run just two phases (aqueous-gas, without the oil phase), in which case the aqueous-gas process descriptions reduce to those of :ref:`eos3`. + +.. list-table:: Summary of EOS8. + :name: tab:eos8 + :widths: 1 3 + :align: center + + * - Components + - | #1: water + | #2: brine + | #3: oil + * - Parameter choices + - | (``NK``, ``NEQ``, ``NPH``, ``NB``) = + | (3, 3, 3, 6) water, air, oil, isothermal (default) + | (3, 4, 3, 6) water, air, oil, nonisothermal + | (2, 2, 2, 6) water, air, no oil, isothermal + | (2, 3, 2, 6) water, air, no oil, nonisothermal + * - Primary variables + - | Single-phase conditions: + | (:math:`P`, :math:`X`, :math:`S_o`, :math:`T`): (pressure, air mass fraction, oil phase saturation, temperature) + | Two-phase conditions: + | (:math:`P_g`, :math:`S_g` + 10, :math:`S_o`, :math:`T`): (gas phase pressure, gas saturation plus ten, oil phase saturation, temperature) + + +Selections +---------- + +The parameters used in the oil phase property description are specified in the TOUGH3 input file by means of a data block **SELEC**, as follows + +.. list-table:: Record **SELEC.1**. + :name: tab:eos8.selec.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``IE(1)`` + - I5 + - set equal to 6 to read six additional records with data for brine and radionuclides, and for hydrodynamic dispersion. + +.. list-table:: Record **SELEC.2**. + :name: tab:eos8.selec.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - + - X + - (void) + +.. list-table:: Record **SELEC.3**. + :name: tab:eos8.selec.3 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - + - X + - (void) + +.. list-table:: Record **SELEC.4**. + :name: tab:eos8.selec.4 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - :math:`S_{or}` + - E10.4 + - irreducible saturation of oil phase. + * - :math:`a` + - E10.4 + - constant portion in Eq. :math:numref:`eq:eos8.2` for oil phase viscosity. + +.. list-table:: Record **SELEC.5**. + :name: tab:eos8.selec.5 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - :math:`a`, :math:`P_1`, :math:`c`, :math:`P_2`, :math:`d`, :math:`T_1`, :math:`e`, :math:`T_2` + - 8E10.4 + - coefficients for oil phase viscosity in Eq. :math:numref:`eq:eos8.2`. + +.. list-table:: Record **SELEC.6**. + :name: tab:eos8.selec.6 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - :math:`\rho_0`, :math:`C`, :math:`P_0`, :math:`E`, :math:`T_0` + - 5E10.4 + - coefficients for oil density in Eq. :math:numref:`eq:eos8.3`. + +.. list-table:: Record **SELEC.7**. + :name: tab:eos8.selec.7 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - :math:`\zeta` + - 10.4 + - coefficients for oil specific enthalpy in Eq. :math:numref:`eq:eos8.4`. diff --git a/doc/source/tough3/eos/eos9.rst b/doc/source/tough3/eos/eos9.rst new file mode 100644 index 00000000..8236c734 --- /dev/null +++ b/doc/source/tough3/eos/eos9.rst @@ -0,0 +1,116 @@ +.. _eos9: + +EOS9 +==== + +This module considers variably saturated flow of a single aqueous phase, which consists entirely of a single water component, and neglects phase change effects. +The gas phase is treated as a passive bystander at constant pressure, and conditions are assumed to be isothermal. +Thus, no mass balance equation for gas and no heat balance is needed, and only a single water mass balance equation is solved for each grid block. +This is very efficient numerically, making EOS9 the module of choice for problems for which the underlying approximations are applicable. + +Liquid flow in EOS9 is described as follows: + +.. math:: + :label: eq:eos9.1 + + \frac{\partial}{\partial t} \phi \S_l \rho_l = \nabla \cdot \left( k \frac{k_{rl}}{\mu_l} \rho_l \nabla \left( P_l + \rho_l g z \right) \right) + +where :math:`\phi` is porosity, :math:`S_l` is water saturation, :math:`\rho_l` is water density, :math:`k` is absolute permeability, :math:`k_{rl}` is relative permeability to the aqueous phase, :math:`\mu_l` is water viscosity, :math:`P_l` is water pressure, :math:`g` is acceleration of gravity, and :math:`z` is defined positive upward. +Neglecting variations in liquid phase density and viscosity, as is appropriate for (nearly) isothermal conditions, Eq. :math:numref:`eq:eos9.1` simplifies to Richards' equation (:cite:label:`richards1931capillary`). + +.. math:: + :label: eq:eos9.2 + + \frac{\partial \theta}{\partial t} = \nabla \cdot \left( K \nabla h \right) + +where :math:`\theta = \phi S_l` is specific volumetric moisture content, :math:`K = k k_{rl} \frac{\rho_l g}{\mu_l}` is hydraulic conductivity, and :math:`h = z + \frac{P_l}{\rho_l g}` is the hydraulic head. +EOS9 can describe flow under partially saturated (0 < :math:numref:`S_l` < 1) as well as fully saturated conditions, and phase changes between the two. + + +Specifications +-------------- + +With only a single mass balance equation per grid block, there is only a single primary thermodynamic variable. +This is taken to be pressure for single-phase (saturated) conditions, and is water saturation for unsaturated conditions. +A distinction between the two is made simply on the basis of the numerical value of the first (and only) primary variable, :math:`X1`. +If :math:`X1` < 1, this indicates that If :math:`X1` represents water saturation and conditions are unsaturated; if If :math:`X1` is larger than a user-specified gas phase reference pressure (default :math:`P_{gas}` = 1.013 x 10\ :sup:`5` Pa), it is taken to be water pressure, and saturated conditions prevail. +When phase changes between saturated and unsaturated conditions occur, the primary variable is switched, as follows. +The numerical value of :math:`X1` and its change during the Newton-Raphson iteration process is monitored. +If :math:`X1` changes from being smaller than 1 to larger than 1, this indicates attainment of fully saturated conditions. +In that case :math:`X1` is switched to pressure, and is initialized at a pressure slightly in excess of gas phase reference pressure as :math:`X1 = P_{gas}(1 + \varepsilon)`, with :math:`\varepsilon` = 10\ :sup:`-6`. +If :math:`X1` changes from being larger than :math:`P_{gas}` to smaller than :math:`P_{gas}`, this indicates a transition from fully to partially saturated conditions. +:math:`X1` is then switched to saturation, and is initialized as :math:`X1 = 1 - \varepsilon`. +Actually, a transition from fully to partially saturated conditions is made only when :math:`X1` drops below :math:`P_{gas}(1 - \varepsilon)`; test calculations have shown that such a (small) finite-size window for phase change improves numerical stability and efficiency. + +In EOS9, the thermophysical properties of water are taken at default reference conditions of :math:`P` = 1.013 x 10\ :sup:`5` Pa, :math:`T` = 15˚C. +These defaults can be overwritten in a flexible manner by specifying appropriate data in a fictitious **ROCKS** domain "``REFCO``", as follows + +.. list-table:: Domain "``REFCO``". + :name: tab:eos9.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``DROK`` + - E10.4 + - reference pressure + * - ``POR`` + - E10.4 + - reference temperature + * - ``PER(1)`` + - E10.4 + - liquid density + * - ``PER(2)`` + - E10.4 + - liquid viscosity + * - ``PER(3)`` + - E10.4 + - liquid compressibility + +Note that assignment of thermophysical data through a specially-named domain was set up just as a convenient way of providing floating-point parameters to the code. +No volume elements (grid blocks) should be attached to domain "``REFCO``", as the data in general will not correspond to reasonable hydrogeologic parameters. +The above mentioned defaults will be overwritten for any parameters for which a non-zero entry is provided in "``REFCO``". +This allows the generation of these parameters internally for user-defined (:math:`P`, :math:`T`); it also allows for directly assigning user-desired values as, e.g., :math:`\rho_{liq}` = 1000 kg/m\ :sup:`3`, :math:`\mu_{liq}` = 10\ :sup:`-3` Pa s (:math:`equiv` 1 centipoise), etc. +A summary of EOS9 specifications appears in :numref:`tab:eos9.2`. + +.. list-table:: Summary of EOS9. + :name: tab:eos9.2 + :widths: 1 3 + :align: center + + * - Components + - | #1: water + * - Parameter choices + - | (``NK``, ``NEQ``, ``NPH``, ``NB``) = + | (1, 1, 1, 6) water, isothermal (default, no other choices available) + * - Primary variables*† + - | Saturated conditions: + | (:math:`P_{liq}`): (water pressure: :math:`P_{liq}` ≥ :math:`P_{gas}`) + | Unsaturated conditions: + | (:math:`S_{liq}`): (water saturation: 0 < :math:`S_{liq}` < 1) + +.. note:: + + | \* The first primary variable may be initialized as :math:`X1` < 0, in which case it will be taken to denote capillary pressure, and will be converted internally to :math:`S_{liq}` in the initialization phase. + | † Reference gas phase pressure, flow system temperature, and (optionally) thermophysical parameters of water density, viscosity, and compressibility may be specified through a fictitious ROCKS domain "``REFCO``". + +In addition to specifying the primary thermodynamic variable on a default, domain, or grid block basis, EOS9 offers alternative ways of initializing flow problems. +The primary variable may be entered as a negative number upon initialization, in which case it will be taken to denote capillary pressure, and will be internally converted to :math:`S_l` in the initialization phase. +EOS9 can also initialize a flow problem with gravity-capillary equilibrium, relative to a user-specified reference elevation :math:`z_{ref}` of the water table. +This type of initialization will be engaged if the user enters a non-zero number in slot ``CWET`` in **ROCKS** domain "``REFCO``", in which case ``CWET`` will be taken to denote the water table elevation :math:`z_{ref}`, in units of meters. +Water pressure at :math:`z_{ref}` is taken equal to reference gas pressure, :math:`P_l(z_{ref}) = P_{gas}`, and is initialized as a function of grid block elevation according to :math:`P(z) = P_{gas} + \left( z_{ref} - z \right) \rho g`. +By convention, the z-axis is assumed to point upward. +In order to use this facility, the z-coordinates (grid block elevations) must be specified in the **ELEME**-data, which will be done automatically if internal *MESH* generation is used. + +In the assignment of gravity-capillary equilibrium as just discussed, water saturations at "sufficiently" high elevations above the water table may end up being smaller than the irreducible water saturation :math:`S_{lr}` specified in the relative permeability function, which may or may not be consistent with the physical behavior of the flow system. +Users may optionally enforce that :math:`S_l` = :math:`S_{lr}` in regions where the capillary pressure function would dictate that :math:`S_{lr}` < :math:`S_{lr}`. +This is accomplished by entering an appropriate parameter in slot ``SPHT`` of **ROCKS** domain "``REFCO``", and works as follows. +The irreducible saturation :math:`S_{lr}` will be taken to be parameter ``RP(int(SPHT))`` of the relative permeability function. +As an example, for the ``IRP`` = 7 relative permeability function, irreducible water saturation is the parameter ``RP(2)``; therefore, for ``IRP`` = 7 the user should specify ``SPHT`` = 2.0 in "``REFCO``" to use this facility. + +EOS9 differs from all of the other EOS modules in that, having only a single primary thermodynamic variable, the first (and here only) primary variable does not necessarily denote pressure. +This necessitates certain other coding adjustments. +For EOS9, the flow terms is assembled differently in subroutine *MULTI*, and the slot #6 of the PAR-array, which normally holds just the capillary pressure, represents total water pressure :math:`P_l = P_{gas} + P_{cap}`. diff --git a/doc/source/tough3/eos/ewasg.rst b/doc/source/tough3/eos/ewasg.rst new file mode 100644 index 00000000..6adfb7f4 --- /dev/null +++ b/doc/source/tough3/eos/ewasg.rst @@ -0,0 +1,247 @@ +.. _ewasg: + +EWASG +===== + +Thermophysical Properties +------------------------- + +The EWASG (WAter-Salt-Gas) fluid property module was developed by :cite:label:`battistelli1997simulator` for modeling geothermal reservoirs with saline fluids and non-condensible gas (NCG). +In contrast to :ref:`eos7`, EWASG describes aqueous fluid of variable salinity not as a mixture of water and brine, but as a mixture of water and NaCl. +This makes it possible to represent temperature-dependent solubility constraints, and to properly describe precipitation and dissolution of salt. +EWASG represents the active system components (water, NaCl, NCG) as three-phase mixtures. +Solid salt is the only active mineral phase, and is treated in complete analogy to fluid phases (aqueous, gas), except that, being immobile, its relative permeability is identically zero. +From mass balances on salt in fluid and solid phases we calculate the volume fraction of precipitated salt in the original pore space :math:`\phi_0`, which is termed "solid saturation", and denoted by :math:`S_s`. +A fraction :math:`\phi_0 S_s` of reservoir volume is occupied by precipitate, while the remaining void space :math:`\phi_f = \phi_0 \left( 1 - S_s \right)` is available for fluid phases. +We refer to :math:`\phi_f` as the "active flow porosity". +The reduction in pore space reduces the permeability of the medium. + +Several choices are available for the non-condensible gas (NCG): CO\ :sub:`2`, air, CH\ :sub:`4`, H\ :sub:`2`, and N\ :sub:`2`. +Gas dissolution in the aqueous phase is described by Henry's law, with coefficients that depend not only on temperature but also on salinity to describe the reduction in NCG solubility with increasing salinity ("salting out"). +The dependence of brine density, enthalpy, viscosity, and vapor pressure on salinity is taken into account, as are vapor pressure-lowering effects from suction pressures (capillary and vapor adsorption effects). +The thermophysical property correlations used in EWASG are accurate for most conditions of interest in geothermal reservoir studies: temperatures in the range from 100 to 350˚C, fluid pressures up to 80 MPa, CO\ :sub:`2` partial pressures up to 10 MPa, and salt mass fraction up to halite saturation. +With the exception of brine enthalpy, thermophysical property correlations are accurate to below 10˚C. +A full discussion of the thermophysical property correlations used and their empirical basis is given in the original paper (:cite:label:`battistelli1997simulator`). + +TOUGH3 also adopts recent improvements of EWASG. +Internally consistent correlations for the water-NaCl mixture properties are included (:cite:label:`battistelli2012improving`), which are developed by :cite:label:`driesner2007system1` and :cite:label:`driesner2007system2`. +These brine correlations are capable to calculate phase properties for temperatures from 0 to 350˚C, pressures from 1 to 100 MPa, and salt mass fraction up to saturation. +In TOUGH3, the brine correlations in :cite:label:`driesner2007system2` are used as the default, unless specified differently by users. + +New options are also added to calculate NCG (CO\ :sub:`2`, CH\ :sub:`4`, and H\ :sub:`2` only) density and fugacity using a virial equation treatment of :cite:label:`spycher1988fugacity`. +This method is available and reliable only for the following temperature and pressure ranges: (1) for CO\ :sub:`2`, 50 - 350˚C and up to 50 MPa, (2) for CH\ :sub:`4`, 16 - 350˚C and up to 50 MPa, and (3) for H\ :sub:`2`, 25 - 600˚C and up to 300 MPa. + + +Permeability Change +------------------- + +As noted above, the relationship between the amount of solid precipitation and the pore space available to the fluid phases is very simple. +The impact of porosity change on formation permeability on the other hand is highly complex. +Laboratory experiments have shown that modest reductions in porosity from chemical precipitation can cause large reductions in permeability (:cite:label:`vaughn1987analysis`). +This is explained by the convergent-divergent nature of natural pore channels, where pore throats can become clogged by precipitation while disconnected void spaces remain in the pore bodies (:cite:label:`verma1988thermohydrological`). +The permeability reduction effects depend not only on the overall reduction of porosity but on details of the pore space geometry and the distribution of precipitate within the pore space. +These may be quite different for different porous media, which makes it difficult to achieve generally applicable, reliable predictions. +EWASG offers several choices for the functional dependence of relative change in permeability, :math:`\frac{k}{k_0}`, on relative change in active flow porosity. + +.. math:: + :label: eq:ewasg.1 + + \frac{k}{k_0} = f \left( \frac{\phi_f}{\phi_0} \right) \equiv f \left( 1 - S_s \right) + +The simplest model that can capture the converging-diverging nature of natural pore channels consists of alternating segments of capillary tubes with larger and smaller radii, respectively; see :numref:`fig:ewasg.1`. +While in straight capillary tube models permeability remains finite as long as porosity is non-zero, in models of tubes with different radii in series, permeability is reduced to zero at a finite porosity. + +.. subfigure:: AB + :name: fig:ewasg.1 + :layout-sm: A|B + :subcaptions: above + :gap: 32px + + .. image:: ../figures/pore_conceptual_model.png + :alt: Conceptual model + + .. image:: ../figures/pore_tubes_in_series.png + :alt: Tubes-in-series + + Model for converging-diverging pore channels. + +From the tubes-in-series model shown in :numref:`fig:ewasg.1`, the following relationship can be derived (Verma and Pruess, 1988) + +.. math:: + :label: eq:ewasg.2 + + \frac{k}{k_0} = \theta^2 \frac{1 - \Gamma + \frac{\Gamma}{\omega^2}}{1 - \Gamma + \Gamma \left( \frac{\theta}{\theta + \omega - 1} \right)^2} + +Here + +.. math:: + :label: eq:ewasg.3 + + \theta = \frac{1 - S_s - \phi_r}{1 - \phi_r} + +depends on the fraction :math:`1 - S_s` of original pore space that remains available to fluids, and on a parameter :math:`\phi_r`, which denotes the fraction of original porosity at which permeability is reduced to zero. +:math:`\Gamma` is the fractional length of the pore bodies, and the parameter :math:`\omega` is given by + +.. math:: + :label: eq:ewasg.4 + + \omega = 1 + \frac{\frac{1}{\Gamma}}{\frac{1}{\phi_r} - 1} + +Therefore, Eq. :math:numref:`eq:ewasg.2` has only two independent geometric parameters that need to be specified, :math:`\phi_r` and :math:`\Gamma`. +As an example, :numref:`fig:ewasg.2` shows the permeability reduction factor from Eq. :math:numref:`eq:ewasg.2`, plotted against :math:`\frac{\phi}{\phi_0} \equiv \left( 1 - S_s \right)`, for parameters of :math:`\phi_r` = :math:`\Gamma` = 0.8. + +.. figure:: ../figures/porosity_permeability.png + :name: fig:ewasg.2 + :width: 75% + + Porosity-permeability relationship for tubes-in-series model, after :cite:label:`verma1988thermohydrological`. + +For parallel-plate fracture segments of different aperture in series, a relationship similar to Eq. :math:numref:`eq:ewasg.2` is obtained, the only difference being that the exponent 2 is replaced everywhere by 3 (:cite:label:`verma1988thermohydrological`). +If only straight capillary tubes of uniform radius are considered, we have :math:`\phi_r` = 0, :math:`\Gamma` = 0, and Eq. :math:numref:`eq:ewasg.2` simplifies to + +.. math:: + :label: eq:ewasg.5 + + \frac{k}{k_0} = \left( 1 - S_s \right)^2 + + +Specifications +-------------- + +A summary of EWASG specifications and parameters appears in :numref:`tab:ewasg`. +The default parameter settings are (``NK``, ``NEQ``, ``NPH``, ``NB``) = (3, 4, 3, 6). +The ``NK`` = 2 (no air) option may only be used for problems with single-phase liquid conditions throughout. +The primary variables are (:math:`P`, :math:`X_{sm}`, :math:`X3`, :math:`T`) for single-phase conditions and (:math:`P`, :math:`X_{sm}`, :math:`S_g` + 10, :math:`T`) for two-phase conditions. + +Primary variable #2 (:math:`X2`) is used for NaCl, and denotes mass fraction :math:`X_s` in the aqueous phase when no solid salt is present, while it is solid saturation plus ten (:math:`S_s` + 10) in the presence of precipitated salt. +The number 10 is added here to be able to determine whether or not a precipitated phase is present from the numerical range of the second primary variable. +Solubility of NaCl in the gas phase is very small at the pressure and temperature conditions considered for EWASG and has been neglected. +During the Newton-Raphson iteration process, possible appearance or disappearance of a solid phase is checked, as follows. +If no solid phase was present at the previous iteration, primary variable :math:`X2` is known to denote salt mass fraction :math:`X_s` in the aqueous phase, and the latest updated value is compared with the equilibrium solubility :math:`XEQ`. +If :math:`S_s` > :math:`XEQ`, precipitation starts, a small solid phase saturation is initialized as :math:`S_s` = 10\ :sup:`-6`, and the second primary variable is switched to :math:`X2` = :math:`S_s` + 10. +If solid salt had been present at the previous iteration, EWASG checks whether :math:`S_s` = :math:`X2` - 10 is still larger than 0. +If not, this indicates that the solid phase disappears; the second primary variable is then switched to dissolved salt mass fraction, and is initialized just below equilibrium solubility as :math:`S_s` = :math:`XEQ` - 10\ :sup:`-6`. + +.. list-table:: Summary of EWASG. + :name: tab:ewasg + :widths: 1 3 + :align: center + + * - Components + - | #1: water + | #2: NaCl + | #3: NCG (CO\ :sub:`2`, air, CH\ :sub:`4`, H\ :sub:`2`, N\ :sub:`2`; optional) + * - Parameter choices + - | (``NK``, ``NEQ``, ``NPH``, ``NB``) = + | (3, 4, 3, 6) water, NaCl, NCG, nonisothermal (default) + | (3, 3, 3, 6) water, NaCl, NCG, isothermal + | (2, 3, 2, 6) water, NaCl, nonisothermal* + | (2, 2, 2, 6) water, NaCl, isothermal* + | Molecular diffusion can be modeled by setting ``NB`` = 8 + * - Primary variables + - | Single-phase conditions (only liquid or only gas): + | (:math:`P`, :math:`X_{sm}`, :math:`X3`, :math:`T`): (pressure, salt mass fraction or solid saturation plus ten, NCG mass fraction, temperature) + | Two-phase conditions: + | (:math:`P`, :math:`X_{sm}`, :math:`S_g` + 10, :math:`T`): (pressure, salt mass fraction or solid saturation plus ten, gas phase saturation plus ten, temperature) + +.. note:: + + | \* the ``NK`` = 2 (no NCG) option may only be used for problems with single-phase liquid conditions throughout. + | † two-phase conditions may be initialized with variables (:math:`T`, :math:`X_{sm}`, :math:`S_g` + 10, :math:`P_{NCG}`), or (:math:`T`, :math:`X_{sm}`, :math:`S_g` + 10, :math:`X3`), where :math:`P_{NCG}` is the partial pressure of NCG, :math:`X3` is mass fraction of NCG in the liquid phase; by convention, EWASG will assume the first primary variable to be pressure if it is larger than 370, otherwise it will be taken to be temperature; if the first primary variable is temperature, the last primary variable will be taken to mean mass fraction of NCG if it is less than 1, otherwise it will be taken to mean NCG partial pressure. + + +Selections +---------- + +Various options for EWASG can be selected through parameter specifications in data block **SELEC**, as follows + +.. list-table:: Record **SELEC.1**. + :name: tab:ewasg.selec.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``IE(1)`` + - I5 + - set equal to 1, to read one additional data record (a larger value with more data records is acceptable, but only one additional record will be used by EWASG). + * - ``IE(3)`` + - I5 + - | allows choice of brine viscosity calculation: + | 0: after Phillips et al. (1981) (default). + | 1: after Palliser and McKibbin (1998). + | 2: after Mao and Sun (2006). + | 3: after Potter (1978). + * - ``IE(4)`` + - I5 + - | allows choice of correlation for compressed brine density: + | 1: after Andersen et al. (1992) (default = 0). + | 2: Pritchett (1993). + | 3: Brine compressibility equal to water compressibility at the same reduced temperature. + | 4: Brine compressibility equal to water compressibility at the same temperature. + | 5: after Batzle and Wang (1992). + | 6: after Driesner (2007). + * - ``IE(8)`` + - I5 + - | allows choice of NCG density and fugacity calculation: + | 0: original EWASG approach (default). + | 1: NCG density according to Spycher and Reed (1988). Only for CO\ :sub:`2`, CH\ :sub:`4`, and H\ :sub:`2`. + | 2: NCG density and gas-aqueous equilibrium according to Spycher and Reed (1988). Only for CO\ :sub:`2`, CH\ :sub:`4`, and H\ :sub:`2`. + * - ``IE(9)`` + - I5 + - | allows choice of NCG enthalpy calculation in the aqueous phase: + | 0: original EWASG approach (default). + | 1: NCG enthalpy as a function of temperature. + * - ``IE(10)`` + - I5 + - | allows to turn vapor pressure lowering on/off: + | 0: VPL is off. + | 1: VPL is on. + * - ``IE(11)`` + - I5 + - | selects dependence of permeability on the fraction :math:`\frac{\phi_f}{\phi_0} = \left( 1 - S_s \right)` of original pore space that remains available to fluids: + | 0: permeability does not vary with :math:`\phi_f`. + | 1: :math:`\frac{k}{k_0} = \left( 1 - S_s \right)^{\gamma}`, with :math:`\gamma` = ``FE(1)``. + | 2: fractures in series, i.e., Eq. :math:numref:`eq:ewasg.2` with exponent 2 everywhere replaced by 3. + | 3: tubes-in-series, i.e., Eq. :math:numref:`eq:ewasg.2`. + * - ``IE(14)`` + - I5 + - | allows choice of treatment of thermophysical properties as a function of salinity: + | 0: full dependence (default). + | 1: vapor pressure independent of salinity. + | 2: vapor pressure and brine enthalpy independent of salinity. + | 3: no salinity dependence of thermophysical properties (salt solubility constraints are maintained). + * - ``IE(15)`` + - I5 + - | allows choice of correlation for brine enthalpy at saturated vapor pressure: + | 1: after Michaelides (1981). + | 2: after Miller (1978) (obsolete). + | 3: after Phillips et al. (1981). + | 4: after Lorenz et al. (2000) (default = 0). + | 5: after Driesner (2007). + * - ``IE(16)`` + - I5 + - | allows choice of the type of NCG (default for ``IE(16)`` = 0 is CO\ :sub:`2`): + | 1: air. + | 2: CO\ :sub:`2`. + | 3: CH\ :sub:`4`. + | 4: H\ :sub:`2`. + | 5: N\ :sub:`2`. + +.. list-table:: Record **SELEC.2**. + :name: tab:ewasg.selec.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``FE(1)`` + - E10.4 + - parameter :math:`\gamma` (for ``IE(11)`` = 1); parameter :math:`\phi_r` (for ``IE(11)`` = 2, 3). + * - ``FE(2)`` + - E10.4 + - parameter :math:`\Gamma` (for ``IE(11)`` = 2, 3). diff --git a/doc/source/tough3/eos/index.rst b/doc/source/tough3/eos/index.rst new file mode 100644 index 00000000..e1b052cb --- /dev/null +++ b/doc/source/tough3/eos/index.rst @@ -0,0 +1,60 @@ +EOS +=== + +TOUGH3 currently includes all equation-of-state (EOS) modules of the Version 2 of TOUGH2, as well as ECO2N (:cite:label:`pruess2005eco2n,pan2015eco2n`), ECO2M (:cite:label:`pruess2011eco2m`), EOS7C (:cite:label:`oldenburg2004eos7c`), EOS7CA (:cite:label:`oldenburg2015eos7ca`), and TMVOC (:cite:label:`pruess2002tmvoc`). + +.. list-table:: Fluid property modules for TOUGH3. + :name: tab:1 + :widths: 1 3 + :header-rows: 1 + :align: center + + * - Module + - Capabilities + * - :ref:`eos1` + - water, water with tracer + * - :ref:`eos2` + - water, CO\ :sub:`2` + * - :ref:`eos3` + - water, air + * - :ref:`eos4` + - water, air, with vapor pressure lowering + * - :ref:`eos5` + - water, hydrogen + * - :ref:`eos7` + - water, brine, air + * - :ref:`eos7r` + - water, brine, air, parent-daughter radionuclides + * - EOS7C + - water, brine, CO\ :sub:`2` (or N\ :sub:`2`), gas tracer, CH\ :sub:`4` + * - EOS7CA + - water, brine, non-condensible gas, gas tracer, air + * - :ref:`eos8` + - water, "dead" oil, non-condensible gas + * - :ref:`eos9` + - variably-saturated isothermal flow according to Richard's equation + * - :ref:`ewasg` + - water, salt (NaCl), non-condensible gas + * - TMVOC + - water, water-soluble volatile organic chemicals, non-condensible gases, with biodegradation + * - :ref:`eco2n` + - water, NaCl, CO\ :sub:`2` + * - ECO2M + - water, NaCl, CO\ :sub:`2`, including transitions between super- and sub-critical conditions, and phase change between liquid gaseous CO\ :sub:`2` + +.. toctree:: + :titlesonly: + :hidden: + :maxdepth: 2 + + eos1 + eos2 + eos3 + eos4 + eos5 + eos7 + eos7r + eos8 + eos9 + ewasg + eco2n diff --git a/doc/source/tough3/figures/figure_1.png b/doc/source/tough3/figures/figure_1.png new file mode 100644 index 00000000..0ba8773c Binary files /dev/null and b/doc/source/tough3/figures/figure_1.png differ diff --git a/doc/source/tough3/figures/figure_10.png b/doc/source/tough3/figures/figure_10.png new file mode 100644 index 00000000..74a2a78f Binary files /dev/null and b/doc/source/tough3/figures/figure_10.png differ diff --git a/doc/source/tough3/figures/figure_2.png b/doc/source/tough3/figures/figure_2.png new file mode 100644 index 00000000..f4ffdc34 Binary files /dev/null and b/doc/source/tough3/figures/figure_2.png differ diff --git a/doc/source/tough3/figures/figure_8.png b/doc/source/tough3/figures/figure_8.png new file mode 100644 index 00000000..5f7e2c8e Binary files /dev/null and b/doc/source/tough3/figures/figure_8.png differ diff --git a/doc/source/tough3/figures/figure_9.png b/doc/source/tough3/figures/figure_9.png new file mode 100644 index 00000000..2a222cbd Binary files /dev/null and b/doc/source/tough3/figures/figure_9.png differ diff --git a/doc/source/tough3/figures/figure_eco2n_1.png b/doc/source/tough3/figures/figure_eco2n_1.png new file mode 100644 index 00000000..be5bd9df Binary files /dev/null and b/doc/source/tough3/figures/figure_eco2n_1.png differ diff --git a/doc/source/tough3/figures/figure_eco2n_2.png b/doc/source/tough3/figures/figure_eco2n_2.png new file mode 100644 index 00000000..70ad3568 Binary files /dev/null and b/doc/source/tough3/figures/figure_eco2n_2.png differ diff --git a/doc/source/tough3/figures/figure_eco2n_3.png b/doc/source/tough3/figures/figure_eco2n_3.png new file mode 100644 index 00000000..a980d25c Binary files /dev/null and b/doc/source/tough3/figures/figure_eco2n_3.png differ diff --git a/doc/source/tough3/figures/figure_eco2n_4.png b/doc/source/tough3/figures/figure_eco2n_4.png new file mode 100644 index 00000000..df205a60 Binary files /dev/null and b/doc/source/tough3/figures/figure_eco2n_4.png differ diff --git a/doc/source/tough3/figures/figure_eco2n_5.png b/doc/source/tough3/figures/figure_eco2n_5.png new file mode 100644 index 00000000..473b020b Binary files /dev/null and b/doc/source/tough3/figures/figure_eco2n_5.png differ diff --git a/doc/source/tough3/figures/figure_eco2n_6.png b/doc/source/tough3/figures/figure_eco2n_6.png new file mode 100644 index 00000000..5e36a92f Binary files /dev/null and b/doc/source/tough3/figures/figure_eco2n_6.png differ diff --git a/doc/source/tough3/figures/figure_eco2n_7.png b/doc/source/tough3/figures/figure_eco2n_7.png new file mode 100644 index 00000000..d2ce4ebf Binary files /dev/null and b/doc/source/tough3/figures/figure_eco2n_7.png differ diff --git a/doc/source/tough3/figures/figure_eos2_1.png b/doc/source/tough3/figures/figure_eos2_1.png new file mode 100644 index 00000000..e5352982 Binary files /dev/null and b/doc/source/tough3/figures/figure_eos2_1.png differ diff --git a/doc/source/tough3/figures/pore_conceptual_model.png b/doc/source/tough3/figures/pore_conceptual_model.png new file mode 100644 index 00000000..baf27e60 Binary files /dev/null and b/doc/source/tough3/figures/pore_conceptual_model.png differ diff --git a/doc/source/tough3/figures/pore_figures.pptx b/doc/source/tough3/figures/pore_figures.pptx new file mode 100644 index 00000000..5fdc4632 Binary files /dev/null and b/doc/source/tough3/figures/pore_figures.pptx differ diff --git a/doc/source/tough3/figures/pore_tubes_in_series.png b/doc/source/tough3/figures/pore_tubes_in_series.png new file mode 100644 index 00000000..3b4d5cbd Binary files /dev/null and b/doc/source/tough3/figures/pore_tubes_in_series.png differ diff --git a/doc/source/tough3/figures/porosity_permeability.png b/doc/source/tough3/figures/porosity_permeability.png new file mode 100644 index 00000000..ebc640e3 Binary files /dev/null and b/doc/source/tough3/figures/porosity_permeability.png differ diff --git a/doc/source/tough3/figures/porosity_permeability.py b/doc/source/tough3/figures/porosity_permeability.py new file mode 100644 index 00000000..6b90c5f1 --- /dev/null +++ b/doc/source/tough3/figures/porosity_permeability.py @@ -0,0 +1,33 @@ +import numpy as np +import matplotlib.pyplot as plt + + +def permeability(porosity, phi_r=0.8, Gamma=0.8): + theta = (porosity - phi_r) / (1.0 - phi_r) + omega = 1.0 + (1.0 / Gamma) / (1.0 / phi_r - 1.0) + + return theta**2 * (1.0 - Gamma + Gamma / omega**2) / (1.0 - Gamma + Gamma * (theta / (theta + omega - 1.0))**2) + + +# Calculate porosity-permeability relationship +phi = np.linspace(0.80, 1.0, 201) +k = permeability(phi) + +# Plot figure +style = { + "font.size": 20, + "xtick.labelsize": 20, + "ytick.labelsize": 20, +} +plt.rcParams.update(style) + +fig, ax = plt.subplots(1, 1, figsize=(8, 6)) +ax.plot(phi, k, c="black", lw=2) +ax.set_xlabel("$\phi / \phi_0$") +ax.set_ylabel("$k / k_0$") +ax.set_xlim(phi.min(), phi.max()) +ax.set_ylim(k.min(), k.max()) +ax.set_xticks(np.linspace(0.8, 1.0, 5)) + +fig.tight_layout() +# fig.savefig("porosity_permeability.png", dpi=300) diff --git a/doc/source/tough3/guide/capillary_pressure_functions.rst b/doc/source/tough3/guide/capillary_pressure_functions.rst new file mode 100644 index 00000000..a91fc11c --- /dev/null +++ b/doc/source/tough3/guide/capillary_pressure_functions.rst @@ -0,0 +1,521 @@ +.. _capillary_pressure_functions: + +Capillary Pressure Functions +============================ + +TOUGH3 provides several capillary pressure functions for two-phase or three-phase flow problems. +The original TOUGH2 two-phase functions have been retained (from ``ICP`` = 1 to ``ICP`` = 8). +The modified Brooks-Corey and van Genuchten models and two versions of the hysteresis model are implemented (``ICP`` = 10, 11, 12, and 13). +The three-phase functions from TMVOC and ECO2M start at IRP = 31. +If one of the two-phase functions is chosen, the gas-NAPL (for TMVOC) or gaseous CO\ :sub:`2`-liquid CO\ :sub:`2` (for ECO2M) capillary pressure will be assumed to be zero. +The notation used below is: + +- :math:`P_{cgn} = P_n - P_g =` gas-NAPL capillary pressure for TMVOC, which is equivalent to :math:`P_{cgl} = P_l - P_g =` gaseous CO\ :sub:`2`-liquid CO\ :sub:`2` capillary pressure for ECO2M +- :math:`P_{cgl} = P_l - P_g =` gas-aqueous capillary pressure for TMVOC, which is equivalent to :math:`P_{cga} = P_a - P_g =` gaseous CO\ :sub:`2`-aqueous capillary pressure for ECO2M +- :math:`P_{cnl} = P_{cgl} - P_{cgn}` for TMVOC, and similarly :math:`P_{cla} = P_{cga} - P_{cgl}` for ECO2M +- :math:`S_l`, :math:`S_g`, and :math:`S_n` are the saturations of aqueous, gas (or gaseous COCO\ :sub:`2`) and NAPL (or liquid CO\ :sub:`2`) phases, respectively + + +Linear Function (ICP=1) +----------------------- + +.. math:: + + P_{cap} = + \begin{cases} + -CP(1) & \text{for $S_l \le CP(2$} \\ + 0 & \text{for $S_l \ge CP(3)$} \\ + -CP(1) \frac{CP(3) - S_l}{CP(3) - CP(2)} & \text{for $CP(2) \lt S_l \lt CP(3)$} \\ + \end{cases} + +Restrictions: :math:`CP(3) \gt CP(2)` + +If :math:`CP(4) \ne 0`: + +.. math:: + + P_{cgn} = P_{cap} (= P_{cgl}) + +.. math:: + + P_{cap} (P_{cgl}) = 0 + + +Function of Pickens et al. (ICP=2) +---------------------------------- + +After :cite:label:`pickens1979finite`. + +.. math:: + + P_{cap} = -P_0 \left( \log \left( \frac{A}{B} \left(\ 1 + \sqrt{1 - \frac{B^2}{A^2}} \right) \right) \right)^{\frac{1}{x}} + +with + +.. math:: + + A = \frac{\left( 1 + \frac{S_l}{S_{l0}} \right) \left( S_{l0} - S_{lr} \right)}{S_{l0} + S_{lr}} + +.. math:: + + B = 1 - \frac{S_l}{S_{l0}} + +Parameters: + +- :math:`CP(1) = P_0` +- :math:`CP(2) = S_{lr}` +- :math:`CP(3) = S_{l0}` +- :math:`CP(4) = x` + +Restrictions: + +- :math:`0 \lt CP(2) \lt 1 \le CP(3)` +- :math:`CP(4) \ne 0` + + +TRUST Capillary Pressure (ICP=3) +-------------------------------- + +After :cite:label:`narasimhan1978numerical`. + +.. math:: + + P_{cap} = + \begin{cases} + -P_e - P_0 \left( \frac{1 - S_l}{S_l - S_{lr}} \right)^{\frac{1}{\eta}} & \text{for $S_l \gt S_{lr}$} \\ + -P_{max} & \text{for $S_l \lt S_{lr}$} \\ + \end{cases} + +Parameters: + +- :math:`CP(1) = P_0` +- :math:`CP(2) = S_{lr}` +- :math:`CP(3) = \eta` +- :math:`CP(4) = P_e` +- :math:`CP(5) = P_{max}` + +Restrictions: + +- :math:`CP(2) \ge 0` +- :math:`CP(3) \ne 0` + + +Milly's Functions (ICP=4) +------------------------- + +.. math:: + + P_{cap} = -98.783 \times 10^A + +with + +.. math:: + + A = 2.26 \left( \frac{0.371}{S_l - S_{lr}} - 1 \right)^{\frac{1}{4}} + +Parameters: + +- :math:`CP(1) = S_{lr}` + +Restrictions: + +- :math:`CP(1) \ge 0` + + +Leverett's Function (ICP=6) +--------------------------- + +After :cite:label:`leverett1941capillary` and :cite:label:`udell1985heat`. + +.. math:: + + P_{cap} = -P_0 \sigma (T) f (S_l) + +with + +.. math:: + + \sigma(T) = \text{surface tension of water (supplied internally in TOUGH3)} + +.. math:: + + S^\ast = \frac{S_l - S_{lr}}{1 - S_{lr}} + +Parameters: + +- :math:`CP(1) = P_0` +- :math:`CP(2) = S_{lr}` + +Restrictions: + +- :math:`0 \le CP(2) \lt 1` + +If :math:`CP(3) \ne 0` + +.. math:: + + P_{cgn} = P_{cap} (= P_{cgl}) + +.. math:: + + P_{cap} (P_{cgl}) = 0 + + +van Genuchten Function (ICP=7) +------------------------------ + +.. math:: + + P_{cap} = -P_0 \left( \left( S^\ast \right)^{-\frac{1}{\lambda}} - 1 \right)^{1 - \lambda} + +subject to the restriction + +.. math:: + + -P_{max} \le P_{cap} \le 0 + +Here, + +.. math:: + + S^\ast = \frac{S_l - S_{lr}}{S_{ls} - S_{lr}} + +Parameters: + +- :math:`CP(1) = \lambda = 1 - \frac{1}{n}` +- :math:`CP(2) = S_{lr}` (should be chosen smaller than the corresponding parameter in the relative permeability function) +- :math:`CP(3) = \frac{1}{P_0} = \frac{\alpha}{\rho_w g}` (proportional to :math:`\sqrt{k}`) +- :math:`CP(4) = P_{max}` +- :math:`CP(5) = S_{ls}` + +.. note:: + + Parameter :math:`\lambda` is :math:`m` in van Genuchten's notation, with :math:`m = 1 - \frac{1}{n}`; parameter :math:`n` is often written as :math:`\beta`. + + In :cite:label:`van1980closed`'s derivation, the parameter :math:`S_{lr}` for irreducible water saturation is the same in the relative permeability and capillary pressure functions. + As a consequence, for :math:`S_l \rightarrow S_{lr}`, we have :math:`k_{rl} \rightarrow 0` and :math:`P_{cap} \rightarrow -\infty`, which is unphysical because it implies that the radii of capillary menisci go to zero as liquid phase is becoming immobile (discontinuous). + In reality, no special capillary pressure effects are expected when liquid phase becomes discontinuous. + Accordingly, we recommend to always choose a smaller :math:`S_{lr}` for the capillary pressure as compared to the relative permeability function. + + +No Capillary Pressure (ICP=8) +----------------------------- + +For all saturations: + +.. math:: + + P_{cap} \equiv 0 + +No parameters. + + +Modified Brooks-Corey Model (ICP=10) +------------------------------------ + +A modified version of the Brooks-Corey model (:cite:label:`brooks1965hydraulic`) has been implemented. +In order to prevent the capillary pressure from decreasing towards negative infinity as the effective saturation approaches zero, a linear function is used for saturations :math:`S_l` below a certain value :math:`\left( S_{lrc} + \varepsilon \right)`, where :math:`\varepsilon` is a small number. +The slope of the linear extrapolation is identical with the slope of the capillary pressure curve at :math:`S_l = S_{lrc} + \varepsilon`. +Alternatively, the capillary pressure is prevented from becoming more negative than :math:`-P_{max}`. +The modified Brooks-Corey model is invoked by setting both ``IRP`` and ``ICP`` to 10. + +.. math:: + + P_{cap} = + \begin{cases} + -P_e \left( S_{ec} \right)^{-\frac{1}{\lambda}} & \text{for $S_l \gt S_{lrc} + \varepsilon$} \\ + -P_e \left( \frac{\varepsilon}{1 - S_{lrc}} \right)^{-\frac{1}{\lambda}} + \frac{P_e}{\lambda} \frac{1}{1 - S_{lrc}} \left( \frac{\varepsilon}{1 - S_{lrc}} \right)^{-\frac{1 + \lambda}{\lambda}} \left( S_l - S_{lrc} - \varepsilon \right) & \text{for $S_l \lt S_{lrc} + \varepsilon$} \\ + \end{cases} + +where + +.. math:: + + P_{cap} \le -P_{max} + +.. math:: + + S_{ec} = \frac{S_l - S_{lrc}}{1 - S_{lrc}} + +Parameters: + +- :math:`CP(1) = \lambda`, pore size distribution index +- :math:`CP(2) = P_e`, gas entry pressure (Pa) + + - If ``USERX(2, N)`` is positive, :math:`P_e = USERX(2, N)` + - If ``USERX(2, N)`` is negative, :math:`P_e = -USERX(2, N) \cdot CP(2)` + - | If :math:`CP(2)` is negative and ``USERX(1, N)`` is non-zero, apply Leverett's rule:\ + | :math:`P_e = -CP(2) \sqrt{\frac{USERX(1, N)}{PER(NMAT)}}` + +- :math:`CP(3) = P_{max}` or :math:`\varepsilon` + + - If :math:`CP(3) = 0`, :math:`P_{max} = 10^{50}`, :math:`\varepsilon = -1` + - If :math:`0 \lt CP(3) \lt 1`, use linear model for :math:`S_l \lt S_{lrc} + \varepsilon` + - If :math:`CP(3) \ge 1`, :math:`P_{max} = CP(3)`, :math:`\varepsilon = -1` + +- :math:`CP(6) = S_{lrc}` + + +Modified van Genuchten Model +---------------------------- + +The van Genuchten model (:cite:label:`luckner1989consistent`) has been modified to prevent the capillary pressure from decreasing towards negative infinity as the effective saturation approaches zero. +The approach is identical to that in ``ICP`` = 10, except that two extensions (linear and log-linear) are available. +The modified van Genuchten model is invoked by setting both ``IRP`` and ``ICP`` to 11. + +.. math:: + + P_{cap} = + \begin{cases} + -\frac{1}{\alpha} \left( \left( S_{ec} \right)^{\frac{\gamma - 1}{m}} - 1 \right)^{\frac{1}{n}} & \text{for $S_l \ge S_{lrc} + \varepsilon$} \\ + -\frac{1}{\alpha} \left( S_{ec\ast}^{\frac{\gamma - 1}{m}} - 1 \right)^{\frac{1}{n}} - \beta \left( S_l - S_{lrc} - \varepsilon \right) & \text{for $S_l \lt S_{lrc} + \varepsilon$} \\ + \end{cases} + +with linear extension: :math:`\beta = -\frac{1 - \gamma}{\alpha n m} \frac{1}{1 - S_{lrc}} \left( S_{ec\ast}^{\frac{\gamma - 1}{m}} - 1 \right)^{\frac{1}{n} - 1} S_{ec\ast}^{\frac{\gamma - 1 - m}{m}}` + +.. math:: + + P_{cap} = -\frac{1}{\alpha} \left( S_{ec\ast}^{\frac{\gamma - 1}{m}} - 1 \right)^{\frac{1}{n}} \cdot 10^{\beta \left( S_l - S_{lrc} - \varepsilon \right)} \quad \text{for $S_l \lt S_{lrc} + \varepsilon$} + +with log-linear extension: :math:`\beta = -\log_{10} (e) \left( \frac{1 - m}{m} \frac{\gamma - 1}{\varepsilon} \frac{1}{S_{ec\ast}^{\frac{1 - \gamma}{m}} - 1} \right)` + +.. math:: + + P_{cap} \ge -P_{max} + +where + +.. math:: + + S_{ec} = \frac{S_l - S_{lrc}}{1 - S_{lrc}} + +.. math:: + + S_{ec\ast} = \frac{\varepsilon}{1 - S_{lrc}} + +Parameters: + +- :math:`CP(1) = n`, parameter related to pore size distribution index (see also :math:`CP(4)`) +- :math:`CP(2) = \frac{1}{\alpha}`, parameter related to gas entry pressure (Pa) + + - If ``USERX(4, N)`` is positive, :math:`\frac{1}{\alpha_i} = USERX(4, N)` + - If ``USERX(4, N)`` is negative, :math:`\frac{1}{\alpha_i} = USERX(4, N) \cdot CP(2)` + - | If :math:`CP(2)` is negative, apply Leverett scaling rule: + | :math:`\frac{1}{\alpha_i} = \lvert CP(2) \rvert \sqrt{\frac{k_i}{PER(NMAT)}}` + | where + + .. math:: + + k_i = + \begin{cases} + USERX(1, N) & \text{for $USERX(1, N) \gt 0$} \\ + USERX(1, N) \cdot PER(NMAT) & \text{for $USERX(1, N) \lt 0$} \\ + \end{cases} + +- :math:`CP(3) = P_{max}` or :math:`\varepsilon` + + - If :math:`CP(3) = 0`, :math:`P_{max} = 10^{50}`, :math:`\varepsilon = -1` + - If :math:`0 \lt CP(3) \lt 1`, :math:`\varepsilon = CP(3)` and use linear extension + - If :math:`CP(3) \ge 1`, :math:`P_{max} = CP(3)`, :math:`\varepsilon = -1` + - If :math:`-1 \lt CP(3) \lt 0`, :math:`\varepsilon = \lvert CP(3) \rvert` and use log-linear extension + +- :math:`CP(4) = m`, if zero then :math:`m = 1 - \frac{1}{CP(1)}`, else :math:`m = CP(4)` and :math:`n = \frac{1}{1 - m}` +- :math:`CP(5) = T_{ref}`, if negative, :math:`\lvert CP(5) \rvert` is reference temperature to account for temperature dependence of capillary pressure due to changes in surface tension +- :math:`CP(6) = \gamma` +- :math:`CP(7) = S_{lrc}`, if zero, then :math:`S_{lrc} = RP(1) = S_{lrk}` + + +Regular Hysteresis (ICP=12) +--------------------------- + +The hysteretic form of the van Genuchten model (:cite:label:`parker1987model, lenhard1987model`) has been implemented. +Details of the implementation are described in :cite:label:`doughty2013user`. +The hysteretic model is invoked by setting both ``IRP`` and ``ICP`` to 12. + +.. math:: + + P_{cap} = -P_0^p \left( \left( \frac{S_l - S_{lmin} }{1 - S_{gr}^{\Delta} - S_{lmin}} \right)^{-\frac{1}{m^p}} - 1 \right)^{1 - m^p} + +where + +.. math:: + + S_{gr}^{\Delta} = \frac{1}{\frac{1}{1 - S_l^{\Delta}} + \frac{1}{S_{grmax}} - \frac{1}{1 - S_{lr}}} + +Parameters: + +- :math:`CP(1) = m^d`, van Genuchten :math:`m` for drainage branch :math:`P_{cap}^d (S_l)` +- :math:`CP(2) = S_{lmin}`, saturation at which original van Genuchten :math:`P_{cap}` goes to infinity. Must have :math:`S_{lmin} \lt S_{lr}`, where :math:`S_{lr}` is the relative permeability parameter :math:`RP(2)` +- :math:`CP(3) = P_0^d`, capillary strength parameter for drainage branch :math:`P_{cap}^d (S_l)` (Pa) +- :math:`CP(4) = P_{max}`, maximum capillary pressure (Pa) obtained using original van Genuchten :math:`P_{cap}`. Inverting the original van Genuchten function for :math:`P_{max}` determines :math:`S_m`, the transition point between the original van Genuchten function and an extension that stays finite as :math:`S_l` goes to zero. For functional form of extension, see description of :math:`CP(13)` below. +- :math:`CP(5) =` scale factor for pressures for unit conversion (1 for pressure in Pa) +- :math:`CP(6) = m^w`, van Genuchten :math:`m` for imbibition branch :math:`P_{cap}^w (S_l)`. Default value is :math:`CP(1)` (recommended unless compelling reason otherwise) +- :math:`CP(7) = P_0^w`, capillary strength parameter for imbibition branch :math:`P_{cap}^w (S_l)` (Pa). Default value is :math:`CP(3)` (recommended unless compelling reason otherwise) +- :math:`CP(8) =` parameter indicating whether to invoke non-zero :math:`P_{cap}` extension for :math:`S_l \gt S_l^\ast = 1 - S_{gr}^{\Delta}` + + - =0: no extension; :math:`P_{cap} = 0` for :math:`S_l \gt S_l^\ast` + - >0: power-law extension for :math:`S_l^\ast \lt S_l \lt 1`, with :math:`P_{cap} = 0` when :math:`S_l = 1`. A non-zero :math:`CP(8)` is the fraction of :math:`S_l^\ast` at which the :math:`P_{cap}` curve departs from the original van Genuchten function. Recommended range of values: 0.97-0.99 + +- :math:`CP(9) =` flag indicating how to treat negative radicand, which can arise for :math:`S_l \gt S_l^{\Delta 23}` for second-order scanning drainage curves (``ICURV`` = 3), where :math:`S_l^{\Delta 23}` is the turning-point saturation between first-order scanning imbibition (``ICURV`` = 2) and second-order scanning drainage. None of the options below have proved to be robust under all circumstances. If difficulties arise because :math:`S_l \gt S_l^{\Delta 23}` for ``ICURV`` = 3, also consider using ``IEHYS(3)`` > 0 or :math:`CP(10)` < 0, which should minimize the occurrence of :math:`S_l \gt S_l^{\Delta 23}` for ``ICURV`` = 3. + + - 0: :math:`radicand = \max(0, radicand)` regardless of :math:`S_l` value + - 1: if :math:`S_l \gt S_l^{\Delta 23}`, radicand takes value of radicant at :math:`S_l = S_l^{\Delta 23}` + - 2: if :math:`S_l \gt S_l^{\Delta 23}`, use first-order scanning imbibition curve (``ICURV`` = 2) + +- :math:`CP(10) =` threshold value of :math:`\lvert \Delta S \rvert` (absolute value of saturation change since previous time step) for enabling a branch switch (default is 10\ :sup:`-6`; set to any negative number to do a branch switch no matter how small :math:`\lvert \Delta S \rvert` is; set to a value greater than 1 to never do a branch switch). See also ``IEHYS(3)`` +- :math:`CP(11) =` threshold value of :math:`S_{gr}^{\Delta}`. If value of :math:`S_{gr}^{\Delta}` calculated from :math:`S_l^{\Delta}` is less than :math:`CP(11)`, use :math:`S_{gr}^{\Delta} = 0`. Recommended value 0.01-0.03; default is 0.02 +- :math:`CP(12) =` flag to turn off hysteresis for :math:`P_{cap}` (no effect on :math:`k_{rl}` and :math:`k_{rg}`; to turn off hysteresis entirely, set :math:`S_{grmax}` in :math:`RP(3)`). + + - 0: hysteresis is on for :math:`P_{cap}` + - 1: hysteresis is off for :math:`P_{cap}` (switch branches of :math:`P_{cap}` as usual, but set :math:`S_{gr} = 0` in :math:`P_{cap}` calculation. Make sure other parameters of :math:`P_{cap}^d` and :math:`P_{cap}^w` are the same: :math:`CP(1) = CP(6)` and :math:`CP(3) = CP(7)`) + +- :math:`CP(13) =` parameter to determine functional form of :math:`P_{cap}` extension for :math:`S_l \lt S_{lmin}` (i.e., :math:`P_{cap} \gt P_{max}`). + + - =0: exponential extension + - >0: power-law extension with zero slope at :math:`S_l = 0` and :math:`P_{cap} (0) = CP(13)`. Recommended value: 2 to 5 times :math:`CP(4) = P_{max}`. Should not be less than or equal to :math:`CP(4)`. + + +Simple Hysteresis (ICP=13) +-------------------------- + +An approximate hysteretic formulation based on the simple hysteresis theory of :cite:label:`patterson2012simple` has been implemented. +The simple hysteresis model is invoked by setting both ``IRP`` and ``ICP`` to 13. +Currently, this option is only available when ECO2N is being used. + +The capillary pressure is the :cite:label:`van1980closed` function + +.. math:: + + P_{cap} = -P_0 \left( \bar{S}_{wn}^{-\frac{1}{m}} - 1 \right)^{1 - m} + +where + +.. math:: + + \bar{S}_{wn} = \frac{S_w - S_{wr}}{1 - S_{wr} - S_{nr}} + +and :math:`S_{wr}` and :math:`S_{nr}` are the residual saturations of the wetting phase and the non-wetting phase, respectively, and :math:`S_{nr}` is a variable calculated as described in Section :ref:`relative_permeabilty_functions` for ``IRP`` = 13. +If :math:`\bar{S}_{wn}` is greater than or equal to one, then the capillary pressure is set to zero. +For :math:`S_w \lt S_{wr} + \varepsilon`, :math:`P_{cap}` is a linear extension that smoothly connects to the :cite:label:`van1980closed` function and is capped by :math:`P_{max}`. + +Parameters: + +- :math:`CP(1) = m` +- :math:`CP(2) = S_{wr}` +- :math:`CP(3) = \frac{1}{P_0}` (Pa\ :sup:`-1`) +- :math:`CP(4)` + + - =0: :math:`P_{max} = 10^{50}`, :math:`\varepsilon = 10^{-5}` + - >1: :math:`P_{max} = CP(4)`, :math:`\varepsilon = 10^{-5}` + - <1: :math:`P_{max} = 10^{50}`, :math:`\varepsilon = CP(4)` + +- :math:`CP(5) = S_{ls}` (recommend 1) +- :math:`CP(6) = 0` unless Active Fracture Model is invoked (untested) +- :math:`CP(7)` + + - <0: :math:`= -f_{snr}` in linear trapping model + - >0: :math:`S_{nrmax}` in Land trapping model + + +.. _icp31: + +Three-Phase Functions of Parker et al. (ICP=31) +----------------------------------------------- + +After :cite:label:`parker1987parametric`. + +.. math:: + + P_{cgn} = -\frac{\rho_l g}{\alpha_{gn}} \left( \left( \bar{S}_n \right)^{-\frac{1}{m}} - 1 \right)^{\frac{1}{n}} + +.. math:: + + P_{cgl} = -\frac{\rho_l g}{\alpha_{nl}} \left( \left( \bar{S}_l \right)^{-\frac{1}{m}} - 1 \right)^{\frac{1}{n}} - \frac{\rho_l g}{\alpha_{gn}} \left( \left( \bar{S}_n \right)^{-\frac{1}{m}} - 1 \right)^{\frac{1}{n}} + +with + +.. math:: + + m = 1 - \frac{1}{n} + +.. math:: + + \bar{S}_l = \frac{S_l - S_m}{1 - S_m} + +.. math:: + + \bar{S}_n = \frac{S_l + S_n - S_m}{1 - S_m} + +Parameters: + +- :math:`CP(1) = S_m` +- :math:`CP(2) = n` +- :math:`CP(3) = \alpha_{gn}` +- :math:`CP(4) = \alpha_{nl}` + +These functions have been modified so that the capillary pressures remain finite at low aqueous saturations. +This is done by calculating the slope of the capillary pressure functions at :math:`\bar{S}_l` and :math:`\bar{S}_n` = 0.1. If :math:`\bar{S}_l` or :math:`\bar{S}_n` is less than 0.1, the capillary pressures are calculated as linear functions in this region with slopes equal to those calculated at scaled saturations of 0.1. + + +ICP=32 +------ + +Same as :ref:`icp31`, except that the strength coefficients are directly provided as inputs, rather than being calculated from the parameters :math:`\alpha_{gn}` and :math:`\alpha_{nl}`. +The capillary pressure functions are then + +.. math:: + + P_{cgn} = -P_{cgn, 0} \left( \left( \bar{S}_n \right)^{-\frac{1}{m}} - 1 \right)^{\frac{1}{n}} + +.. math:: + + P_{cgl} = -P_{cnl, 0} \left( \left( \bar{S}_l \right)^{-\frac{1}{m}} - 1 \right)^{\frac{1}{n}} - P_{cgn, 0} \left( \left( \bar{S}_n \right)^{-\frac{1}{m}} - 1 \right)^{\frac{1}{n}} + +Parameters: + +- :math:`CP(1) = S_m` +- :math:`CP(2) = n` +- :math:`CP(3) = P_{cgn, 0}` +- :math:`CP(4) = P_{cnl, 0}` + + +ICP=33 +------ + +Same as :ref:`icp31`, except that the capillary pressures are modified for small gas saturations to reduce the derivative. + +If :math:`S_l + S_n \gt 0.99` + +.. math:: + + P_{cgn} = P_{cgn} \frac{1 - S_l - S_n}{0.01} + +If :math:`S_l \gt 0.99` + +.. math:: + + P_{cnl} = P_{cnl} \frac{1 - S_l}{0.01} + + +ICP=34 +------ + +Same as :ref:`icp31`, except that the capillary pressures are smoothened out for small gas saturations. + +If :math:`S_l + S_n \gt 0.99` + +.. math:: + + P_{cgn} = P_{cgn} \left( -10^6 \left( S_l + S_n - 0.99 \right)^3 + 1 \right) + +If :math:`S_l \gt 0.99` + +.. math:: + + P_{cnl} = P_{cnl} \left( -10^6 \left( S_l - 0.99 \right)^3 + 1 \right) + + +Custom +------ + +Additional capillary pressure functions can be programmed into subroutine *PCAP* in a fashion completely analogous to that for relative permeabilities (see Section :ref:`Custom Relative Permeability Functions `). diff --git a/doc/source/tough3/guide/governing_equations.rst b/doc/source/tough3/guide/governing_equations.rst new file mode 100644 index 00000000..eff6c8c0 --- /dev/null +++ b/doc/source/tough3/guide/governing_equations.rst @@ -0,0 +1,362 @@ +.. _governing-equations: + +Governing Equations +=================== + +Mass-Balance Equations +---------------------- + +Here we describe the basic mass- and energy-balance equations solved by TOUGH3. +The equations for nonisothermal, multiphase, multicomponent flows in porous and fractured media can be written in the general form + +.. math:: + :label: eq:1 + + \frac{d}{dt} \int_{V_n} M^{\kappa} dV_n = \int_{\Gamma_n} \boldsymbol{\mathrm{F}}^{\kappa} \cdot \boldsymbol{\mathrm{n}} d\Gamma_n + \int_{V_n} q^{\kappa} dV_n + +The integration is over an arbitrary subdomain Vn of the flow system under study, which is bounded by the closed surface :math:`\Gamma_n`. +The quantity M appearing in the accumulation term (left-hand side) represents the mass of component :math:`\kappa` (e.g., water, brine, air, CO\ :sub:`2`, tracer, radionuclides, VOC) or energy (:math:`\kappa = h`) per volume. :math:`\boldsymbol{\mathrm{F}}` denotes mass or heat flux, and :math:`q` denotes sinks and sources. +:math:`\boldsymbol{\mathrm{n}}` is a normal vector on the surface element :math:`d\Gamma_n`, pointing inward into :math:`V_n`. +Each term constituting the equations is described in detail in the following subsections. + + +Accumulation Terms +------------------ + +The general form of the mass accumulation term that includes equilibrium sorption on the solid grains is + +.. math:: + :label: eq:2 + + M^{\kappa} = \phi \sum_{\beta} S_{\beta} \rho_{\beta} X_{\beta}^{\kappa} + \left( 1 - \phi \right) \rho_R \rho_l X_l^{\kappa} K_d + +where :math:`\phi` is porosity, :math:`S_{\beta}` is the saturation of phase :math:`\beta` (e.g., :math:`\beta` = gas, aqueous, non-aqueous phase liquid), :math:`\rho_{\beta}` is the density of phase :math:`\beta`, and :math:`X_{\beta}^{\kappa}`` is the mass fraction of component :math:`\kappa` in phase :math:`\beta`. +:math:`\rho_R` is the rock grain density, and :math:`K_d` is the aqueous (liquid) phase distribution coefficient. +The total mass of component :math:`\kappa` is obtained by summing over the fluid phases :math:`\beta`. +The heat accumulation term in a multiphase system is + +.. math:: + :label: eq:3 + + M^h = \left( 1 - \phi \right) \rho_R C_R T + \phi \sum_{\beta} S_{\beta} \rho_{\beta} u_{\beta} + +where :math:`C_R` is the specific heat of the rock grains, :math:`T` is temperature, and :math:`u_{\beta}` is the specific internal energy of phase :math:`\beta`. + + +Flux Terms +---------- + +Advective mass flux is a sum of phase fluxes, + +.. math:: + :label: eq:4 + + \boldsymbol{\mathrm{F}}^{\kappa} \vert_{adv} = \sum_{\beta} X_{\beta}^{\kappa} \boldsymbol{\mathrm{F}}_{\beta} + +where individual phase fluxes are given by a multiphase version of Darcy's law: + +.. math:: + :label: eq:5 + + \boldsymbol{\mathrm{F}}_{\beta} = \rho_{\beta} \boldsymbol{\mathrm{u}}_{\beta} = -k \frac{k_{r \beta} \rho_{\beta}}{\mu_{\beta}} \left( \nabla P_{\beta} - \rho_{\beta} \boldsymbol{\mathrm{g}} \right) + +Here, :math:`u_{\beta}` is the Darcy velocity (volume flux) of phase :math:`\beta`, :math:`k` is absolute permeability, :math:`k_{r \beta}` is relative permeability to phase :math:`\beta`, :math:`\mu_{\beta}` is dynamic viscosity, and + +.. math:: + :label: eq:6 + + P_{\beta} = P + P_{c \beta} + +is the fluid pressure in phase :math:`\beta`, which is the sum of the pressure :math:`P` of a reference phase (usually taken to be the gas phase) and the capillary pressure :math:`P_{c \beta}` (:math:`\le 0`). +:math:`\boldsymbol{\mathrm{g}}` is the vector of gravitational acceleration. +Vapor pressure lowering due to capillary and phase adsorption effects can be considered, and is modeled by Kelvin's equation (:cite:label:`edlefsen1943thermodynamics`), + +.. math:: + :label: eq:7 + + P_v \left( T, S_l \right) = f_{VPL} \left( T, S_l \right) P_{sat} \left( T \right) + +where + +.. math:: + :label: eq:8 + + f_{VPL} = \exp \left( \frac{M_w P_{cl}\left( S_l \right)}{\rho_l R \left( T + 273.15 \right)} \right) + +is the vapor pressure lowering factor. +:math:`P_v` is the vapor pressure, :math:`P_{sat}` is the saturated vapor pressure of bulk aqueous phase, :math:`P_{cl}` is the capillary pressure (i.e., the difference between aqueous and gas phase pressures), :math:`M_w` is the molecular weight of water, and :math:`R` is the universal gas constant. + +Absolute permeability of the gas phase increases at low pressures according to the relation given by :cite:label:`klinkenberg1941permeability` + +.. math:: + :label: eq:9 + + k = k_{\infty} \left( 1 + \frac{b}{P} \right) + +where :math:`k_{\infty}` is the permeability at "infinite" pressure, and :math:`b` is the Klinkenberg parameter. + +In addition to Darcy flow, mass transport can also occur by diffusion. +Diffusive flux is modeled as follows: + +.. math:: + :label: eq:10 + + \boldsymbol{\mathrm{f}}_{\beta}^{\kappa} = -\phi \tau_0 \tau_{\beta} \rho_{\beta} d_{\beta}^{\kappa} \nabla X_{\beta}^{\kappa} + +here :math:`d_{\beta}^{\kappa}` is the molecular diffusion coefficient for component :math:`\kappa` in phase :math:`\beta`, and :math:`\tau_0 \tau_{\beta}` is the tortuosity, which includes a porous medium dependent factor :math:`\tau_0` and a coefficient that depends on phase saturation :math:`S_{\beta}`, :math:`\tau_{\beta} = \tau_{\beta} \left( S_{\beta} \right)`. +For general two-phase conditions, the total diffusive flux is then given by + +.. math:: + :label: eq:11 + + \boldsymbol{\mathrm{f}}^{\kappa} = -\Sigma_l^{\kappa} \nabla X_l^{\kappa} - \Sigma_g^{\kappa} \nabla X_g^{\kappa} + +where :math:`\Sigma_{\beta}^{\kappa} = \phi \tau_0 \tau_{\beta} \rho_{\beta} d_{\beta}^{\kappa}` is an effective diffusion coefficient in phase :math:`\beta`. +We have used this pragmatic approach because it is not possible to formulate a model for multiphase diffusion that would be accurate under all circumstances. +The basic Fick law works well for diffusion of tracer solutes that are present at low concentrations in a single-phase aqueous solution at rest with respect to the porous medium [1]_. + +Several models are available to describe the dependence of tortuosity on porous medium properties and phase saturation. +For the relative permeability model, tortuosity will be taken as :math:`\tau_0 \tau_{\beta} \left( S_{\beta} \right) = \tau_0 k_{r \beta} \left( S_{\beta} \right)` with the user-specified porous medium dependent factor :math:`\tau_0`. +The :cite:label:`millington1961permeability` model, which has frequently been used for soils, yields non-zero tortuosity coefficients as long as phase saturation is non-zero [2]_. + +.. math:: + :label: eq:12 + + \tau_0 \tau_{\beta} = \phi^{1/3} S_{\beta}^{10/3} + +For the constant diffusivity formulation, :math:`\tau_0 \tau_{\beta} = S_{\beta}` will be used. +This alternative corresponds to the formulation for gas diffusion in the original version of TOUGH2. +In the absence of phase partitioning and adsorptive effects, it amounts to effective diffusivity being approximately equal to :math:`d_{\beta}^{\kappa}`, independent of saturation. This can be seen by noting that the accumulation term in the phase :math:`\beta` contribution to the mass balance equation for component :math:`\kappa` is given by :math:`\phi S_{\beta} \rho_{\beta} X_{\beta}^{\kappa}`, approximately canceling out the :math:`\phi S_{\beta} \rho_{\beta}` coefficient in the diffusive flux. + +TOUGH3 can model the pressure and temperature dependence of gas phase diffusion coefficients by the following equation (:cite:label:`vargaftik1975tables, walker1981studies`). + +.. math:: + :label: eq:13 + + d_g^{\kappa} \left( P, T \right) = d_g^{\kappa} \left( P_0, T_0 \right) \frac{P_0}{P} \left( \frac{T + 273.15}{273.15} \right)^{\theta} + +At standard conditions of :math:`P_0` = 1 atm = 1.01325 bar and :math:`T_0` = 0˚C, the diffusion coefficient for vapor-air mixtures has a value of 2.13 x 10\ :sup:`-5` m\ :sup:`2`/s; parameter :math:`\theta` for the temperature dependence is 1.80. +Presently there are no provisions for inputting different values for the parameter :math:`\theta` of temperature dependence for different gas phase components. +Diffusion coefficients for the non-gaseous phases are taken as constants, with no provisions for temperature dependence of these parameters. + +Heat flux includes conductive, convective, and radiative components: + +.. math:: + :label: eq:14 + + \boldsymbol{\mathrm{F}}^h = -\lambda \nabla T + \sum_{\beta} h_{\beta} \boldsymbol{\mathrm{F}}_{\beta} + f_{\sigma} \sigma_0 \nabla T^4 + +where :math:`\lambda` is the effective thermal conductivity, and :math:`h_{\beta}` is the specific enthalpy in phase :math:`\beta`, :math:`f_{\sigma}` is the radiant emittance factor, and :math:`\sigma_0` is the Stefan-Boltzmann constant. + +.. [1] Many subtleties and complications can arise when multiple components diffuse in a multiphase flow system. Effective diffusivities in general may depend on all concentration variables, leading to nonlinear behavior especially when some components are present in significant (non-tracer) concentrations. Additional nonlinear effects arise from the dependence of tortuosity on phase saturations, and from coupling between advective and diffusive transport. For gases, the Fickian model has serious limitations even at low concentrations, which prompted the development of the "dusty gas" model that entails a strong coupling between advective and diffusive transport (:cite:label:`mason1983gas, webb1998review`) and accounts for molecular streaming effects (Knudsen diffusion) that become very important when the mean free path of gas molecules is comparable to pore sizes. Further complications arise for components that are both soluble and volatile, in which case diffusion in aqueous and gaseous phases may be strongly coupled via phase partitioning effects. An extreme case is the well-known enhancement of vapor diffusion in partially saturated media, which is attributed to pore-level phase change effects (:cite:label:`cass1984enhancement, webb1998review, webb1998enhanced`). These alternative models are not implemented in TOUGH3. + +.. [2] It stands to reason that diffusive flux should vanish when a phase becomes discontinuous at low saturations, suggesting that saturation-dependent tortuosity should be related to relative permeability, i.e., :math:`\tau_{\beta} \left( S_{\beta} \right) \approx k_{r \beta} \left( S_{\beta} \right)`. However, for components that partition between liquid and gas phases, a more complex behavior may be expected. For example, consider the case of a volatile and water-soluble compound diffusing under conditions of low gas saturation where the gas phase is discontinuous. In this case we have :math:`k_{rg} \left( S_g \right) = 0` (because :math:`S_g \lt S_{gr}`), and :math:`k_rl \left( S_l = 1 - S_g \right) < 1`, so that a model equating saturation-dependent tortuosity to relative permeability would predict weaker diffusion than in single-phase liquid conditions. For compounds with "significant" volatility this would be unrealistic, as diffusion through isolated gas pockets would tend to enhance overall diffusion relative to single-phase liquid conditions. + + +Sink and Source Terms +--------------------- + +Sinks and sources are introduced by specifying the mass production (:math:`q \lt 0`) or injection (:math:`q \gt 0`) rates of fluids as well as heat flow. +Any of the mass components may be injected in an element at a constant or time-dependent mass rate, and the specific enthalpy of the injected fluid may be specified as well.Heat sources/sinks (with no mass injection) may be either constant or time dependent. + +In the case of fluid production, a total mass production rate needs to be specified. +The phase composition of the produced fluid may be determined by the relative phase mobilities in the source element. +Alternatively, the produced phase composition may be specified to be the same as the phase composition in the producing element. +In either case, the mass fractions of the components in the produced phases are determined by the corresponding component mass fractions in the producing element. + +TOUGH3 also includes different options for considering wellbore flow effects: a well on deliverability against specified bottomhole or wellhead pressure, or coupled wellbore flow. +Details are discussed below. + + +Deliverability Model +******************** + +Production wells may operate on deliverability against a prescribed flowing bottomhole pressure, :math:`P_{wb}`, with a productivity index PI (:cite:label:`coats1977geothermal`). +With this option, the mass production rate of phase :math:`\beta` from a grid block with phase pressure :math:`P_{\beta} \gt P_{wb}` is + +.. math:: + :label: eq:15 + + q_{\beta} = \frac{k_{r \beta}}{\mu_{\beta}} \rho_{\beta} \cdot PI \cdot \left( P_{\beta} - P_{wb} \right) + +For steady radial flow, the productivity index of layer l is given by (Coats, 1977; Thomas, 1982) + +.. math:: + :label: eq:16 + + (PI)_l = \frac{2 \pi \left( k \Delta z_l \right)}{\log \left( r_e / r_w \right) + s - 1/2} + +Here, :math:`\Delta z_l` denotes the layer thickness, :math:`\left( k \Delta z_l \right)` is the permeability-thickness product in layer :math:`l`, :math:`r_e` is the grid block radius, :math:`r_w` is the well radius, and :math:`s` is the skin factor. If the well is producing from a grid block which does not have cylindrical shape, an approximate PI can be computed by using an +effective radius + +.. math:: + :label: eq:17 + + r_e = \sqrt{A / \pi} + +where :math:`A` is the grid block area; e.g., :math:`A = \Delta x \cdot \Delta y` for an areal Cartesian grid. +More accurate expressions for specific well patterns and grid block shapes have been given in the literature (e.g., :cite:label:`peaceman2000fundamentals, coats1982effects`). + +The rate of production for mass component :math:`\kappa` is + +.. math:: + :label: eq:18 + + \hat{q}^{\kappa} = \sum_{\beta} X_{\beta}^{\kappa} q_{\beta} + +For wells that are screened in more than one layer (element), the flowing wellbore pressure :math:`P_{wb}` can be corrected to approximately account for gravity effects according to the depth-dependent flowing density in the wellbore. +Assuming that the open interval extends from layer :math:`l = ` at the +bottom to :math:`l = L`` at the top, the flowing wellbore pressure in layer :math:`l`, :math:`P_{wb, l}`, is obtained from the wellbore pressure in layer :math:`l + 1`` immediately above it by means of the following recursion formula + +.. math:: + :label: eq:19 + + P_{wb, l} = P_{wb, l + 1} + \frac{g}{2} \left( \rho_l^f \Delta z_l + \rho_{l + 1}^f \Delta z_{l + 1}\right) + +Here, :math:`g` is acceleration of gravity, and :math:`\rho_l^f` is the flowing density in the tubing opposite layer :math:`l`. +Flowing densities are computed using a procedure given by Coats (private communication, 1982). +If wellbore pressure were zero, we would obtain the following volumetric production rate of phase :math:`\beta` from layer :math:`l`. + +.. math:: + :label: eq:20 + + r_{l, \beta} = \left( \frac{k_{r \beta}}{\mu_{\beta}} \right)_l \left( PI \right)_l P_{l, \beta} + +The total volumetric flow rate of phase :math:`\beta` opposite layer :math:`l` is, for zero wellbore pressure + +.. math:: + :label: eq:21 + + r_{l, \beta}^T = \sum_{m=1}^l r_{m, \beta} + +From this, we obtain an approximate expression for flowing density opposite layer :math:`l` which can be used in Eq. :math:numref:`eq:19`. + +.. math:: + :label: eq:22 + + \rho_l^f = \frac{\sum_{\beta} \rho_{l, \beta} r_{l, \beta}^T}{\sum_{\beta} r_{l, \beta}^T} + +During fluid production or injection, the rate of heat removal or injection is determined by + +.. math:: + :label: eq:23 + + \hat{q}^h = \sum_{\beta} q_{\beta} h_{\beta} + +where :math:`h_{\beta}` is the specific enthalpy of phase :math:`\beta`. + + +Coupled Wellbore Flow +********************* + +Geothermal production wells typically operate at (nearly) constant wellhead pressures. +However, as flow rate and flowing enthalpy change with time, wellbore pressure gradients and flowing bottomhole pressures will also change. +TOUGH3 cannot directly describe production from geothermal wells by solving equations for flow in the reservoir and flow in the wellbore in a fully coupled manner [3]_. +TOUGH3 uses an alternative approach (:cite:label:`murray1993toward`) in which the wellbore and reservoir simulations are performed separately. +This can be accomplished by running a wellbore flow simulator prior to the reservoir simulation for a range of flow rates :math:`q` and +flowing enthalpies :math:`h` in order to generate a table of flowing bottomhole pressures :math:`P_{wb}`. + +.. math:: + :label: eq:24 + + P_{wb} = P_{wb} \left( q, h; P_{wh}, z, r_w \right) + +In addition to the functional dependence on :math:`q` and :math:`h`, flowing bottomhole pressure is dependent on a number of well parameters. +These include wellhead pressure :math`P_{wh}`, feed zone depth :math:`z`, wellbore radius :math:`r_w`, friction factors, and possibly others. +By interpolating on these tabular data, Eq. :math:numref:`eq:24` can +be directly inserted into the well source term, Eq. :math:numref:`eq:15`. +Reservoir flow equations that include a quasi-steady approximation to wellbore flow can then be solved with little added computational expense compared to the case where no wellbore flow effects are considered. +Advantages of representing wellbore flow effects through tabular data include increased robustness and computational efficiency. +It also makes it possible to use different wellbore simulators and two-phase flow correlations without any programming changes in the reservoir simulation code. + +We have incorporated a tabular interpolation scheme for dynamic changes of flowing bottomhole pressure into TOUGH3. +Flowing enthalpy at the feed zone is known from phase mobilities and enthalpies calculated by the reservoir simulator. +The unknown well flow rate and flowing bottomhole pressure are obtained by Newton-Raphson iteration on + +.. math:: + :label: eq:25 + + R \left( q \right) = q - \left( \sum \frac{k_{r \beta}}{\mu_{\beta}} \rho_{\beta} \right) \cdot PI \cdot \left( P - P_{wb} \left( q, h \right )\right) = 0 + +The iterative solution of Eq. :math:numref:`eq:25` was embedded in the outer (Newtonian) iteration performed by TOUGH3 on the coupled mass and heat balance equations. +Additional computational work in comparison to conventional simulations with constant downhole pressure is insignificant. + +The coupled wellbore flow capability as coded in TOUGH3 is limited to wells with a single feed zone and can only handle wellbore pressure effects from changing flow rates and enthalpies. +Effects from changing fluid composition, as, e.g., variable non-condensible gas content, are not modeled at present. + +.. [3] The fully coupled approach was taken by :cite:label:`hadgu1995coupled` who coupled the reservoir simulator TOUGH (:cite:label:`pruess1987tough`) with the wellbore simulator WFSA (:cite:label:`hadgu1990multi`). T2Well (:cite:label:`pan2014t2well`) is also a coupled wellbore-reservoir simulator, which extends TOUGH2 to calculate the flow in both the wellbore and the reservoir simultaneously by introducing a special wellbore sub-domain. T2Well uses the drift-flux model and related conservation equations for describing transient two-phase nonisothermal flow in the wellbore sub-domain. T2Well will be implemented in TOUGH3 at a future date. + + +Semi-Analytical Conductive Heat Exchange +---------------------------------------- + +TOUGH3 provides options for modeling linear or radial conductive heat exchange with geologic formations where no fluid exchange is considered, using semi-analytical methods. +This is a much more efficient alternative to the approach that simply extends the computational grid into those formations and assigns small or vanishing permeability to them. +Even to achieve modest accuracy, the number of grid blocks in the heat flow domain could easily become comparable to, or even larger than, the number of grid blocks in the fluid flow domain, leading to a very inefficient calculation. +The semi-analytical methods require no grid blocks outside of the fluid flow domain, and permit better accuracy for short- and long-term heat exchange. +Note that radial and linear semi-analytical heat exchange cannot be combined in the current version of TOUGH3. + + +Linear Heat Exchange between a Reservoir and Confining Beds +*********************************************************** + +TOUGH3 uses the method of :cite:label:`vinsome1980simple`, which gives excellent +accuracy for heat exchange between reservoir fluids and confining beds [4]_ such as may arise in geothermal injection and production operations. +Observing that the process of heat conduction tends to dampen out temperature variations, Vinsome and Westerveld suggested that caprock or baserock temperatures would vary smoothly even for strong and rapid temperature changes at the boundary of the conduction zone. +Arguing that heat conduction perpendicular to the conductive boundary is more important than parallel to it, they proposed to represent the temperature profile in a semi-infinite conductive layer by means of a simple trial function, as follows: + +.. math:: + :label: eq:26 + + T \left( x, t \right) - T_i = \left( T_f - T_i + px + qx^2 \right) \exp \left( -\frac{x}{d}\right) + +Here, :math:`x` is the distance from the boundary, :math:`T_i` is initial temperature in the cap- or base-rock (assumed uniform), :math:`T_f` is the time-varying temperature at the cap- or base-rock boundary, :math:`p` and :math:`q` are time-varying fit parameters, and :math:`d` is the penetration depth for heat conduction, given by + +.. math:: + :label: eq:27 + + d = \frac{\sqrt{\Theta t}}{2} + +where :math:`\Theta = \lambda / \rho C` is the thermal diffusivity, :math:`\lambda` the thermal conductivity, :math:`\rho` the density of the medium, and :math:`C` the specific heat. +In the context of a finite-difference simulation of nonisothermal flow, each +grid block in the top and bottom layers of the computational grid will have an associated temperature profile in the adjacent impermeable rock as given by Eq. :math:numref:`eq:26`. +The coefficients :math:`p` and :math:`q` will be different for each grid block; they are determined concurrently with the flow simulation from the physical constraints of (1) continuity of heat flux across the boundary, and (2) energy conservation for the reservoir/confining layer system. + +.. [4] This method is developed for calculating heat losses from the reservoir to caprock or baserock and predicting the temperature profile in a semi-infinite, homogeneous, conductive half-space confining bed. + + +Radial Heat Exchange between Fluids in a Wellbore and the Surrounding Formation +******************************************************************************* + +Radial, conductive heat exchange between fluids in a discretized wellbore and the formation is calculated using a semi-analytical, time-convolution method. +Note that the time-dependent temperature evolution in the fully-discretized wellbore is calculated numerically. +At each time step, radial heat transfer with the formation is calculated by superposition of analytical solutions of heat flow that are dependent on the temperature differences between subsequent time steps. + +:cite:label:`carlslaw1959conduction` provided an approximate solution for heat conduction between a cylinder and surrounding media where the temperature of the cylinder is maintained constant. +If the initial temperature difference between the two domains is :math:`\Delta T = T_w - T_f` (where :math:`T_w` and :math:`T_f` are the temperatures in the well and the formation, respectively), the heat flux :math:`q` from the wellbore to the formation can be calculated das the product of a heat transfer function and the temperature using Eq. :math:numref:`eq:28` for small values of the dimensionless time :math:`t_d = \alpha t / r_0^2`, where :math:`\alpha` is the thermal diffusivity and :math:`r_0` is the wellbore radius (m), and Eq. :math:numref:`eq:29` for large values of :math:`t_d`: + +.. math:: + :label: eq:28 + + q = f_1 \left( t_d \right) \cdot \Delta T = \frac{\lambda \Delta T}{r_0} \left( \left( \pi t_d \right)^{-0.5} + \frac{1}{2} - \frac{1}{4} \left( \frac{t_d}{\pi} \right)^{0.5} + \frac{1}{8} t_d - ... \right) + +.. math:: + :label: eq:29 + + q = f_2 \left( t_d \right) \cdot \Delta T = \frac{2 \lambda \Delta T}{r_0} \left( \frac{1}{\log \left( 4 t_d \right) - 2 \gamma} - \frac{\gamma}{\left( \log \left( 4 t_d \right) - 2 \gamma \right)^2} - ... \right) + +Here, :math:`\lambda` is the thermal conductivity (W m\ :sup:`-1` K\ :sup:`-1`), and :math:`\gamma` is the Euler constant (0.57722). +The heat transfer functions :math:`f_1` and :math:`f_2` express the amount of heat flux with time due a unit temperature difference. +As shown in :cite:label:`zhang2011time`, the heat transfer functions :math:`f_1` and :math:`f_2` are approximately the same at the dimensionless time :math:`t_d` = 2.8. +Therefore, :math:`t_d` = 2.8 is considered the critical dimensionless time to switch from :math:`f_1` to :math:`f_2`. + +During fluid injection and production, and as a result of the heat exchange processes, temperature changes continuously over time at any point within the wellbore and at the wellbore-formation interface. +Based on superposition, the radial heat flux across each wellbore element to the surrounding formation is a time-convolution result of varying temperature. The discretized form at each time step can be expressed as + +.. math:: + :label: eq:30 + + q_{total} = \sum_{i=1}^{d-1} f \left( t_d - t_i \right) \cdot \Delta T \left( t_i \right) + +Here, :math:`t_d` represents the current time after :math:`d` time steps, and :math:`t_i` represents the time after :math:`i` time steps; the function :math:`f` is :math:`f_1` if :math:`t_d - t_i \le 2.8`, and :math:`f_2` if :math:`t_d - t_i \gt 2.8`. +The temperature difference :math:`\Delta T \left( t_i \right)` is the temperature in the well at time step :math:`i`, minus the formation temperature at the interface at the previous time step, i.e., :math:`\Delta T \left( t_i \right) = T_w \left( t_i \right) - T_f \left( t_{i - 1} \right)`. diff --git a/doc/source/tough3/guide/index.rst b/doc/source/tough3/guide/index.rst new file mode 100644 index 00000000..2dee821f --- /dev/null +++ b/doc/source/tough3/guide/index.rst @@ -0,0 +1,40 @@ +User Guide +========== + +The TOUGH3 simulator is developed for applications involving subsurface flow problems. +TOUGH3 solves mass and energy balance equations that describe fluid and heat flow in general multiphase, multicomponent, and multidimensional systems. +It fully accounts for the movement of gaseous, aqueous, and non-aqueous phases, the transport of latent and sensible heat, and the +transition of components between the available phases, which may appear and disappear depending on the changing thermodynamic state of the system. +Advective fluid flow in each phase occurs under pressure, viscous, and gravity forces according to the multiphase extension of +Darcy's law, which includes relative permeability and capillary pressure effects. +In addition, diffusive mass transport can occur in all phases. +The code includes Klinkenberg effects in the gas phase and vapor pressure lowering due to capillary and phase adsorption effects. +Heat flow occurs by conduction and convection, as well as radiative heat transfer according to the Stefan-Boltzmann equation. +Local equilibrium of all phases is assumed to describe the thermodynamic conditions. +TOUGH3 can simulate the injection or production of fluids and heat, and also includes different options for considering wellbore flow effects. +Effects of sorption onto the solid grains, radionuclide transport, or biodegradation can be simulated as well for certain EOS modules. + +TOUGH3 uses an integral finite difference method (IFDM) for space discretization. +The IFDM (:cite:label:`narasimhan1976integrated`) avoids any reference to a global system of coordinates, and thus offers the advantage of being applicable to regular or irregular discretizations in one, two, and three dimensions. +The IFDM also makes it possible, by means of simple preprocessing of geometric data, to implement double-porosity, dual-permeability, or multiple interacting continua (MINC) methods for fractured media (:cite:label:`pruess1982fluid, pruess1985practical, pruess1983gminc`). +No particular price needs to be paid for this flexibility; indeed, for systems of regular grid blocks referring to a global coordinate system, the IFDM is completely equivalent to conventional finite differences. +Time is discretized fully implicitly as a first-order backward finite difference. +The implicit time-stepping and the 100% upstream weighting of flux terms at interfaces are necessary to avoid impractical time step limitations in flow problems involving phase (dis-)appearances, and to achieve unconditional stability (:cite:label:`peaceman2000fundamentals`). +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. + +TOUGH3 can simulate various fluid mixtures by means of separate EOS modules, which internally calculate the thermophysical properties of specific fluid mixtures, e.g., fluid density, viscosity, and enthalpy. Due to this flexibility to handle a variety of flow systems, TOUGH3 can be used for diverse application areas, such as geothermal reservoir engineering, geological carbon sequestration, natural gas reservoirs, nuclear waste isolation, environmental assessment and remediation, and flow and transport in variably saturated media and aquifers, among other applications that involve nonisothermal multiphase flows. + +.. toctree:: + :titlesonly: + :hidden: + :maxdepth: 2 + + governing_equations + numerical_methods + initial_and_boundary_conditions + preparation_of_input_data + output_from_tough3 + relative_permeability_functions + capillary_pressure_functions diff --git a/doc/source/tough3/guide/initial_and_boundary_conditions.rst b/doc/source/tough3/guide/initial_and_boundary_conditions.rst new file mode 100644 index 00000000..8e4c3c0e --- /dev/null +++ b/doc/source/tough3/guide/initial_and_boundary_conditions.rst @@ -0,0 +1,116 @@ +.. _initial_and_boundary_conditions: + +Initial and Boundary Conditions +=============================== + +Initial Conditions and Restarting +--------------------------------- + +Flow systems are initialized by assigning a complete set of primary thermodynamic variables to all grid blocks into which the flow domain is discretized. +Various options are available in a hierarchical system, as follows. +During the initialization of a TOUGH3 run, all grid blocks are first assigned to default thermodynamic conditions specified in data block **PARAM.4**. +The defaults can be overwritten for selected reservoir domains by assigning domain-specific conditions in data block **INDOM**. These in turn may be superseded by thermodynamic conditions assigned to individual grid blocks in data block **INCON**. A disk file *INCON* written to the same +specifications as data block **INCON** may also be used. + +Different EOS modules use different sets of primary variables, and some EOS modules allow different choices of primary variables for initialization. +For a given EOS module, the primary variables used depend on the fluid phase composition. During phase change, primary variables will be automatically switched from one set to another. +In multiphase flow systems, therefore, different grid blocks will in general have different sets of primary variables, and must be initialized accordingly. + +For many applications, special initial conditions are needed, such as gravity-capillary equilibrium, or steady state corresponding to certain mass and heat flows. +This can be realized by performing a series of TOUGH3 runs, in which thermodynamic conditions obtained in one run, and written to disk file *SAVE*, are used as initial conditions in a subsequent continuation run. +For example, in a geothermal reservoir simulation, a first run may be made to obtain hydrostatic pressure conditions. +These may subsequently be used as boundary conditions in a second run segment to simulate undisturbed natural state conditions with throughflow of mass and heat. +This could be followed by a third run segment with fluid production and injection. +Restarting of a TOUGH3 run is accomplished by providing file *SAVE* generated in a previous run as file *INCON* for initialization. +Usually additional (often minor) adjustments will be made for a restart. +For example, different specifications for the number of time steps and desired printout times may be made. +Some editing of the *SAVE* and/or *MESH* files may be needed to implement boundary conditions on certain grid blocks. +Then, previously calculated pressures on those grid blocks can serve as boundary conditions. +In a continuation run, simulation time and time step counters may be continuously incremented, or they may be reset to zero. +For example, the latter option will be used when simulating production and injection operations following preparation of a "natural" initial state, which may correspond to a large simulation time. + +As far as the internal workings of the code is concerned, there is no difference between a fresh start of a simulation and a restart. +The only feature that makes a simulation a continuation run is that the INCON data were generated by a previous TOUGH3 run, rather than having them explicitly provided by the user. +File *SAVE* always ends with a data record with ``+++`` in the first three columns, followed by one record with restart information (time step and iteration counters, simulation time). +To reset all counters to zero, users should simply replace the ``+++`` with a blank record when using *SAVE* as file *INCON* for another TOUGH3 run. + + +Neumann Boundary Conditions +--------------------------- + +Neumann conditions prescribe fluxes of mass or heat crossing boundary surfaces. +A special case of Neumann boundary conditions is "no flux", which in the integral finite difference framework is handled simply by not specifying any flow connections across the boundary. +More general flux conditions are prescribed by introducing sinks or sources of appropriate strength into the elements adjacent to the boundary. +Time-dependent Neumann conditions can be specified by making sink and source rates time dependent. + + +Dirichlet Boundary Conditions +----------------------------- + +Dirichlet conditions prescribe fixed thermodynamic conditions, such as pressure, temperature, or saturation. +Dirichlet conditions can be implemented by assigning very large volumes (e.g., :math:`V` = 1050 m\ :sup:`3`) to grid blocks adjacent to the boundary, so that their thermodynamic conditions do not change at all from fluid or heat exchange with finite-size blocks in the flow domain. +For those elements with very large volumes, no mass or energy balance equations are set up, and their primary thermodynamic variables are not included in the list of unknowns. +In addition, a small value (such as :math:`D`` = 10\ :sup:`-9` m) should be specified for the nodal distance of such blocks, so that boundary conditions are in fact maintained in close proximity to the surface where they are desired, and not at some distance from it. + +TOUGH3 no longer supports the so-called "inactive" elements allowed in TOUGH2. +If an element with a zero or negative volume is used to indicate that the element and all subsequent elements are to be used for Dirichlet boundary conditions, then the code will internally assign a very large volume for that and all subsequent elements (to be backward compatible with TOUGH2) and print out a warning message. +However, if a dummy element with no volume and no material name is used just to separate boundary elements, the code will generate an error message and stop the simulation. +In TOUGH3, the user must specify a material name for every element. + +Time-dependent Dirichlet conditions can be implemented using two different approaches. The first method consists of placing appropriate, large sinks or sources in boundary elements with large volumes (:cite:label:`moridis1992tough`). +As an example, consider a laboratory experiment reported by Kruger and Ramey (1974) that involved flashing (vaporizing) flow from a sandstone core, with a time-dependent gas pressure boundary condition + +.. math:: + :label: eq:42 + + P_b = P_0 + P_1 t + P_2 t^2 + +maintained at the outflow end. +According to the ideal gas law, the pressure behavior of Eq. :math:numref:`eq:42` can be associated with a time-dependent gas inventory of mass :math:`M_b` in a volume :math:`V` as follows: + +.. math:: + :label: eq:43 + + M_b = P_b \frac{m V}{R T} + +where :math:`m` is the molar weight of the gas, :math:`R` the universal gas constant, and :math:`T` absolute temperature. +The required time dependence of :math:`M_b` can be realized by means of a sink/source rate of + +.. math:: + :label: eq:44 + + Q_b = \frac{dM_b}{dt} = \frac{m V}{R T} \frac{dP_b}{dT} = \frac{m V}{R T} \left( P_1 + P_2 t \right) + +Therefore, the desired boundary condition can be implemented by means of a grid block with volume :math:`V` that is initialized in single-phase gas (e.g., air) conditions, with pressure :math:`P_0`, and with a time-dependent sink/source term given by Eq. :math:numref:`eq:44` that would be specified through tabular generation data in data block **GENER**. +In order for the pressure conditions in this block to be negligibly affected by heat and mass exchange with the flow domain, the volume :math:`V` should be +made very large, e.g., :math:`V` = 1050 m\ :sup:`3`, just as for time-independent Dirichlet boundary conditions. +The time-dependent generation rates from Eq. :math:numref:`eq:44` will then also be very large. +The same approach as just outlined for a time-dependent gas pressure boundary can be used to realize other time-dependent Dirichlet conditions, such as prescribed temporal variation of temperature, capillary pressure, and others. + +The second, newly implemented method to specify time-dependent Dirichlet boundary conditions is to read a set of time and primary variable data at boundary elements from the input file or a file whose name is given in data block **TIMBC**. +Boundary values will be linearly interpolated between table entries. +The volume for these elements should be made very large as well. + + +Atmospheric Boundary Conditions +------------------------------- + +Often flow models need to include the atmosphere as the top boundary. +The atmospheric boundary conditions can be specified using Dirichlet boundary elements with very large volumes. +For EOS9, no atmospheric boundary element is needed since EOS9 uses Richards' equation to describe variably saturated flow of a single aqueous phase and treats the gas phase as a passive bystander at constant pressure. +A single atmospheric element can be connected to all elements at the ground surface, and users may use *AddBound.exe* for this purpose (free software available from the TOUGH website). + +Atmospheric pressure and temperature are used as initial condition in atmospheric elements. +A relative humidity of 100% is conveniently specified by initializing the atmospheric block as a two-phase point with a liquid saturation smaller than the residual liquid saturation (so relative permeability is zero, preventing liquid flow into soil). +For relative humidities less than 100%, a single-phase gas point must be specified with an appropriate air mass fraction (1.0 for dry air; the minimum value depends on vapor pressure, which is a function of temperature; intermediate values determine relative humidity). +The material properties, such as relative permeability and capillary pressure functions, for the atmospheric boundary element should be appropriately selected so that (1) liquid relative permeability is zero, (2) gas relative permeability is one, and (3) capillary pressure is zero. +In addition, mobilities need to be upstream weighted. + +Infiltration can be simulated by specifying the infiltration rate in a row of elements below the atmospheric boundary element using the **GENER** block. Evaporation can be simulated (a) as a binary diffusion process (atmosphere at < 100% relative humidity), (b) by specifying the evaporation rate in a row of elements below the atmospheric boundary element using the **GENER** block, or (c) by assigning a capillary pressure according to Kelvin's equation in the atmospheric element (:cite:label:`ghezzehei2004modeling`). + + +Constant Temperature Boundary Conditions +---------------------------------------- + +Constant temperature boundary conditions but variable pressure, saturation, and mass fractions can be specified by setting rock grain density (``DROK``) to a very large value (e.g., 1.0E50). +This option is useful for cases where the temperature of the injected fluid is maintained constant while the other primary variables defining the system state may vary with time. diff --git a/doc/source/tough3/guide/numerical_methods.rst b/doc/source/tough3/guide/numerical_methods.rst new file mode 100644 index 00000000..27d8670d --- /dev/null +++ b/doc/source/tough3/guide/numerical_methods.rst @@ -0,0 +1,316 @@ +.. _numerical_methods: + +Numerical Methods +================= + +Space and Time Discretization +----------------------------- + +TOUGH3 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. :math:numref:`eq:1` are discretized in space using the integral finite difference method (IFD; :cite:label:`narasimhan1976integrated`). +Introducing appropriate volume averages, we have + +.. math:: + :label: eq:31 + + \int_{V_n} M dV = V_n M_n + +where :math:`M` is a volume-normalized extensive quantity, and :math:`M_n` is the average value of :math:`M` over :math:`V_n`. + +Surface integrals are approximated as a discrete sum of averages over surface segments :math:`A_{nm}`: + +.. math:: + :label: eq:32 + + \int_{\Gamma_n} \boldsymbol{\mathrm{F}}^{\kappa} \cdot \boldsymbol{\mathrm{n}} d\Gamma_n = \sum_{m} A_{nm} F_{nm} + +Here, :math:`F_{nm}` is the average value of the (inward) normal component of :math:`\boldsymbol{\mathrm{F}}` over the surface segment +:math:`A_{nm}` between volume elements :math:`V_n` and :math:`V_m`. +The discretization approach used in the integral finite difference method and the definition of the geometric parameters are illustrated in Figure :numref:`%s `. + +.. figure:: ../figures/figure_1.png + :name: fig:1 + :align: center + + Space discretization and geometry data in the integral finite difference method. + +The discretized flux is expressed in terms of averages over parameters for elements :math:`V_n` and :math:`V_m`. +For the basic Darcy flux term, Eq. :math:numref:`eq:5`, we have + +.. math:: + :label: eq:33 + + 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) + +where the subscripts :math:`(nm)` denote a suitable averaging at the interface between grid blocks :math:`n` and :math:`m` (such as interpolation, harmonic weighting, and upstream weighting, which will be discussed in Section :ref:`interface_weighting_schemes`). +:math:`D_{nm} = D_n + D_m` is the distance between the nodal points :math:`n` and :math:`m`, and :math:`g_{nm}` is the component of gravitational acceleration in the direction from :math:`m` to :math:`n`. + +Space discretization of diffusive flux in multiphase conditions raises some subtle issues. +A finite difference formulation for total diffusive flux, Eq. :math:numref:`eq:11`, may be written as + +.. math:: + :label: eq:34 + + \left( f^{\kappa} \right)_{nm} = - \left( \Sigma_l^{\kappa} \right)_{nm} \frac{\left( X_l^{\kappa} \right)_m - \left( X_l^{\kappa} \right)_n}{D_{nm}} - \left( \Sigma_g^{\kappa} \right)_{nm} \frac{\left( X_g^{\kappa} \right)_m - \left( X_g^{\kappa} \right)_n}{D_{nm}} + +This expression involves the as yet unknown diffusive strength coefficients :math:`\left( \Sigma_l^{\kappa} \right)_{nm}` and :math:`\left( \Sigma_g^{\kappa} \right)_{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. + +TOUGH3 features a fully coupled approach in which the space-discretized version Eq. :math:numref:`eq:34` of the total multiphase diffusive flux Eq. :math:numref:`eq:11` 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 + +.. math:: + :label: eq:35 + + \left( f^{\kappa} \right)_{nm} = - \left\{ \Sigma_l^{\kappa} + \Sigma_g^{\kappa} \frac{\left( X_g^{\kappa} \right)_m - \left( X_g^{\kappa} \right)_n}{\left( X_l^{\kappa} \right)_m - \left( X_l^{\kappa} \right)_n} \right\}_{nm} \frac{\left( X_l^{\kappa} \right)_m - \left( X_l^{\kappa} \right)_n}{D_{nm}} + +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. :math:numref:`eq:35` will reduce to harmonic weighting of either :math:`\Sigma_l^{\kappa}` or :math:`\Sigma_g^{\kappa}`. +The simpler scheme of separate harmonic weighting for individual phase diffusive fluxes is retained as an option. + +Substituting Eqs. :math:numref:`eq:31` and :math:numref:`eq:32` into the governing Eq. :math:numref:`eq:1`, a set of first-order ordinary differential equations in time is obtained: + +.. math:: + :label: eq:36 + + \frac{dM_n^{\kappa}}{dt} = \frac{1}{V_n} \sum_m A_{nm} F_{nm}^{\kappa} + q_n^{\kappa} + +Time is discretized as a first-order finite difference, and the flux and sink and source terms on the right-hand side of Eq. :math:numref:`eq:36` are evaluated at the new time level, :math:`t^{k + l} = t^k + \Delta 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 :math:`k + 1`, so that these unknowns are only implicitly defined in the resulting equations (see, e.g., :cite:label:`peaceman2000fundamentals`). +The time discretization results in the following set of coupled nonlinear, algebraic equations + +.. math:: + :label: eq:37 + + R_n^{\kappa, k+1} = M_n^{\kappa, k+1} - R_n^{\kappa, k} \frac{\Delta t}{V_n} \left( \sum_m A_{nm} F_{nm}^{\kappa, k+1} + V_n q_n^{\kappa, k+1} \right) = 0 + +where we have introduced residuals :math:`R_n^{\kappa, k+1}`. +For each volume element (grid block) :math:`V_n`, there are :math:`NEQ` mass and heat balance equations (:math:`\kappa = 1, 2, ..., NEQ`, where :math:`NEQ` represents the number of equations per grid block). +For a flow system with :math:`NEL` grid blocks, Eq. :math:numref:`eq:37` represents a total of :math:`NEL \times NEQ` coupled nonlinear equations. +The unknowns are the :math:`NEL \times NEQ` independent primary variables :math:`\left\{ x_i; i = 1, ..., NEL \times NEQ \right\}` which completely define the state of the flow system at time :math:`t^{k + l}`. +These equations are solved by Newton-Raphson iteration, which is implemented as follows. +We introduce an iteration index :math:`p` and expand the residuals :math:`R_n^{\kappa, k+1}` in Eq. :math:numref:`eq:37` at iteration step :math:`p + 1` in a Taylor series in terms of the residuals at index :math:`p`. + +.. math:: + :label: eq:38 + + R_n^{\kappa, k+1} \left( x_{i, p+1} \right) = R_n^{\kappa, k+1} \left( x_{i, p} \right) + \sum_i \frac{\partial R_n^{\kappa, k+1}}{\partial x_i} \bigg|_p \left( x_{i, p+1} - x_{i, p} \right) + ... = 0 + +Retaining only terms up to first order, we obtain a set of :math:`NEL \times NEQ` linear equations for the increments :math:`\left( x_{i, p+1} - x_{i, p} \right)`: + +.. math:: + :label: eq:39 + + - \sum_i \frac{\partial R_n^{\kappa, k+1}}{\partial x_i} \bigg|_p \left( x_{i, p+1} - x_{i, p} \right) = R_n^{\kappa, k+1} \left( x_{i, p} \right) + +All terms :math:`\partial R_n / \partial x_i` in the Jacobian matrix are evaluated by numerical differentiation. +Eq. :math:numref:`eq:39` is solved by the linear equations solver selected. +Iteration is continued until the residuals :math:`R_n^{\kappa, k+1}` are reduced below a preset convergence tolerance. + +.. math:: + :label: eq:40 + + \left\vert \frac{R_{n, p+1}^{\kappa, k+1}}{M_{n, p+1}^{\kappa, k+1}} \right\vert \le \varepsilon_1 + +The default (relative) convergence criterion is :math:`\varepsilon_1 = 10^{-5}`. +When the accumulation terms are smaller than :math:`\varepsilon_2` (default :math:`\varepsilon_2 = 1`), an absolute convergence criterion is imposed. + +.. math:: + :label: eq:41 + + \left\vert R_n^{\kappa, k+1} \right\vert \le \varepsilon_1 \cdot \varepsilon_2 + +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 :math:`\Delta t` 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. :math:numref:`eq:37` is provided in the form of a list of grid block volumes :math:`V_n`, interface areas :math:`A_{nm}`, nodal distances :math:`D_{nm}` and components :math:`g_{nm}` 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. +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. :math:numref:`eq:33` 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 (:cite:label:`pruess1985practical`). +For systems of regular grid blocks referenced to global coordinates (such as :math:`r-z` or :math:`x-y-z`), Eq. :math:numref:`eq:37` is identical to a conventional finite difference formulation (e.g., :cite:label:`peaceman2000fundamentals, moridis1992tough`). + + +.. _interface_weighting_schemes: + +Interface Weighting Schemes +--------------------------- + +To obtain a reasonably accurate and efficient solution, particularly for multiphase fluid and heat flow problems, a proper interface weighting scheme should be used. +It is well known that for single-phase flow, the appropriate interface weighting scheme for absolute permeability is harmonic weighting. +For two-phase flow, the added problem of relative permeability weighting arises. +It has been established that for transient flow problems in homogeneous media, relative permeability must be upstream weighted, or else phase fronts may be propagated with erroneous speed (:cite:label:`aziz1979petroleum`). +Studies at the Lawrence Berkeley National Laboratory have shown that for transient two-phase problems in composite (layered) media, both absolute and relative permeability must be fully upstream weighted to avoid the possibility of gross errors (:cite:label:`tsang1990further, wu1993buckley`). +The applicable weighting schemes for different flow problems are +summarized in :numref:`fig:2`. +There is no single weighting scheme for general two-phase flows in composite media that would at the same time preserve optimal accuracy for single-phase or steady two-phase flows. + +.. figure:: ../figures/figure_2.png + :name: fig:2 + :align: center + :width: 50% + + Weighting procedures for absolute (:math:`k`) and relative permeability (:math:`k_r`) at grid block interfaces. + +For modeling of fracture-matrix interaction, a different weighting scheme can be applied. +If a zero nodal distance is specified, the absolute (and relative, if ``MOP2(7)`` > 0) permeability from the other element is used for assignment of interface mobilities. + +Another interesting problem is the weighting scheme for interface densities. +For proper modeling of gravity effects, it is necessary to define interface density as the arithmetic average between the densities of the two adjacent grid blocks, regardless of nodal distances from the interface. +An unstable situation may arise when phases (dis-)appear, because interface density may then have to be "switched" to the upstream value when the phase in question is not present in the downstream block. +For certain flow problems, spatial interpolation of densities may provide more accurate answers. + +Issues of interface weighting and associated discretization errors are especially important when non-uniform or irregular grids are used. +Additional complications related to interface weighting arise in flow problems that involve hydrodynamic instabilities. +Examples include immiscible displacements with unfavorable mobility ratio where a less viscous fluid displaces a fluid of higher viscosity (viscous instability), and flow problems where a denser fluid invades a zone with less dense fluid from above (gravity instability). +These instabilities can produce very large grid orientation errors, i.e., simulated results can depend strongly on the orientation of the computational grid (:cite:label:`yanosik1979nine, pruess1983seven, pruess1991tough2`). + +In some cases, it may be advisable to use higher-order differencing schemes. +Grid orientation effects can be reduced by using 7-point or 9-point differencing instead of the common 5-point "stencil", to achieve a higher degree of rotational invariance in the finite difference approximations of the fundamental differential operators. +In the integral finite difference method, these higher-order schemes can be implemented through preprocessing of geometry data, without any coding changes, by assigning additional flow connections with appropriate weighting factors between elements of the computational grid (:cite:label:`pruess1983seven, pruess1991tough2`). +However, reduction or elimination of grid orientation effects as such does not necessarily achieve a better numerical approximation. +It may just amount to reducing the anisotropy of space discretization errors but not their magnitude, creating an illusion of a better approximation by making space discretization effects less obvious (:cite:label:`pruess1991tough2`). + + +.. _linear_equation_solvers: + +Linear Equation Solvers +----------------------- + +TOUGH3 offers a choice of linear solvers: the internal serial linear solvers of TOUGH2, the parallel Aztec solvers (:cite:label:`tuminaro1999official`; used in TOUGH2-MP), and all the serial and parallel solvers available in Portable, Extensible Toolkit for Scientific Computation (PETSc) (:cite:label:`balay2016petsc`). +TOUGH3 provides a common interface to all three sources of linear solvers, allowing users to experiment with different solvers and their preconditioners, and to determine the most efficient method for the problem of interest. +In addition, there is no restriction on using the Aztec and PETSc solvers in serial mode. Moreover, the internal serial solvers included in TOUGH3 are updated with a new sorting algorithm (private communication, Navarro, 2015), which results in a performance gain up to 30% when compared with the serial solvers in TOUGH2 (actual performance gains are problem-specific). +The different linear equation solvers included in the TOUGH3 package can be selected by means of parameter ``MOP(21)`` in data block **PARAM.1** (see Section 8.2). + + +Internal serial solvers +*********************** + +The most reliable linear equation solvers are based on direct methods, while the performance of iterative techniques tends to be problem-specific and lacks the predictability of direct solvers. +The robustness of direct solvers comes at the expense of large storage requirements and execution times that typically increase proportional to :math:`N^3`, where :math:`N` is the number of equations to be solved. +In contrast, iterative solvers have much lower memory requirements, and their computational work increases much less rapidly with problem size, approximately proportional to :math:`N^{\omega}`, with :math:`\omega \approx 1.4 - 1.6` (:cite:label:`moridis1995flow`). +For large problems (especially 3D problems with more than several thousand volume elements), iterative conjugate gradient (CG) type solvers are therefore the method of choice. +Technical details of the serial methods and their performance can be found in :cite:label:`moridis1998t2solv`. + +TOUGH3 includes several internal serial solvers: one direct solver, LUBAND, and four iterative solvers, DSLUBC (bi-conjugate gradient solver), DSLUCS (Lanczos-type bi-conjugate gradient solver), DSLUGM (generalized minimum residual solver), and DLUSTB (stabilized bi-conjugate gradient solver). +By default, TOUGH3 uses DSLUCS with incomplete LU-factorization as preconditioner for serial runs. +Users need to beware that iterative methods may fail for matrices with special features, such as many zeros on the main diagonal, large numerical range of matrix elements, and nearly linearly dependent rows or columns. +Depending on features of the problem at hand, appropriate matrix preconditioning may be essential to achieve convergence. +Poor accuracy of the linear equation solution will lead to deteriorated convergence rates for the Newton-Raphson iteration, and an increase in the number of iterations for a given time step. +In severe cases, time steps may fail with residuals either stagnating or wildly fluctuating. +Users experiencing difficulties with the default settings are encouraged to experiment with the various solvers and preconditioners included in the TOUGH3 package. + +All iterative solvers use incomplete LU-factorization as a preconditioner. +Alternative preconditioners and iteration parameters can be selected by means of an optional data block **SOLVR** in the TOUGH3 input file. +If **SOLVR** is present, its specifications will override the choices made by ``MOP(21)``. +The default preconditioning with SOLVR is also incomplete LU-factorization. + +The solver DLUSTB implements the BiCGSTAB(m) algorithm (:cite:label:`sleijpen1993bicgstab`), an extension of the BiCGSTAB algorithm of :cite:label:`van1992bi`. +DLUSTB provides improved convergence behavior when iterations are started close to the solution, i.e., near steady state. +The preconditoning algorithms (the Z-preprocessors) can cope with difficult problems in which many of the Jacobian matrix elements on the main diagonal are zero. +An example is the "two-waters" problem with EOS1 in which typically 2/3 of the elements in the main diagonal are zero. +:cite:label:`moridis1998t2solv` show that this type of problem can be solved by choosing appropriate pre-processing options. + + +PETSc solvers +************* + +TOUGH3 provides access to PETSc-based sparse and dense linear solvers. +In many cases, the PETSc solvers are more efficient than the original serial solvers and the Aztec solvers. +Since PETSc is being continually updated, users should consult PETSc's documentation (http://www.mcs.anl.gov/petsc/documentation/index.html) and the summary of the linear solvers available from PETSc (http://www.mcs.anl.gov/petsc/documentation/linearsolvertable.html) for a list of updated Krylov subspace algorithms and preconditioners [5]_. + +The current default PETSc solver is the bi-conjugate gradient method with incomplete LU factorization as the preconditioner. +Different Krylov subspace algorithms and preconditioners can be selected through the specification of a PETSc option file (`.petscrc`), an example of which is shown below: + +.. code-block:: + :caption: An example of the PETSc option file (``.petscrc``). + + # monitor solves + -ksp_monitor + # biconjugate gradient + -ksp_type bicg + # additive Schwarz preconditioner + -pc_type asm + # relative tolerance + -ksp_rtol 1e-7 + +Commonly used options are shown in Table :numref:`tab:2`. + +.. list-table:: Commonly used options for PETSc linear solvers. + :name: tab:2 + :widths: 1 1 3 + :header-rows: 1 + :align: center + + * - Keywords + - Description + - Options + * - ``ksp_type`` + - Solvers + - | ``bigcg`` (bi-conjugate gradient method) + | ``bcgsl`` (stabilized version of bi-conjugate gradient method) + | ``cg`` (conjugate gradient method) + | ``minres`` (minimum residual gradient) + | ``gmres`` (generalized minimal residual method) + | ``fgmres`` (flexible generalized minimal residual method) + * - ``pc_type`` + - preconditioner + - | ``jacobi`` (point Jacobi preconditioner) + | ``pcjacobi`` (point block Jacobi preconditioner) + | ``bjacobi`` (block Jacobi preconditioner) + | ``asm`` (restricted additive Schwarz method) + | ``ilu`` (incomplete factorization preconditioner) + | ``icc`` (incomplete Cholesky factorization preconditioner) + | ``jacobi`` (diagonal scaling preconditioning) + * - ``ksp_monitor`` + - monitor convergence + - N/A. Refer to http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPMonitorSet.html for alternatives. + * - ``ksp_rtol`` + - relative convergence tolerance + - Any real number. + +We do not provide the ability to set these options through the ``SOLVR`` block since it is difficult to encode the various options into the structure of the ``SOLVR`` block. +In addition, the use of a separate option file ensures easy access to PETSc's latest linear solvers and its diagnostic tools. + +A special case is when using dense linear solver. +Then, the user will set ``ksp_type`` to ``none`` and ``pc_type`` to ``lu``. +Note that LU decomposition only works in serial mode. +To use dense linear solvers in parallel, changes can be made to the PETSc configuration scripts to include the parallel dense linear solver MUMPS and SuperLU. + +.. [5] In TOUGH3, the PETSc libraries are configured without any external linear solver packages such as MUMPS and SuperLU. However, these packages can be easily included through minor changes to the configuration script. + + +Aztec solvers +************* + +TOUGH3 provides an interface to Aztec solvers, but users should note that the version of the Aztec solver in TOUGH3 is no longer actively maintained. +The PETSc solvers are in general more efficient than the Aztec solvers, but the Aztec solvers can be more efficient when the number of variables per core is small. + +Consistent with the implementation of the PETSc solvers, the options available in Aztec can be set through the specification of an Aztec option file (``.aztecrc``). +An example is shown below: + +.. code-block:: + :caption: An example of the Aztec option file (``.aztecrc``). + + AZ_solver AZ_bicgstab + AZ_precond AZ_dom_decomp + AZ_tol 1e-6 + + +The format of the Aztec option file is inherited from TOUGH2-MP. TOUGH3 allows the user to modify nearly all Aztec options and parameters described in Section 2 of the Aztec manual (http://www.cs.sandia.gov/CRF/pspapers/Aztec_ug_2.1.ps) through ``.aztecrc``. User can also refer to the TOUGH2-MP manual for more details. diff --git a/doc/source/tough3/guide/output_from_tough3.rst b/doc/source/tough3/guide/output_from_tough3.rst new file mode 100644 index 00000000..0ce15e76 --- /dev/null +++ b/doc/source/tough3/guide/output_from_tough3.rst @@ -0,0 +1,182 @@ +.. _output_from_tough3: + +Output from TOUGH3 +================== + +TOUGH3 produces a variety of printed output, most of which can be controlled by the user. +In the initialization phase TOUGH3 writes out dimensions of problem-size dependent arrays and disk files in use to the standard output file (OUTPUT). +This is followed by documentation on block-by-block permeability modification, on settings of the ``MOP``- and ``MOP2``-parameters for choosing program options, and on the EOS-module. +During execution TOUGH3 can optionally generate a brief printout for Newtonian iterations and time steps. +The file *OUTPUT* also includes the volume- and mass-balances at each specified printout times or time step. + +TOUGH3 generates a pre-defined selection of element, connection, or generation variables based on ``KDATA`` in block **PARAM** (see Table 9). +The list is not EOS-specific, except biomass, which will be included when simulating biodegradation reactions using TMVOC. +Separate output files in the selected format (either CSV for positive ``KDATA`` or TECPLOT for negative ``KDATA``) will be generated for element-, connection-, and sinks/sources-related outputs at user-specified simulation times in block **TIMES** or time step frequencies in block **PARAM**. + +TOUGH3 allows the user to select the output variables to be printed using block **OUTPU**. +The user can choose any number of element-, connection-, and generation-related output variables. +A lumped set of primary variables or secondary parameters can be selected, and other information, such as grid-block or connection coordinates, index of elements, connection, or sinks/sources, and element names, can be included as well. +The list of the output variables is shown in :numref:`tab:8` in Section :ref:`tough3_input_format`. The header and unit of variables/parameters selected for printout will be generated accordingly. +An example **OUTPU** block is shown in :numref:`figure_11`; excerpts of resulting output files for element-, connection- and generation-related output variables are shown in :numref:`figure_12`, :numref:`figure_13` and :numref:`figure_14`, respectively. + +.. code-block:: text + :caption: Example CSV output file. + + " ELEM"," SOURCE"," GEN" + " "," "," (W)" + "TIME [sec] 0.31557600E+08" + " A1001"," HTR 1", 0.300000000000E+04 + "TIME [sec] 0.12559000E+09" + " A1001"," HTR 1", 0.300000000000E+04 + ... + +.. list-table:: Standard output based on absolute value of ``KDATA``. abs(``KDATA``) = 1: a selection of element variables. + :name: tab:kdata1 + :widths: 1 2 + :header-rows: 1 + :align: center + + * - Output variable + - Comment + * - Pressure + - + * - Temperature + - Only in nonisothermal mode + * - Saturation + - Saturation of all phases + * - Mass fraction + - Mass fraction of all components in all mobile phases + * - Relative permeability + - Relative permeability of all mobile phases + * - Capillary pressure + - Between mobile phases + * - Density + - Density of all mobile phases + * - Porosity + - + * - Biomass + - Biomass of all microbial populations (only for TMVOC) + +.. list-table:: Standard output based on absolute value of ``KDATA``. abs(``KDATA``) = 2: in addition, a selection of connection variables. + :name: tab:kdata2 + :widths: 1 2 + :header-rows: 1 + :align: center + + * - Output variable + - Comment + * - Heat flow + - Only in nonisothermal mode + * - Total flow + - + * - Phase flow + - Flow of all mobile phases + * - Diffusive flow + - Only when ``NB`` = 8 + +.. list-table:: Standard output based on absolute value of ``KDATA``. abs(``KDATA``) = 3: in addition, a selection of connection variables. + :name: tab:kdata3 + :widths: 1 2 + :header-rows: 1 + :align: center + + * - Output variable + - Comment + * - Generation rate + - Mass (kg/s) or energy (J/s) rate depending on generation type + * - Flowing enthalpy + - Only in nonisothermal mode + * - Fractional flow + - Only for production + * - Wellbore pressure + - Only for production wells operated on deliverability against specified bottomhole pressure + +.. _figure_11: + +.. code-block:: text + :caption: Example data block OUTPU. + + OUTPU----1----*----2----*----3----*----4----*----5----*----6 + 8 + PRESSURE + SECONDARY 2 6 + SECONDARY 1 4 + MASS FRACTION 2 2 + FLOW 1 + VELOCITY 1 + HEAT FLOW + GENERATION RATE + +.. _figure_12: + +.. code-block:: text + :caption: Element-related output variables in CSV format based on **OUTPU** block shown in :numref:`figure_11`. + + " ELEM"," PRES_G"," PCAP_L"," DEN_G"," X_AIR_L" + " "," (PA)"," (PA)"," (KG/M**3)"," (-)" + "TIME [sec] 0.31557600E+08" + " A1001", 0.145733984563E+06, -0.500000000000E+09, 0.729984424325E+00, 0.000000000000E+00 + " A1002", 0.145733992876E+06, -0.333270877952E+08, 0.839804437107E+00, 0.000000000000E+00 + " A1003", 0.130069098208E+06, -0.149548290610E+06, 0.755041253102E+00, 0.000000000000E+00 + " A1004", 0.118768201640E+06, -0.375912049570E+05, 0.693490433326E+00, 0.000000000000E+00 + " A1005", 0.109739217020E+06, -0.199789863209E+05, 0.644044319825E+00, 0.293927428376E-15 + " A1006", 0.102044115154E+06, -0.109444612669E+05, 0.601696773695E+00, 0.274267136463E-10 + " A1007", 0.100043502582E+06, -0.877952984850E+04, 0.676573675262E+00, 0.349785972071E-05 + … + "TIME [sec] 0.12559000E+09" + " A1001", 0.131667455445E+06, -0.500000000000E+09, 0.579679135438E+00, 0.000000000000E+00 + " A1002", 0.131667427270E+06, -0.500000000000E+09, 0.652436733809E+00, 0.000000000000E+00 + " A1003", 0.131667376616E+06, -0.500000000000E+09, 0.697207803100E+00, 0.000000000000E+00 + " A1004", 0.131667303336E+06, -0.500000000000E+09, 0.731317756019E+00, 0.000000000000E+00 + " A1005", 0.131667206441E+06, -0.500000000000E+09, 0.759680036685E+00, 0.000000000000E+00 + " A1006", 0.125971775053E+06, -0.385373109044E+06, 0.732766156518E+00, 0.000000000000E+00 + " A1007", 0.120105966675E+06, -0.609113801028E+05, 0.700795547905E+00, 0.000000000000E+00 + ... + +.. _figure_13: + +.. code-block:: text + :caption: Connection-related output variables in CSV format based on **OUTPU** block shown in :numref:`figure_11`. + + " ELEM1"," ELEM2"," FLOW_G"," VEL_G"," HEAT" + " "," "," (KG/S)"," (M/S)"," (W)" + "TIME [sec] 0.31557600E+08" + " A1001"," A1002", 0.314097500713E-09, 0.442085908383E-09, -0.299974415519E+04 + " A1002"," A1003", -0.117124968441E-02, -0.815791410995E-03, -0.299910711963E+04 + " A1003"," A1004", -0.113996116095E-02, -0.668855689283E-03, -0.300203907460E+04 + " A1004"," A1005", -0.111083200985E-02, -0.743130677782E-03, -0.300533553035E+04 + " A1005"," A1006", -0.107980321381E-02, -0.905005010191E-03, -0.300885963338E+04 + " A1006"," A1007", -0.292168383775E-03, -0.394691197242E-03, -0.301452215868E+04 + " A1007"," A1008", -0.296897257092E-07, -0.400951136232E-07, -0.297658449442E+04 + … + "TIME [sec] 0.12559000E+09" + " A1001"," A1002", -0.536396107829E-09, -0.109093702349E-08, -0.299835837082E+04 + " A1002"," A1003", -0.246742921890E-08, -0.220645706376E-08, -0.299318958181E+04 + " A1003"," A1004", -0.612573151962E-08, -0.338056616113E-08, -0.298393647773E+04 + " A1004"," A1005", -0.118590967237E-07, -0.463183822453E-08, -0.296972471428E+04 + " A1005"," A1006", -0.937133136787E-03, -0.278903292626E-03, -0.294927355061E+04 + " A1006"," A1007", -0.111723414932E-02, -0.302832717904E-03, -0.295107682950E+04 + ... + +.. _figure_14: + +.. code-block:: text + :caption: Generation-related output variables in CSV format based on **OUTPU** block shown in :numref:`figure_11`. + + " ELEM"," SOURCE"," GEN" + " "," "," (W)" + "TIME [sec] 0.31557600E+08" + " A1001"," HTR 1", 0.300000000000E+04 + "TIME [sec] 0.12559000E+09" + " A1001"," HTR 1", 0.300000000000E+04 + ... + +By default, outputs are printed to both the default standard output file (OUTPUT) and the CSV format files. +Users may opt out printing output variables to the standard output file, particularly for large-scale simulations, to avoid creating a very big file. +TOUGH3 also offers an option to generate a file in a format suitable for TECPLOT. +The output variables written to the standard output file can be extracted for visualization using a reformatting program (such as EXT, a free post-processing program downloadable from the TOUGH website, which parses the standard output file along with spatial information provided in the *MESH* file and then generates a plot file in a format suitable for visualization, for instance, using TECPLOT). +It should be noted that EXT calculates the components of flow vectors at the centers of grid blocks; in the current version of the **OUTPU** feature, flow rates and velocities are simply printed for each connection. + +Time series of some parameters for plotting can optionally be written to files in the CSV file format using blocks **FOFT** (for elements), **COFT** (for connections), and **GOFT** (for sinks and sources). +TOUGH3 will generate separate files for each element, connection, and sink/source. +While TOUGH3 has several input options to select the parameters to be written out, users desiring different parameters than what is coded in *FGTAB* should modify that subroutine. diff --git a/doc/source/tough3/guide/preparation_of_input_data.rst b/doc/source/tough3/guide/preparation_of_input_data.rst new file mode 100644 index 00000000..6347d216 --- /dev/null +++ b/doc/source/tough3/guide/preparation_of_input_data.rst @@ -0,0 +1,2316 @@ +.. _preparation_of_input_data: + +Preparation of Input Data +========================= + +To characterize a flow system, users need to prepare input data, including hydrogeologic and thermal parameters and constitutive relations of the permeable medium (absolute and relative permeability, porosity, capillary pressure, heat conductivity, etc.), thermophysical properties of the +fluids (mostly provided internally), initial and boundary conditions of the flow system, and sinks and sources. +In addition, TOUGH3 requires specification of space-discretized geometry, and various program options, computational parameters, and time-stepping information. +Here we summarize the basic conventions adopted for TOUGH3 input data (Section :ref:`tough3_input_data`), and provide a detailed explanation of input data formats (Section :ref:`tough3_input_format`); the summary and input formats for internal grid generation through the MESHMaker module are explained in Sections :ref:`geometry_data` and :ref:`input_formats_for_meshmaker`, respectively. +Some of the EOS modules have specialized input requirements (discussed in the addenda for those modules). +The TMVOC, ECO2N, and ECO2M modules have special options and input requirements, which are explained in separate reports (TMVOC: Pruess and Battistelli, 2002; ECO2N: Pruess, 2005, Pan et al., 2015; ECO2M: Pruess, 2013). + + +.. _tough3_input_data: + +TOUGH3 Input Data +----------------- + +Input can be provided to TOUGH3 in a flexible manner by means of one or several ASCII data files. +All TOUGH3 input is in fixed format (a few exceptions, such as data blocks **GENER** and **TIMBC**) and standard metric (SI) units, such as meters, seconds, kilograms, ˚C, and the corresponding derived units, such as Newtons, Joules, and Pascal = N/m\ :sup:`2` for pressure. + +In the standard TOUGH3 input file data are organized in blocks which are defined by five-character keywords typed in columns 1-5; see :numref:`tab:3`. +The first record must be a problem title of up to 80 characters. +The last record usually is ENDCY; alternatively, ENDFI may be used if no flow simulation is to be carried out (useful for mesh generation). +Data records beyond **ENDCY** (or **ENDFI**) will be ignored. +Some data blocks, such as those specifying reservoir domains (ROCKS), volume elements (**ELEME**), connections (**CONNE**), sinks/sources (**GENER**), and initial conditions (**INDOM** and **INCON**), have a variable number of records, while others have a fixed number of records. +The end of variable-length data blocks is indicated by a blank record. +The data blocks can be provided in arbitrary order; exceptions are (1) the first line must be the title line, (2) **ELEME**, if present, must precede **CONNE**, (3) **START**, if present, must be specified before **INCON**, and (4) **MULTI** must be specified before **PARAM**, **INDOM**, **INCON** (only if :math:`NKIN \ne NK`), and **OUTPU**. +The blocks **ELEME** and **CONNE** must either be both provided through the input file, or must both be absent, in which case alternative means for specifying geometry data will be employed (see Section :ref:`geometry_data`). +If **START** is present, the block **INCON** can be incomplete, with elements in arbitrary order, or can be absent altogether. +Elements for which no initial conditions are specified in **INCON** will then be assigned domain-specific initial conditions from block **INDOM**, if present, or will be assigned default initial conditions given in block **PARAM**, along with default porosities given in **ROCKS**. +If **START** is not present, **INCON** must contain information for all elements, in exactly the same order as they are listed in block **ELEME** (note that initial conditions will be assigned to elements according to their order, not the element name). + +.. list-table:: TOUGH3 input data blocks. + :name: tab:3 + :widths: 1 5 + :header-rows: 1 + :align: center + + * - Keyword + - Function + * - **TITLE** + - first record, single line with a title for the simulation problem + * - **MESHM** + - parameters for internal grid generation through MESHMaker + * - **ROCKS** + - hydrogeologic parameters for various reservoir domains + * - **MULTI** + - specifies number of fluid components and balance equations per grid block + * - **SELEC** + - used with certain EOS-modules to supply thermophysical property data + * - **START** + - one data record for more flexible initialization + * - **PARAM** + - computational parameters; time stepping and convergence parameters; program options; default initial conditions + * - **MOMOP** + - more program options + * - **SOLVR** + - parameters for linear equation solver + * - **DIFFU** + - diffusivities of mass components + * - **FOFT** + - specifies grid blocks for which time series data are desired + * - **COFT** + - specifies connections for which time series data are desired + * - **GOFT** + - specifies sinks/sources for which time series data are desired + * - **RPCAP** + - parameters for relative permeability and capillary pressure functions + * - **HYSTE** + - parameters for hysteretic characteristic curves; required only if non-default values of parameters are used + * - **TIMES** + - specification of times for generating printout + * - **ELEME*** + - list of grid blocks (volume elements) + * - **CONNE*** + - list of flow connections between grid blocks + * - **GENER*** + - list of mass or heat sinks and sources + * - **INDOM** + - list of initial conditions for specific reservoir domains + * - **INCON*** + - list of initial conditions for specific grid blocks + * - **TIMBC** + - specifies time-dependent Dirichlet boundary conditions + * - **OUTPU** + - specifies variables/parameters for printout + * - **ENDCY** + - last record to close the TOUGH3 input file and initiate the simulation + * - **ENDFI** + - alternative to **ENDCY** for closing a TOUGH3 input file; will cause flow simulation to be skipped; useful if only mesh generation is desired + +.. note:: + + \* These blocks can be provided on separate disk files, in which case they would be omitted from the *INPUT* file. + +Between data blocks, an arbitrary number of records with arbitrary data may be present that do not begin with any of the TOUGH3 keywords. +This is useful for inserting comments about problem specifications directly into the input file. +TOUGH3 will gather all these comments and will print the first 50 such records in the output file. + +Much of the data handling in TOUGH3 is accomplished by means of disk files, which are written in a format of 80 characters per record, so that they can be edited and modified with any text editor. + +:numref:`tab:4` summarizes the disk files other than (default) INPUT and OUTPUT used in TOUGH3. +The initialization of the arrays for geometry, generation, and initial condition data is always made from the disk files *MESH* (or *MINC*), *GENER*, and *INCON*. +A user can either provide these files at execution time, or they can be written from TOUGH3 input data during the initialization phase of the program. +During this initialization phase, two binary files *MESHA* and *MESHB* are created from the disk file *MESH*. +If *MESHA* and *MESHB* exist in the working folder, the code will ignore the *MESH* file and the **ELEME** and **CONNE** blocks in the input file, and read geometric information directly from these two files, which will reduce the memory requirement for the master processor and enhance I/O efficiency. +If the mesh is changed, *MESHA* and *MESHB* must be deleted from the working folder to make the changes take effect. +If no data blocks **GENER** and **INCON** are provided in the input file, and if no disk files *GENER* and *INCON* are present, defaults will take effect (no generation; domain-specific initial conditions from block **INDOM**, or defaults from block **PARAM**). +If a user intends to use these defaults, the user has to make sure that at execution time no disk files *INCON* or *GENER* are present from a previous run (or perhaps from a different problem). +A safe way to use default **GENER** and **INCON** is to specify "dummy" data blocks in the input file, consisting of one record with **GENER** or **INCON**, followed by a blank record. + +The format of data blocks **ELEME**, **CONNE**, **GENER**, and **INCON** is basically the same when these data are provided as disk files as when they are given as part of the input file. +However, specification of these data through the input file rather than as disk files offers some added conveniences, which are useful when a new simulation problem is initiated. +For example, a sequence of identical items (volume elements, connections, sinks or sources) can be specified through a single data record. +Also, indices used internally for cross-referencing elements, connections, and sources will be generated internally by TOUGH3 rather than having them provided by the user. +*MESH*, *GENER*, and *INCON* disk files written by TOUGH3 can be merged into an input file without changes, keeping the cross-referencing information. + +.. list-table:: TOUGH3 disk files. + :name: tab:4 + :widths: 1 5 + :header-rows: 1 + :align: center + + * - File + - Use + * - *MESH* + - written in subroutine INPUT from **ELEME** and **CONNE** data, or in module MESHMaker from mesh specification data; read in *RFILE* to initialize all geometry data arrays used to define the discretized flow problem + * - *GENER* + - written in subroutine *INPUT* from **GENER** data; read in *RFILE* to define nature, strength, and time-dependence of sinks and sources + * - *INCON* + - written in subroutine *INPUT* from **INCON** data; read in *RFILE* to provide a complete specification of initial thermodynamic conditions + * - *SAVE* + - written in subroutine *WRIFI* to record thermodynamic conditions at the end of a TOUGH3 simulation run; compatible with formats of file or data block **INCON** for initializing a continuation run + * - *MINC* + - written in module MESHMaker with MESH-compatible specifications, to provide all geometry data for a fractured-porous medium mesh (double porosity, dual permeability, multiple interacting continua); read (optionally) in subroutine *RFILE* to initialize geometry data for a fractured-porous system + * - *TABLE* + - written in subroutine *CYCIT* to record coefficients of semi-analytical linear heat exchange with confining beds at the end of a TOUGH3 simulation run; read (optionally) in subroutine *QLOSS* to initialize heat exchange coefficients in a continuation run + + +.. _tough3_input_format: + +TOUGH3 Input Format +------------------- + +Here we cover the common input data for all EOS modules of TOUGH3. +Additional EOS-specific input data are discussed in the addendum for each EOS module. +The format described is for the default five-character element names. + + +TITLE +***** + +This is the first record of the input file, containing a header of up to 80 characters, to be printed on output. +This can be used to identify a problem. If no title is desired, leave this record blank. + + +ROCKS +***** + +Introduces material parameters for different reservoir domains. + +.. list-table:: Record **ROCKS.1**. + :name: tab:rocks.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``MAT`` + - A5 + - material name (rock type). + * - ``NAD`` + - I5 + - | if zero or negative, defaults will take effect for a number of parameters (see below): + | ≥ 1: will read another data record to override defaults. + | ≥ 2: will read two more records with domain-specific parameters for relative permeability and capillary pressure functions. + * - ``DROK`` + - E10.4 + - rock grain density (kg/m\ :sup:`3``). If ``DROK`` is set to a very large value (typically 1.0E50), a constant temperature boundary condition can be specified (but variable pressure/saturation). + * - ``POR`` + - E10.4 + - default porosity (void fraction) for all elements belonging to domain ``MAT`` for which no other porosity has been specified in block **INCON**. Option **START** is necessary for using default porosity. + * - ``PER(I)`` + - E10.4 + - ``I`` = 1, 3 absolute permeabilities along the three principal axes, as specified by ``ISOT`` in block **CONNE**. + * - ``CWET`` + - E10.4 + - formation heat conductivity under fully liquid-saturated conditions (W/m ˚C). + * - ``SPHT`` + - E10.4 + - rock grain specific heat (J/kg ˚C). Domains with ``SPHT`` > 10\ :sup:`4` J/kg ˚C will not be included in global material balances. This provision is useful for boundary nodes, which are given very large volumes so that their thermo-dynamic state remains constant. Because of the large volume, inclusion of such nodes in global material balances would make the balances useless. + +When a (dummy) domain named "``SEED``" is specified, the absolute permeabilities specified in ``PER(I)`` are modified by the block-by-block permeability modifiers (PM) according to: + +.. math:: + :label: eq:48 + + k_n \rightarrow k_n^{'} = k_n \cdot \zeta_n + +Here, :math:`k_n` is the absolute ("reference") permeability of grid block :math:`n`, as specified in data block **ROCKS** for the domain to which that grid block belongs, :math:`k_n^{'}` is the modified permeability, and :math:`\zeta_n` is the PM coefficient. +When PM is in effect, the strength of capillary pressure will be automatically scaled according to (:cite:label:`leverett1941capillary`) + +.. math:: + :label: eq:49 + + P_{cap, n} \rightarrow P_{cap, n}^{'} = \frac{P_{cap, n}}{\sqrt{\zeta_n}} + +No grid blocks should be assigned to this domain; the presence of domain "``SEED``" simply serves as a flag to put permeability modification into effect. +Random (spatially uncorrelated) PM data can be internally generated in TOUGH3. Alternatively, externally defined permeability modifiers may be provided as part of the geometry data (PMX) in block **ELEME**. Available PM options are: + +1. Externally supplied: :math:`\zeta_n = PMX - PER(2)` +2. "Linear": :math:`\zeta_n = PER(1) \times s - PER(2)` +3. "Logarithmic": :math:`\zeta_n = \exp \left( - PER(1) \times s \right) - PER(2)` + +where :math:`s` is a random number between 0 and 1. + +Data provided in domain "``SEED``" are used to select the following options. + +.. list-table:: Domain "``SEED``". + :name: tab:seed + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``DROK`` + - E10.4 + - | random number seed for internal generation of "linear" permeability modifiers: + | = 0: (default) no internal generation of "linear" permeability modifiers. + | > 0: perform "linear" permeability modification; random modifiers are generated internally with ``DROK`` as seed. + * - ``POR`` + - E10.4 + - | random number seed for internal generation of "logarithmic" permeability modifiers: + | = 0: (default) no internal generation of "logarithmic" permeability modifiers. + | > 0: perform "logarithmic" permeability modification; random modifiers are generated internally with ``POR`` as seed. + * - ``PER(1)`` + - E10.4 + - | scale factor (optional) for internally generated permeability modifiers: + | = 0: (defaults to ``PER(1)`` = 1): permeability modifiers are generated as random numbers in the interval (0, 1). + | > 0: permeability modifiers are generated as random numbers in the interval (0, ``PER(1)``). + * - ``PER(2)`` + - E10.4 + - | shift (optional) for internal or external permeability modifiers: + | = 0: (default) no shift is applied to permeability modifiers. + | > 0: permeability modifiers are shifted according to :math:`\zeta_n^{'} = \zeta_n - PER(2)`. All :math:`\zeta_n^{'} \lt 0` are set equal to zero. + +If both ``DROK`` and ``POR`` are specified as non-zero, ``DROK`` takes precedence. +And if both ``DROK`` and ``POR`` are zero, permeability modifiers as supplied through **ELEME** data will be used. +Note that the domain "``SEED``" is not required in TOUGH3 if externally defined permeability modifiers in block **ELEME** are used without any shift. + +.. list-table:: Record **ROCKS.1.1** (optional, ``NAD`` ≥ 1 only). + :name: tab:rocks.1.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``COM`` + - E10.4 + - pore compressiblity (Pa\ :sup:`-1`), :math:`\frac{1}{\phi} \left( \frac{\partial \phi}{\partial P} \right)_T`, (default is 0). + * - ``EXPAN`` + - E10.4 + - pore expansivity (1/ ˚C), :math:`\frac{1}{\phi} \left( \frac{\partial \phi}{\partial T} \right)_P`, (default is 0). + * - ``CDRY`` + - E10.4 + - formation heat conductivity under desaturated conditions (W/m ˚C), (default is ``CWET``). + * - ``TORTX`` + - E10.4 + - tortuosity factor for binary diffusion. If ``TORTX`` = 0, a porosity and saturation-dependent tortuosity will be calculated internally from the :cite:label:`millington1961permeability` model, Eq. (12). When diffusivities, FDDIAGin data block **DIFFU**, are specified as negative numbers, :math:`\tau_0 \tau_{\beta} = S_{\beta}` will be used. + * - ``GK`` + - E10.4 + - Klinkenberg parameter b (Pa\ :sup:`-1``) for enhancing gas phase permeability according to the relationship :math:`k_{gas} = k \left( 1 + \frac{b}{P} \right)`. + * - ``XKD3`` + - E10.4 + - Distribution coefficient for parent radionuclide, Component 3, in the aqueous phase, m\ :sup:`3`` kg\ :sup:`-1` (EOS7R only). + * - ``XKD4`` + - E10.4 + - Distribution coefficient for daughter radionuclide, Component 4, in the aqueous phase, m\ :sup:`3`` kg\ :sup:`-1` (EOS7R only). + +.. list-table:: Record **ROCKS.1.2** (optional, ``NAD`` ≥ 2 only). + :name: tab:rocks.1.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``IRP`` + - I5 + - integer parameter to choose type of relative permeability function. + * - + - 5X + - (void) + * - ``RP(I)`` + - E10.4 + - ``I`` = 1, ..., 7 parameters for relative permeability function. + +.. list-table:: Record **ROCKS.1.2.1** (optional, ``IRP`` = 12 only). + :name: tab:rocks.1.2.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``RP(I)`` + - E10.4 + - ``I`` = 8, ..., 10 parameters for relative permeability function. + +.. list-table:: Record **ROCKS.1.3** (optional, ``NAD`` ≥ 2 only). + :name: tab:rocks.1.3 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``ICP`` + - I5 + - integer parameter to choose type of capillary pressure function. + * - + - 5X + - (void) + * - ``CP(I)`` + - E10.4 + - ``I`` = 1, ..., 7 parameters for capillary pressure function. + +.. list-table:: Record **ROCKS.1.3.1** (optional, ``ICP`` = 12 only). + :name: tab:rocks.1.3.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``CP(I)`` + - E10.4 + - ``I`` = 8, ..., 13 parameters for capillary pressure function. + +Repeat records 1, 1.1, 1.2, 1.2.1., 1.3, and 1.3.1 for different reservoir domains. + +A blank record closes the **ROCKS** data block. + + +MULTI +***** + +Permits the user to select the number and nature of balance equations that will be solved. +For most EOS modules this data block is not needed, as default values are provided internally. +Available parameter choices are different for different EOS modules (see the addendum of the EOS module of interest). + +.. list-table:: Record **MULTI.1**. + :name: tab:multi.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``NK`` + - I5 + - number of mass components. + * - ``NEQ`` + - I5 + - number of balance equations per grid block. Usually we have ``NEQ`` = ``NK`` + 1, for solving ``NK`` mass and one energy balance equation. Some EOS modules allow the option ``NEQ`` = ``NK``, in which case only ``NK`` mass balances and no energy equation will be solved. + * - ``NPH`` + - I5 + - number of phases that can be present (2 for most EOS modules). + * - ``NB`` + - I5 + - number of secondary parameters in the PAR-array other than component mass fractions. Available options include ``NB`` = 6 (no diffusion) and ``NB`` = 8 (include diffusion). + * - ``NKIN`` + - I5 + - number of mass components in **INCON** data (default is ``NKIN`` = ``NK``). This parameter can be used, for example, to initialize an EOS7R simulation (``NK`` = 4 or 5) from data generated by EOS7 (``NK`` = 2 or 3). If a value other than the default is to be used, then data block **MULTI** must appear before any initial conditions in data blocks **PARAM**, **INDOM**, or **INCON**. + + +START (optional) +**************** + +A record with **START** typed in columns 1-5 allows a more flexible initialization. +More specifically, when **START** is present, **INCON** data can be in arbitrary order, and need not be present for all grid blocks (in which case defaults will be used). +Without **START**, there must be a one-to-one correspondence between the data in blocks **ELEME** and **INCON**. + + +PARAM +***** + +Introduces computation parameters, time stepping information, and default initial conditions. + +.. list-table:: Record **PARAM.1**. + :name: tab:param.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``NOITE`` + - I2 + - specifies the maximum number of Newtonian iterations per time step (default is 8). + * - ``KDATA`` + - I2 + - | specifies amount of printout (default is 1): + | 0 or 1: print a selection of element variables. + | 2: in addition, print a selection of connection variables. + | 3: in addition, print a selection of generation variables. + | If the above values for ``KDATA`` are increased by 10, printout will occur after each Newton-Raphson iteration (not just after convergence). + | If negative values are used, printout for the selection of variables will be generated in the file format of TECPLOT. The amount of printout is given by the absolute value of ``KDATA``. + * - ``MCYC`` + - I4 + - maximum number of time steps to be calculated. If a negative value is used, ``MCYC`` = 2\ :sup:`-MCYC`. + * - ``MSEC`` + - I4 + - maximum duration, in CPU seconds, of the simulation (default is infinite). + * - ``MCYPR`` + - I4 + - printout will occur for every multiple of ``MCYPR`` steps (default is 1). If a negative value is used, ``MCYPR`` = 2\ :sup:`-MCYPR`. + * - ``MOP(I)`` + - I1 + - ``I`` = 1, 24 allows choice of various options, which are documented in printed output from a TOUGH3 run. + * - ``MOP(1)`` + - I1 + - if unequal 0, a short printout for non-convergent iterations will be generated. + * - | ``MOP(2)`` + | ... + | ``MOP(6)`` + - I1 + - generate additional printout in various sub-routines, if set unequal 0. This feature should not be needed in normal applications, but it will be convenient when a user suspects a bug and wishes to examine the inner workings of the code. The amount of printout increases with ``MOP(I)`` (consult source code listings for details). + * - ``MOP(2)`` + - I1 + - *CYCIT* (main subroutine). + * - ``MOP(3)`` + - I1 + - *MULTI* (flow- and accumulation-terms). + * - ``MOP(4)`` + - I1 + - *QU* (sinks/sources). No longer supported in TOUGH3. + * - ``MOP(5)`` + - I1 + - *EOS* (equation of state). + * - ``MOP(6)`` + - I1 + - *LINEQ* (linear equations). No longer supported in TOUGH3. + * - ``MOP(7)`` + - I1 + - if unequal 0, a printout of input data will be provided. + * - ``MOP(8)`` + - I1 + - if ``ISOT`` < 0, chooses the option for reducing fracture-matrix interface area. + * - ``MOP(9)`` + - I1 + - | determines the composition of produced fluid with the MASS option (see **GENER**). The relative amounts of phases are determined as follows: + | 0: according to relative mobilities in the source element. + | 1: produced source fluid has the same phase composition as the producing element. + * - ``MOP(10)`` + - I1 + - | chooses the interpolation formula for heat conductivity as a function of liquid saturation (:math:`S_l`): + | 0: :math:`C(S_l) = CDRY + \sqrt{S_l} \left( CWET - CDRY \right)`. + | 1: :math:`C(S_l) = CDRY + S_l \left( CWET - CDRY \right)`. + * - ``MOP(11)`` + - I1 + - | determines evaluation of mobility and permeability at interfaces: + | 0: mobilities are upstream weighted with ``WUP`` (see **PARAM.3**), permeability is upstream weighted. + | 1: mobilities are averaged between adjacent elements, permeability is upstream weighted. + | 2: mobilities are upstream weighted, permeability is harmonic weighted. + | 3: mobilities are averaged between adjacent elements, permeability is harmonic weighted. + | 4: mobility and permeability are both harmonic weighted. + * - ``MOP(12)`` + - I1 + - | determines interpolation procedure for time dependent sink/source data (flow rates and enthalpies): + | 0: triple linear interpolation; tabular data are used to obtain interpolated rates and enthalpies for the beginning and end of the time step; the average of these values is then used. + | 1: step function option; rates and enthalpies are taken as averages of the table values corresponding to the beginning and end of the time step. + | 2: rigorous step rate capability for time dependent generation data. A set of times :math:`t_i` and generation rates :math:`q_i` provided in data block **GENER** is interpreted to mean that sink/source rates are piecewise constant and change in discontinuous fashion at table points. Specifically, generation is assumed to occur at constant rate :math:`q_i` during the time interval :math:`[t_i, t_{i+1})`, and changes to :math:`q_{i+1}` at :math:`t_{i+1}`. Actual rate used during a time step that ends at time :math:`t`, with :math:`t_i \le t \le t_{i+1}`, is automatically adjusted in such a way that total cumulative exchanged mass at time :math:`t` + + .. math:: + :label: eq:50 + + Q(t) = \int_0^t q dt^{'} = \sum_{j=1}^{i-1} q_j \left( t_{j+1} - t_j \right) + q \left( t - t_i \right) + + | is rigorously conserved. If also tabular data for enthalpies are given, an analogous adjustment is made for fluid enthalpy, to preserve :math:`\int qh dt`. + * - ``MOP(13)`` + - I1 + - | determines content of *INCON* and *SAVE* files: + | 0: standard content. + | 1: writes user-specified initial conditions to file *SAVE*. + | 2: reads parameters of hysteresis model from file *INCON*. + * - ``MOP(14)`` + - I1 + - (void) + * - ``MOP(15)`` + - I1 + - | determines conductive heat exchange with impermeable geologic formations using semi-analytical methods: + | 0: heat exchange is off. + | 1: linear heat exchange *between a reservoir and confining beds* is on (for grid blocks that have a non-zero heat transfer area; see data block **ELEME**). Initial temperature in cap- or base-rock is assumed uniform and taken as the temperature with which the last element in data block **ELEME** is initialized. + | 2: linear heat exchange *between a reservoir and confining beds* is on. Initial temperature for the confining bed adjacent to an element that has a non-zero heat transfer area is taken as the temperature of that element in data block **INCON**. + | Heat capacity and conductivity of the confining beds are specified in block **ROCKS** for the particular domain to which the very last volume element in data block **ELEME** belongs. Thus, if a semi-analytical heat exchange calculation is desired, the user would append an additional dummy element of a very large volume at the end of the **ELEME** block, and provide the desired parameters as initial conditions and domain data, respectively, for this element. It is necessary to specify which elements have an interface area with the confining beds, and to give the magnitude of this interface area. This information is input as parameter ``AHTX`` in columns 31-40 of volume element data in block **ELEME**. Volume elements for which a zero-interface area is specified will not be subject to heat exchange. A sample problem using ``MOP(15)`` = 1 is included in the addendum for EOS1. + | 5: radial heat exchange *between fluids in a wellbore and the surrounding formation* is on. Constant well and formation properties are given in a material named QLOSS with the following parameters: + | - ``DROK``: Rock grain density [kg/m\ :sup:`3`] of formation near well + | - ``POR``: Well radius [m] + | - ``PER(1)``: Reference elevation [m]; specify Z coordinate in block **ELEME**, columns 71-80 + | - ``PER(2)``: Reference temperature [˚C] + | - ``PER(3)``: Geothermal gradient [˚C/m] + | - ``CWET``: Heat conductivity [W/kg ˚C] of formation near well + | - ``SPHT``: Rock grain specific heat [J/kg ˚C] of formation near well + | 6: radial heat exchange *between fluids in a wellbore and the surrounding formation* is on. Depth-dependent well and formation properties (depth, radius, temperature, conductivity, density, capacity) are provided on an external file named *radqloss.dat* with the information in the following format: on the first line, ``NMATQLOSS`` is the number of elevations with geometric and thermal data, and ``NMATQLOSS`` lines are provided with the following data in free format: elevation [m], well radius [m], initial temperature [˚C], ``CWET``, ``DROK``, ``SPHT``. Between elevations, properties are calculated using linear interpolation. + | RESTART is possible for linear heat exchange between a reservoir and confining beds (``MOP(15)`` = 1 or 2), but not for radial heat exchange (``MOP(15)`` = 5 or 6). The data necessary for continuing the linear heat exchange calculation in a TOUGH3 continuation run are written onto a disk file *TABLE*. When restarting a problem, this file has to be provided under the name *TABLE*. If file *TABLE* is absent, TOUGH3 assumes that no prior heat exchange with confining beds has taken place. + * - ``MOP(16)`` + - I1 + - | provides automatic time step control: + | 0: automatic time stepping based on maximum change in saturation. + | 1: automatic time stepping based on number of iterations needed for convergence. + | >1: time step size will be doubled if convergence occurs within ITER ≤ ``MOP(16)`` Newton-Raphson iterations. It is recommended to set ``MOP(16)`` in the range of 2-4. + * - ``MOP(17)`` + - I1 + - | handles time stepping after linear equation solver failure: + | 0: no time step reduction despite linear equation solver failure. + | 9: reduce time step after linear equation solver failure. + * - ``MOP(18)`` + - I1 + - | selects handling of interface density: + | 0: perform upstream weighting for interface density. + | >0: average interface density between the two grid blocks. However, when one of the two phase saturations is zero, upstream weighting will be performed. + * - ``MOP(19)`` + - I1 + - switch used by different EOS modules for conversion of primary variables. + * - ``MOP(20)`` + - I1 + - switch for vapor pressure lowering in EOS4; ``MOP(20)`` = 1 optionally suppresses vapor pressure lowering effects. + * - ``MOP(21)`` + - I1 + - | selects the linear equation solver: + | 0: defaults to ``MOP(21)`` = 3, DSLUCS, Lanczos-type preconditioned bi-conjugate gradient solver. + | 1: (void) + | 2: DSLUBC, bi-conjugate gradient solver. + | 3: DSLUCS (default). + | 4: DSLUGM, generalized minimum residual preconditioned conjugate gradient solver. + | 5: DLUSTB, stabilized bi-conjugate gradient solver. + | 6: LUBAND, banded direct solver. + | 7: AZTEC parallel iterative solver. + | 8: PETSc parallel iterative solver. + | All conjugate gradient solvers use incomplete LU-factorization as a default preconditioner. Other preconditioners may be chosen by means of a data block **SOLVR**. + * - ``MOP(22)`` + - I1 + - (void) + * - ``MOP(23)`` + - I1 + - (void) + * - ``MOP(24)`` + - I1 + - | determines handling of multiphase diffusive fluxes at interfaces: + | - 0: harmonic weighting of fully coupled effective multiphase diffusivity. + | - 1: separate harmonic weighting of gas and liquid phase diffusivities. + * - ``TEXP`` + - E10.4 + - parameter for temperature dependence of gas phase diffusion coefficient (see Eq. :math:numref:`eq:13`). + * - ``BE`` + - E10.4 + - (optional) parameter for effective strength of enhanced vapor diffusion; if set to a non-zero value, will replace the parameter group :math:`\phi \tau_0 \tau_{\beta}` for vapor diffusion (see Eq. :math:numref:`eq:10`). + +.. list-table:: Record **PARAM.2**. + :name: tab:param.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``TSTART`` + - E10.4 + - starting time of simulation in seconds (default is 0). + * - ``TIMAX`` + - E10.4 + - time in seconds at which simulation should stop (default is infinite). + * - ``DELTEN`` + - E10.4 + - length of time steps in seconds. If ``DELTEN`` is a negative integer, ``DELTEN`` = -``NDLT``, the program will proceed to read ``NDLT`` records with time step information. Note that -``NDLT`` must be provided as a floating point number, with decimal point. + * - ``DELTMX`` + - E10.4 + - upper limit for time step size in seconds (default is infinite). + * - ``ELST`` + - A5 + - no longer supported in TOUGH3. For printout after each time step, use **FOFT** instead. + * - + - 5X + - (void) + * - ``GF`` + - E10.4 + - magnitude (m/s\ :sup:`2`) of the gravitational acceleration vector. Blank or zero gives "no gravity" calculation. + * - ``REDLT`` + - E10.4 + - factor by which time step is reduced in case of convergence failure or other problems (default is 4). + * - ``SCALE`` + - E10.4 + - scale factor to change the size of the mesh (default = 1.0). + +.. list-table:: Record **PARAM.2.1**. + :name: tab:param.2.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``DLT(I)`` + - E10.4 + - Length (in seconds) of time step ``I``. This set of records is optional for ``DELTEN`` = -``NDLT``, a negative integer. Up to 13 records can be read, each containing 8 time step data. If the number of simulated time steps exceeds the number of ``DLT(I)``, the simulation will continue with time steps determined by automatic time step control (``MOP(16)``). + +.. list-table:: Record **PARAM.3**. + :name: tab:param.3 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``RE1`` + - E10.4 + - convergence criterion for relative error (default 10\ :sup:`-5``). + * - ``RE2`` + - E10.4 + - convergence criterion for absolute error (default 1). + * - ``U`` + - E10.4 + - (void) + * - ``WUP`` + - E10.4 + - upstream weighting factor for mobilities and enthalpies at interfaces (default 1.0 is recommended). 0 ≤ ``WUP`` ≤ 1. + * - ``WNR`` + - E10.4 + - weighting factor for increments in Newton/Raphson - iteration (default 1.0 is recommended). 0 < ``WNR`` ≤ 1. + * - ``DFAC`` + - E10.4 + - increment factor for numerically computing derivatives (default value is ``DFAC`` = 10\ :sup:`-k/2`, where :math:`k`, evaluated internally, is the number of significant digits of the floating point processor used; for 64-bit arithmetic, ``DFAC`` ≈ 10\ :sup:`-8`). + * - ``FOR`` + - E10.4 + - factor to change the size of the time step during the Newtonian iteration (default 1.0). + * - ``AMRES`` + - E10.4 + - maximum permissible residual during the Newtonian iteration. If a residual larger than ``AMRES`` is encountered, time step will automatically be reduced (default 10\ :sup:`5`). + +.. list-table:: Record **PARAM.4**. + :name: tab:param.4 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``X(I)`` + - E20.13 + - ``I`` = 1, ``NKIN`` + 1 primary variables which are used as default initial conditions for all grid blocks that are not assigned by means of data blocks **INDOM** or **INCON**. Option **START** is necessary to use default **INCON**. Different sets of primary variables are in use for different EOS modules. + +The number of primary variables, ``NKIN`` + 1, is normally assigned internally in the EOS module, and is usually equal to the number ``NEQ`` of equations solved per grid block. +See data block **MULTI** for special assignments of ``NKIN``. +When more than four primary variables are used more than one line (record) must be provided. + + +INDOM +***** + +Introduces domain-specific initial conditions. +These will supersede default initial conditions specified in **PARAM.4**, and can be overwritten by element-specific initial conditions in data block **INCON**. +Option **START** is needed to use **INDOM** conditions. + +.. list-table:: Record **INDOM.1**. + :name: tab:imdom.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``MAT`` + - A5 + - name of a reservoir domain, as specified in data block **ROCKS**. + +.. list-table:: Record **INDOM.2**. + :name: tab:imdom.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``X(I)`` + - E20.13 + - ``I`` = 1, ``NKIN`` + 1 primary variables assigned to all grid blocks in the domain specified in record **INDOM.1**. Different sets of primary variables are used for different EOS modules. + +A blank record closes the **INDOM** data block. +Repeat records **INDOM.1** and **INDOM.2** for as many domains as desired. +The ordering is arbitrary and need not be the same as in block **ROCKS**. + + +INCON +***** + +Introduces element-specific initial conditions. + +.. list-table:: Record **INCON.1**. + :name: tab:incon.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``EL``, ``NE`` + - A3, I2 + - code name of element. + * - ``NSEQ`` + - I5 + - number of additional elements with the same initial conditions. + * - ``NADD`` + - I5 + - increment between the code numbers of two successive elements with identical initial conditions. + * - ``PORX`` + - E15.9 + - porosity; if zero or blank, porosity will be taken as specified in block **ROCKS** if option **START** is used. + * - ``USRX(I)`` + - E10.4 + - ``I`` = 1, 5 grid block specific parameters (optional). + +.. list-table:: Record **INCON.2**. + :name: tab:incon.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``X(I)`` + - E20.14 + - ``I`` = 1, ``NKIN`` + 1 primary variables for the element specified in record **INCON.1**. **INCON** specifications will supersede default conditions specified in **PARAM.4**, and domain-specific conditions that may have been specified in data block **INDOM**. Different sets of primary variables are used for different EOS modules. + +A blank record closes the **INCON** data block. +Alternatively, initial condition information may terminate on a record with ``+++`` typed in the first three columns, followed by time stepping information. +This feature is used for a continuation run from a previous TOUGH3 simulation. + + +SOLVR (optional) +**************** + +Introduces a data block with parameters for linear equation solvers. +For the parallel solvers, only ``MATSLV`` is used, and the other options should be specified through the PETSc (*.petscrc*) and Aztec (*.aztecrc*) option files. + +.. list-table:: Record **SOLVR.1**. + :name: tab:solvr.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``MATSLV`` + - I1 + - | selects the linear equation solver: + | 1: (void) + | 2: DSLUBC, a bi-conjugate gradient solver + | 3: DSLUCS, a Lanczos-type bi-conjugate gradient solver + | 4: DSLUGM, a generalized minimum residual solver + | 5: DLUSTB, a stabilized bi-conjugate gradient solver + | 6: direct solver LUBAND + | 7: AZTEC parallel iterative solver + | 8: PETSc parallel iterative solver + * - + - 2X + - (void) + * - ``ZPROCS`` + - A2 + - | selects the Z-preconditioning (:cite:label:`moridis1998t2solv`). Regardless of user specifications, Z-preprocessing will only be performed when iterative solvers are used (2 ≤ ``MATSLV`` ≤ 5), and if there are zeros on the main diagonal of the Jacobian matrix: + | Z0: no Z-preprocessing (default for ``NEQ`` = 1) + | Z1: replace zeros on the main diagonal by a small constant (10\ :sup:`-25`; default for ``NEQ`` ≠ 1) + | Z2: make linear combinations of equations for each grid block to achieve non-zeros on the main diagonal + | Z3: normalize equations, followed by Z2 + | Z4: affine transformation to unit main-diagonal submatrices, without center pivoting + * - + - 3X + - (void) + * - ``OPROCS`` + - A2 + - | selects the O-preconditioning (:cite:label:`moridis1998t2solv`): + | O0: no O-preprocessing (default, also invoked for ``NEQ`` = 1) + | O1: eliminate lower half of the main-diagonal submatrix with center pivoting + | O2: O1, plus eliminate upper half of the main-diagonal submatrix with center pivoting + | O3: O2, plus normalize, resulting in unit main-diagonal submatrices + | O4: affine transformation to unit main-diagonal submatrices, without center pivoting + * - ``RITMAX`` + - E10.4 + - selects the maximum number of CG iterations as a fraction of the total number of equations (0.0 < ``RITMAX`` ≤ 1.0; default is ``RITMAX`` = 0.1). + * - ``CLOSUR`` + - E10.4 + - convergence criterion for the CG iterations (10\ :sup:`-12` ≤ ``CLOSUR`` ≤ 10\ :sup:`-6`; default is ``CLOSUR`` = 10\ :sup:`-6`) + + +FOFT (optional) +*************** + +Introduces a list of elements (grid blocks) for which time-dependent data are to be written out for plotting during the simulation. +A separate file is generated for each element in CSV format. +The name of each file starts with *FOFT*, and includes the element name. If regular or simple hysteresis is invoked via ``IRP`` = ``ICP`` = 12 or ``IRP`` = ``ICP`` = 13, then relevant hysteresis parameters are also written to *FOFT*. +If ``MOP2(17)`` > 0, print variables according to the input data in block **OUTPU**. + +.. list-table:: Record **FOFT.1**. + :name: tab:foft.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``EFOFT`` + - A5 + - element name. + * - + - 5X + - (void) + * - ``IFOFTF`` + - I5 + - | a flag to control the amount of printout: + | 0: default printout of pressure, temperature, and saturation of flowing phases. + | >0: print out mass fraction of each component in the specified phase in addition to the default printout. + | <0: print out mass fraction of each component in each of all the flowing phases in addition to the default printout. + +A blank record closes the **FOFT** data block. +Repeat records **FOFT.1** for as many elements as desired. + + +COFT (optional) +*************** + +Introduces a list of connections for which time-dependent data are to be written out for plotting during the simulation. +A separate file is generated for each connection in CSV format. +The name of each file starts with *COFT*, and includes the pair of two element names. + +.. list-table:: Record **COFT.1**. + :name: tab:coft.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``ECOFT`` + - A10 + - a connection name, i.e., an ordered pair of two element names (no blank between elements). + * - + - 10X + - (void) + * - ``ICOFTF`` + - I5 + - | a flag to control the amount of printout: + | 0: default printout of heat flux and flow rate of each flowing phase. + | >0: print out fractional mass flow of each component in the specified phase in addition to the default printout. + | <0: print out fractional mass flow of each component in each of all the flowing phases in addition to the default printout. + +A blank record closes the **COFT** data block. +Repeat records **COFT.1** for as many connections as desired. + + +GOFT (optional) +*************** + +Introduces a list of sinks/sources for which time-dependent data are to be written out for plotting during the simulation. +A separate file is generated for each sink/source in CSV format. +The name of each file starts with *GOFT*, and includes the sink/source name. + +.. list-table:: Record **GOFT.1**. + :name: tab:goft.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``EGOFT`` + - A5 + - the name of an element in which a sink/source is defined. + * - + - 5X + - (void) + * - ``IGOFTF`` + - I5 + - | a flag to control the amount of printout: + | 0: default printout of mass flow rate and flowing enthalpy. + | >0: print out fractional mass flow rate of the specified phase in addition to the default printout. + | <0: print out fractional mass flow rate of each of all the flowing phases in addition to the default printout. + +A blank record closes the **GOFT** data block. +Repeat records **GOFT.1** for as many sinks/sources as desired. + + +DIFFU (optional) +**************** + +Introduces diffusion coefficients (needed only for ``NB`` = 8). + +.. list-table:: Record **DIFFU.1**. + :name: tab:diffu.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``FDDIAG(I, 1)`` + - E10.4 + - ``I`` = 1, ``NPH`` diffusion coefficients for mass component #1 in all phases (``I`` = 1: gas; ``I`` = 2: aqueous; etc). + +.. list-table:: Record **DIFFU.2**. + :name: tab:diffu.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``FDDIAG(I, 2)`` + - E10.4 + - ``I`` = 1, ``NPH`` diffusion coefficients for mass component #2 in all phases (``I`` = 1: gas; ``I`` = 2: aqueous; etc). + +Provide a total of ``NK`` records with diffusion coefficients for all ``NK`` mass components. + + +SELEC +***** + +Introduces a number of integer and floating point parameters that are +used for different purposes in different TOUGH3 modules (EOS7, EOS7R, +EWASG, ECO2N, ECO2M, TMVOC). +Note that TOUGH3 includes additional ``IE`` options for the calculation of brine properties in EWASG, ECO2N, and ECO2M. + +.. list-table:: Record **SELEC.1**. + :name: tab:selec.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``IE(I)`` + - I5 + - ``I`` = 1, 16 EOS-specific integer options. + * - ``IE(1)`` + - I5 + - number of records with floating point numbers that will be read (default is ``IE(1)`` = 1; maximum values is 64). + +.. list-table:: Record **SELEC.2**. + :name: tab:selec.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``FE(I)`` + - E10.4 + - ``I`` = 1, ``IE(1)`` * 8 EOS-specific floating point numbers. + +Provide as many **SELEC.2** (:numref:`tab:selec.2`) records with floating point numbers as specified in ``IE(1)``, up to a maximum of 64 records. + + +RPCAP +***** + +Introduces information on relative permeability and capillary pressure functions, which will be applied for all flow domains for which no data were specified in records **ROCKS.1.2** (:numref:`tab:rocks.1.2`) and **ROCKS.1.3** (:numref:`tab:rocks.1.3`). + +.. list-table:: Record **RPCAP.1**. + :name: tab:rpcap.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``IRP`` + - I5 + - integer parameter to choose type of relative permeability function. + * - + - 5X + - (void) + * - ``RP(I)`` + - E10.4 + - ``I`` = 1, ..., 7 parameters for relative permeability function. + +.. list-table:: Record **RPCAP.2** (optional, ``IRP`` = 12 only). + :name: tab:rpcap.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``RP(I)`` + - E10.4 + - ``I`` = 8, ..., 10 parameters for relative permeability function. + +.. list-table:: Record **RPCAP.3**. + :name: tab:rpcap.3 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``ICP`` + - I5 + - integer parameter to choose type of capillary pressure function. + * - + - 5X + - (void) + * - ``CP(I)`` + - E10.4 + - ``I`` = 1, ..., 7 parameters for capillary pressure function. + +.. list-table:: Record **RPCAP.4** (optional, ``ICP`` = 12 only). + :name: tab:rpcap.4 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``CP(I)`` + - E10.4 + - ``I`` = 8, ..., 13 parameters for capillary pressure function. + + +HYSTE (optional) +**************** + +Provides numerical controls on the hysteretic characteristic curves. +It is not needed if the default values of all its parameters are to be used. + +.. list-table:: Record **HYSTE.1**. + :name: tab:hyste.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``IEHYS(1)`` + - I5 + - | flag to print information about hysteretic characteristic curves: + | =0: no additional print out. + | ≥1: print a one-line message to the output file every time a capillary-pressure branch switch occurs (recommended). + * - ``IEHYS(2)`` + - I5 + - | flag indicating when to apply capillary-pressure branch switching: + | =0: after convergence of time step (recommended). + | >0: after each Newton-Raphson iteration. + * - ``IEHYS(3)`` + - I5 + - | run parameter for sub-threshold saturation change: + | =0: no branch switch unless :math:`\left\vert \Delta S \right\vert` > ``CP(10)``. + | >0: allow branch switch after run of ``IEHYS(3)`` consecutive time steps for which all :math:`\left\vert \Delta S \right\vert` < ``CP(10)`` and all :math:`\Delta S` are the same sign. Recommended value 5-10. This option may be useful if the time step is cut to a small value due to convergence problems, making saturation changes very small. + + +TIMES (optional) +**************** + +Permits the user to obtain printout at specified times. +This printout will occur in addition to printout specified in record **PARAM.1**. + +.. list-table:: Record **TIMES.1**. + :name: tab:times.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``ITI`` + - I5 + - number of times provided on records **TIMES.2**, **TIMES.3**, etc. + * - ``ITE`` + - I5 + - total number of times desired (``ITI`` ≤ ``ITE``; default is ``ITE`` = ``ITI``). + * - ``DELAF`` + - E10.4 + - maximum time step size after any of the prescribed times have been reached (default is infinite). + * - ``TINTER`` + - E10.4 + - time increment for times with index ``ITI``, ``ITI`` + 1, ..., ``ITE``. + +.. list-table:: Record **TIMES.2**. + :name: tab:times.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``TIS(I)`` + - E10.4 + - ``I`` = 1, ``ITI`` times (in ascending order) at which printout is desired. + + +ELEME +***** + +Introduces element (grid block) information. + +.. list-table:: Record **ELEME.1**. + :name: tab:eleme.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``EL``, ``NE`` + - A3, I2 + - five-character code name of an element. The first three characters are arbitrary, the last two characters must be numbers. + * - ``NSEQ`` + - I5 + - number of additional elements having the same volume and belonging to the same reservoir domain. + * - ``NADD`` + - I5 + - increment between the code numbers of two successive elements. (Note: the maximum permissible code number ``NE`` + ``NSEQ`` × ``NADD`` is ≤ 99). + * - ``MA1``, ``MA2`` + - A3, A2 + - a five-character material identifier corresponding to one of the reservoir domains as specified in block **ROCKS**. If the first three characters are blanks and the last two characters are numbers then they indicate the sequence number of the domain as entered in **ROCKS**. If both ``MA1`` and ``MA2`` are left blank the element is by default assigned to the first domain in block **ROCKS**. + * - ``VOLX`` + - E10.4 + - element volume (m\ :sup:`3``). + * - ``AHTX`` + - E10.4 + - interface area (m\ :sup:`2`) for linear heat exchange with semi-infinite confining beds. Internal MESH generation via MESHMaker will automatically assign ``AHTX``. + * - ``PMX`` + - E10.4 + - | block-by-block permeability modification coefficient, :math:`\zeta_n` (optional). The ``PMX`` may be used to specify spatially correlated heterogeneous fields. But users need to run their own geostatistical program to generate the fields they desire, and then use preprocessing programs to place the modification coefficients into the **ELEME** data block, as TOUGH3 provides no internal capabilities for generating such fields. + | If a dummy domain "``SEED``" is specified in data block **ROCKS**, it will be used as multiplicative factor for all the permeability parameters from block ROCKS (see Eq. :math:numref:`eq:48`), and strength of capillary pressure will be scaled according to Eq. :math:numref:`eq:49`. With a dummy domain "``SEED``" in data block **ROCKS**, ``PMX`` = 0 will result in an impermeable block. + | In TOUGH3, ``PMX`` can be active without a dummy domain "``SEED``" in the ROCKS block. If a dummy domain "``SEED``" is not specified in data block **ROCKS**, it can be used to specify grid block permeabilities or permeability modifiers. If a positive value less than 10\ :sup:`-4` is given, it is interpreted as absolute permeability; if a negative value is provided, it is interpreted as a permeability modifier, i.e., a factor with which the absolute permeability specified in block **ROCKS** is multiplied. Alternatively, the same information can be provided through ``USRX`` (columns 31-40) in block **INCON**. + | If ``PMX`` is blank for the first element, the element-by-element permeabilities are ignored. If a dummy domain "``SEED``" is not specified in data block **ROCKS**, strength of capillary pressure will not be automatically scaled. Leverett scaling of capillary pressure can be applied with ``MOP2(6)`` > 0 in data block **MOMOP**. + * - ``X``, ``Y``, ``Z`` + - 3E10.4 + - Cartesian coordinates of grid block centers. These may be included in the **ELEME** data to make subsequent plotting of results more convenient. Note that coordinates are not used in TOUGH3; the exceptions are for optional initialization of a gravity-capillary equilibrium with EOS9 and for optional addition of potential energy to enthalpy with ``MOP2(12)`` > 0 in data block **MOMOP**. + * - ``USERX(I)`` + - E10.4 + - anisotropic permeability or permeability modifier of the X-, Y-, and Z-direction for ``I`` = 1, 2, and 3, respectively. Based on the values, TOUGH3 will internally determine whether it is permeability itself or permeability modifier. To read three permeabilities or permeability modifiers, ``MOP2(20)`` in data block **MOMOP** should be set according to Table 7. Alternatively, the same information can be provided through ``USRX`` (columns 31-60) in block **INCON**. To write these element-by-element parameters to file *SAVE*, set ``MOP(13)`` = 1. + +Repeat record **ELEME.1** for the number of elements desired. + +A blank record closes the **ELEME** data block. + + +CONNE +***** + +Introduces information for the connections (interfaces) between elements. + +.. list-table:: Record **CONNE.1**. + :name: tab:conne.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``EL1``, ``NE1`` + - A3, I2 + - code name of the first element. + * - ``EL2``, ``NE2`` + - A3, I2 + - code name of the second element. + * - ``NSEQ`` + - I5 + - number of additional connections in the sequence. + * - ``NAD1`` + - I5 + - increment of the code number of the first element between two successive connections. + * - ``NAD2`` + - I5 + - increment of the code number of the second element between two successive connections. + * - ``ISOT`` + - I5 + - set equal to 1, 2, or 3; specifies absolute permeability to be ``PER(ISOT)`` for the materials in elements (``EL1``, ``NE1``) and (``EL2``, ``NE2``), where ``PER`` is read in block **ROCKS**. This allows assignment of different permeabilities, e.g., in the horizontal and vertical direction. + * - ``D1`` + - E10.4 + - distance (m) from first element to interface. + * - ``D2`` + - E10.4 + - distance (m) from second element to interface. + * - ``AREAX`` + - E10.4 + - interface area (m\ :sup:`2`). + * - ``BETAX`` + - E10.4 + - cosine of the angle between the gravitational acceleration vector and the line between the two elements. ``GF`` × ``BETAX`` > 0 (<0) corresponds to first element being above (below) the second element. + * - ``SIGX`` + - E10.4 + - | "radiant emittance" factor for radiative heat transfer, which for a perfectly "black" body is equal to 1. The rate of radiative heat transfer between the two grid blocks is + + .. math:: + :label: eq:51 + + G_{rad} = SIGX \times \sigma_0 \times AREAX \times \left( T_2^4 - T_1^4 \right) + + | where :math:`\sigma_0` = 5.6687e-8 J/m\ :sup:`2` K\ :sup:`4` s is the Stefan-Boltzmann constant, and :math:`T_1` and :math:`T_1` are the absolute temperatures of the two grid blocks. ``SIGX`` may be entered as a negative number, in which case the absolute value will be used, and heat conduction at the connection will be suppressed. ``SIGX`` = 0 will result in no radiative heat transfer. + +Repeat record **CONNE.1** for the number of connections desired. + +A blank record closes the **CONNE** data block. +Alternatively, connection information may terminate on a record with ``+++`` typed in the first three columns, followed by element cross-referencing information. +This is the termination used when generating a *MESH* file with TOUGH3. + + +GENER +***** + +Introduces sinks and/or sources. + +.. list-table:: Record **GENER.1**. + :name: tab:gener.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``EL``, ``NE`` + - A3, I2 + - code name of the element containing the sink/source. + * - ``SL``, ``NS`` + - A3, I2 + - code name of the sink/source. The first three characters are arbitrary, the last two characters must be numbers. + * - ``NSEQ`` + - I5 + - number of additional sinks/sources with the same injection/production rate (not applicable for ``TYPE`` = DELV). + * - ``NADD`` + - I5 + - increment between the code numbers of two successive elements with identical sink/source. + * - ``NADS`` + - I5 + - increment between the code numbers of two successive sinks/sources. + * - ``LTAB`` + - I5 + - number of points in table of generation rate versus time. Set 0 or 1 for constant generation rate. For wells on deliverability, ``LTAB`` denotes the number of open layers, to be specified only for the bottommost layer. + * - + - 5X + - (void) + * - ``TYPE`` + - A4 + - | specifies different options for fluid or heat production and injection. For example, different fluid components may be injected, the nature of which depends on the EOS module being used. Different options for considering wellbore flow effects may also be specified: + | - HEAT: Introduces a heat sink/source + | - WATE: water + | - COM1: component 1 + | - COM2: component 2 + | - COM3: component 3 + | - ... + | - COMn: component n + | - MASS: mass production rate specified + | - DELV: well on deliverability, i.e., production occurs against specified bottomhole pressure. If well is completed in more than one layer, bottommost layer must be specified first, with number of layers given in ``LTAB``. Subsequent layers must be given sequentially for a total number of ``LTAB`` layers. + | - F--- or f---: well on deliverability against specified wellhead pressure. By convention, when the first letter of a type specification is F or f, TOUGH3 will perform flowing wellbore pressure corrections using tabular data of flowing bottomhole pressure vs. flow rate and flowing enthalpy. The tabular data used for flowing wellbore correction must be generated by means of a wellbore simulator ahead of a TOUGH3 run as ASCII data of 80 characters per record, according to the format specifications below. + + | The first record is an arbitrary title. The second record holds the number of flow rate and flowing enthalpy data (table points), ``NG`` and ``NH``, respectively, in format 2I5; in :numref:`table_6` we have ``NG`` = 11, ``NH`` = 9. This is followed by ``NG`` flow rate data in format 8E10.4, and ``NH`` enthalpy data also in format 8E10.4. After this come ``NG`` sets of ``NH`` flowing bottomhole pressure data in format 8E10.4. The data in :numref:`table_6` were generated with the HOLA wellbore simulator (Aunzo et al., 1991) for a 0.2 m (≈8 inch) inside diameter well of 1,000 m feed zone depth with 7 bars wellhead pressure. Formation temperature for the conductive heat loss calculation in HOLA was assumed to increase linearly from 25˚C at the land surface to 275.5˚C at 750 m depth. Flow rates cover the range from 0.5 to 90.5 kg/s, and flowing enthalpies cover the range from 1,000 to 1,400 kJ/kg. A data record with very large bottomhole pressures of 55.55 MPa was added by hand for a very large hypothetical rate of 1,000 kg/s. This was done to avoid rates going out of table range during Newton-Raphson iteration in a TOUGH3 flow simulation. + | The data must be provided by means of a disk file, whose name consists of the four characters of the ``TYPE`` specification, and the one character of the following ``ITAB`` parameter. For example, to use wellbore pressure data in a disk file called *f725d*, specify ``TYPE`` as *f725*, and specify ``ITAB`` as *d*. Different wellbore tables, representing, e.g., wells with different diameter, feed zone depth, and flowing wellhead pressure, may be used simultaneously in a TOUGH3 simulation. Also, several wells completed in different grid blocks may reference the same wellbore table. + + | The capability for flowing wellbore pressure correction is presently only available for wells with a single feed zone. + * - ``ITAB`` + - A1 + - unless left blank, table of specific enthalpies will be read (``LTAB`` > 1 only). When time-dependent injection is used, ``ITAB`` must be specified non-blank, and specific enthalpy data must be given. + * - ``GX`` + - E10.4 + - constant generation rate; positive for injection, negative for production; ``GX`` is mass rate (kg/s) for generation types COM1, COM2, COM3, etc, and MASS; it is energy rate (J/s) for a HEAT sink/source. For wells on deliverability, ``GX`` is productivity index PI (m\ :sup:`3`), Eq. :math:numref:`eq:16`. + * - ``EX`` + - E10.4 + - fixed specific enthalpy (J/kg) of the fluid for mass injection (``GX`` > 0). For wells on deliverability against fixed bottomhole pressure, ``EX`` is bottomhole pressure :math:`P_{wb}` (Pa), at the center of the topmost producing layer in which the well is open. + * - ``HG`` + - E10.4 + - thickness of layer (m; wells on deliverability with specified bottomhole pressure only). + +.. _table_6: + +.. code-block:: text + :caption: Flowing bottomhole pressures (in Pa) at 1000 m feed zone depth for a well of 20 cm (≈8 inch) inside diameter producing at 7 bar wellhead pressure (calculated from HOLA; Aunzo et al., 1991). + + *f725d* - (q,h) from ( .5000E+00, .1000E+07) to ( .9050E+02, .1400E+07) + 11 9 + .5000E+00 .1050E+02 .2050E+02 .3050E+02 .4050E+02 .5050E+02 .6050E+02 .7050E+02 + .8050E+02 .9050E+02 1.e3 + .1000E+07 .1050E+07 .1100E+07 .1150E+07 .1200E+07 .1250E+07 .1300E+07 .1350E+07 + .1400E+07 + .1351E+07 .1238E+07 .1162E+07 .1106E+07 .1063E+07 .1028E+07 .9987E+06 .9740E+06 + .9527E+06 + .1482E+07 .1377E+07 .1327E+07 .1299E+07 .1284E+07 .1279E+07 .1279E+07 .1286E+07 + .1292E+07 + .2454E+07 .1826E+07 .1798E+07 .1807E+07 .1835E+07 .1871E+07 .1911E+07 .1954E+07 + .1998E+07 + .4330E+07 .3199E+07 .2677E+07 .2280E+07 .2322E+07 .2376E+07 .2434E+07 .2497E+07 + .2559E+07 + .5680E+07 .4772E+07 .3936E+07 .3452E+07 .2995E+07 .2808E+07 .2884E+07 .2967E+07 + .3049E+07 + .6658E+07 .5909E+07 .5206E+07 .4557E+07 .4158E+07 .3746E+07 .3391E+07 .3402E+07 + .3511E+07 + .7331E+07 .6850E+07 .6171E+07 .5627E+07 .5199E+07 .4814E+07 .4465E+07 .4208E+07 + .3957E+07 + .7986E+07 .7548E+07 .7140E+07 .6616E+07 .6256E+07 .5908E+07 .5634E+07 .5399E+07 + .5128E+07 + .8621E+07 .8177E+07 .7820E+07 .7560E+07 .7234E+07 .6814E+07 .6624E+07 .6385E+07 + .6254E+07 + .8998E+07 .8732E+07 .8453E+07 .8124E+07 .7925E+07 .7671E+07 .7529E+07 .7397E+07 + .7269E+07 + .5555e+08 .5555e+08 .5555e+08 .5555e+08 .5555e+08 .5555e+08 .5555e+08 .5555e+08 + .5555e+08 + +.. list-table:: Record **GENER.1.1** (optional, ``LTAB`` > 1 only). + :name: tab:gener.1.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``F1(L)`` + - E14.7 + - ``L`` = 1, ``LTAB`` generation times. + +.. list-table:: Record **GENER.1.2** (optional, ``LTAB`` > 1 only). + :name: tab:gener.1.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``F2(L)`` + - E14.7 + - ``L`` = 1, ``LTAB`` specific enthalpy of produced or injected fluid. + +.. list-table:: Record **GENER.1.3** (optional, ``LTAB`` > 1 and ``ITAB`` non-blank only; this data must be provided for injection at time-dependent rates). + :name: tab:gener.1.3 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``F3(L)`` + - E14.7 + - ``L`` = 1, ``LTAB`` generation rates. + +Repeat records **GENER.1**, **GENER.1.1**, **GENER.1.2**, and **GENER.1.3** for the number of sinks/sources desired. + +A blank record closes the **GENER** data block. +Alternatively, generation information may terminate on a record with ``+++`` typed in the first three columns, followed by element cross-referencing information. + +In addition to the standard input format, time-dependent generation rates (i.e., if ``LTAB`` > 1 in block **GENER.1**) can be provided as a free-format table with time in the first column, injection or production rate in the second column, and (if ``ITAB`` is not left blank) specific enthalpy in the third column. +The number of table rows is given by ``LTAB``. +The tabular format is chosen by providing the character "T" or "D" in Column 7 after keyword **GENER**. +Moreover, time and rate conversion factors can be given in columns 11-20 and 21-30. +If character "D" is specified in Column 7, time can be given in (any) date format; it will be converted to seconds (relative to the first date given). +These conversion factors only apply to sinks/source with time-dependent generation rates (i.e., constant rates given in columns 41-50 of block +**GENER.1** are not affected). +The free-format options are only available if sinks/sources are given directly in the TOUGH3 input deck. +The external file *GENER* has to be provided in the standard format. + + +TIMBC +***** + +Permits the users to specify time-dependent Dirichlet boundary conditions. +All values in this data block are read in free format. + +.. list-table:: Record **TIMBC.1**. + :name: tab:timbc.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``NTPTAB`` + - Free + - number of elements with time-dependent boundary conditions. + +.. list-table:: Record **TIMBC.2**. + :name: tab:timbc.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``NBCP`` + - Free + - number of times. + * - ``NBCPV`` + - Free + - number of primary variable that is time dependent, e.g., 1 for pressure. + +.. list-table:: Record **TIMBC.3**. + :name: tab:timbc.3 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``BCELM`` + - Free + - name of boundary element (start in Column 1). + +.. list-table:: Record **TIMBC.4**. + :name: tab:timbc.4 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``TIMBCV(I)``, ``PGBCEL(I)`` + - Free + - ``I`` = 1, ``NBCP`` times and values of primary variable ``NBCPV`` at boundary element ``BCELM``. + +Repeat records **TIMBC.2**, **TIMBC.3**, and **TIMBC.4** for ``NTPTAB`` times. + + +MOMOP (optional) +**************** + +Describes additional options. + +.. list-table:: Record **MOMOP**. + :name: tab:momop + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``MOP2(1)`` + - I1 + - | Minimum number of Newton-Raphson iterations: + | 0, 1: Allow convergence in a single Newton-Raphson iteration + | 2: Perform at least two iterations; primary variables are always updated + * - ``MOP2(2)`` + - I1 + - | Length of element names (default: 5 characters). Format of blocks **ELEME**, **CONNE**, **INCON**, and **GENER** change depending on element-name length as follows + | + | **ELEME** + | 5: (A3,I2,I5,I5,A2,A3,6E10.4) + | 6: (A3,I3,I5,I4,A2,A3,6E10.4) + | 7: (A3,I4,I4,I4,A2,A3,6E10.4) + | 8: (A3,I5,I4,I3,A2,A3,6E10.4) + | 9: (A3,I6,I3,I3,A2,A3,6E10.4) + | + | **CONNE** + | 5: (2(A3,I2),I5,2I5,I5,4E10.4) + | 6: (2(A3,I3),I5,2I4,I5,4E10.4) + | 7: (2(A3,I4),I5,2I3,I5,4E10.4) + | 8: (2(A3,I5),I3,2I3,I5,4E10.4) + | 9: (2(A3,I6),I3,2I2,I5,4E10.4) + | + | **INCON** + | 5: (A3,I2,I5,I5,E15.8,4E12.4) + | 6: (A3,I3,I5,I4,E15.8,4E12.4) + | 7: (A3,I4,I4,I4,E15.8,4E12.4) + | 8: (A3,I5,I4,I3,E15.8,4E12.4) + | 9: (A3,I6,I3,I3,E15.8,4E12.4) + | + | **GENER** + | 5: (A3,I2,A3,I2,I5,2I5,I5,5X,A4,A1,3E10.4) + | 6: (A3,I3,A3,I2,I6,2I4,I5,5X,A4,A1,3E10.4) + | 7: (A3,I4,A3,I2,I5,2I4,I5,5X,A4,A1,3E10.4) + | 8: (A3,I5,A3,I2,I4,2I4,I5,5X,A4,A1,3E10.4) + | 9: (A3,I6,A3,I2,I5,2I3,I5,5X,A4,A1,3E10.4) + * - ``MOP2(3)`` + - I1 + - | Honoring generation times in block **GENER**: + | 0: Generation times ignored + | >0: Time steps adjusted to match generation times + * - ``MOP2(4)`` + - I1 + - | Vapor pressure reduction: + | 0: No vapor pressure reduction at low liquid saturation + | >0: Reduces vapor pressure for :math:`S_l` < 0.02 to prevent liquid disappearance by evaporation (only certain EOS modules) + * - ``MOP2(5)`` + - I1 + - | Active Fracture Model: + | 0: Active Fracture Model applied to liquid phase only + | >0: Active Fracture Model applied to all phases + * - ``MOP2(6)`` + - I1 + - | Leverett scaling of capillary pressure: + | 0: No Leverett scaling + | >0: Rescale capillary pressure: :math:`P_c = P_{c, ref} \sqrt{\frac{k_{ref}}{k}}` if element-specific permeabilities are specified + * - ``MOP2(7)`` + - I1 + - | Zero nodal distance: + | 0: Take absolute permeability from other element + | >0: Take absolute and relative permeability from other element + * - ``MOP2(8)`` + - I1 + - | Conversion of element names: + | 0: No conversion + | >0: Convert non-leading spaces in element names to zeros + * - ``MOP2(9)`` + - I1 + - | Time stepping after time-step reduction to honor printout time: + | 0: Continue with time step used before forced time-step reduction + | >0: Continue with time step imposed by forced time-step reduction + * - ``MOP2(10)`` + - I1 + - | Writing *SAVE* file: + | 0: Write *SAVE* file only at the end of a forward run + | 1: Write *SAVE* file after each printout time + | 2: Write separate *SAVE* files after each printout time + * - ``MOP2(11)`` + - I1 + - | Water properties: + | 0: International Formulation Committee (1967) + | 1: IAPWS-IF97 + * - ``MOP2(12)`` + - I1 + - | Enthalpy of liquid water: + | 0: Potential energy not included in enthalpy of liquid water + | >0: Potential energy included in enthalpy of all phases (Stauffer et al., 2014) + * - ``MOP2(13)`` + - I1 + - | Adjustment of Newton-Raphson increment weighting: + | 0: No adjustment + | >0: Reduce ``WNR`` by ``MOP2(13)`` percent if Newton-Raphson iterations oscillate and time step is reduced because ``ITER`` = ``NOITE`` + * - ``MOP2(14)`` + - I1 + - | Print input file to the end of output file: + | 0: Do not reprint input files + | 1: Print TOUGH3 input file to the end of TOUGH3 output file + * - ``MOP2(15)`` + - I1 + - | Porosity used for calculation of rock energy content: + | 0: Use porosity of block **ROCKS**; this assumes that the porosities provided in block **INCON** were the result of a pore compressibility/expansivity calculation; the "original" porosity from block **ROCKS** is used to compensate for equivalent rock-grain density changes + | >0: Use porosity from block **INCON**; this assumes that these porosities were not the result from a pore compressibility/expansivity calculation; changes in rock-grain density due to pore compressibility/expansivity are not compensated. + * - ``MOP2(16)`` + - I1 + - | Porosity-permeability relationships for heterogeneous media: + | 0: No deterministic correlation + | 1: Material-specific empirical correlations (see subroutine *PER2POR*) + * - ``MOP2(17)`` + - I1 + - | Variables printed on *FOFT* files: + | 0: Print variables according to input data in block **FOFT** + | 1: Print variables according to input data in block **OUTPU** + * - ``MOP2(18)`` + - I1 + - (void) + * - ``MOP2(19)`` + - I1 + - (void) + * - ``MOP2(20)`` + - I1 + - | Reading anisotropic permeability modifiers in block **ELEME**: + | 0: Read isotropic permeability modifiers from columns 41-50 + | 1: Read anisotropic permeability modifiers from columns 81-110 + | 2: Read anisotropic permeability modifiers for ``ISOT`` = 1 from columns 41-50 and for ``ISOT`` = 2 and 3 from columns 91-110 + * - ``MOP2(21)`` + - I1 + - | Honoring generation times in blocks **TIMBC**: + | 0: Time stepping ignores times specified in block **TIMBC** + | >0: Time steps adjusted to match times in block **TIMBC** + * - ``MOP2(22)`` + - I1 + - | Format for reading coordinates in block **ELEME**: + | 0: Read coordinates in format 3E10.4 from columns 51-80 + | >0: Read coordinates in format 3E20.14 from columns 51-110 + * - ``MOP2(23)`` + - I1 + - (void) + * - ``MOP2(24)`` + - I1 + - (void) + * - ``MOP2(25)`` + - I1 + - | Check mesh for duplicate element names: + | 0: Do not check the mesh + | 1: Check the mesh + * - ``MOP2(26)`` + - I1 + - | Printout format: + | 0: Both traditional output and CSV formats + | 1: CSV/TECPLOT format (types separated; times combined) + | 2: CSV/TECPLOT format (types separated; times separated) + | 3: CSV/TECPLOT format (types combined; times combined) + * - ``MOP2(27)`` + - I1 + - | Element naming in MESHMAKER: + | 0: Traditional element naming scheme + | 1: Element name is equal to consecutive element number + + +OUTPU (optional) +**************** + +Permits the users to obtain printout of specified variables. +**OUTPU** specifications will supersede the default condition specified in ``KDATA`` in data block **PARAM**. +Block **OUTPU** must be specified after block **MULTI**. + +.. list-table:: Record **OUTPU.0**. + :name: tab:outpu.0 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``COUTFM`` + - A20 + - a keyword indicating the desired output format, currently either CSV, TECPLOT, or PETRASIM. + +.. list-table:: Record **OUTPU.1**. + :name: tab:outpu.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``MOUTVAR`` + - I5 + - number of variables to be printed out. + +.. list-table:: Record **OUTPU.2**. + :name: tab:outpu.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``COUTLN`` + - A20 + - name of variable, to be chosen among the available options. They include primary variables, secondary parameters, flow terms, and more. The name of variables is all capital letters, and should be typed in the input file as shown in :numref:`tab:8`. + * - ``ID1`` + - I5 + - first option for the corresponding keyword in ``COUTLN``, as shown in :numref:`tab:8`. + * - ``ID2`` + - I5 + - second option for the corresponding keyword in ``COUTLN``, as shown in :numref:`tab:8`. + +.. list-table:: Keywords of block **OUTPU** and related output variables. + :name: tab:8 + :widths: 3 1 1 4 1 + :header-rows: 1 + :align: center + + * - Keyword + - ID1 + - ID2 + - Output variable + - Header + * - SET + - ``ISET`` + - + - | Prints predefined sets of output variables: + | ``ISET`` = 1: Set of main element-related output variables + | ``ISET`` = 2: Set of main connection-related output variables + | ``ISET`` = 3: Set of main generation-related output variables + - + * - NO COMMA + - + - + - Omit commas between values + - + * - NO QUOTES + - + - + - Omit quotes around values + - + * - NO NAME + - + - + - Omit element names + - + * - | COORDINATE + | COORD + - ``NXYZ`` + - + - | Grid-block or connection coordinates; mesh dimension and orientation are automatically determined, or can be specified through variable ``NXYZ``: + | ``NXYZ`` = 1 : Mesh is 1D "X " + | ``NXYZ`` = 2 : Mesh is 1D " Y " + | ``NXYZ`` = 3 : Mesh is 1D " Z " + | ``NXYZ`` = 4 : Mesh is 2D "XY " + | ``NXYZ`` = 5 : Mesh is 2D "X Z" + | ``NXYZ`` = 6 : Mesh is 2D " YZ" + | ``NXYZ`` = 7 : Mesh is 3D "XYZ" + - + * - INDEX + - + - + - Index (running number) of elements, connections, or sinks/sources + - + * - | MATERIAL + | ROCK + | ROCK TYPE + - + - + - Material number + - ROCK + * - | MATERIAL NAME + | ROCK NAME + | ROCK TYPE NAME + - + - + - Material name + - ROCK + * - ABSOLUTE + - ``ISOT`` + - + - Absolute permeability in direction ``ISOT``; if ``ISOT`` = 0, permeabilities related to all three directions are printed + - ABS + * - POROSITY + - + - + - Porosity + - POR + * - TEMPERATURE + - + - + - Temperature + - TEMP + * - PRESSURE + - ``IPH``† + - + - Pressure of phase ``IPH`` + - PRES + * - SATURATION + - ``IPH``† + - + - Saturation of phase ``IPH`` + - SAT + * - RELATIVE + - ``IPH``† + - + - Relative permeability of phase ``IPH`` + - REL + * - VISCOSITY + - ``IPH``† + - + - Viscosity of phase ``IPH`` + - VIS + * - DENSITY + - ``IPH``† + - + - Density of phase ``IPH`` + - DEN + * - ENTHALPY + - ``IPH``† + - + - Enthalpy of phase ``IPH`` + - ENT + * - CAPILLARY + - ``IPH``† + - + - | Capillary pressure: + | if ``IPH`` = 1, difference between gas and aqueous phase pressures (for ECO2M, difference between gaseous CO\ :sub:`2` and aqueous phase pressures) + | if ``IPH`` = 2, difference between gas-NAPL phase pressures for TMVOC, and difference between gaseous and liquid CO\ :sub:`2` phase pressures for ECO2M + - PCAP + * - MASS FRACTION + - ``IPH`` + - ``IC`` + - Mass fraction of component ``IC`` in phase ``IPH`` + - X1, X2, ... + * - DIFFUSION1 + - ``IPH``† + - + - Diffusion parameter group 1 :math:`\left( \phi \tau_0 \tau_{\beta} \rho_{\beta} \right)` of phase :math:`\beta` = ``IPH`` + - DIFF1 + * - DIFFUSION2 + - ``IPH``† + - + - Diffusion parameter group 2 :math:`\left( \frac{P_0}{P} \left( \frac{T + 273.15}{273.15} \right)^{\theta} \right)` of phase :math:`\beta` = ``IPH`` + - DIFF2 + * - PSAT + - + - + - Saturated vapor pressure + - PSAT + * - BIOMASS + - + - + - Biomass concentration + - BIO + * - PRIMARY + - ``IPV`` + - + - Primary variable No. ``IPV``; if ``IPV`` = 0, all ``NK`` + 1 primary variables are printed + - + * - SECONDARY + - ``IPH``† + - ``ISP`` + - | Secondary parameter No. ``ISP`` related to phase ``IPH``, where + | ``ISP`` = 0: All secondary parameters + | ``ISP`` = 1: Phase saturation + | ``ISP`` = 2: Relative permeability + | ``ISP`` = 3: Viscosity + | ``ISP`` = 4: Density + | ``ISP`` = 5: Enthalpy + | ``ISP`` = 6: Capillary pressure + | ``ISP`` = 7: Diffusion parameter group 1 + | ``ISP`` = 8: Diffusion parameter group 2 + - + * - | TOTAL FLOW + | TOTAL FLOW RATE + - + - + - Total flow rate + - FLOW + * - | FLOW + | RATE + | FLOW RATE + - ``IPH`` + - ``IC`` + - | Advective flow rate: + | ``IPH`` = 0; ``IC`` = 0: Total flow + | ``IPH`` > 0; ``IC`` = 0: Flow of phase ``IPH`` + | ``IPH`` < 0; ``IC`` = 0: Flow of each phase + | ``IPH`` > 0; ``IC`` > 0: Flow of component ``IC`` in phase ``IPV`` + | ``IPH`` > 0; ``IC`` < 0: The flow of each component in phase ``IPH`` + - FLOW + * - DIFFUSIVE FLOW + - ``IPH`` + - ``IC`` + - | Diffusive flow rate: + | ``IPH`` = 0; ``IC`` = 0: Total flow + | ``IPH`` > 0; ``IC`` = 0: Flow of phase ``IPH`` + | ``IPH`` < 0; ``IC`` = 0: Flow of each phase + | ``IPH`` > 0; ``IC`` > 0: Flow of component ``IC`` in phase ``IPH`` + | ``IPH`` > 0; ``IC`` < 0: The flow of each component in phase ``IPH`` + - FDIFF + * - HEAT FLOW + - + - + - Heat flow rate + - HEAT + * - VELOCITY + - ``IPH``† + - + - Flow velocity of phase ``IPH`` + - VEL + * - | GENERATION + | GENERATION RATE + - + - + - Production or injection rate + - GEN + * - FLOWING ENTHALPY + - + - + - Flowing enthalpy + - ENTG + * - WELLBORE PRESSURE + - + - + - Wellbore pressure (wells on deliverability only) + - PWB + +.. note:: + + † If ``IPH`` = 0, the output variables of all phases are printed. + + +ENDCY +***** + +Closes the TOUGH3 input file and initiates the simulation. + + +.. _geometry_data: + +Geometry Data +------------- + +General concepts +**************** + +Flow geometry in TOUGH3 is defined by means of a list of volume elements ("grid blocks") and a list of flow connections between them, as in other "integral finite difference" codes (:cite:label:`narasimhan1976integrated`). +This formulation can handle regular and irregular flow geometries in one, two, and three dimensions. +Single- and multiple-porosity systems (porous and fractured media) can be specified, and higher-order methods, such as seven- and nine-point differencing, can be implemented by means of appropriate specification of geometric data (:cite:label:`pruess1983seven`). + +In TOUGH3, volume elements are identified by names that consist of a string of by default five characters, ``12345``, unless a different length of element names is specified in data block +MOMOP (``MOP2(2)`` > 5). +These are arbitrary, except that the last two characters (#4 and 5) must be numbers if grids are generated using ``NSEQ`` in data block **ELEME** and **CONNE**; an example of a valid element name is "``ELE10``". +Flow connections are specified as ordered pairs of elements, such as "(``ELE10``, ``ELE11``)". +A variety of options and facilities are available for entering and processing geometric data (see :numref:`fig:8`). +Element volumes and domain identification can be provided by means of a data block **ELEME** in the input file, while a data block **CONNE** can be used to supply connection data, including interface area, nodal distances from the interface, and orientation of the nodal line relative to the vertical. +These data are internally written to a disk file *MESH*, which in turn initializes the geometry data arrays used during the flow simulation. +It is also possible to omit the **ELEME** and **CONNE** data blocks from the input file, and provide geometry data directly on a disk file *MESH*. + +.. figure:: ../figures/figure_8.png + :name: fig:8 + :align: center + :width: 75% + + User options for supplying geometry data. + + +Meshmaker +********* + +TOUGH3 offers an additional way for defining flow system geometry by means of a special program module MESHMaker. +This can perform a number of mesh generation and processing operations and is invoked with the keyword **MESHM** in the input file (see :numref:`fig:9`). +The MESHMaker module has a modular structure. +At the present time, there are three sub-modules available in MESHMaker: keywords RZ2D or RZ2DL invoke generation of a one or two-dimensional radially symmetric R-Z mesh; XYZ initiates generation of a one, two, or three dimensional Cartesian X-Y-Z mesh; and MINC calls a modified version of the *GMINC* program (:cite:label:`pruess1983gminc`) to sub-partition a primary porous medium mesh into a secondary mesh for fractured media, using the method of "multiple interacting continua" (:cite:label:`pruess1985practical`), which will be described in detail below. + +Several naming conventions for the elements created with keywords RZ2D (or RZ2DL) and XYZ have been adopted in the internal mesh generation process. +In addition to the traditional TOUGH2 conventions, the other conventions are adopted to accommodate large numbers of grid blocks in cases with ``MOP2(2)`` > 5 or ``MOP2(27)`` > 0. +Both RZ2D and XYZ assign all grid blocks to domain #1 (first entry in block **ROCKS**); a user desiring changes in domain assignments must do so by hand, either through editing of the *MESH* file with a text editor, or by means of preprocessing with an appropriate utility program, or by appropriate source code changes in subroutines *WRZ2D* and *GXYZ*. +TOUGH3 runs that involve RZ2D or XYZ mesh generation will produce a special printout, showing element names arranged in their actual geometric pattern. + +The naming conventions for the MINC process are as follows. +For a primary grid block with name ``12345``, the corresponding fracture subelement in the secondary mesh is named ``12345`` (character #1 replaced with a blank for easy recognition). +The successive matrix continua are labeled by running character #1 through 2, ..., 9, A, B, ..., Z. +The domain assignment is incremented by 1 for the fracture grid blocks, and by 2 for the matrix grid blocks. +Thus, domain assignments in data block **ROCKS** should be provided in the following order: the first entry is the single (effective) porous medium, then follows the effective fracture continuum, and then the rock matrix. +Users should be aware that the MINC process may lead to ambiguous element names when the inactive element device is used to keep a portion of the primary mesh as unprocessed porous medium. +Also, the MINC process may generate duplicate element names. TOUGH3 will check the element names after reading disk file *MESH*, and abort the simulation if duplicate element names are found. + +.. figure:: ../figures/figure_9.png + :name: fig:9 + :align: center + :width: 75% + + MESHMaker input formats. + +As a convenience for users desiring graphical display of data, the internal mesh generation process will also write nodal point coordinates on file MESH. +By default these data are written in 3E10.4 format into columns 51-80 of each grid block entry in data block **ELEME**, unless a longer effective digit of 3E20.14 format into columns 51-110 is specified in data block **MOMOP** (``MOP2(22)`` > 0). +No internal use is made of nodal point coordinates in TOUGH3, except for optional initialization of a gravity-capillary equilibrium with EOS9 (see the addendum for EOS9) and for optional addition of potential energy to enthalpy with ``MOP2(12)`` > 0 in data block **MOMOP**. + +Mesh generation and/or MINC processing can be performed as part of a simulation run. +Alternatively, by closing the input file with the keyword **ENDFI** (instead of **ENDCY**), it is possible +to skip the flow simulation and only execute the MESHMaker module to generate a *MESH* or *MINC* file. +These files can then be used, with additional user-modifications by hand if desired, in subsequent flow simulations. +Execution of MESHMaker produces printed output which is self-explanatory. + + +Multiple-porosity processing +**************************** + +Multiple-porosity processing for simulation of flow in naturally fractured reservoirs can be invoked by means of a keyword MINC, which stands for "multiple interacting continua" (:cite:label:`pruess1985practical`). +The MINC-process operates on the data of the primary (porous medium) mesh as provided on disk file *MESH*, and generates a "secondary" mesh containing fracture and matrix elements with identical data formats on file *MINC*. +By appropriate subgridding of the matrix blocks, as shown in :numref:`fig:10`, and therefore by resolving the driving pressure, temperature, and mass fraction gradients at the matrix and fracture interface, the transient, multiphase interporosity flows between rock matrix and fractures can accurately be described. +The MINC concept is based on the notion that changes in fluid pressures, temperatures, phase compositions, etc, due to the presence of sinks and sources (production and injection wells) will propagate rapidly through the fracture system, while invading the tight matrix blocks only slowly. +Therefore, changes in matrix conditions will (locally) be controlled by the distance from the fractures. +Fluid and heat flow from the fractures into the matrix blocks, or from the matrix blocks into the fractures, can then be modeled by means of one-dimensional strings of nested grid blocks, as shown in :numref:`fig:10`. +The MINC-method lumps all fractions within a certain reservoir subdomain into continuum #1, all matrix material within a certain distance from the fractures into continuum #2, matrix material at larger distance into continuum #3, and so on. +Quantitatively, the subgridding is specified by means of a set of volume fractions, into which the primary porous medium grid blocks are partitioned. +The MINC-process in the MESHMaker module operates on the element and connection data of a porous medium mesh to calculate, for given data on volume fractions, the volumes, interface areas, and nodal distances for a secondary fractured medium mesh. +The information on fracturing (spacing, number of sets, shape of matrix blocks) required for this is provided by a "proximity function" PROX(x) which expresses, for a given reservoir domain :math:`V_0`, the total fraction of matrix material within a distance :math:`x` from the fractures. +If only two continua are specified (one for fractures, one for matrix), the MINC approach reduces to the conventional double-porosity method (:cite:label:`warren1963behavior`). +Full details are given in a separate report (:cite:label:`pruess1983gminc`). +For any given fractured reservoir flow problem, selection of the most appropriate gridding scheme must be based on a careful consideration of the physical and geometric conditions of flow. +The MINC approach is not applicable to systems in which fracturing is so sparse that the fractures cannot be approximated as a continuum. + +.. figure:: ../figures/figure_10.png + :name: fig:10 + :align: center + :width: 75% + + Subgridding in the method of "multiple interacting continua" (MINC). + +The file *MESH* used in this process can be either directly supplied by the user, or it can have been internally generated either from data in input blocks **ELEME** and **CONNE**, or from RZ2D or XYZ mesh- making. +The MINC process of sub-partitioning porous medium grid blocks into fracture and matrix continua will only operate on active grid blocks, while inactive grid blocks are left unchanged as single porous medium blocks. +In TOUGH3, elements in data block **ELEME** (or file *MESH*) are taken to be "active" unless they have very large volumes, which are taken to be "inactive". +In order to exclude selected reservoir domains from the MINC process and make them remain single porous media, the user needs to change the volume of the corresponding blocks to a very large number before MINC partitioning is made. +Note that here the concept of inactive blocks is used in an unrelated manner with respect to the one to maintain time-independent Dirichlet boundary conditions (see Section :ref:`initial_and_boundary_conditions`). + + +.. _input_formats_for_meshmaker: + +Input Formats for MESHMAKER +--------------------------- + +Generation of radially symmetric grid +************************************* + +Keyword RZ2D (or RZ2DL) invokes generation of a radially symmetric mesh. +Nodal points will be placed half-way between neighboring radial interfaces. +When RZ2D is specified, the mesh will be generated by columns; i.e., in the **ELEME** block we will first have the grid blocks at +smallest radius for all layers, then the next largest radius for all layers, and so on. +With keyword RZ2DL the mesh will be generated by layers; i.e., in the **ELEME** block we will first have all grid blocks for the first (top) layer from smallest to largest radius, then all grid blocks for the second layer, and so on. +Apart from the different ordering of elements, the two meshes for RZ2D and RZ2DL are identical. +The reason for providing the two alternatives is as a convenience to users in implementing boundary conditions by way of inactive elements (see Section :ref:`initial_and_boundary_conditions`). +RZ2D makes it easy to declare a vertical column inactive, facilitating assignment of boundary conditions in the vertical, such as a gravitationally equilibrated pressure gradient. +RZ2DL on the other hand facilitates implementation of areal (top and bottom layer) boundary conditions. + + +RADII +^^^^^ + +RADII is the first keyword following RZ2D; it introduces data for defining a set of interfaces (grid block boundaries) in the radial direction. + +.. list-table:: Record **RADII.1**. + :name: tab:radii.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``NRAD`` + - I5 + - number of radius data that will be read. At least one radius must be provided, indicating the inner boundary of the mesh. + +.. list-table:: Record **RADII.2**. + :name: tab:radii.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``RC(I)`` + - E10.4 + - ``I`` = 1, ``NRAD`` radii in ascending order. + + +EQUID +^^^^^ + +Introduces data on a set of equal radial increments. + +.. list-table:: Record **EQUID.1**. + :name: tab:equid.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``NEQU`` + - I5 + - number of desired radial increments. + * - + - 5X + - (void) + * - ``DR`` + - E10.4 + - number of desired radial increments. + +Note that at least one radius must have been defined via block RADII before EQUID can be invoked. + + +LOGAR +^^^^^ + +Introduces data on radial increments that increase from one to the next by the same factor (:math:`\Delta R_{n + 1} = f \cdot \Delta R_n`). + +.. list-table:: Record **LOGAR.1**. + :name: tab:logar.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``NLOG`` + - I5 + - number of additional interface radii desired. + * - + - 5X + - (void) + * - ``RLOG`` + - E10.4 + - desired radius of the last (largest) of these radii. + * - ``DR`` + - E10.4 + - reference radial increment: the first :math:`\Delta R` generated will be equal to f × ``DR``, with f internally determined such that the last increment will bring total radius to ``RLOG``. f < 1 for decreasing radial increments is permissible. If ``DR`` is set equal to zero, or left blank, the last increment ``DR`` generated before keyword LOGAR will be used as default. + +Additional blocks RADII, EQUID, and LOGAR can be specified in arbitrary order. +Note that at least one radius must have been defined before LOGAR can be invoked. +If ``DR`` = 0, at least two radii must have been defined. + + +LAYER +^^^^^ + +Introduces information on horizontal layers, and signals closure of RZ2D input data. + +.. list-table:: Record **LAYER.1**. + :name: tab:layer.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``NLAY`` + - I5 + - number of horizontal grid layers. + +.. list-table:: Record **LAYER.2**. + :name: tab:layer.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``H(I)`` + - E10.4 + - ``I`` = 1, ``NLAY`` layer thicknesses, from top layer downward. By default, zero or blank entries for layer thickness will result in assignment of the last preceding non-zero entry. Assignment of a zero layer thickness, as needed for inactive layers, can be accomplished by specifying a negative value. + +The LAYER data close the RZ2D data block. +Note that one blank record must follow to indicate termination of the **MESHM** data block. +Alternatively, keyword MINC can appear to invoke MINC-processing for fractured media (see below). + + +Generation of rectilinear grids +******************************* + +XYZ +^^^ + +Invokes generation of a Cartesian (rectilinear) mesh. + +.. list-table:: Record **XYZ.1**. + :name: tab:xyz.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``DEG`` + - E10.4 + - angle (in degrees) between the Y-axis and the horizontal. If gravitational acceleration (parameter ``GF`` in record **PARAM.2**) is specified positive, -90° < ``DEG`` < 90° corresponds to grid layers going from top down. Grids can be specified from bottom layer up by setting ``GF`` or ``BETA`` negative. Default (``DEG`` = 0) corresponds to horizontal Y- and vertical Z-axis. X-axis is always horizontal. + +.. list-table:: Record **XYZ.2**. + :name: tab:xyz.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``NTYPE`` + - A2 + - set equal to NX, NY or NZ for specifying grid increments in X, Y, or Z direction. + * - + - 3X + - (void) + * - ``NO`` + - I5 + - number of grid increments desired. + * - ``DEL`` + - E10.4 + - constant grid increment for ``NO`` grid blocks, if set to a non-zero value. + +.. list-table:: Record **XYZ.3**. + :name: tab:xyz.3 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``DEL(I)`` + - E10.4 + - ``I`` = 1, ``NO`` grid increments in the direction specified by ``NTYPE`` in record XYZ.2. Additional records with formats as XYZ.2 and XYZ.3 can be provided, with X, Y, and Z-data in arbitrary order. + +A blank record closes the XYZ data block. + +Note that the end of block MESHMaker is also marked by a blank record. +Thus, when MESHMaker/XYZ is used, there will be two blank records at the end of the corresponding input data block. + + +MINC processing for fractured media +*********************************** + +MINC +^^^^ +Invokes postprocessing of a primary porous medium mesh from file MESH. +The input formats in data block MINC are identical to those of the *GMINC* program (:cite:label:`pruess1983gminc`), with two enhancements: there is an additional facility for specifying global matrix-matrix connections ("dual permeability"); further, only active elements will be subjected to MINC-processing, the remainder of the MESH remaining unaltered as porous medium grid blocks. + + +PART +^^^^ + +PART is the first keyword following MINC; it will be followed on the same line by parameters ``TYPE`` and ``DUAL`` with information on the nature of fracture distributions and matrix-matrix connections. + +.. list-table:: Record **PART.1**. + :name: tab:part.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``PART`` + - A5 + - identifier of data block with partitioning parameters for secondary mesh. + * - ``TYPE`` + - A5 + - | a five-character word for selecting one of the six different proximity functions provided in MINC (:cite:label:`pruess1983gminc`): + | ONE-D: a set of plane parallel infinite fractures with matrix block thickness between neighboring fractures equal to ``PAR(1)``. + | TWO-D: two sets of plane parallel infinite fractures, with arbitrary angle between them. Matrix block thickness is ``PAR(1)`` for the first set, and ``PAR(2)`` for the second set. If ``PAR(2)`` is not specified explicitly, it will be set equal to ``PAR(1)``. + | THRED: three sets of plane parallel infinite fractures at right angles, with matrix block dimensions of ``PAR(1)``, ``PAR(2)``, and ``PAR(3)``, respectively. If ``PAR(2)`` and/or ``PAR(3)`` are not explicitly specified, they will be set equal to ``PAR(1)`` and/or ``PAR(2)``, respectively. + | STANA: average proximity function for rock loading of Stanford large reservoir model (:cite:label:`lam1988analysis`). + | STANB: proximity function for the five bottom layers of Stanford large reservoir model. + | STANT: proximity function for top layer of Stanford large reservoir model. + | + | Note: a user wishing to employ a different proximity function than provided in MINC needs to replace the function subprogram PROX(x) in file *Mesh_Maker.f90* with a routine of the form: + + .. code-block:: fortran + + FUNCTION PROX(x) + PROX = (arithmetic expression in x) + RETURN + END + + | It is necessary that PROX(x) is defined even when x exceeds the maximum possible distance from the fractures, and that PROX = 1 in this case. Also, when the user supplies his/her own proximity function subprogram, the parameter ``TYPE`` has to be chosen equal to ONE-D, TWO-D, or THRED, depending on the dimensionality of the proximity function. This will assure proper definition of innermost nodal distance (:cite:label:`pruess1983gminc`). + * - + - 5X + - (void) + * - ``DUAL`` + - A5 + - | a five-character word for selecting the treatment of global matrix matrix flow: + | blank: (default) global flow occurs only through the fracture continuum, while rock matrix and fractures interact locally by means of interporosity flow ("double-porosity" model). + | MMVER: global matrix-matrix flow is permitted only in the vertical; otherwise like the double-porosity model; for internal consistency this choice should only be made for flow systems with one or two predominantly vertical fracture sets. + | MMALL: global matrix-matrix flow in all directions; for internal consistency only two continua, representing matrix and fractures, should be specified ("dual-permeability"). + +.. list-table:: Record **PART.2**. + :name: tab:part.2 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``J`` + - I3 + - total number of multiple interacting continua. + * - ``NVOL`` + - I3 + - total number of explicitly provided volume fractions (``NVOL`` < J). If ``NVOL`` < J, the volume fractions with indices ``NVOL`` + 1, ..., ``J`` will be internally generated; all being equal and chosen such as to yield proper normalization to 1. + * - ``WHERE`` + - A4 + - specifies whether the sequentially specified volume fractions begin with the fractures (``WHERE`` = OUT) or in the interior of the matrix blocks (``WHERE`` = IN). + * - ``PAR(I)`` + - E10.4 + - ``I`` = 1, 7 holds parameters for fracture spacing (see above). + +.. list-table:: Record **PART.2.1**. + :name: tab:part.2.1 + :widths: 1 1 6 + :header-rows: 1 + :align: center + + * - Parameter + - Format + - Description + * - ``VOL(I)`` + - E10.4 + - ``I`` = 1, ``NVOL`` volume fraction (between 0 and 1) of continuum with index ``I`` (for ``WHERE`` = OUT) or index ``J`` + 1 - ``I`` (for ``WHERE`` = IN). ``NVOL`` volume fractions will be read. For ``WHERE`` = OUT , ``I`` = 1 is the fracture continuum, ``I`` = 2 is the matrix continuum closest to the fractures, ``I`` = 3 is the matrix continuum adjacent to ``I`` = 2, etc. The sum of all volume fractions must not exceed 1. diff --git a/doc/source/tough3/guide/relative_permeability_functions.rst b/doc/source/tough3/guide/relative_permeability_functions.rst new file mode 100644 index 00000000..79bcdcc0 --- /dev/null +++ b/doc/source/tough3/guide/relative_permeability_functions.rst @@ -0,0 +1,562 @@ +.. _relative_permeabilty_functions: + +Relative Permeability Functions +=============================== + +TOUGH3 provides several relative permeability functions for two-phase or three-phase flow problems. +The original TOUGH2 two-phase functions have been retained (from ``IRP`` = 1 to ``IRP`` = 8). +The modified Brooks-Corey and van Genuchten models and two versions of the hysteresis model (regular and simple) are implemented (``IRP`` = 10, 11, 12, and 13). +The three-phase functions from TMVOC and ECO2M start at ``IRP`` = 31. +For TMVOC, if one of the two-phase functions is chosen, the NAPL relative permeability is assumed to be zero. +For ECO2M, the two-phase functions are only applicable when an aqueous phase and a single CO\ :sub:`2`-rich phase are present. +If one of the two-phase functions is chosen, the relative permeability of the CO\ :sub:`2`-rich phase will be the same function of saturation, regardless whether the CO\ :sub:`2`-rich phase is liquid or gas. +The notation used below is: + +- :math:`k_{rl}`: aqueous phase relative permeability +- :math:`k_{rg}`: gas (for all two-phase EOSs and TMVOC) or gaseous CO\ :sub:`2` (for ECO2M) phase relative permeability +- :math:`k_{rn}`: NAPL (for TMVOC) or liquid CO\ :sub:`2` (for ECO2M) phase relative permeability +- :math:`S_l`, :math:`S_g`, and :math:`S_n` are the saturations of aqueous, gas (or gaseous COCO\ :sub:`2`) and NAPL (or liquid CO\ :sub:`2`) phases, respectively + + +Linear Functions (IRP=1) +------------------------ + +| :math:`k_{rl}` increases linearly from 0 to 1 in range :math:`RP(1) \le S_l \le RP(3)` +| :math:`k_{rg}` increases linearly from 0 to 1 in range :math:`RP(2) \le S_l \le RP(4)` +| Restrictions: :math:`RP(3) \gt RP(1)`, :math:`RP(4) \gt RP(2)` + +If :math:`RP(5) \gt 0`, :math:`k_{rn}` increases linearly from 0 to 1 in the range :math:`RP(1) \le S_n \le RP(3)` + +| If :math:`RP(5) \gt 0` and :math:`RP(6) \gt 0`, :math:`k_{rn}` increases linearly from 0 to 1 in the range :math:`RP(5) \le S_n \le RP(6)` +| Restrictions: :math:`RP(6) \lt RP(5)` + + +IRP=2 +----- + +.. math:: + + k_{rl} = S_l^{RP(1)} + +.. math:: + + k_{rg} = 1 + + +Corey's Curves (IRP=3) +---------------------- + +After :cite:label:`corey1954interrelation`. + +.. math:: + + k_{rl} = \hat{S}^4 + +.. math:: + + k_{rg} = \left( 1 - \hat{S} \right)^2 \left( 1 - \hat{S}^2 \right)^2 + + +where :math:`\hat{S} = \frac{S_l - S_{lr}}{1 - S_{lr} - S_{gr}}`. + +Parameters: + +- :math:`RP(1) = S_{lr}` +- :math:`RP(2) = S_{gr}` + +Restrictions: :math:`RP(1) + RP(2) \lt 1` + + +Grant's Curves (IRP=4) +---------------------- + +After :cite:label:`grant1977permeability`. + +.. math:: + + k_{rl} = \hat{S}^4 + +.. math:: + + k_{rg} = 1 - k_{rl} + +Parameters: + +- :math:`RP(1) = S_{lr}` +- :math:`RP(2) = S_{gr}` + +Restrictions: :math:`RP(1) + RP(2) \lt 1` + + +All Phases Perfectly Mobile (IRP=5) +----------------------------------- + +:math:`k_{rg} = k_{rg} = 1` for all saturations. + +No parameters. + + +Functions of Fatt and Klikoff (IRP=6) +------------------------------------- + +After :cite:label:`fatt1959effect`. + +.. math:: + + k_{rl} = \left( S^\ast \right)^3 + +.. math:: + + k_{rg} = \left( 1 - S^\ast \right)^3 + +where :math:`S^\ast = \frac{S_l - S_{lr}}{1 - S_{lr}}`. + +Parameters: + +- :math:`RP(1) = S_{lr}` + +Restriction: :math:`RP(1) \lt 1` + + +van Genuchten-Mualem Model (IRP=7) +---------------------------------- + +After :cite:label:`mualem1976new` and van :cite:label:`van1980closed`. + +.. math:: + + k_{rl} = + \begin{cases} + \sqrt{S^\ast} \left( 1 - \left( 1 - \left( S^\ast \right)^{\frac{1}{\lambda}} \right)^{\lambda} \right)^2 & \text{if $S_l \lt S_{ls}$} \\ + 1 & \text{if $S_l \ge S_{ls}$} \\ + \end{cases} + +Gas relative permeability can be chosen as one of the following two forms, the second of which is due to :cite:label:`corey1954interrelation`. + +.. math:: + + k_{rg} = + \begin{cases} + 1 - k_{rl} & \text{if $S_{gr} = 0$} \\ + \left( 1 - \hat{S} \right)^2 \left( 1 - \hat{S}^2 \right) & \text{if $S_{gr} \gt 0$} \\ + \end{cases} + +subject to the restriction :math:`0 \le k_{rl}`, :math:`k_{rg} \le 1`. + +Here, + +.. math:: + + S^\ast = \frac{S_l - S_{lr}}{S_{ls} - S_{lr}} + +.. math:: + + \hat{S} = \frac{S_l - S_{lr}}{1 - S_{lr} - S_{gr}} + +Parameters: + +- :math:`RP(1) = \lambda` +- :math:`RP(2) = S_{lr}` +- :math:`RP(3) = S_{ls}` +- :math:`RP(4) = S_{gr}` + +.. note:: + + Parameter :math:`\lambda` is :math:`m` in van Genuchten's notation, with :math:`m = 1 - \frac{1}{n}`; parameter :math:`n` is often written as :math:`\beta`. + + +Functions of Verma et al. (IRP=8) +--------------------------------- + +After :cite:label:`verma1985study`. + +.. math:: + + k_{rl} = \hat{S}^3 + +.. math:: + + k_{rg} = A + B \hat{S} + C \hat{S}^2 + +where :math:`\hat{S} = \frac{S_l - S_{lr}}{S_{ls} - S_{lr}}` + +Parameters as measured by Verma et al. (1985) for steam-water flow in an unconsolidated sand: + +Parameters: + +- :math:`RP(1) = S_{lr} = 0.2` +- :math:`RP(2) = S_{ls} = 0.895` +- :math:`RP(3) = A = 1.259` +- :math:`RP(4) = B = -1.7615` +- :math:`RP(5) = C = 0.5089` + + +Modified Brooks-Corey Model (IRP=10) +------------------------------------ + +A modified version of the Brooks-Corey model (:cite:label:`luckner1989consistent`) has been implemented to prevent the capillary pressure from decreasing towards negative infinity as the effective saturation approaches zero. +The modified Brooks-Corey model is invoked by setting both ``IRP`` and ``ICP`` to 10. + +.. math:: + + k_{rl} = S_{ek}^{\frac{2 + \lambda}{\lambda}} + +.. math:: + + k_{rg} = + \begin{cases} + \left( 1 - S_{ek} \right)^2 \left( 1 - S_{ek}^{\frac{2 + \lambda}{\lambda}} \right) & \text{if $RP(3) = 0$} \\ + 1 - k_{rl} & \text{if $RP(3) \ne 0$} \\ + \end{cases} + +where + +.. math:: + + S_{ek} = \frac{S_l - S_{lrk}}{1 - S_{lrk} - S_{gr}} + +Parameters: + +- :math:`RP(1) = S_{lrk}` +- :math:`RP(2) = S_{gr}` +- :math:`RP(3) =` flag to indicate which equation is used for :math:`k_{rg}` + + +Modified van Genuchten Model (IRP=11) +------------------------------------- + +A modified version of the van Genuchten model (:cite:label:`luckner1989consistent`) has been implemented to prevent the capillary pressure from decreasing towards negative infinity as the effective saturation approaches zero. +The modified van Genuchten model is invoked by setting both ``IRP`` and ``ICP`` to 11. + +.. math:: + + k_{rl} = S_{ekl}^{\gamma} S_{ekl}^{\left( 1 - \gamma \right) \eta} \left( 1 - \left( 1 - S_{ekl}^{\frac{1 - \gamma}{m}} \right)^m \right)^2 + +.. math:: + + k_{rg} = + \begin{cases} + \left( 1 - S_{ekg} \right)^{\zeta} \left( 1 - S_{ekg}^{\frac{1}{m}} \right)^{2m} & \text{if $RP(3) = 0$} \\ + 1 - k_{rl} & \text{if $RP(3) \ne 0$} \\ + \end{cases} + +where + +.. math:: + + S_{ekl} = \frac{S_l - S_{lrk}}{1 - S_{lrk}} + +.. math:: + + S_{ekg} = \frac{S_l}{1 - S_{gr}} + +Parameters: + +- :math:`RP(1) = S_{lrk}`, if negative, :math:`S_{lrk} = 0` for calculating :math:`k_{rg}`, and absolute value is used for calculating :math:`k_{rl}` +- :math:`RP(2) = S_{gr}`, if negative, :math:`S_{gr} = 0` for calculating :math:`k_{rl}`, and absolute value is used for calculating :math:`k_{rg}` +- :math:`RP(3) =` flag to indicate which equation is used for :math:`k_{rg}` +- :math:`RP(4) = \eta` (default = 1/2) +- :math:`RP(5) = \varepsilon_k`, use linear function between :math:`k_{rl}` (:math:`S_e = 1 - \varepsilon_k`) and 1.0 +- :math:`RP(6) = a_{fm}`, constant fracture-matrix interaction reduction factor, in combination with Active Fracture Model +- :math:`RP(7) = \zeta` (default = 1/3) + + +Regular Hysteresis (IRP=12) +--------------------------- + +The hysteretic form of the van Genuchten model (:cite:label:`parker1987model, lenhard1987model`) has been implemented. +Details of the implementation are described in :cite:label:`doughty2013user`. +The regular hysteresis model is invoked by setting both ``IRP`` and ``ICP`` to 12. + +.. math:: + + k_{rl} = \sqrt{\bar{S}_l} \left( 1 - \left( 1 - \frac{\bar{S}_{gt}}{1 - \bar{S}_l^{\Delta}} \right) \left( 1 - \left( \bar{S}_l + \bar{S}_{gt} \right)^{\frac{1}{m}}\right)^m - \frac{\bar{S}_{gt}}{1 - \bar{S}_l^{\Delta}} \left( 1 - \left( \bar{S}_l^{\Delta} \right)^{\frac{1}{m}} \right)^m \right)^2 + +.. math:: + + k_{rg} = k_{rgmax} \left( 1 - \left( \bar{S}_l + \bar{S}_{gt} \right) \right)^{\gamma} \left( 1 - \left( \bar{S}_l + \bar{S}_{gt} \right)^{\frac{1}{m}} \right)^{2m} + +where + +.. math:: + + \bar{S}_l = \frac{S_l - S_{lr}}{1 - S_{lr}} + +.. math:: + + \bar{S}_l^{\Delta} = \frac{S_l^{\Delta} - S_{lr}}{1 - S_{lr}} + +.. math:: + + \bar{S}_{gt} = \frac{S_{gr}^{\Delta} \left( S_l - S_l^{\Delta} \right)}{\left( 1 - S_{lr} \right) \left( 1 - S_l^{\Delta} - S_{gr}^{\Delta} \right)} + +.. math:: + + S_{gr}^{\Delta} = \frac{1}{\frac{1}{1 - S_l^{\Delta}} + \frac{1}{S_{gr, max}} - \frac{1}{1 - S_{lr}}} + +:math:`S_l^{\Delta}` is the turning-point saturation, and :math:`S_{gr}^{\Delta}` is the residual gas saturation. + +Parameters: + +- :math:`RP(1) = m`, van Genuchten :math:`m` for liquid relative permeability (need not equal :math:`CP(1)` or :math:`CP(6)); :math:`k_{rl}` uses the same :math:`m` for drainage and imbibition. +- :math:`RP(2) = S_{lr}`, :math:`k_{rl} (S_{lr}) = 0`, :math:`k_{rg} (S_{lr}) = k_{rgmax}`. Must have :math:`S_{lr} \gt S_{lmin}` in capillary pressure (:math:`CP(2)). :math:`S_{lr}` is minimum saturation for transition to imbibition branch. For :math:`S_l \lt S_{lr}`, curve stays on primary drainage branch even if :math:`S_l` increases. +- :math:`RP(3) = S_{grmax}`, maximum possible value of :math:`S_{gr}^{\Delta}`. Note that the present version of the code requires that :math:`S_{lr} + S_{grmax} \lt 1`, otherwise there will be saturations for which neither fluid phase is mobile, which the code cannot handle. Setting :math:`S_{grmax} = 0` effectively turns off hysteresis. As a special option, a constant, non-zero value of Sgr may be employed by setting :math:`CP(10) \gt 1` and making :math:`RP(3)` negative. The code will set :math:`S_{gr}^{\Delta}` = :math:`-RP(3)` for all grid blocks at all times. +- :math:`RP(4) = \gamma`, typical values 0.33 - 0.50 +- :math:`RP(5) = k_{rgmax}` +- :math:`RP(6) =` fitting parameter for :math:`k_{rg}` extension for :math:`S_l \lt S_{lr}` (only used when :math:`k_{rgmax} \lt 1`); determines type of function for extension and slope of :math:`k_{rg}` at :math:`S_l = 0`: + + - ≤0: use cubic spline for :math:`0 \lt S_l \lt S_{lr}`, with slope at :math:`S_l = 0` of :math:`RP(6)` + - >0: use linear segment for :math:`0 \lt S_l \lt RP(8) S_{lr}` and cubic spline for :math:`RP(8) S_{lr} \lt S_l \lt S_{lr}`, with slope at :math:`S_l = 0` of :math:`-RP(6)`. + +- :math:`RP(7) =` numerical factor used for :math:`k_{rl}` extension to :math:`S_l \gt S_l^\ast`. :math:`RP(7)` is the fraction of :math:`S_l^\ast` at which :math:`k_{rl}` curve departs from the original van Genuchten function. Recommended range of values: 0.95-0.97. For :math:`RP(7) = 0`, :math:`k_{rl} = 1` for :math:`S_l \gt S_l^\ast` (not recommended). +- :math:`RP(8) =` numerical factor used for linear :math:`k_{rg}` extension to :math:`S_l \lt S_{lr}` (only used when :math:`k_{rgmax} \lt 1`). :math:`RP(8)` is the fraction of :math:`S_{lr}` at which the linear and cubic parts of the extensions are joined. +- :math:`RP(9) =` flag to turn off hysteresis for :math:`k_{rl}` (no effect on :math:`P_c` and :math:`k_{rg}`; to turn off hysteresis entirely, set :math:`S_{grmax} = 0` in :math:`RP(3)`). + + - 0: hysteresis is on for :math:`k_{rl}` + - 1: hysteresis is off for :math:`k_{rl}` (force :math:`k_{rl}` to stay on primary drainage branch (:math:`k_{rl}^d`) at all times) + +- :math:`RP(10) = m_{gas}`, van Genuchten m for gas relative permeability (need not equal :math:`CP(1)` or :math:`CP(6)`); :math:`k_{rg}` uses same :math:`m_{gas}` for drainage and imbibition. If zero or blank, use :math:`RP(1)` so that :math:`m_{gas} = m`. + + +Simple Hysteresis (IRP=13) +-------------------------- + +The regular hysteresis option (``IRP`` = ``ICP`` = 12) provides a rigorous representation of hysteretic relative permeability and capillary pressure curves. +However, it can significantly slow down TOUGH3 simulations, because small time steps are often required at turning points, when a grid block switches between drainage and imbibition, because the slopes of the characteristic curves are discontinuous. +Moreover, several control parameters are needed, which generally must be determined by trial and error, for the code to run smoothly. +An alternative means of capturing the essence of hysteresis, while maintaining continuous slopes and requiring no additional control parameters, is the simple hysteresis algorithm of :cite:label:`patterson2012simple`, which is invoked with ``IRP`` = ``ICP`` = 13. +Presently this option is only available when ECO2N is being used. + +The :cite:label:`mualem1976new` relative permeability model is used for the non-wetting phase: + +.. math:: + + k_{rn} = \sqrt{1 - \bar{S}_{wn}} \left( 1 - \bar{S}_{wn}^{\frac{1}{m}} \right)^{2m} + +where + +.. math:: + + \bar{S}_{wn} = \frac{S_w - S_{wr}}{1 - S_{wr} - S_{nr}} + +and :math:`S_{wr}` and :math:`S_{nr}` are residual saturations of the wetting and non-wetting phases, respectively. +Hysteresis is implemented by considering :math:`S_{nr}` to be a variable, which is calculated from the maximum historical non-wetting phase saturation in a grid block, :math:`S_{nmax}`. +The user has the option to specify :math:`S_{nr}` as a linear function of the historical :math:`S_{nmax}`: + +.. math:: + + S_{nr} = f_{snr} S_{nmax} + +or :math:`S_{nr}` can be calculated using a modified form of the :cite:label:`land1968calculation` relationship + +.. math:: + + S_{nr} = \frac{S_{nmax}}{1 + C S_{nmax}} + +with + +.. math:: + + C = \frac{1}{S_{nrmax}} - \frac{1}{1 - S_{wr}} + +where :math:`f_{snr}` and :math:`S_{nrmax}`, the maximum residual non-wetting phase saturation, are user-specified material properties. +:math:`S_{nr}` is calculated during every Newton-Raphson iteration. +If :math:`S_n` drops below :math:`S_{nr}` by dissolution or compression, :math:`S_{nmax}` is recalculated as + +.. math:: + + S_{nmax} = \frac{S_n}{f_{snr}} \text{ or } S_{nmax} = \frac{S_n}{1 - C S_n} + +Wetting-phase relative permeability (non-hysteretic) is from van Genuchten (1980) + +.. math:: + + k_{rw} = \sqrt{\bar{S}_w} \left( 1 - \left( 1 - \bar{S}_w^{\frac{1}{m}}\right)^m \right)^2 + +where + +.. math:: + + \bar{S}_w = \frac{S_w - S_{wr}}{S_{ws} - S_{wr}} + +Parameters: + +- :math:`RP(1) = m` to use in :math:`k_{rw}` +- :math:`RP(2) = S_{wr}` +- :math:`RP(3) = S_{ws}` (recommend 1) +- :math:`RP(4)` + + - <0: :math:`= -f_{snr}` in linear trapping model + - >0: :math:`S_{nrmax}` in Land trapping model + +- :math:`RP(5) = m_{gas}`, :math:`m` to use in :math:`k_{rn}`: if zero or blank, use :math:`RP(1)` +- :math:`RP(6) =` power to use in first term in :math:`k_{rn}` (default 1/2) +- :math:`RP(7)` + + - =0: use :math:`\left( 1 - \bar{S}_{wn} \right)` in first term in :math:`k_{rn}` (Mualem, 1976) + - >0: use :math:`S_g` in first term in :math:`k_{rn}` (:cite:label:`charbeneau2007distribution`), so that :math:`k_{rn}` does not go to 1 when immobile liquid phase is present + + +All Phases Perfectly Mobile (IRP=31) +------------------------------------ + +:math:`k_{rg} = k_{rl} = k_{rn} = 1` + +No parameters. + + +.. _irp32: + +Modified Version of Stone's First Three-Phase Method (IRP=32) +------------------------------------------------------------- + +After :cite:label:`stone1970probability`. + +.. math:: + + k_{rg} = \left( \frac{S_g - S_{gr}}{1 - S_{gr}} \right)^n + +.. math:: + + k_{rl} = \left( \frac{S_l - S_{lr}}{1 - S_{lr}} \right)^n + +.. math:: + + k_{rn} = \left( \frac{1 - S_g - S_l - S_{nr}}{1 - S_g - S_{lr} - S_{nr}} \right) \left( \frac{1 - S_{lr} - S_{nr}}{1 - S_l - S_{nr}} \right) \left( \frac{\left( 1 - S_g - S_{lr} - S_{nr} \right)\left( 1 - S_l \right)}{1 - S_{nr}} \right)^n + +When :math:`S_n = 1 - S_l - S_g - S_s` is near irreducible liquid saturation, :math:`S_{nr} \le S_n \le S_{nr} + 0.005`, liquid relative permeability is taken to be + +.. math:: + + k_{rn}^{'} = k_{rn} \frac{S_n - S_{nr}}{0.005} + +Parameters: + +- :math:`RP(1) = S_{lr}` +- :math:`RP(2) = S_{nr}` +- :math:`RP(3) = S_{gr}` +- :math:`RP(4) = n` + + +Three-Phase Functions of Parker et al. (IRP=33) +----------------------------------------------- + +After :cite:label:`parker1987parametric`. + +.. math:: + + k_{rg} = \sqrt{\bar{S}_g} \left( 1 - \left( \bar{S}_n \right)^{\frac{1}{m}} \right)^{2m} + +.. math:: + + k_{rl} = \sqrt{\bar{S}_l} \left( 1 - \left( 1 - \left( \bar{S}_l \right)^{\frac{1}{m}} \right)^m \right)^2 + +.. math:: + + k_{rn} = \sqrt{\bar{S}_n - \bar{S}_l} \left( \left( 1 - \left( \bar{S}_l \right)^{\frac{1}{m}} \right)^m - \left( 1 - \left( \bar{S}_n \right)^{\frac{1}{m}} \right)^m \right)^2 + +with + +.. math:: + + m = 1 - \frac{1}{n} + +.. math:: + + \bar{S}_g = \frac{S_g}{1 - S_m} + +.. math:: + + \bar{S}_l = \frac{S_l - S_m}{1 - S_m} + +.. math:: + + \bar{S}_n = \frac{S_l + S_n - S_m}{1 - S_m} + +where :math:`k_{rg}`, :math:`k_{rl}`, and :math:`k_{rn}` are limited to values between 0 and 1. + +Parameters: + +- :math:`RP(1) = S_m` +- :math:`RP(2) = n` + + +IRP=34 +------ + +Same as :ref:`irp32`, except that + +.. math:: + + k_{rg} = 1 - \left( \frac{S_n + S_l - S_{lr}}{1 - S_{lr}} \right)^n + + +Power Law (IRP=35) +------------------ + +Phases :math:`\beta = l, n, g`. + +.. math:: + + k_{r \beta} = \left( \frac{S_{\beta} - S_{\beta r}}{1 - S_{\beta r}} \right)^n + +Parameters: + +- :math:`RP(1) = S_{lr}` +- :math:`RP(2) = S_{nr}` +- :math:`RP(3) = S_{gr}` +- :math:`RP(4) = n` + + +Functions Used by Faust (1985) for Two-Phase Buckley-Leverett Problem +--------------------------------------------------------------------- + +After :cite:label:`faust1985transport`. + +.. math:: + + k_{rl} = \frac{\left( S_l - 0.16 \right)^2}{0.64} + +.. math:: + + k_{rg} = 0 + +.. math:: + + k_{rn} = \frac{\left( 0.8 - S_l \right)^2}{0.64} + +where :math:`k_{rl}` and :math:`k_{rn}` are limited to values between 0 and 1. + +No parameters. + + +IRP=37 +------ + +Same are :ref:`irp32`, except a correction factor is applied to :math:`k_{rn}` such as to make :math:`k_{rn}` equal to :math:`k_{rg}` for two-phase conditions with the same aqueous phase saturation. + + +.. _relative_permeabilty_custom: + +Custom +------ + +If the user wishes to employ other relative permeability relationships, these need to be programmed into subroutine *RELP* in module *Utility.f90*. +The routine has the following structure: + +.. code-block:: fortran + + SUBROUTINE RELP(SATU,RELPERM,NNPH,NMAT,USRX) + ... + RELP_FUNCTION: SELECT CASE (IRP(NMAT)) + CASE (1) + CALL RELP_LINEAR(...) + CASE (2) + ... + ... + ... + END SELECT RELP_FUNCTION + + END + +To code an additional relative permeability function, the user needs to insert a code segment analogous to that shown above, beginning with a CASE option which would be identical to ``IRP`` and calls a subroutine for the additional relative permeability function. diff --git a/doc/source/tough3/index.rst b/doc/source/tough3/index.rst new file mode 100644 index 00000000..5cf8c806 --- /dev/null +++ b/doc/source/tough3/index.rst @@ -0,0 +1,20 @@ +TOUGH3 +====== + +TOUGH3 is a general-purpose numerical simulator for multi-dimensional fluid and heat flows of multiphase, multicomponent fluid mixtures in porous and fractured media. +It is developed as an enhanced, more efficient version of the TOUGH2 suite of codes. TOUGH3 consolidates the serial (TOUGH2; :cite:label:`pruess1999tough2`) and parallel (TOUGH2-MP; :cite:label:`zhang2008user`) implementations, enabling simulations to be performed on desktop computers and supercomputers using a single source code. +New PETSc parallel linear solvers (:cite:label:`balay2016petsc`) are added to the existing serial solvers of TOUGH2 and the Aztec solver used in TOUGH2-MP. +TOUGH3 also implements numerous enhanced features. The code inherits all the existing key processes and features of its predecessors, and is backwards compatible with a few justifiable exceptions. However, the parallel computing capability and the additional, parallel linear solvers employed by TOUGH3 remarkably improve the code's computational efficiency. + +The present documentation provides a summary of the mathematical models and numerical methods, discusses new user features, and gives complete specifications for preparing input data. +It also includes a quick start guide to TOUGH3 that describes how to install the code, set up the problem, execute the simulation, and analyze the output. +To make this documentation self-contained, we include much of the material that was covered in the TOUGH2 user's guide (:cite:label:`pruess1999tough2`). + +.. toctree:: + :maxdepth: 2 + :hidden: + + install/index + guide/index + eos/index + references diff --git a/doc/source/tough3/install/index.rst b/doc/source/tough3/install/index.rst new file mode 100644 index 00000000..3a85d2ff --- /dev/null +++ b/doc/source/tough3/install/index.rst @@ -0,0 +1,12 @@ +Installation +============ + +This section describes how to install TOUGH3. + +.. toctree:: + :titlesonly: + :hidden: + :maxdepth: 2 + + linux + windows diff --git a/doc/source/tough3/install/linux.rst b/doc/source/tough3/install/linux.rst new file mode 100644 index 00000000..806e74f5 --- /dev/null +++ b/doc/source/tough3/install/linux.rst @@ -0,0 +1,51 @@ +.. _installation_on_linux: + +Installation on Linux +===================== + +Installation of dependencies +**************************** + +Run the following commands + +.. code-block:: bash + + sudo apt update + sudo apt upgrade + sudo apt install gcc gfortran mpich cmake libblas-dev liblapack-dev python2 python + + +Installation of TOUGH3 +********************** + +Go to your home directory + +.. code-block:: bash + + cd + +Create and go to a new directory "tough3-build" + +.. code-block:: bash + + mkdir tough3-build + cd tough3-build + +Place TOUGH3 installation folders "esd-tough3" and "esd-toughlib" in this new directory + +.. code-block:: bash + + cp -R PATH_TO_ESD_TOUGH3 . + cp -R PATH_TO_ESD_TOUGHLIB . + +Go to "esd-tough3" + +.. code-block:: bash + + cd esd-tough3 + +Compile desired EOS (for instance EOS3, can be a list too) + +.. code-block:: bash + + ./compile_T3_Linux.sh 3 diff --git a/doc/source/tough3/install/windows.rst b/doc/source/tough3/install/windows.rst new file mode 100644 index 00000000..ad736e58 --- /dev/null +++ b/doc/source/tough3/install/windows.rst @@ -0,0 +1,21 @@ +.. _installation_on_windows: + +Installation on Windows +======================= + +On Windows, it is recommended to compile TOUGH3 using Windows Subsystem for Linux (WSL). Otherwise, TOUGH3 can be compiled using Cygwin. + + +Installation with WSL +--------------------- + +Please refer to the following link to install WSL on Windows 10 and Windows 11: https://docs.microsoft.com/en-us/windows/wsl/install + +Once WSL is setup, refer to Section :ref:`installation_on_linux` to compile TOUGH3. + +If you get an error like `"/bin/bash^M: bad interpreter: No such file or directory"`, run the following commands: + +.. code-block:: bash + + sudo apt install dos2unix + dos2unix *.sh diff --git a/doc/source/tough3/references.rst b/doc/source/tough3/references.rst new file mode 100644 index 00000000..aaf80a29 --- /dev/null +++ b/doc/source/tough3/references.rst @@ -0,0 +1,6 @@ +References +========== + +.. bibliography:: ../references.bib + :cited: + :style: apa