No project description provided
Project description
Scikit for Gmsh to generate 3D finite element mesh.
The scikit-gmsh
package provides a simple interface to the gmsh
library.
The library has following main objectives:
- Provide an intuitive, object-oriented API for mesh creation.
- Integrate seamlessly with other libraries in the scientific Python ecosystem.
Contributions are very welcome . This project is released with a Contributor Code of Conduct. By participating in this project, We want you to know that you agree to follow its terms.
Enjoying scikit-gmsh? Show your support with a GitHub star — it’s a simple click that means the world to us and helps others discover it, too! ⭐️
Installation
pip install scikit-gmsh
Usage
import skgmsh as sg
Now, let's define geometry.
shell = [(0, 0, 0), (0, 10, 0), (10, 10, 0), (10, 0, 0), (0, 0, 0)]
holes = [[(2, 2, 0), (2, 4, 0), (4, 4, 0), (4, 2, 0), (2, 2, 0)]]
We can then generate a 2D mesh.
alg = sg.Delaunay2D(shell=shell, holes=holes)
mesh = alg.mesh
To visualize the model, we can use PyVista.
mesh.plot(show_edges=True, cpos="xy")
If you want to set the cell size, you can do so.
alg.cell_size = 0.5
alg.mesh.plot(show_edges=True, cpos="xy")
We can also generate a 3D mesh.
source = pv.Cube()
delaunay_3d = sg.Delaunay3D(edge_source=source, target_sizes=0.2)
plotter = pv.Plotter()
_ = plotter.add_mesh(
delaunay_3d.mesh,
show_edges=True,
line_width=1,
color="aliceblue",
lighting=False,
edge_color="gray",
)
_ = plotter.add_mesh(edge_source.extract_all_edges(), line_width=4, color="gray")
_ = plotter.add_box_axes()
plotter.show()
We can clip a mesh by a plane by specifying the origin and normal. See clip_with_surface_example for more examples using this filter.
clipped = delaunay_3d.mesh.clip(
origin=(0.0, 0.0, 0.0), normal=(0.0, 0.0, 1.0), crinkle=True
)
License
This software is published under the GPLv3 license.
Star History
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file scikit-gmsh-0.2.1.tar.gz
.
File metadata
- Download URL: scikit-gmsh-0.2.1.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca4bd6eb224e79a2139a4d36e5217d04d85103039d3fdfb1e87c5e5a69f460db |
|
MD5 | fc43e414a12ac8a333ac8c68a8268fd4 |
|
BLAKE2b-256 | 248a223944960216ee43263f917e40d28cd16a96429c00faf46d2696dafe7f6a |
File details
Details for the file scikit_gmsh-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: scikit_gmsh-0.2.1-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79f65b608b82cd7c4cb09721052258c6892955144254024fcb78b3c7dc091e4b |
|
MD5 | 7861d93601327b87d31bf38722c17d4b |
|
BLAKE2b-256 | 46ada3bd4d69e52073d6cdb4dc181d6e8b381665bb4beef5c6e1831362f4b9e2 |