Compiling Error CFDEM Solvers

Submitted by breeze on Tue, 11/09/2021 - 16:00

Hi, I have problems compiling CFDEMCoupling on a Linux machine (Fedora34). I first had problems with VTK and compiling Liggghts. I used the auto makefile and switched auto install of VTK to on. However, I still had to set CFDEM_ADD_LIB_PATHS and CFDEM_ADD_LIBS in additionalLibs_5.x to get the compilation to work. I set the paths according to the following post: https://www.cfdem.com/comment/19083#comment-19083

I also got an error regarding line 70 in file utils.h. So I changed it
from: "return static_cast< std::ostringstream & >(( std::ostringstream() << std::dec << a ) ).str();"
to: "return static_cast< std::ostringstream & >(( std::ostringstream().flush() << std::dec << a ) ).str();"

Compiling with the above mentioned adaptions by the command cfdemCompCFDEMall I managed to successfully compile Liggghts, cfdemParticle, scalarTransportModelsCFDEM and fvOptionsCFDEM. However, I get the following error regarding all the cfdem Solvers (log file of cfdemSolverPisoSTM is attached):

g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -DOMPI_SKIP_MPICXX -DSUPERQUADRIC_ACTIVE_FLAG -DNONSPHERICAL_ACTIVE_FLAG -DCFDEMWMPROJECTVERSION="50" -I/usr/include/openmpi-x86_64 -pthread -I/home/bego01/OpenFOAM/OpenFOAM-5.x/src/TurbulenceModels/turbulenceModels/lnInclude -I/home/bego01/OpenFOAM/OpenFOAM-5.x/src/TurbulenceModels/incompressible/lnInclude -I/home/bego01/OpenFOAM/OpenFOAM-5.x/src/fvOptions/lnInclude -I/home/bego01/OpenFOAM/OpenFOAM-5.x/src/transportModels -I/home/bego01/OpenFOAM/OpenFOAM-5.x/src/transportModels/incompressible/singlePhaseTransportModel -I/home/bego01/OpenFOAM/OpenFOAM-5.x/src/finiteVolume/lnInclude -I/home/bego01/OpenFOAM/OpenFOAM-5.x/src/meshTools/lnInclude -I/home/bego01/OpenFOAM/OpenFOAM-5.x/src/fvOptions/lnInclude -I/home/bego01/CFDEM/CFDEMcoupling-PUBLIC-5.x/src/lagrangian/cfdemParticle/lnInclude -I/home/bego01/CFDEM/CFDEMcoupling-PUBLIC-5.x/src/lagrangian/cfdemParticle/cfdTools -I/home/bego01//LIGGGHTS/LIGGGHTS-PUBLIC/src -IlnInclude -I. -I/home/bego01/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude -I/home/bego01/OpenFOAM/OpenFOAM-5.x/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt32Opt/cfdemSolverPiso.o -L/home/bego01/OpenFOAM/OpenFOAM-5.x/platforms/linux64GccDPInt32Opt/lib \
-L/home/bego01/CFDEM/CFDEMcoupling-PUBLIC-5.x/platforms/linux64GccDPInt32Opt/lib -lturbulenceModels -lincompressibleTurbulenceModels -lfvOptions -lincompressibleTransportModels -lfiniteVolume -lmeshTools -lfvOptions -llagrangianCFDEM-PUBLIC-5.x -Wl,-rpath,/home/bego01/LIGGGHTS/LIGGGHTS-PUBLIC/lib/vtk/install/lib -L/home/bego01/LIGGGHTS/LIGGGHTS-PUBLIC/lib/vtk/install/lib -lvtkCommonCore-8.0 -lvtkIOCore-8.0 -lvtkIOXML-8.0 -lvtkIOLegacy-8.0 -lvtkIOImage-8.0 -lvtkCommonDataModel-8.0 - lvtkIOParallelXML-8.0 -lvtkParallelCore-8.0 -lvtkParallelMPI-8.0 -lvtkCommonExecutionModel-8.0 -lvtkFiltersCore-8.0 -lvtksys-8.0 -lvtkCommonMisc-8.0 -lvtkCommonTransforms-8.0 -lvtkCommonMath-8.0 -lvtkIOXMLParser-8.0 -lvtkCommonSystem-8.0 -lvtkDICOMParser-8.0 -lvtkmetaio-8.0 -lOpenFOAM -ldl \
-lm -o /home/bego01/CFDEM/CFDEMcoupling-PUBLIC-5.x/platforms/linux64GccDPInt32Opt/bin/cfdemSolverPiso
g++: error: -E or -x required when input is from standard input
make: *** [/home/bego01/OpenFOAM/OpenFOAM-5.x/wmake/makefiles/general:142: /home/bego01/CFDEM/CFDEMcoupling-PUBLIC-5.x/platforms/linux64GccDPInt32Opt/bin/cfdemSolverPiso] Error 1

Can someone please help me out here? I have no idea what the problem is and how to solve it. CFDEMCoupling used to work on my machine. However, I keep having recompiling issues every now and then after a system update. But this time I can't find a way to get it to work again.

Cheers
Breeze

breeze | Tue, 11/23/2021 - 14:36

In case someone faces a similar issue, I managed to fix the problem. The problem was with the VTK paths. It seems, that most of the time VTK is the problem when installing CFEDM on clusters.

As mentioned before I originally changed CFDEM_ADD_LIB_PATHS and CFDEM_ADD_LIBS in additionalLibs_5.x to add the correct VTK paths. With this I managed to compile everything except for the solvers. I fixed this problem by not adding the VTK paths in additionalLibs_5.x but in the makefile.mpi within the LIGGGHTS src directory in the following way:

VTK_INC = -I/home/username/LIGGGHTS/LIGGGHTS-PUBLIC/lib/vtk/install/include/vtk-8.0
VTK_PATH = -L/home/username/LIGGGHTS/LIGGGHTS-PUBLIC/lib/vtk/build/lib -Wl,-rpath,/home/username/LIGGGHTS/LIGGGHTS-PUBLIC/lib/vtk/build/lib
VTK_LIB = -lvtkCommonCore-8.0 -lvtkIOCore-8.0 -lvtkIOXML-8.0 -lvtkIOLegacy-8.0 -lvtkCommonDataModel-8.0 -lvtkIOParallel-8.0 -lvtkParallelCore-8.0 –lvtkParallelMPI-8.0 -lvtkIOImage-8.0 -lvtkCommonExecutionModel-8.0 -lvtkFiltersCore-8.0 -lvtkIOParallelXML-8.0

Here I use VTK that was downloaded and installed via Autoinstall during "make auto". On a different cluster, the auto install function didn't work and Liggghts could not be compiled with VTK version installed on the system. I fixed this by manually downloading VTK from Git and installed it within my local account. Here I used the VTK version 8.0.1 (make sure that when using cmake, you set MPI to ON and set an install directory with CMAKE_INSTALL_PREFIX, where all the header files are located). The paths in makefile.mpi need to be adapted to the paths of your manually installed vtk version then.

To compile CFDEM with makefile.mpi make sure that "export CFDEM_LIGGGHTS_MAKEFILE_NAME=mpi" is set in your bashrc.