ogstools.mesh.create.boundary_set module#
- class ogstools.mesh.create.boundary_set.BoundarySet[source]#
Bases:
ABCAbstract base class representing a collection of boundaries with constraints.
A BoundarySet is composed of multiple boundaries linked with constraints: - Free of gaps and overlaps. - Distinguished by markers to identify different boundaries. - Adherence to rules of piecewise linear complex (PLC).
- class ogstools.mesh.create.boundary_set.LayerSet[source]#
Bases:
BoundarySetCollection of geological layers stacked to represent subsurface arrangements.
In a geological information system, multiple layers can be stacked vertically to represent the subsurface arrangement. This class provides methods to manage and work with layered geological data.
Initializes a LayerSet. It checks if the list of provided layers are given in a top to bottom order. In neighboring layers, layers share the same surface (upper bottom == low top).
- __init__(layers)[source]#
Initializes a LayerSet. It checks if the list of provided layers are given in a top to bottom order. In neighboring layers, layers share the same surface (upper bottom == low top).
- create_raster(resolution, margin=0.0)[source]#
Create raster representations for the LayerSet.
This method generates raster files at a specified resolution for each layer’s top and bottom boundaries and returns paths to the raster files.
- create_rasters(resolution)[source]#
For each surface a (temporary) raster file with given resolution is created.
- refine(factor)[source]#
Refine the LayerSet by increasing the number of subdivisions.
This function refines the LayerSet by increasing the number of subdivisions in each layer. The factor parameter determines the degree of refinement.
- to_region_prism(resolution, margin=0.0)[source]#
Convert a layered geological structure into a RegionSet using prism meshing.
This function takes a
LayerSetand converts it into aRegionSetobject using prism or tetrahedral meshing technique. The function will use prism elements for meshing if possible; otherwise, it will use tetrahedral elements.- Parameters:
- Return type:
- Returns:
A
RegionSetobject containing the meshed representation of the geological structure.
- raises:
ValueError: If an error occurs during the meshing process.
- example:
layer_set = LayerSet(…) resolution = 0.1 region_set = layer_set.to_region_prism(resolution)
- to_region_simplified(xy_resolution, rank)[source]#
Convert a layered geological structure to a simplified meshed region.
This function converts a layered geological structure represented by a LayerSet into a simplified meshed region using the specified xy_resolution and rank.
- Parameters:
- Return type:
- Returns:
A RegionSet object containing the simplified meshed representation of the geological structure.
- raises:
AssertionError: If the length of the bounds retrieved from the layer_set is not 6.
- example:
layer_set = LayerSet(…) xy_resolution = 0.1 # Example resolution in XY plane rank = 2 # Mesh will be 2D region_set = layer_set.to_region_simplified(xy_resolution, rank)
- to_region_tetrahedron(resolution, margin=0.0)[source]#
Convert a layered geological structure to a tetrahedral meshed region.
This function converts a layered geological structure represented by a LayerSet into a tetrahedral meshed region using the specified resolution.
- Parameters:
- Return type:
- Returns:
A RegionSet object containing the tetrahedral meshed representation of the geological structure.
- raises:
ValueError: If an error occurs during the meshing process.
- notes:
The resolution parameter determines the desired spatial resolution of the mesh.
The function utilizes tetrahedral meshing using Tetgen software to create the meshed representation.
The resulting mesh is tetrahedral, and material IDs are assigned to mesh cells based on the geological layers.
- example:
layer_set = LayerSet(…) resolution = 1 # Example resolution for meshing region_set = layer_set.to_region_tetrahedron(resolution)
- to_region_voxel(resolution)[source]#
Convert a layered geological structure to a voxelized mesh.
This function converts a layered geological structure represented by a LayerSet into a voxelized mesh using the specified resolution.
- Parameters:
resolution (
list) – A list of [x_resolution, y_resolution, z_resolution] for voxelization.- Return type:
- Returns:
A Mesh object containing the voxelized mesh representation of the geological structure.
- raises:
ValueError: If an error occurs during the voxelization process.
- example:
layer_set = LayerSet(…) resolution = [0.1, 0.1, 0.1] # Example voxelization resolutions in x, y, and z dimensions voxel_mesh = layer_set.to_region_voxel(resolution)