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

castellatedMesh true;
snap            true;
addLayers       false;

geometry
{
    C1
    {
        type triSurfaceMesh;
        file "MB_SC_1.stl";
    }

    C2
    {
        type triSurfaceMesh;
        file "MB_SC_2.stl";
    }

    refinementBox
    {
    	type searchableBox;
	min (-0.0003 0 -0.001);
	max (0.0003 0.0003 0.001);
    }
}

castellatedMeshControls
{
    maxLocalCells   1000000;
    maxGlobalCells  20000000;
    minRefinementCells 0;
    maxLoadUnbalance 0.1;
    nCellsBetweenLevels 1;
    locationInMesh (-0.0005 0 0);
    allowFreeStandingZoneFaces true;
    resolveFeatureAngle 30;

    features
    (
        {
            file "MB_SC_1.eMesh";
            level 2;
        }

        {
            file "MB_SC_2.eMesh";
            level 2;
        }
    );


    refinementSurfaces
    {
        C1
        {
            level (2 4);
            patchInfo { type patch; }
        }

	C2
        {
            level (2 4);
            patchInfo { type patch; }
        }
    }


    refinementRegions
    {
	refinementBox
	{
	    mode inside;
	    levels ((1e15 2));
	}
    }
}

snapControls
{
    nSmoothPatch    3;
    tolerance       1;
    nSolveIter      300;
    nRelaxIter      10;
    nFeatureSnapIter 10;
    implicitFeatureSnap false;
    explicitFeatureSnap true;
    multiRegionFeatureSnap false;
}

addLayersControls
{
    relativeSizes   true;
    expansionRatio  1;
    finalLayerThickness 0.3;
    minThickness    0.1;
    nGrow           0;
    featureAngle    60;
    slipFeatureAngle 30;
    nRelaxIter      3;
    nSmoothSurfaceNormals 1;
    nSmoothNormals  3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedialAxisAngle 90;
    nBufferCellsNoExtrude 0;
    nLayerIter      50;

    layers
    {
	C1
	{
	    nSurfaceLayers   6;	
	}

	C2
	{
	    nSurfaceLayers   6;	
	}
    }
}

meshQualityControls
{
    maxNonOrtho     75;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave      80;
    minVol          1e-15;
    minTetQuality   1e-15;
    minArea         -1;
    minTwist        0.02;
    minDeterminant  0.001;
    minFaceWeight   0.05;
    minVolRatio     0.01;
    minTriangleTwist -1;
    nSmoothScale    4;
    errorReduction  0.75;
}

writeFlags      ( scalarLevels layerSets layerFields );

mergeTolerance  1e-06;

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

