/*--------------------------------*- 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
{


//	surface1 
   // {
    //    type searchableBox;
      //  min (-0.5 0.000 -0.005 );
  //      max (0.5 0.007 0.005 );
//	}
	surface2 
    {
       type searchableBox;
        min (-0.5 0.000 -0.005 );
        max (0.4 0.008 0.005 );
	}
	surface3 
    {
        type searchableBox;
        min (0.4 0.0000 -0.005 );
        max (0.5 0.015 0.005 );
	}

};




castellatedMeshControls
{

    maxLocalCells 1000000;


    maxGlobalCells 4000000;

    minRefinementCells 0;

    maxLoadUnbalance 0.10;

    nCellsBetweenLevels 3;

    features
    ();


    resolveFeatureAngle 30;
    
    refinementSurfaces
    {

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

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


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