Writers Class

Biodegradation Writing

class pytoughreact.writers.bio_writing.T2BioParser(filename, mode, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]

Class for parsing TMVOC data file.

__init__(filename, mode, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]
read_multi_value_line(variable, line_type)[source]

Reads a line of parameter multi values from the file into a dictionary variable. Null values are ignored.

Parameters:
  • variable (str) – variable to be read

  • line_type (str) – type of line to be read

read_params_value_line(variable, line_type)[source]

Reads a line of parameter values from the file into a dictionary variable. Null values are ignored.

Parameters:
  • variable (str) – variable to be read

  • line_type (str) – type of line to be read

class pytoughreact.writers.bio_writing.T2Bio(filename='', meshfilename='', read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]

Class for TMVOC data.

__init__(filename='', meshfilename='', read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]
get_present_sections()[source]

Returns a list of TOUGH2 section keywords for which there are corresponding data in the t2bio object.

Returns:

present_sections – Sections with corresponding data in the t2bio object

Return type:

list

property present_sections

Returns a list of TOUGH2 section keywords for which there are corresponding data in the t2bio object.

Returns:

present_sections – Sections with corresponding data in the t2bio object

Return type:

list

read(filename='', meshfilename='', runlocation='')[source]

Reads data from file. Mesh data can optionally be read from an auxiliary file. Extra precision data will also be read from an associated ‘.pdat’ file, if it exists.

Parameters:
  • filename (str) – file to read

  • meshfilename (str) – Mesh file to read

  • runlocation (str) – Path containing executables

read_biodg(infile)[source]

Reads Biodegradation Block

Parameters:

infile (str) – Input file processor

Returns:

components – adds biodegradation block to grid

Return type:

self

read_chem(infile)[source]

Reads chemical components

Parameters:

infile (str) – Input file processor

Returns:

components – adds components to grid

Return type:

self

read_gas(infile)[source]

Reads Gases

Parameters:

infile (str) – Input file processor

Returns:

components – adds gases to grid

Return type:

self

read_more_options(infile)[source]

Reads additional parameter options

Parameters:

infile (str) – Input file processor

Returns:

components – adds more_options block to grid

Return type:

self

read_multi(infile)[source]

Reads EOS parameters

Parameters:

infile (str) – Input file processor

Returns:

components – adds multi block to grid

Return type:

self

read_parameters(infile)[source]

Reads Parameters Block

Parameters:

infile (str) – Input file processor

Returns:

components – adds parameters block to grid

Return type:

self

read_rocktypes(infile)[source]

Reads grid rock types

Parameters:

infile (str) – Input file processor

Returns:

rocktype – adds rocktype information to grid

Return type:

self

read_solids(infile)[source]

Reads Solids Block

Parameters:

infile (str) – Input file processor

Returns:

components – adds solid block to grid

Return type:

self

reset_bio_dicta(all_components)[source]

Resets the BIO dictionary

Parameters:

all_components (list) – all components present

Returns:

empty_list – empty list containing no parameters

Return type:

list

run(save_filename='', incon_filename='', runlocation='', simulator='AUTOUGH2_2', silent=False, output_filename='')[source]

Runs simulation using TMVOC

Parameters:
  • save_filename (str) – filename of SAVE file

  • incon_filename (str) – filename of INCON file

  • run_location (str) – path to Executable and required files

  • simulator (str) – simulator executable name

  • silent (boolean) – if output messages should be written out

  • output_filename (str) – name of output file

section_insertion_index(section)[source]

Determines an appropriate position to insert the specified section in the internal list of data file sections.

Parameters:

section (list) – list of sections

Returns:

parameter – Appropriate position to insert the specified section in the internal list of data file sections.

Return type:

int

update_read_write_functions()[source]

Updates functions for reading and writing sections of data file.

write(filename='', meshfilename='', run_location='', extra_precision=None, echo_extra_precision=None)[source]

Writes data to file. Mesh data can optionally be written to an auxiliary file. For AUTOUGH2, if extra_precision is True or a list of section names, the corresponding data sections will be written to an extra precision file; otherwise, the same sections (if any) that were read in as extra precision will also be written out as extra precision. If echo_extra_precision is True, the extra precision sections will also be written to the main data file.

Parameters:
  • filename (str) – file to read

  • meshfilename (str) – Mesh file to read

  • runlocation (str) – Path containing executables

  • extra_precision (boolean) – Required for AUTOUGH from PYTOUGH

  • echo_extra_precision (boolean) – Required for AUTOUGH from PYTOUGH

write_biodg(outfile)[source]

Writes Biodegradation Block

Parameters:

outfile (str) – output file processor

write_chem(outfile)[source]

Writes chemical components

Parameters:

outfile (str) – output file processor

write_gas(outfile)[source]

Writes Gases

Parameters:

outfile (str) – output file processor

write_parameters(outfile)[source]

Writes Parameters Block

Parameters:

outfile (str) – output file processor

write_solids(outfile)[source]

Writes Solid Block

Parameters:

outfile (str) – output file processor

write_start(outfile)[source]

Writes Start Block

Parameters:

outfile (str) – output file processor

Chemical Writing

class pytoughreact.writers.chemical_writing.T2ChemicalData(filename, mode, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]

Class for parsing CHEMICAL.INP data file.

__init__(filename, mode, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]
find_gas(gases, name)[source]

Get minerals to write

Parameters:
  • gases (list) – list of all gases in the CHEMICAL.INP file

  • name (str) – name of the as

Returns:

parameter – name and properties of the gas

Return type:

str

find_minerals(minerals, name)[source]

Get minerals to write

Parameters:
  • minerals (list) – list of all minerals in the CHEMICAL.INP file

  • name (str) – name of the mineral

Returns:

parameter – name and properties of the mineral

Return type:

str

find_primary_aqueous(primary_aqueous, name)[source]

Get minerals to write

Parameters:
  • primary_aqueous (list) – list of all primary aqueous species in the CHEMICAL.INP

  • name (str) – name of the species

Returns:

parameter – name and properties of the primary species

Return type:

str

get_default_chemical_zone_to_nodes()[source]

Get default chemical zone and map to nodes

Returns:

all_values – all default chemical zone mapped to nodes

Return type:

list

get_default_chemical_zones()[source]

Get default chemical zones

Returns:

liner – list of default chemical zones

Return type:

list

get_minerals_to_write(minerals)[source]

Get minerals to write

Parameters:

minerals (list) – list of all minerals in the CHEMICAL.INP

Returns:

all_values – all minerals

Return type:

list

get_nodes_to_read(grid)[source]

Get nodes to read

Parameters:

grid (list) – list containing all grids in the simulatioj

Returns:

output – list of all nodes

Return type:

list

get_param_values(linetype)[source]

Reads a line of parameter values from the file into a dictionary variable. Null values are ignored.

Parameters:

linetype (str) – type of line to be read

Returns:

all_lines – all parameters values

Return type:

list

get_param_values_decay_species()[source]

Reads a line of parameter values from the file into a dictionary variable. Null values are ignored.

Returns:

all_lines – all parameter decay species values

Return type:

list

get_param_values_exchangeable_cations()[source]

Reads a line of parameter values from the file into a dictionary variable. Null values are ignored.

Returns:

all_lines – all parameter exchangeable cation values

Return type:

list

get_param_values_gas()[source]

Reads a line of parameter values from the file into a dictionary variable. Null values are ignored.

Returns:

all_lines – all parameter gas values

Return type:

list

get_param_values_ib_waters(primary_aqueous, grid)[source]

Get minerals to write

Parameters:

primary_aqueous (list) – list of all primary aqueous species in the CHEMICAL.INP

Returns:

  • initial_waters_list, boundary_waters_list, initial_waters_mapping, boundary_waters_mapping

  • list, list, dict, dict – properties of the initial and boundary water

get_param_values_ij_gases(gases)[source]

Get gas to write

Parameters:

minerals (list) – list of all gases in the CHEMICAL.INP file

Returns:

initial_gas_list, injection_gas_list, initial_gas_mapping, injection_gas_mapping – properties of the initial and boundary gases

Return type:

list, list, dict, dict

get_param_values_mineral()[source]

Reads a line of parameter values from the file into a dictionary variable. Null values are ignored.

Returns:

all_lines – all parameter mineral values

Return type:

list

get_param_values_mineral_zones(minerals)[source]

Get minerals to write

Parameters:

minerals (list) – list of all minerals in the CHEMICAL.INP file

Returns:

initial_minerals_list, initial_minerals_mapping – properties of the initial minerals

Return type:

list, dict

get_param_values_perm_poro(minerals, grid)[source]

Get permeability and porosity

Returns:

initial_perm_poro_list, initial_perm_poro_mapping – properties of the initial permeability and porosity zones

Return type:

list, dict

get_param_values_surface_complex()[source]

Reads a line of parameter values from the file into a dictionary variable. Null values are ignored.

Returns:

all_lines – all parameter gas values

Return type:

list

get_primary_species_to_read(primary_aqueous)[source]

Get primary species to read

Parameters:

aqueous (primary) – list of all primary aqueous species

Returns:

all_values – all primary species

Return type:

list

get_printout_options()[source]

Reads printout options output from CHEMICAL.INP file

Returns:

liner – list of all printout options parameters

Return type:

list

get_reactive_constraints()[source]

Reads reactive constraints from CHEMICAL.INP file

Returns:

liner – list of all reactive constraints

Return type:

list

get_reactive_options()[source]

Reads reactive options from CHEMICAL.INP file

Returns:

liner – list of all reactive options

Return type:

list

get_readio()[source]

Reads reactive input output from CHEMICAL.INP file

Returns:

liner – list of all reactive input output

Return type:

list

get_tolerance_values()[source]

Reads tolerance values from CHEMICAL.INP file

Returns:

liner – list of all tolerance values parameters

Return type:

list

get_weight_diffusion()[source]

Reads weight diffusion output from CHEMICAL.INP file

Returns:

liner – list of all weight diffusion parameters

Return type:

list

search_for_node_index(blocks, nodes)[source]

Search for node index

Parameters:
  • blocks (list) – list of all blocks in the simulation

  • nodes (list) – list of all nodes in the simulation

Returns:

indexes – list of all search output

Return type:

list

class pytoughreact.writers.chemical_writing.T2Chemical(filename='', meshfilename='', t2reactgrid=None, path=None, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]

Main class for structuring the writing , reading of chemical parameters

__init__(filename='', meshfilename='', t2reactgrid=None, path=None, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]

Initialization of Parameters (Permeability Porosity)

Parameters:
  • filename (string) – Name of file to be read from (optional)

  • meshfilename (string) – Name of mesh file to be read from (optional)

  • t2reactgrid (t2reactgrid) – Grid object from t2react

property boundary_water_index

Get Boundary Water Index

Returns:

water_index – get index of water in boundary water

Return type:

dict

convert_to_t2chemical(keyword)[source]

Get corresponding t2chemical keywords

Parameters:

keyword (str) – keyword to convert to t2chemical keyword

Returns:

parameter – converted t2chemical keyword

Return type:

str

count_mineral_zones()[source]

Count number of mineral zones

Returns:

count – number of mineral zones

Return type:

int

count_zones()[source]

Count number of zones

Returns:

count – number of zones

Return type:

int

get_boundary_water_index()[source]

Get Boundary Water Index

Returns:

water_index – get index of water in boundary water

Return type:

dict

get_initial_gas_index()[source]

Get Initial Gas Index

Returns:

gas_index – get index of gas in gases

Return type:

dict

get_initial_water_index()[source]

Get Initial Water Index

Returns:

water_index – get index of water in initial water

Return type:

dict

get_injection_gas_index()[source]

Get Injection Gas Index

Returns:

gas_index – get index of injection gas in gases

Return type:

dict

get_mineral_index()[source]

Get Mineral Index

Returns:

mineral_index – get index of mineral in minerals

Return type:

dict

get_mineral_zones()[source]

Get Mineral zones

Returns:

mineral_zone – list of mineral zones

Return type:

list

get_perm_poro_index()[source]

Get Permeability Porosity Index

Returns:

perm_poro_index – get index of perm poro in chemical.inp

Return type:

dict

get_perm_poro_zones()[source]

Get Porosity / Permeability zones

Returns:

perm_poro_zone – list of perm poro zones

Return type:

list

get_present_sections()[source]

Returns a list of TOUGH2 section keywords for which there are corresponding data in the t2bio object.

Returns:

parameters – list of present sections

Return type:

list

getib_waters()[source]

Get initial and boundary waters

Returns:

ib_waters – list of initial and boundary waters

Return type:

list

getij_gas()[source]

Get initial and injection gas

Returns:

ib_waters – list of initial and boundary waters

Return type:

list

property initial_gas_index

Get Initial Gas Index

Returns:

gas_index – get index of gas in gases

Return type:

dict

property initial_water_index

Get Initial Water Index

Returns:

water_index – get index of water in initial water

Return type:

dict

property injection_gas_index

Get Injection Gas Index

Returns:

gas_index – get index of injection gas in gases

Return type:

dict

map_mineral_to_zone()[source]

Map Mineral to Zone

Returns:

zone – list of perm poro zones

Return type:

dict

property mineral_index

Get Mineral Index

Returns:

mineral_index – get index of mineral in minerals

Return type:

dict

property mineral_zones

Get Mineral zones

Returns:

mineral_zone – list of mineral zones

Return type:

list

property perm_poro

Get Porosity / Permeability zones

Returns:

perm_poro_zone – list of perm poro zones

Return type:

list

property perm_poro_index

Get Permeability Porosity Index

Returns:

perm_poro_index – get index of perm poro in chemical.inp

Return type:

dict

property present_sections

Returns a list of TOUGH2 section keywords for which there are corresponding data in the t2bio object.

Returns:

parameters – list of present sections

Return type:

list

read(filename='', meshfilename='', runlocation='', extra_precision=None, echo_extra_precision=None)[source]

Read from file (chemical.inp)

Parameters:
  • filename (str) – filename

  • meshfilename (str) – MESH filename

  • run_location (str) – path to Executable and required files

  • extra_precision (boolean) – required or AUTOUGH

  • echo_extra_precision (boolean) – required or AUTOUGH

read_aqueous_complexes(infile)[source]

Read Aqueous Complexes

Parameters:

infile (str) – Input file processor

Returns:

components – adds aqueous complexes

Return type:

self

read_aqueous_kinetics(infile)[source]

Read Aqueous Kinetic Species

Parameters:

infile (str) – Input file processor

Returns:

components – adds aqueous kinetics to grid

Return type:

self

read_cation_exchange(infile)[source]

Read Cation Exchange

Parameters:

infile (str) – Input file processor

Returns:

components – adds Cation Exchange to grid

Return type:

self

read_decay_species(infile)[source]

Read decay species from file

Parameters:

infile (str) – Input file processor

Returns:

components – adds decay species to grid

Return type:

self

read_exchangeable_cations(infile)[source]

Read Exchangeable Cations from file

Parameters:

infile (str) – Input file processor

Returns:

components – adds Exchangeable Cations to grid

Return type:

self

read_gases(infile)[source]

Read gases from file

Parameters:

infile (str) – Input file processor

Returns:

components – adds gases to grid

Return type:

self

read_ib_waters(infile)[source]

Reads Initial and Boundary waters from file

Parameters:

infile (str) – Input file processor

Returns:

components – adds Initial and Boundary waters to grid

Return type:

self

read_ij_gas(infile)[source]

Read Initial and Injection Gas

Parameters:

infile (str) – Input file processor

Returns:

components – adds injection gas to grid

Return type:

self

read_linear_equilibrium(infile)[source]

Read Linear Equilibrium

Parameters:

infile (str) – Input file processor

Returns:

components – adds Linear Equilibrium to grid

Return type:

self

read_mineral_zones(infile)[source]

Reads Mineral Zones

Parameters:

infile (str) – Input file processor

Returns:

components – adds mineral zones to grid

Return type:

self

read_minerals(infile)[source]

Read Minerals

Parameters:

infile (str) – Input file processor

Returns:

components – adds minerals

Return type:

self

read_perm_poro(infile)[source]

Read Permeability and Porosity Regions

Parameters:

infile (str) – Input file processor

Returns:

components – adds perm poro to grid

Return type:

self

read_primary_aqueous(infile)[source]

Read Primary Aqueous Species

Parameters:

infile (str) – Input file processor

Returns:

components – adds parameters block to grid

Return type:

self

read_surface_adsorption(infile)[source]

Read Surface adsorption

Parameters:

infile (str) – Input file processor

Returns:

components – adds surface adsorption to grid

Return type:

self

read_surface_complexes(infile)[source]

Read surface complexes from file

Parameters:

infile (str) – Input file processor

Returns:

components – adds surface complexes to grid

Return type:

self

section_insertion_index(section)[source]

Determines an appropriate position to insert the specified section in the internal list of data file sections.

update_read_write_functions()[source]

Updates functions for reading and writing sections of data file.

write(filename='', meshfilename='', runlocation='', extra_precision=None, echo_extra_precision=None)[source]

Write to file (chemical.inp)

Parameters:
  • filename (str) – filename

  • meshfilename (str) – MESH filename

  • run_location (str) – path to Executable and required files

  • extra_precision (boolean) – required or AUTOUGH

  • echo_extra_precision (boolean) – required or AUTOUGH

write_aqueous_complexes(outfile)[source]

Write Aqueous Complexes

Parameters:

outfile (str) – output file processor

write_aqueous_kinetics(outfile)[source]

Write Aqueous Kinetic Species

Parameters:

outfile (str) – output file processor

write_cation_exchange(outfile)[source]

Write Cation Exchange

Parameters:

outfile (str) – output file processor

write_decay_species(outfile)[source]

Write decay species to file

Parameters:

outfile (str) – output file processor

write_dissolution_precipitation(outfile, mineral, format)[source]

Write Dissolution and Precipitation Parameters

Parameters:
  • outfile (str) – output file processor

  • mineral (Mineral) – mineral class containing minerals

  • format (str) – flag for dissolution or precipitation

write_equilibrium(outfile, mineral)[source]

Write Equilibirum Parameters

Parameters:
  • outfile (str) – output file processor

  • mineral (Mineral) – mineral class containing minerals

write_exchangeable_cations(outfile)[source]

Write Exchangeable Cations to file

Parameters:

outfile (str) – output file processor

write_gases(outfile)[source]

Write gases to file

Parameters:

outfile (str) – output file processor

write_ib_waters(outfile)[source]

Write Initial and Boundary waters to file

Parameters:

outfile (str) – output file processor

write_ij_gas(outfile)[source]

Writes Injection gas

Parameters:

outfile (str) – output file processor

write_linear_equilibrium(outfile)[source]

Write Linear Equilibrium

Parameters:

outfile (str) – output file processor

write_mineral_zones(outfile)[source]

Write mineral zones

Parameters:

outfile (str) – output file processor

write_minerals(outfile)[source]

Write Minerals to file

Parameters:

outfile (str) – output file processor

write_perm_poro(outfile)[source]

Write Peremability and Porosity Regions

Parameters:

outfile (str) – output file processor

write_primary_aqueous(outfile)[source]

Writes Primary Aqueous

Parameters:

outfile (str) – output file processor

write_surface_adsorption(outfile)[source]

Write Surface adsorption

Parameters:

outfile (str) – output file processor

write_surface_complexes(outfile)[source]

Write surface complexes to file

Parameters:

outfile (str) – output file processor

write_title(outfile)[source]

Write Title of Chemical file (chemical.inp)

Parameters:

outfile (str) – output file processor

React Writing

class pytoughreact.writers.react_writing.T2ReactParser(filename, mode, specification={'REACT': [['MOPR1', 'MOPR2', 'MOPR3', 'MOPR4', 'MOPR5', 'MOPR6', 'MOPR7', 'MOPR8', 'MOPR9', 'MOPR10', 'MOPR11', 'MOPR12', 'MOPR13', 'MOPR14', 'MOPR15', 'MOPR16', 'MOPR17', 'MOPR1'], ['1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d']], '_more_option_str': [['_more_option_str'], ['21s']], 'blocks': [['name', 'nseq', 'nadd', 'rocktype', 'volume', 'ahtx', 'pmx', 'x', 'y', 'z'], ['5s', '5d', '5d', '5s', '10.4e', '10.4e', '10.4e', '10.3e', '10.3e', '10.3e']], 'capillarity': [['type', '', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter'], ['5d', '5x', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e']], 'connections': [['block1', 'block2', 'nseq', 'nad1', 'nad2', 'direction', 'distance1', 'distance2', 'area', 'dircos', 'sigma'], ['5s', '5s', '5d', '5d', '5d', '5d', '10.4e', '10.4e', '10.4e', '10.7f', '10.3e']], 'default_incons': [['incon', 'incon', 'incon', 'incon'], ['20.14e', '20.14e', '20.14e', '20.14e']], 'diffusion': [['diff', 'diff', 'diff', 'diff', 'diff', 'diff', 'diff', 'diff'], ['10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e']], 'equid': [['nequ', '', 'dr'], ['5d', '5x', '10.4e']], 'generation_enthalpy': [['enthalpy', 'enthalpy', 'enthalpy', 'enthalpy'], ['14.7e', '14.7e', '14.7e', '14.7e']], 'generation_rates': [['rate', 'rate', 'rate', 'rate'], ['14.7e', '14.7e', '14.7e', '14.7e']], 'generation_times': [['time', 'time', 'time', 'time'], ['14.7e', '14.7e', '14.7e', '14.7e']], 'generator': [['block', 'name', 'nseq', 'nadd', 'nads', 'ltab', '', 'type', 'itab', 'gx', 'ex', 'hg', 'fg'], ['5s', '5s', '5d', '5d', '5d', '5d', '5x', '4s', '1s', '10.3e', '10.3e', '10.3e', '10.3e']], 'incon1': [['block', 'nseq', 'nadd', 'porosity'], ['5s', '5d', '5d', '15.9e']], 'incon2': [['incon', 'incon', 'incon', 'incon'], ['20.14e', '20.14e', '20.14e', '20.14e']], 'indom2': [['indom', 'indom', 'indom', 'indom'], ['20.13e', '20.13e', '20.13e', '20.13e']], 'layer1': [['nlay'], ['5d']], 'layer2': [['layer', 'layer', 'layer', 'layer', 'layer', 'layer', 'layer', 'layer'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'lineq': [['type', 'epsilon', 'max_iterations', 'gauss', 'num_orthog'], ['2d', '10.4e', '4d', '1d', '4d']], 'logar': [['nlog', '', 'rlog', 'dr'], ['5d', '5x', '10.4e', '10.4e']], 'minc': [['part', 'type', '', 'dual'], ['5s', '5s', '5x', '5s']], 'multi': [['num_components', 'num_equations', 'num_phases', 'num_secondary_parameters', 'num_inc'], ['5d', '5d', '5d', '5d', '5d']], 'multi_autough2': [['num_components', 'num_equations', 'num_phases', 'num_secondary_parameters', 'eos'], ['5d', '5d', '5d', '5d', '4s']], 'output_times1': [['num_times_specified', 'num_times', 'max_timestep', 'time_increment'], ['5d', '5d', '10.4e', '10.4e']], 'output_times2': [['time', 'time', 'time', 'time', 'time', 'time', 'time', 'time'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'param1': [['max_iterations', 'print_level', 'max_timesteps', 'max_duration', 'print_interval', '_option_str', 'texp', 'be'], ['2d', '2d', '4d', '4d', '4d', '24s', '10.3e', '10.3e']], 'param1_autough2': [['max_iterations', 'print_level', 'max_timesteps', 'max_duration', 'print_interval', '_option_str', 'diff0', 'texp', 'be'], ['2d', '2d', '4d', '4d', '4d', '24s', '10.3e', '10.3e', '10.3e']], 'param2': [['tstart', 'tstop', 'const_timestep', 'max_timestep', 'print_block', '', 'gravity', 'timestep_reduction', 'scale'], ['10.3e', '10.3e', '10.3e', '10.3e', '5s', '5x', '10.4e', '10.4e', '10.4e']], 'param3': [['relative_error', 'absolute_error', 'pivot', 'upstream_weight', 'newton_weight', 'derivative_increment'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'part1': [['num_continua', 'nvol', 'where', 'spacing', 'spacing', 'spacing', 'spacing', 'spacing', 'spacing', 'spacing'], ['3d', '3d', '-4s', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'part2': [['vol', 'vol', 'vol', 'vol', 'vol', 'vol', 'vol', 'vol'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'radii1': [['nrad'], ['5d']], 'radii2': [['radius', 'radius', 'radius', 'radius', 'radius', 'radius', 'radius', 'radius'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'relative_permeability': [['type', '', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter'], ['5d', '5x', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e']], 'rocks1': [['name', 'nad', 'density', 'porosity', 'k1', 'k2', 'k3', 'conductivity', 'specific_heat'], ['5s', '5d', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'rocks1.1': [['compressibility', 'expansivity', 'dry_conductivity', 'tortuosity', 'klinkenberg', 'xkd3', 'xkd4'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'rocks1.2': [['type', '', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter'], ['5d', '5x', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e']], 'rocks1.3': [['type', '', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter'], ['5d', '5x', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e']], 'selec1': [['int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec'], ['5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d']], 'selec2': [['float_selec', 'float_selec', 'float_selec', 'float_selec', 'float_selec', 'float_selec', 'float_selec', 'float_selec'], ['10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e']], 'short': [['', 'frequency'], ['5x', '2d']], 'simulator': [['simulator'], ['80s']], 'solver': [['type', '', 'z_precond', '', 'o_precond', 'relative_max_iterations', 'closure'], ['1d', '2x', '2s', '3x', '2s', '10.4e', '10.4e']], 'timestep': [['timestep', 'timestep', 'timestep', 'timestep', 'timestep', 'timestep', 'timestep', 'timestep'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'title': [['title'], ['80s']], 'xyz1': [['deg'], ['10.4e']], 'xyz2': [['ntype', '', 'no', 'del'], ['2s', '3x', '5d', '10.4e']], 'xyz3': [['deli', 'deli', 'deli', 'deli', 'deli', 'deli', 'deli', 'deli'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']]}, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>}, location=None)[source]

Class for parsing REACTION data file.

__init__(filename, mode, specification={'REACT': [['MOPR1', 'MOPR2', 'MOPR3', 'MOPR4', 'MOPR5', 'MOPR6', 'MOPR7', 'MOPR8', 'MOPR9', 'MOPR10', 'MOPR11', 'MOPR12', 'MOPR13', 'MOPR14', 'MOPR15', 'MOPR16', 'MOPR17', 'MOPR1'], ['1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d', '1d']], '_more_option_str': [['_more_option_str'], ['21s']], 'blocks': [['name', 'nseq', 'nadd', 'rocktype', 'volume', 'ahtx', 'pmx', 'x', 'y', 'z'], ['5s', '5d', '5d', '5s', '10.4e', '10.4e', '10.4e', '10.3e', '10.3e', '10.3e']], 'capillarity': [['type', '', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter'], ['5d', '5x', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e']], 'connections': [['block1', 'block2', 'nseq', 'nad1', 'nad2', 'direction', 'distance1', 'distance2', 'area', 'dircos', 'sigma'], ['5s', '5s', '5d', '5d', '5d', '5d', '10.4e', '10.4e', '10.4e', '10.7f', '10.3e']], 'default_incons': [['incon', 'incon', 'incon', 'incon'], ['20.14e', '20.14e', '20.14e', '20.14e']], 'diffusion': [['diff', 'diff', 'diff', 'diff', 'diff', 'diff', 'diff', 'diff'], ['10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e']], 'equid': [['nequ', '', 'dr'], ['5d', '5x', '10.4e']], 'generation_enthalpy': [['enthalpy', 'enthalpy', 'enthalpy', 'enthalpy'], ['14.7e', '14.7e', '14.7e', '14.7e']], 'generation_rates': [['rate', 'rate', 'rate', 'rate'], ['14.7e', '14.7e', '14.7e', '14.7e']], 'generation_times': [['time', 'time', 'time', 'time'], ['14.7e', '14.7e', '14.7e', '14.7e']], 'generator': [['block', 'name', 'nseq', 'nadd', 'nads', 'ltab', '', 'type', 'itab', 'gx', 'ex', 'hg', 'fg'], ['5s', '5s', '5d', '5d', '5d', '5d', '5x', '4s', '1s', '10.3e', '10.3e', '10.3e', '10.3e']], 'incon1': [['block', 'nseq', 'nadd', 'porosity'], ['5s', '5d', '5d', '15.9e']], 'incon2': [['incon', 'incon', 'incon', 'incon'], ['20.14e', '20.14e', '20.14e', '20.14e']], 'indom2': [['indom', 'indom', 'indom', 'indom'], ['20.13e', '20.13e', '20.13e', '20.13e']], 'layer1': [['nlay'], ['5d']], 'layer2': [['layer', 'layer', 'layer', 'layer', 'layer', 'layer', 'layer', 'layer'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'lineq': [['type', 'epsilon', 'max_iterations', 'gauss', 'num_orthog'], ['2d', '10.4e', '4d', '1d', '4d']], 'logar': [['nlog', '', 'rlog', 'dr'], ['5d', '5x', '10.4e', '10.4e']], 'minc': [['part', 'type', '', 'dual'], ['5s', '5s', '5x', '5s']], 'multi': [['num_components', 'num_equations', 'num_phases', 'num_secondary_parameters', 'num_inc'], ['5d', '5d', '5d', '5d', '5d']], 'multi_autough2': [['num_components', 'num_equations', 'num_phases', 'num_secondary_parameters', 'eos'], ['5d', '5d', '5d', '5d', '4s']], 'output_times1': [['num_times_specified', 'num_times', 'max_timestep', 'time_increment'], ['5d', '5d', '10.4e', '10.4e']], 'output_times2': [['time', 'time', 'time', 'time', 'time', 'time', 'time', 'time'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'param1': [['max_iterations', 'print_level', 'max_timesteps', 'max_duration', 'print_interval', '_option_str', 'texp', 'be'], ['2d', '2d', '4d', '4d', '4d', '24s', '10.3e', '10.3e']], 'param1_autough2': [['max_iterations', 'print_level', 'max_timesteps', 'max_duration', 'print_interval', '_option_str', 'diff0', 'texp', 'be'], ['2d', '2d', '4d', '4d', '4d', '24s', '10.3e', '10.3e', '10.3e']], 'param2': [['tstart', 'tstop', 'const_timestep', 'max_timestep', 'print_block', '', 'gravity', 'timestep_reduction', 'scale'], ['10.3e', '10.3e', '10.3e', '10.3e', '5s', '5x', '10.4e', '10.4e', '10.4e']], 'param3': [['relative_error', 'absolute_error', 'pivot', 'upstream_weight', 'newton_weight', 'derivative_increment'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'part1': [['num_continua', 'nvol', 'where', 'spacing', 'spacing', 'spacing', 'spacing', 'spacing', 'spacing', 'spacing'], ['3d', '3d', '-4s', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'part2': [['vol', 'vol', 'vol', 'vol', 'vol', 'vol', 'vol', 'vol'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'radii1': [['nrad'], ['5d']], 'radii2': [['radius', 'radius', 'radius', 'radius', 'radius', 'radius', 'radius', 'radius'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'relative_permeability': [['type', '', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter'], ['5d', '5x', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e']], 'rocks1': [['name', 'nad', 'density', 'porosity', 'k1', 'k2', 'k3', 'conductivity', 'specific_heat'], ['5s', '5d', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'rocks1.1': [['compressibility', 'expansivity', 'dry_conductivity', 'tortuosity', 'klinkenberg', 'xkd3', 'xkd4'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'rocks1.2': [['type', '', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter'], ['5d', '5x', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e']], 'rocks1.3': [['type', '', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter', 'parameter'], ['5d', '5x', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e']], 'selec1': [['int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec', 'int_selec'], ['5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d', '5d']], 'selec2': [['float_selec', 'float_selec', 'float_selec', 'float_selec', 'float_selec', 'float_selec', 'float_selec', 'float_selec'], ['10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e', '10.3e']], 'short': [['', 'frequency'], ['5x', '2d']], 'simulator': [['simulator'], ['80s']], 'solver': [['type', '', 'z_precond', '', 'o_precond', 'relative_max_iterations', 'closure'], ['1d', '2x', '2s', '3x', '2s', '10.4e', '10.4e']], 'timestep': [['timestep', 'timestep', 'timestep', 'timestep', 'timestep', 'timestep', 'timestep', 'timestep'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']], 'title': [['title'], ['80s']], 'xyz1': [['deg'], ['10.4e']], 'xyz2': [['ntype', '', 'no', 'del'], ['2s', '3x', '5d', '10.4e']], 'xyz3': [['deli', 'deli', 'deli', 'deli', 'deli', 'deli', 'deli', 'deli'], ['10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e', '10.4e']]}, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>}, location=None)[source]
class pytoughreact.writers.react_writing.T2ExtraPrecisionDataParser(filename, mode, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]

Class for parsing AUTOUGH2 extra-precision auxiliary data file.

Parameters:

fixed_format_file (fixed_format_file) – used fir file processing

__init__(filename, mode, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]
class pytoughreact.writers.react_writing.T2React(filename='', meshfilename='', read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]
__init__(filename='', meshfilename='', read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]

Main class for structuring the writing , reading and running of reaction simulations

check_for_executable(executable_name, directory)[source]

Check if the executable exists in the folder.

Parameters:
  • executable_name (str) – name of executable

  • directory (str) – directory that contains executable

Returns:

exception – returns error if executable not found

Return type:

NotFoundError

check_for_thermodynamic_database(directory, t2solute)[source]

Check if the thermodynamic database exists in the folder.

Parameters:
  • t2solute (t2solute) – t2solute class

  • directory (str) – directory that contains thermodynamic database

Returns:

exception – returns error if executable not found

Return type:

NotFoundError

get_present_sections()[source]

Returns a list of TOUGH2 section keywords for which there are corresponding data in the t2react object.

Returns:

parameters – list of present sections

Return type:

list

property present_sections

Returns a list of TOUGH2 section keywords for which there are corresponding data in the t2react object.

Returns:

parameters – list of present sections

Return type:

list

read(filename='', meshfilename='', file_location: str | None = None)[source]

Reads data from file. Mesh data can optionally be read from an auxiliary file. Extra precision data will also be read from an associated ‘.pdat’ file, if it exists.

Reads data from file. Mesh data can optionally be read from an auxiliary file. Extra precision data will also be read from an associated ‘.pdat’ file, if it exists.

Parameters:
  • filename (str) – file to read

  • meshfilename (str) – Mesh file to read

  • file_location (str) – Location where the file is on the local system

read_blocks(infile)[source]

Reads grid blocks

Parameters:

infile (str) – Input file processor

Returns:

parameter – reads block information

Return type:

self

read_connections(infile)[source]

Reads grid connections

read_parameters(infile)[source]

Reads simulation parameters

Parameters:

infile (str) – Input file processor

Returns:

line – read parameters block to grid

Return type:

str

read_rocktypes(infile)[source]

Reads grid rock types

Parameters:

infile (str) – Input file processor

Returns:

rocktype – adds rocktype information to grid

Return type:

self

run(t2solute, save_filename='', incon_filename='', runlocation='', simulator='AUTOUGH2_2', silent=False, output_filename='')[source]

Runs simulation using TOUGH2 ,AUTOUGH2, TOUGHREACT.

Parameters:
  • save_filename (str) – filename of SAVE file

  • incon_filename (str) – filename of INCON file

  • run_location (str) – path to Executable and required files

  • simulator (str) – simulator executable name

  • silent (boolean) – if screen messages should be written out

  • output_filename (str) – name of output listing file (only TOUGH2)

section_insertion_index(section)[source]

Determines an appropriate position to insert the specified section in the internal list of data file sections.

update_read_write_functions()[source]

Updates functions for reading and writing sections of data file.

write(filename='', meshfilename='', runlocation='', extra_precision=None, echo_extra_precision=None)[source]

Writes data to file. Mesh data can optionally be written to an auxiliary file. For AUTOUGH2, if extra_precision is True or a list of section names, the corresponding data sections will be written to an extra precision file; otherwise, the same sections (if any) that were read in as extra precision will also be written out as extra precision. If echo_extra_precision is True, the extra precision sections will also be written to the main data file.

Parameters:
  • filename (str) – file to read

  • meshfilename (str) – Mesh file to read

  • runlocation (str) – Path containing executables

  • extra_precision (boolean) – Required for AUTOUGH from PYTOUGH

  • echo_extra_precision (boolean) – Required for AUTOUGH from PYTOUGH

write_react(outfile)[source]

Writes React Parameters

Parameters:

outfile (str) – output file processor

Solute Writing

class pytoughreact.writers.solute_writing.T2SoluteParser(filename, mode, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]

Class for parsing SOLUTE.INP data file.

__init__(filename, mode, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]
find_minerals(minerals, name)[source]

Get minerals to write

Parameters:
  • minerals (list) – list of all minerals in the CHEMICAL.INP file

  • name (str) – name of the mineral

Returns:

parameter – name and properties of the mineral

Return type:

str

find_primary_aqueous(primary_aqueous, name)[source]

Get minerals to write

Parameters:
  • primary_aqueous (list) – list of all primary aqueous species in the CHEMICAL.INP

  • name (str) – name of the species

Returns:

parameter – name and properties of the primary species

Return type:

str

get_default_chemical_zone_to_nodes()[source]

Get default chemical zone and map to nodes

Returns:

all_values – all default chemical zone mapped to nodes

Return type:

list

get_default_chemical_zones()[source]

Get default chemical zones

Returns:

liner – list of default chemical zones

Return type:

list

get_minerals_to_write(minerals)[source]

Get minerals to write

Parameters:

minerals (list) – list of all minerals in the CHEMICAL.INP

Returns:

all_values – all minerals

Return type:

list

get_nodes_to_read(grid)[source]

Get nodes to read

Parameters:

grid (list) – list containing all grids in the simulatioj

Returns:

output – list of all nodes

Return type:

list

get_primary_species_to_read(primary_aqueous)[source]

Get primary species to read

Parameters:

aqueous (primary) – list of all primary aqueous species

Returns:

all_values – all primary species

Return type:

list

get_printout_options()[source]

Get Printout options in SOLUTE.INP.

Returns:

liner – list of printout options parameters

Return type:

list

get_reactive_constraints()[source]

Get Reactive Constraints in SOLUTE.INP.

Returns:

liner – list of reactive constraints

Return type:

list

get_reactive_options()[source]

Get Reactive Options in SOLUTE.INP.

Returns:

liner – list of reactive options

Return type:

list

get_readio()[source]

Get Read Input Output Options in SOLUTE.INP.

Returns:

all_values – list of Read Input Output

Return type:

list

get_tolerance_values()[source]

Get Tolerance values in SOLUTE.INP.

Returns:

liner – list of tolerance parameters

Return type:

list

get_weight_diffusion()[source]

Get Weight Diffusion in SOLUTE.INP.

Returns:

liner – list of Weight Diffusion parameters

Return type:

list

search_for_node_index(blocks, nodes)[source]

Search for node index

Parameters:
  • blocks (list) – list of all blocks in the simulation

  • nodes (list) – list of all nodes in the simulation

Returns:

indexes – list of all nodes parameters

Return type:

list

class pytoughreact.writers.solute_writing.T2Solute(filename='', meshfilename='', options=None, chemical_zones=None, constraints=None, readio=None, weight_diffusion=None, tolerance=None, printout=None, t2chemical=None, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]

Main class for structuring the writing , reading of solute parameters

__init__(filename='', meshfilename='', options=None, chemical_zones=None, constraints=None, readio=None, weight_diffusion=None, tolerance=None, printout=None, t2chemical=None, read_function={'d': <function value_error_none.<locals>.fn>, 'e': <function value_error_none.<locals>.fn>, 'f': <function value_error_none.<locals>.fn>, 'g': <function value_error_none.<locals>.fn>, 's': <function value_error_none.<locals>.fn>, 'x': <function <lambda>>})[source]

Initialization of Parameters (T2Solute).

Parameters:
  • filename (string) – Name of file to be read from (optional)

  • meshfilename (string) – Name of mesh file to be read from (optional)

  • options (dictionary) –

    Simulation numerical options. Dictionary keys include.

    iteration_scheme : int rsa_newton_raphson: int linear_equation_solver: int activity_coefficient_calculation: int gaseous_species_in_transport: int result_printout: int poro_perm: int co2_h2o_effects: int itds_react: int

    Please refer to TOUGHREACT documentation for details on these properties

  • chemical_zones (dictionary) –

    Simulation printout values. Dictionary keys include.

    IZIWDF: int IZBWDF: int IZMIDF: int IZGSDF: int IZADDF: int IZEXDF: int IZPPDF: int IZKDDF: int IZBGDF: int

    Please refer to TOUGHREACT documentation for details on these properties

  • constraints (dictionary) –

    Simulation numerical constraints. Dictionary keys include.

    skip_saturation : float courant_number: float maximum_ionic_strength: int weighting_factor: int

    Please refer to TOUGHREACT documentation for details on these properties

  • readio (dictionary) –

    Simulation input output values. Dictionary keys include.

    database : string iteration_info: string aqueous_concentration: string minerals: string gas: string time: string

    Please refer to TOUGHREACT documentation for details on these properties

  • weight_diffusion (dictionary) –

    Simulation weight and diffusion values. Dictionary keys include.

    time_weighting : int upstream_weighting: int aqueous_diffusion_coefficient: float gas_diffusion_coefficient: float

    Please refer to TOUGHREACT documentation for details on these properties

  • tolerance (dictionary) –

    Simulation tolerance values. Dictionary keys include.

    maximum_iterations_transport: int transport_tolerance: float maximum_iterations_chemistry: int chemistry_tolerance: float not_used1: float not_used2: float relative_concentration_change: float relative_kinetics_change: float

    Please refer to TOUGHREACT documentation for details on these properties

printoutdictionary

Simulation printout values. Dictionary keys include.

printout_frequency: int number_of_gridblocks: int number_of_chemical_components: int number_of_minerals: int number_of_aqueous: int number_of_surface_complexes: int number_of_exchange_species: int aqueous_unit: int mineral_unit: int gas_unit: int

Please refer to TOUGHREACT documentation for details on these properties

t2chemical: T2Chemical

T2Chemical class to be used in the T2Solute

convert_to_t2solute(keyword)[source]

Get corresponding t2solute keywords

Parameters:

keyword (str) – keyword to convert to t2chemical keyword

Returns:

parameter – converted t2chemical keyword

Return type:

str

generate_zone_to_blocks()[source]

Generate chemical zones in each node/grid.

Returns:

all_blocks – All blocks mapped to zones

Return type:

list

get_boundary_water()[source]

Get Boundary Water Parameters.

Returns:

zone_water – list of all zone water

Return type:

list

get_boundary_water_index()[source]

Get Boundary Water Index.

Returns:

  • key_list (list) – list of all keys

  • value_list (list) – list of all values

get_grid_blocks()[source]

Return name of grid blocks.

Returns:

blk – list of grid blocks

Return type:

list

get_initial_water()[source]

Get Initial Water Parameters.

Returns:

zone_water – list of all zone water

Return type:

list

get_initial_water_index()[source]

Get Initial Water Index.

Returns:

  • key_list (list) – list of all keys

  • value_list (list) – list of all values

get_mineral()[source]

Get Mineral Parameters.

Returns:

mineral_zone – list of all mineral zone

Return type:

list

get_present_sections()[source]

Returns a list of TOUGH2 section keywords for which there are corresponding data in the t2solute object.

Returns:

parameters – list of present sections

Return type:

list

get_zone_value(dict_to_check, value)[source]

Get value of a particular zone

Parameters:
  • dict_to_check (dict) – dictionary that contains zones

  • value (str) – zone to check for

Returns:

zone_number – zone number

Return type:

int

getgrid_info()[source]

Get values for grid including gas, water, minerals, permeability

Returns:

output – grid information

Return type:

list

map_zone_to_blocks(params)[source]

Accurately map zone to blocks in the simulation.

Parameters:
  • params (list) – input parameters

  • Returns

  • --------

property present_sections

Returns a list of TOUGH2 section keywords for which there are corresponding data in the t2solute object.

Returns:

parameters – list of present sections

Return type:

list

read(filename='', meshfilename='', runlocation='', extra_precision=None, echo_extra_precision=None)[source]

Read from simulation file (solute.inp)

Parameters:
  • filename (str) – file to read

  • meshfilename (str) – Mesh file to read

  • runlocation (str) – Path containing executables

  • extra_precision (boolean) – Required for AUTOUGH from PYTOUGH

  • echo_extra_precision (boolean) – Required for AUTOUGH from PYTOUGH

read_adsorption_species(infile)[source]

Reads Adsorption species for which to output concentrations in time and plot files

read_aqueous_species(infile)[source]

Reads aqueous species for which to output concentrations in time and plot files

read_chemical_zones(infile)[source]

Reads default chemical zones in SOLUTE.INP.

Parameters:

infile (str) – Input file processor

Returns:

self – add chemical zones to dict

Return type:

dict

read_chemical_zones_to_nodes(infile)[source]

Reads chemical zones in each node/grid in SOLUTE.INP.

Parameters:

infile (str) – Input file processor

Returns:

self – add chemical zones to dict

Return type:

dict

read_constraints(infile)[source]

Reads simulation constraints in SOLUTE.INP.

Parameters:

infile (str) – Input file processor

Returns:

self – add reactive options to dict

Return type:

dict

read_exchange_species(infile)[source]

Reads Exchange species for which to output concentrations in time and plot files

read_minerals(infile)[source]

Reads minerals for which to output data in time and plot files in SOLUTE.INP.

Parameters:

infile (str) – Input file processor

Returns:

self – add minerals for which to output data in time and plot files to dict

Return type:

dict

read_nodes(infile)[source]

Reads nodes to write to in SOLUTE.INP.

Parameters:

infile (str) – Input file processor

Returns:

self – add nodes to write to dict

Return type:

dict

read_options(infile)[source]

Read Reactive Options in SOLUTE.INP.

Parameters:

infile (str) – Input file processor

Returns:

self – add reactive options to dict

Return type:

dict

read_primary_species(infile)[source]

Reads primary species to output concentrations in time and plot files in SOLUTE.INP.

Parameters:

infile (str) – Input file processor

Returns:

self – add primary species to output concentrations to dict

Return type:

dict

read_printout(infile)[source]

Reads printout_options in SOLUTE.INP.

Parameters:

infile (str) – Input file processor

Returns:

self – add printout_options to dict

Return type:

dict

read_readio(infile)[source]

Reads names of files to write output to in SOLUTE.INP.

Parameters:

infile (str) – Input file processor

Returns:

self – add names of files to write output to dict

Return type:

dict

read_tolerance(infile)[source]

Reads tolerance values in SOLUTE.INP.

Parameters:

infile (str) – Input file processor

Returns:

self – add tolerance values to dict

Return type:

dict

read_weight_diffu(infile)[source]

Reads weighting and diffusion parameters in SOLUTE.INP.

Parameters:

infile (str) – Input file processor

Returns:

self – add weighting and diffusion parameters to dict

Return type:

dict

section_insertion_index(section)[source]

Determines an appropriate position to insert the specified section in the internal list of data file sections.

update_read_write_functions()[source]

Updates functions for reading and writing sections of data file.

write(filename='', meshfilename='', runlocation='', extra_precision=None, echo_extra_precision=None)[source]

Write to simulation file (solute.inp).

Parameters:
  • filename (str) – file to read

  • meshfilename (str) – Mesh file to read

  • runlocation (str) – Path containing executables

  • extra_precision (boolean) – Required for AUTOUGH from PYTOUGH

  • echo_extra_precision (boolean) – Required for AUTOUGH from PYTOUGH

write_adsorption_species(outfile)[source]

Writes Adsorption species for which to output concentrations in time and plot files

Parameters:

outfile (str) – output file processor

write_aqueous_species(outfile)[source]

Writes aqueous species for which to output concentrations in time and plot files

Parameters:

outfile (str) – output file processor

write_chemical_zones(outfile)[source]

Writes default chemical zones

Parameters:

outfile (str) – output file processor

write_chemical_zones_to_nodes(outfile)[source]

Write chemical zones in each node/grid

Parameters:

outfile (str) – output file processor

write_constraints(outfile)[source]

Writes simulation constraints

Parameters:

outfile (str) – output file processor

write_exchange_species(outfile)[source]

Writes Exchange species for which to output concentrations in time and plot files

Parameters:

outfile (str) – output file processor

write_minerals(outfile)[source]

Writes minerals for which to output data in time and plot files

Parameters:

outfile (str) – output file processor

write_nodes(outfile)[source]

Writes nodes to write to

Parameters:

outfile (str) – output file processor

write_options(outfile)[source]

Writes reaction options

Parameters:

outfile (str) – output file processor

write_primary_species(outfile)[source]

Writes primary species to output concentrations in time and plot files

Parameters:

outfile (str) – output file processor

write_printout(outfile)[source]

Writes printout_options

Parameters:

outfile (str) – output file processor

write_readio(outfile)[source]

Writes names of files to write output to

Parameters:

outfile (str) – output file processor

write_title(outfile)[source]

Write Title of Solute file (solute.inp)

Parameters:

outfile (str) – output file processor

write_tolerance(outfile)[source]

Writes tolerance values

Parameters:

outfile (str) – output file processor

write_weight_diffu(outfile)[source]

Writes weighting and diffusion parameters

Parameters:

outfile (str) – output file processor