/*--------------------------------*- 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       false; //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
{
    Cyl.stl
    {
        type triSurfaceMesh;
        name cylinder;
   }
  

    cylinderRef
    {
    type searchableCylinder;
    point1 (0.0 -0.005 0.1);
    point2 (0.0 0.005 0.1);
    radius 0.005;
    }

   
	//surface1 
    //{
    //    type searchableBox;
    //    min (-0.02 0.08 -0.005 );
   //     max (0.02 0.12 0.005 );
	//}
	//surface2
  ////  {
	//type searchableBox;
	//min ( -0.15   -0.046  0 );
	//max (  0.15   -0.040  0.001 );
  //  }

};




castellatedMeshControls
{

    maxLocalCells 1000000;


    maxGlobalCells 4000000;

    minRefinementCells 0;

    maxLoadUnbalance 0.10;

    nCellsBetweenLevels 3;

    features
    ();

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

    resolveFeatureAngle 30;

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


    }


    locationInMesh (0.0 0.0035 0.00025 );


    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.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;

    minMedianAxisAngle 90;


    nBufferCellsNoExtrude 0;


    nLayerIter 50;
}



meshQualityControls
{
    maxNonOrtho 65;

    maxBoundarySkewness 20;
    maxInternalSkewness 4;

    maxConcave 80;

    minVol 1e-13;

    minTetQuality 1e-30;

    minArea -1;

    minFlatness 0.5;


    minTwist 0.05;

    minDeterminant 0.001;

    minFaceWeight 0.05;

    minVolRatio 0.01;

    minTriangleTwist -1;


    nSmoothScale 4;
    errorReduction 0.75;
}



debug 0;


mergeTolerance 1e-6;


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