
[Sponsors] 
[snappyHexMesh] external flow with snappyHexMesh 

LinkBack  Thread Tools  Search this Thread  Display Modes 
January 8, 2010, 04:48 
external flow with snappyHexMesh

#1 
Member
Axel Söhngen
Join Date: Jan 2010
Location: Germany, Trier
Posts: 31
Rep Power: 15 
Hello,
the case i wanted to create is an external flow over a cylinder. I have created the cylinder in catia and imported it in openfoam as a stl file. Then i create a mesh around the cylinder using blockmesh. Now i want to mesh again with the cylinder using snappyHexMesh. These are my first steps using snappy so I don't find the bug in the code! It was my idea to remesh the mesh of blockMesh getting a finer mesh near the cylinder. I hope anyone can help P.s.: sorry for the bad english /** C++ **\  =========    \\ / F ield  OpenFOAM: The Open Source CFD Toolbox   \\ / O peration  Version: 1.5   \\ / A nd  Web: http://www.OpenFOAM.org   \\/ M anipulation   \**/ FoamFile { version 2.0; format ascii; class dictionary; object autoHexMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Which of the steps to run castellatedMesh true; snap true; addLayers false; geometry { Zyl1.stl { type triSurfaceMesh; regions { CATIASTL { name Zylinder; } } } } castellatedMeshControls { locationInMesh (0 0 0); //it is a point outside the stl and inside the blockmesh mesh maxLocalCells 4000000; maxGlobalCells 12000000; minRefinementCells 10; nCellsBetweenLevels 2; resolveFeatureAngle 70; features ( ); refinementSurfaces { Zyl1.stl { level (2 2); regions { CATIASTL { level (3 3); } } } } refinementRegions { } } snapControls { nSmoothPatch 3; tolerance 4.0; nSolveIter 30; nRelaxIter 6; } meshQualityControls { maxNonOrtho 65; maxBoundarySkewness 20; maxInternalSkewness 4; maxConcave 80; minFlatness 0.5; minVol 1e13; minArea 1; minTwist 0.05; minDeterminant 0.001; minFaceWeight 0.05; minVolRatio 0.01; minTriangleTwist 1; nSmoothScale 4; errorReduction 0.75; } addLayersControls { } mergeTolerance 1E6; debug 0; // ************************************************** *********************** // 

January 8, 2010, 10:01 

#2 
Senior Member
BastiL
Join Date: Mar 2009
Posts: 529
Rep Power: 19 
First look that looks fine. What is your problem? What error do you get?
Regards. 

January 8, 2010, 12:40 

#3 
Member
Axel Söhngen
Join Date: Jan 2010
Location: Germany, Trier
Posts: 31
Rep Power: 15 
Hello,
i get no error but in paraview there isn't shown a new mesh. there is only shown the mesh generated in blockMesh. I think that there must be the mesh around the cylinder. 

January 8, 2010, 15:21 

#4  
Senior Member
BastiL
Join Date: Mar 2009
Posts: 529
Rep Power: 19 
Quote:
Do you get a "1" and "2" folder? This should contain your meshes after refinement (1) and snapping (2). If you ran in parallel the might be hidden in the processorX directories. To see the mesh in paraview you have to use the animation control to jump to the next "time". 

January 9, 2010, 02:52 

#5 
Member
Axel Söhngen
Join Date: Jan 2010
Location: Germany, Trier
Posts: 31
Rep Power: 15 
Yes the folders 1 and 2 were created executing snappy but the variables p and U aren't there. I do not run in parallel
(I think) but in the new folders there are the polyMesh folders created. However nothing happens when i jump to the next time in paraview (i think there must be snapped out the geometry of the cylinder). Here is the code executing snappy Thank you for your replies!! /**\  =========    \\ / F ield  OpenFOAM: The Open Source CFD Toolbox   \\ / O peration  Version: 1.6   \\ / A nd  Web: www.OpenFOAM.org   \\/ M anipulation   \**/ Build : 1.653b7f692aa41 Exec : snappyHexMesh Date : Jan 09 2010 Time : 08:35:53 Host : axellaptop PID : 2546 Case : /home/axel/OpenFOAM/axel1.6/run/run/incomressible/Zylinder nProcs : 1 SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Read mesh in = 0.06 s Overall mesh bounding box : (0 0.1 0.05) (0.05 0.1 0.05) Relative tolerance : 1e06 Absolute matching distance : 2.29129e07 Reading refinement surfaces. Read refinement surfaces in = 0 s Reading refinement shells. Read refinement shells in = 0 s Setting refinement level of surface to be consistent with shells. Checked shell refinement in = 0 s Determining initial surface intersections  Edge intersection testing: Number of edges : 3300 Number of edges to retest : 3300 Number of intersected edges : 0 Calculated surface intersections in = 0.04 s Initial mesh : cells:1000 faces:3300 points:1331 Cells per refinement level: 0 1000 Adding patches for surface regions  Patch Region   zylinder: 5 zylinder_CATIASTL Added patches in = 0 s Selecting decompositionMethod hierarchical Refinement phase  Found point (0 0 0) in cell 550 on processor 0 Reading external feature lines. Read feature lines in = 0.01 s Surface refinement iteration 0  Marked for refinement due to surface intersection : 0 cells. Marked for refinement due to curvature/regions : 0 cells. Determined cells to refine in = 0.01 s Selected for refinement : 0 cells (out of 1000) Stopping refining since too few cells selected. Removing mesh beyond surface intersections  Found point (0 0 0) in cell 550 in global region 0 out of 1 regions. Keeping all cells in region 0 containing point (0 0 0) Selected for keeping : 1000 cells. Edge intersection testing: Number of edges : 3300 Number of edges to retest : 0 Number of intersected edges : 0 Shell refinement iteration 0  Marked for refinement due to refinement shells : 0 cells. Determined cells to refine in = 0.03 s Selected for internal refinement : 0 cells (out of 1000) Stopping refining since too few cells selected. Splitting mesh at surface intersections  Introducing baffles for 0 faces that are intersected by the surface. Edge intersection testing: Number of edges : 3300 Number of edges to retest : 0 Number of intersected edges : 0 Created baffles in = 0.02 s After introducing baffles : cells:1000 faces:3300 points:1331 Cells per refinement level: 0 1000 Introducing baffles to block off problem cells  markFacesOnProblemCells : marked 0 additional internal faces to be converted into baffles. Analyzed problem cells in = 0.01 s Introducing baffles to delete problem cells. Edge intersection testing: Number of edges : 3300 Number of edges to retest : 0 Number of intersected edges : 0 Created baffles in = 0.02 s After introducing baffles : cells:1000 faces:3300 points:1331 Cells per refinement level: 0 1000 Remove unreachable sections of mesh  Keeping all cells in region 0 containing point (0 0 0) Selected for keeping : 1000 cells. Edge intersection testing: Number of edges : 3300 Number of edges to retest : 0 Number of intersected edges : 0 Split mesh in = 0.03 s After subsetting : cells:1000 faces:3300 points:1331 Cells per refinement level: 0 1000 Handling cells with snap problems  Introducing baffles for 0 faces that are intersected by the surface. Edge intersection testing: Number of edges : 3300 Number of edges to retest : 0 Number of intersected edges : 0 Created baffles in = 0.02 s After introducing baffles : cells:1000 faces:3300 points:1331 Cells per refinement level: 0 1000 Introducing baffles to block off problem cells  markFacesOnProblemCells : marked 0 additional internal faces to be converted into baffles. Analyzed problem cells in = 0.01 s Introducing baffles to delete problem cells. Edge intersection testing: Number of edges : 3300 Number of edges to retest : 0 Number of intersected edges : 0 Created baffles in = 0.02 s After introducing baffles : cells:1000 faces:3300 points:1331 Cells per refinement level: 0 1000 Remove unreachable sections of mesh  Keeping all cells in region 0 containing point (0 0 0) Selected for keeping : 1000 cells. Edge intersection testing: Number of edges : 3300 Number of edges to retest : 0 Number of intersected edges : 0 Split mesh in = 0.02 s After subsetting : cells:1000 faces:3300 points:1331 Cells per refinement level: 0 1000 dupNonManifoldPoints : Found : 0 nonmanifold points (out of 1331) Edge intersection testing: Number of edges : 3300 Number of edges to retest : 0 Number of intersected edges : 0 getDuplicateFaces : found 0 pairs of duplicate faces. Detected unsplittable baffles : 0 Merge refined boundary faces  mergePatchFaces : Merging 0 sets of faces. Removing 0 straight edge points. Refined mesh : cells:1000 faces:3300 points:1331 Cells per refinement level: 0 1000 Writing mesh to time 0.005 Written mesh in = 0.08 s. Morphing phase  Constructing mesh displacer ... Using mesh parameters { maxNonOrtho 65; maxBoundarySkewness 20; maxInternalSkewness 4; maxConcave 80; minFlatness 0.5; minVol 1e13; minArea 1; minTwist 0.05; minDeterminant 0.001; minFaceWeight 0.05; minVolRatio 0.01; minTriangleTwist 1; nSmoothScale 4; errorReduction 0.75; } Checking initial mesh ... Checking faces in error : nonorthogonality > 65 degrees : 0 faces with face pyramid volume < 1e13 : 0 faces with concavity > 80 degrees : 0 faces with skewness > 4 (internal) or 20 (boundary) : 0 faces with interpolation weights (0..1) < 0.05 : 0 faces with volume ratio of neighbour cells < 0.01 : 0 faces with face twist < 0.05 : 0 faces with triangle twist < 1 : 0 faces on cells with determinant < 0.001 : 0 Detected 0 illegal faces (concave, zero area or negative cell pyramid volume) Checked initial mesh in = 0.01 s Smoothing patch points ... Smoothing iteration 0 Found 0 nonmainfold point(s). Scaling iteration 0 Moving mesh using diplacement scaling : min:1 max:1 Checking faces in error : nonorthogonality > 65 degrees : 0 faces with face pyramid volume < 1e13 : 0 faces with concavity > 80 degrees : 0 faces with skewness > 4 (internal) or 20 (boundary) : 0 faces with interpolation weights (0..1) < 0.05 : 0 faces with volume ratio of neighbour cells < 0.01 : 0 faces with face twist < 0.05 : 0 faces with triangle twist < 1 : 0 faces on cells with determinant < 0.001 : 0 Successfully moved mesh Smoothing iteration 1 Found 0 nonmainfold point(s). Scaling iteration 0 Moving mesh using diplacement scaling : min:1 max:1 Checking faces in error : nonorthogonality > 65 degrees : 0 faces with face pyramid volume < 1e13 : 0 faces with concavity > 80 degrees : 0 faces with skewness > 4 (internal) or 20 (boundary) : 0 faces with interpolation weights (0..1) < 0.05 : 0 faces with volume ratio of neighbour cells < 0.01 : 0 faces with face twist < 0.05 : 0 faces with triangle twist < 1 : 0 faces on cells with determinant < 0.001 : 0 Successfully moved mesh Smoothing iteration 2 Found 0 nonmainfold point(s). Scaling iteration 0 Moving mesh using diplacement scaling : min:1 max:1 Checking faces in error : nonorthogonality > 65 degrees : 0 faces with face pyramid volume < 1e13 : 0 faces with concavity > 80 degrees : 0 faces with skewness > 4 (internal) or 20 (boundary) : 0 faces with interpolation weights (0..1) < 0.05 : 0 faces with volume ratio of neighbour cells < 0.01 : 0 faces with face twist < 0.05 : 0 faces with triangle twist < 1 : 0 faces on cells with determinant < 0.001 : 0 Successfully moved mesh Patch points smoothed in = 0.06 s Calculating patchDisplacement as distance to nearest surface point ... Calculated surface displacement in = 0 s Smoothing displacement ... Iteration 0 Iteration 10 Iteration 20 Displacement smoothed in = 0 s Moving mesh ... Iteration 0 Moving mesh using diplacement scaling : min:1 max:1 Checking faces in error : nonorthogonality > 65 degrees : 0 faces with face pyramid volume < 1e13 : 0 faces with concavity > 80 degrees : 0 faces with skewness > 4 (internal) or 20 (boundary) : 0 faces with interpolation weights (0..1) < 0.05 : 0 faces with volume ratio of neighbour cells < 0.01 : 0 faces with face twist < 0.05 : 0 faces with triangle twist < 1 : 0 faces on cells with determinant < 0.001 : 0 Successfully moved mesh Moved mesh in = 0.02 s Repatching faces according to nearest surface ... Repatched 0 faces in = 0 s Edge intersection testing: Number of edges : 3300 Number of edges to retest : 1956 Number of intersected edges : 0 Snapped mesh : cells:1000 faces:3300 points:1331 Cells per refinement level: 0 1000 Writing mesh to time 0.01 Written mesh in = 0.04 s. Finished meshing in = 0.51 s. End 

January 9, 2010, 12:59 

#6 
New Member
Axel Tietjen
Join Date: Dec 2009
Location: Hamburg, Germany
Posts: 19
Rep Power: 15 
Hi Axel,
I think, there possibly went something wrong with the naming of your geometry, surface and regions. It seems to me that your geometry subdictionary should look somehow like this: geometry { Zyl1.stl} The name Zylinder is then used to define the other options. If you want to refine the internal mesh, too, you should define a region within the above geometry subdictionary. That could look like this: refinementBox // name it as you wantIf you want the whole mesh to be refined, those coordinates would most easily be the coordinates of YOUR blockMesh points. But in my opinion it is better to set blockMesh to produce smaller cells, in this case. But you can use the refinementBox (or several boxes) to refine special areas of interest. To specify the refinement at the geometry surface, the refinementSurface subdictionary should better look like this, I'd suggest: refinementSurfaces { Zylinder} There you can simply use the geometryname instead of the stlfilename. Just to keep the structure of snappyHexMeshDict tidy, I would put the <resolveFeatureAngle 70;>entry directly behind the refinementSurfaces subdictionary, because it belongs to the second entry within the levelbrace. So <level (2 3)> and <resolveFeatureAngle 70> would mean, that snappy refines each cell, that intersect the surface two time, but even three times, where the geometry is maybe a edge. But for a zylinder that option wouldn't make sense, of course. I see that your refinementRegion is empty. But if you wish to use that, just type: refinementRegions { refinementBox} The first value within the brace 1e15 has no meaning. If you want to try these suggested changes, you can run checkMesh after snappy is done and post it's output here. Good luck Axel 

January 11, 2010, 01:53 

#7 
Senior Member
Claus Meister
Join Date: Aug 2009
Location: Wiesbaden, Germany
Posts: 241
Rep Power: 16 
Hey folks!
As I have seen you guys are very involved into snappyHexMesh. I want to ask you is it possible to use snappyHexMesh also for internal flows. I mean if I have pipe in stl then can I created a mesh in the inner of the pipe. cheers, Claus 

January 11, 2010, 03:36 

#8 
Member
Axel Söhngen
Join Date: Jan 2010
Location: Germany, Trier
Posts: 31
Rep Power: 15 
Thank you Axel, i have changed my snappy Dict. and it works.
But now when I type in "icoFoam" there is missing the file p! In controlDict I have started with "latest time". Do I have to copy file p and U into directory 2? 

January 11, 2010, 18:23 

#9 
New Member
Axel Tietjen
Join Date: Dec 2009
Location: Hamburg, Germany
Posts: 19
Rep Power: 15 
Hello Claus,
it is no problem to create a internal mesh with snappy. In fact, I've never done something else... The trick is just to set the locationInMesh (x y z);to a coordinate, that is within your stlsurface. That's all! @ Axel: Great! I'm glad, that I was able to help you with that hints. To your new question: yes, it would help. But make shure, that you copy all needed files to your starttimedirectory. I'm not so familiar with icoFoam since I use the compressible solver rhoPisoFoam, which needs p,U,T,k,omega,mut,alphat, ... Maybe a look in the userguide's tutorial on icoFoam (chapter 2, I think) would give you more details. bye 

January 12, 2010, 05:53 

#10 
Senior Member
Claus Meister
Join Date: Aug 2009
Location: Wiesbaden, Germany
Posts: 241
Rep Power: 16 
Hallo Alex,
I have to tell you that I have even never used snappy because I did not know that this tool is even appropriated for my kind of problem. However, before is started to invest time in it, could you please send me a simple case form which I can learn? I just need to see it then I know what to do. Thanks in advance! Claus 

January 12, 2010, 08:26 

#11 
Senior Member
Claus Meister
Join Date: Aug 2009
Location: Wiesbaden, Germany
Posts: 241
Rep Power: 16 
Hallo Alex,
is me again. I have investigate the snappy hex mesh all the morning. As I can see, all what I want to please you is could you send me or post such a snappyHexDict file with in inter flow application. That would be grateful. Cheers, Claus 

January 15, 2010, 19:43 

#12 
New Member
Axel Tietjen
Join Date: Dec 2009
Location: Hamburg, Germany
Posts: 19
Rep Power: 15 
Hi Claus,
sorry for my late reply, I'm quite busy at the moment. Here is a sHMDict that worked for me. It is just a modified file from a tutorial. (I had to rename it as a .txt file, to upload it.) Please notice that I use a very small geometry in my cases, so locationInMesh and the coordinates of the refinement Boxes are small values and not many refinement levels. You may fit it for your kind of application. in my opinion the "minVol" parameter at the bottom of the file has to fit to the smallest regular cellsize. So you have to calculate: With a initial (block)Mesh of 2x2x2mm blocks, the cell volume reduces to 1/8 within each refinementLevel. While level 0 has a Volume of 8e9m³, a regular level3cell has only 1.56e11m³. Since some cells get cut to half at the surface and then get deformed to snap onto it, I set the "minVol"parameter to 1/8th of that: 1e12 in that case. I don't know exactly what snappy does in every step, but playing around I came to those experiences. Tip: Just create a simple stlgeometry like a sphere to learn using snappy. 

Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Issues on the simulation of highspeed compressible flow within turbomachinery  dowlee  OpenFOAM Running, Solving & CFD  11  August 6, 2021 06:40 
About the Reynolds Number and Yplus in external flow  Mason liu  CFX  18  November 10, 2014 18:37 
[snappyHexMesh] Pipe flow / Internal fluid dynamics with SnappyHexMesh  denner  OpenFOAM Meshing & Mesh Conversion  3  October 13, 2011 09:24 
Modeling internal and external flow for a nozzle  smschnob  Main CFD Forum  1  November 11, 2010 17:12 
Best settings for solar car external flow problems  kdrbrk  Main CFD Forum  0  July 16, 2010 02:18 