Skip to content
rqwang edited this page Jun 17, 2016 · 26 revisions

Instructions to compile#

The CFD-DEM solver lammpsFoam would be successfully installed on a machine with OpenFOAM and LAMMPS. Here are the steps to compile it on your linux machine:

  1. The current version of lammpsFoam is supported by OpenFOAM 2.3.0, 2.3.x, and 2.4.0. The version of the LAMMPS is lamps-1Feb14.

  2. Copy all the files in InterfaceToLammps folder to lammps-1Feb14/src (you can also create a soft link for each file).

  3. Copy all the files in InterfaceToLammps/MAKE folder to lammps-1Feb14/src/MAKE (you can also create soft link of the files).

  4. Change to the lammps-1Feb14/src folder. Use command make yes-granular to install the granular package of LAMMPS. Add space, manybody, molecule, fld, rigid, misc as well in a similar way.

  5. Go back to the lammps-1Feb14/src folder. Use command make shanghailinux to generate an executable file named lmp_shanghailinux in this folder. It may take 10 to 30 minutes.

  6. Stay at lammps-1Feb14/src folder. Use command make makeshlib to generate a new Makefile.shlib file.

  7. Stay at lammps-1Feb14/src folder. Use command make -f Makefile.shlib shanghailinux to compile LAMMPS to a dynamic library. After this step, you will see a file named liblammps_shanghailinux.so in the working directory.

  8. Change to $FOAM_USER_LIBBIN and make a soft link of liblammps_shanghailinux.so generated in previous step. The command is: ln -s PREVIOUS_DIRECTORY/liblammps_shanghailinux.so ., replace PREVIOUS_DIRECTORY with the FULL directory of the lmp_shanghailinux.so.

  9. Change to LammpsFoam folder. Use command wmake libso dragModels to compile the drag models. Use command wmake libso chPressureGrad to compile the pressure gradient for channel flow. Use command wake libso lammpsFoamTurbulenceModels to compile the turbulent models for lammpsFoam.

  10. Change to lammpsFoam/Make folder. Choose the file named options-*-openmpi (* is the name of operating system (OS)) according to your own OS and rename it as the file named options. (For example, if your OS is ubuntu, rename the file options-ubuntu-openmpi as options) Then, you should modify the first line which represents the path of lammps/src directory in the options file. Default path is LAMMPS_DIR = ../lammps-1Feb14/src, you should replace ../lammps-1Feb14 with the path where you installed your own lammps package and the correct version name of your lammps package.

  11. Stay at the same directory. Use command wmake to compile the lammpsFoam solver.

Some common errors:

Step 4: Note: packages of space and fld might not be found in the newer version of lammps. Use command 'make no-USER-QUIP' if error message "*** Environment variable QUIP_ROOT must be set.. Stop." occurs.

Step 5: In the case of error "No target to make Makefile.lammps", change Makefile.package.settings to your system. This should have been done by some automatic script. For some reason, my lammps didn't do it. For error "../compute_smd_tlsph_defgrad.cpp:39:23: fatal error: Eigen/Eigen: No such file or directory #include <Eigen/Eigen>",

Step 6: If error, try command "make shanghailinux mode=shlib instead".