Skip to content

SnappyHexMesh breaks nonCouple connections when using layers, by generating different numbers of points in the nonCouple patches  #10

Description

@efirvida

Hi, I post this in CFD forum link here but I think that this can be an issue of the code so I duplicate it here

I don´t know if this is a bug, or if I'm doing something wrong, I'm sharing my test case for those who want to test. and the STL file can be found here

This is not a perfect SHM configuration or case setup, (I still working on it) but it will clarify my point.

I'm using OpenFOAM 10 to work with the Non-Conformal Coupling (NCC) for rotatory machines like wind turbines

This is my snappyHexMeshDict from now on, I will just activate or deactivate the addLayers feature, which I detect is causing the simulation to explode, with simpleFoam and also with pimpleFoam.

castellatedMesh true;
snap            true;
addLayers       true;

geometry
{
    innerCylinder
    {
        type searchableCylinder;
        point1      (-0.8 0 0);
        point2      ( 0.2 0 0);
        radius      2;
    }        
    
    rotor
    {
        type        triSurfaceMesh;
        file        "rotor.stl";
    }   
};

castellatedMeshControls
{
    maxLocalCells 100000;
    maxGlobalCells 20000000;
    minRefinementCells 0;
    maxLoadUnbalance 0.05;
    nCellsBetweenLevels 1;
    features
    (
        {
            file        "rotor.eMesh";
            level       5;
        }
    );

    refinementSurfaces
    {
        innerCylinder
        {
            level           (4 4);
            cellZone        innerCylinder;
            faceZone        innerCylinder;
            cellZoneInside  inside;
        }
        rotor
        {
            level           (6 6);
        }
    }

    refinementRegions
    {
        innerCylinder
        {
            mode        inside;
            levels      ((1E15 4));
        }        
        rotor
        {
            mode        distance;
            levels      (
                            (0.015 7)
                            (0.045 5)
                        );
        }
    }

    resolveFeatureAngle          45;
    locationInMesh               (4 0 0);
    allowFreeStandingZoneFaces   false;
}

snapControls
{
    nSmoothPatch                    3;
    tolerance                       2.0;
    nSolveIter                     30;
    nRelaxIter                      5;
        nFeatureSnapIter           30;
        implicitFeatureSnap        false;
        explicitFeatureSnap        true;
        multiRegionFeatureSnap     true;
}

addLayersControls
{
    relativeSizes no;
    layers
    {
        rotor
         {
            nSurfaceLayers 8;
        }
    }
    expansionRatio               1.15;
    thickness                    0.0026;
    //firstLayerThickness        0.00027;
    minThickness                 0.00027;
    nGrow                        0;

    nLayerIter                 200;
    nRelaxIter                   3;

    nSmoothSurfaceNormals        1;
    nSmoothThickness            10;
    nSmoothNormals              10;

    featureAngle                150;
    mergePatchFacesAngle         90;
    maxFaceThicknessRatio         0.5;

    maxThicknessToMedialRatio     0.3;
    nMedialAxisIter              10;
    nSmoothDisplacement          45;
    detectExtrusionIsland      true;

    minMedianAxisAngle          90;

    nBufferCellsNoExtrude        0;
}

meshQualityControls
{
    maxNonOrtho              50;
    maxBoundarySkewness       4;
    maxInternalSkewness       2;
    maxConcave               80;
    minVol                -1E30;
    minTetQuality         1E-30;
    minArea                  -1;
    minTwist               0.01;
    minDeterminant         0.01;
    minFaceWeight          0.05;
    minVolRatio            0.01;
    minTriangleTwist         -1;
    nSmoothScale              4;
    errorReduction         0.75;
    relaxed
    {
        maxNonOrtho          50;
    }
}

mergeTolerance 1e-6;

After the meshing process with addLayers I get this checkMesh result:

...

Checking basic patch addressing...
                   Patch    Faces   Points
          externalDomain     7560     7895
                   floor     2520     2671
                   inlet     1764     1849
                  outlet     1764     1849
                   rotor   136794   148215
              **nonCouple1    94800    97993
              nonCouple2    94800    97991**
    nonConformalCyclic_on_nonCouple1        0        0
    nonConformalCyclic_on_nonCouple2        0        0
    nonConformalError_on_nonCouple1        0        0
    nonConformalError_on_nonCouple2        0        0

Checking geometry...
    Overall domain bounding box (-10 -7 -7) (10 7 7)
    Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
    Mesh has 3 solution (non-empty) directions (1 1 1)
    Boundary openness (8.37944e-17 -9.93776e-18 2.88248e-17) OK.
    Max cell openness = 4.54606e-16 OK.
    Max aspect ratio = 17.7266 OK.
    Minimum face area = 2.28786e-07. Maximum face area = 0.111982.  Face area magnitudes OK.
    Min volume = 4.283e-10. Max volume = 0.0373099.  Total volume = 3919.99.  Cell volumes OK.
    Mesh non-orthogonality Max: 49.5951 average: 6.6127
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 3.8277 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

End

As you can notice the NonCopule patch has a slightly different number of points, which didn't occur if I mesh is generated without the layers, as you can notice here in the other checkMesh result after meshing without layer addition:

Code:
...

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
   *Number of regions: 2
    The mesh has multiple regions which are not connected by any face.
  <<Writing region information to "constant/cellToRegion"
  <<Writing region 0 with 2473395 cells to cellSet region0
  <<Writing region 1 with 326748 cells to cellSet region1

Checking basic patch addressing...
                   Patch    Faces   Points
          externalDomain     7560     7747
                   floor     2520     2623
                   inlet     1764     1849
                  outlet     1764     1849
                   rotor   138310   149323
              **nonCouple1    94800    97922
              nonCouple2    94800    97922**
    nonConformalCyclic_on_nonCouple1        0        0
    nonConformalCyclic_on_nonCouple2        0        0
    nonConformalError_on_nonCouple1        0        0
    nonConformalError_on_nonCouple2        0        0

Checking geometry...
    Overall domain bounding box (-10 -7 -7) (10 7 7)
    Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
    Mesh has 3 solution (non-empty) directions (1 1 1)
    Boundary openness (4.04474e-18 1.16983e-17 -6.35165e-17) OK.
    Max cell openness = 3.13835e-16 OK.
    Max aspect ratio = 6.43264 OK.
    Minimum face area = 3.73057e-07. Maximum face area = 0.11197.  Face area magnitudes OK.
    Min volume = 2.04163e-09. Max volume = 0.0373087.  Total volume = 3919.99.  Cell volumes OK.
    Mesh non-orthogonality Max: 48.1571 average: 6.48066
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 3.72748 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

End

So if Run the pimpleFoam I get, the following errors every time I use SHM with layers and nonCouple patches with a different numbers of points.

Create time
Create mesh for time = 0

patchToPatch: Calculating couplings between 94800 source faces and 94800 target faces
    Source min/average/max coverage = 1/1/1
    Target min/average/max coverage = 1/1/1
    Source average openness/error/depth/angle = 7.3383e-17/4.88935e-15/1.8353e-15/1.2387e-07
    Source max openness/error/depth/angle = 5.09752e-16/5.38361e-14/2.3632e-14/1.70755e-06
    196512 couplings calculated in 4.79937s
fvMeshStitcher: Connecting
    9/5 small couplings removed/added to nonConformalCyclic_on_nonCouple1
    Cell min/avg/max openness = 0/5.04361e-17/3.15049e-15
Selecting fvMeshMover motionSolver
Selecting motion solver: solidBody
Selecting solid-body motion function rotatingMotion
Applying solid body motion to cellZone innerCylinder

PIMPLE: No convergence criteria found


PIMPLE: Corrector convergence criteria found
        "(U|p)": tolerance 1e-05, relTol 0
        Calculations will do 2 corrections if the convergence criteria are not met


PIMPLE: Operating solver in transient mode with 2 outer correctors


Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting viscosity model constant
Selecting turbulence model type RAS
Selecting RAS turbulence model kOmegaSST
Selecting patchDistMethod meshWave
RAS
{
    model           kOmegaSST;
    turbulence      on;
    printCoeffs     on;
    alphaK1         0.85;
    alphaK2         1;
    alphaOmega1     0.5;
    alphaOmega2     0.856;
    gamma1          0.555556;
    gamma2          0.44;
    beta1           0.075;
    beta2           0.0828;
    betaStar        0.09;
    a1              0.31;
    b1              1;
    c1              10;
    F3              false;
}

No MRF models present

No fvModels present
No fvConstraints present
Constructing face velocity Uf

Courant Number mean: 0.000160286 max: 0.571237

Starting time loop

forces forces:
    Not including porosity effects
forces forces write:
    sum of forces:
        pressure : (0 0 0)
        viscous  : (0.00344544 0.00140939 0.00354055)
        porous   : (0 0 0)
    sum of moments:
        pressure : (0 0 0)
        viscous  : (-0.00122158 0.000314107 -0.000430482)
        porous   : (0 0 0)

Courant Number mean: 0.000160286 max: 0.571237
fvMeshStitcher: Disconnecting
    Cell min/avg/max openness = 0/4.86921e-17/2.84231e-16
Time = 5e-06s

PIMPLE: Iteration 1
patchToPatch: Calculating couplings between 94800 source faces and 94800 target faces
    Source min/average/max coverage = 0.992612/0.999979/1
    Target min/average/max coverage = 0.992987/0.999979/1
    Source average openness/error/depth/angle = 1.16439e-16/1.87615e-06/0.000106821/0.0127039
    Source max openness/error/depth/angle = 8.26571e-16/0.00267606/0.00265116/0.322249
    805944 couplings calculated in 1.61243s
fvMeshStitcher: Connecting
munmap_chunk(): invalid pointer
[Naboo:21796] *** Process received signal ***
[Naboo:21796] Signal: Aborted (6)
[Naboo:21796] Signal code:  (-6)
[Naboo:21796] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7fc7f8242520]
[Naboo:21796] [ 1] /lib/x86_64-linux-gnu/libc.so.6(pthread_kill+0x12c)[0x7fc7f8296a7c]
[Naboo:21796] [ 2] /lib/x86_64-linux-gnu/libc.so.6(raise+0x16)[0x7fc7f8242476]
[Naboo:21796] [ 3] /lib/x86_64-linux-gnu/libc.so.6(abort+0xd3)[0x7fc7f82287f3]
[Naboo:21796] [ 4] /lib/x86_64-linux-gnu/libc.so.6(+0x896f6)[0x7fc7f82896f6]
[Naboo:21796] [ 5] /lib/x86_64-linux-gnu/libc.so.6(+0xa0d7c)[0x7fc7f82a0d7c]
[Naboo:21796] [ 6] /lib/x86_64-linux-gnu/libc.so.6(+0xa105c)[0x7fc7f82a105c]
[Naboo:21796] [ 7] /lib/x86_64-linux-gnu/libc.so.6(free+0xba)[0x7fc7f82a551a]
[Naboo:21796] [ 8] /home/efirvida/.local/easybuild/software/OpenFOAM/10-foss-2022a/OpenFOAM-10/platforms/linux64GccDPInt32Opt/lib/libfvMeshStitchers.so(+0x2e88b)[0x7fc7ef86a88b]
[Naboo:21796] [ 9] /home/efirvida/.local/easybuild/software/OpenFOAM/10-foss-2022a/OpenFOAM-10/platforms/linux64GccDPInt32Opt/lib/libfvMeshStitchers.so(+0x2e988)[0x7fc7ef86a988]
[Naboo:21796] [10] /home/efirvida/.local/easybuild/software/OpenFOAM/10-foss-2022a/OpenFOAM-10/platforms/linux64GccDPInt32Opt/lib/libfvMeshStitchers.so(_ZN4Foam15fvMeshStitchers6moving26internalFaceCorrectMeshPhiERNS_14GeometricFieldIdNS_13fvsPatchFieldENS_11surfaceMeshEEE+0x880)[0x7fc7ef872520]
[Naboo:21796] [11] /home/efirvida/.local/easybuild/software/OpenFOAM/10-foss-2022a/OpenFOAM-10/platforms/linux64GccDPInt32Opt/lib/libfvMeshStitchers.so(_ZN4Foam15fvMeshStitchers6moving14correctMeshPhiERKNS_22GeometricBoundaryFieldIiNS_13fvsPatchFieldENS_11surfaceMeshEEERNS_14GeometricFieldINS_6VectorIdEES3_S4_EESC_+0x2d8)[0x7fc7ef875698]
[Naboo:21796] [12] [6] #0  Foam::error::printStack(Foam::Ostream&)/home/efirvida/.local/easybuild/software/OpenFOAM/10-foss-2022a/OpenFOAM-10/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so(_ZN4Foam14fvMeshStitcher7connectEbbb+0x2a5)[0x7fc7fa888095]
[Naboo:21796] [13] /home/efirvida/.local/easybuild/software/OpenFOAM/10-foss-2022a/OpenFOAM-10/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so(_ZN4Foam6fvMesh4moveEv+0x5a)[0x7fc7fa75512a]
[Naboo:21796] [14] pimpleFoam[0x42c6a2]
[Naboo:21796] [15] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7fc7f8229d90]
[Naboo:21796] [16] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7fc7f8229e40]
[Naboo:21796] [17] pimpleFoam[0x430a15]
[Naboo:21796] *** End of error message ***
 at ??:?
[6] #1  Foam::sigSegv::sigHandler(int) at ??:?
[6] #2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
[6] #3  free in "/lib/x86_64-linux-gnu/libc.so.6"
[6] #4  ? at fvMeshStitchersMoving.C:?
[6] #5  ? at fvMeshStitchersMoving.C:?
[6] #6  Foam::fvMeshStitchers::moving::internalFaceCorrectMeshPhi(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>&) at ??:?
[6] #7  Foam::fvMeshStitchers::moving::correctMeshPhi(Foam::GeometricBoundaryField<int, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>&, Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>&) at ??:?
[6] #8  Foam::fvMeshStitcher::connect(bool, bool, bool) at ??:?
[6] #9  Foam::fvMesh::move() at ??:?
[6] #10  --------------------------------------------------------------------------
Primary job  terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.
--------------------------------------------------------------------------
? at ??:?
[6] #11  ? in "/lib/x86_64-linux-gnu/libc.so.6"
[6] #12  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
[6] #13  ? at ??:?
[Naboo:21794:0:21794] Caught signal 11 (Segmentation fault: tkill(2) or tgkill(2) at address 0x3e800005522)
==== backtrace (tid:  21794) ====
 0 0x0000000000042520 __GI___sigaction()  :0
 1 0x0000000000096a7c __pthread_kill_implementation()  ./nptl/pthread_kill.c:43
 2 0x0000000000096a7c __pthread_kill_internal()  ./nptl/pthread_kill.c:78
 3 0x0000000000096a7c __GI___pthread_kill()  ./nptl/pthread_kill.c:89
 4 0x0000000000042476 __GI_raise()  ./signal/../sysdeps/posix/raise.c:26
 5 0x0000000000042520 __GI___sigaction()  :0
 6 0x00000000000a54c9 arena_for_chunk()  ./malloc/arena.c:162
 7 0x00000000000a54c9 arena_for_chunk()  ./malloc/arena.c:160
 8 0x00000000000a54c9 __GI___libc_free()  ./malloc/malloc.c:3390
 9 0x000000000002e88b Foam::Pstream::gather<Foam::List<double>, Foam::ListOp<Foam::sumOp<double> > >()  fvMeshStitchersMoving.C:0
10 0x000000000002e988 Foam::reduce<Foam::List<double>, Foam::ListOp<Foam::sumOp<double> > >()  fvMeshStitchersMoving.C:0
11 0x0000000000036520 Foam::fvMeshStitchers::moving::internalFaceCorrectMeshPhi()  ???:0
12 0x0000000000039698 Foam::fvMeshStitchers::moving::correctMeshPhi()  ???:0
13 0x0000000000888095 Foam::fvMeshStitcher::connect()  ???:0
14 0x000000000075512a Foam::fvMesh::move()  ???:0
15 0x000000000042c6a2 main()  ???:0
16 0x0000000000029d90 __libc_start_call_main()  ./csu/../sysdeps/nptl/libc_start_call_main.h:58
17 0x0000000000029e40 __libc_start_main_impl()  ./csu/../csu/libc-start.c:392
18 0x0000000000029e40 __libc_start_main_impl()  ./csu/../csu/libc-start.c:379
19 0x0000000000430a15 _start()  ???:0
=================================
[Naboo:21794] *** Process received signal ***
[Naboo:21794] Signal: Segmentation fault (11)
[Naboo:21794] Signal code:  (-6)
[Naboo:21794] Failing at address: 0x3e800005522
[Naboo:21794] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f2fae842520]
[Naboo:21794] [ 1] /lib/x86_64-linux-gnu/libc.so.6(pthread_kill+0x12c)[0x7f2fae896a7c]
[Naboo:21794] [ 2] /lib/x86_64-linux-gnu/libc.so.6(raise+0x16)[0x7f2fae842476]
[Naboo:21794] [ 3] /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f2fae842520]
[Naboo:21794] [ 4] /lib/x86_64-linux-gnu/libc.so.6(free+0x69)[0x7f2fae8a54c9]
[Naboo:21794] [ 5] /home/efirvida/.local/easybuild/software/OpenFOAM/10-foss-2022a/OpenFOAM-10/platforms/linux64GccDPInt32Opt/lib/libfvMeshStitchers.so(+0x2e88b)[0x7f2fa806588b]
[Naboo:21794] [ 6] /home/efirvida/.local/easybuild/software/OpenFOAM/10-foss-2022a/OpenFOAM-10/platforms/linux64GccDPInt32Opt/lib/libfvMeshStitchers.so(+0x2e988)[0x7f2fa8065988]
[Naboo:21794] [ 7] /home/efirvida/.local/easybuild/software/OpenFOAM/10-foss-2022a/OpenFOAM-10/platforms/linux64GccDPInt32Opt/lib/libfvMeshStitchers.so(_ZN4Foam15fvMeshStitchers6moving26internalFaceCorrectMeshPhiERNS_14GeometricFieldIdNS_13fvsPatchFieldENS_11surfaceMeshEEE+0x880)[0x7f2fa806d520]
[Naboo:21794] [ 8] /home/efirvida/.local/easybuild/software/OpenFOAM/10-foss-2022a/OpenFOAM-10/platforms/linux64GccDPInt32Opt/lib/libfvMeshStitchers.so(_ZN4Foam15fvMeshStitchers6moving14correctMeshPhiERKNS_22GeometricBoundaryFieldIiNS_13fvsPatchFieldENS_11surfaceMeshEEERNS_14GeometricFieldINS_6VectorIdEES3_S4_EESC_+0x2d8)[0x7f2fa8070698]
[Naboo:21794] [ 9] /home/efirvida/.local/easybuild/software/OpenFOAM/10-foss-2022a/OpenFOAM-10/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so(_ZN4Foam14fvMeshStitcher7connectEbbb+0x2a5)[0x7f2fb0e88095]
[Naboo:21794] [10] /home/efirvida/.local/easybuild/software/OpenFOAM/10-foss-2022a/OpenFOAM-10/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so(_ZN4Foam6fvMesh4moveEv+0x5a)[0x7f2fb0d5512a]
[Naboo:21794] [11] pimpleFoam[0x42c6a2]
[Naboo:21794] [12] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7f2fae829d90]
[Naboo:21794] [13] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7f2fae829e40]
[Naboo:21794] [14] pimpleFoam[0x430a15]
[Naboo:21794] *** End of error message ***
--------------------------------------------------------------------------
mpirun noticed that process rank 8 with PID 0 on node Naboo exited on signal 6 (Aborted).
--------------------------------------------------------------------------

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions