CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Native Meshers: snappyHexMesh and Others

How to get a snapped mesh with SnappyHexMesh?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree13Likes
  • 7 Post By niklas
  • 6 Post By niklas

Reply
 
LinkBack Thread Tools Display Modes
Old   June 6, 2013, 12:52
Default How to get a snapped mesh with SnappyHexMesh?
  #1
New Member
 
Jackie Chou
Join Date: Mar 2013
Posts: 11
Rep Power: 4
jackeyhust is on a distinguished road
Hi, Foamers,

I am new in OpenFoam and study it now. I just start it from a simple model.
Though it is small model, I still met some problems. Hopefully I can get your support.

The model consists of three parts : Extr1, Poro, Extr2. Each of them consists of inlet, outlet, and wall. I am now doing the multiregions meshing for these three parts together with snappyhexmesh. But I cannot get a perfectly snapped mesh. The edges and somewhere in the faces look not very smooth. I have struggled with this for a week.

Could someone help me a little bit? I attached the case folder and the pictures which indicate the results I have obtained. I have written the commands I ran the case in command.txt. I am now using OpenFOAM 2.2.0

I have tried to add the featureEdges for all of them and increase the surface refine mesh level, it is better now, but the surface is still not so flat. Could anybody tell me why?

Really thank you for your kind support!


Jackie


case.zip

snapshot1.jpg

snapshot2.jpg

snapshot3.jpg

Last edited by jackeyhust; June 7, 2013 at 08:25.
jackeyhust is offline   Reply With Quote

Old   June 7, 2013, 09:30
Default
  #2
Senior Member
 
Join Date: Mar 2010
Location: Germany
Posts: 117
Rep Power: 7
cutter is on a distinguished road
Try to align your blockMesh with your geometry (start with its real bounding box). This should give you much better results.

cutter
cutter is offline   Reply With Quote

Old   June 9, 2013, 07:49
Default
  #3
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,488
Blog Entries: 34
Rep Power: 86
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings to all!

@Jackie: Sorry, I don't enough time to go through testing this. Please check the tutorials at the following link for more ideas: http://openfoamwiki.net/index.php/Sn...als_and_Guides

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   June 10, 2013, 04:13
Default
  #4
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 20
niklas will become famous soon enoughniklas will become famous soon enough
Conforming a hexmesh to a general geometry implies a few things.
If you want to have a 'perfect' mesh with only orthogonal cells you can not expect it to fit the surface of
the geometry.
And vice versa,
if you want the mesh to fit your geometry perfectly you can not
expect it to consist of only perfectly shaped hex cells.

So it is up to the user to decide what you want the most, good conformity or good quality, usually you can not have both.

Therefore it is a good thing if you can align the mesh with the geometry, since this will allow the mesh to conform to the geometry with less modifications, and not do what you have done here...

You can play with these parameters and see how they affect the mesh.

maxNonOrtho 80;
maxBoundarySkewness 20;
maxInternalSkewness 5;
maxConcave 80;

Start by setting everything to 90, which should make the mesh fit as good as possible given the resolution.
If this looks good you can start reducing the numbers and see what happens.

Below I've made a few such tests just to illustrate how the mesh is unable to conform to the surface when you
start reducing the maxNonOrtho value.
Watch how the surface starts to look 'wavy' as the maxNonOrtho is lowered.

here's a new version of snappyHexMeshDict

Code:
/*--------------------------------*- C++ -*----------------------------------*\
|       o          |                                                          |
|    o     o       | HelyxOS                                                  |
|   o   O   o      | Version: 1.0.0                                           |
|    o     o       | Web:     http://www.engys.com                            |
|       o          |                                                          |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version 2.0;
    format ascii;
    class dictionary;
    location system;
    object snappyHexMeshDict;
}

castellatedMesh true;
snap true;
addLayers false;

geometry
{
    "Extr1.stl"
    {
        type triSurfaceMesh;  
        name Extr1;
    }

    "Extr2.stl"
    {
        type triSurfaceMesh;
        name Extr2;
    }
                                          
    "Poro.stl"
    {
        type triSurfaceMesh;  
        name Poro;
    }

}                                                
                                                 
castellatedMeshControls                          
{                                                
features                                         
(                                                
 /*
    {
        file "Poro.eMesh";      
        level 5; 
    }
    { 
        file "Extr2.eMesh";
        level 5;
    }
 */
);                                               
                                                 
refinementSurfaces                               
{
    Extr1
    { 
        level ( 3 4 );   
        regions 
        {} 
        faceZone Extr1; 
        cellZone Extr1; 
        cellZoneInside inside;
    }

    Extr2
    {
        level ( 3 4 );
        regions 
        {}
        faceZone Extr2;
        cellZone Extr2;
        cellZoneInside inside;
    }

    Poro
    { 
        level ( 3 4 );
        regions 
        {}
        faceZone Poro; 
        cellZone Poro; 
        cellZoneInside inside;
    }
                                                
}                                                
                                                
resolveFeatureAngle 30;

refinementRegions
{

}
                      
                                                
   
   locationInMesh ( 0.4 -0.03  0.6 );           
      

    // 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 10;

    maxLocalCells  1000000;                        //original 100 000
    maxGlobalCells 10000000;                       //original 2 000 000
    minRefinementCells 0;
    // Number of buffer layers between different levels.
    // 1 means normal 2:1 refinement restriction, larger means slower
    // refinement.
    nCellsBetweenLevels 1;                        //original 1,  others 5

    resolveFeatureAngle 30;
    //  allowFreeStandingZoneFaces true;   
	allowFreeStandingZoneFaces false;
    }
    
    // Settings for the snapping.
    
    snapControls
    {
        //- Number of patch smoothing iterations before finding correspondence
        //  to surface
        nSmoothPatch 10;                         //original 3            others 10

    //- 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;

    //- Number of mesh displacement relaxation iterations.
        nSolveIter 10;                                            //others 300           original 30

    //- Maximum number of snapping relaxation iterations. Should stop
    //  before upon reaching a correct mesh.
        nRelaxIter 10;

    // Feature snapping

        //- Number of feature edge snapping iterations.
        //  Leave out altogether to disable.
        nFeatureSnapIter 10;             //original 10

        //- Detect (geometric) features by sampling the surface
        implicitFeatureSnap true;

        //- Use castellatedMeshControls::features
        explicitFeatureSnap false;

        //- Detect features between multiple surfaces
        //  (only for explicitFeatureSnap, default = false)
        multiRegionFeatureSnap true;
    }

    addLayersControls
    {
        layers
        {
        }

        relativeSizes true;
        expansionRatio 1.0;
        finalLayerThickness 0.3;
        minThickness 0.2;
        nGrow 0;
        featureAngle 60;
        nRelaxIter 5;
        nSmoothSurfaceNormals 1;
        nSmoothNormals 3;
        nSmoothThickness 10;
        maxFaceThicknessRatio 0.5;
        maxThicknessToMedialRatio 0.3;
        minMedianAxisAngle 130;
        nBufferCellsNoExtrude 0;
        nLayerIter 50;
        nRelaxedIter 20;
    }

    meshQualityControls
    {
        maxNonOrtho         80;
        maxBoundarySkewness 20;
        maxInternalSkewness 5;
        maxConcave          80;
        minFlatness         0.5;
        minVol              1.00E-13;
        minTetQuality       -1e30;
        //1e-30 ;
        minArea             -1;
        minTwist            0.05;
        minDeterminant      0.01;
        minFaceWeight       0.01;
        minVolRatio         0.001;            //0.01
        minTriangleTwist    -1;
        nSmoothScale        4;
        errorReduction      0.75;
    }

    debug 0;
    mergeTolerance 1E-6;
Attached Images
File Type: jpg mbs_90_mis_90_mno_90_mc_90.jpg (25.4 KB, 379 views)
File Type: jpg mbs_20_mis_5_mno_90_mc_90.jpg (25.3 KB, 328 views)
File Type: jpg mbs_20_mis_5_mno_90_mc_50.jpg (26.6 KB, 317 views)
File Type: jpg mbs_20_mis_5_mno_80_mc_90.jpg (25.3 KB, 308 views)
File Type: jpg mbs_20_mis_5_mno_70_mc_90.jpg (25.4 KB, 337 views)
wyldckat, nisha, olivier78 and 4 others like this.
niklas is offline   Reply With Quote

Old   June 10, 2013, 04:16
Default
  #5
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 20
niklas will become famous soon enoughniklas will become famous soon enough
just some more pics
Attached Images
File Type: jpg mbs_20_mis_5_mno_10_mc_90.jpg (97.4 KB, 337 views)
File Type: jpg mbs_20_mis_5_mno_50_mc_90.jpg (48.6 KB, 303 views)
File Type: jpg mbs_20_mis_5_mno_60_mc_90.jpg (39.7 KB, 297 views)
File Type: jpg mbs_20_mis_5_mno_70_mc_90.jpg (25.4 KB, 304 views)
niklas is offline   Reply With Quote

Old   August 8, 2013, 08:08
Default Mesh Quality in Nikla's Experimnent
  #6
New Member
 
Aditya
Join Date: May 2013
Location: Munich Germany
Posts: 27
Rep Power: 4
kingmaker is on a distinguished road
Hello Niklas...

It would be very very nice if you can also the mesh quality for the above experimental cases. like the results form checkMesh. I am also now experimenting with these parameters. As far as I can understand in the above experiments of yours the mesh quality should be relatively bad for the case with all 90(good surface fit). But my question is if we have a lot of non-orthogonal and skewed faces then the simulation may not converge .. am I correct ... ??

That exactly is my problem now. I am trying to get a good mesh of a blower. But I cannot get the number of skewed faces low. I am getting about 300 skewed faces (total number of faces ~18Millon ) and my solver(MRFSimpleFoam) is not converging. I think these 300 skewed cells are causing it to diverge. Any suggestion on this issue ?? Any one ?? ..

Thank you
kingmaker is offline   Reply With Quote

Old   August 8, 2013, 12:18
Default
  #7
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 20
niklas will become famous soon enoughniklas will become famous soon enough
my first question is obvious.

Are you 100% sure that it is the mesh quality that is the cause of the divergence?

I have found that usually the cause lies in the choice of the initial values of k and epsilon.
What is the initial turbulent viscosity (or length scale)?
niklas is offline   Reply With Quote

Old   August 9, 2013, 03:27
Default Mesh Quality in Nikla's Experimnent
  #8
New Member
 
Aditya
Join Date: May 2013
Location: Munich Germany
Posts: 27
Rep Power: 4
kingmaker is on a distinguished road
Hello Niklas

Thank you for the reply. I think the turbulence settings are good because, the same parameters gave me ok solution previously. I mean the solution converged. But as I wanted to get good solution I started to look at the mesh and make improvements and experiments with mesh quality parameters. And am caught in this problem I mentioned
kingmaker is offline   Reply With Quote

Old   August 9, 2013, 03:37
Default
  #9
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 20
niklas will become famous soon enoughniklas will become famous soon enough
ok

..still havent answered my question though
niklas is offline   Reply With Quote

Old   August 9, 2013, 04:09
Default @Niklas
  #10
New Member
 
Aditya
Join Date: May 2013
Location: Munich Germany
Posts: 27
Rep Power: 4
kingmaker is on a distinguished road
Sorry I was away from the data so could not post it. I am using a k-omega model for turbulence and my turbulence values are :

inital K = 0.0015
initial Omega = 5
Both are uniform on the inlet which is a 140x140(mm) square

I have an inlet flow rate of 0.0011 m3/s


Thank you in advance.
kingmaker is offline   Reply With Quote

Old   August 12, 2013, 07:48
Default
  #11
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 20
niklas will become famous soon enoughniklas will become famous soon enough
ok, those values are pretty acceptable, so thats not it then.

dont know then.
niklas is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Star CCM Overset Mesh Error (Rotating Turbine) thezack CD-adapco 3 December 11, 2013 04:09
3D Hybrid Mesh Errors DarrenC ANSYS Meshing & Geometry 11 August 5, 2013 06:42
Problems viewing mesh from snappyHexMesh DavidOuellette OpenFOAM Meshing & Mesh Conversion 2 March 24, 2013 22:45
Can I use gridgen mesh as a background mesh for snappyhexmesh. amatuer OpenFOAM Meshing & Mesh Conversion 3 May 3, 2012 10:27
SnappyHexMesh not generate mesh first time mavimo OpenFOAM Mesh Utilities 4 August 26, 2008 07:08


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