writer¶
- writer.COFT_writer(input_dictionary)[source]¶
“It wraps up the section COFT
- Returns
output: contains the COFT section
- Return type
str
- writer.CONNE_adder(input_dictionary)[source]¶
“It takes the CONNE file from ../model/t2/sources and print it as a string
- Returns
string : string containing the CONNE section
- Return type
str
- writer.CONNE_from_steinar_to_t2()[source]¶
It takes the CONNE file from steinar and convertir into a CONNE TOUGH2 section (the vertical connections are affected by -1)
- Returns
CONNE: on ../model/t2/sources/
- Return type
file
Attention
Comparing with steinar CONNE format the column width changes with the standard TOUGH2 input file
Examples
>>> CONNE_from_steinar_to_t2()
- writer.ELEME_adder(input_dictionary)[source]¶
“It takes the ELEME file from ../model/t2/sources and print it as a string
- Returns
string : string containing the ELEME section
- Return type
str
- writer.FCG_file_checker(name)[source]¶
Evaluate if the the file defining the FOFT, COFT or GOFT section exits or if it contains more than 100 lines
- Parameters
name (str) – Name of the file to check
Note
Print messages are expected
- Returns
str – string : string containing 100 lines of the selected file
bool – isfile : True if the file exits
- writer.FOFT_writer(input_dictionary)[source]¶
“It wraps up the section FOFT
- Returns
output: contains the FOFT section
- Return type
str
- writer.GENER_adder(input_dictionary)[source]¶
“It takes all the GENER section created depending on the type of run production or natural defined on the input dictionary
- Parameters
input_dictionary (dictionary) – Dictionary specficing the type of run
- Returns
string : string containing the GENER section
- Return type
str
- writer.GOFT_writer(input_dictionary)[source]¶
“It wraps up the section COFT
- Returns
output: contains the COFT section
- Return type
str
- writer.MOMOP_writer(input_dictionary)[source]¶
Return the MOMOP section
- Parameters
input_dictionary (dictionary) – Dictionary with the defined MOMOP information
- Returns
string : string containing MOMOP section
- Return type
str
- writer.MULTI_writer(input_dictionary)[source]¶
“It wraps up the section MULTI
- Parameters
input_dictionary (dictionary) – Dictionary containing the MULTI information
- Returns
output: contains the MULTI section
- Return type
str
- writer.OUTPU_writer(input_dictionary)[source]¶
“It writes the OUTPU of TOUGH2 file
- Parameters
input_dictionary (dictionary) – Dictionary containing the OUTPU information
- Returns
output: contains the OUTPU section
- Return type
str
Examples
‘OUTPU’:{‘FORMAT’:[‘CSV’],’ELEMENT_RELATED’:{‘ENTHALPY’:[1],’SECONDARY’:[1,5]},’CONNECTION_RELATED’:{‘FLOW’:[1,2],},’GENER_RELATED’:{‘GENERATION’:[None],’FRACTIONAL FLOW’:[1]}}
- writer.PARAM_writer(input_dictionary)[source]¶
Return the PARAM section
- Parameters
input_dictionary (dictionary) – Dictionary with the defined parameter information
- Returns
string : string containing PARAM section
- Return type
str
- writer.ROCKS_writer(input_dictionary)[source]¶
Return the ROCKS section
- Parameters
input_dictionary (dictionary) – Dictionary with the defined parameter information
- Returns
string : string containing ROCKS section
- Return type
str
Examples
Dictionary example:
input_data={'ROCKS':{ 'ROCK1':{ 'MAT':'ROCK1', 'DROK':2.65E3, 'POR':0.1, 'CWET':2.1, 'SPHT':850, 'PER_X':1E-15, 'PER_Y':1E-15, 'PER_Z':1E-15, }, } }
- writer.RPCAP_writer(input_dictionary)[source]¶
“It wraps up the section RPCAP
- Parameters
input_dictionary (dictionary) – Dictionary containing the RPCAP information
- Returns
output: contains the RPCAP section
- Return type
str
- writer.SOLVR_writer(input_dictionary)[source]¶
“It wraps up the section SOLVR
- Returns
output: contains the SOLVR section
- Return type
str
- writer.TIMES_writer(input_dictionary)[source]¶
Return the TIMES section
- Parameters
input_dictionary (dictionary) – Dictionary with the defined TIMES information
- Returns
string : string containing the TIMES section
- Return type
str
- writer.TITLE_writer(input_dictionary)[source]¶
“It writes the TITLE of TOUGH2 file
- Parameters
input_dictionary (dictionary) – Dictionary containing the TITLE information
- Returns
output: contains the TITLE section
- Return type
str
- writer.converter(value, format_t2, def_value)[source]¶
Returns the input value on the specified format
- Parameters
value (float-str) – Parameter to be written
format_t2 (dictionary) – Contains the format and default values for every variable
def_value (bool) – True in case the default values is used
Note
format_t2 comes from the file formats.py. In case a new type of section is included, the variable name needs to be specified on the file
- writer.def_value_selector(section, key, input_dictionary, rocks=False)[source]¶
Evaluate if the necessary parameter has been defined on the input file
- Parameters
section (str) – Section from TOUGH2 file such as PARAMETER, RPCAP, etc.
key (str) – Parameter to evaluate
input_dictionary (dictionary) – Dictionary with the defined input information
- writer.diff_seconds(ref, date)[source]¶
Return the difference in seconds
- Parameters
ref (datetime) – Model’s reference time
date (datetime) – An arbitrary time
- Returns
diff_seconds : difference in seconds
- Return type
int
- writer.merge_ELEME_and_in_to_t2()[source]¶
It takes the ELEME file from the steinar directory and convert it into a TOUGH2 format with coordinates
- Returns
ELEME: section from TOUGH2 file
- Return type
file
Attention
It adds the head of the section.
Examples
>>> merge_ELEME_and_in_to_t2()
- writer.source_to_GOFT(input_dictionary)[source]¶
“It creates the GOFT section base on the well feedzone position nickname
- Parameters
input_dictionary (dictionary) – Dictionary with the data base location information
- Returns
GOFT: on ../model/t2/sources
- Return type
file
Examples
>>> source_to_GOFT(input_dictionary)
- writer.t2_input(include_FOFT, include_SOLVR, include_COFT, include_GOFT, include_RPCAP, include_MULTI, include_START, include_TIMES, include_OUTPU, include_MOMOP, input_dictionary)[source]¶
“It creates the FOFT section base on the well feedzone position
- Parameters
input_dictionary (dictionary) – Dictionary with all the necessary information to define a model
include_FOFT (bool) – If true includes the FOFT section on the TOUGH2 file
include_SOLVR (bool) – If true includes the SOLVR section on the TOUGH2 file
include_COFT (bool) – If true includes the COFT section on the TOUGH2 file
include_GOFT (bool) – If true includes the GOFT section on the TOUGH2 file
include_RPCAP (bool) – If true includes the RPCAP section on the TOUGH2 file
include_MULTI (bool) – If true includes the MULTI section on the TOUGH2 file
include_START (bool) – If true includes the START sentence is added on the top of PARAM section
include_OUTPU (bool) – If true includes the OUTPU section on the TOUGH2 file
include_TIMES (bool) – If true includes the TIMES section on the TOUGH2 file
include_MOMOP (bool) – If true includes the MOMOP section on the TOUGH2 file
- Returns
t2: on ../model/t2/t2
- Return type
file
Examples
>>> t2_input(input_dictionary,include_FOFT=True,include_SOLVR=True,include_COFT=False,include_GOFT=True,include_RPCAP=False,include_MULTI=True,include_START=True,include_MOMOP=True,include_OUTPU=True)
- writer.well_sources_to_FOFT(input_dictionary, wells)[source]¶
“It creates the FOFT section base on the well feedzone position
- Parameters
input_dictionary (dictionary) – Dictionary with the data base location information
wells (list) – Wells to include on the FOFT section
- Returns
FOFT: on ../model/t2/sources
- Return type
file
Examples
>>> well_sources_to_FOFT(input_dictionary)
- writer.wells_track_blocks_to_FOFT(input_dictionary, wells)[source]¶
It creates the FOFT section base on the well track
- Parameters
input_dictionary (dictionary) – Dictionary with the data base location information
wells (list) – Wells to include on the FOFT section
- Returns
FOFT: on ../model/t2/sources
- Return type
file
Attention
This function could have more than 100 elements depending on the number of layers and wells defined. For TOUGH2 6.x it is preffereable to use well_sources_to_FOFT
Examples
>>> wells_track_blocks_to_FOFT(input_dictionary)