OpenFOAM/C3/Introduction-to-SnappyHexMesh/English

From Script | Spoken-Tutorial
Revision as of 13:23, 3 July 2014 by Chaitralighodke (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tutorial: Introduction to snappyHexMesh in OpenFOAM.


Script and Narration: Chaitrali Ghodke.


Keywords: Import STL file, background hex mesh, snappyHexMeshDict.


Visual Cue
Narration
Slide 1 Hello and welcome to the spoken tutorial on Introduction to snappyHexMesh in OpenFOAM.
Slide 2 : Learning Objectives


In this tutorial, we will learn about
  • The parameters in snappyHexMesh to generate Mesh in OpenFOAM.


Slide 2: Pre-requisite As a pre-requisite, the user requires


  • Surface data files in STL format
  • A domain with hex mesh
  • snappyHexMeshDict located in the system sub-directory of case


Slide 3:

System Requirement

To record this tutorial, I am using
  • Ubuntu Linux operating system 12.04
  • OpenFOAM version 2.2.1
  • ParaView version 3.12.0


Slide 4: Methodology for snappyHexMesh


There are five steps to create a mesh with the snappyHexMesh utility.

Step 1 : Create a base mesh by using blockMesh utility

Step 2 : Refine base mesh

Step 3 : Remove unused cells

Step 4 : Snap mesh to surface

Step 5 : Add layers

Ctrl+Alt+t simultaneously

Type run cd OpenFOAM-2.2.2/tutorials/mesh/snappyHexMesh/flange

Let us learn, the different parameters in snappyHexMesh to generate mesh in OpenFOAM.

To do this, we will open the terminal window and enter the path for flange as shown.

Type run Type run and press Enter.
Type cd tutorials/mesh/snappyHexMesh/flange Type cd tutorials/mesh/snappyHexMesh/flange and press Enter.
Type ls


Now type ls and press Enter.


There are two folders constant and system.

Type cd system Type cd space system and press Enter.
Type ls Now type ls and press Enter.


You can see the snappyHexMeshDict file.

Type gedit snappyHexMeshDict To view the contents of the file type -

gedit snappyHexMeshDict

and press Enter.


(Note that H, M and D here are in capital letters.)

This will open up the snappyHexMeshDict file.
Let me drag this to the capture area.
Slide 5 : snappyHexMeshDict file contains all the instructions and the entire process revolves around this file.
Activation rows


With the first rows of snappyHexMeshDict, you can activate or skip sections of the process.
Geometry In geometry section, all active regions that take part in snappy process can be defined.
castellatedMeshControls section. The parameters that govern the process of cell splitting are described in castellatedMeshControls section.
CastellatedMeshControls The parameters that are listed below are well explained in snappyHexMeshDict file.
nCellsBetweenLevels nCellsBetweenLevels defines number of cells for each refinement level.


The higher it is, the more gradual the mesh will be.

Explicit feature edge refinement In the explicit feature edge refinement section, you can set specific refinement level for geometry’s feature edges.


The .eMesh file can be obtained with the surfaceFeatureExtract utility.

Surface based refinement


In the surface-based refinement section, you can set the refinement levels of all surfaces defined in geometry file.
Mesh selection Mesh selection is a very important parameter.


If the chosen point is inside the surface described in geometry file, then snappyHexMesh will create the internal mesh.


Otherwise the external part (inside the blockMesh) is meshed.

The next step involves moving cell vertex points onto the surface geometry.
SnapControls


Settings for the snapping


The snapping process is carried out by four parameters:
  • nSmoothPatch
  • tolerance
  • nSolveIter
  • nRelaxIter

These parameters control the number of iterations and tolerance between mesh and STL surface.

nSmoothPatch Modified sentence is shown in the script.


Original sentence:


nSmoothPatch option changes how many times the exterior (the boundary wall) should be iterated.nSmoothPatch option changes how many times the exterior (the boundary wall) should be iterated.


The mesh will become smoother if the number of iterations are more.

tolerance Modified sentence is shown in the script.


Original sentence:

Tolerance option changes how long distance the program should look for a point to snap.Tolerance option changes how long distance the program should look for a point to snap.


The distance will be the number that is in tolerance.

nSolveIter Modified SentencenSolveIter option changes how many times the snapping part of snappyHexMesh should be run.
nRelaxIter


Modified SentencenRelaxIter option changes how many times the mesh should run a relaxing script, that removes bad mesh points.
addLayerControls


The process of mesh layer addition involves shrinking the existing mesh from the boundary and inserting layers of cells.

The group of parameters define the dimensions for layers and surface on which they will be attached.

relativeSizes RelativeSizes option (true or false) changes the way to read the parameters.
layers In layers option, you can define the number of layers and the patch on which attach the layers.


It must be an STL patch in geomery menu, and not a user defined region.

expansionRatio


ExpansionRatio parameters set the ratio between two subsequent layers.
finalLayerThickness


FinalLayerThickness parameter sets the thickness of the last layer.
minThickness MinThickness parameter sets the minimum allowable thickness of layer.
Advanced settings


Advanced settings is the second group of parameters.


It contains more specific controls that can help in layer creation.

featureAngle


FeatureAngle is the angle above which the surface will not be extruded.
==== nRelaxIter ==== nRelaxIter option changes how many times the mesh will run a relaxing script.
==== maxFaceThicknessRatio ==== MaxFaceThicknessRatio option changes the maximum allowable value of aspect ratio.
meshQualityControls


meshQualityControls parameter sets the minimum thresholds to generate mesh in snap and add-layers parts.


In 99% of the cases, it is better to leave the default values.


But sometimes you can deactivate one or more controls to force mesh generation.

These are the different parameters in snappyHexMeshDict.


These parameters are important to generate mesh using snappyHexMesh utility.

<PAUSE>

Let me get back to the slides.

Let us summarize.
Slide 9: Summary


In this tutorial we learnt :

Different parameteres in snappyHexMesh to generate mesh in OpenFoam.

Slide 10: About Spoken tutorials Watch the video available at this URL:

http://spoken-tutorial.org/What_is_a_Spoken_Tutorial

It summarizes the Spoken Tutorial project.

If you do not have good bandwidth, you can download and watch it.

Slide 11:

About Spoken tutorials

The Spoken Tutorial Project Team

-Conducts workshops using spoken tutorials

-Gives certificates to those who pass an online test

-For more details, please write to

contact@spoken-tutorial.org

Slide 12:

Acknowledgement


Spoken Tutorial is a part of Talk to a Teacher project,

It is supported by the National Mission on Education through ICT, MHRD, Government of India.

More information on the same is available at the following URL link http://spoken-tutorial.org/NMEICT-Intro

About the contributor This is Chaitrali Ghodke from IIT BOMBAY signing off.

Thanks for joining.

Contributors and Content Editors

Chaitralighodke, Nancyvarkey