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

[snappyHexMesh] Improving mesh quality + inlet too coarse

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 13, 2015, 13:16
Default Improving mesh quality + inlet too coarse
  #1
New Member
 
Join Date: Jun 2015
Location: UK
Posts: 13
Rep Power: 11
MartinBlx is on a distinguished road
Hi everybody,

I have used sHM to create a mesh that I use for flow simulations inside a channel, principally with simpleFoam, icoFoam and pisoFoam.

I would like to improve the quality of my mesh. If my current mesh looks ok and seems to give acceptable results when solving, when looking at the quality of the mesh on ParaView, the mesh doesn't look so good ( a lot of weird triangles):



https://drive.google.com/file/d/0B_T...ew?usp=sharing

My snappyHexMeshDict is:

Code:
castellatedMesh true;    
snap        true;    
addLayers   false;   


geometry
{
    coil.stl
    {
 type triSurfaceMesh;
 regions
 {
 inlet
 {
 name Inlet;
 }
 outlet
 {
 name Outlet;
 }
 channel
 {
 name Channel;
 }
 }
    }
};

castellatedMeshControls
{
maxLocalCells 1000000;  
maxGlobalCells 2000000;
minRefinementCells 10;  
maxLoadUnbalance 0.10;
nCellsBetweenLevels 1;  
features
(
);
refinementSurfaces
{
coil.stl
{
 level (3 3);
 regions
 {
inlet
 {
 level (3 3);
 }
outlet
 {
 level (3 3);
 }
channel
 {
 level (3 3);
 }
 }
}
}  
resolveFeatureAngle 80;
refinementRegions  {}
locationInMesh (4.60 0 -0.1);  
allowFreeStandingZoneFaces true;
}

snapControls
{
nSmoothPatch 3;
tolerance 4.0;
nSolveIter 30;
nRelaxIter 5;
nFeatureSnapIter 15;
implicitFeatureSnap false;
explicitFeatureSnap true;
multiRegionFeatureSnap false;
}


addLayersControls
{
}

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

debug 0;

mergeTolerance 1E-6;


// ************************************************************************* //
Here's the results of checkMesh:

Code:
Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:           384847
    faces:            899461
    internal faces:   784170
    cells:            270062
    faces per cell:   6.2342388
    boundary patches: 3
    point zones:      0
    face zones:       0
    cell zones:       0

Overall number of cells of each type:
    hexahedra:     176939
    prisms:        17694
    wedges:        0
    pyramids:      0
    tet wedges:    361
    tetrahedra:    0
    polyhedra:     75068
    Breakdown of polyhedra by number of faces:
        faces   number of cells
            4   26111
            5   13529
            6   7818
            9   13278
           12   7411
           15   6642
           18   279

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
                   Inlet      472      490  ok (non-closed singly connected)
                  Outlet      477      496  ok (non-closed singly connected)
                 Channel   114342   139344  ok (non-closed singly connected)

Checking geometry...
    Overall domain bounding box (-4.8993775 -0.29861881 -4.8996497) (4.8999494 1.6490441 4.899462)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (2.1939305e-17 -7.0482654e-17 -1.0274938e-16) OK.
    Max cell openness = 3.6825096e-16 OK.
    Max aspect ratio = 5.7538098 OK.
    Minimum face area = 0.00014774862. Maximum face area = 0.010235913.  Face area magnitudes OK.
    Min volume = 1.8909542e-06. Max volume = 0.0010082752.  Total volume = 12.200188.  Cell volumes OK.
    Mesh non-orthogonality Max: 47.158213 average: 15.388555
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 0.85600618 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

End
I tried to play with the different features of sHMDict but I didn't manage to improve my mesh and obtaining a good-looking one.

Besides, I think I have a problem with the meshing of my patches (an inlet and an outlet). They are supposed to be perfect disks but, when checking their shape on ParaView, it's not so good:



https://drive.google.com/file/d/0B_T...ew?usp=sharing

Any suggestions how I could increase the quality of my mesh and if there is any solution for obtaining a better inlet?

Martin

Last edited by MartinBlx; July 15, 2015 at 08:08.
MartinBlx is offline   Reply With Quote

Old   July 15, 2015, 10:19
Default
  #2
Member
 
DanielP
Join Date: Jan 2015
Posts: 33
Rep Power: 11
danielpiaget is on a distinguished road
Hello Martin, I have notice that you are using the ExpliciteFeatureSnap method to project the Castellated mesh on to the surface geometry STL file. But you are missing a file that needs to be generated with the surfaceFeatureExtract utility.This file needs to be defined in the castellatedMeshControls dictionary.The surfaceFeatureExtract utility will output a folder name extendedFeatureEdgeMesh.It will be located in the constant/ directory.To be able to generate the file, you will need a file (another dictionary file !) named surfaceFeatureExtractDict to be located in the system/ folder.I have added a copy below. You only need to copy in any text editor and save the file as surfaceFeatureExtractDict. 1) Create surfaceFeatureExtractDict file with text editor ?????????????????????????????????????????????????? ???????? copy of surfaceFeatureExtractDict ?????????????????????????????????????????????????? ?????? ------------------------------------------------------------------------- /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object surfaceFeatureExtractDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // coil.stl { // How to obtain raw features (extractFromFile || extractFromSurface) extractionMethod extractFromSurface; extractFromSurfaceCoeffs { // Mark edges whose adjacent surface normals are at an angle less // than includedAngle as features // - 0 : selects no edges // - 180: selects all edges includedAngle 180; } // Write options // Write features to obj format for postprocessing writeObj yes; } // ************************************************** *********************** // ?????????????????????????????????????????????????? ???????? 2)At the Linux command line, type the following command: surfaceFeatureExtract 3) In the snappyHexMeshdict add the following code in the castellatedMeshControls under the feature function: features ( { file "coil.extendedFeatureEdgeMesh"; level 3; } ); 4) Run snappyHexMesh again. Good luck, Daniel
danielpiaget is offline   Reply With Quote

Old   July 28, 2015, 08:50
Default
  #3
New Member
 
Join Date: Jun 2015
Location: UK
Posts: 13
Rep Power: 11
MartinBlx is on a distinguished road
Hi, sorry for the late feedback to your answer Daniel!

Indeed, in my snapControls dictionary I had the following code lines;

Code:
snapControls
    nFeatureSnapIter 15;
    implicitFeatureSnap false;
    explicitFeatureSnap true; 
    multiRegionFeatureSnap false;
}
since I don't use SurfaceFeatureExtract, you're right there is no point using "explicitFeatureSnap" so I changed it to false and turned "impliciFeatureSnap" to true:

Code:
snapControls
    //nFeatureSnapIter 15;
    implicitFeatureSnap true;
    explicitFeatureSnap false; 
    multiRegionFeatureSnap false;
}
I don't use SurfaceFeatureExtract since I have just one .stl file where my 3 regions are defined in it. As far I have understood, I should use SurfaceFeatureExtract if I chose to create my mesh with every regions in a seperate .stl file (so 3 files).

So when executing sHM with these new settings, the obtained mesh has still the same not so good-looking shape that the mesh linked in my first post...

Is it possible to to better do you think? or I should consider my mesh acceptable?

I'll try to create a mesh by SurafceExtracting and will go back to you as well.
MartinBlx is offline   Reply With Quote

Old   July 28, 2015, 09:32
Default
  #4
New Member
 
Join Date: Jun 2015
Location: UK
Posts: 13
Rep Power: 11
MartinBlx is on a distinguished road
So I've just created a new mesh but this time with the surface extraction.

My snappyHexMeshDict, surfaceFeatureExtractDict and results from checkMesh are the following:

Code:
castellatedMesh true;    
snap            true;    
addLayers       false;   

geometry 
{
    inlet.stl {type triSurfaceMesh; name inlet;}
    outlet.stl {type triSurfaceMesh; name outlet;}
    channel.stl {type triSurfaceMesh; name channel;}
    coil.stl {type triSurfaceMesh; name coil;}
};

castellatedMeshControls
{
    maxLocalCells 1000000;  
    maxGlobalCells 2000000; 
    minRefinementCells 10;  //0 means no bad cells are allowed during refinement stages
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 1;  // expansion factor between each high & low refinement zone
    features
    (
        {file "inlet.eMesh"; level 3;} 
        {file "outlet.eMesh"; level 3;} 
        {file "channel.eMesh"; level 3;} 
        {file "coil.eMesh"; level 3;} 
    );
    refinementSurfaces
    {
    inlet {level (3 3);}
        outlet {level (3 3);}
    channel {level (3 3);} 
    }  
    resolveFeatureAngle 80;  // resolve sharp angles - default 30
    refinementRegions        // In descending levels of fine-ness
    {
    channel 
        {
        mode distance;
        levels ((0.0006 4) (0.002 3) (0.01 2));
        }
    }
    locationInMesh (4.60 0 -0.1);  
    allowFreeStandingZoneFaces true;
}

snapControls
{
    nSmoothPatch 3;
    tolerance 4.0;
    nSolveIter 30;
    nRelaxIter 5;
    nFeatureSnapIter 15; // default is 10
    implicitFeatureSnap false; //detects without doing surfaceFeatureExtract
    explicitFeatureSnap true; 
    multiRegionFeatureSnap false; //detects features between multiple surfaces
}

addLayersControls
{
    relativeSizes false; // was true
    layers
    {
    channel
             {nSurfaceLayers 3;} // was 3
    }
    expansionRatio 1.3;
    finalLayerThickness 0.00016; //was 0.00016
    minThickness 0.00008; //was 0.00008
    nGrow 0; // was 1 
    // Advanced settings
    featureAngle 80; // was 70 //- When not to extrude surface. 0 is flat, 90 is right angle.
    nRelaxIter 3;  //- Max# of snapping relaxation iter. Should stop before upon reaching a correct mesh.
    nSmoothSurfaceNormals 1;  // Number of smoothing iterations of surface normals
    nSmoothNormals 3; // Number of smoothing iterations of interior mesh movement direction
    nSmoothThickness 10;  // Smooth layer thickness over surface patches
    maxFaceThicknessRatio 0.5; // Stop layer growth on highly warped cells
    maxThicknessToMedialRatio 0.3; // Reduce layer growth where ratio thickness to medial distance is large
    minMedianAxisAngle 130;  // Angle used to pick up medial axis points
    nBufferCellsNoExtrude 0;   // Create buffer region for new layer terminations
    nLayerIter 50; // Overall max number of layer addition iterations
}

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

debug 0;

mergeTolerance 1E-6;
Code:
inlet.stl
{
    extractionMethod    extractFromSurface; // extractFromFile or extractFromSurface
    extractFromSurfaceCoeffs
    {includedAngle   150;}
    writeObj                yes;    // Write options
}

outlet.stl
{
    extractionMethod    extractFromSurface; // extractFromFile or extractFromSurface
    extractFromSurfaceCoeffs
    {includedAngle   150;}
    writeObj                yes;    // Write options
}

channel.stl
{
    extractionMethod    extractFromSurface; // extractFromFile or extractFromSurface
    extractFromSurfaceCoeffs
    {includedAngle   150;}
    writeObj                yes;    // Write options
}

coil.stl
{
    extractionMethod    extractFromSurface; // extractFromFile or extractFromSurface
    extractFromSurfaceCoeffs
    {includedAngle   150;}
    writeObj                yes;    // Write options
}
Code:
Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:           603300
    faces:            1318613
    internal faces:   1155723
    cells:            386176
    faces per cell:   6.4072754
    boundary patches: 9
    point zones:      0
    face zones:       0
    cell zones:       0

Overall number of cells of each type:
    hexahedra:     202624
    prisms:        21820
    wedges:        0
    pyramids:      0
    tet wedges:    5208
    tetrahedra:    348
    polyhedra:     156176
    Breakdown of polyhedra by number of faces:
        faces   number of cells
            4   26732
            5   19037
            6   49240
            7   6954
            8   4682
            9   24637
           10   1024
           11   519
           12   15592
           13   32
           14   51
           15   6833
           16   2
           18   841

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
                    maxY        0        0                        ok (empty)
                    minX        0        0                        ok (empty)
                    maxX        0        0                        ok (empty)
                    minY        0        0                        ok (empty)
                    minZ        0        0                        ok (empty)
                    maxZ        0        0                        ok (empty)
                   inlet      472      490  ok (non-closed singly connected)
                  outlet      493      519  ok (non-closed singly connected)
                 channel   161925   216991  ok (non-closed singly connected)

Checking geometry...
    Overall domain bounding box (-4.8993783 -0.29930061 -4.89965) (4.8999584 1.6548865 4.8997751)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (-3.318191e-16 -4.8856613e-16 -3.47991e-16) OK.
    Max cell openness = 3.4562049e-16 OK.
    Max aspect ratio = 6.1466887 OK.
    Minimum face area = 3.6696844e-05. Maximum face area = 0.010194678.  Face area magnitudes OK.
    Min volume = 2.6245674e-07. Max volume = 0.0010016498.  Total volume = 12.203286.  Cell volumes OK.
    Mesh non-orthogonality Max: 62.229585 average: 16.554294
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 1.8968828 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

End
So, for the same geometry, this technic takes 2.5 more time than the implicit one (mesh obtained in 390s compared to 143s), for a mesh with more cells (386176 vs 270062). However, I can't see any improvements in the quality of the mesh:

https://drive.google.com/file/d/0B_T...ew?usp=sharing

I'm sure it's possible to obtain a better resolution but I really don't know with which parameters from the sHMDict to play with..

Any help will be welcomed
MartinBlx is offline   Reply With Quote

Old   July 31, 2015, 07:41
Default
  #5
New Member
 
Join Date: Jun 2015
Location: UK
Posts: 13
Rep Power: 11
MartinBlx is on a distinguished road
Last attempt to have help

After playing with the features of the castellatedMeshDict, and a bit with the snapDict ones, I didn't obtain anything good-looking for my mesh...
MartinBlx is offline   Reply With Quote

Old   August 2, 2015, 23:09
Default
  #6
Member
 
DanielP
Join Date: Jan 2015
Posts: 33
Rep Power: 11
danielpiaget is on a distinguished road
Hello Martin,

In my experience, you should be able to generate a good quality mesh for a cylinder channel.

Try using the .surfaceFeatureExtract files and not the emesh files.

Also, I have noticed that you set the tolerance to 4 in the Snap dictionary. Try it with a value of 1.

Thanks,

Daniel
danielpiaget 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
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
[ICEM] Improving mesh quality neprendo ANSYS Meshing & Geometry 1 June 19, 2014 09:56
[ICEM] improving mesh quality kannstmasehn ANSYS Meshing & Geometry 8 April 29, 2013 06:28
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 22:11
How to control Minximum mesh space? hung FLUENT 7 April 18, 2005 10:38


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