-
Notifications
You must be signed in to change notification settings - Fork 37
TOUGH2 data files
TOUGH2 takes its main input for a simulation from a formatted text file, referred to here as the TOUGH2 data file. This file contains information on the model grid, generators, time stepping and other parameters.
The PyTOUGH t2data
module enables the user to handle TOUGH2 data files using Python scripts. You can import it in the usual ways, e.g.:
from t2data import *
(Tip: if you import the t2data
module, and you also want to use the mulgrids
module, you don't need to import that separately, because t2data
imports mulgrids
itself.)
The data file formats for TOUGH2 and AUTOUGH2 are mostly the same, but there are some differences. The t2data
module supports both.
This module defines a t2data
class, which represents the entire contents of a TOUGH2 data file. The definition of this class specifies the properties and methods that a t2data
object will have.
Its properties correspond to all the different sections of a TOUGH2 data file (title, parameters, model grid, generators etc.). Most of these sections themselves contain many different parameters, and so are represented in a t2data
object as dictionaries with multiple items, accessed by name.
A t2data
object has methods for carrying out tasks such as reading from and writing to disk, adding and deleting generators, running the simulation, converting between different versions of TOUGH2 and transferring models from one grid to another.
It is possible to create an 'empty' t2data
object in the usual way, e.g.:
dat = t2data()
More often we wish to read an existing data file from disk into an object, which can be done just by including the file name inside the parentheses, e.g.:
dat = t2data('sim.dat')
which will read the contents of the file 'sim.dat' into a t2data
object called dat
.
Printing a t2data
object (by typing print dat
) will just return the data file's title.
The main part of a TOUGH2 data file is usually taken up with the specification of the model grid, including the blocks, connections and rock types. Because this is such a major part of the TOUGH2 data file, and because it is often useful to be able to manipulate model grids independently of other simulation information (time stepping, generators etc.) the grid part of a TOUGH2 data file is given a whole property to itself: the grid
property. This is an instance of a separate t2grid
class.
Hence the model grid contained in a t2data
object dat
can be accessed by dat.grid
.
A t2grid
object has its own properties and methods, described here.
For example, a t2grid
object has a block
property, which is a dictionary containing all the blocks in the grid, accessible by block name. Hence, the block with name 'AR210' in the grid of a t2data
object dat
can be accessed by dat.grid.block['AR210']
.