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 (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
- ogstools.feflowlib.tools.assign_bulk_ids(mesh)[source]#
Add data arrays for bulk_node_ids and bulk_element_ids to the given bulk mesh.
- Parameters:
mesh (UnstructuredGrid) – bulk mesh
- ogstools.feflowlib.tools.remove_bulk_ids(mesh)[source]#
Remove data arrays for bulk_node_ids and bulk_element_ids of the given bulk mesh.
- Parameters:
mesh (UnstructuredGrid) – bulk mesh
- ogstools.feflowlib.tools.get_dimension(mesh)[source]#
Return the dimension of the mesh.
- Parameters:
mesh (UnstructuredGrid) – mesh
- Return type:
int
- 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 (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 (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 (UnstructuredGrid) – mesh
- Returns:
path with name of mesh, topsurface mesh with cell boundary conditions
- Return type:
tuple[Path, UnstructuredGrid]
- 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 (UnstructuredGrid) – mesh
property (str) – property
- Returns:
material_properties
- Return type:
dict
- ogstools.feflowlib.tools.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.tools.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.tools.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.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 (UnstructuredGrid) – mesh
properties_list (list) – list of properties to be combined
- Returns:
material_properties
- Return type:
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 (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.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.
- 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.
- ogstools.feflowlib.tools.materials_in_HT(material_properties, model)[source]#
Create the section for material properties for HT processes in the prj-file.
- ogstools.feflowlib.tools.materials_in_CT(material_properties, species_list, model)[source]#
Create the section for material properties for CT (component transport) processes in the prj-file.
- class ogstools.feflowlib.tools.RequestParams[source]#
Bases:
TypedDict
- species_list: NotRequired[list | None]#
- max_iter: NotRequired[int]#
- rel_tol: NotRequired[float]#
- ogstools.feflowlib.tools.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 templatesspecies_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: