Skip to content

Commit 0741050

Browse files
GBenedettmengmengzhang2019GuidoValli97
authored
Add pentagrow for automatic hybrid mesh generation (#293)
Automatic RANS mesh generation using Gmsh-Pentagrow-Tetgen Co-authored-by: Mengmeng Zhang <mengmeng.zha@gmail.com> Co-authored-by: GuidoValli97 <guidovalli@hotm>
1 parent f1ee8de commit 0741050

File tree

8 files changed

+604
-54
lines changed

8 files changed

+604
-54
lines changed

ceasiompy/CPACS2GMSH/README.md

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@
1010

1111
<br />
1212

13-
`CPACS2GMSH` is an automatic mesh generator module for a [CPACS](https://www.cpacs.de) aircraft geometry [[1]](#Alder20) using [GMSH](https://gmsh.info/) ,a finite element mesh generator. An unstructured mesh is automatically generated in a spherical domain surrounding the aircraft. The resulting mesh can be used for a CFD calculation by connecting the `SU2Run` module after `CPACS2GMSH` module.
13+
`CPACS2GMSH` is an automatic mesh generator module for a [CPACS](https://www.cpacs.de) aircraft geometry [[1]](#Alder20) using [GMSH](https://gmsh.info/) ,a finite element mesh generator.
14+
15+
It's currently possible to choose between two options for 3D meshing of the external domain.
16+
Selecting the 'Euler' an unstructured mesh is automatically generated in a spherical domain surrounding the aircraft.
17+
Instead, selecting the 'RANS' option Gmsh will generate only the 2D mesh of the entire aircraft, which will then be processed by the programme [Pentagrow] to generate the structured part that wraps the geometry, then [Tetgen](https://wias-berlin.de/software/tetgen/1.5/doc/manual/manual.pdf) package provides for meshing of the unstructured part. The hybrid mesh obtained will constitute the 3D domain.
18+
19+
20+
The resulting mesh can be used for a CFD calculation by connecting the `SU2Run` module after `CPACS2GMSH` module.
1421

1522
<br />
1623

@@ -21,7 +28,7 @@
2128
Surface mesh of the D150 aircraft, with a symmetry plane
2229
</p>
2330

24-
If an engine (simple or doubleflux) is part of the aircraft geometry, CPACS2GMSH will combine the different nacelle parts in one engine and will add an intake and exhaust surface that can be used by SU2Run to simulate the engine operation. For doubleflux engines, only one intake surface will be placed on the fan cowl and two exhaust surfaces will be placed on the fan and center cowl.
31+
By Euler if an engine (simple or doubleflux) is part of the aircraft geometry, CPACS2GMSH will combine the different nacelle parts in one engine and will add an intake and exhaust surface that can be used by SU2Run to simulate the engine operation. For doubleflux engines, only one intake surface will be placed on the fan cowl and two exhaust surfaces will be placed on the fan and center cowl.
2532

2633
If the aircraft geometry contains propeller engines, their blades will be replaced by 2D disk surfaces in order to simulate the propeller engines with SU2 disk actuator model.
2734

@@ -43,6 +50,11 @@ General options:
4350
* `Display mesh with GMSH : False`
4451
Open the gmsh GUI after the generation of the surface mesh (2D) and the domain mesh (3D). This option is usefully to control the quality of the automated generated mesh or make extra operation with gmsh GUI.
4552

53+
54+
Mesh type:
55+
* `Choice the mesh type: Euler or RANS`
56+
Choose between an unstructured domain (Euler) and an hybrid domain (RANS)
57+
4658
Domain:
4759

4860
* `Use Symmetry : False`
@@ -51,7 +63,8 @@ Apply a symmetry operation to the model with a xz symmetry plane in the center o
5163
* `Farfield size factor : 6.0`
5264
Enable to control the spherical domain size. The fluid domain surrounding the aircraft is defined with a radius equivalent to the largest xyz aircraft dimension times the `Farfield size factor
5365

54-
Mesh size:
66+
if Euler:
67+
Euler options:
5568

5669
* `Farfield : 25.0` Mesh size of the farfield surfaces
5770
* `Fuselage : 0.4` Mesh size of the fuselage surfaces
@@ -61,6 +74,23 @@ Mesh size:
6174

6275
:warning: The mesh size values are unitless. They are consistent with the aircraft dimensions units
6376

77+
else:
78+
RANS options:
79+
80+
*`Number of layer: 20`
81+
Number of prismatic element layers
82+
*`height of first layer: 3 e-5 mm`
83+
Height of the first prismatic cell, touching the wall, in mesh length units.
84+
*`Max layer thickness: 10 cm`
85+
The maximum allowed absolute thickness of the prismatic layer.
86+
*`Growth factor: 1.2`
87+
Growth factor between edge lengths of coincident tetrahedra
88+
*`Feature angle: 80 grad`
89+
Whenever the dihedral angle of two triangle is smaller than this limit, the resulting edge is understood to represent an actual geometrical feature. Larger angles are treated as resulting from approximation of curved surfaces by linear triangles
90+
*`Surface mesh size: 5 `
91+
Surface mesh size factor compared to the aircraft largest dimension, omogeneus everywhere
92+
93+
6494
Advanced mesh parameters :
6595

6696
* `LE/TE refinement factor : 7.0`
@@ -81,12 +111,16 @@ Engine exhaust surface position from the back of the engine fan cowl in percent
81111

82112
## Analyses
83113

84-
`CPACS2GMSH` Generate .brep files with TiGL for each part of the aircraft configuration. Then all the parts are imported into GMSH to generates a SU2 mesh file.
114+
`CPACS2GMSH` Generate .brep files with TiGL for each part of the aircraft configuration. Then all the parts are imported into GMSH to generates a SU2 mesh file
115+
116+
for the euler case, instead a .stl file is generated to be read by pentagrow
85117

86118
## Outputs
87119

88120
`CPACS2GMSH` outputs a SU2 mesh files (.su2), the path to this file is saved in the CPACS file under this xpath: /cpacs/toolspecific/CEASIOMpy/filesPath/su2Mesh.
89121

122+
With RANS also a configuration file is created in the same directory containing the setup used to generate the hybrid mesh.
123+
90124
## Installation or requirements
91125

92126
`CPACS2GMSH` is a native CEASIOMpy module, hence it is available and installed by default. To run it, you just have to be sure that you are in the CEASIOMpy Conda environment.
@@ -95,6 +129,8 @@ Engine exhaust surface position from the back of the engine fan cowl in percent
95129

96130
At the time of writing, this module is not able to handle aircraft with control surfaces (they will not be modelled and thus appear in the final mesh).
97131

132+
For the RANS part, it is only possible to process aircraft consisting of .brep files of category 'fuselage' and 'wing'
133+
98134
## More information
99135

100136
* [CPACS official website](https://www.cpacs.de)

ceasiompy/CPACS2GMSH/__specs__.py

Lines changed: 123 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
SU2MESH_XPATH,
2121
GMSH_MESH_SIZE_FACTOR_FUSELAGE_XPATH,
2222
GMSH_MESH_SIZE_FACTOR_WINGS_XPATH,
23+
GMSH_MESH_TYPE_XPATH,
24+
GMSH_NUMBER_LAYER_XPATH,
25+
GMSH_H_FIRST_LAYER_XPATH,
26+
GMSH_MAX_THICKNESS_LAYER_XPATH,
27+
GMSH_GROWTH_FACTOR_XPATH,
28+
GMSH_GROWTH_RATIO_XPATH,
29+
GMSH_SURFACE_MESH_SIZE_XPATH,
30+
GMSH_FEATURE_ANGLE_XPATH,
2331
)
2432
from ceasiompy.utils.moduleinterfaces import CPACSInOut
2533

@@ -52,15 +60,15 @@
5260
)
5361

5462
cpacs_inout.add_input(
55-
var_name="export_propellers",
56-
var_type=bool,
57-
default_value=False,
63+
var_name="type_mesh",
64+
var_type=list,
65+
default_value=["Euler", "RANS"],
5866
unit="1",
59-
descr="Export propeller(s) to be use as disk actuator",
60-
xpath=GMSH_EXPORT_PROP_XPATH,
67+
descr="Chose between Euler and RANS mesh",
68+
xpath=GMSH_MESH_TYPE_XPATH,
6169
gui=True,
62-
gui_name="Export propeller(s)",
63-
gui_group="General options",
70+
gui_name="Chose the mesh type",
71+
gui_group="Mesh type",
6472
)
6573

6674
cpacs_inout.add_input(
@@ -78,7 +86,7 @@
7886
cpacs_inout.add_input(
7987
var_name="farfield_factor",
8088
var_type=float,
81-
default_value=6,
89+
default_value=10,
8290
unit="[-]",
8391
descr="Farfield size factor compare to the aircraft largest dimension",
8492
xpath=GMSH_FARFIELD_FACTOR_XPATH,
@@ -93,11 +101,11 @@
93101
default_value=10,
94102
unit="[-]",
95103
descr="""Factor proportional to the biggest cell on the plane
96-
to obtain cell size on the farfield""",
104+
to obtain cell size on the farfield(just for Euler)""",
97105
xpath=GMSH_MESH_SIZE_FARFIELD_XPATH,
98106
gui=True,
99107
gui_name="Farfield mesh size factor",
100-
gui_group="Mesh size",
108+
gui_group="Euler options",
101109
)
102110

103111
cpacs_inout.add_input(
@@ -109,7 +117,7 @@
109117
xpath=GMSH_MESH_SIZE_FACTOR_FUSELAGE_XPATH,
110118
gui=True,
111119
gui_name="Fuselage mesh size factor",
112-
gui_group="Mesh size",
120+
gui_group="Euler options",
113121
)
114122

115123
cpacs_inout.add_input(
@@ -121,7 +129,7 @@
121129
xpath=GMSH_MESH_SIZE_FACTOR_WINGS_XPATH,
122130
gui=True,
123131
gui_name="Wings mesh size factor",
124-
gui_group="Mesh size",
132+
gui_group="Euler options",
125133
)
126134

127135
cpacs_inout.add_input(
@@ -133,7 +141,7 @@
133141
xpath=GMSH_MESH_SIZE_ENGINES_XPATH,
134142
gui=True,
135143
gui_name="Engines",
136-
gui_group="Mesh size",
144+
gui_group="Euler options",
137145
)
138146

139147
cpacs_inout.add_input(
@@ -145,7 +153,103 @@
145153
xpath=GMSH_MESH_SIZE_PROPELLERS_XPATH,
146154
gui=True,
147155
gui_name="Propellers",
148-
gui_group="Mesh size",
156+
gui_group="Euler options",
157+
)
158+
159+
cpacs_inout.add_input(
160+
var_name="n_layer",
161+
var_type=int,
162+
default_value=20,
163+
unit="[-]",
164+
descr="Number of prismatic element layers.",
165+
xpath=GMSH_NUMBER_LAYER_XPATH,
166+
gui=True,
167+
gui_name="Number of layer",
168+
gui_group="RANS options",
169+
)
170+
171+
cpacs_inout.add_input(
172+
var_name="h_first_layer",
173+
var_type=float,
174+
default_value=3,
175+
unit="[\u03BCm]",
176+
descr="is the height of the first prismatic cell, touching the wall, in mesh length units.",
177+
xpath=GMSH_H_FIRST_LAYER_XPATH,
178+
gui=True,
179+
gui_name="Height of first layer",
180+
gui_group="RANS options",
181+
)
182+
183+
cpacs_inout.add_input(
184+
var_name="max_layer_thickness",
185+
var_type=float,
186+
default_value=100,
187+
unit="[mm]",
188+
descr="The maximum allowed absolute thickness of the prismatic layer.",
189+
xpath=GMSH_MAX_THICKNESS_LAYER_XPATH,
190+
gui=True,
191+
gui_name="Max layer thickness",
192+
gui_group="RANS options",
193+
)
194+
195+
cpacs_inout.add_input(
196+
var_name="growth_ratio",
197+
var_type=float,
198+
default_value=1.2,
199+
unit="[-]",
200+
descr="the largest allowed ratio between the wall-normal edge lengths of consecutive cells",
201+
xpath=GMSH_GROWTH_RATIO_XPATH,
202+
gui=True,
203+
gui_name="Growth ratio",
204+
gui_group="RANS options",
205+
)
206+
207+
cpacs_inout.add_input(
208+
var_name="growth_factor",
209+
var_type=float,
210+
default_value=1.4,
211+
unit="[-]",
212+
descr="Desired growth factor between edge lengths of coincident tetrahedra",
213+
xpath=GMSH_GROWTH_FACTOR_XPATH,
214+
gui=True,
215+
gui_name="Growth factor",
216+
gui_group="RANS options",
217+
)
218+
219+
cpacs_inout.add_input(
220+
var_name="feature_angle",
221+
var_type=float,
222+
default_value=40,
223+
unit="[grad]",
224+
descr="Larger angles are treated as resulting from approximation of curved surfaces",
225+
xpath=GMSH_FEATURE_ANGLE_XPATH,
226+
gui=True,
227+
gui_name="Feature Angle",
228+
gui_group="RANS options",
229+
)
230+
231+
cpacs_inout.add_input(
232+
var_name="surface_mesh_factor",
233+
var_type=float,
234+
default_value=5,
235+
unit="[10^-3]",
236+
descr="Surface mesh size factor compared to aircraft largest dimension (omogeneus everywhere)",
237+
xpath=GMSH_SURFACE_MESH_SIZE_XPATH,
238+
gui=True,
239+
gui_name="Surface mesh size",
240+
gui_group="RANS options",
241+
)
242+
243+
cpacs_inout.add_input(
244+
var_name="export_propellers",
245+
var_type=bool,
246+
default_value=False,
247+
unit="1",
248+
descr="Export propeller(s) to be use as disk actuator",
249+
xpath=GMSH_EXPORT_PROP_XPATH,
250+
gui=True,
251+
gui_name="Export propeller(s)",
252+
gui_group="General options",
149253
)
150254

151255
cpacs_inout.add_input(
@@ -157,7 +261,7 @@
157261
xpath=GMSH_N_POWER_FACTOR_XPATH,
158262
gui=True,
159263
gui_name="n power factor",
160-
gui_group="Advanced mesh parameters",
264+
gui_group="Advanced Euler mesh parameters",
161265
)
162266

163267
cpacs_inout.add_input(
@@ -169,7 +273,7 @@
169273
xpath=GMSH_N_POWER_FIELD_XPATH,
170274
gui=True,
171275
gui_name="n power field",
172-
gui_group="Advanced mesh parameters",
276+
gui_group="Advanced Euler mesh parameters",
173277
)
174278

175279
cpacs_inout.add_input(
@@ -181,7 +285,7 @@
181285
xpath=GMSH_REFINE_FACTOR_XPATH,
182286
gui=True,
183287
gui_name="LE/TE refinement factor",
184-
gui_group="Advanced mesh parameters",
288+
gui_group="Advanced Euler mesh parameters",
185289
)
186290
cpacs_inout.add_input(
187291
var_name="refine_truncated",
@@ -192,7 +296,7 @@
192296
xpath=GMSH_REFINE_TRUNCATED_XPATH,
193297
gui=True,
194298
gui_name="Refine truncated TE",
195-
gui_group="Advanced mesh parameters",
299+
gui_group="Advanced Euler mesh parameters",
196300
)
197301

198302
cpacs_inout.add_input(
@@ -205,7 +309,7 @@
205309
xpath=GMSH_AUTO_REFINE_XPATH,
206310
gui=True,
207311
gui_name="Auto refine",
208-
gui_group="Advanced mesh parameters",
312+
gui_group="Advanced Euler mesh parameters",
209313
)
210314

211315
cpacs_inout.add_input(

0 commit comments

Comments
 (0)