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

[snappyHexMesh] Simulation of flow around a cylinder in OpenFOAM in 2D case

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By Yann
  • 1 Post By GerhardHolzinger
  • 1 Post By martinmat13

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 23, 2024, 11:22
Post Simulation of flow around a cylinder in OpenFOAM in 2D case
  #1
New Member
 
Martin Mathew
Join Date: Nov 2023
Posts: 4
Rep Power: 3
martinmat13 is on a distinguished road
I tried to make a domain for my simulation for a 2d case. But when I import my stl file and execute snappyHexMesh, the stl file is split up into 4 cells in z-direction and the base mesh is 1 cell (which is desired as for a 2d case).

How can I resolve this issue with the stl file.

The images and snappyHexMeshDict are shown here below.

************************************************** *************

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2212 |
| \\ / 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 false;
geometry
{
fish.stl { type triSurfaceMesh; name fish; }
refinementeBox
{
type searchableBox;
min (0.9 0 0);
max (2.4 0.75 0.01);
}

fishRefinementBox
{
type searchableBox;
min (1.38 0.33 0);
max (1.72 0.42 0.01);
}

}

castellatedMeshControls
{
features
(
{ file "fish.eMesh";
level 2 ;
//refineFeatureEdgesOnly false;
}
);

refinementSurfaces
{
fish {
level (2 2);
patchInfo
{
type wall;
}
}


}

refinementRegions
{
/*fish
{

mode outside;
levels ((0.01 1));


}*/

/*refinementeBox
{

mode inside;
levels ((1 1));

}*/

fishRefinementBox
{

mode inside;
levels ((1 1));

}

}

locationInMesh (1.2 0.54 0.0009); //(0.2 0.2 0.1);
maxLocalCells 100000;
maxGlobalCells 200000;
minRefinementCells 0;
nCellsBetweenLevels 1;
resolveFeatureAngle 20;
allowFreeStandingZoneFaces true;
planarAngle 30.0;
maxLoadUnbalance 0.1;
}

snapControls
{
nSolveIter 300;
nSmoothPatch 5;
tolerance 2.0;
nRelaxIter 25;
nFeatureSnapIter 20;
implicitFeatureSnap false;
explicitFeatureSnap true;
multiRegionFeatureSnap true;
}

addLayersControls
{
layers
{
//"patch_inlet-fancoil.*"
//{
//nSurfaceLayers 10;
//}
}

relativeSizes true;
expansionRatio 1.05;
finalLayerThickness 0.5;
minThickness 0.05;
nGrow 0;
featureAngle 130;
slipFeatureAngle 60;
nRelaxIter 5;
nSmoothSurfaceNormals 1;
nSmoothNormals 3;
nSmoothThickness 10;
maxFaceThicknessRatio 0.5;
maxThicknessToMedialRatio 0.3;
minMedialAxisAngle 90;
nBufferCellsNoExtrude 0;
nLayerIter 50;
nRelaxedIter 20;
writeVTK false;
noErrors false;
layerRecovery 1;
growZoneLayers false;
projectGrownUp 0.0;
}

meshQualityControls
{
maxNonOrtho 65.0;
maxBoundarySkewness 3;
maxInternalSkewness 3;
maxConcave 65.0;
minFlatness 0.5;
minVol 1.0E-13;
minTetQuality 1.0E-15;
minArea -1.0;
minTwist 0.02;
minDeterminant 0.001;
minFaceWeight 0.05;
minVolRatio 0.01;
minTriangleTwist -1.0;
nSmoothScale 4;
errorReduction 0.75;
relaxed
{
maxNonOrtho 65;
}
}

debug 0;
mergeTolerance 1.0E-2;
autoBlockMesh true;
Attached Images
File Type: jpg BaseMesh.jpg (65.2 KB, 10 views)
File Type: jpg STLMesh.jpg (72.9 KB, 11 views)
martinmat13 is offline   Reply With Quote

Old   January 23, 2024, 11:44
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hello Martin,

Due to the way snappy refines the mesh (octree structure), it cannot mesh 2D cases out of the box since it also refines the 3rd dimension.
However, you can mesh your geometry in snappy as you already did, then use the extrudeMesh utility to extrude one of the face of your mesh and get the proper one-cell thickness mesh you need for your 2D case.

I didn't search for it but you should be able to find examples in the tutorials or on the forum.

Regards,
Yann
martinmat13 likes this.
Yann is offline   Reply With Quote

Old   January 23, 2024, 12:32
Default
  #3
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
Extrude a one-cell layer of the front or back patch and throw away the original mesh.
martinmat13 likes this.
GerhardHolzinger is offline   Reply With Quote

Old   January 24, 2024, 08:34
Default
  #4
New Member
 
Martin Mathew
Join Date: Nov 2023
Posts: 4
Rep Power: 3
martinmat13 is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hello Martin,

Due to the way snappy refines the mesh (octree structure), it cannot mesh 2D cases out of the box since it also refines the 3rd dimension.
However, you can mesh your geometry in snappy as you already did, then use the extrudeMesh utility to extrude one of the face of your mesh and get the proper one-cell thickness mesh you need for your 2D case.

I didn't search for it but you should be able to find examples in the tutorials or on the forum.

Regards,
Yann
Dear Mr. Yann

Thank you for your reply and suggestion. Good news is, it worked the way you suggested and I was able to extrude my mesh. Much thanks and regards.

Martin
Yann likes this.
martinmat13 is offline   Reply With Quote

Reply

Tags
cfd, meshing 2d, openfoam, simulation, snappyhexmesh


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
Map of the OpenFOAM Forum - Understanding where to post your questions! wyldckat OpenFOAM 10 September 2, 2021 06:29
Issues on the simulation of high-speed compressible flow within turbomachinery dowlee OpenFOAM Running, Solving & CFD 11 August 6, 2021 07:40
Turning the Tutorial propeller case into a flow driven case with 6Dof efirvida OpenFOAM 0 March 7, 2017 10:45
Running a feedback control simulation of the flow around a cylinder gasagna OpenFOAM Running, Solving & CFD 0 July 16, 2014 11:03
[Other] OpenFoam Flow over a Circular Cylinder WolfgangS. OpenFOAM Meshing & Mesh Conversion 12 March 3, 2014 11:53


All times are GMT -4. The time now is 10:48.