pyopmnearwell.utils.writefile module

Utility functions for necessary files and variables to run OPM Flow.

pyopmnearwell.utils.writefile.compact_format(values)

Use the ‘n*x’ notation to write repited values to save storage

Parameters:

values (list) – List with the variable values

Returns:

List with the compacted variable values

Return type:

values (list)

pyopmnearwell.utils.writefile.create_3dgrid(dic)

Function to handle the first part of the 3d grids

Parameters:

dic (dict) – Global dictionary with required parameters

Returns:

Global dictionary with new added parameters

Return type:

dic (dict)

pyopmnearwell.utils.writefile.d3_grids(dic, dxarray)

Function to handle the second part of the 3d grids

Parameters:
  • dic (dict) – Global dictionary with required parameters

  • dxarray (list) – String with the size of the grid cells

Returns:

Global dictionary with new added parameters

Return type:

dic (dict)

pyopmnearwell.utils.writefile.get_2dgrid(dic)

Function to create the 2D corner-point grid

Parameters:

dic (dict) – Global dictionary with required parameters

Returns:

Global dictionary with new added parameters

Return type:

dic (dict)

pyopmnearwell.utils.writefile.get_spaces(dic)

Improve the format of the files by aligning the values

Parameters:

dic (dict) – Global dictionary with required parameters

pyopmnearwell.utils.writefile.handle_core(dic)

Function to handle the core geometry

Parameters:

dic (dict) – Global dictionary with required parameters

Returns:

Global dictionary with new added parameters

Return type:

dic (dict)

pyopmnearwell.utils.writefile.manage_grid(dic)

Function to handle the grid

Parameters:

dic (dict) – Global dictionary with required parameters

Returns:

Global dictionary with new added parameters

Return type:

dic (dict)

pyopmnearwell.utils.writefile.manage_sections(dic)

Function to write the include files in the input deck

Parameters:

dic (dict) – Global dictionary with required parameters

pyopmnearwell.utils.writefile.manage_tables(dic)

Function to write the saturation function tables

Parameters:

dic (dict) – Global dictionary with required parameters

pyopmnearwell.utils.writefile.map_zcords(dic)

Generate the z array with the grid face locations

pyopmnearwell.utils.writefile.reservoir_files(dic, **kwargs)

Write OPM-related files by running Mako templates.

Parameters:
  • dic (dict) – Global dictionary with required parameters

  • **kwargs

    Possible kwargs are:

    • recalc_grid (bool): Whether to recalculate the GRID.INC file. Intended for ensemble runs, where the saturation functions/geography/etc. do not need to be recalculated for each ensemble member. Defaults to True.

    • recalc_tables (bool): Whether to recalculate the TABLES.INC file. Defaults to True.

    • recalc_sections (bool): Whether to recalculate the GEOLOGY.INC and FLUXNUM.INC files. Defaults to True.

    • inc_folder (pathlib.Path): If any of the mentioned files is not recalculated, they are taken from this folder. Defaults to pathlib.Path("").

Note

  • All of the recalc_* options only work for co2store no_disgas_no_diffusion on a cake grid so far.

  • For other models or grids there will be errors.

Returns:

Global dictionary with new added parameters

Return type:

dic (dict)