# [snappyHexMesh] snappyHexMesh doesnt snap

 Register Blogs Members List Search Today's Posts Mark Forums Read

 June 9, 2015, 06:56 #41 New Member   John Smith Join Date: Jun 2015 Posts: 4 Rep Power: 9 Is it possible in the blockMeshDict to create two areas in effect, one close to the turbine where I can impose much more vertices and a larger one to deal with the macro flow effects? Or is this what the refinement is supposed to do? Thanks, Mark

 June 9, 2015, 09:17 #42 Senior Member   Saideep Join Date: Apr 2015 Location: INDIA Posts: 203 Rep Power: 11 Hi Mark; It basically gets complex if you have an irregular shape. Incase if you have a chance to split into hexahedral polygons then it is easy as explained in the cavity tutorial. Also I just saw several videos in Youtube which shows the usage of "Adaptive meshes". {I didn't start working with that as of now may be someone can shed some light on that}. I just have an impression it is just a library so it shall be easy to use an adaptive grid also. Saideep

July 21, 2015, 15:24
#43
New Member

Regis
Join Date: Jan 2012
Posts: 24
Rep Power: 13
Quote:
 Originally Posted by wyldckat The only thing that I can find to be potentially wrong is the "locationInMesh", which is a value too round and likely to get placed on top of a face or vertex of a cell.
Bruno, could you elaborate a bit more on this? From what I understood, as far as this point is inside the part of the geometry we wish to mesh, we're good. For instance, I use something like (5 5 5), that is, really round numbers.

Regis

July 25, 2015, 15:04
#44
Retired Super Moderator

Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,969
Blog Entries: 45
Rep Power: 127
Greetings to all!

@Regis_:
Quote:
 Originally Posted by Regis_ Bruno, could you elaborate a bit more on this? From what I understood, as far as this point is inside the part of the geometry we wish to mesh, we're good. For instance, I use something like (5 5 5), that is, really round numbers.
The answer is essentially in the comment section of the "snappyHexMeshDict" files that are in the OpenFOAM tutorial cases, e.g.: https://github.com/OpenFOAM/OpenFOAM...xMeshDict#L140
Code:
```    // NOTE: This point should never be on a face, always inside a cell, even
// after refinement.
// This is an outside point locationInMesh (-0.033 -0.033 0.0033);
locationInMesh (-9.23149e-05 -0.0025 -0.0025); // Inside point```
In other words, you should avoid situations where it's not able to calculate an accurate line between the location of this point "locationInMesh" and the centre/vertexes of a face (face of a cell).

Best regards,
Bruno

Last edited by wyldckat; July 25, 2015 at 15:05. Reason: added a few missing words

March 17, 2018, 14:08
#45
Member

Join Date: Oct 2017
Posts: 52
Rep Power: 7
Quote:
 Originally Posted by wyldckat Greetings Thomas and welcome to the forum! The only thing that I can find to be potentially wrong is the "locationInMesh", which is a value too round and likely to get placed on top of a face or vertex of a cell. I suggest the following: Create a smaller case, based on this geometry, with a single connecting cylinder. Prepare the case for mesh generation. In a similar way to the tutorial "mesh/snappyHexMesh/flange". Test if it works. If it does, run Allclean and pack your case inside a zip or tar.gz file and attach to your next post. If too big, share online in some site like Dropbox. This way it is easier to diagnose what's wrong, since we'll be able to test this ourselves. Best regards, Bruno
can anyone tell me what is wrong with my mesh. whenever i run it, i only get bounding box which i created with blockMesh
Code:
```/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.1                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
version     2.0;
format      ascii;
class       dictionary;
object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Which of the steps to run
castellatedMesh true;
snap            true;

geometry
{
mysurf.stl
{
type triSurfaceMesh;
regions
{
input {name input;}
walls {name walls;}
output {name output;}

}
}
cylinder.stl
{
type triSurfaceMesh;
name cylinder;
}
};

// Settings for the castellatedMesh generation.
castellatedMeshControls
{

maxLocalCells 100000;

maxGlobalCells 2000000;

minRefinementCells 10;

nCellsBetweenLevels 1;

features
(

);

refinementSurfaces
{
regional.stl
{
// Surface-wise min and max refinement level
level (2 2);
input { level (2 2);    patchInfo {type	   patch;} }
walls { level (2 2);    patchInfo {type	   patch;} }
output { level (2 2);   patchInfo {type   patch;} }
}
}

// Resolve sharp angles
resolveFeatureAngle 24;

refinementRegions
{
cylinder.stl
{

levels (2 2);
}
}

locationInMesh (0 0 10);

allowFreeStandingZoneFaces true;
}

snapControls
{

nSmoothPatch 3;

tolerance 2.0;

nSolveIter 30;

nRelaxIter 5;

nFeatureSnapIter 10;

implicitFeatureSnap true;

explicitFeatureSnap false;

multiRegionFeatureSnap false;
}

// Settings for the layer addition.
{
relativeSizes true;

layers
{

}

expansionRatio 1.0;

finalLayerThickness 0.3;

minThickness 0.1;

nGrow 0;

featureAngle 60;

slipFeatureAngle 30;

nRelaxIter 3;

nSmoothSurfaceNormals 1;

nSmoothNormals 3;

nSmoothThickness 10;

maxFaceThicknessRatio 0.5;

maxThicknessToMedialRatio 0.3;

minMedianAxisAngle 90;

nBufferCellsNoExtrude 0;

nLayerIter 50;
}

meshQualityControls
{
#include "meshQualityDict"

//- Number of error distribution iterations
nSmoothScale 4;
//- Amount to scale back displacement at error points
errorReduction 0.75;
}

writeFlags
(
scalarLevels
layerSets
layerFields     // write volScalarField for layer coverage
);

mergeTolerance 1e-6;

// ************************************************************************* //```

March 17, 2018, 16:43
#46
Retired Super Moderator

Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,969
Blog Entries: 45
Rep Power: 127
Quote:
 Originally Posted by gouravjee can anyone tell me what is wrong with my mesh. whenever i run it, i only get bounding box which i created with blockMesh
1. Please follow the instructions given here: How to give enough info to get help
2. Because right now the best me or any one else can do is guess, and my best guess is that snappyHexMesh is as blind as we are regarding the geometry you are telling us that exists somewhere in 3D space.
Because:
1. Yes, you do have a geometry somewhere, but where is it exactly?
2. What is its size?
3. Is the geometry truly inside the bounding box defined in blockMeshDict?
4. Is the geometry ever crossed by one of the cell edges of the initial mesh?
5. Did you know that there is a ton of information about how to use snappyHexMesh provided here: https://openfoamwiki.net/index.php/SnappyHexMesh ?
__________________

March 18, 2018, 08:56
#47
Member

Join Date: Oct 2017
Posts: 52
Rep Power: 7
Quote:
 Originally Posted by wyldckat Quick answer: Please follow the instructions given here: How to give enough info to get help Because right now the best me or any one else can do is guess, and my best guess is that snappyHexMesh is as blind as we are regarding the geometry you are telling us that exists somewhere in 3D space. Because: Yes, you do have a geometry somewhere, but where is it exactly? What is its size? Is the geometry truly inside the bounding box defined in blockMeshDict? Is the geometry ever crossed by one of the cell edges of the initial mesh? Did you know that there is a ton of information about how to use snappyHexMesh provided here: https://openfoamwiki.net/index.php/SnappyHexMesh ?
I assume you might help me with this information
• I have tried with unv format for creating bounding box.
• To get familiar with snappyHexMeshI have used the following tutorial https://www.youtube.com/watch?v=n9xYN59v3po
• My geometry lies within the bounding box as i have confirmed it in salome
• it is a cylindrical geometry which has both height and radius of 300 cm
• cylinder.stl indicates the internal solid region and rest are the faces.

Last edited by wyldckat; March 18, 2018 at 14:15. Reason: repaired link

March 18, 2018, 14:19
#48
Retired Super Moderator

Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,969
Blog Entries: 45
Rep Power: 127
Quote:
 Originally Posted by gouravjee I assume you might help me with this informationI have tried with unv format for creating bounding box. To get familiar with snappyHexMeshI have used the following tutorial https://www.youtube.com/watch?v=n9xYN59v3po My geometry lies within the bounding box as i have confirmed it in salome it is a cylindrical geometry which has both height and radius of 300 cm cylinder.stl indicates the internal solid region and rest are the faces.
I should have been more specific... Both me or anyone else, need the following information about the geometry and the initial mesh, in order to try and diagnose the problem:
1. Which are the specific dimensions of the cylindrical geometry and where exactly is it located in 3D space? The specific X, Y, Z coordinates are very important. The units in which you defined the values are also very important.
2. Which are the specific dimensions of the bounding box of the initial mesh? Again, the X, Y, Z values of the 2 extremes of this mesh are important.
3. Which is the number of cell divisions that you have defined along X, Y and Z for the initial mesh?

 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 OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Glc OpenFOAM Meshing & Mesh Conversion 6 October 8, 2021 02:50 [snappyHexMesh] only snap edges of specific region with snappyHexMesh mike.franky OpenFOAM Meshing & Mesh Conversion 0 July 19, 2017 06:56 [snappyHexMesh] snappyHexMesh. irregular cells on snap stage Svensen OpenFOAM Meshing & Mesh Conversion 0 April 3, 2015 03:12 [snappyHexMesh] SnappyHexMesh refine but does not snap malaboss OpenFOAM Meshing & Mesh Conversion 6 December 10, 2014 05:31 [snappyHexMesh] snappyHexMesh failure to snap to geometry Yadasol OpenFOAM Meshing & Mesh Conversion 1 November 17, 2014 05:00

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