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

[snappyHexMesh] Trouble in meshing with SHM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 29, 2022, 11:16
Default Trouble in meshing with SHM
  #1
New Member
 
Join Date: Nov 2022
Posts: 9
Rep Power: 4
TheGenius is on a distinguished road
Hi to everyone,
I've generated a mesh of a racing car with snappyHexMesh. However, on the body I can see that I have randon regions in which SHM has refined more than in all other parts as shown in picture. Does anybody know why this is happening?

https://ibb.co/f81DQ5v[/IMG]
TheGenius is offline   Reply With Quote

Old   December 4, 2022, 11:59
Default
  #2
Member
 
Join Date: Feb 2020
Posts: 79
Rep Power: 6
Fouch is on a distinguished road
Quote:
Originally Posted by TheGenius View Post
Hi to everyone,
I've generated a mesh of a racing car with snappyHexMesh. However, on the body I can see that I have randon regions in which SHM has refined more than in all other parts as shown in picture. Does anybody know why this is happening?

https://ibb.co/f81DQ5v[/IMG]
Hi,

Could you share your snappyhexmeshdict ?

BR
Fouch is offline   Reply With Quote

Old   December 4, 2022, 12:28
Default
  #3
New Member
 
Join Date: Nov 2022
Posts: 9
Rep Power: 4
TheGenius is on a distinguished road
I'm sending it below.

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 6 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

castellatedMesh true;
snap true;
addLayers true;

// Geometry. Definition of all surfaces. All surfaces are of class searchableSurface.
// Surfaces are used
// - to specify refinement for any mesh cell intersecting it
// - to specify refinement for any mesh cell inside/outside/near
// - to 'snap' the mesh boundary to the surface
geometry
{
body.stl
{
type triSurfaceMesh;
name body;
}

frontWheel.stl
{
type triSurfaceMesh;
name frontWheel;
}

rearWheel.stl
{
type triSurfaceMesh;
name rearWheel;
}


};

// Settings for the castellatedMesh generation.
castellatedMeshControls
{

// If local number of cells is >= maxLocalCells on any processor
// switches from from refinement followed by balancing
// (current method) to (weighted) balancing before refinement.
// This is basically the number of cells that fit on a processor. If you choose this too small
// it will do just more refinement iterations to obtain a similar mesh.
maxLocalCells 99999999;

// Overall cell limit (approximately). Refinement will stop immediately
// upon reaching this number so a refinement level might not complete.
// Note that this is the number of cells before removing the part which
// is not 'visible' from the keepPoint. The final number of cells might
// actually be a lot less.
maxGlobalCells 99999999;

// The surface refinement loop might spend lots of iterations refining just a
// few cells. This setting will cause refinement to stop if <= minimumRefine
// are selected for refinement. Note: it will at least do one iteration
// (unless the number of cells to refine is 0)
minRefinementCells 10;

// Allow a certain level of imbalance during refining
// (since balancing is quite expensive)
// Expressed as fraction of perfect balance (= overall number of cells /
// nProcs). 0=balance always.
maxLoadUnbalance 0.1;

// Number of buffer layers between different levels.
// 1 means normal 2:1 refinement restriction, larger means slower
// refinement.
nCellsBetweenLevels 6;

// Specifies a level for any cell intersected by its edges.
// This is a featureEdgeMesh, read from constant/triSurface for now.
features
(
{
file "body.eMesh";
level 8;
}
{
file "frontWheel.eMesh";
level 8;
}
{
file "rearWheel.eMesh";
level 8;
}


);

// Specifies two levels for every surface. The first is the minimum level,
// every cell intersecting a surface gets refined up to the minimum level.
// The second level is the maximum level. Cells that 'see' multiple
// intersections where the intersections make an
// angle > resolveFeatureAngle get refined up to the maximum level.
refinementSurfaces
{
body
{
level (6 6);
}
frontWheel
{
level (6 6);
}
rearWheel
{
level (6 6);
}
}

// Resolve sharp angles
// Applies maximum level of refinement to cells that can see intersections whose
// angle exceeds this
resolveFeatureAngle 10;

planarAngle 10;
gapLevelIncrement 2;

// Region-wise refinement
// Specifies refinement level for cells in relation to a surface. One of
// three modes:
// - distance. 'levels' specifies per distance to the surface the
// wanted refinement level. The distances need to be specified in
// descending order.
// - inside. 'levels' is only one entry and only the level is used. All
// cells inside the surface get refined up to the level. The surface
// needs to be closed for this to be possible.
// - outside. Same but cells outside.
refinementRegions
{

}

// Mesh selection. After refinement patches get added for all refinementSurfaces and
// all cells intersecting the surfaces get put into these patches. The
// section reachable from the locationInMesh is kept.
// This point should never be on a face, always inside a cell, even
// after refinement.
locationInMesh (0 -1 10);

allowFreeStandingZoneFaces true;
}

// Settings for the snapping.
snapControls
{
// Number of patch smoothing iterations before finding correspondence
// to surface. This option changes how many times the exterior (the boundary
// wall) should be iterated. The more iterations, the smoother the mesh
// will become.
nSmoothPatch 3;

// Relative distance for points to be attracted by surface feature point
// or edge. True distance is this factor times local maximum edge length.
// This option changes how long distance the program should look for a point
// to snap, the distance is the number put in "tolerance"*"size of the mesh".
tolerance 2.0;

// Number of mesh displacement relaxation iterations. This option changes
// how many times the "snapping" part of snappyHexMesh should be run:
// - the higher this number is the better mesh quality will be gained
// - the higher this number is the more equidistant mesh will be created
// when it comes to the boundary
// - the higher this number is the longer tha snapping will take
nSolveIter 30;

// Maximum number of snapping relaxation iterations. Should stop
// before upon reaching a correct mesh. This option changes how many times
// the mesh will run a relaxing script that removes some bad mesh point,
// however snappyHexMesh should stop before, when the correct mesh is created
nRelaxIter 5;

// Number of feature edge snapping iterations.
// Leave out altogether to disable. Do not use here since mesh resolution
// too low and baffles present. Controls the number of morph iterations
// within main snapping iterative process, to attract mesh points to
// surface and avoid sharp edges problems.
nFeatureSnapIter 15;

// True of false to enable implicit or explcit method for feature snap
// process. Implicit uses geometric only features by sampling the surface,
// while explcit uses castellatedMeshControls.
implicitFeatureSnap false;
explicitFeatureSnap true;

// True of false to enable the detection of the points on multiple surfaces
// (only for explicitFeatureSnap)
multiRegionFeatureSnap false;
}

// Settings for the layer addition.
addLayersControls
{

// True of false to changes the way to read the parameters given next.
// - true: next parameters define the layers' dimensions as
// "parameters" * "undistorted cell size outside layers"
// - false: next parameters define directly the layers' dimensions (absolute)
relativeSizes true;

// Layer thickness specification, can be specified in one of following ways:
// - expansionRatio and finalLayerThickness or firstLayerThickness.
// Where expansionRatio set the grow factor of the layers (ratio between two
// subsequent layers), while finalLayerThickness set the thickness of the last
// layer. Wanted thickness of final added cell layer. If multiple layers
// is the thickness of the layer furthest away from the wall.
// Relative to undistorted size of cell outside layer.
// - overall thickness and firstLayerThickness
// - overall thickness and finalLayerThickness
// - overall thickness and expansionRatio
expansionRatio 1.5;
finalLayerThickness 0.4;

// Minimum thickness of cell layer. If for any reason layer
// cannot be above minThickness do not add layer.
// Relative to undistorted size of cell outside layer.
minThickness 0.005;

// Per final patch (so not geometry!) the layer information
layers
{
body
{
nSurfaceLayers 5;
}
frontWheel
{
nSurfaceLayers 5;
}
rearWheel
{
nSurfaceLayers 5;
}
}

// If points get not extruded do nGrow layers of connected faces that are
// also not grown. This helps convergence of the layer addition process
// close to features.
nGrow 0;

// Angle above which surface is not extruded. One of the first parameters on
// which play when layer addition fails. 0 is flat surface,
// 90 is when two faces make straight angle.
featureAngle 330;

// Maximum number of snapping relaxation iterations. Should stop
// before upon reaching a correct mesh. This option changes how many times
// the mesh will run a relaxing script.
nRelaxIter 10;

// Number of smoothing iterations of surface normals
nSmoothSurfaceNormals 1;

// Number of smoothing iterations of interior mesh movement direction
nSmoothNormals 3;

// Smooth layer thickness over surface patches
nSmoothThickness 10;

// Stop layer growth on highly warped cells.
// This option changes the maximum allowable value of aspect ratio.
// Sometimes (expecially in corners) the layers must be generated over highly
// warped cells.
maxFaceThicknessRatio 0.5;

// Reduce layer growth where ratio thickness to medial
// distance is large
maxThicknessToMedialRatio 0.3;

// Angle used to pick up medial axis points
// Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
minMedialAxisAngle 130;

// Create buffer region for new layer terminations
nBufferCellsNoExtrude 0;

// Overall max number of layer addition iterations. The mesher will exit
// if it reaches this number of iterations; possibly with an illegal
// mesh.
nLayerIter 50;

// Number of smoothing iterations of interior mesh movement direction
nSmoothNormals 10;

slipFeatureAngle 30;

nRelaxedIter 20;

additionalReporting true;
}

// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
#include "meshQualityDict"
nSmoothScale 4;
relaxed
{
}
errorReduction 0.75;
}

debugFlags
(
);

writeFlags
(
// write volScalarField with cellLevel for postprocessing
scalarLevels

// write cellSets, faceSets of faces in layer
layerSets

// write volScalarField for layer coverage
layerFields
);

// Merge tolerance. Is fraction of overall bounding box of initial mesh. The
// write tolerance needs to be higher than this.
mergeTolerance 1e-6;

// ************************************************** *********************** //
TheGenius is offline   Reply With Quote

Old   December 4, 2022, 15:37
Default
  #4
Member
 
Join Date: Feb 2020
Posts: 79
Rep Power: 6
Fouch is on a distinguished road
I think you have to play with "resolveFeatureAngle 10;". Try to increase the value to 20 and post the result.


BR
Fouch is offline   Reply With Quote

Old   December 5, 2022, 02:37
Default
  #5
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
Please check the recommendations here: Partial coarse mesh


Especially look for your cell count and if it reaches the max. You define alot of high levels so you probably run into the max count.
AtoHM is offline   Reply With Quote

Old   December 5, 2022, 05:04
Default
  #6
New Member
 
Join Date: Nov 2022
Posts: 9
Rep Power: 4
TheGenius is on a distinguished road
Reply to Fouch:
I thought that in this case the ResolveFeatureAngle is irrelevant as I'm using the same values for max and min refinement level.

Reply to AtyoHM:
I'm pretty sure I'm not reaching the Max Cells number imposed in the dictionary. I'm actually obtaining around 20 Milions of cells and maximum is set to 99.999 Millions.
TheGenius is offline   Reply With Quote

Old   December 5, 2022, 05:21
Default
  #7
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
Add a log of the run and pictures would help. Attach them directly to the forum, I don't click on random links.
AtoHM is offline   Reply With Quote

Old   December 5, 2022, 05:34
Default
  #8
New Member
 
Join Date: Nov 2022
Posts: 9
Rep Power: 4
TheGenius is on a distinguished road
Here it is.
Tell me which part of the log file you want as it's too large to be uploaded.
Attached Images
File Type: jpg Screenshot (131).jpg (172.8 KB, 27 views)
TheGenius is offline   Reply With Quote

Old   December 5, 2022, 05:56
Default
  #9
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
The refinement phase including the end of it.
AtoHM is offline   Reply With Quote

Old   December 5, 2022, 06:15
Default
  #10
New Member
 
Join Date: Nov 2022
Posts: 9
Rep Power: 4
TheGenius is on a distinguished road
Here are the first 5 parts.
Attached Files
File Type: txt log1.txt (113.1 KB, 4 views)
File Type: txt log2.txt (160.7 KB, 1 views)
File Type: txt log3.txt (192.5 KB, 1 views)
File Type: txt log4.txt (193.0 KB, 1 views)
File Type: txt log5.txt (193.1 KB, 0 views)
TheGenius is offline   Reply With Quote

Old   December 5, 2022, 06:16
Default
  #11
New Member
 
Join Date: Nov 2022
Posts: 9
Rep Power: 4
TheGenius is on a distinguished road
And here the last two parts
Attached Files
File Type: txt log6.txt (193.3 KB, 1 views)
File Type: txt log7.txt (177.9 KB, 3 views)
TheGenius 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
[Other] Good learning materials for robust meshing techniques in 2021 FoxInCFD ANSYS Meshing & Geometry 0 November 19, 2021 06:52
[GAMBIT] Trouble with meshing Chevron Nozzle piyushvjn ANSYS Meshing & Geometry 0 May 26, 2014 16:14
[snappyHexMesh] Multi Region Meshing with sHM marango OpenFOAM Meshing & Mesh Conversion 3 March 27, 2012 01:51
[GAMBIT] Trouble meshing complex VOF geometry RPJones ANSYS Meshing & Geometry 2 February 14, 2011 19:54
Trouble with meshing in Pro-am NALLELI Siemens 1 July 13, 2005 04:41


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