|
[Sponsors] |
[snappyHexMesh] Avoiding highly skewed faces and generating a high quality 3D-Mesh |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 3, 2023, 04:13 |
Avoiding highly skewed faces and generating a high quality 3D-Mesh
|
#1 |
Member
Mohd Shaeq
Join Date: Aug 2023
Location: Leinfelden-Echterdingen
Posts: 30
Rep Power: 3 |
Hello respected members of the OpenFOAM community,
I want to investigate the injection characteristics of hydrogen in a hydrogen engine and for that I am have generated a 3D-mesh for the hydrogen engine using the snappyHexMesh utility. Although the generated mesh is okay for the combustion chamber, it is terrible for the parts which are the most important for my simulations, i.e. nozzle, injector fluid chamber and valve needle. I generated the 2D triangular mesh in Salome and used the resulting STL file to generate the 3D hexahedral mesh. I have read several threads regarding skewed faces and also tweaked my snappyHexMeshDict, unfortunately to no avail. I have attached the photos of the generated 2D and 3D meshes for nozzle (Duese) and injector fluid chamber (Injektor Fluidkammer) in this post and for valve needle (Nadel) in the following one. The snappyHexMeshDict is as follows:- 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 true; // Geometry. Definition of all surfaces.surface is of class // searchablecylinder. geometry { Wasserstoffmotor // STL filename { type triSurfaceMesh; file "Wasserstoffmotor.stl"; regions { Ansaugrohr {name Ansaugrohr; } Basalkruemmer {name Basalkruemmer; } Duese {name Duese; } InjektorFluidkammer {name InjektorFluidkammer; } InjektorFluidvolumen {name InjektorFluidvolumen; } Kammervolumen { name Kammervolumen; } Nadel {name Nadel; } } } 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 (2 3) ; regions { Ansaugrohr { level (2 2); patchInfo { type wall; }} Basalkruemmer { level (2 2); patchInfo { type patch; }} Duese { level (5 5); patchInfo { type patch; }} InjektorFluidkammer { level (2 2); patchInfo { type patch; }} InjektorFluidvolumen { level (2 2); patchInfo { type patch; }} Kammervolumen { level (2 2); patchInfo { type wall; }} Nadel { level (5 5); patchInfo { type patch; }} } } } // Resolve sharp angles resolveFeatureAngle 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 { refinementBox { mode inside; levels ((1.0 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.06); // 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" maxNonOrtho 65; maxBoundarySkewness 20; maxInternalSkewness 4; maxConcave 80; minVol 1e-18; minTetQuality 1e-9; minArea -1; minTwist 0.05; minDeterminant 0.001; minFaceWeight 0.05; minVolRatio 0.01; minTriangleTwist -1; // Advanced nSmoothScale 4; errorReduction 0.75; relaxed { maxNonOrtho 75; } // Advanced nSmoothScale 4; errorReduction 0.75; //- 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; // ************************************************************************* // Kind regards, Shaeq |
|
September 3, 2023, 04:19 |
|
#2 |
Member
Mohd Shaeq
Join Date: Aug 2023
Location: Leinfelden-Echterdingen
Posts: 30
Rep Power: 3 |
The screenshots of the generated 2D and 3D meshes for the valve needle (Ventilnadel) are attached herewith.
Last edited by MohdShaeq; September 3, 2023 at 06:42. |
|
September 3, 2023, 14:22 |
checkMesh and snappyHexMesh log files
|
#3 |
Member
Mohd Shaeq
Join Date: Aug 2023
Location: Leinfelden-Echterdingen
Posts: 30
Rep Power: 3 |
Code:
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1912 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : _f3950763fe-20191219 OPENFOAM=1912 Arch : "LSB;label=32;scalar=64" Exec : checkMesh Date : Sep 03 2023 Time : 15:15:47 Host : localhost.localdomain PID : 24512 I/O : uncollated Case : /home/MohdShaeq/Desktop/Wasserstoffmotor-Studie/grobesNetz nProcs : 1 trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10) allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Time = 0 Mesh stats points: 1331 faces: 3300 internal faces: 2700 cells: 1000 faces per cell: 6 boundary patches: 1 point zones: 0 face zones: 0 cell zones: 0 Overall number of cells of each type: hexahedra: 1000 prisms: 0 wedges: 0 pyramids: 0 tet wedges: 0 tetrahedra: 0 polyhedra: 0 Checking topology... Boundary definition OK. Cell to face addressing OK. Point usage OK. Upper triangular ordering OK. Face vertices OK. Number of regions: 1 (OK). Checking patch topology for multiply connected surfaces... Patch Faces Points Surface topology walls 600 602 ok (closed singly connected) Checking faceZone topology for multiply connected surfaces... No faceZones found. Checking basic cellZone addressing... No cellZones found. Checking geometry... Overall domain bounding box (-0.1 -0.1 -0.2) (0.1 0.1 0.1) Mesh has 3 geometric (non-empty/wedge) directions (1 1 1) Mesh has 3 solution (non-empty) directions (1 1 1) Boundary openness (9.48677e-18 -3.72694e-18 1.01644e-18) OK. Max cell openness = 1.21069e-16 OK. Max aspect ratio = 1.5 OK. Minimum face area = 0.0004. Maximum face area = 0.0006. Face area magnitudes OK. Min volume = 1.2e-05. Max volume = 1.2e-05. Total volume = 0.012. Cell volumes OK. Mesh non-orthogonality Max: 0 average: 0 Non-orthogonality check OK. Face pyramids OK. Max skewness = 5.55352e-15 OK. Coupled point location match (average 0) OK. Mesh OK. --> FOAM Warning : From function virtual Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate() in file meshes/polyMesh/polyMeshIO.C at line 215 Number of patches has changed. This may have unexpected consequences. Proceed with care. Time = 2.5e-06 Mesh stats points: 598371 faces: 1384437 internal faces: 1210087 cells: 399274 faces per cell: 6.4981 boundary patches: 8 point zones: 0 face zones: 0 cell zones: 0 Overall number of cells of each type: hexahedra: 323774 prisms: 0 wedges: 0 pyramids: 0 tet wedges: 0 tetrahedra: 0 polyhedra: 75500 Breakdown of polyhedra by number of faces: faces number of cells 6 27643 8 2252 9 29480 10 754 11 1597 12 9609 13 303 14 542 15 2957 16 42 17 74 18 242 20 3 21 1 22 1 Checking topology... Boundary definition OK. Cell to face addressing OK. Point usage OK. Upper triangular ordering OK. Face vertices OK. Number of regions: 1 (OK). Checking patch topology for multiply connected surfaces... Patch Faces Points Surface topology walls 15735 15915 ok (closed singly connected) Ansaugrohr 11739 13844 ok (non-closed singly connected) Basalkruemmer 11628 12818 ok (non-closed singly connected) Duese 883 980 ok (non-closed singly connected) InjektorFluidkammer 1984 2764 ok (non-closed singly connected) InjektorFluidvolumen 192 256 ok (non-closed singly connected) Kammervolumen 131405 145376 multiply connected (shared edge) Nadel 784 810 ok (non-closed singly connected) Checking faceZone topology for multiply connected surfaces... No faceZones found. <<Writing 44 conflicting points to set nonManifoldPoints Checking basic cellZone addressing... No cellZones found. Checking geometry... Overall domain bounding box (-0.1 -0.1 -0.2) (0.1 0.1 0.1) Mesh has 3 geometric (non-empty/wedge) directions (1 1 1) Mesh has 3 solution (non-empty) directions (1 1 1) Boundary openness (4.41082e-16 1.55119e-16 -5.88725e-15) OK. Max cell openness = 2.03288e-16 OK. Max aspect ratio = 1.5008 OK. Minimum face area = 3.90625e-07. Maximum face area = 0.0006. Face area magnitudes OK. Min volume = 3.66016e-10. Max volume = 1.2e-05. Total volume = 0.0119673. Cell volumes OK. Mesh non-orthogonality Max: 31.0121 average: 12.0054 Non-orthogonality check OK. Face pyramids OK. Max skewness = 1.00107 OK. Coupled point location match (average 0) OK. Mesh OK. Time = 5e-06 Mesh stats points: 566222 faces: 1342867 internal faces: 1210087 cells: 399274 faces per cell: 6.39399 boundary patches: 8 point zones: 0 face zones: 0 cell zones: 0 Overall number of cells of each type: hexahedra: 295821 prisms: 12555 wedges: 0 pyramids: 0 tet wedges: 1334 tetrahedra: 0 polyhedra: 89564 Breakdown of polyhedra by number of faces: faces number of cells 4 5242 5 10124 6 26772 7 1850 8 1378 9 28941 10 354 11 1179 12 9722 13 182 14 508 15 2959 16 41 17 66 18 241 20 4 22 1 Checking topology... Boundary definition OK. Cell to face addressing OK. Point usage OK. Upper triangular ordering OK. Face vertices OK. Number of regions: 1 (OK). Checking patch topology for multiply connected surfaces... Patch Faces Points Surface topology walls 15735 15915 ok (closed singly connected) Ansaugrohr 10565 13819 ok (non-closed singly connected) Basalkruemmer 9093 10756 ok (non-closed singly connected) Duese 667 820 ok (non-closed singly connected) InjektorFluidkammer 1554 2607 ok (non-closed singly connected) InjektorFluidvolumen 185 243 ok (non-closed singly connected) Kammervolumen 94347 117298 multiply connected (shared edge) Nadel 634 685 ok (non-closed singly connected) Checking faceZone topology for multiply connected surfaces... No faceZones found. <<Writing 44 conflicting points to set nonManifoldPoints Checking basic cellZone addressing... No cellZones found. Checking geometry... Overall domain bounding box (-0.100007 -0.100072 -0.200014) (0.100009 0.100025 0.1) Mesh has 3 geometric (non-empty/wedge) directions (1 1 1) Mesh has 3 solution (non-empty) directions (1 1 1) Boundary openness (-1.23824e-16 3.34021e-17 -5.3738e-15) OK. Max cell openness = 3.61057e-16 OK. Max aspect ratio = 21.1498 OK. Minimum face area = 1.33193e-09. Maximum face area = 0.000644089. Face area magnitudes OK. Min volume = 9.72437e-12. Max volume = 1.31486e-05. Total volume = 0.011967. Cell volumes OK. Mesh non-orthogonality Max: 64.9997 average: 14.9734 Non-orthogonality check OK. Face pyramids OK. ***Max skewness = 6.08013, 14 highly skew faces detected which may impair the quality of the results <<Writing 14 skew faces to set skewFaces Coupled point location match (average 0) OK. Failed 1 mesh checks. Time = 7.5e-06 Mesh stats points: 558196 faces: 1336636 internal faces: 1210087 cells: 399274 faces per cell: 6.37838 boundary patches: 8 point zones: 0 face zones: 0 cell zones: 0 Overall number of cells of each type: hexahedra: 294164 prisms: 15576 wedges: 0 pyramids: 0 tet wedges: 1962 tetrahedra: 16 polyhedra: 87556 Breakdown of polyhedra by number of faces: faces number of cells 4 5156 5 8370 6 26971 7 2237 8 1510 9 28276 10 972 11 632 12 9636 13 143 14 393 15 2941 16 27 17 52 18 235 19 3 20 1 21 1 Checking topology... Boundary definition OK. Cell to face addressing OK. Point usage OK. Upper triangular ordering OK. Face vertices OK. Number of regions: 1 (OK). Checking patch topology for multiply connected surfaces... Patch Faces Points Surface topology walls 15735 15915 ok (closed singly connected) Ansaugrohr 10248 13256 ok (non-closed singly connected) Basalkruemmer 8860 10402 ok (non-closed singly connected) Duese 625 776 ok (non-closed singly connected) InjektorFluidkammer 1468 2516 ok (non-closed singly connected) InjektorFluidvolumen 179 235 ok (non-closed singly connected) Kammervolumen 88809 110228 multiply connected (shared edge) Nadel 625 674 ok (non-closed singly connected) Checking faceZone topology for multiply connected surfaces... No faceZones found. <<Writing 38 conflicting points to set nonManifoldPoints Checking basic cellZone addressing... No cellZones found. Checking geometry... Overall domain bounding box (-0.100007 -0.100072 -0.200014) (0.100009 0.100025 0.1) Mesh has 3 geometric (non-empty/wedge) directions (1 1 1) Mesh has 3 solution (non-empty) directions (1 1 1) Boundary openness (-1.1779e-16 -2.92112e-17 -5.35009e-15) OK. Max cell openness = 3.61057e-16 OK. Max aspect ratio = 19.7306 OK. Minimum face area = 3.79651e-09. Maximum face area = 0.000644089. Face area magnitudes OK. Min volume = 9.72437e-12. Max volume = 1.31486e-05. Total volume = 0.0119668. Cell volumes OK. Mesh non-orthogonality Max: 64.9997 average: 14.9447 Non-orthogonality check OK. Face pyramids OK. ***Max skewness = 6.08013, 13 highly skew faces detected which may impair the quality of the results <<Writing 13 skew faces to set skewFaces Coupled point location match (average 0) OK. Failed 1 mesh checks. End Last edited by MohdShaeq; September 4, 2023 at 01:38. |
|
September 7, 2023, 15:06 |
|
#4 |
Member
Mohd Shaeq
Join Date: Aug 2023
Location: Leinfelden-Echterdingen
Posts: 30
Rep Power: 3 |
Dear members, kindly help me in alleviating this issue as I am unable to proceed forward. Your valuable suggestions will make it very easy for me to simulate my case successfully.
Best regards, Shaeq |
|
September 10, 2023, 02:51 |
|
#5 | |
Senior Member
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13 |
Quote:
You try to cover details that are one to two magnitudes smaller than the mesh cell size you preset. Increase the level for this region to get a better represenation. That is just to get the geometry right, you might need even more to get the physics correct there because of high gradients. Also we can see, that your STL is already a "rough" representation of the needle's cylindrical shape in some areas. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] No generation of layer onto zerothickness surface | crubio.abujas | OpenFOAM Meshing & Mesh Conversion | 3 | October 25, 2022 04:20 |
[snappyHexMesh] snappyHexMesh does not detect highly skewed faces? | ptpacheco | OpenFOAM Meshing & Mesh Conversion | 1 | January 4, 2022 13:37 |
[blockMesh] Floating Point Exception while generating wedge based mesh | jns-v | OpenFOAM Meshing & Mesh Conversion | 9 | July 8, 2021 06:36 |
[snappyHexMesh] problems generating clean mesh | Christian_tt | OpenFOAM Meshing & Mesh Conversion | 2 | June 20, 2019 06:39 |
GenerateVolumeMesh Error - Surface Wrapper Self Interacting (?) | AndreP | STAR-CCM+ | 10 | August 2, 2018 08:48 |