GMSHmaker2D#
- class zeroheliumkit.fem.heliumsurface.GMSHmaker2D(layout: Structure | Entity, electode_config: dict, mesh_config: dict | list[dict], filename: str, savedir: str = '')[source]#
Bases:
objectMethods
Generates and writes the geometry definition to a file in GMSH format.
create_gmsh_surface(polygon, zcoord)Creates a Gmsh surface based on the given polygon and z-coordinate.
Creates Gmsh surfaces based on the polygons in the layout.
create_mesh([dim, print_progress])Generates a mesh using Gmsh and saves it to the specified directory.
create_physical_lines_from_lines(...)Create physical lines in the Gmsh model based on the electrode configuration.
create_physical_surfaces(surfaces)Create physical surfaces from the surfaces
define_mesh(mesh_config)Define the mesh based on the given mesh configuration.
Disables console output in GMSH by setting the 'General.Terminal' option to 0.
Exports the current GMSH configuration to a YAML file.
finalize()Finalizes the GMSH session and releases all associated resources.
fragmentation(surfaces)Gluing all surfaces together
gmsh_to_polygon_matches(gmsh_surface, ...)Compares gmsh Volumes with extruded shapely Polygon
Opens the Gmsh graphical user interface with customized color options for geometry points and text.
- create_gmsh_surface(polygon: Polygon, zcoord: float) int[source]#
Creates a Gmsh surface based on the given polygon and z-coordinate.
- Parameters:
polygon (Polygon) – Shapely polygon defining the shape of the surface.
zcoord (float) – The z-coordinate of the surface.
- Returns:
The ID of the created Gmsh surface.
- Return type:
int
- create_gmsh_surfaces() list[source]#
Creates Gmsh surfaces based on the polygons in the layout.
- Returns:
A list of the IDs of the created Gmsh surfaces.
- Return type:
list
- fragmentation(surfaces: list) list[source]#
- Gluing all surfaces together
Handles correctly the shared surfaces between surfaces
- Parameters:
surfaces (list) – list of all surfaces
- Returns:
list of reconfigured surfaces
- Return type:
list
- create_physical_surfaces(surfaces: dict)[source]#
Create physical surfaces from the surfaces
- Parameters:
surfaces (dict) – dictionary of surfaces
- create_physical_lines_from_polygons(electrode_config: dict)[source]#
Create physical lines in the Gmsh model based on the electrode configuration.
- Parameters:
electrode_config (dict) – A dictionary containing the electrode configuration. The keys represent the names of the electrode groups, and the values contain information about the layer and polygons associated with each group.
Example: >>> electrode_config = { … “ElectrodeGroup1”: { … “layer”: (“Layer1”, [0, 1]), … }, … “ElectrodeGroup2”: { … “layer”: (“Layer2”, [2]), … }, … } >>> create_physical_lines(electrode_config)
- gmsh_to_polygon_matches(gmsh_surface: int, shapely_polygon: Polygon) bool[source]#
Compares gmsh Volumes with extruded shapely Polygon
- Parameters:
Volume (int) – gmsh Volume
polygon (Polygon) – shapely Polygon
gmsh_layer (str) – gmsh layer name, which contains info about z-coordinates
- Returns:
True, if Volume equals to extruded Polygon within tolerance
- Return type:
bool
- define_mesh(mesh_config: dict | list[dict])[source]#
Define the mesh based on the given mesh configuration.
- Parameters:
mesh_config (dict | list[dict]) – The mesh configuration. It can be a single dictionary or a list of dictionaries. Each dictionary should contain the following keys: - “Thickness” (float): The thickness of the box. - “VIn” (float): The inner value of the box. - “VOut” (float): The outer value of the box. - “box” (list[float]): The coordinates of the box in the format [XMin, YMin, XMax, YMax].
- create_mesh(dim=2, print_progress=True)[source]#
Generates a mesh using Gmsh and saves it to the specified directory.
- Parameters:
dim (str, optional) – The dimension of the mesh to generate (‘2’ or ‘3’). Defaults to ‘2’.
- Raises:
KeyboardInterrupt – If the mesh generation is interrupted by the user.
- open_gmsh()[source]#
Opens the Gmsh graphical user interface with customized color options for geometry points and text.
- finalize()[source]#
Finalizes the GMSH session and releases all associated resources. This method should be called after all mesh generation and processing tasks are complete to properly clean up the GMSH environment.