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

[snappyHexMesh] SHM refines feature edges partially

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 14, 2024, 23:28
Default SHM refines feature edges partially
  #1
Member
 
Ali B.
Join Date: Mar 2020
Location: abzrg.github.io
Posts: 44
Rep Power: 6
reverseila is on a distinguished road
Dear all,


I am meshing a rectangular pipe with a cavity on top of it. An image
of the domain with feature edges extracted is attached here. I want to
refine the mesh on the cavity's edges.

The cavity features are extracted using Paraview: using FeatureEdges
and ExtractSelected filters, and then converted to surface using
ExtractSurface filter. The surface is exported as a VTK file and
converted to eMesh file using surfaceFeatureConvert.

outline.jpg

Then, I set the surface refinement everywhere uniformly (level 2) and
set the feature refinement of the cavity to 3, 4, and 5 in multiple attempts.
The images below show the refinement level of 5, but the results were
similar in that somewhere on few of the edges the mesh was refined
below the specified level. I'm totally clueless why this is happening. I
would appreciate if anyone could point out what's wrong or I'm
missing something (like a parameter needs to be changed in the dictionary).
The snappyHexMeshDict dictionary is attached below as well.

mesh-is.jpg

mesh-2.jpg

(Why I'm meshing this using snappyHexMesh and not blockMesh? I'm just
learning SHM and tinkering with stuff. )


Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2312                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

///////////////////////////////////////////////////////////////////////////////
castellatedMesh true;
snap            false;
addLayers       false;
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
geometry
{
    pipe.stl
    {
        type triSurfaceMesh;
        name pipe;

        regions
        {
            inlet       { name inlet; }
            outlet      { name outlet; }
            fixedWalls  { name fixedWalls; }
            middle      { name middle; }
            front       { name front; }
            back        { name back; }
        };
    }
}
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
castellatedMeshControls
{

    maxLocalCells 100000;

    maxGlobalCells 2000000;

    minRefinementCells 10;

    maxLoadUnbalance 0.10;

    nCellsBetweenLevels 3;


    features
    (
        {
            file "pipe.eMesh";
            level 2;
        }

        {
            file "cavityRegion.eMesh";
            level 5; // <-------
        }
    );


    refinementSurfaces
    {
        pipe
        {
            level (0 0);

            regions
            {
                inlet       { level (2 2); patchInfo { type path; inGroups (grpPatch); }}
                outlet      { level (2 2); patchInfo { type path; inGroups (grpPatch); }}
                fixedWalls  { level (2 2); patchInfo { type wall; inGroups (grpWall); }}
                middle      { level (2 2); patchInfo { type symmetry; inGroups (grpSymmetry); }}
                front       { level (2 2); patchInfo { type wall; inGroups (grpWall); }}
                back        { level (2 2); patchInfo { type wall; inGroups (grpWall); }}
            }
        }
    }

    resolveFeatureAngle 30;

    planarAngle 30;

    refinementRegions
    {
    }

    locationInMesh (0.05 0.05 0.0);


    allowFreeStandingZoneFaces true;
}
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
snapControls
{
    nSmoothPatch 3;

    tolerance 2.0;

    nSolveIter 30;

    nRelaxIter 5;

    // Feature snapping

        nFeatureSnapIter 10;

        implicitFeatureSnap false;

        explicitFeatureSnap true;

        multiRegionFeatureSnap false;
}
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
addLayersControls
{
    relativeSizes true;

    layers
    {
        pipe
        {
            nSurfaceLayers 1;
        }
    }

    expansionRatio 1.0;

    finalLayerThickness 0.3;

    minThickness 0.1;

    nGrow 0;

    // Advanced settings

        featureAngle 130;

        slipFeatureAngle 30;

        nRelaxIter 3;

        nSmoothSurfaceNormals 1;

        nSmoothNormals 3;

        nSmoothThickness 10;

        maxFaceThicknessRatio 0.5;

        maxThicknessToMedialRatio 0.3;

        minMedialAxisAngle 90;

        nBufferCellsNoExtrude 0;

        nLayerIter 50;
}
///////////////////////////////////////////////////////////////////////////////



///////////////////////////////////////////////////////////////////////////////
meshQualityControls
{
    #include "meshQualityDict"
    nSmoothScale 4;
    errorReduction 0.75;
}
///////////////////////////////////////////////////////////////////////////////


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

mergeTolerance 1e-6;


// ************************************************************************* //
// vim: fdm=indent
$FOAM_API: 2312
Attached Files
File Type: txt surfaceFeatureExtractDict.txt (2.1 KB, 0 views)
File Type: txt meshQualityDict.txt (1.0 KB, 0 views)

Last edited by reverseila; July 15, 2024 at 01:13.
reverseila is offline   Reply With Quote

Old   July 15, 2024, 02:18
Default
  #2
Senior Member
 
M
Join Date: Dec 2017
Posts: 692
Rep Power: 12
AtoHM is on a distinguished road
sHM might reach your specified
Code:
maxGlobalCells 2000000;
and thus stops refining at some point. If that happens, it should be indicated in the snappyHexMesh.log file if you let it write one.
AtoHM is offline   Reply With Quote

Old   July 15, 2024, 12:34
Default
  #3
Member
 
Ali B.
Join Date: Mar 2020
Location: abzrg.github.io
Posts: 44
Rep Power: 6
reverseila is on a distinguished road
Hi AtoHM, and Thanks for your reply.

I have attached both the snappyHexMesh's log and the checkMesh's log.
Total number of cells in the mesh: 400k.
Attached Files
File Type: txt log.snappyHexMesh.txt (72.9 KB, 2 views)
File Type: txt log.checkMesh.txt (3.7 KB, 0 views)
reverseila is offline   Reply With Quote

Old   July 16, 2024, 01:20
Default
  #4
Senior Member
 
M
Join Date: Dec 2017
Posts: 692
Rep Power: 12
AtoHM is on a distinguished road
The parameter maxLocalCells could have the same influence as it specifies the
Quote:
max number of cells per processor during refinement
as per https://doc.cfd.direct/openfoam/user.../snappyhexmesh.
Try setting this above the expected cell count, e.g. 2M too. Other than that I cannot see an error. Check visually that the eMesh file holds all the edges you expect it to have. Try refinement with level 4 first, see it if works.


You can also try to set minRefinementCells to 1. This way snappy will always refine until all cells marked for refinement are at the target level. Your log does not state that it stopped with cells left, but its worth a try.
AtoHM is offline   Reply With Quote

Old   July 16, 2024, 17:05
Default
  #5
Member
 
Ali B.
Join Date: Mar 2020
Location: abzrg.github.io
Posts: 44
Rep Power: 6
reverseila is on a distinguished road
Thank you AtoHM.


Unfortunately, I've tried all of these, one by one and combined,
but none changed the result.


I've also changed two other parameters, e.g., nCellsBetweenLevels (3 -> 1),
maxBoundarySkewness (20 -> 4) but they didn't help.


Other thing I did was to import stl (created in FreeCAD) into Blender,
converted the mesh into quad and refined the mesh,
and then meshed it with shm, and this too didn't work.



At this point I think I'm gonna quit trying further .
If you, however, want to check the case let me know please.

Last edited by reverseila; July 16, 2024 at 22:06.
reverseila is offline   Reply With Quote

Old   July 17, 2024, 02:17
Default
  #6
Senior Member
 
M
Join Date: Dec 2017
Posts: 692
Rep Power: 12
AtoHM is on a distinguished road
Stl is a triangulated surface representation, I wonder how you even exported your quad mesh into stl?



You can upload the stl file and I can try to mesh it. And the eMesh files too.
AtoHM is offline   Reply With Quote

Old   July 18, 2024, 07:16
Default
  #7
Member
 
Ali B.
Join Date: Mar 2020
Location: abzrg.github.io
Posts: 44
Rep Power: 6
reverseila is on a distinguished road
The exported STL is indeed a triangulated surface. However, in Blender
using the Remesh modifier, I made a quad mesh out of the FreeCAD's
triangulated coarse mesh.

Hope you find a solution for this
Attached Files
File Type: zip shm.zip (14.7 KB, 1 views)
reverseila is offline   Reply With Quote

Old   July 18, 2024, 07:41
Default
  #8
Senior Member
 
M
Join Date: Dec 2017
Posts: 692
Rep Power: 12
AtoHM is on a distinguished road
Yeah still, what did you do with the quad thing afterwards? When you export it to stl or obj again its again split into triangles.


I will try to look at the case over the weekend!
AtoHM is offline   Reply With Quote

Old   July 18, 2024, 07:51
Default
  #9
Member
 
Ali B.
Join Date: Mar 2020
Location: abzrg.github.io
Posts: 44
Rep Power: 6
reverseila is on a distinguished road
I thought a finer, more structured, and more uniform mesh would help.
The initial mesh generated by FreeCAD was very coarse and non-uniform.
I converted it into quad mesh (more uniform) and then sub-divided it (finer).

Now, I really didn't think about it at the time, and I don't know how it is
converted to triangles during the export process, but Blender did it for me anyway.

Last edited by reverseila; July 19, 2024 at 06:08.
reverseila is offline   Reply With Quote

Reply

Tags
feature edge handling, feature refinement, featureedges, snappyhexmesh


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] stringing of feature edges Hr_kules OpenFOAM Meshing & Mesh Conversion 0 July 22, 2022 08:30
[snappyHexMesh] snappyHexMesh - 90° edges problem troth OpenFOAM Meshing & Mesh Conversion 22 October 22, 2021 10:28
[snappyHexMesh] snappyHexMesh stuck when snap is turned on yukuns OpenFOAM Meshing & Mesh Conversion 3 February 2, 2021 13:05
SimpleFoam & Theater jipai OpenFOAM Running, Solving & CFD 3 June 18, 2019 10:11
[snappyHexMesh] Manually define feature edges in SHM palgroth OpenFOAM Meshing & Mesh Conversion 0 July 9, 2014 04:22


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