|
[Sponsors] |
November 22, 2022, 03:02 |
Partial coarse mesh
|
#1 |
New Member
Marius
Join Date: Sep 2022
Posts: 27
Rep Power: 4 |
Hi,
I tried to mesh a car with snappyHexMesh and at the first look it came out quite well. But as I checked some parts of it I found that they are super coarse and I don't know why. Additionally I found that the bottom of the tyres are not closed? I put them exactly on z 0.0. What could cause this? Would addLayers solve it? Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v2206 | | \\ / 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; // 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 { clio3rs.stl { type triSurfaceMesh; name clio3rs; } refinementBox { type box; min (-0.8027 -0.8881 0.0); max (3.1784 0.8883 1.465); } } // 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 10000000; // 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; // 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 0; // 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 3; // 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 "clio3rs.eMesh"; level 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 { clio3rs { // Surface-wise min and max refinement level level (4 6); } } // 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 ((1E15 6)); //} } // 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 (-1.95 1.45 0.01); // 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 8; //- 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 80; //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 8; // Feature snapping //- Number of feature edge snapping iterations. // Leave out altogether to disable. nFeatureSnapIter 20; //- 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 false; } // 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 { clio3rs { 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 130; // 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 8; // 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 60; } // 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; } // Advanced // 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; // ************************************************************************* // Best, Marius |
|
November 24, 2022, 03:59 |
|
#2 |
Senior Member
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13 |
I see nothing unusual, so just some thoughts:
1) try minRefinementCells > 0 (1?) 2) try surfaceRefinement with min and max level 5 6 or 4 5 and not two levels apart 3) do you reach 10M cells in the process? Then increase maxGlobalCells. Regarding the wheel: Does the blockMesh really cover the geometry completely? |
|
November 24, 2022, 11:22 |
|
#3 |
New Member
Marius
Join Date: Sep 2022
Posts: 27
Rep Power: 4 |
Thanks for the help.
I just increased minRefinementCells to 10 and also adjusted surfaceRefinement to 5 6. Regarding 3) I reach 10M cells, yes. But as soon as I increase the value for maxGlobalCells snappyHexMesh just crashes and closes the terminal window. I have no idea why. I started with 8 cores in parallel meshing and reduced it to 4, but no luck. Setup is: Ryzen 7 3800X - 8 physical cores at 4.7 GHz 32 GB DDR4 3200 RAM I can see that the RAM hits the 32 GB while meshing and uses the swap partition. Oh and regarding the blockMesh. The car is at Z 0.0 and the blockMesh also ends at Z 0.0. I just set Z to -1.0E-4 Last edited by Counterdoc; November 24, 2022 at 13:28. |
|
November 24, 2022, 13:52 |
|
#4 |
Senior Member
Niels Nielsen
Join Date: Mar 2009
Location: NJ - Denmark
Posts: 556
Rep Power: 27 |
You could scale the mesh/geometry to mm so that snappy has larger numbers to work with.
Precission is better when 1 is 1.0 and not 0.001 It does not always help, but I've found it genereally performs a bit better. Sometimes I wonder if Snappy were to be faster if everything internally was integers. just scale the mesh geometry so 1mm is 1000 then precission could still be ok when converting to m again.
__________________
Linnemann PS. I do not do personal support, so please post in the forums. |
|
November 25, 2022, 03:02 |
|
#5 |
Senior Member
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13 |
Ok, so the cell cap is most likely the reason you have these big cells, once snappy hits the cap, it just stops refinement.
Regarding blockMesh: indeed, I always provide a slightly bigger blockMesh than the bounding box of the stl to avoid such effects. So, this should be fixed now as well? But it appears to be a memory issue now and I don't know how to resolve that other than getting more resources. Interesting remarks from linnemann, will there be an influence on the memory there? |
|
November 25, 2022, 03:30 |
|
#6 |
New Member
Marius
Join Date: Sep 2022
Posts: 27
Rep Power: 4 |
Currently snappyHexMesh is running with 40M cells and it still reaches that limit. But I guess that is normal for a whole car that should have a fine mesh. I have seen a bachelor thesis from an Audi student with a 70M cells mesh.
Regarding memory I think I will upgrade the RAM to 64 GB. For more I would have to build a new PC or switch the whole calculations to a server with big resources. |
|
November 25, 2022, 07:31 |
|
#7 |
Senior Member
Niels Nielsen
Join Date: Mar 2009
Location: NJ - Denmark
Posts: 556
Rep Power: 27 |
Rule of thumb, 1GB of memory per 1mil cells.
__________________
Linnemann PS. I do not do personal support, so please post in the forums. |
|
November 25, 2022, 07:38 |
|
#8 |
New Member
Marius
Join Date: Sep 2022
Posts: 27
Rep Power: 4 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
foam-extend-4.1 release | hjasak | OpenFOAM Announcements from Other Sources | 19 | July 16, 2021 06:02 |
[snappyHexMesh] non uniform mesh near the stl object | vava10 | OpenFOAM Meshing & Mesh Conversion | 0 | January 31, 2021 15:41 |
Can I just use a coarse mesh as my final mesh size? | cfdnewb123 | Main CFD Forum | 8 | January 17, 2021 06:11 |
Grid transformation to computational space | mech_eng_gr | Main CFD Forum | 1 | May 31, 2020 22:17 |
Gambit problems | Althea | FLUENT | 22 | January 4, 2017 04:19 |