CFDEM Coupling installation in Ubuntu

Submitted by rahulsoni on Sun, 05/01/2016 - 11:30

Hello Everyone, I am attempting here to outline a step by step CFDEM installation procedure that worked for me. Kindly, help improve the same by suggestions and contributions.

Note: Slightly modified steps for following combination of compatibility at https://www.evernote.com/shard/s214/sh/0ec74d17-2173-4c6e-a156-6c8cbe418...
word CFDEMversion="cfdem-3.4.0";
word compatibleLIGGGHTSversion="3.4.0";
word OFversion="3.0.x-commit-ac3f6c67e02f0aac3777c27f9fb7558fc3536e37";

Note: CFDEM LIGGGHTS may not support vtk compiled LIGGGHTS, therefore, the following procedure will use non vtk compiled LIGGGHTS only. Also, CFDEM supports an speciifc version of LIGGGHTS and OpenFOAM. Therefore, if one is intended to install LIGGGHTS only for DEM use, then, it is better to have separate and very fresh installation of it. So that there is no conflict between only DEM LIGGGHTS and CFDEM LIGGGHTS. The procedure in following link can be followed to install LIGGGHTS separately:
http://www.cfdem.com/forums/liggghts-installation-guide-ubuntu-1204-lts-...

First of all check the compatibility of latest CFDEM coupling with version of LIGGGHTS and OpenFOAM.
To do so check file https://github.com/CFDEMproject/CFDEMcoupling-PUBLIC/blob/master/src/lag...

For the present case it is like:
word CFDEMversion="cfdem-3.0.2";
word compatibleLIGGGHTSversion="3.3.1";
word OFversion="2.4.x-commit-3d8da0e960c717ff582f1517a27724144f086b83";

So, we will try installing the suggested versions only.

Reference web page https://openfoamwiki.net/index.php/Installation/Linux/OpenFOAM-2.4.0/Ubuntu

Reminder: Whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.4.0 shell environment. In other words, run the following command whenever you start a new terminal:
of24x

OpenFOAM-2.4.x installation
Based on https://openfoamwiki.net/index.php/Installation/Linux/OpenFOAM-2.4.0/Ubuntu

  1. sudo -s
  2. apt-get install build-essential flex bison zlib1g-dev qt4-dev-tools libqt4-dev gnuplot libreadline-dev \
    libncurses-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev libmpfr-dev \
    python python-dev
  3. apt-get install libglu1-mesa-dev libqt4-opengl-dev
  4. exit
  5. sudo apt-get install octave
  6. sudo apt-get install epstool
  7. git clone git://github.com/OpenFOAM/OpenFOAM-2.4.x.git
  8. cd OpenFOAM-2.4.x
  9. git checkout 3d8da0e960c717ff582f1517a27724144f086b83
  10. see http://www.cfdem.com/forums/openfoam-installation-cfdemcoupling-publicsr... and change the export WM_MPLIB=SYSTEMOPENMPI at line number 85 (approx) [if it is not so]
  11. wget "http://downloads.sourceforge.net/foam/ThirdParty-2.4.0.tgz?use_mirror=mesh" -O ThirdParty-2.4.0.tgz
  12. tar -xzf ThirdParty-2.4.0.tgz
  13. rm ThirdParty-2.4.0.tgz
  14. mv ThirdParty-2.4.0 ThirdParty-2.4.x
  15. ln -s /usr/bin/mpicc.openmpi OpenFOAM/OpenFOAM-2.4.x/bin/mpicc
  16. ln -s /usr/bin/mpirun.openmpi OpenFOAM/OpenFOAM-2.4.x/bin/mpirun
  17. uname -m
  18. Open a new terminal
    for x86_64 enter following command

    source $HOME/OpenFOAM/OpenFOAM-2.4.x/etc/bashrc WM_NCOMPPROCS=4
  19. Also, copy this line at the end of the ~/.bashrc file. And, reopen new terminal.
    echo "alias of24x='source \$HOME/OpenFOAM/OpenFOAM-2.4.x/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
    Note: This last line means that whenever you start a new terminal window or tab, you should run the alias command associated to the OpenFOAM 2.4.0 shell environment. In other words, whenever you start a new terminal, you should run:
    of24x
  20. cd $WM_THIRD_PARTY_DIR
  21. export QT_SELECT=qt4
  22. ./Allwmake 
    (wait for the msg to come that all done, rerun the command to ensure the compilation)
  23. ./Allwmake 
    (recheck it once again)
  24. wmSET $FOAM_SETTINGS
    (If it says wmSET command not found then try: source OpenFOAM/OpenFOAM-2.4.x/etc/bashrc or source ../OpenFOAM-2.4.x/etc/bashrc if your are in $WM_THIRD_PARTY_DIR)
  25. wmSET $FOAM_SETTINGS
    (If it says wmSET command not found then try: source OpenFOAM/OpenFOAM-2.4.x/etc/bashrc or source ../OpenFOAM-2.4.x/etc/bashrc if your are in $WM_THIRD_PARTY_DIR)
  26. sed -i -e 's=version}\.3=version}.12.1=' getCmake
  27. chmod +x getCmake
  28. ./getCmake
  29. ./makeCmake
  30. wmSET $FOAM_SETTING
  31. export QT_SELECT=qt4
  32. sed -i -e 's=MPI_ARCH_PATH/include=MPI_ARCH_PATH/include;$MPI_INCLUDE=' etc/tools/ParaView4Functions
  33. sed -i -e 's=//#define GLX_GLXEXT_LEGACY=#define GLX_GLXEXT_LEGACY=' \
    ParaView-4.1.0/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx/li>
  34. cd $WM_THIRD_PARTY_DIR/ParaView-4.1.0
  35. wget http://www.paraview.org/pipermail/paraview/attachments/20140210/464496cc... -O Fix.patch
    patch -p1 < Fix.patch
  36. cd VTK
  37. wget https://github.com/gladk/VTK/commit/ef22d3d69421581b33bc0cd94b647da73b61... -O Fix2.patch
    patch -p1 < Fix2.patch
  38. cd ../..
  39. uname -m
  40. #this will take a while... somewhere between 30 minutes to 2 hours or more
    ./makeParaView4 -python -mpi -python-lib /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0/li>
  41. wmSET $FOAM_SETTINGS
  42. cd $WM_PROJECT_DIR
  43. find src applications -name "*.L" -type f | xargs sed -i -e 's=\ (YY\_FLEX\_SUBMINOR\_VERSION\)=YY_FLEX_MINOR_VERSION < 6 \&\& \1='
  44. cd $WM_PROJECT_DIR
  45. export QT_SELECT=qt4
  46. ./Allwmake
  47. ./Allwmake (#Run it a second time for getting a summary of the installation)
  48. Test the installation
    icoFoam -help

CFDEM-3.0.2 and LIGGGHTS-3.3.1 installation preparation:

  1. cd
  2. sudo apt-get install octave
  3. sudo apt-get install epstool
  4. sudo apt-get install python-numpy
  5. gedit ~/.bashrc
  6. add at the bottom alias lpp="python $HOME/LPP/src/lpp.py"
  7. cd
  8. mkdir CFDEM
  9. cd CFDEM
  10. git clone git://github.com/CFDEMproject/CFDEMcoupling-PUBLIC.git CFDEMcoupling-PUBLIC-$WM_PROJECT_VERSION
  11. [Optional]
    To get the latest version, open a terminal, go to the location of your local installation and type: Warning: git stash will remove your changes in $HOME/CFDEM/CFDEMcoupling-PUBLIC-$WM_PROJECT_VERSION!

    cd $HOME/CFDEM/CFDEMcoupling-PUBLIC-$WM_PROJECT_VERSION
    git stash
    git pull
  12. cd
  13. git clone git://github.com/CFDEMproject/LIGGGHTS-PUBLIC.git LIGGGHTS-PUBLIC
  14. Download Pizza.py Toolkit from http://www.sandia.gov/~sjplimp/download.html and put the extracted dir as $HOME/
  15. cd
  16. Preparing liggghts
    LIGGGHTS has to be compiled with -fPIC CCFLAG switch thus, it is suggested to compile with Makefile.fedora_fpic, and ensure the following lines in it:

    CCFLAGS = -O2 \
    -funroll-loops -fstrict-aliasing -Wall -Wno-unused-result -fPIC
    SHFLAGS = -fPIC

LIGGGHTS-3.3.1 installation (see http://www.cfdem.com/forums/liggghts-installation-guide-ubuntu-1204-lts-... for any troubleshooting):

  1. sudo apt-get install libvtk5-dev libeigen2-dev libopenmpi-dev g++ git-core
  2. sudo apt-get install build-essential git
  3. sudo apt-get install openmpi-common openmpi-bin libopenmpi-dev
  4. sudo apt-get install cmake
  5. sudo apt-get install cmake-curses-gui
  6. ##Checking installations
    which mpirun
    /usr/bin/mpirun comes up?
    which mpic++
    /usr/bin/mpic++ comes up?
    mpic++ -v
    gcc-Version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) comes up at the last line?
  7. sudo add-apt-repository ppa:jon-severinsson/ffmpeg
  8. sudo apt-get update
  9. sudo apt-get install ffmpeg
  10. sudo apt-get install frei0r-plugins
  11. cd
  12. wget https://sites.google.com/site/rahuliitdhn/files-1/language-specs.tar.gz?...
  13. tar -zxvf language-specs.tar.gz?...1
  14. sudo mv $HOME/language-specs/liggghts.lang /usr/share/gtksourceview-3.0/language-specs
  15. cd $HOME/LIGGGHTS-PUBLIC/src/
  16. sudo make clean-all
  17. sudo make fedora_fpic
  18. sudo ln -s /$HOME/LIGGGHTS-PUBLIC/src/lmp_fedora_fpic /usr/bin/liggghts_fedora
  19. sudo gedit ~/.bashrc
  20. alias "liggghts_fedora=$HOME/LIGGGHTS-PUBLIC/src/lmp_fedora_fpic"

CFDEM-3.0.2 installation:

  1. Setting up Environment Variables:
  2. Add following lines at bottom
    ##================================================#
    ##- source cfdem env vars
    export CFDEM_VERSION=PUBLIC
    export CFDEM_PROJECT_DIR=$HOME/CFDEM/CFDEMcoupling-$CFDEM_VERSION-$WM_PROJECT_VERSION
    export CFDEM_SRC_DIR=$CFDEM_PROJECT_DIR/src
    export CFDEM_SOLVER_DIR=$CFDEM_PROJECT_DIR/applications/solvers
    export CFDEM_DOC_DIR=$CFDEM_PROJECT_DIR/doc
    export CFDEM_UT_DIR=$CFDEM_PROJECT_DIR/applications/utilities
    export CFDEM_TUT_DIR=$CFDEM_PROJECT_DIR/tutorials
    export CFDEM_PROJECT_USER_DIR=$HOME/CFDEM/$LOGNAME-$CFDEM_VERSION-$WM_PROJECT_VERSION
    export CFDEM_bashrc=$CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/bashrc
    export CFDEM_LIGGGHTS_SRC_DIR=$HOME/LIGGGHTS-PUBLIC/src
    export CFDEM_LIGGGHTS_MAKEFILE_NAME=fedora_fpic
    export CFDEM_LPP_DIR=$HOME/LPP/src
    export CFDEM_PIZZA_DIR=$HOME/PIZZA/pizza-9Oct15/src
    . $CFDEM_bashrc
    #================================================#
  3. Reopen new terminal
  4. or

  5. bash
  6. It will prompt to add user-public dir then say yes
  7. check to see if any other errors are there
  8. Save the ~/.bashrc, open a new terminal and test the settings. The commands:
    $CFDEM_PROJECT_DIR
    $CFDEM_SRC_DIR
    $CFDEM_LIGGGHTS_SRC_DIR
    should give "...: is a directory" otherwise something went wrong and the environment variables in ~/bashrc are not set correctly.
  9. To specify the paths of pizza, please check the settings in
    $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/bashrc
    (Note that the lines similar to what we have added in the $HOME/.bashrc is available here but all are commented by default so no need to touch them)
  10. If $CFDEM_SRC_DIR is set correctly, you can type
    cfdemSysTest
    to get some information if the paths are set correctly.

Compile LIGGGHTS(R) and CFDEM(R)coupling:

  1. Go to your LIGGGHTS src directory and perform
    sudo make clean-all
  2. Now compile:
    cfedmCompLIG
  3. If previous compilation was successful, then compile CFDEM:
    Try things in following sequence (although cfdemCompCFDEM should be sufficient but we can try to compile one by one so that we can see where is error being logged):

    cfdemCompCFDEMsrc
    cfdemCompCFDEMsol
    cfdemCompCFDEMuti
    cfdemCompCFDEMall
    cfdemCompCFDEM
  4. If you see the file $HOME/CFDEM/CFDEMcoupling-PUBLIC-2.4.x/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling.sh then it already compiles src, solver and utilities in the sequence and we have already compiled LIGGGHTS so only cfdemCompCFDEM is required.
  5. Run cfdemTestTut to test the tutorials if the compilation was done properly.
  6. Important commands related to CFDEM compilation defined in $HOME/CFDEM/CFDEMcoupling-PUBLIC-2.3.x/src/lagrangian/cfdemParticle/etc/bashrc
    cfdemCleanCFDEM cleans the cfdem built
    cfdemPullLIG pull the LIGGGHTS from web
    cfdemPullCFDEMcoupling pull cfdem coupling
    cfdemCompCFDEMall compiling cfdem coupling with LIGGGHTS
    cfdemCompCFDEM compiling cfdem (src+solvers)
    cfdemCompCFDEMsrc compiling cfdem src
    cfdemCompCFDEMsol compiling solvers
    cfdemCompCFDEMuti compiling utilities
    See full list of command in $HOME/CFDEM/CFDEMcoupling-PUBLIC-2.3.x/src/lagrangian/cfdemParticle/etc/bashrc
anirbanmondal93's picture

anirbanmondal93 | Mon, 05/09/2016 - 11:29

Hi rahulsoni,

Thanks for the installation tutorials of CFDEMCoupling given by you.
I want to install it on my ubuntu 14.04LTS linux based system.

What tutorials step-by-step you have given, will that work on my ubuntu 14.04 version?

Waiting for your reply.
With best regards,

Anriban

khoatranxd | Tue, 05/10/2016 - 10:25

I try to install CFDEM Coupling as above instruction. But it always shows error when i run the command"cfdemCompCFDEM" as following
/home/khoa/CFDEM/CFDEMcoupling-PUBLIC-/applications/utilities/cfdemPostproc

/home/khoa/CFDEM/CFDEMcoupling-PUBLIC-/src/lagrangian/cfdemParticle/etc/functions.sh: line 148: rmdepall: command not found
/home/khoa/CFDEM/CFDEMcoupling-PUBLIC-/src/lagrangian/cfdemParticle/etc/functions.sh: line 150: wclean: command not found
/home/khoa/CFDEM/CFDEMcoupling-PUBLIC-/src/lagrangian/cfdemParticle/etc/functions.sh: line 156: wmake: command not found

Anyone can help me?
THanks
Khoa

Daniel Queteschiner | Thu, 05/12/2016 - 16:18

Hi Khoa,

those commands are specific to OpenFOAM so I suppose the setup of your environment variables is incorrect at some point.
I suggest to double check all relevant paths and also check your setup using the cfdemSysTest command.

Cheers
Daniel

khoatranxd | Tue, 05/17/2016 - 03:18

HI Daniel

Thank you! I will try to check it again

anirbanmondal93's picture

anirbanmondal93 | Tue, 05/17/2016 - 13:17

Hi guys,

The openFoam version-3.0.1 is being installed in my ubuntu-14.04LTS.
I want to install CFDEM-3.0.2 and LIGGGHTS-3.3.1 beside that.
Will the OFversion-3.0.1 work with the above CFDEMversion-3.0.2 and LIGGGHTSverison-3.3.1 following the above mentioned installation guidelines given by rahulsoni. Or i have to install only Ofversion-2.2.x to do compatibleness.

Regards,

JoG | Wed, 06/29/2016 - 22:24

I just installed LIGGGHTS-PUBLIC 3.4.1 with CFDEM 3.0.x and OpenFOAM 3.0.x under Ubuntu 14.04LTS.
You have to follow exactly the guidelines in https://github.com/CFDEMproject/CFDEMcoupling-PUBLIC/blob/master/doc/git...
For me it was very important to compile the exact commit of OpenFOAM mentioned in the versionInfo.h file which can be found here: https://github.com/CFDEMproject/CFDEMcoupling-PUBLIC/blob/master/src/lag...

Good luck!