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] Help with Snappy: no layers growing (https://www.cfd-online.com/Forums/openfoam-meshing/195751-help-snappy-no-layers-growing.html)

GianF November 16, 2017 07:52

Help with Snappy: no layers growing
 
Hi all, first time posting on forums but an avid reader :D
I have been trying to get layers to grow on a wing that is not perfectly aligned with the background mesh (created with blockMesh). I have been successful in the past when the wing was perpendicular to the part but cannot get it to work in this case.
I have attached my snappyHexMeshDict and snappyHexMesh report below. Any help is really appreciated.
As I understand it it seems that edge intersection testing is the main reason the thing isn't working but I could be wrong as i am pretty new to snappy

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  dev                                  |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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


// Geometry. Definition of all surfaces. All surfaces are of class
// searchableSurface.
// Surfaces are used
// - to specify refinement for any mesh cell intersecting it
// - to specify refinement for any mesh cell inside/outside/near
// - to 'snap' the mesh boundary to the surface
geometry
{
    Hor.stl
    {
        type triSurfaceMesh;
        name Hor;
    }

};

// Settings for the layer addition.
addLayersControls
{
    // Are the thickness parameters below relative to the undistorted
    // size of the refined cell outside layer (true) or absolute sizes (false).
    relativeSizes false;

    // Per final patch (so not geometry!) the layer information
    layers
    {
        "(Hor).*"
        {
            nSurfaceLayers 1;
        }
    }

    // Expansion factor for layer mesh
    expansionRatio 1.3;

    // Wanted thickness of final added cell layer. If multiple layers
    // is the thickness of the layer furthest away from the wall.
    // Relative to undistorted size of cell outside layer.
    // See relativeSizes parameter.
    finalLayerThickness 0.001;

    // Minimum thickness of cell layer. If for any reason layer
    // cannot be above minThickness do not add layer.
    // Relative to undistorted size of cell outside layer.
    minThickness 0.01;

    // If points get not extruded do nGrow layers of connected faces that are
    // also not grown. This helps convergence of the layer addition process
    // close to features.
    // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x)
    nGrow 1;

    // Advanced settings

    // When not to extrude surface. 0 is flat surface, 90 is when two faces
    // are perpendicular
    featureAngle 60;

    // At non-patched sides allow mesh to slip if extrusion direction makes
    // angle larger than slipFeatureAngle.
    slipFeatureAngle 30;

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

    // Number of smoothing iterations of surface normals
    nSmoothSurfaceNormals 1;

    // Number of smoothing iterations of interior mesh movement direction
    nSmoothNormals 3;

    // Smooth layer thickness over surface patches
    nSmoothThickness 10;

    // Stop layer growth on highly warped cells
    maxFaceThicknessRatio 0.5;

    // Reduce layer growth where ratio thickness to medial
    // distance is large
    maxThicknessToMedialRatio 0.3;

    // Angle used to pick up medial axis points
    // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
    minMedianAxisAngle 90;


    // Create buffer region for new layer terminations
    nBufferCellsNoExtrude 0;


    // Overall max number of layer addition iterations. The mesher will exit
    // if it reaches this number of iterations; possibly with an illegal
    // mesh.
    nLayerIter 150;
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
    #include "meshQualityDict"


    // Advanced

    //- Number of error distribution iterations
    nSmoothScale 8;
    //- Amount to scale back displacement at error points
    errorReduction 0.5;
}


// Advanced

// Write flags
writeFlags
(
    scalarLevels
    layerSets
    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;


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


Code:

Shrinking and layer addition phase
----------------------------------

Using mesh parameters
{
    maxNonOrtho    70;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave      80;
    minVol          1e-013;
    minTetQuality  1e-015;
    minArea        -1;
    minTwist        0.02;
    minDeterminant  0.005;
    minFaceWeight  0.02;
    minVolRatio    0.01;
    minTriangleTwist -1;
    nSmoothScale    8;
    errorReduction  0.5;
}



Merging all faces of a cell
---------------------------
    - which are on the same patch
    - which make an angle < 60 degrees
      (cos:0.5)
    - as long as the resulting face doesn't become concave by more than 90 degrees
      (0=straight, 180=fully concave)

Merging 3555 sets of faces.

Edge intersection testing:
    Number of edges            : 3786657
    Number of edges to retest  : 19959
    Number of intersected edges : 165712

Undo iteration 0
----------------
Checking faces in error :
    non-orthogonality > 70  degrees                        : 42
    faces with face pyramid volume < 1e-013                : 0
    faces with face-decomposition tet quality < 1e-015      : 18
    faces with concavity > 80  degrees                    : 0
    faces with skewness > 4  (internal) or 20  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.02        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                          : 0
    faces on cells with determinant < 0.005                : 8
Masters that need to be restored:76
Edge intersection testing:
    Number of edges            : 3786825
    Number of edges to retest  : 757
    Number of intersected edges : 165880


Undo iteration 1
----------------
Checking faces in error :
    non-orthogonality > 70  degrees                        : 0
    faces with face pyramid volume < 1e-013                : 0
    faces with face-decomposition tet quality < 1e-015      : 0
    faces with concavity > 80  degrees                    : 0
    faces with skewness > 4  (internal) or 20  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.02        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                          : 0
    faces on cells with determinant < 0.005                : 0

Merging all points on surface that
- are used by only two boundary faces and
- make an angle with a cosine of more than 0.5.

Removing 3913 straight edge points ...

Edge intersection testing:
    Number of edges            : 3786825
    Number of edges to retest  : 29893
    Number of intersected edges : 165880

Undo iteration 0
----------------
Checking faces in error :
    non-orthogonality > 70  degrees                        : 6
    faces with face pyramid volume < 1e-013                : 0
    faces with face-decomposition tet quality < 1e-015      : 0
    faces with concavity > 80  degrees                    : 0
    faces with skewness > 4  (internal) or 20  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.02        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                          : 0
    faces on cells with determinant < 0.005                : 0
Detected 4 error faces on boundaries that have been merged. These will be restored to their original faces.

Edge intersection testing:
    Number of edges            : 3786825
    Number of edges to retest  : 46
    Number of intersected edges : 165880

Undo iteration 1
----------------
Checking faces in error :
    non-orthogonality > 70  degrees                        : 2
    faces with face pyramid volume < 1e-013                : 0
    faces with face-decomposition tet quality < 1e-015      : 1
    faces with concavity > 80  degrees                    : 0
    faces with skewness > 4  (internal) or 20  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.02        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                          : 0
    faces on cells with determinant < 0.005                : 0
Detected 0 error faces on boundaries that have been merged. These will be restored to their original faces.

Detected 3 error faces in mesh. Restoring neighbours of faces in error.

Edge intersection testing:
    Number of edges            : 3786825
    Number of edges to retest  : 124
    Number of intersected edges : 165880

Checking mesh manifoldness ...

Checking initial mesh ...
Checking faces in error :
    non-orthogonality > 70  degrees                        : 0
    faces with face pyramid volume < 1e-013                : 0
    faces with face-decomposition tet quality < 1e-015      : 0
    faces with concavity > 80  degrees                    : 0
    faces with skewness > 4  (internal) or 20  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.02        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                          : 0
    faces on cells with determinant < 0.005                : 0
Detected 0 illegal faces (concave, zero area or negative cell pyramid volume)

Adding in total 0 inter-processor patches to handle extrusion of non-manifold processor boundaries.

Handling points with inconsistent layer specification ...

Handling non-manifold points ...

Checking patch manifoldness ...
Outside of local patch is multiply connected across edges or points at 0 points.
Set displacement to zero for all 0 non-manifold points

Handling feature edges ...

Growing non-extrusion points by one layer ...
Set displacement to zero for an additional 0 points.

patch    faces    layers avg thickness[m]
                          near-wall overall
-----    -----    ------ --------- -------
motorBike 166049  1      0.001    0.001 

Selecting externalDisplacementMeshMover displacementMedialAxis
displacementMedialAxis : Calculating distance to Medial Axis ...
displacementMedialAxis : Smoothing normals ...
    Iteration 0  residual 0.0147636
displacementMedialAxis : Inserting points on patch atmosphere if angle to nearest layer patch > 30 degrees.
displacementMedialAxis : Inserting points on patch outlet if angle to nearest layer patch > 30 degrees.
displacementMedialAxis : Inserting points on patch inlet if angle to nearest layer patch > 30 degrees.
displacementMedialAxis : Inserting points on patch bottom if angle to nearest layer patch > 30 degrees.
displacementMedialAxis : Inserting points on patch side if angle to nearest layer patch > 30 degrees.
displacementMedialAxis : Inserting points on patch midPlane if angle to nearest layer patch > 30 degrees.
displacementMedialAxis : Smoothing normals in interior ...
    Iteration 0  residual 0.039521

Layer addition iteration 0
--------------------------

Determining displacement for added points according to pointNormal ...
Detected 886 points with point normal pointing through faces.
Reset displacement at 886 points to average of surrounding points.

displacementMedialAxis : Smoothing using Medial Axis ...
displacementMedialAxis : Reducing layer thickness at 0 nodes where thickness to medial axis distance is large
displacementMedialAxis : Removing isolated regions ...
displacementMedialAxis : Number of isolated points extrusion stopped : 0
displacementMedialAxis : Smoothing field ...
    Iteration 0  residual 0
displacementMedialAxis : Moving mesh ...
displacementMedialAxis : Iteration 0
Moving mesh using displacement scaling : min:1  max:1
Checking faces in error :
    non-orthogonality > 70  degrees                        : 0
    faces with face pyramid volume < 1e-013                : 0
    faces with face-decomposition tet quality < 1e-015      : 0
    faces with concavity > 80  degrees                    : 0
    faces with skewness > 4  (internal) or 20  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.02        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                          : 0
    faces on cells with determinant < 0.005                : 0
displacementMedialAxis : Successfully moved mesh
displacementMedialAxis : Finished moving mesh ...
truncateDisplacement : Unextruded 0 faces due to non-consecutive vertices being extruded.
truncateDisplacement : Unextruded 0 faces due to stringed edges with inconsistent extrusion.

Setting up information for layer truncation ...

Checking mesh with layer ...
Checking faces in error :
    non-orthogonality > 70  degrees                        : 0
    faces with face pyramid volume < 1e-013                : 0
    faces with face-decomposition tet quality < 1e-015      : 0
    faces with concavity > 80  degrees                    : 0
    faces with skewness > 4  (internal) or 20  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.02        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                          : 0
    faces on cells with determinant < 0.005                : 0
Detected 0 illegal faces (concave, zero area or negative cell pyramid volume)
Extruding 0 out of 166049 faces (0%). Removed extrusion at 0 faces.
Added 0 out of 166049 cells (0%).
Edge intersection testing:
    Number of edges            : 3786825
    Number of edges to retest  : 0
    Number of intersected edges : 165880

Doing final balancing
---------------------

Writing 0 added cells to cellSet addedCells
Writing 0 faces inside added layer to faceSet layerFaces

Writing fields with layer information:
    nSurfaceLayers    : actual number of layers
    thickness        : overall layer thickness
    thicknessFraction : overall layer thickness (fraction of desired thickness)


patch    faces    layers  overall thickness
                            [m]      [%]
-----    -----    ------  ---      ---
motorBike 166049  0        0        0     

Layer mesh : cells:1188561  faces:3786825  points:1437885
Cells per refinement level:
    0        239693
    1        5384
    2        12869
    3        36171
    4        116321
    5        480434
    6        297689
Writing mesh to time constant
Wrote mesh in = 20.108 s.
Layers added in = 20.108 s.
Checking final mesh ...
Checking faces in error :
    non-orthogonality > 70  degrees                        : 0
    faces with face pyramid volume < 1e-013                : 0
    faces with face-decomposition tet quality < 1e-015      : 0
    faces with concavity > 80  degrees                    : 0
    faces with skewness > 4  (internal) or 20  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.02        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                          : 0
    faces on cells with determinant < 0.005                : 0
Finished meshing without any errors
Finished meshing in = 547.434 s.
End

Finalising parallel run

Any help is really appreciated

PS:
I am currently downloading Salome and will try to see if improving my stl will make a difference.

elmo555 December 12, 2017 04:44

Welcome to these forums, Gian.

These two lines might be the problem:

Code:

    finalLayerThickness 0.001;

    minThickness 0.01;

You specify that one layer should be generated, with a thickness of 0.001m (since you set relativeSizes false;), but at the same time you say that no layer thinner than 0.01m should be generated. At least that's how I understand the relativeSizes parameter.

Let me know if that works!

openfoam_aero September 23, 2020 08:26

Quote:

Originally Posted by elmo555 (Post 674819)
Welcome to these forums, Gian.

These two lines might be the problem:

Code:

    finalLayerThickness 0.001;

    minThickness 0.01;

You specify that one layer should be generated, with a thickness of 0.001m (since you set relativeSizes false;), but at the same time you say that no layer thinner than 0.01m should be generated. At least that's how I understand the relativeSizes parameter.

Let me know if that works!

Hi Lennart


I believe that finalLayerThickness is the ratio of the thickness of the last layer to the size of the surface on which the layers have been added. Consider a cube and one of its surfaces to be 0.1m wide. If you set finalLayerThickness to 0.01, that would mean that the thickness of the final layer in add layers will be 0.01 x 0.1 = 0.001m.


All times are GMT -4. The time now is 01:11.