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

[snappyHexMesh] FOAM Warning: Not all entries in refinementSurfaces dictionary were used.

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 2 Post By Yann
  • 1 Post By Yann
  • 1 Post By MohdShaeq

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 28, 2023, 04:30
Default FOAM Warning: Not all entries in refinementSurfaces dictionary were used.
  #1
Member
 
Mohd Shaeq
Join Date: Aug 2023
Location: Leinfelden-Echterdingen
Posts: 30
Rep Power: 3
MohdShaeq is on a distinguished road
Hello respected members of the CFD community,

I want to investigate the injection characteristics of hydrogen in a hydrogen engine and for that I am attempting to generate a 3D-mesh for the hydrogen engine using the snappyHexMesh utility.

However, I am encountering the following two warnings and am therefore unable to generate the required mesh:-

FOAM Warning :
From function Foam::refinementSurfaces::refinementSurfaces(const Foam::searchableSurfaces&, const Foam::dictionary&, Foam::label, bool)
in file refinementSurfaces/refinementSurfaces.C at line 418
Reading "/home/MohdShaeq/Desktop/Wasserstoffmotor-Studie/system/snappyHexMeshDict.castellatedMeshControls.refineme ntSurfaces"
Not all entries in refinementSurfaces dictionary were used. The following entries were not used : 1(Wasserstoffmotor)

FOAM Warning :
From function Foam::shellSurfaces::shellSurfaces(const Foam::searchableSurfaces&, const Foam::dictionary&, bool)
in file shellSurfaces/shellSurfaces.C at line 771
Reading "/home/MohdShaeq/Desktop/Wasserstoffmotor-Studie/system/snappyHexMeshDict.castellatedMeshControls.refineme ntRegions"
Not all entries in refinementRegions dictionary were used. The following entries were not used : 1(refinementBox)

Unfortunately, I am unable to attach the pertinent case files as it shows an error that the files are invalid. Hence, the snappyHexMeshDict is as follows:-

\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

// Geometry. Definition of all surfaces.surface is of class
// searchablecylinder.
geometry
{
Geometrie // STL filename
{
type triSurfaceMesh;
file "Wasserstoffmotor.stl";

regions
{
Kammervolumen {name Kammervolumen; }
InjektorFluidkammer {name InjektorFluidkammer; }
Nadel {name Nadel; }
Duese {name Duese; }
InjektorFluidvolumen {name InjektorFluidvolumen; }
Basalkruemmer {name Basalkruemmer; }
Ansaugrohr { name Ansaugrohr; }
}

refinementBox
{
type searchableBox;
min (-1.0 -0.7 0.0);
max ( 8.0 0.7 2.5);
}

}

/*
cone
{
type searchableCylinder ;
point1 (0.0252573 0 0.0119241) ; // location of the cente at the bottom
point2 (0.0255827 0 0.0128696) ; // location of the center at the top
radius 0.015; // radius of the cylinder
}
*/
}
// Settings for the castellatedMesh generation.
castellatedMeshControls //sub-dictionary of controls for castellated mesh.
{
// Refinement parameters
// ~~~~~~~~~~~~~~~~~~~~~

// If local number of cells is >= maxLocalCells on any processor
// switches from from refinement followed by balancing
// (current method) to (weighted) balancing before refinement.
maxLocalCells 1000000; //100000;

// 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 10000000; //1000000;

// 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; //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.10;

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


// Explicit feature edge refinement
features
(
{
file "Wasserstoffmotor.eMesh";
level 5; //4; //5; //6

}
);


// Surface based refinement
// ~~~~~~~~~~~~~~~~~~~~~~~~

// 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
{
Wasserstoffmotor
{
// Surface - wise min and max refinement level
level (3 3) ;
regions
{
Kammervolumen { level (2 2); patchInfo { type patch; }}
InjektorFluidkammer { level (2 2); patchInfo { type patch; }}
Nadel { level (5 5); patchInfo { type patch; }}
Duese { level (5 5); patchInfo { type patch; }}
InjektorFluidvolumen { level (2 2); patchInfo { type patch; }}
Basalkruemmer { level (2 2); patchInfo { type patch; }}
Ansaugrohr { level (2 2); patchInfo { type patch; }}
}
}
}
// Resolve sharp angles
resolveFeatureAngle 54;

// 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
{
refinementBox
{
mode inside;
level 3;
}
}

// 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.
// NOTE: This point should never be on a face, always inside a cell, even
// after refinement.
locationInMesh (0.01 0.01 0.01); // Inside Point
/*
locationsInMesh
(
((0 0 0) liner)
((0 0 0.01) cylinderHead)
((-0.025 -0.02 0.05) Valve_stem_exh)
((-0.025 0.02 0.05) Valve_stem_exh)
((-0.005 0 0.005) H2_inlet)
);
*/

// Outside Point (external Mesh)(40 40 55) ; // Inside Point //(0 0 0); // Outside Point (external Mesh)

// Whether any faceZones (as specified in the refinementSurfaces)
// are only on the boundary of corresponding cellZones or also allow
// free-standing zone faces. Not used if there are no faceZones.
allowFreeStandingZoneFaces true;
}


// Settings for the snapping.
snapControls
{
nSmoothPatch 3;
tolerance 2.0;
nSolveIter 30;
nRelaxIter 5;
// Feature snapping
nFeatureSnapIter 10;
// - Detect ( geometric only ) features by sampling the surface
// ( default = false ).
implicitFeatureSnap false ;
// - Use castellatedMeshControls :: features ( default = true )
explicitFeatureSnap true ;
// - Detect points on multiple surfaces ( only for explicitFeatureSnap )
multiRegionFeatureSnap true ;
}

addLayersControls
{
// Are the thickness parameters below relative to the undistorted
// size of the refined cell outside layer (true) or absolute sizes (false).
relativeSizes true;

// Per final patch (so not geometry!) the layer information
layers
{
Wasserstoffmotor
{
nSurfaceLayers 3;
}
}

// Expansion factor for layer mesh
expansionRatio 1.0;

// 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.
// See relativeSizes parameter.
finalLayerThickness 0.3;

// 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.1;

// 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.
// Note: changed(corrected) w.r.t 1.7.x! (didn't do anything in 1.7.x)
nGrow 0;

// Advanced settings

// When not to extrude surface. 0 is flat surface, 90 is when two faces
// are perpendicular
featureAngle 60;

// At non-patched sides allow mesh to slip if extrusion direction makes
// angle larger than slipFeatureAngle.
slipFeatureAngle 30;

// Maximum number of snapping relaxation iterations. Should stop
// before upon reaching a correct mesh.
nRelaxIter 3;

// 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
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 1.7.x! 90 degrees corresponds to 130
// in 1.7.x.
minMedialAxisAngle 90;


// 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;
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.

meshQualityControls
{
#include "meshQualityDict"


// Advanced

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

}


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


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


// ************************************************** *********************** //

I have been trying for the past few days to resolve this issue, unfortunately to no avail. I have also read the threads with similar titles, but the solutions proposed there do not work in my case. I am new to OpenFOAM and am using OpenFOAM v1912.

Kindly point out the mistakes I have made or something I have overlooked. I would be highly grateful for your kind help.

Kind regards,
Mohd Shaeq
MohdShaeq is offline   Reply With Quote

Old   August 28, 2023, 05:19
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 Mohd Shaeq,

There are 2 errors in the geometry section of your snappyHexMeshDict:
  1. There is no Wasserstoffmotor name defined
  2. You have a bracket issue: the refinementBox is defined inside the Geometrie, it should be defined outside

Lets fix the brack thing, it should look like this:

Code:
geometry
{
	Geometrie // STL filename
	{
		type triSurfaceMesh;
		file "Wasserstoffmotor.stl";

		regions
		{
			Kammervolumen {name Kammervolumen; }
			InjektorFluidkammer {name InjektorFluidkammer; }
			Nadel {name Nadel; }
			Duese {name Duese; }
			InjektorFluidvolumen {name InjektorFluidvolumen; }
			Basalkruemmer {name Basalkruemmer; }
			Ansaugrohr { name Ansaugrohr; }
		}
	}
	
	refinementBox
	{
		type searchableBox;
		min (-1.0 -0.7 0.0);
		max ( 8.0 0.7 2.5);
	}

}
Now about your names: the entity you are trying to mesh is named "Geometrie" and then you define names for regions inside Geometrie. There is no Wasserstoffmotor name defined anywhere. Sure it is the name of your STL file, but the way you defined it in snappyHexMeshDict, you named it Geometrie.

You should probably define it this way:
Code:
Wasserstoffmotor
{
	type triSurfaceMesh;
	file "Wasserstoffmotor.stl";
}
Please note there are different syntaxes available to do the same thing. For instance you could also write it this way:
Code:
Wasserstoffmotor.stl
{
	type triSurfaceMesh;
	name Wasserstoffmotor;
}
Let us know if it solved you issue,
Yann
AtoHM and MohdShaeq like this.
Yann is offline   Reply With Quote

Old   August 28, 2023, 15:14
Default
  #3
Member
 
Mohd Shaeq
Join Date: Aug 2023
Location: Leinfelden-Echterdingen
Posts: 30
Rep Power: 3
MohdShaeq is on a distinguished road
Hello Yann,

Thank you very much for your swift assistance. I corrected the mistakes as suggested by you and the program ran smoothly right away. However, even then the mesh cannot be generated.

I further encountered the following warnings in snappyHexMesh.log and have been struggling with them for the past few hours:-

--> FOAM Warning : Displacement (1.33043e-06 -2.6956e-05 3.56488e-07) at mesh point 232294 coord (-0.0548044 -0.0704804 -0.1101) points through the surrounding patch faces
Smoothing displacement ...
Iteration 0
Iteration 10
Iteration 20
Displacement smoothed in = 11.6 s

--> FOAM Warning : Displacement (2.39463e-06 -4.85208e-05 6.4164e-07) at mesh point 232294 coord (-0.0548031 -0.0705074 -0.1101) points through the surrounding patch faces
Smoothing displacement ...
Iteration 0
Iteration 10
Iteration 20
Displacement smoothed in = 9.11 s

--> FOAM Warning : Displacement (2.87334e-06 -5.8225e-05 7.6991e-07) at mesh point 232294 coord (-0.0548007 -0.0705559 -0.110099) points through the surrounding patch faces
Smoothing displacement ...
Iteration 0
Iteration 10
Iteration 20
Displacement smoothed in = 9.06 s

--> FOAM Warning : Displacement (2.6815e-06 -5.43434e-05 7.18506e-07) at mesh point 232294 coord (-0.0547978 -0.0706141 -0.110099) points through the surrounding patch faces
Smoothing displacement ...
Iteration 0
Iteration 10
Iteration 20
Displacement smoothed in = 10.08 s

--> FOAM Warning : Displacement (2.01077e-06 -4.07576e-05 5.38784e-07) at mesh point 232294 coord (-0.0547951 -0.0706685 -0.110098) points through the surrounding patch faces
Smoothing displacement ...
Iteration 0
Iteration 10
Iteration 20
Displacement smoothed in = 8.97 s

--> FOAM Warning : Displacement (1.20603e-06 -2.44547e-05 3.23155e-07) at mesh point 232294 coord (-0.0547931 -0.0707092 -0.110097) points through the surrounding patch faces
Smoothing displacement ...
Iteration 0
Iteration 10
Iteration 20
Displacement smoothed in = 8.68 s

--> FOAM Warning : Displacement (2.64361e-05 8.49849e-06 6.98576e-05) at mesh point 429199 coord (0.0296647 0.0396826 -0.0954227) points through the surrounding patch faces
Smoothing displacement ...
Iteration 0
Iteration 10
Iteration 20
Displacement smoothed in = 8.01 s

--> FOAM Warning : Displacement (1.3396e-05 -2.72514e-05 -1.56756e-06) at mesh point 3164 coord (0.0300702 0.0400778 -0.0951579) points through the surrounding patch faces
Smoothing displacement ...
Iteration 0
Iteration 10
Iteration 20
Displacement smoothed in = 8.25 s

--> FOAM Warning : Displacement (1.70666e-05 -2.59993e-05 5.43628e-07) at mesh point 3164 coord (0.0300835 0.0400507 -0.0951595) points through the surrounding patch faces
Smoothing displacement ...
Iteration 0
Iteration 10
Iteration 20
Displacement smoothed in = 9.64 s

--> FOAM Warning : Displacement (1.51027e-06 2.20348e-06 1.25782e-07) at mesh point 429198 coord (0.0299556 0.039284 -0.0958939) points through the surrounding patch faces
Smoothing displacement ...
Iteration 0
Iteration 10
Iteration 20
Displacement smoothed in = 6.93 s

--> FOAM Warning :
From function Foam::labelHashSet Foam polyBoundaryMesh patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 891
Cannot find any patch or group names matching Wasserstoffmotor
--> FOAM Warning :
From function Foam::layerParameters::layerParameters(const Foam::dictionary&, const Foam polyBoundaryMesh&, bool)
in file snappyHexMeshDriver/layerParameters/layerParameters.C at line 284
Reading "/home/MohdShaeq/Desktop/Wasserstoffmotor-Studie/system/snappyHexMeshDict.addLayersControls.layers"
Layer specification for Wasserstoffmotor does not match any patch.
Valid patches are 8(walls Kammervolumen InjektorFluidkammer Nadel Duese InjektorFluidvolumen Basalkruemmer Ansaugrohr)

I understand that I need to define patches in the boundary dictionary under the polyMesh folder, but I do not know how to identify the startFaces for the respective patches. I have thoroughly read the OpenFOAM User Guide, but still am unable to resolve the issue. Could you please help me with this? This would greatly enhance my understanding of patches and overcome a major hurdle.

Lastly, could you also guide me on how to attach the code(s) instead of typing them in the post? It always displays the message that the attached file is invalid.

I look forward to your response.

Thanks and kind regards,
Shaeq

Last edited by MohdShaeq; August 28, 2023 at 23:56.
MohdShaeq is offline   Reply With Quote

Old   August 29, 2023, 04:57
Default
  #4
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 Shaeq,

I would not pay too much attention to the smoothing warning for now.

Quote:
Originally Posted by MohdShaeq View Post
--> FOAM Warning :
From function Foam::labelHashSet Foam polyBoundaryMesh patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 891
Cannot find any patch or group names matching Wasserstoffmotor
--> FOAM Warning :
From function Foam::layerParameters::layerParameters(const Foam::dictionary&, const Foam polyBoundaryMesh&, bool)
in file snappyHexMeshDriver/layerParameters/layerParameters.C at line 284
Reading "/home/MohdShaeq/Desktop/Wasserstoffmotor-Studie/system/snappyHexMeshDict.addLayersControls.layers"
Layer specification for Wasserstoffmotor does not match any patch.
Valid patches are 8(walls Kammervolumen InjektorFluidkammer Nadel Duese InjektorFluidvolumen Basalkruemmer Ansaugrohr)
This part is related to the layer addition phase, and it's again a matter of name definition. However, it shouldn't prevent snappy to generate a mesh. (only the boundary layers cells won't be created).
Generally speaking, It can be interesting to deactivate the addLayers phase in snappy to focus on getting a good snapped mesh. Once you're satisfied with it, you may activate the addLayers phase and proceed further to generate your boundary layer cells.

Quote:
Originally Posted by MohdShaeq View Post
I understand that I need to define patches in the boundary dictionary under the polyMesh folder, but I do not know how to identify the startFaces for the respective patches. I have thoroughly read the OpenFOAM User Guide, but still am unable to resolve the issue. Could you please help me with this? This would greatly enhance my understanding of patches and overcome a major hurdle.
Shaeq
The polyMesh/boundary file is generated by snapppyHexMesh. You don't have to define it yourself, so you don't need to worry about startFaces. The only thing you might want to change is the type of the patch. But you can also define that in snappyHexMeshDict.

If snappy runs without error, you should get a mesh (not necessarily the one you want, but snappy should generate something, unless it crashed or stopped on a fatal error). So first step would be to check the mesh it created, and depending on what you see, modify snappyHexMeshDict accordingly.

Please note snappy does not write the mesh at the same place depending on the command you run:
  • If you run snappyHexMesh without any option, the default behavior is to write each meshing phase in a new timestep directory. So you should end with 3 timestep directories containing: castellated mesh, snapped mesh, snapped mesh with layers
  • If you run snappyHexMesh with the -overwrite option, it will overwrite the constant/polyMesh directory rather than created new time steps directories.
  • If you run snappyHexMesh in parallel, the behavior will be the same except it will write data in processors directories rather than at the root of the case

Regarding your last question:

Quote:
Originally Posted by MohdShaeq View Post
Lastly, could you also guide me on how to attach the code(s) instead of typing them in the post? It always displays the message that the attached file is invalid.
This is due to the file extension: the forum only allow to attach some file types, you can see the list of authorized file types when attaching a file. Just replace ".log" with ".txt" and you should be able to attach the file.
Alternatively, you can use the [CODE] tags in the message editor to post relevant snippets of your files instead of pasting it as plain text, it makes it more easily readable.

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

Old   August 30, 2023, 00:12
Default
  #5
Member
 
Mohd Shaeq
Join Date: Aug 2023
Location: Leinfelden-Echterdingen
Posts: 30
Rep Power: 3
MohdShaeq is on a distinguished road
Hello Yann,

Thank you very much for the detailed answer. You have greatly enhanced my understanding of the snappyHexMesh utility.

The mesh was indeed generated. However, I made a visualisation error, which is why I was unable to see the mesh.

Kind regards,
Shaeq
Yann likes this.
MohdShaeq 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] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 18:22
[Gmsh] Import problem ARC OpenFOAM Meshing & Mesh Conversion 0 February 27, 2010 11:56
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 05:37
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 11:23
Warning 097- AB Siemens 6 November 15, 2004 05:41


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