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

geometry
{
    flyingfish
    {
        type triSurfaceMesh;
        file "flyingfish45deg.stl";
    }

    refinementBox
    {
        type box;
        min  ( -0.2 -0.2 -0.025);
        max  (  0.6  0.2 -0.015);
    }

    refinementBox1
    {
        type box;
        min  ( -0.1 -0.08 -0.09);
        max  (  0.5  0.08  0.09);
    }

    refinementBox3
    {
        type box;
        min  ( 0  -0.06 -0.015);
        max  ( 0.4 0.06  0.05);
    }
}

castellatedMeshControls
{
    maxLocalCells 100000;
    maxGlobalCells 2000000;
    minRefinementCells 10;
    nCellsBetweenLevels 2;

    features ();

    refinementSurfaces
    {
        flyingfish
        {
            level (3 3);
        }
    }

    resolveFeatureAngle 30;

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

    locationInMesh (0.3 0 0);

    allowFreeStandingZoneFaces true;
}

snapControls
{
     nSmoothPatch 3;
     tolerance 4;
     nSolveIter 30;
     nRelaxIter 5;
}

addLayersControls
{
    relativeSizes true;

    layers
    {
    }
    expansionRatio 1.0;
    finalLayerThickness 0.5;
    minThickness 0.25;
    nGrow 0;
    featureAngle 360;
    nRelaxIter 5;
    nSmoothSurfaceNormals 16;
    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;
    minTwist 0.05;
    minDeterminant 0.001;
    minFaceWeight 0.05;
    minVolRatio 0.01;
    minTriangleTwist -1;
    nSmoothScale 4;
    errorReduction 0.75;
}

mergeTolerance 1e-6;

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