gener¶
- gener.create_well_flow(flow_times, input_dictionary, include_gener=True)[source]¶
It creates a mh text file for every well on the input dictionary. These wells need to have been defined on the general input_dictionary before the mesh was created
- Parameters
flow_times (dictionary) – e.g. ‘WELL-1’ : [[datetime(2029,1,1,0,0,0),datetime(2080,1,1,0,0,0)] #Initial day of operation , [1.5,1.5] #Steam value for every time step, [15,15]#Brine value for every time step, [1100,1100] #Flowing enthalpy value for every time step , [7,7] #WHP, ‘P’ #P for producer and I for injector],
include_gener (bool) – If True it creates a file GENER_MAKEUP, from which the wells define on this section can be included on the TOUGH2 input file and the data from newly generated file is added/overwritten to the sqlite databse
input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file
- Returns
file – {well}_mh.dat: it contains the dictionary information on a text file format
file – GENER_MAKEUP: on ../model/t2/t2/SOURCES
Note
This function can be use to generate production scenarios on a calibrated model
- gener.def_gener_selector(block, key, geners)[source]¶
If gener block is not completely define, the default value is use
- Parameters
block (str) – Referes to the mesh
key (str) – Referes to a GENER parameters
geners (dictionary) – Contains the neccesary information to define a sink/source. g.e. ‘DA110’:{‘SL’:’GEN’,’NS’:10,’TYPE’:’MASS’,’GX’:1,’EX’:1.1E6},
- Returns
value – float: the selecte value for a parameter
def_value – bool: if True the default value is used
Attention
No data is needed from sqlite
- gener.plot_makeup_wells(flow_times)[source]¶
It plots a defined scenario of production including injector wells
- Parameters
flow_times (dictionary) – e.g. ‘WELL-1’ : [[datetime(2029,1,1,0,0,0),datetime(2080,1,1,0,0,0)] #Initial day of operation , [1.5,1.5] #Steam value for every time step, [15,15]#Brine value for every time step, [1100,1100] #Flowing enthalpy value for every time step , [7,7] #WHP, ‘P’ #P for producer and I for injector],
- Returns
wells_flow: horizontal histogram
- Return type
plot
Attention
No data is needed from sqlite
- gener.splitting_gener(input_dictionary, info, source_i)[source]¶
It splits and prints the GENER definition of a given SOURCE
- Parameters
input_dictionary (dictionary) – Contains the name of the TOUGH2 input file
info (dictionary) –
- Contains as a key the source name and an array with the period ranges as datetimes, e.g.:
’SRC69’:{1: [datetime(1970,1,1,0,0,0),datetime(2010,1,1,0,0,0)],2: [datetime(2010,1,1,0,0,0),datetime(2100,1,1,0,0,0)],}
source_i (str) – Source name to be split
- Returns
A printout of the splited gener over time
- Return type
str
Attention
It has to be manually updated to the gener section
- gener.write_gener_from_sqlite(type_flow, input_dictionary, make_up=False, def_inj_T=None, min_days=0.5, time_between_months=120)[source]¶
It is the main function on this module, it writes the GENER section from the mh input files
- Parameters
input_dictionary (dictionary) – Dictionary containing the path and name of database, the reference date on datime format and TOUGH2 version under the key t2_ver, if lower than 7, conventional 4 columns for GENER is used. For 7 or higher, DATES are used.
wells (array) – Wells to be included
type_flow (str) – It defines the type of flow on the well. ‘constant’ adds a zero flow before the start of well production at -infinity and keeps the value of the flow to the infinity, ‘shutdown’ closes the well after the last record, ‘invariable’ ‘invariable’ writes the GENER section for every well as it is written on the input file
make_up (bool) – If True the output file is written on GENER_MAKEUP. Otherwise, on GENER_PROD
def_inj_T (dictionary) – Defines the default temperature for the injector wells when there is no flowing enthalpy provided.
- Returns
GENER_PROD: a text file on ‘../model/t2/sources/’
- Return type
file
Attention
All the information comes from the sqlite databse. If there are some other sources or sinks define with the prefix SRC, they should be written first on the database by executing write_geners_to_txt_and_sqlite(). Thus, the next correlatative will be +1 for the first well
Examples
>>> write_gener_from_sqlite(input_dictionary,type_flow='constant')
- gener.write_geners_to_txt_and_sqlite(input_dictionary, geners)[source]¶
It writes the GENER section for the constant sink/sources from the model on a text file and at the sqlite database
- Parameters
input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file
geners (dictionary) – Contains the neccesary information to define every constant sink/source on the model. g.e.’DA110’:{‘SL’:’GEN’,’NS’:10,’TYPE’:’MASS’,’GX’:1,’EX’:1.1E6}
- Returns
GENER_SOURCES: text file on ‘../model/t2/sources/GENER_SOURCES’
- Return type
file
Attention
Every time the function is executed it overwrites the file
Examples
>>> write_geners_to_txt_and_sqlite(input_dictionary,geners)
- gener.write_t2_format_gener(var_array, time_array, var_type, var_enthalpy, type_flow, input_dictionary)[source]¶
It generates the block of time, flow and enthalpy for each flow
- Parameters
var_array (array) – Contains the flow data
time_array (array) – Contains the time data on datetime format
input_dictionary (dictionary) – It contains the reference date on datatime format
var_type (str) – It indicates the type of well producer ‘R’ or injector ‘R’
var_enthalpy (array) – Contains the flowing enthalpy data
type_flow (str) – It defines the type of flow on the well. ‘constant’ adds a zero flow before the start of well production at -infinity and keeps the value of the flow to the infinity, ‘shutdown’ closes the well after the last record, ‘invariable’ ‘invariable’ writes the GENER section for every well as it is written on the input file
- Returns
str – string_P: contains the defined format for the GENER section for a particular producer well.
str – string_R : contains the defined format for the GENER section for a particular injector well.
int – cnt_P : defines the number of flows records on every string_P for each producer well
int – cnt_R : defines the number of flows records on every string_R for each injector well
Attention
The legth of var_array, time_array and var_enthalpy must be the same
Note
For every well a value of flow zero is set on time -1E50 and before the first record. This function is used by write_gener_from_sqlite() as it does not produce any output file by itself.
- gener.write_t2_format_gener_dates(var_array, time_array, var_type, var_enthalpy, type_flow, def_T, min_days, time_between_months)[source]¶
It generates the block of time, flow and enthalpy for each flow on datetime format
- Parameters
var_array (array) – Contains the flow data
time_array (array) – Contains the time data on datetime format
var_type (str) – It indicates the type of well producer ‘R’ or injector ‘R’
var_enthalpy (array) – Contains the flowing enthalpy data
type_flow (str) – It defines the type of flow on the well. ‘constant’ adds a zero flow before the start of well production at -infinity and keeps the value of the flow to the infinity, ‘shutdown’ closes the well after the last record, ‘invariable’ ‘invariable’ writes the GENER section for every well as it is written on the input file
def_T (flot) – Default temperature value for injector wells with no flowing enthalpy provided.
- Returns
str – string_P: contains the defined format for the GENER section for a particular producer well.
str – string_R : contains the defined format for the GENER section for a particular injector well.
int – cnt_P : defines the number of flows records on every string_P for each producer well
int – cnt_R : defines the number of flows records on every string_R for each injector well
Attention
The legth of var_array, time_array and var_enthalpy must be the same
Note
For every well a value of flow zero is set on time -infinity and before the first record. This function is used by the function write_gener_from_sqlite() as it does not produce any output file by itself.