output

output.PTjson_to_sqlite(input_dictionary, source='t2')[source]

It stores the defined json file into the database on the table t2PTout

Parameters
  • source (str) – It can be ‘t2’ or ‘sav’

  • input_dictionary (dictionary) – Dictionary contaning the path and name of database on keyword ‘db_path’.

Examples

>>> PTjson_to_sqlite("t2")
output.eleme_CSV(input_dictionary, path=None, cutoff_time=1e+50)[source]
It generates an output file for every element of every well. It is one of the most computationally demanding functions.

It expects to read the output from either TOUGH2_eleme.csv or TOUGH2_XYZ.csv files.

Parameters
  • input_dictionary (dictionary) – Dictionary contaning the path and name of database on keyword ‘db_path’ and the TOUGH2 file name.

  • path (str) – In case a the output file is in a different location. Such as a server.

  • cutoff_time (float) – Max time to storage

Returns

{well}_PT_evol.dat : on ../output/PT/evol for every well

Return type

files

output.extract_csv_from_t2out(json_output=False)[source]

It writes the parameter for every block from the last output file of TOUGH2 simulation on csv or json

Parameters

json_output (bool) – If True a json file is save on ../output/PT/json/

Returns

PT.csv: on ../output/PT/csv/

Return type

file

Attention

The file ELEME.json needs to be updated

output.flowell(input_dictionary, init_values=100000)[source]

It extracts from the conventional TOUGH2 output file the FLOWELL data for every well.

Parameters
  • input_dictionary (dictionary) – Dictionary contaning the path and name of database on keyword ‘db_path’, the specified layers and the reference date

  • init_values (int) – Number of possible number initial values for FLOWELL output.

Returns

flowell.json: at output/

Return type

File

output.from_sav_to_json(sav_version='sav1')[source]

It writes a json file with temperature and pressure data from the specified .sav for every block including coordinates

Parameters

sav_version (str) – Extension of sav file, i.e. sav, sav1, sav2, etc.

Returns

PT_json_from_sav.txt : on ../output/PT/json/

Return type

file

Attention

The ELEME.json file needs to be updated

Examples

>>> from_sav_to_json(sav_version='sav1')
output.gen_evol(input_dictionary)[source]

It generates an output file containing flow and flowing enthalpy for each GEN element. As a convention the library it is suggested to use GEN for any source/sink that is not a well

Parameters

input_dictionary (dictionary) – Dictionary contaning the path and name of database on keyword ‘db_path’.

Returns

{GEN}_{BLOCK}_{NICKNAME}.txt : on ../output/mh/txt

Return type

file

output.it2COF(input_dictionary)[source]

Extracts the COF value for each block on the OBSERVATION section of the inverse file

Parameters

input_dictionary (dictionary) – Contains the name of the iTOUGH2 file

Returns

COF_PT.json: on the output/PT/json/ folder

Return type

file

Attention

It might changed based on the iTOUGH2 version

Examples

>>> it2COF(input_dictionary)
output.it2DATASET(input_dictionary)[source]

Extracts the OBSERVATION dataset on the the inverse file

Parameters

input_dictionary (dictionary) – Contains the name of the iTOUGH2 file

Returns

it2_PT.json: on the output/PT/json/ folder

Return type

file

Attention

It might changed based on the iTOUGH2 version

Examples

>>> it2DATASET(input_dictionary)
output.it2OBJF(input_dictionary)[source]

Extracts the value of the objective function from the output inverse file and append it with the current time

Parameters

input_dictionary (dictionary) – Contains the name of the iTOUGH2 file

Returns

OBJ.json: on the output/PT/json/ folder

Return type

file

Attention

It might changed based on the iTOUGH2 version

Examples

>>> it2OBJF(input_dictionary)
output.power(input_dictionary, WHP)[source]

When all the well feedzones are declare as MASS type in the TOUGH2 input file, this functions estimates the power generation based on the assumption of an isoenthalpic expansion from the feedzone to the wellhead.

Parameters
  • input_dictionary (dictionary) – Dictionary contaning the path and name of database on keyword ‘db_path’

  • WHP (dictionary) – Using the structure: ‘well’:[WHP, ESC, ‘unit’, ‘masstype’]. masstype could be either MASS or FLOWELL

Returns

units_power.csv: in output/

Return type

File

output.power_from_flowell(input_dictionary, WHP, exceptions)[source]

When all the well feedzones are declare as MASS and FLOWELL type in the TOUGH2 input file, this functions estimates the power generation based on the assumption of an isoenthalpic expansion from the feedzone to the wellhead for the MASS type and takes directly the steam saturation at the wellhead when it comes from FLOWELL.

Parameters
  • input_dictionary (dictionary) – Dictionary contaning the path and name of database on keyword ‘db_path’

  • WHP (dictionary) – Using the structure: ‘well’:[WHP, ESC, ‘unit’, ‘masstype’]. masstype could be either MASS or FLOWELL

  • exceptions (list) – List of sources listed as FLOWELL than will be treated as MASS. It occurs when just one period from the wells are calibrate with FLOWELL.

Returns

units_power_flowell.csv: in output/

Return type

File

Attention

Functions src_csv() and eleme_CSV() should be ran before executing this function

output.power_i(Px, hx, mx, ESC, atm_p=0.092)[source]

It calculates an stimated power output and steam saturation, based on a isoenthalpic expansion

Parameters
  • Px (float) – Assumed wellhead pressure

  • hx (float) – Flowing enthalpy pressure

  • mx (float) – Mass flow rate

  • ESC (float) – Assumed specific steam consumption

  • atm_p (float) – Atmosphere presure in bar

Returns

[power, saturation]

Return type

array

output.src_csv(input_dictionary, path=None, type_source='SRC')[source]
It generates an output file containing flow and flowing enthalpy for each sources listed in the GENER section in the TOUGH2 input file..

It expects to read the TOUGH2_gener.csv file

Parameters
  • input_dictionary (dictionary) – Dictionary contaning the path and name of database on keyword ‘db_path’ and the TOUGH2 file name.

  • path (str) – In case a the output file is in a different location. Such as a server.

  • type_source (str) – Either SRC or GEN

Returns

{SOURCE}_{BLOCK}_{NICKNAME}.txt : on ../output/mh/txt for every source

Return type

files

output.src_evol(input_dictionary)[source]

It generates an output file containing flow and flowing enthalpy for each SRC element. As a convention the library it is suggested to use SRC for any source/sink that is a well

Parameters

input_dictionary (dictionary) – Dictionary contaning the path and name of database on keyword ‘db_path’.

Returns

{GEN}_{BLOCK}_{NICKNAME}.txt : on ../output/mh/txt

Return type

file

output.t2_CSV_to_json(input_dictionary, itime=None, all_times=False, path=None, num=None, output_times=220)[source]
It creates severals or a single json file from the output file from the TOUGH2 run. Each of them for diffent output times.

It expects to read the output from either TOUGH2_eleme.csv or TOUGH2_XYZ.csv files.

Parameters
  • itime (float) – It defines a time at which a the parameters from the blocks are extracted into json file. Must be on the same units as the TOUGH2 output files (days, seconds, etc.)

  • path (str) – In case a the output file is in a different location. Such as a server.

  • input_dictionary (dictionary) – Dictionary contaning the TOUGH2 file name.

  • all_times (bool) – If True it saves all the output times (It does not consider itime). If False, it considers itime.

  • output_times (int) – It is an stimation of the number of output times in the TOUGH2 file. Due to its large runtime it has not been implemented, in Linux the command: grep ‘TIMES’ {T2_output_file.csv} | wl -c, would give the right number

  • num (int) – Based on a linear spacing it gives the number of output_times that would be store. If None it will store every output time.

Returns

t2_ouput_{time}.json: on ../output/PT/json/evol/

Return type

files

Attention

When t2_output is saved, the large could be too large for the system to handle it. The file mesh/ELEME.json has to be created

output.t2_to_json(itime=None, save_full=False)[source]

It creates a severals or a single json file from the output file from the TOUGH2 run

Parameters
  • itime (float) – It defines a time at which a the parameters from the blocks are extracted into json file. Must be on the same units as the TOUGH2 output files (days, seconds, etc.)

  • save_full (bool) – If True it creates a single output json file

Returns

  • files – t2_ouput_{time}.json: on ../output/PT/json/evol/

  • file – t2_output: on ../output/PT/json/

Attention

When t2_output is saved, the large could be too large for the system to handle it

Examples

>>> t2_to_json()
output.total_enthalpy(wells)[source]

It creates an output file containing the weighted flowing enthalpy from the producing wells.

Parameters

wells (list) – Contains the producer wells included in the calculation.

Returns

total_prod_mh.csv: in input/mh/

Return type

files

Attention

Each file has to be previously storage. It does a forward fill, since it is necessary to have one value at least per day for every well.

output.write_PT_from_t2output(input_dictionary)[source]

It writes the parameter for every block from every well from the last output file of TOUGH2 simulation

Parameters

input_dictionary (dictionary) – Dictionary contaning the path and name of database on keyword ‘db_path’, list of wells under the keywords ‘WELLS’, ‘MAKE_UP_WELLS’ and ‘NOT_PRODUCING_WELL’

Returns

{well_name}_PT.txt: file containing the information for every block from every well

Return type

file

Attention

The layers and well block need to be on the databse

Examples

>>> write_PT_from_t2output(input_dictionary)
output.write_PT_from_t2output_from_prod(input_dictionary, sav_version='sav1')[source]

It writes a pressure and temperature comming from block on every well in the specified .sav file.

Parameters
  • input_dictionary (dictionary) – Dictionary contaning the path and name of database on keyword ‘db_path’.

  • sav_version (str) – Extension of sav file, i.e. sav, sav1, sav2, etc.

Returns

{well_name}_PT.txt: it contains the pressure and temperature information for every well

Return type

file

output.write_PT_of_wells_from_t2output_in_time(input_dictionary)[source]

It generates file containing the evolution of every block on every well

Extrae la evolucion de los bloques relacionados de todos los pozos en la direccion “../output/PT/evol”

Parameters

input_dictionary (dictionary) – Dictionary contaning the path and name of database on keyword ‘db_path’, list of wells under the keywords ‘WELLS’, ‘MAKE_UP_WELLS’ and ‘NOT_PRODUCING_WELL’

Returns

{well}_PT_{layer}.txt : on ../output/PT/evol

Return type

file

Examples

>>> write_PT_of_wells_from_t2output_in_time(input_dictionary)