ogstools.feflowlib package#

ogstools.feflowlib.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 (UnstructuredGrid) – mesh

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

Returns:

material_properties

Return type:

defaultdict

ogstools.feflowlib.component_transport(saving_path, species, prj, dimension=3, fixed_out_times=None, time_stepping=None, initial_time=1, end_time=1)[source]#

A template for component transport process to be simulated in ogs.

Parameters:
  • saving_path (Path) – path of ogs simulation results

  • species (list)

  • prj (Project) – ogs project, which shall be used with the template

  • dimension (int) – True, if the model is 2 dimensional.

  • time_stepping (list | None) – List of how often a time step should be repeated and its time.

  • initial_time (int) – Beginning of the simulation time.

  • end_time (int) – End of the simulation time.

Return type:

Project

ogstools.feflowlib.convert_geometry_mesh(doc)[source]#

Get the geometric construction of the mesh.

Parameters:

doc (doctype) – The FEFLOW data.

Returns:

mesh

Return type:

UnstructuredGrid

ogstools.feflowlib.convert_properties_mesh(doc)[source]#

Get the mesh with point and cell properties.

Parameters:

doc (doctype) – The FEFLOW data.

Returns:

mesh

Return type:

UnstructuredGrid

ogstools.feflowlib.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 :return: 0 for no cells have been deactivated and 1 for cells have been deactivated

Return type:

int

ogstools.feflowlib.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 (UnstructuredGrid) – mesh

Returns:

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

Return type:

tuple[Path, UnstructuredGrid]

ogstools.feflowlib.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 (UnstructuredGrid) – mesh

Returns:

dict_of_point_boundary_conditions

Return type:

dict

ogstools.feflowlib.get_material_properties_of_CT_model(mesh)[source]#

Gets the material properties/parameter for each chemical species/component of the model.

Parameters:

mesh (UnstructuredGrid) – mesh

Return type:

defaultdict

ogstools.feflowlib.get_material_properties_of_HT_model(mesh)[source]#

Get a dictionary of all necessaray parameter values for a HT problem for each material in the mesh.

Parameters:

mesh (UnstructuredGrid) – mesh

Returns:

material_properties

Return type:

defaultdict

ogstools.feflowlib.get_species(mesh)[source]#

Get the names of chemical species of a mesh. Only works, if species-specific porosity values are assigned and named ‘*_P_PORO’.

Parameters:

mesh (UnstructuredGrid) – mesh

Returns:

list of species

Return type:

list

ogstools.feflowlib.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 (PolyData) – The surface mesh.

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

Returns:

specific_cells

Return type:

UnstructuredGrid

class ogstools.feflowlib.helpFormat[source]#

Bases: ArgumentDefaultsHelpFormatter, RawTextHelpFormatter

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

ogstools.feflowlib.hydro_thermal(saving_path, prj, dimension=3)[source]#

A template for a hydro-thermal process to be simulated in ogs.

Parameters:
  • saving_path (Path) – path of ogs simulation results

  • prj (Project) – ogs project, which shall be used with the template

  • dimension (int) – to known if the model is 2D or not

Return type:

Project

ogstools.feflowlib.liquid_flow(saving_path, prj, dimension=3)[source]#

A template for a steady liquid flow process to be simulated in ogs.

Parameters:
  • saving_path (Path) – path of ogs simulation results

  • prj (Project) – ogs project, which shall be used with the template

  • dimension (int) – True, if the model is 2 dimensional.

Return type:

Project

ogstools.feflowlib.points_and_cells(doc)[source]#

Get points and cells in a pyvista compatible format.

Parameters:

doc (doctype) – The FEFLOW data.

Returns:

pts, cells, celltypes (points, cells, celltypes)

Return type:

tuple[ndarray, list, list]

ogstools.feflowlib.setup_prj_file(bulk_mesh_path, mesh, material_properties, process, **kwargs)[source]#

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

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

  • mesh (UnstructuredGrid) – mesh

  • material_properties (dict) – material properties

  • process (str) – the process to be prepared

Keyword Arguments (kwargs):
  • model (ogs.OGS) – A ogs6py (ogs) model that is extended, should be used for templates

  • species_list (list) – All chemical species that occur in a model, if the model is to simulate a Component Transport (HC/CT) process.

  • max_iter (int) – Maximal iterations of process coupling in a CT process.

  • relative_tolerance (float) – Relative tolerance of process coupling in a CT process.

Returns:

model

Return type:

Project

ogstools.feflowlib.steady_state_diffusion(saving_path, prj)[source]#

A template for a steady state diffusion process to be simulated in ogs.

Parameters:
  • saving_path (Path) – path of ogs simulation results

  • prj (Project) – ogs project, which shall be used with the template

Return type:

Project

ogstools.feflowlib.update_geometry(mesh, doc)[source]#

Update the geometric construction of the mesh with point and cell data.

Parameters:
  • mesh (UnstructuredGrid) – The mesh to be updated.

  • doc (doctype) – The FEFLOW data.

Returns:

mesh

Return type:

UnstructuredGrid

ogstools.feflowlib.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 (UnstructuredGrid) – mesh

  • property_list (list) – list of properties

  • new_property (str) – name of the combined properties

  • material – material with inhomogeneous properties

  • saving_path (Path) – path to save the mesh

Returns:

filename

Return type:

str

ogstools.feflowlib.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 (UnstructuredGrid) – mesh

Submodules#