CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   addLayersControls in snappyHexMesh around cylinder (https://www.cfd-online.com/Forums/main/246937-addlayerscontrols-snappyhexmesh-around-cylinder.html)

Redrakham January 4, 2023 03:39

addLayersControls in snappyHexMesh around cylinder
 
2 Attachment(s)
I created 3d mesh using snappyHexMesh for vortex-induced vibration of cylinder in OpenFOAM-v1906. When adding layers around the cylinder, the points are not distributed evenly around the cylinder. It created some unwanted vorticity in front of the cylinder. Many many thanks for the help:).


I attached the mesh around the cylinder and vorticity contour.



Attachment 92867 Attachment 92868



This is my snappyHexMeshDict file:
/*--------------------------------*- C++ -*----------------------------------*\

| ========= | |

| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |

| \\ / O peration | Version: v1912 |

| \\ / A nd | Website: www.openfoam.com |

| \\/ M anipulation | |

\*---------------------------------------------------------------------------*/

FoamFile

{

version 2.0;

format ascii;

class dictionary;

location "system";

object snappyHexMeshDict;

}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //



castellatedMesh true;

snap true;

addLayers true;



geometry

{

cylinder1.stl

{

type triSurfaceMesh;

name cylinder1;

}

refinementcyl

{

type searchableCylinder;

point1 (0 0 -9.6);

point2 (0 0 0);

radius 0.7;

}

refinementBox1

{

type box;

min (0 -1 -9.6);

max (2 1 0);

}

refinementBox2

{

type box;

min (2 -2 -9.6);

max (6 2 0);

}

refinementBox3

{

type box;

min (6 -3 -9.6);

max (10 3 0);

}

refinementBox4

{

type box;

min (10 -4.5 -9.6);

max (20 4.5 0);

}

refinementBox5

{

type box;

min (-10 -10 -9.6);

max (20 10 0);

}

};

castellatedMeshControls

{

maxLocalCells 100000;



maxGlobalCells 2000000;



minRefinementCells 0;



maxLoadUnbalance 0.1;



nCellsBetweenLevels 5;



features

(

{

file "cylinder1.eMesh";

level 4;

}

);



refinementSurfaces

{

cylinder1

{

level (5 5); // (surface refinement level, curvature refinement level)

}



patchInfo

{

type wall;

inGroups (wall);

}

}



resolveFeatureAngle 30;



planarAngle 30;



refinementRegions

{

refinementcyl

{

mode inside;

levels ((1E15 5));

}

refinementBox1

{

mode inside;

levels ((1E15 4));

}

refinementBox2

{

mode inside;

levels ((1E15 4));

}

refinementBox3

{

mode inside;

levels ((1E15 3));

}

refinementBox4

{

mode inside;

levels ((1E15 2));

}

refinementBox5

{

mode inside;

levels ((1E15 0));

levelIncrement (0 4 (0 0 1));

}



}



locationInMesh (1.001 2.001 -4.5001);



allowFreeStandingZoneFaces true;



}



snapControls

{



nSmoothPatch 3;



tolerance 2.0;



nSolveIter 300;



nRelaxIter 5;



nFeatureSnapIter 2;



implicitFeatureSnap true;



explicitFeatureSnap false;



multiRegionFeatureSnap true;



}



addLayersControls

{



expansionRatio 1.15;



finalLayerThickness 1.0;



minThickness 0.002;



relativeSizes true;



layers

{



cylinder1

{

nSurfaceLayers 21;

}/*

back

{

nSurfaceLayers 4;

}*/



}



nGrow 0;



featureAngle 60;



maxFaceThicknessRatio 0.5;



nSmoothSurfaceNormals 10;



nSmoothThickness 10;



//minMedialAxisAngle 90;



minMedianAxisAngle 90;



nSmoothDisplacement 90;



maxThicknessToMedialRatio 0.3;



nSmoothNormals 15;



slipFeatureAngle 30;



nRelaxIter 5;



nBufferCellsNoExtrude 0;



nLayerIter 50;



nRelaxedIter 20;



meshShrinker displacementMotionSolver;



solver displacementLaplacian;



displacementLaplacianCoeffs

{

diffusivity quadratic inverseDistance 1(cylinder1);

}



}



meshQualityControls

{

#include "meshQualityDict"



relaxed

{

maxNonOrtho 75;

}

// Advanced



//- Number of error distribution iterations

nSmoothScale 4;

//- Amount to scale back displacement at error points

errorReduction 0.75;

}



mergeTolerance 1e-6;

// ************************************************** *********************** //

LuckyTran January 4, 2023 10:17

From the image it looks like snappy is working exactly as it should. If the cells are not evenly distributed to your like, then the cells in the input mesh are not even.

Redrakham January 4, 2023 23:35

Thank you very much for your reply. What do you mean by "cells in the input mesh are not even"? The nodes on the cylinder surface are not equally spaced and there is sudden jump in the element size along the surface of the cylinder. How do I rectify it?

AtoHM January 5, 2023 01:11

The input mesh for snappyHexMesh is the blockMesh. Lucky suggests to check the spacing there. You can deactivate the layer generation and try to get the distribution as good as possible with a given blockMesh. Then go and reactivate layers generation.


All times are GMT -4. The time now is 21:27.