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

simple sphere with snappyhexmesh

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

Like Tree3Likes
  • 1 Post By Duncan_vdH
  • 1 Post By norman1981
  • 1 Post By Ivooo

Reply
 
LinkBack Thread Tools Display Modes
Old   May 31, 2011, 11:18
Default simple sphere with snappyhexmesh
  #1
New Member
 
Duncan Roy van der Heul
Join Date: May 2010
Posts: 14
Rep Power: 7
Duncan_vdH is on a distinguished road
I tried to use SHM, but I hope I am doing something wrong, because the result is a bit disappointing. The snapping does not make a good approximation of the actual surface. I played around with the four snapping parameters but their influence is not so great.
Am I missing something, or is this the best SHM can do?

The STL file I am using is a very high resolution description of a sphere using triangles.
The pictures show the inner surface of the mesh in paraFoam: the castellated case, the snapped case (next time level) and the snapped case together with the geometry.

Any ideas would be appreciated!

Kind regards.
Duncan
Attached Images
File Type: png castellated_sphere.png (45.2 KB, 210 views)
File Type: png snapped_sphere.png (85.9 KB, 197 views)
File Type: png geom_sphere.png (96.8 KB, 237 views)
y_jiang likes this.

Last edited by Duncan_vdH; May 31, 2011 at 11:21. Reason: try to make post more clear.
Duncan_vdH is offline   Reply With Quote

Old   June 22, 2011, 03:31
Default sphere with snappyHexMesh
  #2
Member
 
Erik Arlemark
Join Date: Mar 2009
Location: Eindhoven, Netherlands
Posts: 47
Rep Power: 8
Erik is on a distinguished road
Hi Duncan,

It seems that the snapping is not working in your case. I am also trying to mesh a sphere. I get a smooth surface with the snapp function. However I can't manage to add layers.

You can have a look at my snappyHexMeshDict and blockMeshDict for this.

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.0.0                                 |
|   \\  /    A nd           | Web:      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       true;


geometry
{

    sphere
    {
        type searchableSphere;
        centre  (0 0 0);
        radius  0.1;
    }
};

castellatedMeshControls
{
    maxLocalCells 1000000;
    maxGlobalCells 2000000;
    minRefinementCells 0;
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 1;
    features
    (
    );
    refinementSurfaces
    {  
        sphere
        {
            level (2 2);
        /*    regions
            {
                secondSolid
                {
                    level (5 5);
                }
            }
        */
            patchInfo
            {
                type wall;
            }
        }
        
    }

    resolveFeatureAngle 30;
    refinementRegions
    {
    }
    locationInMesh (0.11 0 0);
    allowFreeStandingZoneFaces true;
}


snapControls
{
    nSmoothPatch 3;
    tolerance 1.0;
    nSolveIter 30;
    nRelaxIter 3;
}

addLayersControls
{
    relativeSizes true;
    layers
    {
        sphere_region0
        {
            nSurfaceLayers 2;

        }

    }

    expansionRatio 1.0;
//    finalLayerThickness 1e-9;
finalLayerThickness 0.01;
    finalLayerRatio 0.01;
    minThickness 0;
    nGrow 1;
    featureAngle 60;
    nRelaxIter 5;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 90;
    nBufferCellsNoExtrude 0;
    nLayerIter 50;
    nRelaxedIter 20;
}

meshQualityControls
{
    maxNonOrtho 65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minVol 1e-200;
    minTetQuality 1e-9;
    minArea -1;
    minTwist 0.05;
    minDeterminant 0.001;
    minFaceWeight 0.05;
    minVolRatio 0.00001;
    minTriangleTwist -1;

    nSmoothScale 4;
    errorReduction 0.75;

    relaxed
    {
        maxNonOrtho 75;
    }
}

debug 0;
mergeTolerance 1e-6;

// ************************************************************************* //
If you or anyone else know how to get the layers of mesh around the sphere please let me know.

ps. here the sphere is in unit order of length scale but once I get the layers right, I will want to mesh a micro sized sphere.

Best regards,
Erik Arlemark
Attached Images
File Type: jpg corseSphere.jpg (94.1 KB, 274 views)
File Type: jpg snappedSphere.jpg (94.6 KB, 361 views)
Attached Files
File Type: txt blockMeshDict.txt (1.5 KB, 118 views)
Erik is offline   Reply With Quote

Old   June 22, 2011, 07:45
Default
  #3
New Member
 
Duncan Roy van der Heul
Join Date: May 2010
Posts: 14
Rep Power: 7
Duncan_vdH is on a distinguished road
Hi Erik,

Thanks for responding.

I found an error in my Blockmeshdict and now have a smooth sphere and layers. And a different opinion on Snappyhexmesh :-).

I basically went back to the Iglo tutorial and started from that. Remove all the internal stuff and use the Iglo geometry as the basis.
I would recommend starting with all the settings for layer control from that tutorial. I think many of your grid quality parameters are quite different form that testcase.

Now I have layers too!

If you redirect output to file, is layer generation mentioned in the output?

I can send you the files I am using, just email me.
Duncan_vdH is offline   Reply With Quote

Old   June 22, 2011, 11:12
Default sphere with snappyHexMesh
  #4
Member
 
Erik Arlemark
Join Date: Mar 2009
Location: Eindhoven, Netherlands
Posts: 47
Rep Power: 8
Erik is on a distinguished road
Hi Duncan,

Thanks for your reply. I now managed to get layers to the sphere as well. I will also have a look at the Igloo case as you suggested. Maybe I can optimize the mesh for my purpose.

picure of mesh and snappyHexMeshDict is attached in case anyone else is interested.

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.0.0                                 |
|   \\  /    A nd           | Web:      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       true;


geometry
{

    sphere
    {
        type searchableSphere;
        centre  (0 0 0);
        radius  0.1;
    }
};

castellatedMeshControls
{
    maxLocalCells 1000000;
    maxGlobalCells 2000000;
    minRefinementCells 0;
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 1;
    features
    (
    );
    refinementSurfaces
    {  
        sphere
        {
            level (2 1);
        /*    regions
            {
                secondSolid
                {
                    level (5 5);
                }
            }
        */
            patchInfo
            {
                type wall;
            }
        }
        
    }

    resolveFeatureAngle 30;
    refinementRegions
    {
    /*	sphere
    	{
    		mode outside;
    		levels ((1.0 1));
    	}
    */
    }
    locationInMesh (0.11 0 0);
    allowFreeStandingZoneFaces true;
}


snapControls
{
    nSmoothPatch 3;
    tolerance 1.0;
    nSolveIter 30;
    nRelaxIter 5;
}

addLayersControls
{
    relativeSizes false;
    layers
    {
        sphere_region0
        {
            nSurfaceLayers 2;

        }

    }

    expansionRatio 1.0;
//    finalLayerThickness 1e-9;
finalLayerThickness 0.1;
    finalLayerRatio 0.01;
    minThickness 0.002;
    nGrow 0;
    featureAngle 30;
    nRelaxIter 10;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 40;
    nBufferCellsNoExtrude 0;
    nLayerIter 100;
    nRelaxedIter 20;
}

meshQualityControls
{
    maxNonOrtho 65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minVol 1e-200;
    minTetQuality 1e-9;
    minArea -1;
    minTwist 0.05;
    minDeterminant 0.001;
    minFaceWeight 0.05;
    minVolRatio 0.01;
    minTriangleTwist -1;

    nSmoothScale 4;
    errorReduction 0.75;

    relaxed
    {
        maxNonOrtho 75;
    }
}

debug 0;
mergeTolerance 1e-6;

// ************************************************************************* //
Many thanks,
Erik
Attached Images
File Type: jpg snappedSphereLayer.jpg (96.9 KB, 314 views)
Erik is offline   Reply With Quote

Old   June 22, 2011, 11:18
Default
  #5
New Member
 
Duncan Roy van der Heul
Join Date: May 2010
Posts: 14
Rep Power: 7
Duncan_vdH is on a distinguished road
Hi Erik,

I also have these small, very slender elements in my mesh like I see in your case, away from the sphere.
Do you or anybody else know how to suppress these or make them disappear? I played around with the minimum volume setting, but this had little effect.

Cheers,
Duncan
Duncan_vdH is offline   Reply With Quote

Old   June 24, 2011, 03:36
Default
  #6
Member
 
Erik Arlemark
Join Date: Mar 2009
Location: Eindhoven, Netherlands
Posts: 47
Rep Power: 8
Erik is on a distinguished road
Hi Duncan and all,

Yes indeed, I also would like to get rid of the very small cells and I can not seem to get the minVolRatio entry to control this. Thanks for the advise of looking at the igloo case. I will give this a try.

Cheers,
Erik
Erik is offline   Reply With Quote

Old   June 29, 2011, 07:32
Default sphere with snappyHexMesh
  #7
Member
 
Erik Arlemark
Join Date: Mar 2009
Location: Eindhoven, Netherlands
Posts: 47
Rep Power: 8
Erik is on a distinguished road
Hi Duncan and all,

It seems a nice mesh of the sphere (see figure here) can be made for specific configurations of number of cells in x-,y- and z-direction, being set in the blockMeshDict file. If an ill-favored number or background mesh is chosen the small cells appear (as I have posted above). Attached is also a spherical cavity, created by setting the locationInMesh entry to a point inside the created sphere.

ps. For the figure attached, I prefer to have only one relatively thick layer next to the sphere but this is not necessary for producing a clean mesh of the sphere with layers.

Cheers,
Erik
Attached Images
File Type: jpg sphericalCavity.jpg (99.9 KB, 287 views)
File Type: jpg sphericalOstacal.jpg (103.5 KB, 286 views)
Attached Files
File Type: txt snappyHexMeshDictCavity.txt (2.7 KB, 111 views)
File Type: txt snappyHexMeshDictSphere.txt (2.8 KB, 204 views)
File Type: txt blockMeshDict.txt (1.5 KB, 140 views)
Erik is offline   Reply With Quote

Old   July 6, 2011, 07:11
Default
  #8
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 6
lindstroem is on a distinguished road
Hi Erik,

would it be possible that you also post your stl file? it looks quite promising what you did and i would like to give it a try too.

Thanks in advance!
lindstroem is offline   Reply With Quote

Old   July 7, 2011, 02:42
Default
  #9
Member
 
norman1981's Avatar
 
Norman Del Puppo
Join Date: Mar 2009
Location: Hinwil, CH
Posts: 57
Rep Power: 8
norman1981 is on a distinguished road
Quote:
Originally Posted by lindstroem View Post
Hi Erik,

would it be possible that you also post your stl file? it looks quite promising what you did and i would like to give it a try too.

Thanks in advance!
You don't need it because Erik used a searchableSphere object to generate the sphere, look at the snappyHexMeshDict and you'll find these lines:

geometry
{

sphere
{
type searchableSphere;
centre (0 0 0);
radius 0.1e-7;
}
};

Regards

Norman
anishtain4 likes this.
norman1981 is offline   Reply With Quote

Old   July 7, 2011, 05:13
Default
  #10
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 6
lindstroem is on a distinguished road
oh - thanks for the information.. didn't know, that shm has this function too!
lindstroem is offline   Reply With Quote

Old   March 20, 2012, 12:47
Default
  #11
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 6
lindstroem is on a distinguished road
Hi again,

I was trying to add a boundary layer to my sphere. To compute the flow around a sphere i meshed a quarter of a sphere and wanted to refine the boundary layer. I am not so sure, how to deal with the "addLayersControls" which should do that if I understood everything correct.

I added my blockmesh and snappyHexMeshDict.

--
Edit: the
layers
{
sphere
{
nSurfaceLayers 5;
}
}
in the provided SHMDict needs to be sphere_region0 (or?) but it does not change anything...
---

Thanks in advance!
Attached Files
File Type: txt blockMeshDict.txt (1.3 KB, 23 views)
File Type: txt snappyHexMesh.txt (4.4 KB, 34 views)

Last edited by lindstroem; March 20, 2012 at 13:14.
lindstroem is offline   Reply With Quote

Old   March 20, 2012, 17:13
Default
  #12
New Member
 
Duncan Roy van der Heul
Join Date: May 2010
Posts: 14
Rep Power: 7
Duncan_vdH is on a distinguished road
Hi,
I completely switched over to using SALOME for meshing and have no regrets!
You should check it out, it works like a charm.
Regards,
Duncan
Duncan_vdH is offline   Reply With Quote

Old   March 30, 2012, 10:14
Default Sphere using blockMeshing
  #13
New Member
 
Ivo
Join Date: Feb 2012
Posts: 22
Rep Power: 5
Ivooo is on a distinguished road
I think this would be the best place to share my .m4 file of a sphere or spheroid created using several blocks and arc-edges, as opposed to using a utility such as snappyHexMesh. The advantage is that it creates a body-conformal mesh around the spher(e/oid).

Why?
I have seen that a droplet on a cylindrical surface created using SHM has an unphysical contact line (see image attached), and if I create a cylinder using blockmeshing only (see tutorial of the chargedWire), the contactline is nice and smooth. In addition, the SHM method did not allow me to use parallel+interDyMFoam, and the blockmesh version does. Hence, I felt that creating a sphere using blockMesh only will also improve results and since it took me a day or so I thought I'd share.
Attached Images
File Type: jpg fibreMeshInfluence_differentSize1.jpg (97.6 KB, 193 views)
File Type: jpg sphereMesh.jpg (80.8 KB, 219 views)
Attached Files
File Type: txt blockMeshDict.m4.txt (40.9 KB, 116 views)
atg likes this.
Ivooo is offline   Reply With Quote

Old   May 17, 2012, 05:04
Post Unable to see Sphere in ParaFoam
  #14
New Member
 
Amit Mangtani
Join Date: May 2012
Posts: 5
Rep Power: 5
amitmangtani is on a distinguished road
Hi Erik,
I am new to OpenFoam and i've been told to do CFD of the cylinder in which a sphere is placed inside the cylinder as an obstacle... I have been able to make the structured grid for cylinder but still not able to figure out the unstructured grid around the sphere...
I have looked your both Dict files and after using them i am not able to see the unstructured grid around sphere in ParaFoam..

Can you please me suggest me the mistake?? No error has been showing in terminal but when i open the ParaFoam i can only see the block domain which is created by blockmesh and nothing else.. So i'm little confused now that what snappyHexMesh does??

Regards,
Amit Mangtani

Quote:
Originally Posted by Erik View Post
Hi Duncan and all,

It seems a nice mesh of the sphere (see figure here) can be made for specific configurations of number of cells in x-,y- and z-direction, being set in the blockMeshDict file. If an ill-favored number or background mesh is chosen the small cells appear (as I have posted above). Attached is also a spherical cavity, created by setting the locationInMesh entry to a point inside the created sphere.

ps. For the figure attached, I prefer to have only one relatively thick layer next to the sphere but this is not necessary for producing a clean mesh of the sphere with layers.

Cheers,
Erik

Last edited by amitmangtani; May 17, 2012 at 08:18.
amitmangtani is offline   Reply With Quote

Old   August 9, 2012, 09:54
Default
  #15
New Member
 
Join Date: Apr 2011
Location: Magdeburg, Germany
Posts: 23
Rep Power: 6
Nico A. is on a distinguished road
Hello Ivo,

I am also doing simulations of a flow around a sphere. I also generated some structured grids, but they did not have a sufficient quality at the sphere surface. But your grids looks really, really good, thanks for the dict at this point. I also tried to understand what you have done and i wanted to add some new blocks for my case. But unfortunately I just got errors during blockMeshing.

As you can see in the attached file, I would like to create a wake area behind the sphere in z-direction (about 7*Lenght of the current domain). So can you help me with it, or give me some hints, how do realize this? Thanks in advance.

Best regards, Nico
Attached Images
File Type: jpg Sphere_wake.jpg (43.4 KB, 101 views)
Nico A. is offline   Reply With Quote

Old   August 9, 2012, 09:59
Default
  #16
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 6
lindstroem is on a distinguished road
you need to make sure, that your cells fit the cells of the neighboring block. Maybe that can help you:
How to handle internal patches for p,T,U
or you use the same discretization in x and y direction as in the "master"block
greetings
lindstroem is offline   Reply With Quote

Old   August 9, 2012, 10:06
Default
  #17
New Member
 
Ivo
Join Date: Feb 2012
Posts: 22
Rep Power: 5
Ivooo is on a distinguished road
Dear Nico,

As lindstroem mentions, you'd have to connect your other mesh blocks to the same grid. You might want to use pyFoamDisplayBlockMesh to distinguish the different blocks. Once that's fixed and you still get errors, please post the errors so people can have a clue what's going on.

Cheers
I
Ivooo is offline   Reply With Quote

Old   August 9, 2012, 11:43
Default
  #18
New Member
 
Join Date: Apr 2011
Location: Magdeburg, Germany
Posts: 23
Rep Power: 6
Nico A. is on a distinguished road
Thank you both for the very quick answers. I now decided to use the extrudeMesh utility, which works fine so far, I hope the results will show that.
Nico A. 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
chtMultiRegionFoam + Sphere mesh + makeCellset.setSets alvora OpenFOAM 4 March 22, 2011 03:44
Snappyhexmesh - simple question. atareen64 OpenFOAM Native Meshers: snappyHexMesh and Others 0 March 16, 2011 15:02
snappyHexMesh simple help! atareen64 OpenFOAM Native Meshers: snappyHexMesh and Others 0 March 2, 2011 16:52
A few simple questions about SnappyHexMesh. suitup OpenFOAM Native Meshers: snappyHexMesh and Others 1 December 19, 2009 15:30
meshing F1 front wing Steve FLUENT 0 April 17, 2003 12:37


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