ogstools.mesh package#
- ogstools.mesh.depth(mesh, top_mesh, vertical_axis=None)[source]#
Returns the depth values of the mesh.
Computes the distance between each point of mesh and top_mesh along the vertical_axis. Uses linear interpolation to interpolate in between points of top_mesh.
- Parameters:
mesh (
UnstructuredGrid) – Mesh at the points of which the depth is computed.top_mesh (
UnstructuredGrid) – The mesh which defines the vertical boundary.vertical_axis (
Union[int,Literal['x','y','z'],None]) – If not given: For 3D, the z-axes is used. For 2D, the last axis of the plane wherein the mesh is lying is used (i.e. y if the mesh is in the xy-plane; z if it is in the xz-plane).
- Return type:
- ogstools.mesh.difference(base_mesh, subtract_mesh, variable=None)[source]#
Compute the difference of variables between two meshes.
- Parameters:
base_mesh (
UnstructuredGrid) – The mesh to subtract from.subtract_mesh (
UnstructuredGrid) – The mesh whose data is to be subtracted.variable (
Variable|str|None) – The variable of interest. If not given, all point and cell_data will be processed raw.
- Return type:
- Returns:
A new mesh containing the difference of variable or of all datasets between both meshes.
- ogstools.mesh.difference_matrix(meshes_1, meshes_2=None, variable=None)[source]#
Compute the difference between all combinations of two meshes from one or two arrays based on a specified variable.
- Parameters:
meshes_1 (
ndarray[tuple[Any,...],dtype[UnstructuredGrid]]) – The first list/array of meshes to be subtracted from.meshes_2 (
ndarray[tuple[Any,...],dtype[UnstructuredGrid]] |None) – The second list/array of meshes, it is subtracted from the first list/array of meshes - meshes_1 (optional).variable (
Variable|str|None) – The variable of interest. If not given, all point and cell_data will be processed raw.
- Return type:
- Returns:
An array of meshes containing the differences of variable or all datasets between meshes_1 and meshes_2 for all possible combinations.
- ogstools.mesh.difference_pairwise(meshes_1, meshes_2, variable=None)[source]#
Compute pairwise difference between meshes from two lists/arrays (they have to be of the same length).
- Parameters:
meshes_1 (
ndarray[tuple[Any,...],dtype[UnstructuredGrid]]) – The first list/array of meshes to be subtracted from.meshes_2 (
ndarray[tuple[Any,...],dtype[UnstructuredGrid]]) – The second list/array of meshes whose data is subtracted from the first list/array of meshes - meshes_1.variable (
Variable|str|None) – The variable of interest. If not given, all point and cell_data will be processed raw.
- Return type:
- Returns:
An array of meshes containing the differences of variable or all datasets between meshes_1 and meshes_2.
- ogstools.mesh.from_simulator(simulation, name, node_properties=None, cell_properties=None, field_properties=None)[source]#
Constructs a pyvista mesh from a running simulation. It always contains points (geometry) and cells (topology) and optionally the given node-based or cell-based properties Properties must be added afterwards
- Parameters:
simulator – Initialized and not finalized simulator object
name (
str) – Name of the submesh (e.g. domain, left, … )node_properties (
Sequence[str] |None) – Given properties will be added to the mesh None or [] -> no properties will be addedcell_properties (
Sequence[str] |None) – Given properties will be added to the mesh None or [] -> no properties will be added
- Return type:
- Returns:
A Mesh (Pyvista Unstructured Grid) object
- ogstools.mesh.ip_data_threshold(mesh, value, scalars='MaterialIDs', invert=False)[source]#
Filters integration point data to match the threshold criterion.
Similar to
pyvista’s threshold filter, but only acting on the field data and returning the modified field data dict.- Parameters:
mesh (
UnstructuredGrid) – original mesh, needs to contain MaterialIDs and IntegratioPointMetaData.value (
int|Sequence[int]) – Single value or (min, max) to be used for the threshold. If a sequence, then length must be 2. If single value, it is used as the lower bound and selecting everything above.scalars (
str) – Name of data to threshold on.invert (
bool) – Invert the threshold results
- Return type:
- ogstools.mesh.ip_metadata(mesh)[source]#
return the IntegrationPointMetaData in the mesh’s field_data as a dict.
- ogstools.mesh.node_reordering(mesh, method=1)[source]#
Reorders mesh nodes to make a mesh compatible with OGS6.
- Parameters:
mesh (
UnstructuredGrid) – mesh whose nodes are to be reordered.method (
int) –0: Reversing order of nodes for all elements.
- 1: Reversing order of nodes unless it’s perceived correct by OGS6
standards. This is the default selection.
- 2: Fixing node ordering issues between VTK and OGS6 (only applies
to prism-elements).
- 3: Re-ordering of mesh node vector such that all base nodes are
sorted before all nonlinear nodes.
- Return type:
- ogstools.mesh.save(mesh, filename=None, **kwargs)[source]#
Save mesh to file.
Supported are all file formats pyvista supports. In case you want to save as a vtu-file and the given mesh is not a pv.UnstructuredGrid it is cast to one prior to saving.
- ogstools.mesh.to_ip_mesh(mesh)[source]#
Create a mesh with cells centered around integration points.
- Return type:
- ogstools.mesh.to_ip_point_cloud(mesh)[source]#
Convert integration point data to a pyvista point cloud.
- Return type:
- ogstools.mesh.validate(mesh, strict=False)[source]#
Check conformity of mesh with OGS.
- Parameters:
mesh (
UnstructuredGrid|Path|str) – pyvista mesh or path to the mesh file.strict (
bool) – If True, raise a UserWarning if checkMesh returns an error.
- Return type:
Subpackages#
- ogstools.mesh.create package