CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [snappyHexMesh] snappyHexMesh feature edge (https://www.cfd-online.com/Forums/openfoam-meshing/89669-snappyhexmesh-feature-edge.html)

Turbulence July 23, 2012 12:25

2 Attachment(s)
Hi everyone :)

Are those smooth circular edges even possible?:eek:
I am trying to mesh a simple cylinder.I ran snappyhexmesh many times, took all the advice available online, but of no use. :mad: (used sufracefeatureextract also). PFA the image of 'cylinder after using sufracefeatureextract'.
Any help would be appreciated. :)

Horus July 23, 2012 13:23

Your cylinder looks like the snap phase of snappyHexMesh has not taken place, just the castellated mesh was created.

Did you reconstructParMesh/look at the correct timestep 3?

Turbulence July 24, 2012 08:42

Hi Horus

I just checked it. Its looks fine now. My bad :o

Thank You
Turbulence

Sam-CFD September 20, 2012 07:05

having prism layer through to the inlet
 
I found this thread quite helpful to have my mesh conform more to the geometry. Now, I am having trouble though, getting the prism layer extending all the way to the flow boundaries.

I would like to have something like this mesh (made using ICEM CFD) but as of now I only manage to get this one with the snappyHexMesh utility.

I would be glad for some reviews. Thank you.

Sam

mturcios777 September 20, 2012 13:10

You can either make the base cartesian mesh have that kind of underlying structure (but in that case you might as well create the mesh using blockMesh, it can be done), or user layer insertion with uniform layer thickness and lots of layers. This will require some experimentation.

Andrea_85 March 11, 2013 08:23

Hi all,
i would like to extract feature edges in a particular region of my domain. So i am usign -subsetBox option to remove edges outside specified bounding box. Which is the correct syntax?

the option -subsetBox ((1 1 1)(2 2 2)) does not work.

thank
andrea

cutter March 11, 2013 10:18

Is this really the correct syntax?!

See http://www.cfd-online.com/Forums/ope...-features.html

Andrea_85 March 11, 2013 10:45

Hi,
you are right! great, now it works.

best


andrea

mina.basta July 31, 2013 03:58

Dear all,,,

I have problem & I think it's related to the feature edge,, Could you help me ?

http://www.cfd-online.com/Forums/ope...alve-case.html

best regards,
Mina

sivakumar August 22, 2013 11:10

sHM - edge snapping
 
2 Attachment(s)
Dear All,
After going through this thread I have fixed some problem, but still I have some problem with edge snapping.

the steps I followed is:

1) I executed blockMesh after setting up the case ( 0 cons-> ( poly, trisurf) sys), see fig 1.

2) Secondly, as Bruno's post, the surfaceFeatureExtract command has been executed.
Code:

surfaceFeatureExtract -includedAngle 150 -writeObj constant/triSurface/fanGeo.stl fanGeo
3) Thirdly, I have edited the sHMDict as below,

Code:

castellatedMesh true;
snap            true;
addLayers      false;

geometry
{
    fanGeo.stl
    {
        type triSurfaceMesh;
        name fanGeo;
    }

    refinementBox
    {
        type searchableBox;
        min (-0.4 0.2 -0.1);
        max (0.4 0.8 0.1);
    }
};

// Settings for the castellatedMesh generation.
castellatedMeshControls
{

    maxLocalCells 2000000;
    maxGlobalCells 20000000;
    minRefinementCells 3;
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 5;

    features
    (
        {
          file "fanGeo.eMesh";
          level 4;
        }
    );

    refinementSurfaces
    {
        fanGeo
        {
            level (4 4);
        }
    }

    // Resolve sharp angles
    resolveFeatureAngle 30;

    refinementRegions
    {
       
    }

    locationInMesh (0.15 0.46 1);

    allowFreeStandingZoneFaces true;
}

// Settings for the snapping.
snapControls
{
    nSmoothPatch 5;
    tolerance 1;
    nSolveIter 300;
    nRelaxIter 5;
    nFeatureSnapIter 20;
}

// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
    maxNonOrtho 65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    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;
}

I tried many cases, but still the edge of the fan is not on the line. see fig.2 (bladeEdge)

please help me to get the good edge snapping.

Thanks,
Sivakumar

wyldckat August 22, 2013 11:46

Hi Sivakumar,

The second image is too far from the blade details. I can't see how many cells you had available for adjusting the mesh to the blade.

Best regards,
Bruno

PS: please use the "[CODE]" markers, as explained on the second link on my signature.

sivakumar August 22, 2013 12:03

Dear Bruno,
Thank you very much for your quick reply, I didnt refine any particular region so far. I am trying to make it possible to use of it.
after getting some experience I want to do refining region and adding layers and so on...

I used the blockMeshDict as follows
Code:

convertToMeters 1;

a 10;
b 10;
c 150;
yi 0.2;
yf 0.8;
zi -1.55;
zf 6.05;
xi -0.4;
xf 0.4;

vertices
(
    ($xi $yi $zi) //0
    ($xf $yi $zi) //1
    ($xf $yf $zi) //2
    ($xi $yf $zi) //3
    ($xi $yi $zf) //4
    ($xf $yi $zf) //5
    ($xf $yf $zf) //6
    ($xi $yf $zf) //7
);


blocks
(
    hex (0 1 2 3 4 5 6 7) ($a $b $c) simpleGrading (1 1 1) // is it possible can I make 3 hex boxes?? instead of 1 so that I can give more refinement for particular region?
);

edges
(
);

patches
(   
);

mergePatchPairs
(
);

If you dont mind please give me some information about defining the patches.

I tried as follows for another case to define patches in the blockMeshDict, but its not working.

convertToMeters 1;

vertices
(
    (-0.2 0 -1.5)
    (0.7 0 -1.5)
    (0.7 0.8 -1.5)
    (-0.2 0.8 -1.5)
    (-0.2 0 -0.1)
    (0.7 0 -0.1)
    (0.7 0.8 -0.1)
    (-0.2 0.8 -0.1)
    (-0.2 0 0)
    (0.7 0 0)
    (0.7 0.8 0)
    (-0.2 0.8 0)
    (-0.2 0 0.1)
    (0.7 0 0.1)
    (0.7 0.8 0.1)
    (-0.2 0.8 0.1)
    (-0.2 0 0.2)
    (0.7 0 0.2)
    (0.7 0.8 0.2)
    (-0.2 0.8 0.2)
    (-0.2 0 6)
    (0.7 0 6)
    (0.7 0.8 6)
    (-0.2 0.8 6)   
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (30 40 100) simpleGrading (1 1 1)
    hex (4 5 6 7 8 9 10 11) (30 40 20) simpleGrading (1 1 1)
   
    hex (8 9 10 11 12 13 14 15)
    fan
    (30 40 60)
    simpleGrading (1 1 1)

    hex (12 13 14 15 16 17 18 19) (30 40 20) simpleGrading (1 1 1)
    hex (16 17 18 19 20 21 22 23) (30 40 500) simpleGrading (1 1 1)
);


boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 3 2 1)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (20 21 22 23)
        );
    }
   
    top0
    {
        type wall;
        faces
        (
            (0 1 5 4)
        );
    }

    top1
    {
        type wall;
        faces
        (
            (4 5 9 8)
        );
    }

    top2
    {
        type wall;     
        faces
        (
            (8 9 13 12)
        );
    }

    top3
    {
        type wall;
        faces
        (
            (12 13 17 16)
        );
    }

    top4
    {
        type wall;
        faces
        (
            (16 17 21 20)
        );
    }

    ILR0
    {
        type cyclic;
        neighbourPatch ILR1;
        faces
        (
            (0 4 7 3)         
        );
    }

    ILR1
    {
        type cyclic;
        neighbourPatch ILR0;
        faces
        (
            (1 5 6 2)         
        );
    }

    CLR0
    {
        type cyclic;
        neighbourPatch CLR1;
        faces
        (
            (4 8 11 7)         
        );
    }

    CLR1
    {
        type cyclic;
        neighbourPatch CLR0;
        faces
        (
            (5 9 10 6)         
        );
    }

    FCLR0
    {
        type cyclic;
        neighbourPatch FCLR1;
        faces
        (
            (12 16 19 15)         
        );
    }

    FCLR1
    {
        type cyclic;
        neighbourPatch FCLR0;
        faces
        (
            (13 17 18 14)         
        );
    }

    OLR0
    {
        type cyclic;
        neighbourPatch OLR1;
        faces
        (
            (16 20 23 19)         
        );
    }

    OLR1
    {
        type cyclic;
        neighbourPatch OLR0;
        faces
        (
            (17 21 22 18)         
        );
    }

    center0
    {
        type wall;     
        faces
        (
            (3 7 6 2)
        );
    }

    center1
    {
        type wall;     
        faces
        (
            (7 11 10 6)
        );
    }

    center2
    {
        type wall;     
        faces
        (
            (15 19 18 14)
        );
    }

    center3
    {
        type wall;     
        faces
        (
            (19 23 22 18)
        );
    }
 
    fan
    {
        type wall;     
        faces
        (
            (8 12 15 11)
            (11 15 14 10)
            (9 13 14 10)
        );
    }

 

);

Thanks,
Sivakumar

wyldckat August 22, 2013 12:45

Hi Sivakumar,

There isn't much I can do with your "blockMeshDict" file. I wanted to see the zoom near the blade's edge, in order to be able to suggest anything useful.

Either way, I suggest that you try to use the currently available GUIs, which I'll quote from here: http://openfoamwiki.net/index.php/Sn..._Interfaces.29
Quote:

SwiftSnap
A very useful plug-in for Blender for configuring snappyHexMeshDict. There is SwiftBlock for blockMeshDict as well!

HelyxOS
A GUI for using OpenFOAM. See the video tutorials:

Best regards,
Bruno

sivakumar August 22, 2013 13:02

5 Attachment(s)
Hi Bruno,
I have attached the some of the zoomed figures,


Thanks,
Sivakumar

wyldckat August 22, 2013 13:23

Hi Sivakumar,

The number of cells available along the width of the blade, near this end of the blade, is far from enough. You need at least 2x the refinement that you have right now, near that end of the blade, for snappyHexMesh to be able to give you a barely good mesh.

The other detail is that you should keep in mind to have a good base mesh that is well aligned with the blade, if possible.
I think the tutorial "incompressible/pimpleDyMFoam/wingMotion", namely the sub-folder "wingMotion_snappyHexMesh", should give you a good idea of how things work.

Best regards,
Bruno

sivakumar August 22, 2013 13:37

Thanks Bruno, I will have a look now.

f0208secretx May 28, 2014 03:03

1 Attachment(s)
Hello all,

I was playing with this surfaceFeatureExtract tool today. Its pretty cool, except that I cannot seem to get it to work.

In particular I am playing with flow over a cube. After the eMesh file was created, I ran snappyHexMesh and got the following error:
Code:


--> FOAM FATAL IO ERROR:
attempt to read beyond EOF

file: /Volumes/OpenFOAM-v2.3.0-git/jui-hsienwang-2.3.x/run/cube/system/snappyHexMeshDict.castellatedMeshControls.features at line 33.

    From function ITstream::read(token&)
    in file db/IOstreams/Tstreams/ITstream.C at line 83.

FOAM exiting

Any ideas where I should look? I attached a couple of related files for your reference. Thanks


JHW

f0208secretx May 28, 2014 16:22

Quote:

Originally Posted by f0208secretx (Post 494442)
Hello all,

I was playing with this surfaceFeatureExtract tool today. Its pretty cool, except that I cannot seem to get it to work.

In particular I am playing with flow over a cube. After the eMesh file was created, I ran snappyHexMesh and got the following error:
Code:


--> FOAM FATAL IO ERROR:
attempt to read beyond EOF

file: /Volumes/OpenFOAM-v2.3.0-git/jui-hsienwang-2.3.x/run/cube/system/snappyHexMeshDict.castellatedMeshControls.features at line 33.

    From function ITstream::read(token&)
    in file db/IOstreams/Tstreams/ITstream.C at line 83.

FOAM exiting

Any ideas where I should look? I attached a couple of related files for your reference. Thanks


JHW


I managed to wipe my own ass. The correct snappyHexMeshDict file should have
Code:

    features
    (
      {
          file  "cube.eMesh";
          level 1;
      }
    );

But my original one is
Code:

    features
    (
          file  "cube.eMesh";
          level 1;
    );

Lesson learned! Great tool for sharp edges.


JHW

Alhasan January 14, 2016 15:13

Trailing edge not a problem
 
4 Attachment(s)
Hi All,

I have been trying to mesh this particular geometry for more than a month now, this is my final resort to ask on the forums.

What ever I do the trailing edge of the airfoil is always deforming and the sides of the serrations are always having some deformity and not having the smooth finish as th top of the airfoil.

Here is my SappyCode
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.0.1                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.com                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
castellatedMesh true;
snap            true;
addLayers      false;

geometry
{
    Blade.stl
    {
        type triSurfaceMesh;
        name Blade;
    }

};


castellatedMeshControls
{

    maxLocalCells 999999999;

    maxGlobalCells 999999999;

    minRefinementCells 10;

    maxLoadUnbalance 0.10;

    nCellsBetweenLevels 3;

    resolveFeatureAngle 30;//60 require high values

    allowFreeStandingZoneFaces true;

    locationInMesh (-0.0005 0.0005 0.0009);

    features
    (
        {
            file "Blade.eMesh";
            level 0;
        }
    );


    refinementSurfaces
    {
        Blade
        {

            level (4 4);
        }
    }

    refinementRegions
    {
        Blade
        {
            mode distance;
            levels ((0.005 2)(0.01 1));
        }

    }
}


snapControls
{
 
    nSmoothPatch 10;
    tolerance 4;
    nSolveIter 300;
    nRelaxIter 10;
    nFeatureSnapIter 20;
    implicitFeatureSnap false;
    explicitFeatureSnap true;
    multiRegionFeatureSnap true; //only for explicitFeature, Deafault = false
}


addLayersControls
{
    relativeSizes true;
    layers
    {
    Blade_solid
        {
            nSurfaceLayers 5;
        }
    }
    expansionRatio 1.0;
    finalLayerThickness 0.8;
    minThickness 0.001;//1e-15
    nGrow 0;
    featureAngle 90;//180

    nRelaxIter 100;//15

    nSmoothSurfaceNormals 10;//1
    nSmoothNormals 30;
    nSmoothThickness 30;//10

    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 90;
    nBufferCellsNoExtrude 0;
    nLayerIter 50;
}

meshQualityControls
{
    maxNonOrtho 65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minVol 1e-13;
    minTetQuality 1e-9;//1e-30
    minArea -1;
    minTwist 0.05;//0.02
    minDeterminant 0.001;
    minFaceWeight 0.05;//0.02
    minVolRatio 0.01;
    minTriangleTwist -1;
    nSmoothScale 4;
    errorReduction 0.75;
    relaxed
    {
        maxNonOrtho 75;// 180 to disable
    }

}

debug 0;
mergeTolerance 1E-6;


// ************************************************************************* //

I have tried everything from playing with the feature angle, the tolerence levels, snapp controls, surfacefeature extract is at 150 and all of the control values etc. How ever I must say the following wyldckat comment helped a lot
Quote:

Originally Posted by wyldckat (Post 447514)
The number of cells available along the width of the blade, near this end of the blade, is far from enough. You need at least 2x the refinement that you have right now, near that end of the blade, for snappyHexMesh to be able to give you a barely good mesh.

i increased the number of cells in the domain to get better results but still not the surface finish I am looking for,

Even the surface layers were showing deformities now and then, about 70% of the airfoil had good surfacelayer mesh but suddenly there is a deformity similar to disscussed by artur, so as now I have planned to follow Arthurs suggestion but If there is any other way to get the surface mesh sorted in snappyHexMesh itself I will be very happy.
Quote:

Originally Posted by Artur (Post 490618)
Perhaps it's worth to do it in a few steps: run snappy without layer addition first, get a decent mesh; when you're happy with it save it and try adding some layers in; you can do these in a few steps too to get some coarser ones into the outer BL regions and really fine ones close to the wall. This way you may find it easier to figure out which parameters affect your particular geometry the most. And you won't have to re-mesh everything when willing to just change one layer parameter.

So, long story short, How to get a fine finish on the triangle shapes of my trailing edge, and also stop the deformity of the very final tip of my trailing edge.

This is just very fine tuning of the surface finish of the mesh as we are interested in the surface boundary layer of the airfoil, the mesh on the surface of the airfoil is absolutely fine only when close to the trailing edge and the thin trailing edge that is causing this issue

Thanks for your time and efforts,
Hasan K.J

wyldckat March 28, 2016 15:35

Greetings Hasan K.J,

I've had this post of yours on my to-do list for quite sometime now and unfortunately I only managed to take a look into it today :(.

Without access to the geometry or at least a test case to work with, I will have to guess that:
  • snapControls.nSmoothPatch: set this to 0. It's only useful for curved surfaces, at least from my experience.
  • snapControls.tolerance: set this to 1 or 0.5, to reduce the snapping range.
  • snapControls.multiRegionFeatureSnap: set to false, unless you are actually making a a multi-region mesh.
Beyond this, my guess would be that there might be something wrong with the STL file. You can try checking it with surfaceCheck.


The other possibility that comes to mind is that you should have a refinement region better refined:
Code:

Blade
        {
            mode distance;
            levels ((0.0005 4)(0.001 3)(0.005 2)(0.01 1));
        }

Or to even have a specific refinement box along the trail of the blade, to ensure that snappyHexMesh is able to see the refinement region that you're asking for.

The other possibilities that comes to mind are:
  1. Using foamyHexMesh, which is a more surface-oriented mesher, but I have never used it myself.
  2. Using cfMesh, which is fairly easier to use and a lot faster in many cases: https://sourceforge.net/projects/cfmesh/
Best regards,
Bruno


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