snappyHexMesh tutorial for a simple Geometry

In this section I will address how to use the snappyHexMesh tool to mesh a Cylinder. We can either create an stl file for the cylinder - place it inside the triSurface/constant folder and call the same into the background mesh, or a simple cylinder can be directly created by using the 'searchable cylinder' parameter within the snappyHexMeshDict. 

cylinder
    {
type searchableCylinder;
  point1 (0 0.0 -0.5);
 point2    (0 0.0 0.5);
radius 0.01585;
    }
A refined mesh can be viewed below.



The radius of the cylinder is of the order e-02 which gives us some insight into what the cell size for the back ground mesh can be. The blockMesh for the background mesh will be addressed later. Next in line in the snappyHexMeshDict is the Refinement box parameter. This box defines how refinement around the cylinder and importantly how the wake refinement can be achieved. The refinement box separates the finer refinement from the background mesh grid.
 refinementBox
    {
        type searchableBox;
        min (-0.15 -0.1 -0.2);
        max ( 0.65  0.1  0.2);
    }

To accommodate the movement from one level of refinement to another, a parameter called the nCellsBetweenLevels is utilized. They are basically a buffer layer of cells between two different levels of refinement. The smallest value of 1 implies a drastic transition between levels with a 2:1 ratio. A larger value would mean a slower transition to the next level of refinement.
nCellsBetweenLevels 6;

Feature edge refinement is not utilized for the above case because a cylinder STL file is not created in the first place.
features ();

Let us now look at one of the refinement possibilities applied for producing a fine grid whose y+ is lesser than one. The refinement varies as we move from the surface of the cylinder to the refinement box, and as a result is divided into surface refinements and region refinements.
Firstly, the cylinder surface is assigned a specific level of grid refinement. 
refinementSurfaces
    {
        cylinder
        {
            level (4 4);
        }
    }

Secondly. the region around the cylinder is assigned a specific value of refinement with respect to the distance from the surface of the cylinder.
cylinder
        {
            mode  distance;
            levels ((0.02 4)); //0.02 is the distance measured as we move away from the cylinder surface
        }

Thirdly and finally, a region anywhere inside the refinement box is allotted a refinement. 
refinementBox
        {
            mode inside;
            levels ((1e15 3));
        }

The area inside the cylinder which does not come in contact with the fluid domain or that which is not required for external flow study is removed by using the following parameter. It selects the cells to be kept inside the fluid domain.
locationInMesh (-0.25 0 0)

There are two important surface and edge angle parameters mentioned inside the snappyHexMeshDict. They are:

  1. resolveFeatureAngle: This angle plays a vital role in capturing the surface edges and preserving the feature of the geometry. A lower value would do the trick! But a lower value would also mean a larger refinement at the feature edges, thus increasing the number of cells inside fluid domain. 30 is a reasonably good value for complex geometries and 60 for a cylinder
  2. featureAngle: Normally a higher value for this would ensure that the Boundary layer doesn't collapse during the layer addition phase.
Next inline is the Boundary layer addition phase. A good number of layer addition is required at the boundary if the grid is refined down to a y+ value lesser than 1, especially when employing kOmegaSST turbulence models. Of course a simulation utilizing a wall Function does not require much layer addition.


layers
    {
        "cylinder*.*"
        {
            nSurfaceLayers 9;
        }
    }

expansionRatio 1.05;
firstLayerThickness 0.1;
minThickness 0.05;

Expansion ratio is the ratio between the top layer and the bottom layer. A good value for the expansion ration is 1.2 as it ensures smooth transitioning of the boundary layers. minThickness is the parameter which holds the sum of all the boundary layers from exceeding the assigned value. Check the image below for definitions regarding the boundary layer parameters.


Comments

  1. Nice post! Can you share the source code please?

    ReplyDelete
  2. Thanks! When is it necessary to use a mesh like this:
    http://mycfdarchive.blogspot.com/2017/05/how-to-refine-blockmesh.html
    Is it necesary only when there is vortex shedding?

    ReplyDelete

Post a Comment

Popular posts from this blog

snappyHexMesh Tutorial For a Complex Geometry and External Aerodynamics

AIRCRAFT OpenFOAM SIMULATION (BOEING 747)