15
Pre-processing in openfoam, mesh generation. OpenFOAM kurs 2011 Håkan Nilsson Olivier Petit

Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Pre-processing in openfoam,

mesh generation.

OpenFOAM kurs 2011 Håkan Nilsson Olivier Petit

Page 2: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

Different ways of creating the mesh.Outline

� Using SnappyHexMeshSnappyHexMeshSnappyHexMeshSnappyHexMesh, an OpenFOAM mesh generation

tool.

Svensk Vattenkraft Centrum - SVC

tool.

� Using blockMeshblockMeshblockMeshblockMesh.

� Importing the mesh from external softwareexternal softwareexternal softwareexternal software.

Page 3: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

A tutorial for snappyHexMesh.

� SnappyHexMesh generates a 3D mesh from a .stl file.

( triangulated surface geometry)

� For this tutorial, a simplified pump geometry is chosen.

Svensk Vattenkraft Centrum - SVC

For more simplicity in computations, the symmetry of the geometry is used, and only one quarter of the pump is meshed.

Page 4: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

A tutorial for snappyHexMesh.

� DownloadDownloadDownloadDownload the tutorial from Håkan’s webpage.

� SourceSourceSourceSource OpenFOAM 2.0.x with alias or

. /chalmers/sw/unsup64/OpenFOAM/OpenFOAM-2.0.x/etc/bashrc

Svensk Vattenkraft Centrum - SVC

� To check if the right OpenFOAM was called: whichwhichwhichwhich SimpleFoamSimpleFoamSimpleFoamSimpleFoam

It should point to simpleFoam in OpenFOAM-2.0.x

� In the tutorial case, you should find:

1. The .stl file located in constant/triSurface.

2. A dictionnary called snappyHexMeshDict in system/.

Page 5: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

snappyHexMesh: step 1

� Creation of a grid surrounding the stl surface....

Svensk Vattenkraft Centrum - SVC

Characteristics of the grid:

� The aspect ratio of the grid cells should be around 1.

� More than one cell in the z direction.

� At least on cell’s edge should intersect the surface.

� There can not be empty patches, it is a 3D mesher.

Page 6: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

SnappyHexMesh: step 1� Starting the splitting process.

Svensk Vattenkraft Centrum - SVC

• Start the splitting from locationInMesh feature.

•This edge must be inside the region to be

meshed and must no coincide with a cell face.

• Splitting the cells around the surface according to :refinementSurfaces {

file.stl {

level (2 2); // default (min max) refinement for surface }

}

Page 7: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

Snappyhexmesh: step 1� Cell removal process, and refinement of specified regions

Svensk Vattenkraft Centrum - SVC

• Keep the side of the mesh defined by locationInMesh.

• Remove all cells that have above 50% of their volumes in the meshed region.

This first step is saved into the time folder 1.

The region refined is specified by: � inside: inside the volume region.� outside: outside the volume region.� distance: according to distance to the surface.The region is defined first as geometry.

Page 8: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

Snappyhexmesh: step 2� Snapping to surface.

The steps to snap to surface are:1. Snap the vertices onto the STL surface.2. Solve for relaxation of the internal mesh.

Svensk Vattenkraft Centrum - SVC

2. Solve for relaxation of the internal mesh.3. Iterate using the snapControls in SnappyHexMeshDict.

This second step is saved into the time folder 2.

Page 9: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

Snappyhexmesh: step 3

� Boundary layer addition.

The boundary are applied on patches,

not on surface!!

Svensk Vattenkraft Centrum - SVC

� Mesh projection back from the surface using a specified thickness normal to the surface.� Solve for relaxation of the internal mesh with the latest projected boundary vertices.� Check if validation criteria are validated.� If the validation criteria can be satisfied, insert mesh layers.

not on surface!!

This last step is saved into the time folder 3.

Page 10: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

Snappyhexmesh: pros and cons.� Possibilities of multiple refinements that make it very robust.

� It runs in parallel.

� Need of a good quality STL surface, with more than one region/patch.

� The feature line is now available, but is still very weak.

� A Boundary Layer mesh is not easy to obtain, it requires experience and trial

and error method.

Svensk Vattenkraft Centrum - SVC

and error method.

Page 11: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

blockMesh/m4: a short tutorial.

� m4: allow a parametrization of the case, easy to change.m4: allow a parametrization of the case, easy to change.m4: allow a parametrization of the case, easy to change.m4: allow a parametrization of the case, easy to change.

rUt

rStatUt

Svensk Vattenkraft Centrum - SVC

rIn

rRotIn

rRotUt

rStatIn

α2- α1

Page 12: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

blockMesh/m4: pros and cons.

� Very easy way to create an simple geometry.

� The parametrization with m4 allow to create

different geometry from the same m4 file.

� Not enough precision in the meshing

Svensk Vattenkraft Centrum - SVC

� Not enough precision in the meshing

parameters.

� Easy to go wrong on the orientation of the faces

and blocks.

Page 13: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

Import the mesh: pros and cons

� Need of an other software to create the mesh.

� Few converters:

� fluentMeshToFoamfluentMeshToFoamfluentMeshToFoamfluentMeshToFoam, fluent3DMeshToFoamfluent3DMeshToFoamfluent3DMeshToFoamfluent3DMeshToFoam for Gambit

mesh types.

Svensk Vattenkraft Centrum - SVC

mesh types.

� starToFoamstarToFoamstarToFoamstarToFoam for STAR-CD mesh types.

� ideasToFoamideasToFoamideasToFoamideasToFoam for I-DEAS mesh types

� cfx4ToFoamcfx4ToFoamcfx4ToFoamcfx4ToFoam for CFX mesh types.

� CGNSToFoamCGNSToFoamCGNSToFoamCGNSToFoam for CGNS files (can import more than

meshes), developped by users.

Page 14: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

Conclusion

� SnappyHexMesh is an easy tool to generate a

mesh, but is still young and lacks some

important features.

�m4/blockMesh is a perfect tool when it comes

Svensk Vattenkraft Centrum - SVC

�m4/blockMesh is a perfect tool when it comes

to simple geometries, but is not enough

developped to deal with real type geometries.

� The most common solution is to import a mesh

from an external software.

Page 15: Pre-processingin openfoam, meshgeneration.hani/kurser/OS_CFD_2011/mesh... · 2011-09-12 · SnappyHexMesh is an easy tool to generate a mesh, but is still young and lacks some important

Chalmers University of Technology

EXTERNAL LINKS FOR SNAPPYHEXMESH

� http://www.hydroniumion.de/allgemein/snapp

yhexmesh-tutorial/

� http://www.hydroniumion.de/studium/snappyh

exmesh-tutorial-part-2/

Svensk Vattenkraft Centrum - SVC

exmesh-tutorial-part-2/

� http://www.openfoam.com/docs/user/snappy

HexMesh.php#x26-1510005.4