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

[snappyHexMesh] SnappyHexMesh for big complex city STL

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By Alczem
  • 1 Post By Yann
  • 1 Post By AtoHM
  • 1 Post By Yann
  • 1 Post By arezayan87

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 21, 2024, 17:24
Smile SnappyHexMesh for big complex city STL
  #1
New Member
 
Amirreza
Join Date: Mar 2020
Posts: 17
Rep Power: 6
arezayan87 is on a distinguished road
Hi

I've stuck in a problem with [snappyHexMesh]. I need too mesh a big complex city, but when meshing process is finished the result is terrible!
the box-shaped buildings get deformed (see the picture attached )

I increased the level values in castellatedMeshControls block, in addition the value of the resolvedFeatureAngle is set 175. but no considerable changes occurred!!

is there any way to get ride of this tough situation?
Attached Images
File Type: jpg raw_Stl_buildings.jpg (47.2 KB, 33 views)
File Type: jpg after_snappy_buildings.JPG (84.7 KB, 29 views)
arezayan87 is offline   Reply With Quote

Old   March 22, 2024, 04:28
Default
  #2
Senior Member
 
Join Date: Dec 2021
Posts: 251
Rep Power: 6
Alczem is on a distinguished road
Hey,


If you can, share your snappyHexMeshDict, it will help people understand.


The resolveFeatureAngle works the other way I believe! Meaning that to detect more edges, you have to reduce this value (set it to 30 to resolve the edges of faces making an angle sharper than 30° for instance). By setting it to 175, you are only detecting angles sharper than 175°, which is... very sharp! Try reducing it.


Are you using implicit or explicit feature detection? What are your input geometry files (stl, obj...)?
Yann likes this.
Alczem is offline   Reply With Quote

Old   March 22, 2024, 04:46
Default
  #3
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,238
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
This bit might help to understand the resolveFeatureAngle parameter: https://doc.openfoam.com/2306/tools/...veFeatureAngle
arezayan87 likes this.
Yann is offline   Reply With Quote

Old   March 22, 2024, 06:09
Default
  #4
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
Looks suspiciously like a highly flat background mesh. Snappy is very bad at handling flat blockMesh cells as input. Try cubic background cells.
arezayan87 likes this.
AtoHM is offline   Reply With Quote

Old   March 22, 2024, 08:22
Default
  #5
New Member
 
Amirreza
Join Date: Mar 2020
Posts: 17
Rep Power: 6
arezayan87 is on a distinguished road
Quote:
Originally Posted by Alczem View Post
Hey,


If you can, share your snappyHexMeshDict, it will help people understand.


The resolveFeatureAngle works the other way I believe! Meaning that to detect more edges, you have to reduce this value (set it to 30 to resolve the edges of faces making an angle sharper than 30° for instance). By setting it to 175, you are only detecting angles sharper than 175°, which is... very sharp! Try reducing it.


Are you using implicit or explicit feature detection? What are your input geometry files (stl, obj...)?


about resolveFeatureAngle you're right, I set includedAngle 170.

I've attached my SHMDict here.
Attached Files
File Type: txt snappyHexMeshDict.txt (2.2 KB, 3 views)
arezayan87 is offline   Reply With Quote

Old   March 22, 2024, 08:26
Default
  #6
New Member
 
Amirreza
Join Date: Mar 2020
Posts: 17
Rep Power: 6
arezayan87 is on a distinguished road
Quote:
Originally Posted by AtoHM View Post
Looks suspiciously like a highly flat background mesh. Snappy is very bad at handling flat blockMesh cells as input. Try cubic background cells.
Dear AtoHM

I don't understand what "flat blockMesh" is, I used blockMesh as backGround mesh. would you explain more about cubic background cell?
arezayan87 is offline   Reply With Quote

Old   March 25, 2024, 03:23
Default
  #7
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
In the 2nd image looking at the defect regions it appears your background mesh cells are flat; meaning not as high (z) as they are wide (x and y extent). Snappy does work best with a uniform background mesh (x, y and z lengths identical == cubic cells).
AtoHM is offline   Reply With Quote

Old   March 26, 2024, 10:40
Default snapControls seems to be disabled!
  #8
New Member
 
Amirreza
Join Date: Mar 2020
Posts: 17
Rep Power: 6
arezayan87 is on a distinguished road
Quote:
Originally Posted by AtoHM View Post
In the 2nd image looking at the defect regions it appears your background mesh cells are flat; meaning not as high (z) as they are wide (x and y extent). Snappy does work best with a uniform background mesh (x, y and z lengths identical == cubic cells).
Thanks for clear explanation about flat and cubic cells,
After trying with a cubic background cells snapControls does not work properly.
I mean the edges are coarse even in high level values. I guess snapping the edges is somehow disabled!!

this is my SHMDict:

Code:
#includeEtc "caseDicts/mesh/generation/snappyHexMeshDict.cfg"

castellatedMesh on;
snap            on;
addLayers       on;

geometry
{
    buildings.stl
    {
        type triSurfaceMesh;
        name buildings;
    }
/*
    ground.stl
    {
        type triSurfaceMesh;
        name buildings;
    }
*/
    refinementBox
    {
        type box;
        min  (-256   -272.5   0);
        max  (233.239 277.011  65);
    }

}

castellatedMeshControls
{
  nCellsBetweenLevels 15;
  resolveFeatureAngle 15;
    features
    (
      { file  "buildings.eMesh"; level 6; }
    );

    refinementSurfaces
    {
        buildings
        {
            level (4 4);
            patchInfo { type wall; }
        }

        ground
        {
            level (1 2);
            patchInfo { type wall; }
        }
    }

    refinementRegions
    {
        refinementBox
        {
            mode inside;
            levels ((1E15 2));
        }
    }

    locationInMesh (2 0 0.2);
}

snapControls
{
    nSolveIter 100;
    //- Maximum number of snapping relaxation
    //iterations. Should stop before upon
    //reaching a correct mesh.
    nRelaxIter 15;
    // Feature snapping
    //Number of feature edge snapping iterations.
    nFeatureSnapIter 10;
    explicitFeatureSnap    true;
    implicitFeatureSnap    false;
}

addLayersControls
{
    layers
    {
        "CAD.*"
        {
            nSurfaceLayers 3;
        }
    }

    relativeSizes       false;
    expansionRatio      1.2;
    featureAngle        160;
    finalLayerThickness 0.5;
    minThickness        1.8e-3;
//    Surface based refinement level (2 4);
}

meshQualityControls
{}

writeFlags
(
    noRefinement
    // scalarLevels
    // layerSets
    // layerFields
);

mergeTolerance 1e-6;
Attached Images
File Type: jpg errors.jpg (88.7 KB, 16 views)
arezayan87 is offline   Reply With Quote

Old   March 26, 2024, 10:58
Default
  #9
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,238
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
This looks like castellatedMesh.

If you ran snappy without the -overwrite option, make sure to move the to latest time step in ParaView in order to see your final mesh.
arezayan87 likes this.
Yann is offline   Reply With Quote

Old   March 27, 2024, 06:03
Thumbs up * Solved
  #10
New Member
 
Amirreza
Join Date: Mar 2020
Posts: 17
Rep Power: 6
arezayan87 is on a distinguished road
Quote:
Originally Posted by Yann View Post
This looks like castellatedMesh.

If you ran snappy without the -overwrite option, make sure to move the to latest time step in ParaView in order to see your final mesh.


Thanks dear Yann
That works
your solution helped me to tackle the problem
Yann likes this.
arezayan87 is offline   Reply With Quote

Old   April 20, 2024, 14:07
Default problem with increasing levels
  #11
New Member
 
Amirreza
Join Date: Mar 2020
Posts: 17
Rep Power: 6
arezayan87 is on a distinguished road
Hi after a long time

I have a problem with using snappyHexMesh for this case(p1.png). when I increase the level in castellatedMeshControls block (more than 5) snappy crashes and stop running. I don't understand the outputs because it doesn't say what the problem is explicitly!!


best wishes
Amirreza
Attached Images
File Type: png p1.png (174.8 KB, 14 views)
Attached Files
File Type: txt snappy_log.txt (12.0 KB, 3 views)
arezayan87 is offline   Reply With Quote

Old   April 22, 2024, 04:18
Default
  #12
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,238
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hello,

It would help to have the full snappy log file. (It is often useful to know what was going on prior to the crash)

Yann
Yann is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] Errors with snappyHexMesh and cyclic BCs for complex STL structures DanPad07 OpenFOAM Meshing & Mesh Conversion 0 July 21, 2021 12:34
[CAD formats] Creating waterproof STL using snappyHexMesh or salome Tobi OpenFOAM Meshing & Mesh Conversion 58 May 13, 2020 07:01
[snappyHexMesh] What types of stl files are needed in snappyhexmesh? phandy OpenFOAM Meshing & Mesh Conversion 1 February 19, 2015 06:36
[snappyHexMesh] Experimentally obtained STL file for internal Flow SnappyHexMesh Irish09 OpenFOAM Meshing & Mesh Conversion 9 April 7, 2012 09:50
Meshing complex white-light/GOM based STL models jola Main CFD Forum 13 January 30, 2012 02:35


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