Mesh generation using cfMesh

Transcription

Mesh generation using cfMesh
Disclaimer
“This offering is not approved or
endorsed by OpenCFD Limited, the
producer of the OpenFOAM software
and owner of the OPENFOAM® and
OpenCFD® trade marks.”
Introductory OpenFOAM® Course
From 16th to 20th February, 2015
University of Genoa, DICCA
Dipartimento di Ingegneria Civile, Chimica e Ambientale
Your Lecturer
Joel GUERRERO
joel.guerrero@unige.it
guerrero@wolfdynamics.com Your Lecturer
Damiano NATALI
damiano.natali@unige.it
natali@wolfdynamics.com Your Lecturer
Matteo BARGIACCHI
matteo.bargiacchi@unige.it
bargiacchi@wolfdynamics.com Today’s lecture
1.  Mesh generation using cfMesh
Mesh generation using cfMesh
Friendliness
Final quality of the
mesh
BlockMesh
snappyHexMesh
cfMesh
Salome
Engrid
GMSH
NETGEN
Triangle/Tetgen
Good
Fairly Good
Mild
Bad
Very Bad
Mesh generation using cfMesh
Case 1. Wolf profile (2D external mesh).
Let us generate the mesh by using cfMesh.
From now on, follow me.
In the terminal type:
•  cd $PTOFC/cfM/wolf2D
(The STL files are already here)
•  paraview
(Load wolfRibbon.stl
and
wolfRibbonFeatures.stl)
The 2D cfMesh generator requires a
“ribbon-shaped” FMS or an STL geometry
like the one pictured here. The geometry
file does not have a prescribed folder to
be placed. It could be saved wherever
you like.
wolfRibbonFeatures.stl Mesh generation using cfMesh
Here follows how an STL (STereoLithography) geometry file is made.
solid patchName
...
facet normal nx ny nz
outer loop
vertex x1 y1 z1
vertex x2 y2 z2
vertex x3 y3 z3
endloop
endfacet
...
endsolid patchName
The order of the vertices (outer vs
inner) is not always important. It
depends on the application: e.g.
cfMesh reads only the normal
orientation. Mesh generation using cfMesh
While being very easy to understand, STL format is far from being memory-optimized
because it defines points shared by triangles multiple times.
e.g. point P in figure is defined
4 times as it is shared by 4 triangles.
Moreover, the order of the vertices is enough to
define the face orientation, though the definition
of the normal is redundant.
A better format could be used in cfMesh: FMS.
We will analyze it later.
Mesh generation using cfMesh
In the terminal type:
•  gedit *stl
and look at the differences between the two STL files.
wolfRibbon.stl is composed by only 2 patches “walls” and “wolf”
wolfRibbonFeatures.stl is composed by 5 patches “walls_0”, “walls_1”,
“walls_2”, “walls_3” and “wolf”.
While the geometry is exactly the same, the second choice enables cfMesh to
correctly recognize the features (i.e. edges) that are shared by two patches.
In the terminal type:
•  gedit system/meshDict
look at the localRefinement, objectRefinements and boundaryLayers
entries and choose between the two geometries
surfaceFile “wolfRibbon.stl”
//surfaceFile “wolfRibbonFeatures.stl”
Mesh generation using cfMesh
In the terminal type:
•  cartesian2DMesh
•  checkMesh
•  paraFoam
and look at the differences between the two meshes.
wolfRibbon.stl
wolfRibbonFeatures.stl
Mesh generation using cfMesh
Note: by default cfMesh uses all the available processors. If you want to specify
the number of processors to be used type in the terminal
•  export OMP_NUM_THREADS=np
Where np is the number of processors (e.g. 2).
Refer to the user guide User Guide – cfMesh v1.0.1.pdf for additional
details.
Mesh generation using cfMesh
Case 2. Box (3D internal mesh).
Let us generate the mesh by using cfMesh.
From now on, follow me.
In the terminal type:
•  cd $PTOFC/cfM/boxCfMesh
(The geometry files are already here)
•  paraview
(Load box.stl only because box.fms cannot
be visualized in paraview without a conversion)
The 3D cfMesh generator requires a
water-tight STL or FMS geometry like the
one pictured here. The geometry file does
not have a prescribed folder to be placed.
It could be saved wherever you like.
box.stl Mesh generation using cfMesh
In the terminal type:
•  gedit box.*
and look at the differences between the two geometry files. In terms of memory
usage, FMS files are way lighter than the corresponding STL ASCII files and
comprehend embedded info on the features-edges and patch type. STL binary files
are a good option to preserve memory but they are not human readable.
In the terminal type:
•  gedit system/meshDict
look at the renameBoundary entry and choose between the two geometries
surfaceFile “box.stl”
//surfaceFile “box.fms”
It is possible to convert STL to FMS and vice-versa using the following utility:
•  surfaceFeatureEdges –angle <angle> <input_surface_file.stl>
<output_surface_file.fms>
Mesh generation using cfMesh
This is how a FMS geometry file looks like:
// patch names and types
1(
solid
patch
)
// points (x y z)
8((0 0 0) (0 1 0) (0 0 1) (1 0 0)
(0 1 1) (1 0 1) (1 1 0) (1 1 1))
// facets [ (p1 p2 p3) belong to group ]
12(((4 1 2) 0) ((1 0 2) 0) ((5 6 7) 0)
((5 3 6) 0) ((0 3 2) 0) ((2 3 5) 0)
((4 6 1) 0) ((7 6 4) 0) ((0 1 3) 0)
((3 1 6) 0) ((5 4 2) 0) ((7 4 5) 0))
// feature-edges
12((4 1) (2 4) (1 0) (0 2) (6 7) (7 5)
Right hand rule to determine the orientation of the
facet
(5 3) (3 6) (0 3) (5 2) (6 1) (4 7))
// subsets [points, facets, feature-edges]
0() 0() 0()
Mesh generation using cfMesh
In the terminal type:
•  cartesianMesh
•  checkMesh
•  paraFoam
and look at the differences between the two meshes.
box.stl
box.fms
Mesh generation using open source tools
Look at how the boundary layer is treated at the feature-edges. Regardless
the fact that the edge is not well resolved. Which one is better in terms of
intrinsic mesh quality? The mesh generated from the STL geometry has an
higher skewness (1.66) with respect to the FMS one (1.17). Anyway higher
maximum values of non-orthogonality occurs (37) where different refinement
regions are defined over the same edge.
skew 1.66
nonOrtho 28
box.stl
skew 1.17
nonOrtho 37
box.fms
Thank you for your attention
These lectures notes are licensed under the Creative Commons
Attribution-ShareAlike 4.0 International License.
To view a copy of this license, visit
http://creativecommons.org/licenses/by-sa/4.0/