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] Sphere in a channel by snappyHexMesh (https://www.cfd-online.com/Forums/openfoam-meshing/180011-sphere-channel-snappyhexmesh.html)

arsalan.dryi November 14, 2016 16:01

Sphere in a channel by snappyHexMesh
 
1 Attachment(s)
Dear Foamers,

I want to mesh a sphere inside a channel in both regions of inside and outside of the sphere. For this purpose, I'm trying to mesh these regions separately using sHM and merge them using mergeMesh.( Do you have any better suggestion??!)
For the region outside of the sphere, I'm using Tobias' tutorial (many thanks to him for great tutorials) but with my defined regions not the stl surfaces. ( I also used the stl surfaces, but with no success!)
My problem is snapping not works properly when a finer grid is used as the background mesh by blockMesh, or when I use high levels for refinement region around the sphere. And as a result of bad snapping, layering procedure not works!
My sHM dict is as follows:
Code:

 
// Which of the steps to run
castellatedMesh  true;
snap              true;
addLayers        true;

geometry
{

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

};

// Settings for the castellatedMesh generation.
castellatedMeshControls
{

    maxLocalCells 1000000;

    maxGlobalCells 2000000;


    minRefinementCells 0;


    maxLoadUnbalance 0.0;


    nCellsBetweenLevels 3;

    features
    (

    );


    refinementSurfaces
    {
       
        sphere
        {
            // Surface-wise min and max refinement level
            level (3 3);
        }
    }

    resolveFeatureAngle 60;


    refinementRegions
    {

    }

    locationInMesh (0.01 0.01 0.01);


    allowFreeStandingZoneFaces no;
}


snapControls
{
 
    nSmoothPatch 3;

    tolerance 1.2;

    nSolveIter 185;


    nRelaxIter 4;


        nFeatureSnapIter 5;


        implicitFeatureSnap false;

        explicitFeatureSnap true;

        multiRegionFeatureSnap false;
}


addLayersControls
{

    relativeSizes true;

    layers
    {
        sphere
        {
            nSurfaceLayers  6;
        }
    }

    // Expansion factor for layer mesh
    expansionRatio 1.1;

    finalLayerThickness 0.7;

    minThickness 0.0001;

    nGrow 0;

 
    featureAngle 85;

    slipFeatureAngle 25;

    nRelaxIter 5;

    nSmoothSurfaceNormals 4;

    nSmoothNormals 3;

    nSmoothThickness 10;

    maxFaceThicknessRatio 0.5;

    maxThicknessToMedialRatio 0.2;
    minMedianAxisAngle 90;

    nBufferCellsNoExtrude 0;

    nLayerIter 50;
}

meshQualityControls
{
    #include "meshQualityDict"
    //- Number of error distribution iterations
    nSmoothScale 4;
    //- amount to scale back displacement at error points
    errorReduction 0.75;
}

writeFlags
(
    scalarLevels
    layerSets
    layerFields    // write volScalarField for layer coverage
);

mergeTolerance 1e-6;

And here is blockMeshDict :
Code:

convertToMeters 0.0005;

vertices
(
    (-30 -30  -30)
    ( 30 -30  -30)
    ( 30  30  -30)
    (-30  30  -30)
    (-30 -30  30)
    ( 30 -30  30)
    ( 30  30  30)
    (-30  30  30)
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (60 60 60) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    maxY
    {
        type wall;
        faces
        (
            (3 7 6 2)
        );
    }
    minX
    {
        type wall;
        faces
        (
            (0 4 7 3)
        );
    }
    maxX
    {
        type wall;
        faces
        (
            (2 6 5 1)
        );
    }
    minY
    {
        type wall;
        faces
        (
            (1 5 4 0)
        );
    }
    minZ
    {
        type wall;
        faces
        (
            (0 3 2 1)
        );
    }
    maxZ
    {
        type wall;
        faces
        (
            (4 5 6 7)
        );
    }
);

mergePatchPairs
(
);

For example the whole meshing procedure works well with a 30*30*30 grid and refinement levels of (3 3) around the sphere, but increasing grid numbers to 60*60*60 results bad snapping and no layer around the sphere. while with a 60*60*60 grid and refinement levels of (1 3) around the sphere, everything works well!
I really need to high levels of refinement around the sphere and a finer grid of the whole domain together.

Any help and comment will be appreciated.
Regards,
Arsalan.


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