/*--------------------------------*- 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.21  -0.10    -0.10);
        max ( 0.30  -0.013    0.10);
	}   
};




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
         }

    }

    locationInMesh (0.05 0.01 0.05);
    
    
    allowFreeStandingZoneFaces true;
}



snapControls
{
    nSmoothPatch 3;

    tolerance 2.0;

    nSolveIter 30;

    nRelaxIter 5;

    //nFeatureSnapIter 10;
}

addLayersControls
{
   relativeSizes false;

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

   // thickness 0.01;
    expansionRatio 1.19;
    //finalLayerThickness 0.0007;
    firstLayerThickness 0.00002;
    minThickness 0.00000001;

    nGrow 0;


    featureAngle 60;

    nRelaxIter 5;

    nSmoothSurfaceNormals 1;

    nSmoothNormals 3;

    nSmoothThickness 10;

    maxFaceThicknessRatio 0.5;

    maxThicknessToMedialRatio 0.3;

    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;


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