Input and output files#
Input parameters#
- toughio.read_input(filename, file_format=None, **kwargs)#
Read TOUGH input file.
- Parameters:
filename (str, pathlike or buffer) – Input file name or buffer.
file_format (str ('tough', 'toughreact-flow', 'toughreact-solute', 'toughreact-chemical', 'json') or None, optional, default None) – Input file format.
label_length (int or None, optional, default None) – Only if
file_format = "tough"
. Number of characters in cell labels.n_variables (int or None, optional, default None) – Only if
file_format = "tough"
. Number of primary variables.eos (str or None, optional, default None) – Only if
file_format = "tough"
. Equation of State.mopr_11 (int, optional, default 0) – Only if
file_format = "toughreact-solute"
. MOPR(11) value in file ‘flow.inp’.
- Returns:
TOUGH input parameters.
- Return type:
dict
Note
If
file_format == 'tough'
, can also read MESH, INCON and GENER files.
- toughio.write_input(filename, parameters, file_format=None, **kwargs)#
Write TOUGH input file.
- Parameters:
filename (str, pathlike or buffer) – Output file name or buffer.
parameters (dict) – Parameters to export.
file_format (str ('tough', 'toughreact-flow', 'toughreact-solute', 'toughreact-chemical', 'json') or None, optional, default None) – Output file format.
block (str {'all', 'gener', 'mesh', 'incon'} or None, optional, default None) –
Only if
file_format = "tough"
. Blocks to be written:’all’: write all blocks,
’gener’: only write block GENER,
’mesh’: only write blocks ELEME, COORD and CONNE,
’incon’: only write block INCON,
None: write all blocks except blocks defined in ignore_blocks.
ignore_blocks (list of str or None, optional, default None) – Only if
file_format = "tough"
and block is None. Blocks to ignore.space_between_blocks (bool, optional, default False) – Only if
file_format = "tough"
. Add an empty record between blocks.eos (str or None, optional, default None) – Only if
file_format = "tough"
. Equation of State. If eos is defined in parameters, this option will be ignored.mopr_10 (int, optional, default 0) – Only if
file_format = "toughreact-solute"
. MOPR(10) value in file ‘flow.inp’.mopr_11 (int, optional, default 0) – Only if
file_format = "toughreact-solute"
. MOPR(11) value in file ‘flow.inp’.verbose (bool, optional, default True) – Only if
file_format
in {“toughreact-solute”, “toughreact-chemical”}. If True, add comments to describe content of file.
- toughio.register_input(file_format, extensions, reader, writer=None)#
Register a new input format.
- Parameters:
file_format (str) – File format to register.
extensions (array_like) – List of extensions to associate to the new format.
reader (callable) – Read fumction.
writer (callable or None, optional, default None) – Write function.
Simulation outputs#
- toughio.read_output(filename, file_format=None, labels_order=None, connection=False)#
Read TOUGH SAVE or output file for each time step.
- Parameters:
filename (str, pathlike or buffer) – Input file name or buffer.
file_format (str ('csv', 'petrasim', 'save', 'tecplot', 'tough') or None, optional, default None) – Input file format.
labels_order (list of array_like or None, optional, default None) – List of labels.
connection (bool, optional, default False) – Only for standard TOUGH output file. If True, return data related to connections.
- Returns:
namedtuple (type, format, time, labels, data) or list of namedtuple for each time step.
- Return type:
namedtuple or list of namedtuple
- toughio.write_output(filename, output, file_format=None, **kwargs)#
Write TOUGH output file.
- Parameters:
filename (str, pathlike or buffer) – Output file name or buffer.
output (namedtuple or list of namedtuple) – namedtuple (type, format, time, labels, data) or list of namedtuple for each time step to export.
file_format (str ('csv', 'petrasim', 'save', 'tecplot', 'tough') or None, optional, default None) – Output file format.
unit (dict or None, optional, default None) – Only if
file_format = "tough"
. Overwrite header unit.
- toughio.register_output(file_format, extensions, reader, writer=None)#
Register a new output format.
- Parameters:
file_format (str) – File format to register.
extensions (array_like) – List of extensions to associate to the new format.
reader (callable) – Read function.
writer (callable or None, optional, default None) – Write function.