xiaoh / sediFoam

CFD-DEM Solver with emphasis on sediment transport
GNU General Public License v2.0
105 stars 51 forks source link

lammpsFOAM Compilation Error #2

Closed JoshYEn closed 7 years ago

JoshYEn commented 7 years ago

I followed the instructions, and I've already installed OpenFOAM & complied the lammps packages. But, there were some errors occurred while I was compiling the softParticleCloud.C (lammpsFOAM).

Issues: (part of commands)

softParticleCloud.C:73:23: note: in expansion of macro ‘MPI_COMM_WORLD’
             MPI_Abort(MPI_COMM_WORLD, 1);
                       ^
softParticleCloud.C:80:21: error: ‘lammps_sync’ was not declared in this scope
     lammps_sync(lmp_);
                     ^
In file included from /home/ay/OpenFOAM/ay-2.4.0/run/sediFoam/lammpsFoam/include/LammpsCollection.H:7:0,
                 from softParticleCloud.H:47,
                 from softParticleCloud.C:27:
/usr/lib/openmpi/include/mpi.h:305:72: warning: use of old-style cast [-Wold-style-cast]
 #define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void *) &(global)))
                                                                        ^
/usr/lib/openmpi/include/mpi.h:902:18: note: in expansion of macro ‘OMPI_PREDEFINED_GLOBAL’
 #define MPI_CHAR OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_char)
                  ^
softParticleCloud.C:105:26: note: in expansion of macro ‘MPI_CHAR’
         MPI_Bcast(line,n,MPI_CHAR,0,MPI_COMM_WORLD);
                          ^
/usr/lib/openmpi/include/mpi.h:305:73: warning: use of old-style cast [-Wold-style-cast]
 #define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void *) &(global)))
                                                                         ^
/usr/lib/openmpi/include/mpi.h:902:18: note: in expansion of macro ‘OMPI_PREDEFINED_GLOBAL’
 #define MPI_CHAR OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_char)
                  ^
softParticleCloud.C:105:26: note: in expansion of macro ‘MPI_CHAR’
         MPI_Bcast(line,n,MPI_CHAR,0,MPI_COMM_WORLD);
                          ^
/usr/lib/openmpi/include/mpi.h:305:72: warning: use of old-style cast [-Wold-style-cast]
 #define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void *) &(global)))
                                                                        ^
/usr/lib/openmpi/include/mpi.h:879:24: note: in expansion of macro ‘OMPI_PREDEFINED_GLOBAL’
 #define MPI_COMM_WORLD OMPI_PREDEFINED_GLOBAL( MPI_Comm, ompi_mpi_comm_world)
                        ^
softParticleCloud.C:105:37: note: in expansion of macro ‘MPI_COMM_WORLD’
         MPI_Bcast(line,n,MPI_CHAR,0,MPI_COMM_WORLD);
                                     ^
/usr/lib/openmpi/include/mpi.h:305:73: warning: use of old-style cast [-Wold-style-cast]
 #define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void *) &(global)))
                                                                         ^
/usr/lib/openmpi/include/mpi.h:879:24: note: in expansion of macro ‘OMPI_PREDEFINED_GLOBAL’
 #define MPI_COMM_WORLD OMPI_PREDEFINED_GLOBAL( MPI_Comm, ompi_mpi_comm_world)
                        ^
softParticleCloud.C:105:37: note: in expansion of macro ‘MPI_COMM_WORLD’
         MPI_Bcast(line,n,MPI_CHAR,0,MPI_COMM_WORLD);
                                     ^
softParticleCloud.C:119:40: error: ‘lammps_get_global_n’ was not declared in this scope
     nGlobal_ = lammps_get_global_n(lmp_);
                                        ^
softParticleCloud.C:131:40: error: ‘lammps_get_initial_np’ was not declared in this scope
     lammps_get_initial_np(lmp_, npArray);
                                        ^
softParticleCloud.C:163:5: error: ‘lammps_get_initial_info’ was not declared in this scope
     );
     ^
softParticleCloud.C:189:24: error: ‘lammps_step’ was not declared in this scope
     lammps_step(lmp_, 0);
                        ^
softParticleCloud.C:192:46: error: ‘lammps_get_local_domain’ was not declared in this scope
     lammps_get_local_domain(lmp_, lmpLocalBox);
                                              ^
softParticleCloud.C: In member function ‘void Foam::softParticleCloud::adjustLampTimestep()’:
softParticleCloud.C:212:47: error: ‘lammps_get_timestep’ was not declared in this scope
     double dtLampIn = lammps_get_timestep(lmp_);
                                               ^
softParticleCloud.C:227:40: error: ‘lammps_set_timestep’ was not declared in this scope
     lammps_set_timestep(lmp_, dtLampAdj);
                                        ^
In file included from softParticleCloud.C:27:0:
softParticleCloud.H: In constructor ‘Foam::softParticleCloud::softParticleCloud(const volVectorField&, const volScalarField&, Foam::volVectorField&, Foam::dimensionedScalar, Foam::volScalarField&, Foam::IOdictionary&)’:
softParticleCloud.H:109:27: warning: ‘Foam::softParticleCloud::mesh_’ will be initialized after [-Wreorder]
             const fvMesh& mesh_;
                           ^
softParticleCloud.H:103:27: warning:   ‘Foam::dimensionedScalar Foam::softParticleCloud::nu_’ [-Wreorder]
         dimensionedScalar nu_;
                           ^
softParticleCloud.C:421:1: warning:   when initialized here [-Wreorder]
 softParticleCloud::softParticleCloud
 ^
In file included from softParticleCloud.C:27:0:
softParticleCloud.H:181:22: warning: ‘Foam::softParticleCloud::cloudProperties_’ will be initialized after [-Wreorder]
         IOdictionary cloudProperties_;
                      ^
softParticleCloud.H:179:25: warning:   ‘Foam::volVectorField& Foam::softParticleCloud::Ue_’ [-Wreorder]
         volVectorField& Ue_;
                         ^
softParticleCloud.C:421:1: warning:   when initialized here [-Wreorder]
 softParticleCloud::softParticleCloud
 ^
In file included from softParticleCloud.C:27:0:
softParticleCloud.H:225:29: warning: ‘Foam::softParticleCloud::gamma_’ will be initialized after [-Wreorder]
             volScalarField& gamma_;
                             ^
softParticleCloud.H:116:20: warning:   ‘Foam::scalarList Foam::softParticleCloud::cpuTimeSplit_’ [-Wreorder]
         scalarList cpuTimeSplit_;
                    ^
softParticleCloud.C:421:1: warning:   when initialized here [-Wreorder]
 softParticleCloud::softParticleCloud
 ^
softParticleCloud.C: In member function ‘void Foam::softParticleCloud::lammpsEvolveForward(Foam::vector*, Foam::vector*, int*, Foam::vectorList, Foam::vectorList, int)’:
softParticleCloud.C:846:9: error: ‘lammps_put_local_info’ was not declared in this scope
         );
         ^
softParticleCloud.C:876:9: error: ‘lammps_put_local_info’ was not declared in this scope
         );
         ^
softParticleCloud.C:893:28: error: ‘lammps_step’ was not declared in this scope
     lammps_step(lmp_, nstep);
                            ^
softParticleCloud.C:900:44: error: ‘lammps_get_local_n’ was not declared in this scope
     int lmpNLocal = lammps_get_local_n(lmp_);
                                            ^
softParticleCloud.C:922:5: error: ‘lammps_get_local_info’ was not declared in this scope
     );
     ^
softParticleCloud.C: In member function ‘void Foam::softParticleCloud::addNewParticles()’:
softParticleCloud.C:1198:86: error: ‘lammps_create_particle’ was not declared in this scope
     lammps_create_particle(lmp_, npAdd, posArray, tagArray, ds, rhos, types, velArray);
                                                                                      ^
softParticleCloud.C:1104:11: warning: unused variable ‘myrank’ [-Wunused-variable]
     label myrank = Pstream::myProcNo();
           ^
softParticleCloud.C: In member function ‘void Foam::softParticleCloud::addAndDeleteParticle()’:
softParticleCloud.C:1231:61: error: ‘lammps_delete_particle’ was not declared in this scope
             lammps_delete_particle(lmp_, deleteList, nDelete);
                                                             ^
softParticleCloud.C:1264:57: error: ‘lammps_delete_particle’ was not declared in this scope
         lammps_delete_particle(lmp_, deleteList, nDelete);
                                                         ^
softParticleCloud.C: In member function ‘bool Foam::softParticleCloud::pointInRegion(Foam::vector&, Foam::tensor&)’:
softParticleCloud.C:1389:16: warning: unused variable ‘hE’ [-Wunused-variable]
         scalar hE = mag(p2p1E);
                ^
softParticleCloud.C:1391:16: warning: unused variable ‘dotE’ [-Wunused-variable]
         scalar dotE = (p2p1E & pxp1E);
                ^
make: *** [Make/linux64GccDPOpt/softParticleCloud.o] Error 1

There were some errors like xxx not declared. How could I resolve it?

Huge Thanks.

iurnus commented 7 years ago

It seems that you need to compile LAMMPS as a library first before you compile the lammpsFoam solver.

Please follow the instruction to compile the code, and check if liblammps_shanghailinux.so file is generated. https://github.com/xiaoh/sediFoam/wiki/How-to-compile%3F

Best, Rui

On Wed, Sep 27, 2017 at 10:06 PM, JoshYEn notifications@github.com wrote:

I followed the instructions, and I've already installed OpenFOAM & complied the lammps packages. But, there were some errors occurred while I was compiling the softParticleCloud.C (lammpsFOAM).

  • OpenFOAM version: 2.4.0
  • Lammps version: 1Feb14

Issues:

softParticleCloud.C:73:23: note: in expansion of macro ‘MPI_COMM_WORLD’ MPI_Abort(MPI_COMM_WORLD, 1); ^ softParticleCloud.C:80:21: error: ‘lammps_sync’ was not declared in this scope lammpssync(lmp); ^ In file included from /home/ay/OpenFOAM/ay-2.4.0/run/sediFoam/lammpsFoam/include/LammpsCollection.H:7:0, from softParticleCloud.H:47, from softParticleCloud.C:27: /usr/lib/openmpi/include/mpi.h:305:72: warning: use of old-style cast [-Wold-style-cast]

define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void *) &(global)))

                                                                    ^

/usr/lib/openmpi/include/mpi.h:902:18: note: in expansion of macro ‘OMPI_PREDEFINED_GLOBAL’

define MPI_CHAR OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_char)

              ^

softParticleCloud.C:105:26: note: in expansion of macro ‘MPI_CHAR’ MPI_Bcast(line,n,MPI_CHAR,0,MPI_COMM_WORLD); ^ /usr/lib/openmpi/include/mpi.h:305:73: warning: use of old-style cast [-Wold-style-cast]

define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void *) &(global)))

                                                                     ^

/usr/lib/openmpi/include/mpi.h:902:18: note: in expansion of macro ‘OMPI_PREDEFINED_GLOBAL’

define MPI_CHAR OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_char)

              ^

softParticleCloud.C:105:26: note: in expansion of macro ‘MPI_CHAR’ MPI_Bcast(line,n,MPI_CHAR,0,MPI_COMM_WORLD); ^ /usr/lib/openmpi/include/mpi.h:305:72: warning: use of old-style cast [-Wold-style-cast]

define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void *) &(global)))

                                                                    ^

/usr/lib/openmpi/include/mpi.h:879:24: note: in expansion of macro ‘OMPI_PREDEFINED_GLOBAL’

define MPI_COMM_WORLD OMPI_PREDEFINED_GLOBAL( MPI_Comm, ompi_mpi_comm_world)

                    ^

softParticleCloud.C:105:37: note: in expansion of macro ‘MPI_COMM_WORLD’ MPI_Bcast(line,n,MPI_CHAR,0,MPI_COMM_WORLD); ^ /usr/lib/openmpi/include/mpi.h:305:73: warning: use of old-style cast [-Wold-style-cast]

define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void *) &(global)))

                                                                     ^

/usr/lib/openmpi/include/mpi.h:879:24: note: in expansion of macro ‘OMPI_PREDEFINED_GLOBAL’

define MPI_COMM_WORLD OMPI_PREDEFINED_GLOBAL( MPI_Comm, ompi_mpi_comm_world)

                    ^

softParticleCloud.C:105:37: note: in expansion of macro ‘MPI_COMM_WORLD’ MPI_Bcast(line,n,MPI_CHAR,0,MPI_COMM_WORLD); ^ softParticleCloud.C:119:40: error: ‘lammps_get_globaln’ was not declared in this scope nGlobal = lammps_get_globaln(lmp); ^ softParticleCloud.C:131:40: error: ‘lammps_get_initial_np’ was not declared in this scope lammps_get_initialnp(lmp, npArray); ^ softParticleCloud.C:163:5: error: ‘lammps_get_initial_info’ was not declared in this scope ); ^ softParticleCloud.C:189:24: error: ‘lammps_step’ was not declared in this scope lammpsstep(lmp, 0); ^ softParticleCloud.C:192:46: error: ‘lammps_get_local_domain’ was not declared in this scope lammps_get_localdomain(lmp, lmpLocalBox); ^ softParticleCloud.C: In member function ‘void Foam::softParticleCloud::adjustLampTimestep()’: softParticleCloud.C:212:47: error: ‘lammps_get_timestep’ was not declared in this scope double dtLampIn = lammps_gettimestep(lmp); ^ softParticleCloud.C:227:40: error: ‘lammps_set_timestep’ was not declared in this scope lammps_settimestep(lmp, dtLampAdj); ^ In file included from softParticleCloud.C:27:0: softParticleCloud.H: In constructor ‘Foam::softParticleCloud::softParticleCloud(const volVectorField&, const volScalarField&, Foam::volVectorField&, Foam::dimensionedScalar, Foam::volScalarField&, Foam::IOdictionary&)’: softParticleCloud.H:109:27: warning: ‘Foam::softParticleCloud::mesh’ will be initialized after [-Wreorder] const fvMesh& mesh; ^ softParticleCloud.H:103:27: warning: ‘Foam::dimensionedScalar Foam::softParticleCloud::nu’ [-Wreorder] dimensionedScalar nu; ^ softParticleCloud.C:421:1: warning: when initialized here [-Wreorder] softParticleCloud::softParticleCloud ^ In file included from softParticleCloud.C:27:0: softParticleCloud.H:181:22: warning: ‘Foam::softParticleCloud::cloudProperties’ will be initialized after [-Wreorder] IOdictionary cloudProperties; ^ softParticleCloud.H:179:25: warning: ‘Foam::volVectorField& Foam::softParticleCloud::Ue’ [-Wreorder] volVectorField& Ue; ^ softParticleCloud.C:421:1: warning: when initialized here [-Wreorder] softParticleCloud::softParticleCloud ^ In file included from softParticleCloud.C:27:0: softParticleCloud.H:225:29: warning: ‘Foam::softParticleCloud::gamma’ will be initialized after [-Wreorder] volScalarField& gamma; ^ softParticleCloud.H:116:20: warning: ‘Foam::scalarList Foam::softParticleCloud::cpuTimeSplit’ [-Wreorder] scalarList cpuTimeSplit; ^ softParticleCloud.C:421:1: warning: when initialized here [-Wreorder] softParticleCloud::softParticleCloud ^ softParticleCloud.C: In member function ‘void Foam::softParticleCloud::lammpsEvolveForward(Foam::vector, Foam::vector, int*, Foam::vectorList, Foam::vectorList, int)’: softParticleCloud.C:846:9: error: ‘lammps_put_local_info’ was not declared in this scope ); ^ softParticleCloud.C:876:9: error: ‘lammps_put_local_info’ was not declared in this scope ); ^ softParticleCloud.C:893:28: error: ‘lammps_step’ was not declared in this scope lammpsstep(lmp, nstep); ^ softParticleCloud.C:900:44: error: ‘lammps_get_local_n’ was not declared in this scope int lmpNLocal = lammps_get_localn(lmp); ^ softParticleCloud.C:922:5: error: ‘lammps_get_local_info’ was not declared in this scope ); ^ softParticleCloud.C: In member function ‘void Foam::softParticleCloud::addNewParticles()’: softParticleCloud.C:1198:86: error: ‘lammps_create_particle’ was not declared in this scope lammps_createparticle(lmp, npAdd, posArray, tagArray, ds, rhos, types, velArray); ^ softParticleCloud.C:1104:11: warning: unused variable ‘myrank’ [-Wunused-variable] label myrank = Pstream::myProcNo(); ^ softParticleCloud.C: In member function ‘void Foam::softParticleCloud::addAndDeleteParticle()’: softParticleCloud.C:1231:61: error: ‘lammps_delete_particle’ was not declared in this scope lammps_deleteparticle(lmp, deleteList, nDelete); ^ softParticleCloud.C:1264:57: error: ‘lammps_delete_particle’ was not declared in this scope lammps_deleteparticle(lmp, deleteList, nDelete); ^ softParticleCloud.C: In member function ‘bool Foam::softParticleCloud::pointInRegion(Foam::vector&, Foam::tensor&)’: softParticleCloud.C:1389:16: warning: unused variable ‘hE’ [-Wunused-variable] scalar hE = mag(p2p1E); ^ softParticleCloud.C:1391:16: warning: unused variable ‘dotE’ [-Wunused-variable] scalar dotE = (p2p1E & pxp1E); ^ make: *** [Make/linux64GccDPOpt/softParticleCloud.o] Error 1

There were some errors like xxx not declared. How could I resolve it?

Huge Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xiaoh/sediFoam/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AGjsUwdHG-t-vI-Xqnvcg8zKPNF5zqttks5smylkgaJpZM4Pmu3w .

-- Rui Sun Ph.D. Candidate Department of Aerospace and Ocean Engineering Virginia Polytechnic Institute and State University Blacksburg, VA, USA

JoshYEn commented 7 years ago

Thanks for your reply. I managed to compile it on my computer. Huge Thanks!

Best regards, Josh

toor111 commented 5 years ago

I am trying to compile Sedifoam following the instruction : https://github.com/xiaoh/sediFoam/wiki/How-to-compile%3F . at the stage of 12.Stay at the same directory. Use command wmake to compile the lammpsFoam solver. I got error. There is no rule to target make option .!

Linux is ubuntu 16.04 I installed OpenFOAM 2.3.0 I installed lamps-1Feb14.

Could you please help me ? Thanks alot