of2su2 1.0.1__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.
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: of2su2
3
+ Version: 1.0.1
4
+ Summary: Convert OpenFOAM meshes (incl. snappyHexMesh polyhedra and hanging nodes) into valid SU2 meshes, with SU2-exact quality checks
5
+ Author: Vaibhav Hiwale
6
+ License-Expression: GPL-3.0-or-later
7
+ Project-URL: Homepage, https://github.com/VaibhavHiwale/of2su2
8
+ Project-URL: Documentation, https://github.com/VaibhavHiwale/of2su2/blob/main/docs/METHOD.md
9
+ Project-URL: Issues, https://github.com/VaibhavHiwale/of2su2/issues
10
+ Keywords: openfoam,su2,cfd,mesh,mesh-conversion,snappyhexmesh,polyhedral,hanging-nodes
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Scientific/Engineering :: Physics
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: numpy
20
+ Dynamic: license-file
21
+
22
+ # of2su2 — OpenFOAM mesh → SU2 mesh
23
+
24
+ [![PyPI](https://img.shields.io/pypi/v/of2su2)](https://pypi.org/project/of2su2/) [![tests](https://github.com/VaibhavHiwale/of2su2/actions/workflows/tests.yml/badge.svg)](https://github.com/VaibhavHiwale/of2su2/actions/workflows/tests.yml) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/VaibhavHiwale/of2su2/blob/main/LICENSE)
25
+
26
+ Converts an OpenFOAM mesh (`constant/polyMesh`, including snappyHexMesh meshes with polyhedra and hanging nodes) into a
27
+ valid, conformal SU2 mesh, and reports its quality exactly as SU2 computes it.
28
+
29
+ - **Single file**, Python 3 + numpy. No OpenFOAM or SU2 installation needed.
30
+ - **Only what SU2 cannot use is changed**: hex, prism, pyramid and tet cells are written as they are; polyhedra and
31
+ hanging-node cells are split into standard elements, mostly without added points.
32
+ - **Checked output**: no inverted elements, every face matched, Σ volume = domain volume, SU2's own dual-CV quality.
33
+ - **Nothing dropped silently**: zones, interfaces, patch types and groups are carried over or listed.
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install of2su2 # from PyPI
39
+ pip install git+https://github.com/VaibhavHiwale/of2su2 # latest version from GitHub
40
+ of2su2 --help
41
+ ```
42
+
43
+ Or download the single file `of2su2.py` and run `python3 of2su2.py` (needs only numpy).
44
+
45
+ ## Usage
46
+
47
+ ```bash
48
+ # convert (case folder or its constant/polyMesh folder)
49
+ of2su2 path/to/openfoamCase mesh.su2
50
+
51
+ # convert and improve the worst added points against SU2's quality metrics (slower)
52
+ of2su2 path/to/openfoamCase mesh.su2 --opt-apex 40 --opt-vr 1000
53
+
54
+ # score any .su2 file with SU2's quality metrics (optionally compare with SU2's MESH_QUALITY output)
55
+ of2su2 --check mesh.su2 [--vtk flow.vtk]
56
+ ```
57
+
58
+ Output: `mesh.su2`, a full report `mesh.su2.json`, mesh information `mesh.su2.info.json`, and a summary on screen:
59
+
60
+ ```text
61
+ zone rotating: 42,404 points, 61,106 elements, markers blade_wall, blade_root_cap, blade_tip_cap, AMI1
62
+ valid: YES (non-positive elements 0, unmatched faces 0)
63
+ SU2 orthogonality min 15.0° (points < 20°: 8, < 25°: 35), CV face AR max 173, sub-volume ratio max 357
64
+ SU2 orientation check (as SU2 v8.5.0 does it): flips 0, distorted 0; boundary quads flips 0, distorted 2
65
+ zone rest: 13,092 points, 18,902 elements, markers farfield, AMI2
66
+ ...
67
+ interface rotating | rest: markers AMI1 / AMI2 (coupled patches (cyclicAMI))
68
+ NOT carried over: pointZone 'frozenPoints' (0 points): the SU2 mesh format has no point sets
69
+ ```
70
+
71
+ ### Options
72
+
73
+ | Option | Meaning |
74
+ |---|---|
75
+ | `--opt-apex DEG` | move added centre points whose SU2 orthogonality is below DEG; never makes aspect ratio or volume ratio worse |
76
+ | `--opt-vr RATIO` | move added centre points of cells next to points with SU2 sub-volume ratio above RATIO |
77
+ | `--tri-interface` | triangulate zone-interface faces identically on both sides (for SU2 `WEIGHTED_AVERAGE`, see below) |
78
+ | `--single-zone` | one SU2 zone even if the mesh has separated cellZones |
79
+ | `--merge A B` | with `--single-zone`: glue this coupled patch pair (default: every cyclic/cyclicAMI pair whose points coincide is glued) |
80
+ | `--no-merge` | keep coupled patches as separate markers |
81
+ | `--no-patterns` | do not use the hanging-node transition patterns (centre-point split only) |
82
+ | `--nproc N` | worker processes (default: all CPUs; 1 = serial; the output does not depend on N) |
83
+ | `--check MESH.su2` | score an existing .su2 file instead of converting (`--vtk flow.vtk`: compare with SU2's output) |
84
+ | `--json` | print the full report |
85
+
86
+ ## What it handles
87
+
88
+ | OpenFOAM | SU2 |
89
+ |---|---|
90
+ | hex, prism, pyramid, tet cells | same elements |
91
+ | hex with hanging nodes (2:1 refinement transitions) | mixed-element transition pattern (tets/pyramids/prisms/hexes, mostly no added point) when valid and not worse than the centre-point split |
92
+ | polygonal prisms (wall layers over split faces) | triangular prisms, no added point |
93
+ | other polyhedra, tet-wedges | pyramids + tets around one added centre point; polygon faces triangulated once → conformal |
94
+ | patches | markers (`MARKER_TAG=`), SU2 face winding |
95
+ | cellZones separated in OpenFOAM (`createBaffles` + `mergeOrSplitBaffles -split`) | one SU2 zone per cellZone + `rest` (`NZONE=` file); the coupled patches (e.g. cyclicAMI `AMI1`/`AMI2`) become the interface markers |
96
+ | cellZones with a conformal boundary (internal faceZone) | one SU2 zone; reported with the reason (of2su2 does not change the mesh topology) |
97
+ | patch types, groups, pointZones, sets | `<mesh>.su2.info.json` + "NOT carried over" list in the summary |
98
+ | ASCII or binary polyMesh, 32/64-bit labels | — |
99
+
100
+ Names are kept and made SU2-safe where needed; every rename is listed.
101
+
102
+ ### Multizone meshes and `--tri-interface`
103
+
104
+ For a rotating zone (MRF) in SU2, separate the zone in OpenFOAM first:
105
+
106
+ ```bash
107
+ createBaffles -overwrite # faceZone → patch pair (e.g. cyclicAMI AMI1/AMI2)
108
+ mergeOrSplitBaffles -split -overwrite # duplicate the points → two separated cell regions
109
+ of2su2 . mesh.su2 # → 2 SU2 zones, interface markers AMI1/AMI2
110
+ ```
111
+
112
+ In the SU2 config use `MARKER_ZONE_INTERFACE= ( AMI1, AMI2 )` and `KIND_INTERPOLATION`. The interface nodes coincide, so
113
+ `NEAREST_NEIGHBOR` is exact. SU2's conservative `WEIGHTED_AVERAGE` interpolation fails (NaN) on quadrilateral interface
114
+ elements; `--tri-interface` triangulates every interface face identically on both sides and splits only the cells
115
+ touching the interface (tets on the interface, pyramids elsewhere). It is the only option that changes cells SU2 could
116
+ use as they are.
117
+
118
+ ## Known limitations
119
+
120
+ - 3D meshes only; periodic `cyclic` patches with a transform are not converted.
121
+ - Validated on the bundled test meshes and on one large snappyHexMesh rotor mesh (13.7 M cells, MRF zone, conformal
122
+ and baffled); other meshers may show cell types not covered yet — the validity check reports any failure.
123
+ - Large meshes need memory (≈ 31 GB for 13.7 M cells) and time (≈ 7 min; ≈ 40 min with `--tri-interface`).
124
+ - At zone interfaces each SU2 zone sees only half of a node's control volume, so SU2's orthogonality there is lower
125
+ than for the same mesh as one zone. This comes from SU2's dual mesh, not from the conversion.
126
+
127
+ ## Method and validation
128
+
129
+ See [docs/METHOD.md](https://github.com/VaibhavHiwale/of2su2/blob/main/docs/METHOD.md): SU2 mesh requirements (from the SU2 source), the conversion steps, the quality
130
+ metrics, performance, validation results and credits.
131
+
132
+ ## Tests
133
+
134
+ ```bash
135
+ pip install pytest && python3 -m pytest -q tests/
136
+ ```
137
+
138
+ | Path | Content |
139
+ |---|---|
140
+ | `tests/test_of2su2.py` | regression tests (pattern table, validity, quality, zones, interfaces) |
141
+ | `testcases/rotor_cut/` | 2,441 cells covering every unsupported cell shape of a 13.7 M-cell snappy rotor mesh (polyMesh included) |
142
+ | `testcases/blade_box/` | small snappyHexMesh blade case with refinement transitions, wall layers and an AMI pair (`Allrun` builds it; needs OpenFOAM) |
143
+ | `su2/su2_mesh_quality.cfg` | SU2 config that writes SU2's own mesh-quality output, to compare with `--check --vtk` |
144
+
145
+ ## Licence
146
+
147
+ **GPL v3 or later** ([LICENSE](https://github.com/VaibhavHiwale/of2su2/blob/main/LICENSE)). of2su2 contains the hanging-node transition-pattern table of MixedOcTree
148
+ (github.com/clobosmesher/MixedOcTree, (C) 2013-2017 Claudio Lobos et al., GPL v3), based on E. González & C. Lobos,
149
+ "A set of mixed-element transition patterns for adaptive 3D meshing" (2014/15). Other prior art is credited in
150
+ [docs/METHOD.md](https://github.com/VaibhavHiwale/of2su2/blob/main/docs/METHOD.md).
151
+
152
+ ## Citation
153
+
154
+ If you use of2su2 in published work, please cite it (GitHub: "Cite this repository", from `CITATION.cff`).
@@ -0,0 +1,7 @@
1
+ of2su2.py,sha256=StLQP9cy13JRkwznSxAHhMDana9lAg9-Q2efkH2zYvo,159225
2
+ of2su2-1.0.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
3
+ of2su2-1.0.1.dist-info/METADATA,sha256=BBDr2ojt11xi8Nhb1xnSJg0mvnYUke9UNnienNNJhfE,8729
4
+ of2su2-1.0.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
5
+ of2su2-1.0.1.dist-info/entry_points.txt,sha256=YpR0r3A6yz25AJOwak4Xdl4XKlYHb8wTGvLikwN0Hmk,39
6
+ of2su2-1.0.1.dist-info/top_level.txt,sha256=uIGTeErmgR2Jfm3B8TBfWadQZ4ZN10eAvawVj7nWSF8,7
7
+ of2su2-1.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ of2su2 = of2su2:main