Error at reading STL mesh file in Coupled CFD-DEM Simulation

Submitted by lesscharles on Tue, 07/18/2017 - 20:12

Hello, I'm facing this problem with the new version of CFDEM Coupling.
I'm attaching the log file of the simulation, but the error starts as:

Reading STL file '../DEM/Coarse_DEM_mesh.stl' (mesh processing step 1/3)
[2] #0 Foam::error::printStack(Foam::Ostream&)[3] #0 Foam::error::printStack(Foam::Ostream&)[1] #0 Foam::error::printStack(Foam::Ostream&) at ??:?
[2] #1 Foam::sigSegv::sigHandler(int) at ??:?
[3] #1 Foam::sigSegv::sigHandler(int) at ??:?
[1] #1 Foam::sigSegv::sigHandler(int) at ??:?
[2] #2 ? at ??:?
[3] #2 ? at ??:?
[1] #2 ? in "/lib/x86_64-linux-gnu/libpthread.so.0"
[2] #3 fclose in "/lib/x86_64-linux-gnu/libpthread.so.0" in "/lib/x86_64-linux-gnu/libpthread.so.0"

Essentially the simulation (that works with a CFD only and DEM only) it's not even starting.

To the best of my knowledge, I didn't get very far trying changing mesh size, 'cause a segmentation fault could have been caused by a very small mesh.
Thanks for the attention

medvedeg | Fri, 07/21/2017 - 09:54

Hallo lesscharles,

reading of the stl mesh crashed on LIGGGHTS side. Could you please provide the full setup?

Alexander Podlozhnyuk

j-kerbl's picture

j-kerbl | Mon, 07/31/2017 - 11:32

Hi lesscharles,

I was able to reproduce the error. I found a small bug with parallel handling of binary STL files.
You can either switch to ASCII stls or apply a patch, which you can find in the next reply and recompile.

Thanks for sharing your case!

Cheers,
Josef

j-kerbl's picture

j-kerbl | Mon, 07/31/2017 - 11:34

diff --git a/src/input_mesh_tri.cpp b/src/input_mesh_tri.cpp
index 27d3d5b..7f059a4 100644
--- a/src/input_mesh_tri.cpp
+++ b/src/input_mesh_tri.cpp
@@ -378,9 +378,12 @@ void InputMeshTri::meshtrifile_stl(class TriMesh *mesh,class Region *region, con
 
     if (strcmp(arg[0],"solid") != 0 && nLines == 1)
     {
-        if (me == 0 && verbose_)
-            fprintf(screen,"Note: solid keyword not found, assuming binary stl file\n");
-        fclose(nonlammps_file);
+        if (me == 0)
+        {
+            fclose(nonlammps_file);
+            if (verbose_)
+                fprintf(screen,"Note: solid keyword not found, assuming binary stl file\n");
+        }
         nonlammps_file = NULL;
         meshtrifile_stl_binary(mesh, region, filename);
         break;
@@ -540,11 +543,11 @@ void InputMeshTri::meshtrifile_stl_binary(class TriMesh *mesh, class Region *reg
             // error handling
             if (!stl_file)
                 error->one(FLERR,"Corrupt STL file: Error in reading binary STL file.");
-            // increase triangle counter
-            count++;
         }
         // communicate triangle data
         MPI_Bcast(&tri_data,12,MPI_FLOAT,0,world);
+        // increase triangle counter
+        count++;
         if(size_exclusion_list_ > 0 && count == (unsigned int)exclusion_list_[i_exclusion_list_]) {
             if(i_exclusion_list_ < size_exclusion_list_-1)
                 i_exclusion_list_++;

lesscharles | Wed, 09/06/2017 - 19:27

Thanks for the reply!
I've focused my attention to other cases in last weeks, and I can't recompile CFDEM, but in future how can I apply the patch?
Do I have to move to the master folder and then type the code you wrote, before re-compiling LIGGGHTS?
I'm glad to have helped you find out bugs!

j-kerbl's picture

j-kerbl | Mon, 10/16/2017 - 11:17

Hi lesschares,

it works with the patch command.
https://linux.die.net/man/1/patch

Cheers,
Josef