|
[Sponsors] |
[snappyHexMesh] Doubts regarding the use of snappyHexMesh for multiregion meshing |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 20, 2020, 11:44 |
Doubts regarding the use of snappyHexMesh for multiregion meshing
|
#1 |
Member
Join Date: Feb 2020
Posts: 90
Rep Power: 6 |
Hello to all,
I am trying to create a mesh with snappyHexMesh from OpenFOAM v1912 for a simulation with chtmultiregionfoam. The simulation I intend to do is the heat transfer between an object and the surrounding environment. However I am getting some problems with the mesh generation that I do not know to solve. First, I created the object for my simulation with SolidWorks and exported it as a .stl file. Afterwards, I used the utility surfaceCheck to see if there was any problem with the stl file. The result is reported bellow: Code:
Reading surface from "file.stl" ... Statistics: Triangles : 16792 in 1 region(s) Vertices : 8390 Bounding Box : (6.70036 0.337349 7.66593) (97.3158 107.602 270.705) Region Size ------ ---- file 16792 Surface has no illegal triangles. Triangle quality (equilateral=1, collapsed=0): 0 .. 0.05 : 0.225167 0.05 .. 0.1 : 0.137804 0.1 .. 0.15 : 0.10374 0.15 .. 0.2 : 0.0655669 0.2 .. 0.25 : 0.0671153 0.25 .. 0.3 : 0.0554431 0.3 .. 0.35 : 0.0365055 0.35 .. 0.4 : 0.0316222 0.4 .. 0.45 : 0.0196522 0.45 .. 0.5 : 0.0195927 0.5 .. 0.55 : 0.0262625 0.55 .. 0.6 : 0.0289424 0.6 .. 0.65 : 0.0418652 0.65 .. 0.7 : 0.0244164 0.7 .. 0.75 : 0.0375179 0.75 .. 0.8 : 0.0271558 0.8 .. 0.85 : 0.0176274 0.85 .. 0.9 : 0.0145307 0.9 .. 0.95 : 0.00929014 0.95 .. 1 : 0.0101834 min 5.02094e-08 for triangle 3821 max 0.999814 for triangle 7547 Edges: min 0.00204362 for edge 20194 points (90.4121 69.108 118.394)(90.4122 69.1085 118.392) max 85.2453 for edge 623 points (94.7912 1.70649 179.227)(9.54585 1.70001 179.228) Checking for points less than 1e-6 of bounding box ((90.6154 107.265 263.039) metre) apart. Found 0 nearby points. Surface is closed. All edges connected to two faces. Number of unconnected parts : 1 Number of zones (connected area with consistent normal) : 1 End According to the log, everything is Ok with the .stl file, so I moved on to extracting the surface features with the utility surfaceFeatureExtract according to the following dictionary entries: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1912 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object surfaceFeatureExtractDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // file.stl { extractionMethod extractFromSurface; // Mark edges whose adjacent surface normals are at an angle less // than includedAngle as features // - 0 : selects no edges // - 180: selects all edges includedAngle 120; // Write options writeFeatureEdgeMesh yes; // Write features to obj format for postprocessing writeObj yes; subsetFeatures { // Keep nonManifold edges (edges with >2 connected faces) nonManifoldEdges yes; // Keep open edges (edges with 1 connected face) openEdges yes; } } Following this I defined the blockMeshDict to create a domain able to encompass my part and have enough space to be the "environment" in the CHTmultiregion simulation. Afterwards used the following entries in the snappyHexMeshDict. The mesher was run in parallel with 4 cores. Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1912 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object snappyHexMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Which of the steps to run castellatedMesh true; snap true; addLayers false; //Preserve all generated patches. Default is to remove zero-sized patches (false). //keepPatches no; // 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 { file.stl { type triSurfaceMesh; name file; } /* insert.stl { type triSurfaceMesh; name insert; } */ box // User defined region name { type searchableBox; // region defined by bounding box min (-40 -40 -40); max (134 150 305); } } // 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 2500000; // 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 100000000; // 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 3; // Number of buffer layers between different levels. // 1 means normal 2:1 refinement restriction, larger means slower // refinement. nCellsBetweenLevels 4; maxLoadUnbalance 0.1; // handleSnapProblems true; // interfaceRefine false; // 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 "file.eMesh"; //"file.eMesh"; level 4; } /* { file "insert.eMesh"; //"insert.eMesh"; level 3; }*/ ); // 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 { file { // Surface-wise min and max refinement level level (3 4); // cellZone file; // cellZoneInside inside; } /* insert { // Surface-wise min and max refinement level level (2 3); // cellZone insert; //cellZoneInside inside; } */ } // Resolve sharp angles resolveFeatureAngle 15; planarAngle 30; // 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 { box { mode inside; levels ((0 1)); } /*insert { mode inside; levels ((0 1)); } file { mode distance; levels ( (2.0 3) // within first 1 m refinement level 3 (4.0 2) // within 3.0 m refinement level 2. ); // gapMode mixed; }*/ } // 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. //((50.1234 4.1234 125.1234) file) //((51.69727420806885 84.44279861450195 126.82534122467041) insert) locationsInMesh ( ((50.1234 4.1234 125.1234) file) ((0 16 255) air) ); // 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 false; } // Settings for the snapping. snapControls { //- Number of patch smoothing iterations before finding correspondence // to surface nSmoothPatch 10; // nSmoothInternal 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 2.0; // //- Number of mesh displacement relaxation iterations. nSolveIter 50; // //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 5; //- Highly experimental and wip: number of feature edge snapping // iterations. Leave out altogether to disable. // Of limited use in this case since faceZone faces not handled. nFeatureSnapIter 10;// implicitFeatureSnap false; explicitFeatureSnap true; multiRegionFeatureSnap false; } // Settings for the layer addition. addLayersControls { relativeSizes false; // Per final patch (so not geometry!) the layer information layers { inlet { nSurfaceLayers 0; } outlet { nSurfaceLayers 0; } walls { nSurfaceLayers 0; } "air_.*" { nSurfaceLayers 3; } "file_.*" { nSurfaceLayers 0; } } // Expansion factor for layer mesh expansionRatio 1; // 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; //1 // 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; //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; //0 // Advanced settings // When not to extrude surface. 0 is flat surface, 90 is when two faces // are perpendicular featureAngle 180;//30 slipFeatureAngle 30; // Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 5; // 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; //1 // 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; //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; nRelaxedIter 20; } // Generic mesh quality settings. At any undoable phase these determine // where to undo. meshQualityControls { #include "meshQualityDict" // Advanced //- Number of error distribution iterations nSmoothScale 6; //- Amount to scale back displacement at error points errorReduction 0.5; relaxed { maxNonOrtho 75; } } // Advanced // Merge tolerance. Is fraction of overall bounding box of initial mesh. // Note: the write tolerance needs to be higher than this. mergeTolerance 1e-6; After the mesher was finished, I ran the utility checkMesh to check the validity of the mesh. Here I have some issues I do not know how to revolve. From the checkMesh utility I get the following report: Code:
Checking patch topology for multiply connected surfaces... Patch Faces Points Surface topology inlet 3600 3721 ok (non-closed singly connected) outlet 3600 3721 ok (non-closed singly connected) walls 14400 14640 ok (non-closed singly connected) file 6 12 ok (closed singly connected) file_to_air 0 0 ok (empty) air_to_file 0 0 ok (empty) Checking faceZone topology for multiply connected surfaces... FaceZone Faces Points Surface topology file_to_air 308329 315830 multiply connected (shared edge) <<Writing 220 conflicting points to set nonManifoldPoints Additionally, during the snapping phase of snappyHexMesh I get the following warnings: Code:
1º --> FOAM Warning : Displacement (0.001743875 0.0007534403 0.003355832) at mesh point 19285 coord (34.51458 7.311233 15.83157) points through the surrounding patch faces Smoothing displacement ... 2º --> FOAM Warning : From function void Foam::snappySnapDriver::doSnap(const Foam::dictionary&, const Foam::dictionary&, Foam::meshRefinement::FaceMergeType, Foam::scalar, Foam::scalar, const Foam::snapParameters&) in file snappyHexMeshDriver/snappySnapDriver.C at line 2856 Did not successfully snap mesh. Continuing to snap to resolve easy surfaces but the resulting mesh will not satisfy your quality constraints My questions are: What are these nonManifoldPoints? Why do I have a shared edge? How can I handle this? After/during castellation, snappyHexMesh creates a patch with the name of my file and with a very small amount of faces and points associated with it. Why does it do this, and how can I get rid of it? Can the warnings in the snap phase be solved? I tried changing all the parameters but was not able to get rid of them. I will also leave attached the logs from the operations I carried out. Thanks in advance and sorry for the long post! |
|
May 24, 2020, 14:56 |
|
#2 |
Member
Join Date: Feb 2020
Posts: 90
Rep Power: 6 |
Hello to all,
I was able to pseudo solve the problem: I switched to OpenFOAM7 In the blockMesh I set it to have a cellZone called environment Code:
blocks ( hex (0 1 2 3 4 5 6 7 ) environment (60 60 60) simpleGrading (1 1 1) ); Code:
faceZone file; cellZone file; cellZoneInside insidePoint; insidePoint (50 4 125 ); // point inside the object Code:
locationsInMesh ( ((50.1234 4.1234 125.1234) file) ((0 16 255) air) ); Code:
locationInMesh (0 16 255); // point outside of the file object In the end I got sort of what I wanted, but now I do not know how to set the boundary layers since I lost the file_to_environment patch However, I still do not know how to solve the "multiply connected (shared edge)" and the nonManifoldPoints. I do not know if they are problematic for the simulation If you know how to solve this, please share. Thanks! |
|
September 26, 2020, 16:15 |
Problem in simulating the liquid jet
|
#3 |
New Member
CA
Join Date: Sep 2020
Posts: 2
Rep Power: 0 |
Hi ,
I am getting the similar problem. attached is the stl file. Email: monika.yadav@liverpool.ac.uk |
|
October 4, 2021, 12:48 |
|
#4 |
Member
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10 |
have u guys been able to solve nonManifoldPoints issue?
Does it even affect the simulation results (if the number of such point is a few)? |
|
October 22, 2021, 12:38 |
|
#5 |
Member
JuanMi
Join Date: Nov 2017
Posts: 41
Rep Power: 9 |
Your stl might have non manifold edges. Use surfaceCheck <stlname> and check it
|
|
Tags |
snappyhexmesh |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] Parallel meshing - SnappyHexMesh | Akanksha90 | OpenFOAM Meshing & Mesh Conversion | 3 | March 3, 2022 08:52 |
[snappyHexMesh] Sails Meshing with snappyHexMesh | Paolo.F | OpenFOAM Meshing & Mesh Conversion | 13 | August 14, 2015 03:28 |
[snappyHexMesh] snappyHexMesh meshing two close objects gap | Bollonga | OpenFOAM Meshing & Mesh Conversion | 1 | August 19, 2014 07:37 |
[snappyHexMesh] Problem Meshing a V-notch Weir with snappyHexMesh | kflora | OpenFOAM Meshing & Mesh Conversion | 11 | December 19, 2011 02:58 |
[snappyHexMesh] Meshing a sphere with snappyHexMesh | Cyberholmes | OpenFOAM Meshing & Mesh Conversion | 2 | July 19, 2011 17:46 |