ogstools.meshlib.gmsh_meshing module#
- ogstools.meshlib.gmsh_meshing.rect(lengths=1.0, n_edge_cells=1, n_layers=1, structured_grid=True, order=1, mixed_elements=False, jiggle=0.0, out_name=Path('rect.msh'), msh_version=None)[source]#
- ogstools.meshlib.gmsh_meshing.cuboid(lengths=1.0, n_edge_cells=1, n_layers=1, structured_grid=True, order=1, mixed_elements=False, out_name=Path('unit_cube.msh'), msh_version=None)[source]#
- ogstools.meshlib.gmsh_meshing.remesh_with_triangle(mesh, output_file=Path() / 'tri_mesh.msh', size_factor=1.0, order=1)[source]#
Discretizes a given Mesh with triangles and saves as gmsh .msh.
Requires the mesh to be 2D and to contain ‘MaterialIDs in the cell data.
- Parameters:
mesh (UnstructuredGrid) – The mesh which shall be discretized with triangles
output_file (Path | str) – The full filepath to the resulting file
size_factor (float) – A factor to scale the element sizes.
order (int) – The element order (1=linear, 2=quadratic, …)
- class ogstools.meshlib.gmsh_meshing.Groundwater[source]#
Bases:
object
Groundwater(begin: float = -30, isolation_layer_id: int = 1, flow_direction: str = ‘+x’)
- begin: float = -30#
depth of groundwater begin (negative) in m
- isolation_layer_id: int = 1#
number of the groundwater isolation layer (count starts with 0)
- flow_direction: str = '+x'#
groundwater inflow direction as string - supported ‘+x’, ‘-x’, ‘-y’, ‘+y’
- __init__(begin=-30, isolation_layer_id=1, flow_direction='+x')#
- class ogstools.meshlib.gmsh_meshing.BHE[source]#
Bases:
object
(B)orehole (H)eat (E)xchanger
- x: float = 50.0#
x-coordinate of the BHE in m
- y: float = 50.0#
y-coordinate of the BHE in m
- __init__(x=50.0, y=50.0, z_begin=-1.0, z_end=-60.0, borehole_radius=0.076)#
- z_begin: float = -1.0#
BHE begin depth (zero or negative) in m
- z_end: float = -60.0#
BHE end depth (zero or negative) in m
- borehole_radius: float = 0.076#
borehole radius in m
- ogstools.meshlib.gmsh_meshing.gen_bhe_mesh_gmsh(length, width, layer, groundwater, BHE_Array, target_z_size_coarse=7.5, target_z_size_fine=1.5, n_refinement_layers=2, meshing_type='structured', dist_box_x=5.0, dist_box_y=10.0, inner_mesh_size=5.0, outer_mesh_size=10.0, propagation=1.1, order=1, out_name=Path('bhe_mesh.msh'))[source]#
Create a generic BHE mesh for the Heat_Transport_BHE-Process with additionally submeshes at the top, at the bottom and the groundwater inflow, which is exported in the Gmsh .msh format. For the usage in OGS, a mesh conversion with msh2vtu with dim-Tags [1,3] is needed. The mesh is defined by multiple input parameters. Refinement layers are placed at the BHE-begin, the BHE-end and the groundwater start/end. See detailed description of the parameters below:
- Parameters:
length (float) – Length of the model area in m (x-dimension)
width (float) – Width of the model area in m (y-dimension)
layer (float | list[float]) – List of the soil layer thickness in m
groundwater (Groundwater | list[Groundwater]) – List of groundwater layers, where every is specified by a tuple of three entries: [depth of groundwater begin (negative), number of the groundwater isolation layer (count starts with 0), groundwater inflow direction as string - supported ‘+x’, ‘-x’, ‘-y’, ‘+y’], empty list [] for no groundwater flow
BHE_Array (BHE | list[BHE]) – List of BHEs, where every BHE is specified by a tuple of five floats: [x-coordinate BHE, y-coordinate BHE, BHE begin depth (zero or negative), BHE end depth (negative), borehole radius in m]
target_z_size_coarse (float) – maximum edge length of the elements in m in z-direction, if no refinemnt needed
target_z_size_fine (float) – maximum edge length of the elements in the refinement zone in m in z-direction
n_refinement_layers (int) – number of refinement layers which are evenly set above and beneath the refinemnt depths (see general description above)
meshing_type (str) – ‘structured’ and ‘prism’ are supported
dist_box_x (float) – distance in m in x-direction of the refinemnt box according to the BHE’s
dist_box_y (float) – distance in m in y-direction of the refinemnt box according to the BHE’s
inner_mesh_size (float) – mesh size inside the refinement box in m
outer_mesh_size (float) – mesh size outside of the refinement box in m
propagation (float) – growth of the outer_mesh_size, only supported by meshing_type ‘structured’
order (int) – Define the order of the mesh: 1 for linear finite elements / 2 for quadratic finite elements
out_name (Path) – name of the exported mesh, must end with .msh
- Returns:
a gmsh .msh file
- Return type:
None
- ogstools.meshlib.gmsh_meshing.gen_bhe_mesh(length, width, layer, groundwater, BHE_Array, target_z_size_coarse=7.5, target_z_size_fine=1.5, n_refinement_layers=2, meshing_type='structured', dist_box_x=5.0, dist_box_y=10.0, inner_mesh_size=5.0, outer_mesh_size=10.0, propagation=1.1, order=1, out_name=Path('bhe_mesh.vtu'))[source]#
Create a generic BHE mesh for the Heat_Transport_BHE-Process with additionally submeshes at the top, at the bottom and the groundwater inflow, which is exported in the OGS readable .vtu format. Refinement layers are placed at the BHE-begin, the BHE-end and the groundwater start/end. See detailed description of the parameters below:
- Parameters:
length (float) – Length of the model area in m (x-dimension)
width (float) – Width of the model area in m (y-dimension)
layer (float | list[float]) – List of the soil layer thickness in m
groundwater (Groundwater | list[Groundwater]) – List of groundwater layers, where every is specified by a tuple of three entries: [depth of groundwater begin (negative), number of the groundwater isolation layer (count starts with 0), groundwater inflow direction, as string - supported ‘+x’, ‘-x’, ‘-y’, ‘+y’], empty list [] for no groundwater flow
BHE_Array (BHE | list[BHE]) – List of BHEs, where every BHE is specified by a tuple of five floats: [x-coordinate BHE, y-coordinate BHE, BHE begin depth (zero or negative), BHE end depth (negative), borehole radius in m]
target_z_size_coarse (float) – maximum edge length of the elements in m in z-direction, if no refinemnt needed
target_z_size_fine (float) – maximum edge length of the elements in the refinement zone in m in z-direction
n_refinement_layers (int) – number of refinement layers which are evenly set above and beneath the refinemnt depths (see general description above)
meshing_type (str) – ‘structured’ and ‘prism’ are supported
dist_box_x (float) – distance in m in x-direction of the refinemnt box according to the BHE’s
dist_box_y (float) – distance in m in y-direction of the refinemnt box according to the BHE’s
inner_mesh_size (float) – mesh size inside the refinement box in m
outer_mesh_size (float) – mesh size outside of the refinement box in m
propagation (float) – growth of the outer_mesh_size, only supported by meshing_type ‘structured’
order (int) – Define the order of the mesh: 1 for linear finite elements / 2 for quadratic finite elements
out_name (Path) – name of the exported mesh, must end with .vtu
- Returns:
list of filenames of the created vtu mesh files
- Return type:
list[str]