Rotating part mesh generation

Let's start with listing of the part of the makeMesh.sh script that belongs to the mesh generation of the rotating part of the model.

echo "Creating mesh of rotating part..."
   cd  mesh/rotatingPart
   blockMesh > ../../log.rotatingPart-blockMesh  2>&1
   surfaceFeatureExtract > ../../log.rotatingPart-surfaceFeatureExtract 2>&1
   decomposePar > ../../log.rotatingPart-decomposePar  2>&1
   mpiexec -np $numProcs transformPoints -parallel -rotate '( (1 0 0) (0.993572 0 0.113203) )'> ../../log.rotatingPart-transformPoints  2>&1
   mpiexec -np $numProcs snappyHexMesh -overwrite -parallel > ../../log.rotatingPart-snappyHexMesh  2>&1
   reconstructParMesh -constant > ../../log.rotatingPart-reconstructParMesh  2>&1
   topoSet > ../../log.rotatingPart-topoSet 2>&1 # creating 'rotor' zone
   checkMesh  -constant > ../../log.rotatingPart-checkMesh  2>&1
   cd ..

Lines 20 - 22 prints "Creating mesh of rotating part..." on the terminal screen, jumps into the directory mesh/rotatingPart and starts the application blockMesh (line 22) for making the background mesh for the rotating part of the wind turbine model. The standard output is forwarded into the log file (log.rotatingPart-blockMesh).

# cd mesh/rotatingPart/
# blockMesh > ../../log.rotatingPart-blockMesh 2>&1

One can see the detailed settings of blockMesh in blockMeshDict.

# cat mesh/rotatingPart/system/blockMeshDict

Line 23 - running surfaceFeatureExtract utility for making *.eMesh files containing feature edges information. One can see the settings for this utility in system/surfaceFeatureExtractDict and system/surfaceFeatureExtractDictDefaults

# surfaceFeatureExtract > \
../../log.rotatingPart-surfaceFeatureExtract 2>&1

Once the background mesh is created it can be decomposed (line 24) for parallel execution with settings defined in system/decomposeParDict.

# decomposePar > ../../log.rotatingPart-decomposePar 2>&1

At this moment there is a background mesh which is aligned with the principal axes - so not aligned with the axis of rotation of the wind turbine model. The utility transformPoints will be used to make the background mesh parallel with the axis of rotation.

# mpiexec -np 6 transformPoints -parallel -rotate \
'( (1 0 0) (0.993572 0 0.113203) )'> \
../../log.rotatingPart-transformPoints 2>&1

The switch -rotate '( (1 0 0) (0.993572 0 0.113203) )' sets transformation in terms of a rotation between vector (1 0 0) and vector (0.993572 0 0.113203) where the first vector stands for axis x in basic coordinate system and the second vector stands for axis of rotation. The switch -np 6 means using of 6 processor in parallel computation. The main mesh generation process is done using utility snappyHexMesh (line 26).

# mpiexec -np 6 snappyHexMesh -overwrite -parallel > \
../../log.rotatingPart-snappyHexMesh 2>&1

When the snappyHexMesh finishes the mesh generation in parallel it is necessary to make a parallel reconstruction of the mesh. One can reconstruct a parallelized mesh into one mesh by running reconstructParMesh (line 27).

# reconstructParMesh -constant > \
../../log.rotatingPart-reconstructParMesh 2>&1

The switch -constant in the command above means one wants to reconstruct the mesh directly into the directory constant.

Using topoSet (line 28) one will create 'rotor' zone needed for dynamicMesh later on.

# topoSet > ../../log.rotatingPart-topoSet 2>&1

Line 29 - running the checkMesh utility to collect the information about the mesh size and quality.

Line 30 - just a jump back to the root directory of the case.

The script is set to generate the aligned mesh - to generate the typical mesh and to make a comparison of the mesh quality one can just make a copy of the tutorial then comment out the line 25 in the script (put a hash sign "#" to the beginning of the line 25) and run the makeMesh.sh script again.

Figure: Wind turbine tutorial. Mesh of rotating part.
Image CFDsupport_meshing_training_wind_turbine_mesh_4 Image CFDsupport_meshing_training_wind_turbine_mesh_5

OpenFOAM Training by CFD Support,   CFD SUPPORT,   info@cfdsupport.com    +420 212 243 883      © CFD support, s.r.o., Sokolovsk√° 270/201, 190 00 Praha 9, Czech Republic