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

[snappyHexMesh] SnappyHexMesh in 2D case

Register Blogs Community New Posts Updated Threads Search

Like Tree11Likes
  • 1 Post By eugene
  • 1 Post By hansel
  • 4 Post By elmo555
  • 5 Post By mAlletto

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 23, 2008, 17:26
Default SnappyHexMesh in 2D case
  #1
sjs
New Member
 
Sylvia Smullin
Join Date: Mar 2009
Posts: 10
Rep Power: 17
sjs is on a distinguished road
I am trying to look at an airfoil shape in 2D. Geometry is like the airfoil in a big box, with wind along the chord direction. I set up "empty" patches on the walls perpendicular to the span of the airfoil. This works fine. However, then when I try to use snappyHexMesh to mesh nicely around the foil shape, it doesn't work. With a blockdict specifying only 1 cell in that span direction, snappyHexMesh won't work (it does work if I don't have empty patches on those boundary). If I make 2 cells in the span direction, snappyHexMesh works, however when I try to run icoFoam, I get this error:

This mesh contains patches of type empty but is not 1D or 2D by virtue of the fact that the number of faces of this empty patch is not divisible by the number of cells.

Suggestion for how I can use this excellent snappyHexMesh tool for a 2D case?

Thank you.
Sylvia
sjs is offline   Reply With Quote

Old   July 24, 2008, 09:33
Default You cant. The best you could d
  #2
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
You cant. The best you could do is to make a slightly 3D case and use symmetry planes on the spanwise boundaries.
Gang Wang likes this.
eugene is offline   Reply With Quote

Old   July 24, 2008, 14:09
Default Thank you for the advice. I tr
  #3
sjs
New Member
 
Sylvia Smullin
Join Date: Mar 2009
Posts: 10
Rep Power: 17
sjs is on a distinguished road
Thank you for the advice. I tried symmetry planes with 1 cell in the span direction. snappyHexMesh failed. So I use 2 cells in the span direction, with symmetry plane boundary conditions. From a physical point of view, how accurate is this for a 2D case? For accuracy, do I just need to use an outside mesher so I can make it more properly 2D (ie empty side planes and only 1 cell in the span direction)? It looks like the naca airfoil example in soniceTurbFoam works fine with empty planes on either side and only one cell in the spanwise direction.

Thanks.
Sylvia
sjs is offline   Reply With Quote

Old   July 24, 2008, 14:44
Default If you import a 2D mesh, made
  #4
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
If you import a 2D mesh, made for example with gambit, the converter extrudes it to a 3D mesh with 1 cell in the extrusion direction, with empty planes as boundary conditions. OpenFOAM does not have a 2D solver, but that is the right way of performing 2D simulations.

Francesco
fra76 is offline   Reply With Quote

Old   July 25, 2008, 14:51
Default By the way, I also tried symme
  #5
sjs
New Member
 
Sylvia Smullin
Join Date: Mar 2009
Posts: 10
Rep Power: 17
sjs is on a distinguished road
By the way, I also tried symmetry planes, both on rhoSonicFoam and on icoFoam. Both systems diverged within 0.02 s of integration time. I don't know if this has anything to do with the mesh, but it seemed to work ok with slip boundary conditions (which is not at all what I want) or without the snappyHexMesh (which also is not what I want). Has anyone else tried to use snappyHexMesh extending to side planes with b.c. that are anyting besides slip?
sjs is offline   Reply With Quote

Old   August 25, 2008, 05:59
Default HI Sylvia, Regarding your e
  #6
Senior Member
 
mayank gupta
Join Date: Mar 2009
Posts: 110
Rep Power: 17
mgz1985 is on a distinguished road
HI Sylvia,

Regarding your error with running icoFoam, it is due to the fact of having cells in the 3D. I had the same problem.

To solve 2-D cases in OpenFOAM u need to specify only 1 cell in z-direction of type empty. if snappyHexMesh is adding 2 cells in the z-direction, u r bound to get the error

If u define more than 1 cell in the z-direction u get the above error. I have not worked with snappyHexMesh but i know with my experience of meshing an airfoil, the reason for the above error.
mgz1985 is offline   Reply With Quote

Old   February 11, 2009, 06:36
Default Hello Eugene, hello FOAMers,
  #7
Member
 
lord_kossity's Avatar
 
Andreas Dietz
Join Date: Mar 2009
Location: Munich
Posts: 79
Rep Power: 17
lord_kossity is on a distinguished road
Hello Eugene,
hello FOAMers,

I've got one additional question applying snappyHexMesh for a 2D-case.

For an analysis of lift and drag, i tried to create a 2D-mesh of a car.

I did the following to cheat a bit, since I already knew that snappyHex is not planned to work in 2D.

1) create a blockMesh with one cell in spanwise direction

2) change the level of refinementSurfaces to (0 0) in order to avoid additional cells in spanwise direction

3) snapping runs with standard parameters

4) change surfaceLayers to 2 in addLayersControls

snappyHexMesh runs fine. But it does not insert layers.

For copyright reasons, I can only show a part of the frontend




In order that anybody can run the case, I additionaly attach the blockMeshDict and snappyHexMeshDict for a 2D Cube (one cell in y-direction).





Please let me know, if you are able to insert layers.

Andreas

btw: anybody knows how to get rid of the diagonals in paraview?
lord_kossity is offline   Reply With Quote

Old   February 11, 2009, 06:38
Default one more try for the picture:
  #8
Member
 
lord_kossity's Avatar
 
Andreas Dietz
Join Date: Mar 2009
Location: Munich
Posts: 79
Rep Power: 17
lord_kossity is on a distinguished road
one more try for the picture:


lord_kossity is offline   Reply With Quote

Old   February 11, 2009, 06:55
Default Hi Andreas, No, you cannot
  #9
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
Hi Andreas,

No, you cannot insert layers in pseudo-2D. At present, layers cannot just stop. They have to gradually go from no layer cells to many layer cells in a step-wise fashion. Thus 1 layer would never be possible.

Eugene
eugene is offline   Reply With Quote

Old   July 8, 2009, 18:42
Default
  #10
Senior Member
 
Steve Hansel
Join Date: Jun 2009
Location: Colorado, USA
Posts: 112
Rep Power: 17
hansel is on a distinguished road
It would be nice to have a utility that would take a 2d (one layer thick) slice out of a 3d mesh. I was hoping flattenMesh would do it, but that's for something else.

For taking a z slice at height Z:

1) Find all faces and edges that cross Z
2) preserve those faces and edges, and discard the others.
3) Run flattenMesh on the results.

hmmm I guess you also have to close the top and bottom. Maybe it's not so simple.

Steve
elmo555 likes this.
hansel is offline   Reply With Quote

Old   November 29, 2017, 12:19
Default
  #11
Member
 
Lennart
Join Date: Feb 2016
Posts: 46
Rep Power: 10
elmo555 is on a distinguished road
Apparently, there are a few solutions to use SnappyHexMesh for 2D cases:
http://openfoamwiki.net/index.php/Sn...rate_2D_meshes

The simples one seems to be from Alejandro Roger Ull:
Dynamic Mesh for a Gear Pump

I'll quickly summarize what to do here:
  1. Crease base mesh with blockMesh with separate "empty" patches named "front" and "back"
  2. Create mesh with snappyHexMesh as you like
  3. Run "extrudeMesh" with an extrudeMeshDict like the one provided below.

Here's a simple extrudeMeshDict that will do the job:
Code:
constructFrom       patch;

sourceCase          ".";

sourcePatches       (front);

exposedPatchName    back;

flipNormals         false;

extrudeModel        linearNormal;

nLayers             1;

expansionRatio      1.0;

linearNormalCoeffs
{
    thickness       0.01;
}

mergeFaces          false;
akionux, Mansur, hogsonik and 1 others like this.

Last edited by elmo555; November 29, 2017 at 12:59. Reason: Added code
elmo555 is offline   Reply With Quote

Old   August 15, 2018, 20:41
Default
  #12
New Member
 
Alex
Join Date: Jul 2018
Posts: 2
Rep Power: 0
Chubmaster is on a distinguished road
extrudeMesh does
Code:
Writing mesh to "/mnt/c/Users/Avedis/Desktop/Fluids_stuff/flateplate02D/constant/region0"
, it does not write to the most recent polymesh. When I check the constant directory its not there. If I look at the most recent time in paraview, its the same mesh as before. I don't think it did anything.
Chubmaster is offline   Reply With Quote

Old   November 8, 2019, 05:51
Default
  #13
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
Maybe it is of interest for someone: in the openfoam.com version 1906 there is a tutorial how to create a 2d mesh from snappy. The procedure is like described above: first create a 3d mesh with snappy and then use the utility extrudeMesh to create a mesh with only one cell in spanwise direction. The tutorial can be found in $FOAM_TUTORIAL/incompressible/overSimpleFoam/aeroFoil
mAlletto 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
Pressure instabilities with interDyMFoam for the floatingObject case nbadano OpenFOAM Running, Solving & CFD 15 October 15, 2021 07:35
Reporting a bug in Allrun script on wingMotion case i.sabahi OpenFOAM Bugs 0 June 10, 2018 10:00
Running parallel case after parallel meshing with snappyHexMesh? Adam Persson OpenFOAM Running, Solving & CFD 0 August 31, 2015 23:04
Is Playstation 3 cluster suitable for CFD work hsieh OpenFOAM 9 August 16, 2015 15:53
Simple channel case using cyclicAMI will not converge cbcoutinho OpenFOAM Running, Solving & CFD 3 August 4, 2015 13:28


All times are GMT -4. The time now is 12:00.