CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [snappyHexMesh] SHM does not snap my geometry (https://www.cfd-online.com/Forums/openfoam-meshing/189404-shm-does-not-snap-my-geometry.html)

Twan June 19, 2017 10:05

SHM does not snap my geometry
 
4 Attachment(s)
Hello Foamers,

I am new to this Forum but I've been working with OpenFOAM for 3/4 weeks now. I did several tutorials before I start working on my own case but apparently there is something I'm still doing wrong and I can not find it.

I would like to mesh a geometry using Snappy, the geometry doesn't need any layers. But even if it needed layers, something goes wrong in the snapping proces.

The geometry itself is confidential, so I can not upload the .stl file. But a picture is added at the end of this Thread. (basically 2 'cylinders' on top of each-other).

My snappyHexMeshDict and log file are given below, I really hope that anyone has an idea or some suggestions.

( In the shmDict addidtional stl files are listed but are not used for now. In the future I would like to add a bathymetry. )

Kind regards,
Twan

Twan June 20, 2017 08:38

snappyHexMeshDict without Layers
 
The txt files are not easy to read:
I hope this gives a better overview:

Code:



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

// Which of the steps to run
castellatedMesh true;
snap            true;
addLayers      false;


geometry
{
    /*bathymetry.stl
    {
        type triSurfaceMesh;
        name bathymetry;
        appendRegionName false;

    }*/
   
    /*GOEDcylinder.stl
    {
        type triSurfaceMesh;
        name GOEDcylinder;
    }*/
    NEW_velCap_translation.stl
    {
    type    triSurfaceMesh;
    name    NEW_velCap_translation;
    }
    refinementBox
    { 
        type searchableBox
        min (6.85 0.85 -0.25);
        max (7.15 1.15 -0.05);
   
   
    }

};

// Settings for the castellatedMesh generation.
castellatedMeshControls
{

    // Refinement parameters
    // ~~~~~~~~~~~~~~~~~~~~~

    maxLocalCells 10000000;


    maxGlobalCells 10000000;


    minRefinementCells 10;

 
    maxLoadUnbalance 0.10;

 
    nCellsBetweenLevels 5;




    features
    (
        /*{ 
            file "GOEDcylinder.eMesh";
            level 3;
        }
        { 
            file "NEW_velCap_translation.eMesh";
            level 3;
        }*/
    );


    refinementSurfaces
    {
        /*
        bathymetry
        {
          // Surface-wise min and max refinement level
            level (0 0);
        }*/
        NEW_velCap_translation
        {
                level (0 4);
        }

    }

 
   
    resolveFeatureAngle 30;

    refinementRegions
    {
        refinementBox
        {
            mode inside;
        levels ((1E15 3));
        }
    }


 
    limitRegions
    {
    }


 
       
        locationInMesh (6.51 0.51 -0.2);
       
        allowFreeStandingZoneFaces false;
        faceZoneControls
        {
        }
}

// Settings for the snapping.
snapControls
{
    // Number of patch smoothing iterations before finding correspondence
    // to surface
    nSmoothPatch 30;

    // Optional: number of smoothing iterations for internal points on
    // refinement interfaces. This will reduce non-orthogonality on
    // refinement interfaces.
    //nSmoothInternal $nSmoothPatch;

    // Maximum relative distance for points to be attracted by surface.
    // True distance is this factor times local maximum edge length.
    tolerance 4.0;

    // Number of mesh displacement relaxation iterations.
    nSolveIter 30;

    // Maximum number of snapping relaxation iterations. Should stop
    // before upon reaching a correct mesh.
    nRelaxIter 15;

}


meshQualityControls
{
        //- Maximum non-orthogonality allowed. Set to 180 to disable.
    maxNonOrtho 65;

    //- Max skewness allowed. Set to <0 to disable.
    maxBoundarySkewness 20;
    maxInternalSkewness 4;

    //- Max concaveness allowed. Is angle (in degrees) below which concavity
    //  is allowed. 0 is straight face, <0 would be convex face.
    //  Set to 180 to disable.
    maxConcave 80;

    //- Minimum projected area v.s. actual area. Set to -1 to disable.
    minFlatness 0.5;

    //- Minimum pyramid volume. Is absolute volume of cell pyramid.
    //  Set to a sensible fraction of the smallest cell volume expected.
    //  Set to very negative number (e.g. -1E30) to disable.
    minVol 1e-13;
   
    minTetQuality 1e-9; //>>>>>>>>>>>ADDED THIS BECAUSE SNM DID NOT RUN WITHOUT IT.<<<<<<<<<<<<<<<<<<<<<<<<<<

    //- Minimum face area. Set to <0 to disable.
    minArea -1;

    //- Minimum face twist. Set to <-1 to disable. dot product of face normal
    //- and face centre triangles normal
    minTwist 0.02;

    //- minimum normalised cell determinant
    //- 1 = hex, <= 0 = folded or flattened illegal cell
    minDeterminant 0.001;

    //- minFaceWeight (0 -> 0.5)
    minFaceWeight 0.02;

    //- minVolRatio (0 -> 1)
    minVolRatio 0.01;

    //must be >0 for Fluent compatibility
    minTriangleTwist -1;

    // Advanced

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

// Advanced

//// Debug flags
//debugFlags
//(
//    mesh            // write intermediate meshes
//    intersections  // write current mesh intersections as .obj files
//    featureSeeds    // write information about explicit feature edge
//                    // refinement
//    attraction      // write attraction as .obj files
//    layerInfo      // write information about layers
//);
//
//// Write flags
//writeFlags
//(
//    scalarLevels    // write volScalarField with cellLevel for postprocessing
//    layerSets      // write cellSets, faceSets of faces in layer
//    layerFields    // write volScalarField for layer coverage
//);

// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1e-6;

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


Twan June 22, 2017 07:57

Found the error
 
Hello,

I found my (unfortunate) mistake; I started building my caste from a 2D-case, which blockMeshDict I copied and chanced as follows:
I adjusted the coordinates of the vertices and the number of at blocks, e.g. ( 100, 100, 50) instead of ( 100, 1, 50).
Now one thing one also must adjust is the patch for your front and back.
In the 2D case these are 'empty' but should be patches aswell.

Without changing this you can get a nice castellated mesh and snappyHexMesh does some snapping, but you wont get a smooth surface.

I know that if SHM did work at this point (still empty patches) my results obtained would be wrong and eventually I would have found the mistake, but at this moment I did not run the simulations because of the wrong mesh.

I hope that some of you who have the same problem wont need to struggle as long as I did (2 weeks).

Kind Regards,
Twan


All times are GMT -4. The time now is 00:18.