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.0.tar.gz
.
File metadata
- Download URL: scikit-gmsh-0.2.0.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e41bfcfea0c5b6b74bd3de225dbf25842d36bce7d8d4e1a9fb5b54f722022ae |
|
MD5 | 019f95dcef3cdbc77e9fdca4ac4c8d4d |
|
BLAKE2b-256 | 73ff1c8d713d80826d27a77425cf661ff49e489e960024b75c4c89ca87e2d495 |
File details
Details for the file scikit_gmsh-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: scikit_gmsh-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f31ff8d63bfb567852135164dcd48913c05e3dde8e646d0de92079116ba5258b |
|
MD5 | 1fa70fcfd3499dbbc48e0775866efc3f |
|
BLAKE2b-256 | 0fb923756bc590b9c4358302cb0a2cf8b54d68278cd87bd427148dc3981c7da4 |