/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM v2512                                  |
|  \\    /   O peration     | snappyHexMeshDict                               |
|   \\  /    A nd           | Mesh Generation Settings                        |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/

FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      snappyHexMeshDict;
}


// STL geometry is refined using snappyHexMesh
// Boundary layer cells are added near the disk surface

castellatedMesh true;
snap            true;
addLayers       true;


// STL geometry definition

geometry
{
    // Use this STL file for disk case
    // disk.stl

    // Use this STL file for annular disk case
    annularDisk.stl
    {
        type triSurfaceMesh;
        name disk;
    }
};


// Castellated mesh controls

castellatedMeshControls
{
    maxLocalCells 1000000;
    maxGlobalCells 2000000;
    minRefinementCells 0;
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 3;

    features
    (
    );

    refinementSurfaces
    {  
        disk
        {
            level (3 3);

            patchInfo
            {
                type wall;
            }
        }
        
    }

    resolveFeatureAngle 30;

    refinementRegions
    {

    }

    locationInMesh (1.5 0 0);

    allowFreeStandingZoneFaces no;
}


// Snap controls

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


// Layer addition controls

addLayersControls
{
    relativeSizes false;

    layers
    {
        disk
        {
            nSurfaceLayers 3;
        }

    }

    expansionRatio 1.02;
    finalLayerThickness 0.005;
    finalLayerRatio 0.01;
    minThickness 0.001;

    nGrow 0;
    featureAngle 30;

    nRelaxIter 10;

    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;

    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 40;

    nBufferCellsNoExtrude 0;

    nLayerIter 100;
    nRelaxedIter 20;
}


// Mesh quality controls

meshQualityControls
{
    maxNonOrtho 65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;

    minVol 1e-200;
    minTetQuality 1e-9;
    minArea -1;

    minTwist 0.05;
    minDeterminant 0.001;
    minFaceWeight 0.05;
    minVolRatio 0.01;
    minTriangleTwist -1;

    nSmoothScale 4;
    errorReduction 0.75;

    relaxed
    {
        maxNonOrtho 75;
    }
}


// Debug and merge settings

debug 0;

mergeTolerance 1e-6;