error when comiling src

Submitted by lenard10 on Fri, 04/15/2011 - 21:53

Hi,
The wmake for Cfdemparticle src ran smoothly for a while then I got following errors:
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.H:45:17: error: mpi.h: No such file or directory
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.H:46:62: error: lammps.h: No such file or directory
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.H:47:19: error: input.h: No such file or directory
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.H:48:18: error: atom.h: No such file or directory
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.H:49:21: error: library.h: No such file or directory
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.H:51:34: error: library_cfd_coupling.h: No such file or directory
In file included from subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:30:
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.H:79: error: ‘MPI_Comm’ does not name a type
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.H:81: error: ‘LAMMPS_NS’ has not been declared
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.H:81: error: ISO C++ forbids declaration of ‘LAMMPS’ with no type
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.H:81: error: expected ‘;’ before ‘*’ token
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C: In constructor ‘Foam::twoWayMPI::twoWayMPI(const Foam::dictionary&, Foam::cfdemCloud&)’:
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:69: error: ‘MPI_COMM_WORLD’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:69: error: ‘MPI_Comm_rank’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:70: error: ‘MPI_Comm_size’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:73: error: ‘MPI_UNDEFINED’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:75: error: ‘comm_liggghts’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:75: error: ‘MPI_Comm_split’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:92: error: ‘MPI_Abort’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:96: error: ‘lmp’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:96: error: expected type-specifier before ‘LAMMPS_NS’
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:96: error: expected ‘;’ before ‘LAMMPS_NS’
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:106: error: ‘MPI_INT’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:106: error: ‘MPI_Bcast’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:108: error: ‘MPI_CHAR’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:109: error: ‘lmp’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C: In member function ‘virtual void Foam::twoWayMPI::getVectorData(Foam::word, double** const&) const’:
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:136: error: ‘lmp’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:136: warning: use of old-style cast
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:136: error: ‘data_liggghts_to_of’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C: In member function ‘virtual void Foam::twoWayMPI::getScalarData(Foam::word, double** const&) const’:
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:146: error: ‘lmp’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:146: warning: use of old-style cast
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:146: error: ‘data_liggghts_to_of’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C: In member function ‘virtual void Foam::twoWayMPI::giveVectorData(Foam::word, double** const&) const’:
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:156: error: ‘lmp’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:156: warning: use of old-style cast
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:156: error: ‘data_of_to_liggghts’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C: In member function ‘virtual void Foam::twoWayMPI::giveScalarData(Foam::word, double** const&) const’:
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:166: error: ‘lmp’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:166: warning: use of old-style cast
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:166: error: ‘data_of_to_liggghts’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C: In member function ‘virtual void Foam::twoWayMPI::allocateArray(double**&, double, int, int) const’:
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:180: error: ‘lmp’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:180: error: ‘allocate_external_double’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C: In member function ‘virtual bool Foam::twoWayMPI::couple() const’:
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:200: error: ‘lmp’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:205: error: ‘lmp’ was not declared in this scope
subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C:205: error: ‘lammps_get_natoms’ was not declared in this scope
make: *** [Make/linux64GccDPOpt/twoWayMPI.o] Error 1

I added -fPIC in liggghts make.fedora file but it still didn't work. May I know what is the possible reason?
BTW: The older version of cfdem ran well using the installation tutorial.

Thank you guys!

Lenard

cgoniva's picture

cgoniva | Mon, 04/18/2011 - 08:50

Dear Lenard,

seems like your compiler cannot find the files necessary for the coupling via MPI.
These were not necessary for the coupling via files - That's why it worked for the previous release.

Please use the
use the 1.7.x source pack version (not the pre-compiled)
please see instructions at:
http://www.openfoam.com/download/source.php

Cheers,
Christoph

Kazzack | Wed, 04/20/2011 - 14:28

I have used the source version of openfoam suggested, but I'm facing the same problem in compiling, also initial I'm getting the following error
subModels/momCoupleModel/explicitCouple/explicitCouple.C

could not open file RASModel.H for source file subModels/momCoupleModel/explicitCouple/explicitCouple.C

Making dependency list for source file subModels/momCoupleModel/implicitCouple/implicitCouple.C

could not open file RASModel.H for source file subModels/momCoupleModel/implicitCouple/implicitCouple.C

Making dependency list for source file subModels/regionModel/regionModel/regionModel.C

could not open file RASModel.H for source file subModels/regionModel/regionModel/regionModel.C

Making dependency list for source file subModels/regionModel/regionModel/newRegionModel.C

could not open file RASModel.H for source file subModels/regionModel/regionModel/newRegionModel.C

Making dependency list for source file subModels/regionModel/allRegion/allRegion.C

could not open file RASModel.H for source file subModels/regionModel/allRegion/allRegion.C

Making dependency list for source file subModels/dataExchangeModel/dataExchangeModel/dataExchangeModel.C

could not open file RASModel.H for source file subModels/dataExchangeModel/dataExchangeModel/dataExchangeModel.C

Making dependency list for source file subModels/dataExchangeModel/dataExchangeModel/newDataExchangeModel.C

could not open file RASModel.H for source file subModels/dataExchangeModel/dataExchangeModel/newDataExchangeModel.C

could not open file sys/stat.h for source file subModels/dataExchangeModel/dataExchangeModel/newDataExchangeModel.C

Making dependency list for source file subModels/dataExchangeModel/twoWayFiles/twoWayFiles.C

could not open file RASModel.H for source file subModels/dataExchangeModel/twoWayFiles/twoWayFiles.C

could not open file sys/stat.h for source file subModels/dataExchangeModel/twoWayFiles/twoWayFiles.C

Making dependency list for source file subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C

could not open file RASModel.H for source file subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C

could not open file sys/stat.h for source file subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C

Making dependency list for source file subModels/averagingModel/averagingModel/averagingModel.C

could not open file RASModel.H for source file subModels/averagingModel/averagingModel/averagingModel.C

Making dependency list for source file subModels/averagingModel/averagingModel/newAveragingModel.C

could not open file RASModel.H for source file subModels/averagingModel/averagingModel/newAveragingModel.C

Making dependency list for source file subModels/averagingModel/dilute/dilute.C

could not open file RASModel.H for source file subModels/averagingModel/dilute/dilute.C

Making dependency list for source file subModels/averagingModel/dense/dense.C

could not open file RASModel.H for source file subModels/averagingModel/dense/dense.C

Kazzack | Wed, 04/20/2011 - 17:24

It didnt work,
then I have tried by using the development version of the liggghts, and I'am having the error given on node/294

I have one doubt related to the above link and that is
Following setting in LIGGGHTS/SRC/MAKE/Makefile.xy and re-compile LIGGGHTS

CC = mpic++
CCFLAGS = -g -O3 -fPIC
DEPFLAGS = -M
LINK = mpic++
LINKFLAGS = -g -O3 -fPIC
LIB =
ARCHIVE = ar
ARFLAGS = -rc
SIZE = size
Should a new Makefile.xy should be created, or the Makefile.openmpi
should be edited.
Please suggest

ckloss's picture

ckloss | Wed, 04/20/2011 - 17:53

Hi Kazzak,

just edit the makefile. If that does not resolve it please have a look at the installation guideline and browse the forum threads - I am sure your question will be answered there.

Christoph

Tao | Mon, 05/02/2011 - 01:41

Hi Lenard,
I got the same problem when I try to compile src in the folder "cd ..../user-1.7.1/src/lagrangian/cfdemParticle". I found a solution for the error of header files as listed in your post. In the "subModels/dataExchangeModel/twoWayMPI/twoWayMPI.H", you can find all the error header files. They are all LAMMPS included files. You can locate them under the folder $HOME/myliggghts/src. Thus, these files actually exist in the computer. However, the compiler cannot locate them. Thus, I tried several ways to solve this problem.
Step 1: Open the file "options" under the folder: /OpenFOAM-1.7.1/src/lagrangian/cfdemParticle/Make. This file contains the full directory paths to locate header files. The path "$(CFDEM_LIGGGHTS_SRC_DIR)" is the path for "$HOME/myliggghts/src". However, when I type "echo $ CFDEM_LIGGGHTS_SRC_DIR" in the terminal, a different path for this environmental variable came out. Thus, it's quite clear that there is something wrong with this variable.
Step 2: We need to fix this wrong link. Go to "/OpenFOAM-1.7.1/src/lagrangian/cfdemParticle/etc" and open the "bashrc" file. Edit this line "export CFDEM_LIGGGHTS_SRC_DIR=$HOME/myliggghts/src" to the correct path.
Step 3: Open a new terminal. Type "echo $ FDEM_LIGGGHTS_SRC_DIR", correct path would appear.
Step 4: Everything is Ok now. Re-compile src in the folder "cd ..../user-1.7.1/src/lagrangian/cfdemParticle". No error occur.

Cheers,
Tao