ogstools.feflowlib.tools module#

class ogstools.feflowlib.tools.helpFormat[source]#

Bases: ArgumentDefaultsHelpFormatter, RawTextHelpFormatter

A helper class for passing the correct format for the CLI arguments.

ogstools.feflowlib.tools.get_specific_surface(surface_mesh, filter_condition)[source]#

Return only cells that match the filter condition for the normals of the input-surface mesh. A standard use case could be to extract the cells that have a normal in a particular direction, e.g. upward in the z-direction. The filter condition would then be: lambda normals: normals[:, 2] > 0.

Parameters:
  • surface_mesh (pyvista.PolyData) – The surface mesh.

  • filter_condition (Callable [[list], [list]]) – A condition to set up the filter for the normals.

Returns:

specific_cells

Return type:

pyvista.UnstructuredGird

ogstools.feflowlib.tools.assign_bulk_ids(mesh)[source]#

Add fields bulk_node_ids and bulk_element_ids to the given bulk mesh.

Parameters:
  • mesh_name (str) – name of the mesh

  • mesh (UnstructuredGrid) –

ogstools.feflowlib.tools.extract_point_boundary_conditions(out_mesh_path, mesh)[source]#

Returns the point boundary conditions of the mesh. It works by iterating all point data and looking for data arrays that include the string “_BC”. Depending on what follows, it defines the boundary condition type.

Parameters:
  • out_mesh_path (Path) – path of the output mesh

  • mesh (pyvista.UnstructuredGrid) – mesh

Returns:

dict_of_point_boundary_conditions

Return type:

dict

ogstools.feflowlib.tools.write_point_boundary_conditions(out_mesh_path, mesh)[source]#

Writes the point boundary conditions that are returned from ‘extract_point_boundary_conditions()’

Parameters:
  • out_mesh_path (Path) – path for writing

  • mesh (pyvista.UnstructuredGrid) – mesh

ogstools.feflowlib.tools.extract_cell_boundary_conditions(bulk_mesh_path, mesh)[source]#

Returns the cell boundary conditions of the mesh. It works by iterating all cell data and looking for data arrays that include the strings “P_SOUF” or “P_IOFLOW”. +++WARNING+++: This function still in a experimental state since it is not clear how exactly this function will be used in the future. TODO: Allow a generic definition of the normal vector for the filter condition.

Parameters:
  • bulk_mesh_path (Path) – name of the mesh

  • mesh (pyvista.UnstructuredGrid) – mesh

Returns:

path with name of mesh, topsurface mesh with cell boundary conditions

Return type:

tuple

ogstools.feflowlib.tools.get_material_properties(mesh, property)[source]#

Get the material properties of the mesh converted from FEFLOW. There are several methods available to access the material properties. Either they are accessible with the FEFLOW API(ifm) or with brute-force methods, which check each element, like this function.

Parameters:
  • mesh (pyvista.UnstructuredGrid) – mesh

  • property (str) – property

Returns:

material_properties

Return type:

dict

ogstools.feflowlib.tools.combine_material_properties(mesh, properties_list)[source]#

Combine multiple material properties. The combined properties are returned as list of values in a dictionary.

Parameters:
  • mesh (pyvista.UnstructuredGrid) – mesh

  • properties_list (list) – list of properties to be combined

Returns:

material_properties

Return type:

collections.defaultdict

ogstools.feflowlib.tools.write_mesh_of_combined_properties(mesh, property_list, new_property, material_id, saving_path)[source]#

Writes a separate mesh-file with a specific material that has inhomogeneous property values within the material group. It can also be used to write multiple properties into a “new property” data array. For example, write a data array for a tensor defined by data arrays representing values of different spatial directions. Nevertheless it can still be be used to write the inhomogeneous values of a single property into a separate mesh-file.

Parameters:
  • mesh (pyvista.UnstructuredGrid) – mesh

  • property_list (list) – list of properties

  • new_property (str) – name of the combined properties

  • material (int) – material with inhomogeneous properties

  • saving_path (Path) – path to save the mesh

  • material_id (int) –

Returns:

filename

Return type:

str

ogstools.feflowlib.tools.materials_in_steady_state_diffusion(material_properties, model)[source]#

Create the section for material properties for steady state diffusion processes in the prj-file.

Parameters:
  • bulk_mesh_path (Path) – path of bulk mesh

  • mesh (pyvista.UnstructuredGrid) – mesh

  • material_properties (dict) – material properties

  • model (ogs6py.OGS) – model to setup prj-file

Returns:

model

Return type:

ogs6py.OGS

ogstools.feflowlib.tools.materials_in_liquid_flow(material_properties, model)[source]#

Create the section for material properties in liquid flow processes in the prj-file.

Parameters:
  • bulk_mesh_path (Path) – path of bulk mesh

  • mesh (pyvista.UnstructuredGrid) – mesh

  • material_properties (dict) – material properties

  • model (ogs6py.OGS) – model to setup prj-file

Returns:

model

Return type:

ogs6py.OGS

ogstools.feflowlib.tools.setup_prj_file(bulk_mesh_path, mesh, material_properties, process, model=None)[source]#

Sets up a prj-file for ogs simulations using ogs6py.

Parameters:
  • bulk_mesh_path (Path) – path of bulk mesh

  • mesh (pyvista.UnstructuredGrid) – mesh

  • material_properties (dict) – material properties

  • process (str) – the process to be prepared

  • model (ogs6py.OGS) – model to setup prj-file

Returns:

model

Return type:

ogs6py.OGS

ogstools.feflowlib.tools.deactivate_cells(mesh)[source]#

Multiplies the MaterialID of all cells that are inactive in FEFLOW by -1. Therefore, the input mesh is modified. :param mesh: mesh :type mesh: pyvista.UnstructuredGrid :return: 0 for no cells have been deactivated and 1 for cells have been deactivated :rytpe: int

Parameters:

mesh (UnstructuredGrid) –