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

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
castellatedMesh true;
snap           false;
addLayers       false;

geometry
{
    
	
	
	inlet.stl
    {
        type triSurfaceMesh;
        name inlet;
    }
	
	
	outlet.stl
    {
        type triSurfaceMesh;
        name outlet;
    }
	
	wedge1.stl
    {
        type triSurfaceMesh;
        name wedge1;
    }
	wedge2.stl
    {
        type triSurfaceMesh;
        name wedge2;
    }
	sbs.stl
    {
        type triSurfaceMesh;
        name sbs;
    }
	walls.stl
    {
        type triSurfaceMesh;
        name walls;
    }

};

castellatedMeshControls
{
//preservePatches (inlet );
    maxLocalCells 1000000;
    maxGlobalCells 2000000;
    minRefinementCells 0;
    nCellsBetweenLevels 2;
      allowFreeStandingZoneFaces true;

    features
    (
      /*
	  {
            file "cvd4.eMesh";
            level 4;
        }
		
		 {
            file "inlet.eMesh";
            level 4;
        }
		
		 {
            file "outlet.eMesh";
            level 2;
        }
		
		{
            file "wedge1.eMesh";
            level 2;
        }
		*/
    );

    refinementSurfaces
    {
       
		
		inlet
        {
            level (3 3);
			patchInfo
			{
			type patch;
			}
        }
		
		outlet
        {
            level (2 3);
			
			patchInfo
			{
			type patch;
			}
        }
		
		wedge1
        {
            level (3 3);
			patchInfo
			{
			type patch;
			}
        }
		wedge2
        {
            level (3 3);
			patchInfo
			{
			type patch;
			}
        }
		sbs
        {
            level (3 3);
			patchInfo
			{
			type wall;
			}
        }
		walls
        {
            level (3 3);
			patchInfo
			{
			type wall;
			}
        }
		
		
		}
 
    resolveFeatureAngle 30;

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

    locationInMesh (-0.1 -0.1 -0.01);// A point *inside* the geometry
}

snapControls
{
    nSmoothPatch 3;
    tolerance 2.0;
    nSolveIter 30;
    nRelaxIter 5;
    implicitFeatureSnap false;
    explicitFeatureSnap true;
    multiRegionFeatureSnap false;
}

addLayersControls
{
    relativeSizes true;

    layers
    {
    }

    expansionRatio 1.2;
    finalLayerThickness 0.3;
    minThickness 0.1;
    nGrow 0;
    featureAngle 60;
    nRelaxIter 3;
    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;
    minFlatness 0.5;
    minVol 1e-13;
    minTetQuality 1e-9;
    minArea -1;
    minTwist 0.02;
    minDeterminant 0.001;
    minFaceWeight 0.02;
    minVolRatio 0.01;
    minTriangleTwist -1;
    nSmoothScale 4;
    errorReduction 0.75;
}

writeFlags
(
    scalarLevels
    layerSets
    layerFields
);

mergeTolerance 1e-6;


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