Difference between revisions of "SnappyHexMesh"

From OpenFOAMWiki
(Tutorials and Guides: Fixed damaged link to the new location)
(formatting and added link to the gear mesh tutorial)
Line 8: Line 8:
 
** eMesh feature edge files, that define feature edges that have describe sharp corners.
 
** eMesh feature edge files, that define feature edges that have describe sharp corners.
  
<br>
+
 
 
{{VersionInfo}} {{version1.5}} {{version1.6}} {{version1.7}} {{version2.0}} {{version2.1}} {{version1.5-dev}} {{version1.6-ext}}
 
{{VersionInfo}} {{version1.5}} {{version1.6}} {{version1.7}} {{version2.0}} {{version2.1}} {{version1.5-dev}} {{version1.6-ext}}
  
 
'''Note''': feature edges only available in: {{version2.0}} {{version2.1}}
 
'''Note''': feature edges only available in: {{version2.0}} {{version2.1}}
  
<br>
+
 
 
Configuring both the dictionary file and providing good geometries can be a very arduous task. Therefore, at the moment of this writing (11:06, 18 August 2012 (CEST)), this wiki page will try to point you in the right direction, without describing each and every detail related to using <tt>snappyHexMesh</tt>. Feel free to contribute to this page!
 
Configuring both the dictionary file and providing good geometries can be a very arduous task. Therefore, at the moment of this writing (11:06, 18 August 2012 (CEST)), this wiki page will try to point you in the right direction, without describing each and every detail related to using <tt>snappyHexMesh</tt>. Feel free to contribute to this page!
  
<br>
+
 
 
= Tutorials and Guides =
 
= Tutorials and Guides =
 
Here are listed links to tutorials and guides on using <tt>snappyHexMesh</tt>:
 
Here are listed links to tutorials and guides on using <tt>snappyHexMesh</tt>:
Line 32: Line 32:
 
* Tutorials by T. Holzmann at personal homepage:
 
* Tutorials by T. Holzmann at personal homepage:
 
** [http://www.holzmann-cfd.de/index.php/en/openfoamen/ some snappyHexMesh Tutorials]
 
** [http://www.holzmann-cfd.de/index.php/en/openfoamen/ some snappyHexMesh Tutorials]
<br>
+
 
  
 
= Tips =
 
= Tips =
Line 42: Line 42:
 
* In the tutorial <tt>incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh</tt>
 
* In the tutorial <tt>incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh</tt>
  
<br>
+
Other tutorials:
 +
* This is an ''awesome'' tutorial: [http://www.cfd-online.com/Forums/openfoam/103804-dynamic-mesh-gear-pump.html#post368540 Dynamic Mesh for a Gear Pump].
 +
 
 +
 
 
== Multi-region meshes ==
 
== Multi-region meshes ==
 
There are a few instructions/examples on how to generate multi-region meshes with snappyHexMesh:
 
There are a few instructions/examples on how to generate multi-region meshes with snappyHexMesh:
Line 49: Line 52:
 
** Note: this happens whenever the base mesh doesn't coincide with the outer limits of the target surface geometry. The tutorial <tt>heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater</tt> is such an example where the outside of the original STL files coincides with the base mesh.
 
** Note: this happens whenever the base mesh doesn't coincide with the outer limits of the target surface geometry. The tutorial <tt>heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater</tt> is such an example where the outside of the original STL files coincides with the base mesh.
  
<br>
 
  
 
== Running in parallel ==
 
== Running in parallel ==
Line 60: Line 62:
 
* Modified <tt>motorBike</tt> tutorial to be used as a benchmark case for running in parallel: [http://code.google.com/p/bluecfd-singlecore/wiki/Runtimes202_211 Runtimes of OpenFOAM vs blueCFD] - {{VersionInfo}}{{version2.0.x}}{{version2.1.x}}
 
* Modified <tt>motorBike</tt> tutorial to be used as a benchmark case for running in parallel: [http://code.google.com/p/bluecfd-singlecore/wiki/Runtimes202_211 Runtimes of OpenFOAM vs blueCFD] - {{VersionInfo}}{{version2.0.x}}{{version2.1.x}}
  
<br>
+
 
 
== GUI (Graphical User Interfaces) ==
 
== GUI (Graphical User Interfaces) ==
 
Currently there are several interactive ways (using GUI) of generating meshes with <tt>snappyHexMesh</tt>. Here will only be listed the ones that are '''open-source''':
 
Currently there are several interactive ways (using GUI) of generating meshes with <tt>snappyHexMesh</tt>. Here will only be listed the ones that are '''open-source''':
Line 69: Line 71:
 
; [http://engys.com/products/helyx-os Helyx<sup>OS</sup>] : A GUI for using OpenFOAM. See the video tutorials: <br><ul><li>[http://www.youtube.com/watch?v=yJbFnFzDLqo Helyx<sup>OS</sup> - Example: External Aerodynamics Setup]</li><li>[http://www.youtube.com/watch?v=ZdQsHhZJTxo Helyx<sup>OS</sup> - Engys' free-to-download Open Source native GUI for OPENFOAM®]</li></ul>
 
; [http://engys.com/products/helyx-os Helyx<sup>OS</sup>] : A GUI for using OpenFOAM. See the video tutorials: <br><ul><li>[http://www.youtube.com/watch?v=yJbFnFzDLqo Helyx<sup>OS</sup> - Example: External Aerodynamics Setup]</li><li>[http://www.youtube.com/watch?v=ZdQsHhZJTxo Helyx<sup>OS</sup> - Engys' free-to-download Open Source native GUI for OPENFOAM®]</li></ul>
  
<br>
+
 
 
== Another way of projection of a mesh on an STL surface ==
 
== Another way of projection of a mesh on an STL surface ==
 
Adding boundary layers with <tt>snappyHexMesh</tt> can sometimes be very stressing, specially when it sometimes stops the layers in the ''wrong'' places. Trying to improve this feature was one of several works made in the [http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2011/ MSc/PhD course in CFD with OpenSource software, 2011 at Chalmers], namely:
 
Adding boundary layers with <tt>snappyHexMesh</tt> can sometimes be very stressing, specially when it sometimes stops the layers in the ''wrong'' places. Trying to improve this feature was one of several works made in the [http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2011/ MSc/PhD course in CFD with OpenSource software, 2011 at Chalmers], namely:
Line 79: Line 81:
  
 
[[Category:Mesh generation utilities]]
 
[[Category:Mesh generation utilities]]
 +
  
 
== ''Isolate and Conquer'' ==
 
== ''Isolate and Conquer'' ==

Revision as of 11:34, 18 September 2012


1 Introduction

In a nutshell, snappyHexMesh is a mesh generator that takes an already existing mesh (usually created with blockMesh) and chisels it into the mesh you want. But for this, it requires:

  • A very well defined dictionary, namely system/snappyHexMeshDict.
  • Good geometrical definitions, such as:
    • STL/OBJ files with well defined surfaces;
    • eMesh feature edge files, that define feature edges that have describe sharp corners.


Valid versions: OF version 15.png OF version 16.png OF version 17.png OF Version 20.png OF Version 21.png OF Version 15dev.png OF Version 16ext.png

Note: feature edges only available in: OF Version 20.png OF Version 21.png


Configuring both the dictionary file and providing good geometries can be a very arduous task. Therefore, at the moment of this writing (11:06, 18 August 2012 (CEST)), this wiki page will try to point you in the right direction, without describing each and every detail related to using snappyHexMesh. Feel free to contribute to this page!


2 Tutorials and Guides

Here are listed links to tutorials and guides on using snappyHexMesh:


3 Tips

On this chapter are listed links and direct tips on using snappyHexMesh.

3.1 Generate 2D meshes

Instructions/examples on how to generate 2D meshes using snappyHexMesh can be found in at least two places:

Other tutorials:


3.2 Multi-region meshes

There are a few instructions/examples on how to generate multi-region meshes with snappyHexMesh:

  • See the tutorial heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater.
  • Instructions on how to remove an external unwanted region: Background Mesh in snappy with multi domain (CHT) post #3
    • Note: this happens whenever the base mesh doesn't coincide with the outer limits of the target surface geometry. The tutorial heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater is such an example where the outside of the original STL files coincides with the base mesh.


3.3 Running in parallel

Currently there are several official tutorials on how to use snappyHexMesh in parallel:

  • incompressible/windSimpleFoam/turbineSiting - Valid versions: OF Version 20.png
  • incompressible/simpleFoam/turbineSiting - Valid versions: OF Version 21.png
  • incompressible/pisoFoam/les/motorBike/motorBike - Valid versions: OF Version 21.png

Other tutorials:


3.4 GUI (Graphical User Interfaces)

Currently there are several interactive ways (using GUI) of generating meshes with snappyHexMesh. Here will only be listed the ones that are open-source:

Discretizer 
Check the Screencasts page for more information.
SwiftSnap 
A very useful plug-in for Blender for configuring snappyHexMeshDict. There is SwiftBlock for blockMeshDict as well!
HelyxOS 
A GUI for using OpenFOAM. See the video tutorials:


3.5 Another way of projection of a mesh on an STL surface

Adding boundary layers with snappyHexMesh can sometimes be very stressing, specially when it sometimes stops the layers in the wrong places. Trying to improve this feature was one of several works made in the MSc/PhD course in CFD with OpenSource software, 2011 at Chalmers, namely:

Other important links:

  • Thread dedicated to discussing on this subject: [1]
  • Adjusted code for working with the latest OpenFOAM versions: [2]


3.6 Isolate and Conquer

Since snappyHexMesh has so many mesh quality parameters, these sometimes to get in the way of the meshes you're trying to generate. The solution apparently is simple:

  1. Disable all quality controls.
  2. Diagnose visually the resulting mesh.
  3. Gradually turn back on one quality indicator at a time, while checking the resulting mesh with both checkMesh and ParaView.

For more on this, read the following posts/threads: