CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Error in layer addition/removal: Need help debugging

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Zena27

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 11, 2023, 06:47
Exclamation Error in layer addition/removal: Need help debugging
  #1
Member
 
Zeinab
Join Date: Feb 2023
Posts: 32
Rep Power: 3
Zena27 is on a distinguished road
Hello,
I am working with layer addition and removal and I get an error when ever I use it. The error is shown below.

Code:
#0  Foam::error::printStack(Foam::Ostream&) in ~/OpenFOAM/OpenFOAM-v2212/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so
#1  Foam::sigSegv::sigHandler(int) in ~/OpenFOAM/OpenFOAM-v2212/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so
#2  ? in /usr/lib64/libpthread.so.0
#3  Foam::cell::edgesFromFaceList(Foam::List<Foam::face> const&) const in ~/OpenFOAM/OpenFOAM-v2212/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so
#4  Foam::layerAdditionRemoval::changeTopology() const in ~/OpenFOAM/OpenFOAM-v2212/platforms/linux64GccDPInt32Opt/lib/libdynamicMesh.so
#5  Foam::polyTopoChanger::changeTopology() const in ~/OpenFOAM/OpenFOAM-v2212/platforms/linux64GccDPInt32Opt/lib/libdynamicMesh.so
#6  Foam::polyTopoChanger::changeMesh(bool, bool, bool, bool) in ~/OpenFOAM/OpenFOAM-v2212/platforms/linux64GccDPInt32Opt/lib/libdynamicMesh.so
#7  Foam::dynamicMotionSolverTopoFvMesh::update() in ~/OpenFOAM/OpenFOAM-v2212/platforms/linux64GccDPInt32Opt/lib/libtopoChangerFvMesh.so
#8  ? in ~/OpenFOAM/OpenFOAM-v2212/platforms/linux64GccDPInt32Opt/bin/moveDynamicMesh
#9  __libc_start_main in /usr/lib64/libc.so.6
#10  ? in ~/OpenFOAM/OpenFOAM-v2212/platforms/linux64GccDPInt32Opt/bin/moveDynamicMesh
When I traced the error I found that it happens at the changeTopology() function especially in line 217 in layerAdditionRemoval.C
Code:
  const edgeList cellEdges(cFaces.edges(mesh.faces()));
I traced it even more and I found that the error comes from the Foam::cell:edges() function. This function is used to compute the set of unique edges of the cell by iterating over all the faces and edges of the cell and adding each unique edge to a list. which. The function is shown below:

Code:
Foam::edgeList Foam::cell::edges(const faceUList& meshFaces) const
{
    const labelList& cFaces = *this;
 
    label nEdges = 0;
    for (const label facei : cFaces)
    {
        nEdges += meshFaces[facei].nEdges();
    }
 
    edgeList allEdges(nEdges);
 
    nEdges = 0;
 
    forAll(cFaces, facei)
    {
        for (const edge& curEdge : meshFaces[cFaces[facei]].edges())
        {
            bool edgeFound = false;
 
            for (label checki = 0; checki < nEdges; ++checki)
            {
                if (curEdge == allEdges[checki])
                {
                    edgeFound = true;
                    break;
                }
            }
 
            if (!edgeFound)
            {
                allEdges[nEdges] = curEdge;
                ++nEdges;
            }
        }
    }
When I tried to debug it, I found that the size of the cFaces labelList created at the first line doesn't have the same size as the meshFaces faceList passed to the function. I checked the total number of faces in the mesh and It matched the one with the meshFaces faceList. Also the forloop keeps running until the iterations > meshfaces.size().

I have few questions related to this problem:

1. Is it a high level problem or it's a low level. I checked the error because I have a perfect mesh that expands from the top and compresses near the bottom and just waits for layer addtition/ removal.

2. How deos the cFaces labelList created and how does it have a larger size that the meshFaces faceList?

3. Is there any easier way of debugging because It was so hard editing and then using wmake and then running?

4. What are the possible causes and potential solutions to this?

Last edited by Zena27; May 11, 2023 at 10:33.
Zena27 is offline   Reply With Quote

Old   May 11, 2023, 10:32
Cool
  #2
Member
 
Zeinab
Join Date: Feb 2023
Posts: 32
Rep Power: 3
Zena27 is on a distinguished road
Hello Guys,
I managed to figure out what's going on. The problem was really frustrating.
So basically the problem was on the orientation of the faceZones on which I will apply the layer addition/removal.
So if you look at the sphere drop case, the topoSetDict file, you will see these lines in the creation of the top and bottom faceZones.

Code:
       source  setAndNormalToFaceZone;
        faceSet bottom;
        normal  (0 1 0);
so the definition of the normal is really important because what I understood is that it was trying to read the edges outside my mesh causing it to crash. So you have to get the correct orientation of the faceZones for your layer addition/removal to work.
AliVali likes this.
Zena27 is offline   Reply With Quote

Reply

Tags
debugging, labellist, layeradditionremoval, sourcecodemodify


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] Help with Snappy: no layers growing GianF OpenFOAM Meshing & Mesh Conversion 2 September 23, 2020 09:26
[snappyHexMesh] layer not added Rasmusiwersen OpenFOAM Meshing & Mesh Conversion 1 January 2, 2020 10:43
Prismatic boundary layer KateEisenhower enGrid 5 September 15, 2015 08:48
[snappyHexMesh] Boundary layer generation problems ivan_cozza OpenFOAM Meshing & Mesh Conversion 0 October 6, 2010 14:47
errors Fahad Main CFD Forum 0 March 23, 2004 14:20


All times are GMT -4. The time now is 17:42.