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

[snappyHexMesh] Multi-region mesh: improve mesh on interface fluid-solid

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 2 Post By Yann
  • 1 Post By Ryôzanpaku Tiger
  • 1 Post By Yann
  • 1 Post By Ryôzanpaku Tiger

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 2, 2023, 11:43
Default Multi-region mesh: improve mesh on interface fluid-solid
  #1
New Member
 
RT
Join Date: Mar 2020
Location: Germany
Posts: 16
Rep Power: 6
Ryôzanpaku Tiger is on a distinguished road
Dear all,

I am solving a heat transfer multi-region problem: a hot air flow in a pipe with thick walls. The geometry is created in FreeCAD, imported to STEP, exported to SALOME for triangulation, imported to STL. The resulted STL file is a closed surface and has a nice triangulation (see attached figure).

The resulted mesh doesn't look good at the interface between air and pipe (see attached figures).

I tried to adjust the parameters, following various guidelines (including those found on this forum), but couldn't improve the mesh at the interface.

I would very appreciate if you could give me a hint on how I can improve my mesh. Which parameters should be variated? Should I try layers?

Here is a link to the case if needed: case files

Thanks!
Attached Images
File Type: jpg pipe_tri.jpg (121.6 KB, 13 views)
File Type: jpg pipe_air.jpg (188.0 KB, 14 views)
File Type: jpg pipe_air_surface.jpg (36.1 KB, 15 views)
File Type: jpg pipe_air_interface.jpg (189.8 KB, 15 views)

Last edited by Ryôzanpaku Tiger; November 2, 2023 at 13:30. Reason: wrong title
Ryôzanpaku Tiger is offline   Reply With Quote

Old   November 3, 2023, 03:29
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,095
Rep Power: 26
Yann will become famous soon enough
Hello,

When meshing multiregion cases, non-orthogonality can be a problem when snapping on curved surface like your cylinder.

You might try to increase the maxNonOrtho parameter in meshQualityControls and see if it improves snapping on the cylinder surface.

Yann
Yann is offline   Reply With Quote

Old   November 4, 2023, 10:09
Default
  #3
New Member
 
RT
Join Date: Mar 2020
Location: Germany
Posts: 16
Rep Power: 6
Ryôzanpaku Tiger is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hello,

When meshing multiregion cases, non-orthogonality can be a problem when snapping on curved surface like your cylinder.

You might try to increase the maxNonOrtho parameter in meshQualityControls and see if it improves snapping on the cylinder surface.

Yann
Dear Yann,

thank you very much! I increased maxNonOrtho and my mesh has improved!

I will check mesh quality parameters more thoroughly.

Thank you!
Yann likes this.
Ryôzanpaku Tiger is offline   Reply With Quote

Old   November 4, 2023, 18:56
Default
  #4
New Member
 
RT
Join Date: Mar 2020
Location: Germany
Posts: 16
Rep Power: 6
Ryôzanpaku Tiger is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hello,

When meshing multiregion cases, non-orthogonality can be a problem when snapping on curved surface like your cylinder.

You might try to increase the maxNonOrtho parameter in meshQualityControls and see if it improves snapping on the cylinder surface.

Yann
Hello Yann,

I improved the mesh significantly, thank you very much!

The interface is now very smooth, but there are few spots, where the outer edges are not resolved properly. These are the tiny bits which are “cut out” of the mesh.

I read few topics here on the forum about 90 degrees edges and tried few things, but I couldn’t get read of these tiny bits. Could you please give a hint, what could it be? Here is snappyHexMeshDict:

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

castellatedMesh true;
snap            true;
addLayers       false;

geometry
{
    pipe.stl   { type triSurfaceMesh; name pipe;   }
    inlet.stl  { type triSurfaceMesh; name inlet;  }
    outlet.stl { type triSurfaceMesh; name outlet; }
}

castellatedMeshControls
{
    maxGlobalCells 10000000;
    maxLocalCells 5000000;
    minRefinementCells 10;
    nCellsBetweenLevels 1;
    features
    (
        { file "pipe.extendedFeatureEdgeMesh";  level 3; }
    );

    refinementSurfaces
    {
        pipe   { level (2 3); }
        inlet  { level (2 3); patchInfo { type patch; } }
        outlet { level (2 3); patchInfo { type patch; } }
    }
    resolveFeatureAngle 30;
    refinementRegions
    {
    }
    locationsInMesh
    (
        ((0.0081 0.0001 0.0049) fluid )
        ((0.0139 0.0001 0.0001) pipe  )
    );
    allowFreeStandingZoneFaces false;
}

snapControls
{
    nSmoothPatch 3;
    tolerance 1.0;
    nSolveIter 100;
    nRelaxIter 5;
    nFeatureSnapIter 5;
    implicitFeatureSnap false;
    explicitFeatureSnap true;
    multiRegionFeatureSnap false;
}

addLayersControls
{
    relativeSizes false;
    layers
    {
        pipeInnerWall { nSurfaceLayers 8; }
    }
    expansionRatio 1.2;
    finalLayerThickness 0.001;
    minThickness 0.0005;
    nGrow 0;
    featureAngle 80;
    nRelaxIter 5;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedialAxisAngle 90;
    nBufferCellsNoExtrude 0;
    nLayerIter 50;
    nRelaxedIter 20;
}

meshQualityControls
{
    maxNonOrtho 180;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minFlatness 0.5;
    minVol 1e-13;
    minTetQuality 1e-30;
    minArea -1;
    minTwist 0.02;
    minDeterminant 0.001;
    minFaceWeight 0.02;
    minVolRatio 0.01;
    minTriangleTwist -1;
    nSmoothScale 4;
    errorReduction 0.75;
}

mergeTolerance 1e-6;

// ************************************************************************* //
I would also appreciate your thoughts about the STL files problem: I use 3 STL files – pipe, inlet, outlet. All 3 surfaces have nice triangulation, but inlet and outlet are not closed. If I combine all files together, then the resulted file is not closed too. Well, the mesh is generated, but I know that it is not the ideal situation. What could be a solution here? Or should I simply be happy that my mesh is generated quite nicely, despite of the not closed surfaces?

Thank you very much for your help!
Attached Images
File Type: jpg edge.jpg (28.7 KB, 10 views)
File Type: jpg edge_mesh.jpg (204.5 KB, 12 views)
Ryôzanpaku Tiger is offline   Reply With Quote

Old   November 6, 2023, 06:02
Default
  #5
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,095
Rep Power: 26
Yann will become famous soon enough
Hello,

Having a closed STL file might help with snapping. Nothing certain about that, but it might be worth trying.
After concatenating your STL file, there are 2 utilities you can use to clean up the concatenated file : surfacePointMerge and surfaceHookUp.

Have a look at this post: Surface Check and Repair Utilities - Need Explanation

Another thing you can try is to activate this switch and see how it affects your mesh:
Code:
multiRegionFeatureSnap false;
Regards,
Yann
Ryôzanpaku Tiger likes this.
Yann is offline   Reply With Quote

Old   November 6, 2023, 07:00
Default
  #6
New Member
 
RT
Join Date: Mar 2020
Location: Germany
Posts: 16
Rep Power: 6
Ryôzanpaku Tiger is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hello,

Having a closed STL file might help with snapping. Nothing certain about that, but it might be worth trying.
After concatenating your STL file, there are 2 utilities you can use to clean up the concatenated file : surfacePointMerge and surfaceHookUp.

Have a look at this post: Surface Check and Repair Utilities - Need Explanation

Another thing you can try is to activate this switch and see how it affects your mesh:
Code:
multiRegionFeatureSnap false;
Regards,
Yann
Hello Yann,

Thank you for the hints! I will check these utilities and try to repair the concatenated file.

Before I read your answer, I have solved the problem with the edge resolution by using
Code:
nFeatureSnapIter 10;
The "teeth" disappeared. However, I still tried to use multiRegionFeatureSnap and with a new value of nFeatureSnapIter the mesh didn't change (is this normal? ), so I returned back to multiRegionFeatureSnap set to false.

(Here is a link to the updated case: case files)

Thank you very much again for the help!
Yann likes this.
Ryôzanpaku Tiger is offline   Reply With Quote

Old   November 10, 2023, 10:16
Default
  #7
New Member
 
RT
Join Date: Mar 2020
Location: Germany
Posts: 16
Rep Power: 6
Ryôzanpaku Tiger is on a distinguished road
Hello Yann,

May I bother you with another question?

Now, when the mesh in the pipe is fine, I would like to add a thin plate with small holes inside the pipe.

Here is snappyHexMeshDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    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
{
    pipe.stl   { type triSurfaceMesh; name pipe;}
    inlet.stl  { type triSurfaceMesh; name inlet;  }
    outlet.stl { type triSurfaceMesh; name outlet; }
    plane.stl { type triSurfaceMesh; name plane;
        regions
        {
            planeBackFace {name planeBackFace;}
            planeBottomFace {name planeBottomFace;}
            planeFrontFace {name planeFrontFace;}
            planeHole1 {name planeHole1;}
            planeHole2 {name planeHole2;}
            planeHole3 {name planeHole3;}
            planeHole4 {name planeHole4;}
            planeHole5 {name planeHole5;}
            planeHole6 {name planeHole6;}
            planeLeftFace {name planeLeftFace;}
            planeRightFace {name planeRightFace;}
            planeTopFace {name planeTopFace;}
        }
    }
}


// Settings for the castellatedMesh generation.
castellatedMeshControls
{
    maxGlobalCells 10000000;
    maxLocalCells 5000000;
    minRefinementCells 10;
    nCellsBetweenLevels 1;

    features
    (
        { file "pipe.extendedFeatureEdgeMesh";   level 2; }
        { file "plane.extendedFeatureEdgeMesh";  level 2; }
    );

    refinementSurfaces
    {
        pipe
        {
            level (2 2);
        }
        inlet
        {
            level (2 2);
            patchInfo { type patch; }
        }
        outlet
        {
            level (2 2);
            patchInfo { type patch; }
        }
        plane
        {
            level (2 2);
            patchInfo { type wall; }
            regions
            {
                planeHole1 { level (4 5); }
                planeHole2 { level (4 5); }
                planeHole3 { level (4 5); }
                planeHole4 { level (4 5); }
                planeHole5 { level (4 5); }
                planeHole6 { level (4 5); }
            }
        }
    }

    resolveFeatureAngle 30;

    refinementRegions
    {
    }

    locationsInMesh
    (
        ((0.0081 0.0001 0.0049) fluid )
        ((0.0139 0.0001 0.0001) pipe  )
        ((0.0001 0.0001 0.0001) plane)
    );

    allowFreeStandingZoneFaces false;
}


// Settings for the snapping.
snapControls
{
    nSmoothPatch 3;
    tolerance 1.0;
    nSolveIter 100;
    nRelaxIter 5;
    nFeatureSnapIter 10;
    implicitFeatureSnap false;
    explicitFeatureSnap true;
    multiRegionFeatureSnap false;
}

addLayersControls
{
    relativeSizes false;

    layers
    {
        pipeInnerWall { nSurfaceLayers 8; }
    }

    expansionRatio 1.2;
    finalLayerThickness 0.001;
    minThickness 0.0005;
    nGrow 0;
    featureAngle 80;
    nRelaxIter 5;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;

    minMedialAxisAngle 90;
    nBufferCellsNoExtrude 0;
    nLayerIter 50;
    nRelaxedIter 20;
}

meshQualityControls
{
    maxNonOrtho 180;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minFlatness 0.5;
    minVol 1e-13;
    minTetQuality 1e-30;
    minArea -1;
    minTwist 0.02;
    minDeterminant 0.001;
    minFaceWeight 0.02;
    minVolRatio 0.01;
    minTriangleTwist -1;
    nSmoothScale 4;
    errorReduction 0.75;
}

mergeTolerance 1e-6;

// ************************************************************************* //
The mesh doesn't look bad (see figure 1), but I would like to achieve better smoothness of the inner surfaces of the holes. However, if, for example, for
Code:
planeHole1 { level (5 6); }
the mesh does not improve.

I tried changing snapping parameters, but it didn't give any improvement. I tried using refinementRegions (see figure 2), but it only made the mesh worse, and the edges were not resolved correctly.

Could you please give a hint: what else could be adjusted here?

And another problem with the current mesh: the mesh quality complains about
Code:
Checking faces in error :
    faces with face pyramid volume < 1e-13                 : 128128
Of course, I could remove this warning by adjusting
Code:
minVol
parameter, but I am not sure whether I should do it.

I would very appreciate any hints! Thank you!
Attached Images
File Type: jpg hole.jpg (79.4 KB, 12 views)
File Type: jpg hole_refinementRegions.jpg (73.9 KB, 10 views)
Ryôzanpaku Tiger is offline   Reply With Quote

Old   November 10, 2023, 10:41
Default
  #8
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,095
Rep Power: 26
Yann will become famous soon enough
Hello,

Hard to say, how does the holes look in your STL file ?
Yann is offline   Reply With Quote

Old   November 10, 2023, 11:46
Default
  #9
New Member
 
RT
Join Date: Mar 2020
Location: Germany
Posts: 16
Rep Power: 6
Ryôzanpaku Tiger is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hello,

Hard to say, how does the holes look in your STL file ?
Please see attached the part of the STL model with the hole. Thanks!
Attached Images
File Type: jpg hole_tri.jpg (135.0 KB, 9 views)
Ryôzanpaku Tiger is offline   Reply With Quote

Old   November 11, 2023, 07:50
Default
  #10
New Member
 
RT
Join Date: Mar 2020
Location: Germany
Posts: 16
Rep Power: 6
Ryôzanpaku Tiger is on a distinguished road
UPDATE: I refined the STL model in SALOME reducing the local length form 0.0003 to 0.0001. The STL model has now a very big size, but the resulted surface is smooth.

However, the mesh quality still complains about the faces:
Code:
Checking faces in error :
    faces with face pyramid volume < 1e-13                 : 268112
I assume that because of the length values the volume can be that small. But to which extent can this warning be ignored?

I would very appreciate any hints! Thank you!
Attached Images
File Type: jpg 0003.jpg (140.6 KB, 10 views)
File Type: jpg 0001.jpg (140.7 KB, 12 views)
Ryôzanpaku Tiger is offline   Reply With Quote

Reply

Tags
multi-region mesh, 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
Can I use fvOptions to couple a solid region and a fluid region? titanchao OpenFOAM Running, Solving & CFD 4 January 14, 2022 07:55
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 07:38
problem with Min/max rho tH3f0rC3 OpenFOAM 8 July 31, 2019 09:48
Question about adaptive timestepping Guille1811 CFX 25 November 12, 2017 17:38
Unstabil Simulation with chtMultiRegionFoam mbay101 OpenFOAM Running, Solving & CFD 13 December 28, 2013 13:12


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