CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[snappyHexMesh] snappyHexMesh parameter setting

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By AtoHM
  • 2 Post By AtoHM
  • 2 Post By AtoHM

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 15, 2023, 16:46
Default snappyHexMesh parameter setting
  #1
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
Hello,
I'm simulating flow over cylinder in order to learn openfoam. However, would you please let me know how i could alter snappyhexMesh parameters in order to nail to my desired mesh (specially close to the cylinder wall).
Mind you, I have attached my mesh and desired mesh:).Thank you for your time.

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2112                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

castellatedMesh true;
snap            true;
addLayers       true;

geometry
{
    cylinder
    {
        type    searchableCylinder;
        point1  (0 0 -0.01);
        point2  (0 0 0.01);
        radius  0.02;
    }
    refinementBox 
    {
        type searchableBox;
        min (-0.2 -0.2 -0.01);
        max (0.5 0.2 0.01);
    }
};


castellatedMeshControls
{
    maxLocalCells       100000;
    maxGlobalCells      200000000;
    minRefinementCells  10;
    maxLoadUnbalance    0.10;
    nCellsBetweenLevels 3;      // important
    resolveFeatureAngle 30;
    allowFreeStandingZoneFaces true;
    features
    ();
    refinementSurfaces
    {
        cylinder
        {
            
			level (4 4);
            patchInfo
            {
                type     wall;
                inGroups (cylinderGroup);
            }
        }
    };
	
    refinementRegions
	{
	    refinementBox
	    {
	  
	       mode inside;
		   levels ((1 1));
		
	    }
	  
	}
	
    locationInMesh (0.1 0.1 0);
}


snapControls
{
    nSmoothPatch    3;
    tolerance       2.0;
    nSolveIter      30; //
    nRelaxIter      5;   //
	nFeatureSnapIter 10; //
	implicitFeatureSnap false;
	explicitFeatureSnap true;
    multiRegionFeatureSnap false;
	
}


// Controls for boundary layer addition
addLayersControls
{
    relativeSizes true;
    layers
    {
        "cylinder"
        {
            nSurfaceLayers 7;
        }
        
    }
    expansionRatio 1.2;
    finalLayerThickness 0.3;
    minThickness 0.1;
    nGrow 0;
    featureAngle 30;
    slipFeatureAngle 80;
    nRelaxIter 3;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 90;
    nBufferCellsNoExtrude 0;
    nLayerIter 50;
}



// Controls for mesh quality
meshQualityControls
{
    maxNonOrtho 65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minVol 1e-18;
    minTetQuality 1e-9;
    minArea -1;
    minTwist 0.05;
    minDeterminant 0.001;
    minFaceWeight 0.05;
    minVolRatio 0.01;
    minTriangleTwist -1;

    // Advanced
    nSmoothScale 4;
    errorReduction 0.75;

    relaxed
    {
        maxNonOrtho 75;
    }
}

// Advanced
debug 0;
mergeTolerance 1e-6;
Attached Images
File Type: jpg my mesh.jpg (104.2 KB, 34 views)
File Type: jpg mesh.jpg (186.7 KB, 35 views)
saeed jamshidi is offline   Reply With Quote

Old   August 15, 2023, 17:35
Default
  #2
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
Thats as good as a snappyHexMesh-mesh gets. Do you have any specific part you want another way? To me, it looks fine.
saeed jamshidi likes this.
AtoHM is offline   Reply With Quote

Old   August 16, 2023, 02:46
Default
  #3
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
Dear AtoHM, thank you for your response. My first goal is to understand snappyHexMesh nature deep as much as possible.
As you can see in zoomed area in the second mesh, except for boundary layers there are three step in meshing.
The point is this jump from smaller grids to larger grids is smooth and each cell just were splited to four cells (not two cells). In contrast, in my mesh there are cells that were splited to two cells.
I just want to know how I could do that. I don't know whether I could convey my mean or not?!
Thanks
saeed jamshidi is offline   Reply With Quote

Old   August 16, 2023, 03:26
Default
  #4
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
Ah, I get it.
Do not worry, what you see is just a visual thing coming from a Paraview setting. You should deactivate the 'decompose polyhedra' option to get a better representation, as shown here: How to visualize polyhedron mesh in paraview


Just to clarify, snappy does neither split in half nor into 4, it's always 1 to 8 because we are in 3d. This is called an octree and shown e.g. here: https://www.cradle-cfd.com/technolog...etail0004.html
Yann and saeed jamshidi like this.
AtoHM is offline   Reply With Quote

Old   August 16, 2023, 03:51
Default
  #5
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
Dear AtoHM, thank you again. It was really helpful.
I have attached my result; Maybe someone would see it!
Attached Images
File Type: jpg Screenshot (97).jpg (105.8 KB, 30 views)
saeed jamshidi is offline   Reply With Quote

Old   August 16, 2023, 04:25
Default
  #6
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
Glad to help, now, go and play with
Code:
nCellsBetweenLevels 3;
and see what happens
Yann and saeed jamshidi like this.
AtoHM is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] creating baffles using snappyHexMesh (for given random shaped surfaces) ashish.svm OpenFOAM Meshing & Mesh Conversion 1 January 17, 2018 02:24
[snappyHexMesh] Running snappyHexMesh in parallel - optimizing peterhess OpenFOAM Meshing & Mesh Conversion 2 January 3, 2018 03:54
question about fluid2 parameter setting Mike Wang FLOW-3D 1 November 3, 2017 04:41
Turbulence Model Parameter Setting Up- Vortex Shedding Problem nima_nzm Main CFD Forum 4 June 12, 2015 10:43
compile errors of boundary condition "expDirectionMixed" liying02ts OpenFOAM Bugs 2 February 1, 2010 21:11


All times are GMT -4. The time now is 01:46.