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

    surfaceLevel 6;
    teLevel 9;
    tipLevel 8;
    lineLevel 8; 
    prismLayer 8;

    castellatedMesh true;
    snap true;
    addLayers false;
    geometry
    {
        wing_lower.stl
        {
            type triSurfaceMesh;
            name  wing_lower;
        }
        wing_upper.stl
        {
            type triSurfaceMesh;
            name  wing_upper;
        }
        wing_tip.stl
        {
            type triSurfaceMesh;
            name  wing_tip;
        }
        wing_te.stl
        {
            type triSurfaceMesh;
            name  wing_te;
        }
    }

    castellatedMeshControls
    {
        features
        (
            {
                file "wing_lower.eMesh";
                level $lineLevel;
            }

            {
                file "wing_upper.eMesh";
                level $lineLevel;
            }

            {
                file "wing_tip.eMesh";
                level $lineLevel;
            }

            {
                file "wing_te.eMesh";
                level $lineLevel;
            }
        );
        refinementSurfaces
        {
            wing_upper
            {
                level ( $surfaceLevel $surfaceLevel );
            }
            
            wing_lower
            {
                level ( $surfaceLevel $surfaceLevel );
            }
            
            wing_te
            {
                level ( $teLevel $teLevel );
            }
            
            wing_tip
            {
                level ( $tipLevel $tipLevel );
            }
        }

        refinementRegions
        {

           
        }

        locationInMesh ( 2 2 2 );
        maxLocalCells 10000000;
        maxGlobalCells 200000000;
        minRefinementCells 0;
        nCellsBetweenLevels 3;
        resolveFeatureAngle 10;
        allowFreeStandingZoneFaces true;
        planarAngle 30;
        maxLoadUnbalance 0.10;
    }

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

    addLayersControls
    {
        layers
        {
            "wing.*"
            {nSurfaceLayers $prismLayer;}
        }

        relativeSizes true;
        expansionRatio 1.3;
        finalLayerThickness 0.5;
        minThickness 0.001;
        nGrow 0;
        featureAngle 180;
        slipFeatureAngle 80;
        nRelaxIter 5;
        nSmoothSurfaceNormals 1;
        nSmoothNormals 3;
        nSmoothThickness 10;
        maxFaceThicknessRatio 0.5;
        maxThicknessToMedialRatio 0.3;
        minMedialAxisAngle 90;
        nBufferCellsNoExtrude 0;
        nLayerIter 50;
        nRelaxedIter 20;
        writeVTK false;
        noErrors false;
        layerRecovery 1;
        growZoneLayers false;
        projectGrownUp 0.0;
    }

    meshQualityControls
    {
        maxNonOrtho 70;
        maxBoundarySkewness 4;
        maxInternalSkewness 4;
        maxConcave 80;
        minFlatness 0.5;
        minVol 1.00E-13;
        minTetQuality -1e30;
        minArea -1;
        minTwist 0.01;
        minDeterminant 0.01;
        minFaceWeight 0.03;
        minVolRatio 0.01;
        minTriangleTwist -1;
        nSmoothScale 4;
        errorReduction 0.75;
        relaxed {maxNonOrtho 79; maxBoundarySkewness 8; }

    }

    debug 0;
    mergeTolerance 1E-6;
    autoBlockMesh false;
