chilmesh 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chilmesh-0.1.0/LICENSE +21 -0
- chilmesh-0.1.0/PKG-INFO +215 -0
- chilmesh-0.1.0/README.md +180 -0
- chilmesh-0.1.0/pyproject.toml +21 -0
- chilmesh-0.1.0/setup.cfg +4 -0
- chilmesh-0.1.0/src/chilmesh/CHILmesh.py +933 -0
- chilmesh-0.1.0/src/chilmesh/__init__.py +10 -0
- chilmesh-0.1.0/src/chilmesh/utils/plot_utils.py +365 -0
- chilmesh-0.1.0/src/chilmesh.egg-info/PKG-INFO +215 -0
- chilmesh-0.1.0/src/chilmesh.egg-info/SOURCES.txt +11 -0
- chilmesh-0.1.0/src/chilmesh.egg-info/dependency_links.txt +1 -0
- chilmesh-0.1.0/src/chilmesh.egg-info/requires.txt +3 -0
- chilmesh-0.1.0/src/chilmesh.egg-info/top_level.txt +1 -0
chilmesh-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Dominik Mattioli
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
chilmesh-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chilmesh
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Advanced mesh generation and smoothing for hydrodynamic domains
|
|
5
|
+
Author: Dominik Mattioli
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2023 Dominik Mattioli
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Requires-Python: >=3.8
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: numpy
|
|
32
|
+
Requires-Dist: matplotlib
|
|
33
|
+
Requires-Dist: scipy
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
<h1 align="center">
|
|
37
|
+
CHILmesh: representing triangular, quadrangular and mixed-element (2D) meshes for advanced and automatic mesh generation for hydrodynamic domains.
|
|
38
|
+
</h1>
|
|
39
|
+
|
|
40
|
+
<p align="center">
|
|
41
|
+
<strong><a href="https://scholar.google.com/citations?user=IBFSkOcAAAAJ&hl=en">Dominik Mattioli</a><sup>1†</sup>, <a href="https://scholar.google.com/citations?user=mYPzjIwAAAAJ&hl=en">Ethan Kubatko</a><sup>2</sup></strong><br>
|
|
42
|
+
<sup>†</sup>Corresponding author<br><br>
|
|
43
|
+
<sup>1</sup>Penn State University<br>
|
|
44
|
+
<sup>2</sup>Computational Hydrodynamics and Informatics Lab (CHIL), The Ohio State University
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<a href="https://ceg.osu.edu/computational-hydrodynamics-and-informatics-laboratory">
|
|
50
|
+
<img src="https://img.shields.io/badge/CHIL%20Lab%20@%20OSU-a7b1b7?logo=academia&logoColor=ba0c2f&labelColor=ba0c2f" alt="CHIL Lab @ OSU">
|
|
51
|
+
</a>
|
|
52
|
+
<a href="https://ceg.osu.edu/computational-hydrodynamics-and-informatics-laboratory">
|
|
53
|
+
<img src="https://img.shields.io/badge/OSU_CHIL-ADMESH-66bb33?logo=github&logoColor=ba0c2f&labelColor=ffffff" alt="OSU CHIL ADMESH">
|
|
54
|
+
</a>
|
|
55
|
+
<a href="https://github.com/user-attachments/files/19724263/QuADMESH-Thesis.pdf">
|
|
56
|
+
<img src="https://img.shields.io/badge/Thesis-QuADMESH-ba0c2f?style=flat-square&logo=book&logoColor=white&labelColor=cfd4d8" alt="QuADMESH Thesis">
|
|
57
|
+
</a>
|
|
58
|
+
<a href="https://scholar.google.com/citations?view_op=view_citation&hl=en&user=IBFSkOcAAAAJ&citation_for_view=IBFSkOcAAAAJ:u5HHmVD_uO8C">
|
|
59
|
+
<img src="https://img.shields.io/badge/Scholar-Profile-4285F4?logo=google-scholar&logoColor=white" alt="Google Scholar">
|
|
60
|
+
</a>
|
|
61
|
+
<a href="https://www.mathworks.com/matlabcentral/fileexchange/135632-chilmesh">
|
|
62
|
+
<img src="https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg" alt="MathWorks File Exchange">
|
|
63
|
+
</a>
|
|
64
|
+
<a href="https://github.com/domattioli/CHILmesh/blob/d63b7d221842cbb00bdb057b201519ac5e49febc/LICENSE">
|
|
65
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" alt="License: MIT">
|
|
66
|
+
</a>
|
|
67
|
+
</p>
|
|
68
|
+
<p align="center">
|
|
69
|
+
<img src="https://github.com/user-attachments/assets/0c344383-cde0-454f-810f-5407092a7be2" alt="image">
|
|
70
|
+
</p>
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## Releases
|
|
74
|
+
- 2025/04/12 Python version of our code
|
|
75
|
+
- 2023/09/19 MATLAB code revisited; repo initiated
|
|
76
|
+
- 2017/08/01 Nascent MATLAB version of the code
|
|
77
|
+
#### Future Work
|
|
78
|
+
[](https://github.com/domattioli/MADMESHR)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## Table of Contents
|
|
82
|
+
- [Releases](#releases)
|
|
83
|
+
- [Future Work](#future-work)
|
|
84
|
+
- [Installation](#installation)
|
|
85
|
+
- [Key Features](#key-features)
|
|
86
|
+
- [To-Do](#to-do)
|
|
87
|
+
- [Example Usage](#example-usage)
|
|
88
|
+
- [BibTeX](#bibtex)
|
|
89
|
+
- [Acknowledgements](#acknowledgements)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## Installation
|
|
93
|
+
Install via pip:
|
|
94
|
+
```bash
|
|
95
|
+
pip install chilmesh
|
|
96
|
+
```
|
|
97
|
+
Or:
|
|
98
|
+
```bash
|
|
99
|
+
git clone https://github.com/domattioli/CHILmesh && cd CHILmesh
|
|
100
|
+
python -m venv .myenv
|
|
101
|
+
source .myenv/bin/activate
|
|
102
|
+
.myenv/bin/pip install requirements.txt
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## Key Features
|
|
107
|
+
- Minimal user input, automatic generation.
|
|
108
|
+
- Support for triangular, quadrilateral, and mixed-element meshes.
|
|
109
|
+
- Finite Element Method (FEM)-based and geometric mesh smoothing and other topological quality-improvement functionality.
|
|
110
|
+
- Element quality evaluation (angular skewness) for quads & tris.
|
|
111
|
+
- Novel [layer-based conceptualization for 2D meshes.
|
|
112
|
+
- [MeshLayers.pdf](https://github.com/user-attachments/files/19724245/MeshLayers.pdf)
|
|
113
|
+
- `.fort.14` file input/output for ADCIRC models
|
|
114
|
+
- API inspired by MATLAB’s `delaunayTriangulation()`
|
|
115
|
+
|
|
116
|
+
### To-Do📌
|
|
117
|
+
- Finish porting all functionality from original MATLAB code to python.
|
|
118
|
+
- Add support for generating Delaunay meshes from scratch via zero-input CHILmesh().
|
|
119
|
+
- Add support for delaunay trainagulation object input/output.
|
|
120
|
+
- Add support for [.gmsh](https://gmsh.info/doc/texinfo/gmsh.html) input/output.
|
|
121
|
+
- Extend .write_to_fort14() to support quadrilateral output
|
|
122
|
+
- pip installation
|
|
123
|
+
|
|
124
|
+
### Example Usage:
|
|
125
|
+
```python
|
|
126
|
+
# Load mesh
|
|
127
|
+
import matplotlib.pyplot as plt
|
|
128
|
+
import numpy as np
|
|
129
|
+
from chilmesh import CHILmesh
|
|
130
|
+
|
|
131
|
+
# Randomly generate and triangulate points inside the donut domain.
|
|
132
|
+
domain_ffn = '/kaggle/working/CHILmesh/doc/domains/fort_14/annulus_200pts.fort.14'
|
|
133
|
+
mesh = CHILmesh.read_from_fort14( domain_ffn )
|
|
134
|
+
# mesh = CHILmesh() # random delaunay to-do
|
|
135
|
+
|
|
136
|
+
# Set up 2x3 subplot grid
|
|
137
|
+
fig, axs = plt.subplots(2, 3, figsize=(18, 10))
|
|
138
|
+
axs = axs.flatten()
|
|
139
|
+
fig.suptitle("Original vs Smoothed Mesh Comparison", fontsize=16)
|
|
140
|
+
|
|
141
|
+
# --- Original Mesh Plots ---
|
|
142
|
+
# 0. Original: Mesh + point/edge/element
|
|
143
|
+
_, ax = mesh.plot(ax=axs[0])
|
|
144
|
+
mesh.plot_point(1, ax=ax)
|
|
145
|
+
mesh.plot_edge(1, ax=ax)
|
|
146
|
+
mesh.plot_elem(1, ax=ax)
|
|
147
|
+
ax.set_title("Original: Mesh + Highlighted Entities")
|
|
148
|
+
|
|
149
|
+
# 1. Original: Layers
|
|
150
|
+
_, ax = mesh.plot_layer(ax=axs[1])
|
|
151
|
+
ax.set_title("Original: Mesh Layers")
|
|
152
|
+
|
|
153
|
+
# 2. Original: Quality
|
|
154
|
+
q0, _, stats0 = mesh.elem_quality( )
|
|
155
|
+
print( stats0 )
|
|
156
|
+
_, ax = mesh.plot_quality(ax=axs[2])
|
|
157
|
+
ax.set_title(f"Original: Quality Map (Median: {np.median(q0):.2f}, Std: {np.std(q0):.2f})")
|
|
158
|
+
|
|
159
|
+
# --- Smoothed Mesh Plots ---
|
|
160
|
+
# 3. Smoothed: Mesh + point/edge/element
|
|
161
|
+
mesh_smoothed = mesh.copy()
|
|
162
|
+
mesh_smoothed.smooth_mesh( method='fem', acknowledge_change=True )
|
|
163
|
+
_, ax = mesh_smoothed.plot(ax=axs[3])
|
|
164
|
+
mesh_smoothed.plot_point(1, ax=ax)
|
|
165
|
+
mesh_smoothed.plot_edge(1, ax=ax)
|
|
166
|
+
mesh_smoothed.plot_elem(1, ax=ax)
|
|
167
|
+
ax.set_title("Smoothed: Mesh + Highlighted Entities")
|
|
168
|
+
|
|
169
|
+
# 4. Smoothed: Layers
|
|
170
|
+
_, ax = mesh_smoothed.plot_layer(ax=axs[4])
|
|
171
|
+
ax.set_title("Smoothed: Mesh Layers")
|
|
172
|
+
|
|
173
|
+
# 5. Smoothed: Quality
|
|
174
|
+
q, _, stats = mesh_smoothed.elem_quality( )
|
|
175
|
+
print( stats )
|
|
176
|
+
_, ax = mesh_smoothed.plot_quality(ax=axs[5])
|
|
177
|
+
ax.set_title(f"Smoothed: Quality Map (Median: {np.median(q):.2f}, Std: {np.std(q):.2f})")
|
|
178
|
+
|
|
179
|
+
# Layout tidy
|
|
180
|
+
plt.tight_layout()
|
|
181
|
+
plt.subplots_adjust(top=0.9) # leave space for suptitle
|
|
182
|
+
plt.show()
|
|
183
|
+
#fig.savefig("result.png", dpi=600, bbox_inches='tight')
|
|
184
|
+
```
|
|
185
|
+

|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
> **Note**: When mesh is mixed-element, connectivity (elem2vert adjacency) follows the format `Node1-Node2-Node3-Node4`, such that `Node4 == Node3` for triangular elements.
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
### BibTeX:
|
|
192
|
+
> DO Mattioli (2017). QuADMESH+: A Quadrangular ADvanced Mesh Generator for Hydrodynamic Models [Master's thesis, Ohio State University]. OhioLINK Electronic Theses and Dissertations Center. http://rave.ohiolink.edu/etdc/view?acc_num=osu1500627779532088
|
|
193
|
+
```bibtex
|
|
194
|
+
@mastersthesis{mattioli2017quadmesh,
|
|
195
|
+
author = {Mattioli, Dominik O.},
|
|
196
|
+
title = {{QuADMESH+}: A Quadrangular ADvanced Mesh Generator for Hydrodynamic Models},
|
|
197
|
+
school = {The Ohio State University},
|
|
198
|
+
year = {2017},
|
|
199
|
+
note = {Master's thesis},
|
|
200
|
+
url = {http://rave.ohiolink.edu/etdc/view?acc_num=osu1500627779532088}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
- [Read the pdf for free here](https://github.com/user-attachments/files/19727573/QuADMESH__Thesis_Doc.pdf)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
#### Acknowledgements
|
|
208
|
+
The following pieces of work inspired contributions to this repository:
|
|
209
|
+
- [ADMESH](https://doi.org/10.1007/s10236-012-0574-0)
|
|
210
|
+
- See the rest of the citations in the thesis [QuADMESH-Thesis.pdf](https://github.com/user-attachments/files/19724263/QuADMESH-Thesis.pdf)
|
|
211
|
+
- Original work was funded by [Aquaveo](https://aquaveo.com/) and contributed to by Alan Zundel.
|
|
212
|
+
- [FEM Smoother paper](https://api.semanticscholar.org/CorpusID:34335417)
|
|
213
|
+
- [Inspiring MATLAB implementation](https://github.com/CHLNDDEV/OceanMesh2D/blob/Projection/utilities/direct_smoother_lur.m)
|
|
214
|
+
- [Angle-Based Smoother paper](https://www.andrew.cmu.edu/user/shimada/papers/00-imr-zhou.pdf)
|
|
215
|
+
- The MATLAB code was originally developed for a master's thesis research project (2015–2017) at **The Ohio State University**.
|
chilmesh-0.1.0/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
CHILmesh: representing triangular, quadrangular and mixed-element (2D) meshes for advanced and automatic mesh generation for hydrodynamic domains.
|
|
3
|
+
</h1>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong><a href="https://scholar.google.com/citations?user=IBFSkOcAAAAJ&hl=en">Dominik Mattioli</a><sup>1†</sup>, <a href="https://scholar.google.com/citations?user=mYPzjIwAAAAJ&hl=en">Ethan Kubatko</a><sup>2</sup></strong><br>
|
|
7
|
+
<sup>†</sup>Corresponding author<br><br>
|
|
8
|
+
<sup>1</sup>Penn State University<br>
|
|
9
|
+
<sup>2</sup>Computational Hydrodynamics and Informatics Lab (CHIL), The Ohio State University
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://ceg.osu.edu/computational-hydrodynamics-and-informatics-laboratory">
|
|
15
|
+
<img src="https://img.shields.io/badge/CHIL%20Lab%20@%20OSU-a7b1b7?logo=academia&logoColor=ba0c2f&labelColor=ba0c2f" alt="CHIL Lab @ OSU">
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://ceg.osu.edu/computational-hydrodynamics-and-informatics-laboratory">
|
|
18
|
+
<img src="https://img.shields.io/badge/OSU_CHIL-ADMESH-66bb33?logo=github&logoColor=ba0c2f&labelColor=ffffff" alt="OSU CHIL ADMESH">
|
|
19
|
+
</a>
|
|
20
|
+
<a href="https://github.com/user-attachments/files/19724263/QuADMESH-Thesis.pdf">
|
|
21
|
+
<img src="https://img.shields.io/badge/Thesis-QuADMESH-ba0c2f?style=flat-square&logo=book&logoColor=white&labelColor=cfd4d8" alt="QuADMESH Thesis">
|
|
22
|
+
</a>
|
|
23
|
+
<a href="https://scholar.google.com/citations?view_op=view_citation&hl=en&user=IBFSkOcAAAAJ&citation_for_view=IBFSkOcAAAAJ:u5HHmVD_uO8C">
|
|
24
|
+
<img src="https://img.shields.io/badge/Scholar-Profile-4285F4?logo=google-scholar&logoColor=white" alt="Google Scholar">
|
|
25
|
+
</a>
|
|
26
|
+
<a href="https://www.mathworks.com/matlabcentral/fileexchange/135632-chilmesh">
|
|
27
|
+
<img src="https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg" alt="MathWorks File Exchange">
|
|
28
|
+
</a>
|
|
29
|
+
<a href="https://github.com/domattioli/CHILmesh/blob/d63b7d221842cbb00bdb057b201519ac5e49febc/LICENSE">
|
|
30
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" alt="License: MIT">
|
|
31
|
+
</a>
|
|
32
|
+
</p>
|
|
33
|
+
<p align="center">
|
|
34
|
+
<img src="https://github.com/user-attachments/assets/0c344383-cde0-454f-810f-5407092a7be2" alt="image">
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Releases
|
|
39
|
+
- 2025/04/12 Python version of our code
|
|
40
|
+
- 2023/09/19 MATLAB code revisited; repo initiated
|
|
41
|
+
- 2017/08/01 Nascent MATLAB version of the code
|
|
42
|
+
#### Future Work
|
|
43
|
+
[](https://github.com/domattioli/MADMESHR)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Table of Contents
|
|
47
|
+
- [Releases](#releases)
|
|
48
|
+
- [Future Work](#future-work)
|
|
49
|
+
- [Installation](#installation)
|
|
50
|
+
- [Key Features](#key-features)
|
|
51
|
+
- [To-Do](#to-do)
|
|
52
|
+
- [Example Usage](#example-usage)
|
|
53
|
+
- [BibTeX](#bibtex)
|
|
54
|
+
- [Acknowledgements](#acknowledgements)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
Install via pip:
|
|
59
|
+
```bash
|
|
60
|
+
pip install chilmesh
|
|
61
|
+
```
|
|
62
|
+
Or:
|
|
63
|
+
```bash
|
|
64
|
+
git clone https://github.com/domattioli/CHILmesh && cd CHILmesh
|
|
65
|
+
python -m venv .myenv
|
|
66
|
+
source .myenv/bin/activate
|
|
67
|
+
.myenv/bin/pip install requirements.txt
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Key Features
|
|
72
|
+
- Minimal user input, automatic generation.
|
|
73
|
+
- Support for triangular, quadrilateral, and mixed-element meshes.
|
|
74
|
+
- Finite Element Method (FEM)-based and geometric mesh smoothing and other topological quality-improvement functionality.
|
|
75
|
+
- Element quality evaluation (angular skewness) for quads & tris.
|
|
76
|
+
- Novel [layer-based conceptualization for 2D meshes.
|
|
77
|
+
- [MeshLayers.pdf](https://github.com/user-attachments/files/19724245/MeshLayers.pdf)
|
|
78
|
+
- `.fort.14` file input/output for ADCIRC models
|
|
79
|
+
- API inspired by MATLAB’s `delaunayTriangulation()`
|
|
80
|
+
|
|
81
|
+
### To-Do📌
|
|
82
|
+
- Finish porting all functionality from original MATLAB code to python.
|
|
83
|
+
- Add support for generating Delaunay meshes from scratch via zero-input CHILmesh().
|
|
84
|
+
- Add support for delaunay trainagulation object input/output.
|
|
85
|
+
- Add support for [.gmsh](https://gmsh.info/doc/texinfo/gmsh.html) input/output.
|
|
86
|
+
- Extend .write_to_fort14() to support quadrilateral output
|
|
87
|
+
- pip installation
|
|
88
|
+
|
|
89
|
+
### Example Usage:
|
|
90
|
+
```python
|
|
91
|
+
# Load mesh
|
|
92
|
+
import matplotlib.pyplot as plt
|
|
93
|
+
import numpy as np
|
|
94
|
+
from chilmesh import CHILmesh
|
|
95
|
+
|
|
96
|
+
# Randomly generate and triangulate points inside the donut domain.
|
|
97
|
+
domain_ffn = '/kaggle/working/CHILmesh/doc/domains/fort_14/annulus_200pts.fort.14'
|
|
98
|
+
mesh = CHILmesh.read_from_fort14( domain_ffn )
|
|
99
|
+
# mesh = CHILmesh() # random delaunay to-do
|
|
100
|
+
|
|
101
|
+
# Set up 2x3 subplot grid
|
|
102
|
+
fig, axs = plt.subplots(2, 3, figsize=(18, 10))
|
|
103
|
+
axs = axs.flatten()
|
|
104
|
+
fig.suptitle("Original vs Smoothed Mesh Comparison", fontsize=16)
|
|
105
|
+
|
|
106
|
+
# --- Original Mesh Plots ---
|
|
107
|
+
# 0. Original: Mesh + point/edge/element
|
|
108
|
+
_, ax = mesh.plot(ax=axs[0])
|
|
109
|
+
mesh.plot_point(1, ax=ax)
|
|
110
|
+
mesh.plot_edge(1, ax=ax)
|
|
111
|
+
mesh.plot_elem(1, ax=ax)
|
|
112
|
+
ax.set_title("Original: Mesh + Highlighted Entities")
|
|
113
|
+
|
|
114
|
+
# 1. Original: Layers
|
|
115
|
+
_, ax = mesh.plot_layer(ax=axs[1])
|
|
116
|
+
ax.set_title("Original: Mesh Layers")
|
|
117
|
+
|
|
118
|
+
# 2. Original: Quality
|
|
119
|
+
q0, _, stats0 = mesh.elem_quality( )
|
|
120
|
+
print( stats0 )
|
|
121
|
+
_, ax = mesh.plot_quality(ax=axs[2])
|
|
122
|
+
ax.set_title(f"Original: Quality Map (Median: {np.median(q0):.2f}, Std: {np.std(q0):.2f})")
|
|
123
|
+
|
|
124
|
+
# --- Smoothed Mesh Plots ---
|
|
125
|
+
# 3. Smoothed: Mesh + point/edge/element
|
|
126
|
+
mesh_smoothed = mesh.copy()
|
|
127
|
+
mesh_smoothed.smooth_mesh( method='fem', acknowledge_change=True )
|
|
128
|
+
_, ax = mesh_smoothed.plot(ax=axs[3])
|
|
129
|
+
mesh_smoothed.plot_point(1, ax=ax)
|
|
130
|
+
mesh_smoothed.plot_edge(1, ax=ax)
|
|
131
|
+
mesh_smoothed.plot_elem(1, ax=ax)
|
|
132
|
+
ax.set_title("Smoothed: Mesh + Highlighted Entities")
|
|
133
|
+
|
|
134
|
+
# 4. Smoothed: Layers
|
|
135
|
+
_, ax = mesh_smoothed.plot_layer(ax=axs[4])
|
|
136
|
+
ax.set_title("Smoothed: Mesh Layers")
|
|
137
|
+
|
|
138
|
+
# 5. Smoothed: Quality
|
|
139
|
+
q, _, stats = mesh_smoothed.elem_quality( )
|
|
140
|
+
print( stats )
|
|
141
|
+
_, ax = mesh_smoothed.plot_quality(ax=axs[5])
|
|
142
|
+
ax.set_title(f"Smoothed: Quality Map (Median: {np.median(q):.2f}, Std: {np.std(q):.2f})")
|
|
143
|
+
|
|
144
|
+
# Layout tidy
|
|
145
|
+
plt.tight_layout()
|
|
146
|
+
plt.subplots_adjust(top=0.9) # leave space for suptitle
|
|
147
|
+
plt.show()
|
|
148
|
+
#fig.savefig("result.png", dpi=600, bbox_inches='tight')
|
|
149
|
+
```
|
|
150
|
+

|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
> **Note**: When mesh is mixed-element, connectivity (elem2vert adjacency) follows the format `Node1-Node2-Node3-Node4`, such that `Node4 == Node3` for triangular elements.
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### BibTeX:
|
|
157
|
+
> DO Mattioli (2017). QuADMESH+: A Quadrangular ADvanced Mesh Generator for Hydrodynamic Models [Master's thesis, Ohio State University]. OhioLINK Electronic Theses and Dissertations Center. http://rave.ohiolink.edu/etdc/view?acc_num=osu1500627779532088
|
|
158
|
+
```bibtex
|
|
159
|
+
@mastersthesis{mattioli2017quadmesh,
|
|
160
|
+
author = {Mattioli, Dominik O.},
|
|
161
|
+
title = {{QuADMESH+}: A Quadrangular ADvanced Mesh Generator for Hydrodynamic Models},
|
|
162
|
+
school = {The Ohio State University},
|
|
163
|
+
year = {2017},
|
|
164
|
+
note = {Master's thesis},
|
|
165
|
+
url = {http://rave.ohiolink.edu/etdc/view?acc_num=osu1500627779532088}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
- [Read the pdf for free here](https://github.com/user-attachments/files/19727573/QuADMESH__Thesis_Doc.pdf)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
#### Acknowledgements
|
|
173
|
+
The following pieces of work inspired contributions to this repository:
|
|
174
|
+
- [ADMESH](https://doi.org/10.1007/s10236-012-0574-0)
|
|
175
|
+
- See the rest of the citations in the thesis [QuADMESH-Thesis.pdf](https://github.com/user-attachments/files/19724263/QuADMESH-Thesis.pdf)
|
|
176
|
+
- Original work was funded by [Aquaveo](https://aquaveo.com/) and contributed to by Alan Zundel.
|
|
177
|
+
- [FEM Smoother paper](https://api.semanticscholar.org/CorpusID:34335417)
|
|
178
|
+
- [Inspiring MATLAB implementation](https://github.com/CHLNDDEV/OceanMesh2D/blob/Projection/utilities/direct_smoother_lur.m)
|
|
179
|
+
- [Angle-Based Smoother paper](https://www.andrew.cmu.edu/user/shimada/papers/00-imr-zhou.pdf)
|
|
180
|
+
- The MATLAB code was originally developed for a master's thesis research project (2015–2017) at **The Ohio State University**.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "chilmesh"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Advanced mesh generation and smoothing for hydrodynamic domains"
|
|
9
|
+
authors = [{name = "Dominik Mattioli"}]
|
|
10
|
+
license = {file = "LICENSE"}
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.8"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"numpy",
|
|
15
|
+
"matplotlib",
|
|
16
|
+
"scipy",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[tool.setuptools]
|
|
20
|
+
package-dir = {"" = "src"}
|
|
21
|
+
packages = ["chilmesh", "chilmesh.utils"]
|
chilmesh-0.1.0/setup.cfg
ADDED