/*--------------------------------*- 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_0;
    }
	surface1 // avant seuil
    {
        type searchableBox;
        min ( -0.4 -0.025 -0.00018 );
        max (  0.4  0.025  0.00018 );
	}
        surface2
     {
        type searchableBox;
        min ( -0.2 -0.04 -0.00018 );
        max (  0.2  0.15  0.00018 );
        }
        surface3 
     {
        type searchableBox;
        min ( -0.4  0.0  -0.00018 );
        max (  0.4  0.15  0.00018 );
        }
/*
        surface4
    {
        type searchableBox;
        min ( -0.12  -0.06	  0.0     );
        max (  0.12  -0.04  0.001   );
        }
        surface5
    {
        type searchableBox;
        min ( -0.07  -0.075  0.0     );
        max (  0.07  -0.05  0.001   );
        }
	surface6
    {
        type searchableBox;
        min ( -0.35 -0.025  0.0     );
        max (  0.35  0.01  0.001   );
        }
        surface7
    {
        type searchableBox;
        min (  -0.15  -0.03  0.0     );
        max (   0.15   0.05  0.001   );
        }
        surface8
    {
        type searchableBox;
        min (  -1.0   -0.045  0.0     );
        max (   1.0   -0.025  0.001   );
        }
        surface9
    {
        type searchableBox;
        min (  -0.35 -0.025  0.0     );
        max (   0.35  0.005  0.001   );
        }
*/
};




castellatedMeshControls
{

    maxLocalCells 1000000;


    maxGlobalCells 4000000;

    minRefinementCells 0;

    maxLoadUnbalance 0.10;

    nCellsBetweenLevels 6;

    features
    ();

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

    resolveFeatureAngle 30;

    refinementRegions
    {
   
        
        surface1
         {
            mode inside;
            levels ((1E15 1));//1
         }
       surface2
        {
           mode inside;
           levels ((1E15 1));//1
        }
       surface3
        {
            mode inside;
            levels ((1E15 1));//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
        }
       surface9
        {
            mode inside;
            levels ((1E15 2));//1
        }
*/
    }


    locationInMesh (-0.399 0.0 0.0);


    allowFreeStandingZoneFaces true;
}



snapControls
{
    nSmoothPatch 3;

    tolerance 1.0;

    nSolveIter 30;

    nRelaxIter 5;

    //nFeatureSnapIter 10;
}

addLayersControls
{
   relativeSizes false;

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

   // thickness 0.01;
  //  expansionRatio 1.225832448;
    expansionRatio 1.1;
    //finalLayerThickness 0.0007;
    firstLayerThickness 0.002;
    minThickness 0.00000001;

    nGrow 0;


    featureAngle 175;

    nRelaxIter 5;

    nSmoothSurfaceNormals 1;

    nSmoothNormals 3;

    nSmoothThickness 10;

    maxFaceThicknessRatio 0.5;

    maxThicknessToMedialRatio 0.3;

//    minMedianAxisAngle 90;
    minMedialAxisAngle 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;


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