snappyHexMeshDict file settings

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

castellatedMesh true;
snap true;
addLayers true;


geometry
{
   b.stl //To read the geometry STL file
    {
       type triSurfaceMesh;
       name b; //The name of the inner surface of snappyHexMesh
    }
    D1.stl
    {
       type triSurfaceMesh;
       name D1;
    }
      

    //bBox
    //{
       // type searchableBox;
       // min (1.81 -0.5 0);
       // max (2.19 0.5 0.14);
   // }
    
     
    WaveBox
    {
        type searchableBox; //Cube encryption
        min (0 -0.5 0);
        max (10 0.5 0.5);
    }
    
}



castellatedMeshControls
{

    maxLocalCells 2000000; //Global maximum grid amount, after reaching the number, the grid divider will not add any more grids

    maxGlobalCells 16000000; //Maximum grid volume for a single core

    minRefinementCells 0; //Minimum number of refinement cells. If the number of grid cells on a feature is less than this parameter, the refinement will stop.

    maxLoadUnbalance 0.10; //Maximum load balancing parameter, grid parallel computing, by setting this value, the grid computing load between each processor is allowed to be unbalanced to a certain extent. When the value of this parameter is 0, load balancing is forced, and the amount of grid processed between each processor strictly maintains the total number of units/number of computing cores. A lower value (e.g. 0) may result in the system frequently balancing the load on the grid. When the parameter value is set to 1, the grid equalization operation is completely disabled.

    nCellsBetweenLevels 10; //The number of buffer grid layers between different refinement levels to make the grid size change more gently

    features
    (
        {
            file "b.eMesh"; //The file generated after using the command surfaceFeatureExtract
            level 1;
        }
        {
            file "D1.eMesh";
            level 1;
        }
        
    );

    refinementSurfaces //Refine the surface
   {
      b//corresponds to the above name
      {
            level (1 2); //The minimum and maximum levels of surface mesh refinement, that is, the minimum and maximum number of times the mesh is divided.

      }
      D1
      {
            level (1 2);

      }
      
      
   }
  
\t
    // Resolve sharp angles
    resolveFeatureAngle 30; //Automatically detect the angle. When the curvature change angle exceeds this parameter value, the feature area grid uses the maximum surface refinement level, and features below this angle use the minimum surface refinement level. The default parameter value is 30. When the parameter value is set to 360, it means that this function is turned off.

    planarAngle 30;

    refinementRegions //Volume encryption, for the geometric regions defined in geometry
    {
        
        WaveBox
        {
            mode inside; //Refining the mesh within the closed three-dimensional geometric area
            levels ((0 1)); //The inside method only needs to set the second refinement level, the first digit occupies a space and does not participate in the calculation
        }
        
       b
        {
            mode distance; //Refine all meshes within the specified range of the geometric surface
          //levels ((0.06 4)); The refinement level is 4 within the range of 0.06
            levels ((0.005 3)(0.01 2)); //Multiple groups can be used
        }
       D1
        {
            mode distance;
          //levels ((0.06 4));
            levels ((0.001 3)(0.005 2));
        }

    }


    locationInMesh (3 0 0.35); //Grid domain control points define where to mesh, inside or outside the geometry.
  //locationOutsideMesh (70 0 1);
    allowFreeStandingZoneFaces true; //Allow independent faces. If the parameter value is set to false, it means that the faceZones specified in face encryption (refinementSurfaces) are only located on the boundaries of the corresponding cellZones, serving as the interface between different domains. If the parameter value is true, this faceZone is allowed to be used as an independent area (for example: baffle interface, etc.).
}


snapControls //Surface fitting parameters, move the body mesh nodes to the geometric surface, and fit the jagged surface in the body mesh
{
   
    nSmoothPatch 3; //The number of surface smoothing iterations specifies the number of smoothing iterations for mesh fitting on the surface. Increasing the number of iterations can make the mesh on the surface smoother and fit better, and can reduce the skew rate of the mesh on the surface.

    tolerance 2.0; //Maximum relative distance of snapping points (recommended 2-5), Too low values will reduce the quality of the snapping. Too large values do not have an effect(0.5-1.0-2)

    nSolveIter 30; //Maximum number of iterations for grid fitting. For simple models, you can set this parameter value to 100. If the grid quality after fitting is not ideal, you can try increasing this parameter value to 300.
                   //default 30. Number of mesh displacement relaxation iterations.
                   //This is likely to improve the snapping to the surface
    nRelaxIter 5; //Number of fit relaxation iterations to eliminate poor quality units or grid nodes, 5-8 is recommended.
                  //default 5(10-20-50). Maximum number of snapping relaxation iterations. Should stop before upon reaching a correct mesh.
    
    nFeatureSnapIter 10; //Number of iterations for feature edge capture, snapping grid points to surface edges.
                         //default 10. Feature snapping
                         //This is likely to improve the snapping of edges 50-100
    implicitFeatureSnap false; //Implicit feature capture

    explicitFeatureSnap true; // explicit feature capture

    multiRegionFeatureSnap false; //Multi-domain feature capture
}

addLayersControls
{

    relativeSizes true; //true: the boundary layer thickness parameter value is the ratio relative to the size of the grid cells on the adjacent surface; false: the boundary layer thickness parameter value is directly defined by the absolute value (unit: m).

    layers //Set different basic parameters of the boundary layer for each surface
    {
       "b.*"
        {
            nSurfaceLayers 5; //Number of boundary layers
        }
        "D1.*"
        {
            nSurfaceLayers 5;
        }

    }

    expansionRatio 1.2; //Boundary layer expansion ratio, the thickness ratio (height ratio) of two adjacent layers.

    finalLayerThickness 0.6; //The thickness of the last layer of the boundary layer, ensuring that the last layer of the boundary layer grid is not greater than this value.
    //firstLayerThickness 0.01;The thickness of the first layer of the boundary layer.
    
    minThickness 0.001; //Minimum total layer thickness.

    nGrow 0; //Maximum number of canceled boundary layer units

    featureAngle 150; //Maximum surface angle of boundary layer

    slipFeatureAngle 30; //Boundary layer slip angle, it is recommended to use the best value between 70-80 to limit the sliding of the layer, the default value is half of featureAngle.

    nRelaxIter 5; //The number of volume mesh shrink iterations, 5 is recommended.

    nSmoothSurfaceNormals 1; //Number of iterations for boundary layer surface normal smoothing, 1 is recommended.

    nSmoothNormals 3; //The number of volume mesh smoothing iterations, 3 is recommended.

    nSmoothThickness 10; //Number of boundary layer thickness smoothing iterations

    maxFaceThicknessRatio 0.5; //Maximum aspect ratio of surface mesh

    maxThicknessToMedialRatio 0.3; //The maximum ratio of layer thickness to intermediate axis length, 0.3 is recommended.

    minMedialAxisAngle 90; //Pick up the angle of the middle axis point, pick up the angle of the middle axis point

    nBufferCellsNoExtrude 0; //The number of buffer cells on the boundary layer termination surface

    nLayerIter 30; //The maximum total number of iterations for boundary layer addition, 50-60 is recommended.
}

meshQualityControls //Mesh quality control
{

    maxNonOrtho 65; //Maximum non-orthogonal angle. When 0, it means that two adjacent grids are completely orthogonal. The default value is 65. When set to 180, it means that this control is turned off.
    maxBoundarySkewness 20; //Maximum boundary surface mesh skewness
    maxInternalSkewness 4; //Maximum internal surface mesh skewness
    maxConcave 80; //Maximum concavity
    minFlatness 0.5; //Minimum flatness value
    minVol 1e-13; //Minimum unit volume
    minTetQuality 1e-9;
    minArea -1; //Minimum mesh area
    minTwist 0.02; //Minimum surface distortion
    minDeterminant 0.001; //The minimum allowed normalized unit determinant value
    minFaceWeight 0.05; //The minimum value of the face weight allowed between adjacent grids
    minVolRatio 0.01; //The minimum volume expansion rate allowed between adjacent grids
    minTriangleTwist -1; //Allow minimum triangle element distortion value

    nSmoothScale 4; //The number of smoothing times during grid scaling recovery iterations
    errorReduction 0.75; //Grid scaling recovery iteration, this parameter reduces the scaling displacement at the error point
    
   relaxed //Specify relatively relaxed standards for some key mesh quality control parameters (such as non-orthogonality, skewness, etc.)
    {
        //- Maximum non-orthogonality allowed. Set to 180 to disable.
        maxNonOrtho 75;
    }

    // Advanced

    //- Number of error distribution iterations
    nSmoothScale 4;
    //- amount to scale back displacement at error points
    errorReduction 0.75;
}



writeFlags
(
    scalarLevels
    layerSets
    layerFields // write volScalarField for layer coverage
);
//Flags for optional output
// 0 : only write final meshes
// 1: write intermediate meshes
// 2: write volScalarField with cellLevel for postprocessing
// 4 : write current intersections as .obj files
debug 0;
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1e-6;


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