|
[Sponsors] |
[snappyHexMesh] snappyHexMesh, Multi-Regions & Boundary Layers |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 31, 2012, 09:45 |
snappyHexMesh, Multi-Regions & Boundary Layers
|
#1 |
New Member
ThibaudB
Join Date: Jun 2011
Posts: 5
Rep Power: 15 |
Hello OpenFOAMers,
in a previous thread, I was struggling with sHM and complex geometries, but this time, the case involves a much simpler geometry, in a quite standard configuration. My problem consists in the simulation of heat transfer of a cylinder in a transverse flow. It involves the chtMultiRegionFoam solver, thus needing (in my case) a fluid and solid region. I would like to use layers refinement in the fluid region at the interface between the fluid space and the solid cylinder, but either sHM generates the 2 regions without layers (only the normal leveled refinements) either it only generates the fluid region without solid region, but boundary layers at the wall where the solid region should be. Is it so, that specifying layers in a multi-region sHM case will unfortunately not be possible because of incompatible interfaces between the solid region and the created refined layers? Thanks in advance for any hints/help! Regards, Thibaud |
|
February 1, 2012, 06:28 |
|
#2 |
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21 |
As you observed it is not possible to have layers at fluid-solid interfaces when using standard snappyHexMesh.
|
|
April 19, 2012, 08:16 |
|
#3 |
Member
Join Date: Nov 2009
Location: Germany
Posts: 96
Rep Power: 17 |
Hi Eugene,
you mean there are versions of sHM that can handle layer generation in multi-region cases?
__________________
"When I meet God, I am going to ask him two questions: Why relativity? And why turbulence? I really believe he will have an answer for the first." Werner Heisenberg
|
|
October 1, 2013, 03:28 |
|
#4 |
Senior Member
Robert Castilla
Join Date: Apr 2009
Location: Spain
Posts: 110
Rep Power: 17 |
Hello,
I am facing now the same problem. Is still no possible to add layers in a multiregion mesh? Thanks Robert |
|
October 1, 2013, 17:50 |
|
#5 |
Member
Miro
Join Date: Jan 2013
Location: Europe
Posts: 51
Rep Power: 13 |
Hello everyone,
you should check out propeller tutorial, IIRC mesh there consists of multiple regions with baffles in between. There was a thread about that a few weeks back, i don't know if there was a solution. However, if anyone figures out how to mesh multiple regions with snappy, i very much like to see how it works. I would do it myself, but unfortunately I just don't have the time right now. |
|
October 30, 2013, 06:58 |
|
#6 |
Senior Member
Aram Amouzandeh
Join Date: Mar 2009
Location: Vienna, Vienna, Austria
Posts: 190
Rep Power: 17 |
Dear all,
I modified the utility snappyHexMesh in order to accept the "-region <regionName>" option called snappyHexMeshMR by changing the lines 131 and 136/137 in snappyHexMeshMR.C (see attachment). Its not extensively tested. I just used it for layer insertion (castellatedMesh false; snap false; addLayers true; ) and so far it worked for me. Extract snappyHexMeshMR.gz in $WM_PROJECT_USER_DIR/applications directory and then do wclean and wmake. The utility then works as snappyHexMeshMR -region <regionName> As for the default case, it needs the respective .stl file in constant /<regionName>/triSurface/ as well as the snappyHexMeshDict in system/<regionName>/. Hope you can make use of it. Any feedback is appreciated!! Cheers, Aram |
|
December 9, 2013, 04:06 |
|
#7 |
New Member
Andrzej Prusiński
Join Date: Jul 2011
Posts: 10
Rep Power: 15 |
Hello Aram,
I am looking at your software (snappyHexMeshMR with option region), but it seams that it doesn't work in my case. Starting form the installation of the attached snappyHexMeshMR: I've used commands like you wrote and the files are placed like this: OpenFOAM |-user-2.2.2 --|-run ----|-my_case ------|-Make ------|-constant --------|-region ------ |-system -------- |-region ------ |-1 ------ |-2 ------ |-snappyHexMeshMR.C ------ |-snappyHexMeshMR.dep In folder region (in constant and in system) are files needed by the software when I'm doing first step which I mean doing simply snappyHexMesh for my *.stl file with castelledMesh and snapping everything goes fine. After that I use "snappyHexMeshMR -region region" and it end without doing anything - It seems like the snappyHexMeshMR couldn't find *.stl or eMesh or even previously made mesh (castelledMesh and snappy). Maybe I've made some mistake with unpacking the software or I simply made huge mess in my folder so the software can't find files? Last edited by Prosiaczek; December 9, 2013 at 04:08. Reason: quick reply erase <space> which mades the structure of folder illegible |
|
December 9, 2013, 13:15 |
|
#8 |
Senior Member
Aram Amouzandeh
Join Date: Mar 2009
Location: Vienna, Vienna, Austria
Posts: 190
Rep Power: 17 |
hey!
it looks like you have no snappyHexMeshDict in your system/region/ folder but then I wonder why snappy did not output an error ... what is the output of "snappyHexMeshMR -region region" saying? however, there is no need to put the snappyHexMeshMR.C and snappyHexMeshMR.dep in any of your case folders! cheers, aram |
|
December 10, 2013, 03:14 |
|
#9 |
New Member
Andrzej Prusiński
Join Date: Jul 2011
Posts: 10
Rep Power: 15 |
Hi Aram.
Thank you for fast replay. I do have the snappyHexMeshDict in my region folder inside the system folder with such a configuration: - castelledMesh false - snap false - addLayers true which is exact opposite to the snappyHexMeshDict located in the <my_case>/system. This is an output created after usage of snappyHexMeshMR Code:
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.2.2-9240f8b967db Exec : snappyHexMeshMR -region warstwa Date : Dec 10 2013 Time : 08:09:04 Host : "PC5EJ1" PID : 2738 Case : /home/andrzej/OpenFOAM/andrzej-2.2.2/run/oplyw_bez_styku nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Disallowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh warstwa for time = 0 Read mesh in = 0.03 s Overall mesh bounding box : (-4 -4 -4) (4 4 4) Relative tolerance : 1e-06 Absolute matching distance : 1.38564e-05 Reading refinement surfaces. Read refinement surfaces in = 0.01 s Reading refinement shells. --> FOAM Warning : From function shellSurfaces::shellSurfaces(..) in file autoHexMesh/shellSurfaces/shellSurfaces.C at line 419 Reading "/home/andrzej/OpenFOAM/andrzej-2.2.2/run/oplyw_bez_styku/system/warstwa/snappyHexMeshDict.castellatedMeshControls.refinementRegions" from line 146 to line 147 Not all entries in refinementRegions dictionary were used. The following entries were not used : 2 ( levels mode ) Read refinement shells in = 0 s Setting refinement level of surface to be consistent with shells. Checked shell refinement in = 0 s Reading features. Refinement level according to distance to "test.eMesh" (0 points, 0 edges). level 2 for all cells within 0 meter. Detected 0 featurePoints out of 0 on feature test.eMesh --> FOAM Warning : From function treeBoundBox::treeBoundBox(const UList<point>&) in file meshes/treeBoundBox/treeBoundBox.C at line 136 cannot find bounding box for zero-sized pointField, returning zero Read features in = 0 s Determining initial surface intersections ----------------------------------------- Edge intersection testing: Number of edges : 25200 Number of edges to retest : 25200 Number of intersected edges : 1032 Calculated surface intersections in = 0.03 s Initial mesh : cells:8000 faces:25200 points:9261 Cells per refinement level: 0 8000 Adding patches for surface regions ---------------------------------- Patch Type Region ----- ---- ------ test: 1 wall test_OpenSCAD_Model Added patches in = 0 s Selecting decompositionMethod none Layer thickness specified as final layer and expansion ratio. Shrinking and layer addition phase ---------------------------------- Using mesh parameters { maxNonOrtho 75; maxBoundarySkewness 20; maxInternalSkewness 4; maxConcave 80; minVol 1e-20; minTetQuality 1e-13; minArea -1; minTwist 0.05; minDeterminant 0.001; minFaceWeight 0.005; minVolRatio 0.001; minTriangleTwist -1; nSmoothScale 4; errorReduction 0.75; relaxed { maxNonOrtho 75; } } Merging all faces of a cell --------------------------- - which are on the same patch - which make an angle < 1 degrees (cos:0.999848) - as long as the resulting face doesn't become concave by more than 90 degrees (0=straight, 180=fully concave) Merging 0 sets of faces. No faces merged ... Merging all points on surface that - are used by only two boundary faces and - make an angle with a cosine of more than 0.999848. No straight edges simplified and no points removed ... No layers to generate ... Layer mesh : cells:8000 faces:25200 points:9261 Cells per refinement level: 0 8000 Writing mesh to time 1 Wrote mesh in = 0.01 s. Layers added in = 0.01 s. Finished meshing in = 0.08 s. End Regards Andrzej |
|
December 10, 2013, 11:26 |
|
#10 |
Senior Member
Aram Amouzandeh
Join Date: Mar 2009
Location: Vienna, Vienna, Austria
Posts: 190
Rep Power: 17 |
Hey Andrzej,
yes the tool was modified in order to add layers in a region to a specific patch of the respective region. It is important, that you refer to a none-zero patch which has an entry in the constant/<regionName>/polyMesh/boundary file, not to a patch which is only present in your surfache file (i.e. e.g. a .stl)! You normaly split the mesh with splitMesh into single regions after snappyHexMesh created the face- and cellZone of your desired regions (for an example see the multiRegionHeater tutorial). Then, you can add layers only to the (non-zero) patches which splitMesh creates and writes into the constant/<regionName>/polyMesh/boundary file. I forgot to ask last time: could you also post the dictionary you used with snappyHexMeshMR. Cheers, Aram Last edited by mabinty; December 10, 2013 at 11:44. Reason: wrong path |
|
December 11, 2013, 06:06 |
|
#11 |
New Member
Andrzej Prusiński
Join Date: Jul 2011
Posts: 10
Rep Power: 15 |
Hi Aram,
Thanks to your suggestion I have started to looking for information: how to create a patch without the snappyHexMesh. But from what I found it seems that to create patch before the snappyHexMesh I need to use "createPatchDict" which is rather of a way to create simple patches (not designed for the complex geometry) ;/ My model for the test purpose consist just of the sphere and surroundings (box around mentioned sphere), where I need to apply layers for both Zones. Either way I also tried to do the splitMesh (without having any other patches than those which are created by the snappyHexMesh), so I wrote such a command in terminal: splitMesh test test_OpenSCAD_Model test_OpenSCAD_Model_slave As u can see in attached snappyHexMeshDict test is the name for the stl file, test_OpenSCAD_Model - is a patch where the layer are extruded and the _slave is what snappyHexMesh create when i try to create the faceZona and cellZone. If You could tell me: a) whether my guess about createPatch function is good or not and should I follow this track? b) if I correctly found needed names for the splitMesh? btw. Here I enclose the snappyHexMeshDict which is located inside the region folder designed for my region: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object autoHexMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Which of the steps to run castellatedMesh false; snap false; 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 { /* sphereA { type searchableSphere; centre (0 0 0); radius 3; name sphere; }*/ test.stl { type triSurfaceMesh; name test; } }; // Settings for the castellatedMesh generation. castellatedMeshControls { // 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 3000; // 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 20000; // 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 2; // Number of buffer layers between different levels. // 1 means normal 2:1 refinement restriction, larger means slower // refinement. nCellsBetweenLevels 1; // Explicit feature edge refinement // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies a level for any cell intersected by its edges. // This is a featureEdgeMesh, read from constant/triSurface for now. features ( { file "test.eMesh"; level 2; } ); // 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 { /* sphere { level (1 2); faceZone sphere; cellZone sphere; cellZoneInside outside; }*/ test { level (1 2); /* faceZone test; cellZone test; cellZoneInside inside; */ } } resolveFeatureAngle 1; // 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 { mode inside; levels ((1E15 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. // This is an outside point locationInMesh (-0.033 -0.033 0.0033); locationInMesh (0 0 0); // Inside point // 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 { //- Number of patch smoothing iterations before finding correspondence // to surface nSmoothPatch 18; //- Relative distance for points to be attracted by surface feature point // or edge. True distance is this factor times local // maximum edge length. tolerance 1.0; //- Number of mesh displacement relaxation iterations. nSolveIter 300; //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 20; // Feature snapping //- Number of feature edge snapping iterations. // Leave out altogether to disable. nFeatureSnapIter 20; //- Detect (geometric) features by sampling the surface implicitFeatureSnap false; //- Use castellatedMeshControls::features explicitFeatureSnap true; //- Detect features between multiple surfaces // (only for explicitFeatureSnap, default = false) multiRegionFeatureSnap true; } // Settings for the layer addition. 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 { /* bez_styku_OpenSCAD_Model_slave { nSurfaceLayers 2; } */ test_OpenSCAD_Model { nSurfaceLayers 2; } } // Expansion factor for layer mesh expansionRatio 0.8; // Wanted thickness of final added cell layer. If multiple layers // is the thickness of the layer furthest away from the wall. // See relativeSizes parameter. finalLayerThickness 0.2; // Minimum thickness of cell layer. If for any reason layer // cannot be above minThickness do not add layer. // See relativeSizes parameter. 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. nGrow 1; // Advanced settings // When not to extrude surface. 0 is flat surface, 90 is when two faces // are perpendicular featureAngle 1; // Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals nSmoothSurfaceNormals 3; // 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 minMedianAxisAngle 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; // Max number of iterations after which relaxed meshQuality controls // get used. Up to nRelaxIter it uses the settings in meshQualityControls, // after nRelaxIter it uses the values in meshQualityControls::relaxed. nRelaxedIter 20; } // Generic mesh quality settings. At any undoable phase these determine // where to undo. meshQualityControls { //- Maximum non-orthogonality allowed. Set to 180 to disable. maxNonOrtho 75; //- Max skewness allowed. Set to <0 to disable. maxBoundarySkewness 20; maxInternalSkewness 4; //- Max concaveness allowed. Is angle (in degrees) below which concavity // is allowed. 0 is straight face, <0 would be convex face. // Set to 180 to disable. maxConcave 80; //- Minimum pyramid volume. Is absolute volume of cell pyramid. // Set to a sensible fraction of the smallest cell volume expected. // Set to very negative number (e.g. -1E30) to disable. minVol 1e-20; //- Minimum quality of the tet formed by the face-centre // and variable base point minimum decomposition triangles and // the cell centre. Set to very negative number (e.g. -1E30) to // disable. // <0 = inside out tet, // 0 = flat tet // 1 = regular tet minTetQuality 1e-13; //- Minimum face area. Set to <0 to disable. minArea -1; //- Minimum face twist. Set to <-1 to disable. dot product of face normal //- and face centre triangles normal minTwist 0.05; //- minimum normalised cell determinant //- 1 = hex, <= 0 = folded or flattened illegal cell minDeterminant 0.001; //- minFaceWeight (0 -> 0.5) minFaceWeight 0.005; //- minVolRatio (0 -> 1) minVolRatio 0.001; //must be >0 for Fluent compatibility minTriangleTwist -1; //- if >0 : preserve single cells with all points on the surface if the // resulting volume after snapping (by approximation) is larger than // minVolCollapseRatio times old volume (i.e. not collapsed to flat cell). // If <0 : delete always. //minVolCollapseRatio 0.5; // Advanced //- Number of error distribution iterations nSmoothScale 4; //- amount to scale back displacement at error points errorReduction 0.75; // Optional : some meshing phases allow usage of relaxed rules. // See e.g. addLayersControls::nRelaxedIter. relaxed { //- Maximum non-orthogonality allowed. Set to 180 to disable. maxNonOrtho 75; } } // Advanced // Flags for optional output // 0 : only write final meshes // 1 : write intermediate meshes // 2 : write volScalarField with cellLevel for postprocessing // 4 : write current intersections as .obj files debug 0; // Merge tolerance. Is fraction of overall bounding box of initial mesh. // Note: the write tolerance needs to be higher than this. mergeTolerance 1E-6; // ************************************************************************* // |
|
December 11, 2013, 10:18 |
|
#12 |
Senior Member
Aram Amouzandeh
Join Date: Mar 2009
Location: Vienna, Vienna, Austria
Posts: 190
Rep Power: 17 |
hey,
to your questions: a) a possible idea but might not be necessary b) sorry I was talking about the tool "splitMeshRegions", not "splitMesh" as I wrongly mentioned in my previous post. splitMeshRegions creats two separate regions with seperate meshes from e.g. cellZones and then creates patches at the interface of these regions. So the procedure I d suggest you should follow is: 1.) mesh the two regions (box and sphere) and create faceZones/cellZones for each region with snappyHexMesh (see e.g. the tutorial mesh/snappyHexMesh/snappyMultiRegionHeater/). 2.) create two separate regions with "splitMeshRegions -cellZones" (for additional info see also http://www.cfd-online.com/Forums/ope...tml#post341623). 3.) add layers in your regions with "snappyHexMeshMR -region <regionName>". as you want to add layers at the interface of your box and sphere, look for the name of the interface patch in constant/<regionName>/polyMesh/boundary and use this patch name in your layers dictionary of the snappyHexMeshDict. hope that helps! cheers, aram |
|
December 17, 2013, 07:59 |
|
#13 |
New Member
Andrzej Prusiński
Join Date: Jul 2011
Posts: 10
Rep Power: 15 |
Hi Aram,
It seems that I am lost again and I am not sure where I have made a mistake. I am guessing that at the step with spliMeshRegions I am doing something wrong (I've read linked by you topic concer the usage of "setSet"), but trying to explain what is wrong would be probably way to difficult for both sides ;/ so i'll try to copy here my input, output and set of the commands which i used: 1. Here is my snappyHexMeshDict file: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: 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. 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 { box.stl { type triSurfaceMesh; name box; } kula.stl { type triSurfaceMesh; name kula; } }; // Settings for the castellatedMesh generation. castellatedMeshControls { // 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 30000; // 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 200000; // 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 6; // Number of buffer layers between different levels. // 1 means normal 2:1 refinement restriction, larger means slower // refinement. nCellsBetweenLevels 5; // Explicit feature edge refinement // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies a level for any cell intersected by its edges. // This is a featureEdgeMesh, read from constant/triSurface for now. features ( { file "kula.eMesh"; level 2; } { file "box.eMesh"; level 2; } ); // 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 { kula { level (3 4); faceZone kula; cellZone kula; cellZoneInside inside; } box { level (3 4); faceZone box; cellZone box; cellZoneInside outside; } } resolveFeatureAngle 1; // 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 { //mode inside; //levels ((1E15 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. // This is an outside point locationInMesh (-0.033 -0.033 0.0033); locationInMesh (-3.8 -3.8 -3.8); // Inside point // 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 { //- Number of patch smoothing iterations before finding correspondence // to surface nSmoothPatch 10; //- Relative distance for points to be attracted by surface feature point // or edge. True distance is this factor times local // maximum edge length. tolerance 1.0; //- Number of mesh displacement relaxation iterations. nSolveIter 150; //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 10; // Feature snapping //- Number of feature edge snapping iterations. // Leave out altogether to disable. nFeatureSnapIter 20; //- Detect (geometric) features by sampling the surface implicitFeatureSnap false; //- Use castellatedMeshControls::features explicitFeatureSnap true; //- Detect features between multiple surfaces // (only for explicitFeatureSnap, default = false) multiRegionFeatureSnap true; } // Settings for the layer addition. 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 { allBoundary { nSurfaceLayers 3; } } // Expansion factor for layer mesh expansionRatio 0.8; // Wanted thickness of final added cell layer. If multiple layers // is the thickness of the layer furthest away from the wall. // See relativeSizes parameter. finalLayerThickness 0.2; // Minimum thickness of cell layer. If for any reason layer // cannot be above minThickness do not add layer. // See relativeSizes parameter. 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. nGrow 1; // Advanced settings // When not to extrude surface. 0 is flat surface, 90 is when two faces // are perpendicular featureAngle 25; // Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals nSmoothSurfaceNormals 3; // 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 minMedianAxisAngle 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; // Max number of iterations after which relaxed meshQuality controls // get used. Up to nRelaxIter it uses the settings in meshQualityControls, // after nRelaxIter it uses the values in meshQualityControls::relaxed. nRelaxedIter 20; } // Generic mesh quality settings. At any undoable phase these determine // where to undo. meshQualityControls { //- Maximum non-orthogonality allowed. Set to 180 to disable. maxNonOrtho 75; //- Max skewness allowed. Set to <0 to disable. maxBoundarySkewness 20; maxInternalSkewness 4; //- Max concaveness allowed. Is angle (in degrees) below which concavity // is allowed. 0 is straight face, <0 would be convex face. // Set to 180 to disable. maxConcave 80; //- Minimum pyramid volume. Is absolute volume of cell pyramid. // Set to a sensible fraction of the smallest cell volume expected. // Set to very negative number (e.g. -1E30) to disable. minVol 1e-20; //- Minimum quality of the tet formed by the face-centre // and variable base point minimum decomposition triangles and // the cell centre. Set to very negative number (e.g. -1E30) to // disable. // <0 = inside out tet, // 0 = flat tet // 1 = regular tet minTetQuality 1e-13; //- Minimum face area. Set to <0 to disable. minArea -1; //- Minimum face twist. Set to <-1 to disable. dot product of face normal //- and face centre triangles normal minTwist 0.05; //- minimum normalised cell determinant //- 1 = hex, <= 0 = folded or flattened illegal cell minDeterminant 0.01; //- minFaceWeight (0 -> 0.5) minFaceWeight 0.005; //- minVolRatio (0 -> 1) minVolRatio 0.001; //must be >0 for Fluent compatibility minTriangleTwist -1; //- if >0 : preserve single cells with all points on the surface if the // resulting volume after snapping (by approximation) is larger than // minVolCollapseRatio times old volume (i.e. not collapsed to flat cell). // If <0 : delete always. //minVolCollapseRatio 0.5; // Advanced //- Number of error distribution iterations nSmoothScale 4; //- amount to scale back displacement at error points errorReduction 0.75; // Optional : some meshing phases allow usage of relaxed rules. // See e.g. addLayersControls::nRelaxedIter. relaxed { //- Maximum non-orthogonality allowed. Set to 180 to disable. maxNonOrtho 75; } } // Advanced // Flags for optional output // 0 : only write final meshes // 1 : write intermediate meshes // 2 : write volScalarField with cellLevel for postprocessing // 4 : write current intersections as .obj files debug 0; // Merge tolerance. Is fraction of overall bounding box of initial mesh. // Note: the write tolerance needs to be higher than this. mergeTolerance 1E-6; // ************************************************************************* // 2. To run snappyHexMesh I have made my own "Allrun" file: Code:
#!/bin/sh rm -r constant/extendedFeatureEdgeMesh rm constant/triSurface/*.eMesh rm -r 1 2 3 blockMesh surfaceFeatureExtract decomposePar mpirun -np 3 snappyHexMesh -parallel reconstructParMesh -mergeTol 1e-6 -time 1 reconstructParMesh -mergeTol 1e-6 -time 2 rm -r processor* Code:
cellSet isolation new zoneToCell kula cellSet isolation add zoneToCell box cellSet isolation subset Code:
setSet -batch batch.setSet Code:
*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.2.2-9240f8b967db Exec : setSet -batch batch.setSet Date : Dec 17 2013 Time : 12:20:08 Host : "PC5EJ1" PID : 4313 Case : /home/andrzej/OpenFOAM/andrzej-2.2.2/run/oplyw_bez_styku nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Disallowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create polyMesh for time = 1 Time:1 cells:2459155 faces:7641732 points:2723581 patches:5 bb:(-4.1 -4.1 -4.1) (4.1 4.1 4.1) cellSets: isolation size:2459155 cellZones: box size:1349184 kula size:1109971 faceZones: box size:125323 kula size:132365 Time = 1 mesh not changed. Reading commands from file "batch.setSet" Please type 'help', 'quit' or a set command after prompt. Doing:"cellSet isolation new zoneToCell kula" Set:isolation Size:0 Action:new Adding all cells of cellZone kula ... Found matching zone kula with 1109971 cells. Writing isolation (size 1109971) to "1/polyMesh/sets/isolation" and to vtk file "VTK/isolation/isolation_0.vtk" Doing:"cellSet isolation add zoneToCell box" Set:isolation Size:1109971 Action:add Adding all cells of cellZone box ... Found matching zone box with 1349184 cells. Writing isolation (size 2459155) to "1/polyMesh/sets/isolation" and to vtk file "VTK/isolation/isolation_0.vtk" Doing:"cellSet isolation subset" Set:isolation Size:2459155 Action:subset Writing isolation (size 2459155) to "1/polyMesh/sets/isolation" and to vtk file "VTK/isolation/isolation_0.vtk" End of batch file Time = 2 topology changed; patches unchanged. Time:2 cells:2459155 faces:7641732 points:2723581 patches:5 bb:(-4.1 -4.1 -4.10004) (4.1 4.1 4.10005) Reading commands from file "batch.setSet" Please type 'help', 'quit' or a set command after prompt. Doing:"cellSet isolation new zoneToCell kula" Set:isolation Size:0 Action:new Adding all cells of cellZone kula ... Found matching zone kula with 1109971 cells. Writing isolation (size 1109971) to "2/polyMesh/sets/isolation" and to vtk file "VTK/isolation/isolation_1.vtk" Doing:"cellSet isolation add zoneToCell box" Set:isolation Size:1109971 Action:add Adding all cells of cellZone box ... Found matching zone box with 1349184 cells. Writing isolation (size 2459155) to "2/polyMesh/sets/isolation" and to vtk file "VTK/isolation/isolation_1.vtk" Doing:"cellSet isolation subset" Set:isolation Size:2459155 Action:subset Writing isolation (size 2459155) to "2/polyMesh/sets/isolation" and to vtk file "VTK/isolation/isolation_1.vtk" End of batch file End Code:
subsetMesh -overwrite isolation Code:
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.2.2-9240f8b967db Exec : subsetMesh -overwrite isolation Date : Dec 17 2013 Time : 12:24:45 Host : "PC5EJ1" PID : 4331 Case : /home/andrzej/OpenFOAM/andrzej-2.2.2/run/oplyw_bez_styku nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Disallowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Reading cell set from isolation Adding exposed internal faces to a patch called "oldInternalFaces" (created if necessary) --> FOAM FATAL ERROR: Cannot find directory "polyMesh/sets" in times 0 down to constant From function Time::findInstance(const fileName&, const word&, const IOobject::readOption, const word&) in file db/Time/findInstance.C at line 142. FOAM exiting 5. If I am correct, I should now use the splitMeshRegions software: Code:
splitMeshRegions -cellZones Code:
snappyHexMeshMR -region warstwa a) what cause the error in the 4th steps, or how can I prepare 0 folder? b) Are the 5th and 6th steps correct and will the 6th one be the last, after which I will get the boundary layers inside the cellZones? Best regards Andrzej |
|
December 18, 2013, 05:35 |
|
#14 |
Senior Member
Aram Amouzandeh
Join Date: Mar 2009
Location: Vienna, Vienna, Austria
Posts: 190
Rep Power: 17 |
Hey Andrzej,
the reason why subsetMesh gives an error is that it cannot find the set "isolation" in its default location constant/polyMesh/sets because snappy wrote the mesh info in the two seperate time directories 1/ and 2/. It looks like subsetMesh can only read the needed set from the constant directory, there is not something like a "-time" or "-latestTime" flag (see by typing "subsetMesh -help" in the terminal). In order to get the mesh and the face/cellZones you created with snappy written in the constant directory, use the "-overwrite" flag: Code:
snappyHexMesh -overwrite Code:
setSet -batch batch.setStet After that, when you execute Code:
splitMeshRegions -cellZones -overwrite - constant/kula/polyMesh - constant/box/polyMesh In addition to the surrounding boundary patches, splitMeshRegions will create an interface patch for each region, i.e. in your case "kula_to_box" in constant/kula/polyMesh/boundary and "box_to_kula" in constant/box/polyMesh/boundary. snappyHexMeshMR can only use the non-zero patches present in constant/kula/polyMesh/boundary and constant/box/polyMesh/boundary. Hence, if you e.g. want layer addition in the region "box" at the "box_to_kula" patch, you have to use "box_to_kula" in the layers sub-dictionary of the snappyHexMeshDict (which must be stored in system/box) and execute Code:
snappyHexMeshMR -region box Code:
snappyHexMeshMR -overwrite -region box All the best!! Aram Last edited by mabinty; December 18, 2013 at 05:40. Reason: clarification |
|
February 27, 2015, 08:41 |
|
#15 |
New Member
Andrzej Prusiński
Join Date: Jul 2011
Posts: 10
Rep Power: 15 |
Dear Aram,
I have tried recently to install your upgrade (snappyHexMeshMR), however it seems that it is not compatible with the newest openFOAM 2.3.1 (or I am making some mistake which leads to this error). The error which I get, when I try to install snappyHexMeshMR looks like this: Code:
SOURCE=snappyHexMeshMR.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam231/src/parallel/decompose/decompositionMethods/lnInclude -I/opt/openfoam231/src/mesh/autoMesh/lnInclude -I/opt/openfoam231/src/meshTools/lnInclude -I/opt/openfoam231/src/fileFormats/lnInclude -I/opt/openfoam231/src/triSurface/lnInclude -I/opt/openfoam231/src/dynamicMesh/lnInclude -I/opt/openfoam231/src/edgeMesh/lnInclude -I/opt/openfoam231/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam231/src/OpenFOAM/lnInclude -I/opt/openfoam231/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/snappyHexMeshMR.o snappyHexMeshMR.C: In function ‘void writeMesh(const Foam::string&, const Foam::meshRefinement&, Foam::label)’: snappyHexMeshMR.C:108:44: error: ‘SCALARLEVELS’ is not a member of ‘Foam::meshRefinement’ meshRefiner.write(meshRefinement::MESH|meshRefinement::SCALARLEVELS, ""); ^ snappyHexMeshMR.C:115:9: error: no matching function for call to ‘Foam::meshRefinement::write(Foam::meshRefinement::debugType, Foam::fileName) const’ ); ^ snappyHexMeshMR.C:115:9: note: candidates are: In file included from /opt/openfoam231/src/mesh/autoMesh/lnInclude/autoSnapDriver.H:39:0, from snappyHexMeshMR.C:37: /opt/openfoam231/src/mesh/autoMesh/lnInclude/meshRefinement.H:1097:18: note: bool Foam::meshRefinement::write() const bool write() const; ^ /opt/openfoam231/src/mesh/autoMesh/lnInclude/meshRefinement.H:1097:18: note: candidate expects 0 arguments, 2 provided /opt/openfoam231/src/mesh/autoMesh/lnInclude/meshRefinement.H:1106:18: note: void Foam::meshRefinement::write(Foam::meshRefinement::debugType, Foam::meshRefinement::writeType, const Foam::fileName&) const void write ^ /opt/openfoam231/src/mesh/autoMesh/lnInclude/meshRefinement.H:1106:18: note: candidate expects 3 arguments, 2 provided snappyHexMeshMR.C: In function ‘int main(int, char**)’: snappyHexMeshMR.C:241:5: error: no matching function for call to ‘Foam::searchableSurfaces::searchableSurfaces(Foam::IOobject, const Foam::dictionary&)’ ); ^ snappyHexMeshMR.C:241:5: note: candidates are: In file included from snappyHexMeshMR.C:39:0: /opt/openfoam231/src/meshTools/lnInclude/searchableSurfaces.H:108:9: note: Foam::searchableSurfaces::searchableSurfaces(const Foam::IOobject&, const Foam::dictionary&, bool) searchableSurfaces ^ /opt/openfoam231/src/meshTools/lnInclude/searchableSurfaces.H:108:9: note: candidate expects 3 arguments, 2 provided /opt/openfoam231/src/meshTools/lnInclude/searchableSurfaces.H:98:18: note: Foam::searchableSurfaces::searchableSurfaces(Foam::label) explicit searchableSurfaces(const label); ^ /opt/openfoam231/src/meshTools/lnInclude/searchableSurfaces.H:98:18: note: candidate expects 1 argument, 2 provided /opt/openfoam231/src/meshTools/lnInclude/searchableSurfaces.H:85:9: note: Foam::searchableSurfaces::searchableSurfaces(const Foam::searchableSurfaces&) searchableSurfaces(const searchableSurfaces&); ^ /opt/openfoam231/src/meshTools/lnInclude/searchableSurfaces.H:85:9: note: candidate expects 1 argument, 2 provided snappyHexMeshMR.C:252:5: error: no matching function for call to ‘Foam::refinementSurfaces::refinementSurfaces(Foam::searchableSurfaces&, const Foam::dictionary&)’ ); ^ snappyHexMeshMR.C:252:5: note: candidates are: In file included from snappyHexMeshMR.C:40:0: /opt/openfoam231/src/mesh/autoMesh/lnInclude/refinementSurfaces.H:118:9: note: Foam::refinementSurfaces::refinementSurfaces(const Foam::searchableSurfaces&, const labelList&, const wordList&, const Foam::PtrList<Foam::surfaceZonesInfo>&, const labelList&, const labelList&, const labelList&, const labelList&, const scalarField&, Foam::PtrList<Foam::dictionary>&) refinementSurfaces ^ /opt/openfoam231/src/mesh/autoMesh/lnInclude/refinementSurfaces.H:118:9: note: candidate expects 10 arguments, 2 provided /opt/openfoam231/src/mesh/autoMesh/lnInclude/refinementSurfaces.H:110:9: note: Foam::refinementSurfaces::refinementSurfaces(const Foam::searchableSurfaces&, const Foam::dictionary&, Foam::label) refinementSurfaces ^ /opt/openfoam231/src/mesh/autoMesh/lnInclude/refinementSurfaces.H:110:9: note: candidate expects 3 arguments, 2 provided /opt/openfoam231/src/mesh/autoMesh/lnInclude/refinementSurfaces.H:99:9: note: Foam::refinementSurfaces::refinementSurfaces(const Foam::refinementSurfaces&) refinementSurfaces(const refinementSurfaces&); ^ /opt/openfoam231/src/mesh/autoMesh/lnInclude/refinementSurfaces.H:99:9: note: candidate expects 1 argument, 2 provided snappyHexMeshMR.C:369:5: error: no matching function for call to ‘Foam::meshRefinement::write(Foam::label, Foam::fileName)’ ); ^ snappyHexMeshMR.C:369:5: note: candidates are: In file included from /opt/openfoam231/src/mesh/autoMesh/lnInclude/autoSnapDriver.H:39:0, from snappyHexMeshMR.C:37: /opt/openfoam231/src/mesh/autoMesh/lnInclude/meshRefinement.H:1097:18: note: bool Foam::meshRefinement::write() const bool write() const; ^ /opt/openfoam231/src/mesh/autoMesh/lnInclude/meshRefinement.H:1097:18: note: candidate expects 0 arguments, 2 provided /opt/openfoam231/src/mesh/autoMesh/lnInclude/meshRefinement.H:1106:18: note: void Foam::meshRefinement::write(Foam::meshRefinement::debugType, Foam::meshRefinement::writeType, const Foam::fileName&) const void write ^ /opt/openfoam231/src/mesh/autoMesh/lnInclude/meshRefinement.H:1106:18: note: candidate expects 3 arguments, 2 provided snappyHexMeshMR.C:404:26: error: ‘class Foam::refinementSurfaces’ has no member named ‘faceZoneNames’ if (surfaces.faceZoneNames()[surfI].empty()) ^ snappyHexMeshMR.C:576:77: error: no matching function for call to ‘Foam::autoRefineDriver::doRefine(const Foam::dictionary&, Foam::refinementParameters&, const Foam::Switch&, const Foam::dictionary&)’ refineDriver.doRefine(refineDict, refineParams, wantSnap, motionDict); ^ snappyHexMeshMR.C:576:77: note: candidate is: In file included from snappyHexMeshMR.C:36:0: /opt/openfoam231/src/mesh/autoMesh/lnInclude/autoRefineDriver.H:179:14: note: void Foam::autoRefineDriver::doRefine(const Foam::dictionary&, const Foam::refinementParameters&, const Foam::snapParameters&, bool, const Foam::dictionary&) void doRefine ^ /opt/openfoam231/src/mesh/autoMesh/lnInclude/autoRefineDriver.H:179:14: note: candidate expects 5 arguments, 4 provided snappyHexMeshMR.C:614:70: error: no matching function for call to ‘Foam::autoSnapDriver::doSnap(const Foam::dictionary&, const Foam::dictionary&, Foam::scalar&, Foam::snapParameters&)’ snapDriver.doSnap(snapDict, motionDict, curvature, snapParams); ^ snappyHexMeshMR.C:614:70: note: candidate is: In file included from snappyHexMeshMR.C:37:0: /opt/openfoam231/src/mesh/autoMesh/lnInclude/autoSnapDriver.H:621:18: note: void Foam::autoSnapDriver::doSnap(const Foam::dictionary&, const Foam::dictionary&, Foam::scalar, Foam::scalar, const Foam::snapParameters&) void doSnap ^ /opt/openfoam231/src/mesh/autoMesh/lnInclude/autoSnapDriver.H:621:18: note: candidate expects 5 arguments, 4 provided make: *** [Make/linux64GccDPOpt/snappyHexMeshMR.o] Błąd 1 Regards Andrzej |
|
May 18, 2015, 16:06 |
|
#16 |
Senior Member
Aram Amouzandeh
Join Date: Mar 2009
Location: Vienna, Vienna, Austria
Posts: 190
Rep Power: 17 |
Hey Andrze,
please excuse me for my late response! I did not study the error message in detail but it could be a problem with the version. However, for the case you are using OF 2.3.1 it might be better to use sHM of the same version. In my post from October 30, 2013 I discribed which lines I canged in the code (see the tar.gz files). Hence, copy (in OF 2.3.1 or any other version) the code of sHM into $WM_PROJECT_USER_DIR/applications and change the appropriate lines in the .C file. Compile it with wmake and that's it! Hope I could still help you. All the best, Aram |
|
Tags |
boundary layer, multi regions, snappyhexmesh |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wind turbine simulation | Saturn | CFX | 60 | July 17, 2024 06:45 |
y+ = 1 boundary layer mesh with snappyHexMesh | Arzed23 | OpenFOAM Running, Solving & CFD | 6 | November 23, 2022 16:15 |
[snappyHexMesh] Error defining boundary layer around cube snappyHexMesh | crizpi21 | OpenFOAM Meshing & Mesh Conversion | 5 | October 16, 2021 11:56 |
[snappyHexMesh] Could not Add Boundary Layers near a Rectangular Channel Wall using SnappyHexMesh | Gary | OpenFOAM Meshing & Mesh Conversion | 3 | July 30, 2018 05:14 |
[snappyHexMesh] no boundary layers using snappyHexMesh | thorsten | OpenFOAM Meshing & Mesh Conversion | 1 | October 22, 2009 07:01 |