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

// Which of the steps to run
castellatedMesh true;
snap            true;
addLayers       true; //pour ajouter des couches près des parois


// Geometry. Definition of all surfaces. All surfaces are of class
// searchableSurface.
// Surfaces are used
// - to specify refinement for any mesh cell intersecting it
// - to specify refinement for any mesh cell inside/outside/near
// - to 'snap' the mesh boundary to the surface
geometry
{
    Cylinder.stl
    {
        type triSurfaceMesh;
        name cylinder;
    }
   
	surface1 // avant seuil
    {
        type searchableBox;
        min (-0.03  -0.025    0.0 );
        max ( 0.1   0.05     0.001);
	}

        surface2
     {
        type searchableBox;
        min (-0.75    -0.03  0.0     );
        max ( 1.6  -0.02  0.001   );
        }

        surface3 
     {
        type searchableBox;
        min (-0.1    -0.045  0.0     );
        max ( 0.2   -0.025  0.001   );
        }

        surface4
    {
        type searchableBox;
        min ( -0.07  -0.06	  0.0     );
        max (  0.12  -0.04  0.001   );
        }


        surface5
    {
        type searchableBox;
        min ( -0.06  -0.075  0.0     );
        max (  0.07  -0.05  0.001   );
        }

	surface6
    {
        type searchableBox;
        min (  0.0 -0.025  0.0     );
        max (  0.35  0.01  0.001   );
        }
        surface7
    {
        type searchableBox;
        min (  -0.15  -0.03  0.0     );
        max (   0    0.05  0.001   );
        }
        surface8
    {
        type searchableBox;
        min (  -0.75  -0.045  0.0     );
        max (  -0.5   -0.025  0.001   );
        }
};




castellatedMeshControls
{

    maxLocalCells 1000000;


    maxGlobalCells 4000000;

    minRefinementCells 0;

    maxLoadUnbalance 0.10;

    nCellsBetweenLevels 3;

    features
    ();

    refinementSurfaces
    {
        cylinder
        {
            level (1 1);
        }
    }

    resolveFeatureAngle 30;

    refinementRegions
    {
   
        
        surface1
        {
            mode inside;
            levels ((1E15 2));//1
        }
       surface2
       {
           mode inside;
           levels ((1E15 2));//1
       }

       surface3
        {
            mode inside;
            levels ((1E15 2));//1
        }


       surface4
        {
            mode inside;
            levels ((1E15 2));//1
        }

       surface5
        {
            mode inside;
            levels ((1E15 2));//1
        }

       surface6
        {
            mode inside;
            levels ((1E15 2));//1
        }
       surface7
        {
            mode inside;
            levels ((1E15 1));//1
        }
       surface8
        {
            mode inside;
            levels ((1E15 2));//1
        }
    }


    locationInMesh (-0.1 0.2 0.00001);


    allowFreeStandingZoneFaces true;
}



snapControls
{
    nSmoothPatch 3;

    tolerance 2.0;

    nSolveIter 30;

    nRelaxIter 5;

    //nFeatureSnapIter 10;
}

addLayersControls
{
   relativeSizes false;

    layers
    {
        "(cylinder).*"
        {
            nSurfaceLayers 5;// nb de couches à ajouter prés des parois
        }
    }

   // thickness 0.01;
    expansionRatio 1.01;
    //finalLayerThickness 0.0007;
    firstLayerThickness 0.0006;
    minThickness 0.00000001;

    nGrow 0;


    featureAngle 60;

    nRelaxIter 5;

    nSmoothSurfaceNormals 1;

    nSmoothNormals 3;

    nSmoothThickness 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-30;

    minArea -1;

    minTwist 0.05;

    minDeterminant 0.001;

    minFaceWeight 0.05;

    minVolRatio 0.01;

    minTriangleTwist -1;


    nSmoothScale 4;
    errorReduction 0.75;
}



debug 0;


mergeTolerance 1e-6;


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