/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version: 9                                      |
|   \\  /    A nd           |                                                 |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/

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


// ================================================================
// MESH GENERATION
// ================================================================

castellatedMesh true;

snap true;

addLayers false;


// ================================================================
// GEOMETRY
// ================================================================

geometry
{
    fluidDomain.stl
    {
        type triSurfaceMesh;
        name fluidDomain;
    }
}


// ================================================================
// CASTELLATED MESH CONTROLS
// ================================================================

castellatedMeshControls
{
    maxLocalCells 1000000;

    maxGlobalCells 2000000;

    minRefinementCells 10;

    maxLoadUnbalance 0.10;

    nCellsBetweenLevels 3;


    // ------------------------------------------------------------
    // FEATURE EDGES
    // FINE MESH
    // ------------------------------------------------------------

    features
    (
        {
            file "fluidDomain.eMesh";

            level 3;
        }
    );


    // ------------------------------------------------------------
    // SURFACE REFINEMENT
    // FINE MESH
    // ------------------------------------------------------------

    refinementSurfaces
    {
        fluidDomain
        {
            level (2 3);
        }
    };


    resolveFeatureAngle 30;


    // ------------------------------------------------------------
    // REFINEMENT REGIONS
    // ------------------------------------------------------------

    refinementRegions
    {
    };


    // ------------------------------------------------------------
    // POINT INSIDE FLUID DOMAIN
    // ------------------------------------------------------------

    locationInMesh (0.3 0.15 0.05);


    allowFreeStandingZoneFaces true;
}


// ================================================================
// SNAP CONTROLS
// ================================================================

snapControls
{
    nSmoothPatch 3;

    tolerance 2.0;

    nSolveIter 30;

    nRelaxIter 5;

    nFeatureSnapIter 10;

    implicitFeatureSnap false;

    explicitFeatureSnap true;

    multiRegionFeatureSnap false;
}


// ================================================================
// LAYER CONTROLS
// ================================================================

addLayersControls
{
    relativeSizes true;

    layers
    {
    }

    expansionRatio 1.0;

    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;

    nRelaxedIter 20;
}


// ================================================================
// MESH QUALITY CONTROLS
// ================================================================

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;
}


// ================================================================
// WRITE FLAGS
// ================================================================

writeFlags
(
    scalarLevels
    layerSets
    layerFields
);


// ================================================================
// MERGE TOLERANCE
// ================================================================

mergeTolerance 1e-6;


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