Coreform-Cubit-Mesh-Export 1.11.0__py3-none-any.whl
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.
- coreform_cubit_mesh_export-1.11.0.dist-info/METADATA +292 -0
- coreform_cubit_mesh_export-1.11.0.dist-info/RECORD +9 -0
- coreform_cubit_mesh_export-1.11.0.dist-info/WHEEL +5 -0
- coreform_cubit_mesh_export-1.11.0.dist-info/licenses/LICENSE +504 -0
- coreform_cubit_mesh_export-1.11.0.dist-info/top_level.txt +2 -0
- cubit_mesh_export.py +2738 -0
- other_formats/cubit_mesh_export_2d_geo_lukas_format.py +77 -0
- other_formats/cubit_mesh_export_3d_cdb.py +142 -0
- other_formats/cubit_mesh_export_3d_freefem_mesh.py +59 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Coreform_Cubit_Mesh_Export
|
|
3
|
+
Version: 1.11.0
|
|
4
|
+
Summary: Cubit mesh export to various formats including Gmsh, Nastran, VTK, and Netgen
|
|
5
|
+
Author-email: Kengo Sugahara <ksugahar@kindai.ac.jp>
|
|
6
|
+
Maintainer-email: Kengo Sugahara <ksugahar@kindai.ac.jp>
|
|
7
|
+
License-Expression: LGPL-2.1-only
|
|
8
|
+
Project-URL: Homepage, https://github.com/ksugahar/Coreform_Cubit_Mesh_Export
|
|
9
|
+
Project-URL: Repository, https://github.com/ksugahar/Coreform_Cubit_Mesh_Export
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/ksugahar/Coreform_Cubit_Mesh_Export/issues
|
|
11
|
+
Keywords: cubit,mesh,exodus,gmsh,nastran,vtk,netgen,ngsolve,export,coreform
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
24
|
+
Requires-Python: >=3.7
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Provides-Extra: netgen
|
|
28
|
+
Requires-Dist: ngsolve; extra == "netgen"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# Coreform Cubit Mesh Export
|
|
32
|
+
|
|
33
|
+
A Python library for exporting mesh files from Coreform Cubit to various formats.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
### Install from PyPI (Recommended)
|
|
38
|
+
```bash
|
|
39
|
+
pip install --upgrade coreform-cubit-mesh-export
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Install into Cubit's Python Environment
|
|
43
|
+
To use within Cubit's journal scripts (`play "script.py"`) for Gmsh/VTK/Nastran export:
|
|
44
|
+
|
|
45
|
+
**Windows:**
|
|
46
|
+
```bash
|
|
47
|
+
"C:\Program Files\Coreform Cubit 2025.3\bin\python3\python.exe" -m pip install coreform-cubit-mesh-export
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Linux/Mac:**
|
|
51
|
+
```bash
|
|
52
|
+
/path/to/cubit/bin/python3/python -m pip install coreform-cubit-mesh-export
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Install for Netgen/NGSolve Integration
|
|
56
|
+
For `export_netgen()` with high-order curving, install into your own Python environment (not Cubit's bundled Python):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Install with ngsolve dependency
|
|
60
|
+
pip install coreform-cubit-mesh-export[netgen]
|
|
61
|
+
|
|
62
|
+
# Or install separately
|
|
63
|
+
pip install coreform-cubit-mesh-export ngsolve
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Then add Cubit's bin path to your script:
|
|
67
|
+
```python
|
|
68
|
+
import sys
|
|
69
|
+
sys.path.append("C:/Program Files/Coreform Cubit 2025.3/bin")
|
|
70
|
+
import cubit
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Install Development Version from GitHub
|
|
74
|
+
```bash
|
|
75
|
+
pip install git+https://github.com/ksugahar/Coreform_Cubit_Mesh_Export.git
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Supported File Formats
|
|
79
|
+
|
|
80
|
+
- **Exodus II** ⭁ENEW
|
|
81
|
+
- Cubit's native format (.exo, .e, .g)
|
|
82
|
+
- All element types and orders
|
|
83
|
+
- Nodesets and Sidesets support
|
|
84
|
+
- Large model support (64-bit)
|
|
85
|
+
- **Netgen**
|
|
86
|
+
- Direct mesh conversion (no intermediate files)
|
|
87
|
+
- High-order curving via `mesh.Curve()` (order 2, 3, 4, 5, ...)
|
|
88
|
+
- All element types: Tet, Hex, Wedge, Pyramid
|
|
89
|
+
- **Gmsh Format**
|
|
90
|
+
- Version 4.1 (with $Entities section, 2D/3D auto-detect)
|
|
91
|
+
- Version 2.2 (full support, 2nd-order elements)
|
|
92
|
+
- **Nastran Format**
|
|
93
|
+
- 2D meshes
|
|
94
|
+
- 3D meshes
|
|
95
|
+
- **MEG Format** (for ELF)
|
|
96
|
+
- 2D meshes
|
|
97
|
+
- 3D meshes
|
|
98
|
+
- **VTK Format**
|
|
99
|
+
- Legacy VTK (.vtk) - auto-detect element order
|
|
100
|
+
- VTK XML (.vtu) - modern format with binary support
|
|
101
|
+
|
|
102
|
+
## Usage
|
|
103
|
+
|
|
104
|
+
### Netgen (High-Order Curving)
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
import cubit
|
|
108
|
+
import cubit_mesh_export
|
|
109
|
+
import ngsolve
|
|
110
|
+
|
|
111
|
+
# Create mesh in Cubit
|
|
112
|
+
cubit.cmd("create sphere radius 1")
|
|
113
|
+
cubit.cmd("volume 1 scheme tetmesh")
|
|
114
|
+
cubit.cmd("mesh volume 1")
|
|
115
|
+
cubit.cmd("block 1 add tet all in volume 1")
|
|
116
|
+
cubit.cmd("block 1 name 'domain'")
|
|
117
|
+
cubit.cmd("block 2 add tri all in surface all")
|
|
118
|
+
cubit.cmd("block 2 name 'boundary'")
|
|
119
|
+
|
|
120
|
+
# Export geometry for Curve() support
|
|
121
|
+
cubit.cmd('export step "geometry.step" overwrite')
|
|
122
|
+
|
|
123
|
+
# Convert to NGSolve mesh with high-order curving
|
|
124
|
+
ngmesh = cubit_mesh_export.export_netgen(cubit, geometry_file="geometry.step")
|
|
125
|
+
mesh = ngsolve.Mesh(ngmesh)
|
|
126
|
+
mesh.Curve(3) # 3rd order curved elements
|
|
127
|
+
|
|
128
|
+
# Use in FEM analysis
|
|
129
|
+
print(mesh.GetMaterials()) # ('domain',)
|
|
130
|
+
print(mesh.GetBoundaries()) # ('boundary',)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
See [docs/export_NetgenMesh.md](docs/export_NetgenMesh.md) for detailed documentation.
|
|
134
|
+
|
|
135
|
+
### Usage within Cubit
|
|
136
|
+
|
|
137
|
+
After generating a mesh in Cubit, execute a Python script as follows:
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
# Cubit command line
|
|
141
|
+
play "export_mesh.py"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Example content of `export_mesh.py`:
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
import cubit_mesh_export
|
|
148
|
+
|
|
149
|
+
# Export to Nastran format (3D)
|
|
150
|
+
FileName = 'output/model.nas'
|
|
151
|
+
cubit_mesh_export.export_nastran(cubit, FileName, DIM="3D")
|
|
152
|
+
|
|
153
|
+
# Export to Gmsh format (v2.2, supports 2nd-order elements)
|
|
154
|
+
FileName = 'output/model.msh'
|
|
155
|
+
cubit_mesh_export.export_gmsh_v2(cubit, FileName)
|
|
156
|
+
|
|
157
|
+
# Export to VTK format (auto-detects element order)
|
|
158
|
+
FileName = 'output/model.vtk'
|
|
159
|
+
cubit_mesh_export.export_vtk(cubit, FileName)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Function Reference
|
|
163
|
+
|
|
164
|
+
### Naming Convention
|
|
165
|
+
|
|
166
|
+
Functions use **snake_case** naming (e.g., `export_gmsh_v2`). Legacy PascalCase names are available as aliases for backward compatibility.
|
|
167
|
+
|
|
168
|
+
| Recommended (snake_case) | Legacy (PascalCase) |
|
|
169
|
+
|--------------------------|---------------------|
|
|
170
|
+
| `export_exodus` | *(already snake_case)* |
|
|
171
|
+
| `export_gmsh_v2` | `export_Gmsh_ver2` |
|
|
172
|
+
| `export_gmsh_v4` | `export_Gmsh_ver4` |
|
|
173
|
+
| `export_nastran` | `export_Nastran` |
|
|
174
|
+
| `export_netgen` | `export_NetgenMesh` |
|
|
175
|
+
| `export_meg` | *(already snake_case)* |
|
|
176
|
+
| `export_vtk` | *(already snake_case)* |
|
|
177
|
+
| `export_vtu` | *(already snake_case)* |
|
|
178
|
+
|
|
179
|
+
### Exodus II Format
|
|
180
|
+
- `export_exodus(cubit, filename, overwrite=True, large_model=False)` - Export to Exodus II format
|
|
181
|
+
- Cubit's native format (.exo, .e, .g)
|
|
182
|
+
- Supports all element types and orders
|
|
183
|
+
- `large_model=True` for meshes with >2 billion elements/nodes
|
|
184
|
+
|
|
185
|
+
### Netgen Format
|
|
186
|
+
- `export_netgen(cubit, geometry_file=None)` - Export to `netgen.meshing.Mesh` object
|
|
187
|
+
- Returns mesh ready for `ngsolve.Mesh()` conversion
|
|
188
|
+
- With `geometry_file`: enables `mesh.Curve(order)` for high-order elements
|
|
189
|
+
- Supports: Tet, Hex, Wedge, Pyramid, Tri, Quad
|
|
190
|
+
|
|
191
|
+
### Gmsh Format
|
|
192
|
+
- `export_gmsh_v4(cubit, filename, DIM="auto")` - Export to Gmsh v4.1 format with $Entities section
|
|
193
|
+
- DIM: "auto"/"2D"/"3D"
|
|
194
|
+
- `export_gmsh_v2(cubit, filename)` - Export to Gmsh v2.2 format with 2nd-order element support
|
|
195
|
+
|
|
196
|
+
### Nastran Format
|
|
197
|
+
- `export_nastran(cubit, filename, DIM="2D|3D", PYRAM=True|False)` - Export to Nastran BDF format
|
|
198
|
+
- Convert pyramids to degenerate hex with `PYRAM=False` (for JMAG compatibility)
|
|
199
|
+
|
|
200
|
+
### MEG Format (for ELF)
|
|
201
|
+
- `export_meg(cubit, filename, DIM="T|R|K", MGR2=[])` - T: 3D, R: axisymmetric, K: 2D
|
|
202
|
+
|
|
203
|
+
### VTK Format
|
|
204
|
+
- `export_vtk(cubit, filename)` - Export to Legacy VTK format, auto-detects element order
|
|
205
|
+
- `export_vtu(cubit, filename, binary=False)` - Export to VTK XML format (.vtu)
|
|
206
|
+
|
|
207
|
+
## High-Order Element Support
|
|
208
|
+
|
|
209
|
+
| Format | 1st Order | 2nd Order | 3rd+ Order |
|
|
210
|
+
|--------|-----------|-----------|------------|
|
|
211
|
+
| Exodus II | ✁E| ✁E| ✁E|
|
|
212
|
+
| NGSolve | ✁E| ✁E(via Curve) | ✁E(via Curve) |
|
|
213
|
+
| Gmsh v4.1 | ✁E| ✁E| ❁E|
|
|
214
|
+
| Gmsh v2.2 | ✁E| ✁E| ❁E|
|
|
215
|
+
| VTK/VTU | ✁E| ✁E| ❁E|
|
|
216
|
+
| Nastran | ✁E| ❁E| ❁E|
|
|
217
|
+
|
|
218
|
+
**Note**: Exodus II is Cubit's native format and supports all element orders. NGSolve's `mesh.Curve(order)` generates high-order nodes from geometry.
|
|
219
|
+
|
|
220
|
+
## Block Registration
|
|
221
|
+
|
|
222
|
+
This module uses **blocks only** for mesh export (not nodesets or sidesets).
|
|
223
|
+
|
|
224
|
+
**Why?** In Cubit, only blocks support element order control via `block X element type tetra10`. Nodesets and sidesets lack this capability. By standardizing on blocks, we ensure consistent 2nd order element support across all export formats.
|
|
225
|
+
|
|
226
|
+
**Boundary conditions** can still be defined using separate blocks:
|
|
227
|
+
```
|
|
228
|
+
block 1 add tet all in volume 1 # Domain
|
|
229
|
+
block 1 name "domain"
|
|
230
|
+
block 2 add tri all in surface 1 # Boundary
|
|
231
|
+
block 2 name "boundary"
|
|
232
|
+
block 1 element type tetra10 # Convert to 2nd order
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Geometry vs Mesh Elements in Blocks
|
|
236
|
+
|
|
237
|
+
Blocks can contain either **mesh elements** or **geometry**. Both are now supported:
|
|
238
|
+
|
|
239
|
+
```python
|
|
240
|
+
# Method 1: Register mesh elements directly (recommended)
|
|
241
|
+
block 1 add tet all
|
|
242
|
+
block 1 add hex all
|
|
243
|
+
|
|
244
|
+
# Method 2: Register geometry (volume, surface, curve, vertex)
|
|
245
|
+
block 1 add volume 1 # Exports tet/hex/wedge/pyramid in the volume
|
|
246
|
+
block 2 add surface 1 # Exports tri/quad on the surface
|
|
247
|
+
block 3 add curve 1 # Exports edges on the curve
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**Behavior by geometry type:**
|
|
251
|
+
|
|
252
|
+
| Block Contains | Elements Exported |
|
|
253
|
+
|----------------|-------------------|
|
|
254
|
+
| Volume | tet, hex, wedge, pyramid (3D elements only) |
|
|
255
|
+
| Surface | tri, quad (2D elements only) |
|
|
256
|
+
| Curve | edge (1D elements only) |
|
|
257
|
+
| Vertex | node (0D elements only) |
|
|
258
|
+
|
|
259
|
+
### Mixed Element Types Warning
|
|
260
|
+
|
|
261
|
+
When a block contains multiple 3D element types (e.g., tet + hex), a warning is displayed with instructions for 2nd order conversion:
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
WARNING: Block 1 ('mixed') contains multiple 3D element types: hex, tet
|
|
265
|
+
To convert all elements to 2nd order, you need to issue separate commands:
|
|
266
|
+
block 1 element type hex20
|
|
267
|
+
block 1 element type tetra10
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
This warning helps users understand that each element type requires its own conversion command.
|
|
271
|
+
|
|
272
|
+
## Requirements
|
|
273
|
+
|
|
274
|
+
- Coreform Cubit 2024.3 or later (provides Python environment and `cubit` module)
|
|
275
|
+
- NGSolve/Netgen (optional, for `export_NetgenMesh()` function)
|
|
276
|
+
|
|
277
|
+
## License
|
|
278
|
+
|
|
279
|
+
LGPL-2.1 (GNU Lesser General Public License version 2.1)
|
|
280
|
+
|
|
281
|
+
## Author
|
|
282
|
+
|
|
283
|
+
Kengo Sugahara (ksugahar@kindai.ac.jp)
|
|
284
|
+
|
|
285
|
+
## Repository
|
|
286
|
+
|
|
287
|
+
- GitHub: [https://github.com/ksugahar/Coreform_Cubit_Mesh_Export](https://github.com/ksugahar/Coreform_Cubit_Mesh_Export)
|
|
288
|
+
- PyPI: [https://pypi.org/project/coreform-cubit-mesh-export/](https://pypi.org/project/coreform-cubit-mesh-export/)
|
|
289
|
+
|
|
290
|
+
## Bug Reports & Feature Requests
|
|
291
|
+
|
|
292
|
+
Please submit via [GitHub Issues](https://github.com/ksugahar/Coreform_Cubit_Mesh_Export/issues).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
cubit_mesh_export.py,sha256=rXb00tG8RrhNPKgu3_7u74H-StWFIzmqFyFcbEB1lBk,106495
|
|
2
|
+
coreform_cubit_mesh_export-1.11.0.dist-info/licenses/LICENSE,sha256=oZDcnIBDdV2Q-LCnX6ZrnkLUr0yYC_XdxjPwEk2zzuc,26430
|
|
3
|
+
other_formats/cubit_mesh_export_2d_geo_lukas_format.py,sha256=XJh9K2nMYkpqBgSzTNhxy1dn4ZLczw0lecCCNBGaTHk,2543
|
|
4
|
+
other_formats/cubit_mesh_export_3d_cdb.py,sha256=xjJqORrz4HKd5mcEdaUyYK4jv0xBg32e_U9Dvldi8BM,5687
|
|
5
|
+
other_formats/cubit_mesh_export_3d_freefem_mesh.py,sha256=doBAxvORdAj5NJ07Z2POwz_bue-AtEqDMBUajV7mk8k,2095
|
|
6
|
+
coreform_cubit_mesh_export-1.11.0.dist-info/METADATA,sha256=D17omYMzaAS7A8KsxJQBKOXSqIybW8ukLLDzwL7I0qQ,10081
|
|
7
|
+
coreform_cubit_mesh_export-1.11.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
coreform_cubit_mesh_export-1.11.0.dist-info/top_level.txt,sha256=SkY8F11iefgXRQA876hZtbxHVhwAAI_p7zbi5b8M7So,32
|
|
9
|
+
coreform_cubit_mesh_export-1.11.0.dist-info/RECORD,,
|