Skip to content

Commit

Permalink
Add pentagrow for automatic hybrid mesh generation (#293)
Browse files Browse the repository at this point in the history
Automatic RANS mesh generation using Gmsh-Pentagrow-Tetgen

Co-authored-by: Mengmeng Zhang <mengmeng.zha@gmail.com>
Co-authored-by: GuidoValli97 <guidovalli@hotm>
  • Loading branch information
3 people authored Apr 19, 2024
1 parent f1ee8de commit 0741050
Show file tree
Hide file tree
Showing 8 changed files with 604 additions and 54 deletions.
44 changes: 40 additions & 4 deletions ceasiompy/CPACS2GMSH/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@

<br />

`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.
`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.

It's currently possible to choose between two options for 3D meshing of the external domain.
Selecting the 'Euler' an unstructured mesh is automatically generated in a spherical domain surrounding the aircraft.
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.


The resulting mesh can be used for a CFD calculation by connecting the `SU2Run` module after `CPACS2GMSH` module.

<br />

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

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.
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.

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.

Expand All @@ -43,6 +50,11 @@ General options:
* `Display mesh with GMSH : False`
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.


Mesh type:
* `Choice the mesh type: Euler or RANS`
Choose between an unstructured domain (Euler) and an hybrid domain (RANS)

Domain:

* `Use Symmetry : False`
Expand All @@ -51,7 +63,8 @@ Apply a symmetry operation to the model with a xz symmetry plane in the center o
* `Farfield size factor : 6.0`
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

Mesh size:
if Euler:
Euler options:

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

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

else:
RANS options:

*`Number of layer: 20`
Number of prismatic element layers
*`height of first layer: 3 e-5 mm`
Height of the first prismatic cell, touching the wall, in mesh length units.
*`Max layer thickness: 10 cm`
The maximum allowed absolute thickness of the prismatic layer.
*`Growth factor: 1.2`
Growth factor between edge lengths of coincident tetrahedra
*`Feature angle: 80 grad`
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
*`Surface mesh size: 5 `
Surface mesh size factor compared to the aircraft largest dimension, omogeneus everywhere


Advanced mesh parameters :

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

## Analyses

`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.
`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

for the euler case, instead a .stl file is generated to be read by pentagrow

## Outputs

`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.

With RANS also a configuration file is created in the same directory containing the setup used to generate the hybrid mesh.

## Installation or requirements

`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.
Expand All @@ -95,6 +129,8 @@ Engine exhaust surface position from the back of the engine fan cowl in percent

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).

For the RANS part, it is only possible to process aircraft consisting of .brep files of category 'fuselage' and 'wing'

## More information

* [CPACS official website](https://www.cpacs.de)
Expand Down
142 changes: 123 additions & 19 deletions ceasiompy/CPACS2GMSH/__specs__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
SU2MESH_XPATH,
GMSH_MESH_SIZE_FACTOR_FUSELAGE_XPATH,
GMSH_MESH_SIZE_FACTOR_WINGS_XPATH,
GMSH_MESH_TYPE_XPATH,
GMSH_NUMBER_LAYER_XPATH,
GMSH_H_FIRST_LAYER_XPATH,
GMSH_MAX_THICKNESS_LAYER_XPATH,
GMSH_GROWTH_FACTOR_XPATH,
GMSH_GROWTH_RATIO_XPATH,
GMSH_SURFACE_MESH_SIZE_XPATH,
GMSH_FEATURE_ANGLE_XPATH,
)
from ceasiompy.utils.moduleinterfaces import CPACSInOut

Expand Down Expand Up @@ -52,15 +60,15 @@
)

cpacs_inout.add_input(
var_name="export_propellers",
var_type=bool,
default_value=False,
var_name="type_mesh",
var_type=list,
default_value=["Euler", "RANS"],
unit="1",
descr="Export propeller(s) to be use as disk actuator",
xpath=GMSH_EXPORT_PROP_XPATH,
descr="Chose between Euler and RANS mesh",
xpath=GMSH_MESH_TYPE_XPATH,
gui=True,
gui_name="Export propeller(s)",
gui_group="General options",
gui_name="Chose the mesh type",
gui_group="Mesh type",
)

cpacs_inout.add_input(
Expand All @@ -78,7 +86,7 @@
cpacs_inout.add_input(
var_name="farfield_factor",
var_type=float,
default_value=6,
default_value=10,
unit="[-]",
descr="Farfield size factor compare to the aircraft largest dimension",
xpath=GMSH_FARFIELD_FACTOR_XPATH,
Expand All @@ -93,11 +101,11 @@
default_value=10,
unit="[-]",
descr="""Factor proportional to the biggest cell on the plane
to obtain cell size on the farfield""",
to obtain cell size on the farfield(just for Euler)""",
xpath=GMSH_MESH_SIZE_FARFIELD_XPATH,
gui=True,
gui_name="Farfield mesh size factor",
gui_group="Mesh size",
gui_group="Euler options",
)

cpacs_inout.add_input(
Expand All @@ -109,7 +117,7 @@
xpath=GMSH_MESH_SIZE_FACTOR_FUSELAGE_XPATH,
gui=True,
gui_name="Fuselage mesh size factor",
gui_group="Mesh size",
gui_group="Euler options",
)

cpacs_inout.add_input(
Expand All @@ -121,7 +129,7 @@
xpath=GMSH_MESH_SIZE_FACTOR_WINGS_XPATH,
gui=True,
gui_name="Wings mesh size factor",
gui_group="Mesh size",
gui_group="Euler options",
)

cpacs_inout.add_input(
Expand All @@ -133,7 +141,7 @@
xpath=GMSH_MESH_SIZE_ENGINES_XPATH,
gui=True,
gui_name="Engines",
gui_group="Mesh size",
gui_group="Euler options",
)

cpacs_inout.add_input(
Expand All @@ -145,7 +153,103 @@
xpath=GMSH_MESH_SIZE_PROPELLERS_XPATH,
gui=True,
gui_name="Propellers",
gui_group="Mesh size",
gui_group="Euler options",
)

cpacs_inout.add_input(
var_name="n_layer",
var_type=int,
default_value=20,
unit="[-]",
descr="Number of prismatic element layers.",
xpath=GMSH_NUMBER_LAYER_XPATH,
gui=True,
gui_name="Number of layer",
gui_group="RANS options",
)

cpacs_inout.add_input(
var_name="h_first_layer",
var_type=float,
default_value=3,
unit="[\u03BCm]",
descr="is the height of the first prismatic cell, touching the wall, in mesh length units.",
xpath=GMSH_H_FIRST_LAYER_XPATH,
gui=True,
gui_name="Height of first layer",
gui_group="RANS options",
)

cpacs_inout.add_input(
var_name="max_layer_thickness",
var_type=float,
default_value=100,
unit="[mm]",
descr="The maximum allowed absolute thickness of the prismatic layer.",
xpath=GMSH_MAX_THICKNESS_LAYER_XPATH,
gui=True,
gui_name="Max layer thickness",
gui_group="RANS options",
)

cpacs_inout.add_input(
var_name="growth_ratio",
var_type=float,
default_value=1.2,
unit="[-]",
descr="the largest allowed ratio between the wall-normal edge lengths of consecutive cells",
xpath=GMSH_GROWTH_RATIO_XPATH,
gui=True,
gui_name="Growth ratio",
gui_group="RANS options",
)

cpacs_inout.add_input(
var_name="growth_factor",
var_type=float,
default_value=1.4,
unit="[-]",
descr="Desired growth factor between edge lengths of coincident tetrahedra",
xpath=GMSH_GROWTH_FACTOR_XPATH,
gui=True,
gui_name="Growth factor",
gui_group="RANS options",
)

cpacs_inout.add_input(
var_name="feature_angle",
var_type=float,
default_value=40,
unit="[grad]",
descr="Larger angles are treated as resulting from approximation of curved surfaces",
xpath=GMSH_FEATURE_ANGLE_XPATH,
gui=True,
gui_name="Feature Angle",
gui_group="RANS options",
)

cpacs_inout.add_input(
var_name="surface_mesh_factor",
var_type=float,
default_value=5,
unit="[10^-3]",
descr="Surface mesh size factor compared to aircraft largest dimension (omogeneus everywhere)",
xpath=GMSH_SURFACE_MESH_SIZE_XPATH,
gui=True,
gui_name="Surface mesh size",
gui_group="RANS options",
)

cpacs_inout.add_input(
var_name="export_propellers",
var_type=bool,
default_value=False,
unit="1",
descr="Export propeller(s) to be use as disk actuator",
xpath=GMSH_EXPORT_PROP_XPATH,
gui=True,
gui_name="Export propeller(s)",
gui_group="General options",
)

cpacs_inout.add_input(
Expand All @@ -157,7 +261,7 @@
xpath=GMSH_N_POWER_FACTOR_XPATH,
gui=True,
gui_name="n power factor",
gui_group="Advanced mesh parameters",
gui_group="Advanced Euler mesh parameters",
)

cpacs_inout.add_input(
Expand All @@ -169,7 +273,7 @@
xpath=GMSH_N_POWER_FIELD_XPATH,
gui=True,
gui_name="n power field",
gui_group="Advanced mesh parameters",
gui_group="Advanced Euler mesh parameters",
)

cpacs_inout.add_input(
Expand All @@ -181,7 +285,7 @@
xpath=GMSH_REFINE_FACTOR_XPATH,
gui=True,
gui_name="LE/TE refinement factor",
gui_group="Advanced mesh parameters",
gui_group="Advanced Euler mesh parameters",
)
cpacs_inout.add_input(
var_name="refine_truncated",
Expand All @@ -192,7 +296,7 @@
xpath=GMSH_REFINE_TRUNCATED_XPATH,
gui=True,
gui_name="Refine truncated TE",
gui_group="Advanced mesh parameters",
gui_group="Advanced Euler mesh parameters",
)

cpacs_inout.add_input(
Expand All @@ -205,7 +309,7 @@
xpath=GMSH_AUTO_REFINE_XPATH,
gui=True,
gui_name="Auto refine",
gui_group="Advanced mesh parameters",
gui_group="Advanced Euler mesh parameters",
)

cpacs_inout.add_input(
Expand Down
Loading

0 comments on commit 0741050

Please sign in to comment.