Install foam-extend 3.1 on CentOS 7

Preparation: 1. In order to install foam-extend 3.1, please make sure you have installed packages git, mercurial and subversion for source code retrieving, rpm-build for software packaging, gcc and g++ for compiling.

sudo yum install rpm-build gcc gcc-c++ libstdc++-devel binutils-devel

2. To install the third-party packages, you should have these packages installed: qt, qt-devel, qtwebkit and qtwebkit-devel for Paraview compiling and running, gcc-c++ and libc++-devel for openmpi, m4 for bison.

yum install m4 cmake qt qt-devel qtwebkit qtwebkit-devel flex

Installation 1. Download foam-extend 3.1 to the folder foam.

git clone https://github.com/Unofficial-Extend-Project-Mirror/openfoam-extend-foam-extend-3.1.git

In default, the directory of foam-extend 3.1 is openfoam-extend-foam-extend-3.1, to make it shorter, you can change its name with

cd $HOME/foam
mv openfoam-extend-foam-extend-3.1 foam-extend-3.1

2. After you have downloaded the source code, you should modify some environmental variables in the file .bash_profile in your home directory.

vi ~/.bash_profile

Add the following line (variables) before the line PATH=....:

export QT_BIN_DIR=/usr/lib64/qt4/bin

Add the following line to the end of ~/.bashrc:

alias fe31='source $HOME/foam/foam-extend-3.1/etc/bashrc'

where $HOME/foam/foam-extend-3.1/ is the location of your foam-extend directory. And run those files with

. ~/.bash_profile
. ~/.bashrc

Then, run

fe31

to make the FOAM related variables effective.

3. Before you compile Third-party packages, run:

cd $FOAM_SRC
wmakeLnIncludeAll

Otherwise, when you install swak4Foam, it will appear: helpers/printSwakVersion.H:46:21: fatal error: Pstream.H: No such file or directory #include "Pstream.H"

4. When you install the third-party packages, the PyFoam cannot be compiled. you should change the file AllMake.stage3, find the line:

    ( rpm_make -p PyFoam-0.6.3 -s PyFoam-0.6.3.spec  -u  http://downloads.sourceforge.net/project/openfoam-extend/foam-extend-3.1/ThirdParty/PyFoam-0.6.3.tar.gz )

and change it as:

    ( rpm_make -p PyFoam-0.6.3 -s PyFoam-0.6.3.spec  -u  http://openfoamwiki.net/images/c/cb/PyFoam-0.6.3.tar.gz -n PyFoam-0.6.3-1.noarch -a noarch)

Here, you should update the SPEC file for PyFoam, please find the lines in PyFoam-0.6.3.spec:

URL:                    http://openfoamwiki.net/images/e/e3/PyFoam-0.6.3-rc.tar.gz
Source: 		%url/%{name}-%{version}-rc.tar.gz

and update with:

URL:                    http://openfoamwiki.net/images/c/cb/PyFoam-0.6.3.tar.gz
Source: 		%url/%{name}-%{version}.tar.gz

And update the following lines

%prep
%setup -q -n PyFoam-%{version}-rc

with

%prep
%setup -q -n PyFoam-%{version}

After you set all of the aboves right, you can run:

./AllMake

5. After you have compiled ThirdParty packages, you can compile the foam solvers and applications now:

cd ../
./Allwmake > make.log 2>&1 

./Allwmake > make.log 2>&1 makes a full log into make.log, including errors outputted during the compiling process (i.e. "2>&1" does the redirect of stderr to stdout). Now, so you should have a cup of coffee if your computer is fast enough, otherwise, you should hang out. Then you'll get compiled foam. P.S. 1. If you don't have gcc-c++ and libstdc++-devel installed, the compiling will give you an error: c++ preprocessor "/lib/cpp" fails sanity check 2. If you don't have qtwebkit and qtwebkit-devel installed, the compiler will give you error when you compile paraview: [ 81%] Building CXX object Qt/Widgets/CMakeFiles/pqWidgets.dir/pqHelpWindow.cxx.o /pqHelpWindow.cxx:56:21: fata error: QWebPage: No such file or directory # include compilation terminated. Packages qtwebkit and qtwebkit-devel are stored in EPEL, you should install them from there.

sudo yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

Then, you can install qtwebkit and qtwebkit-devel. 3. If you have not installed binutils-devel before you install FOAM, the following error will appear: -lspecie -lfoam -liberty -ldl -lrt -lm -o /home/abc/foam/foam-extend-3.1/applications/bin/linux64GccDPOpt/mixtureAdiabaticFlameT /usr/bin/ld: cannot find -liberty collect2: error: ld returned 1 exit status

   Send article as PDF   

One Reply to “Install foam-extend 3.1 on CentOS 7”

  1. If you find the following error:

    
    [rdu@nd1 torque-4.2.10]$ sudo systemctl status pbs_server -l
    ● pbs_server.service - pbs-server
       Loaded: loaded (/usr/lib/systemd/system/pbs_server.service; disabled; vendor preset: disabled)
       Active: failed (Result: exit-code) since Sun 2019-06-09 16:16:35 CST; 13s ago
      Process: 119123 ExecStart=/usr/sbin/pbs_server (code=exited, status=3)
    
    Jun 09 16:16:35 nd1 systemd[1]: Starting pbs-server...
    Jun 09 16:16:35 nd1 pbs_server[119123]: pbs_server port already bound: Address already in use
    Jun 09 16:16:35 nd1 systemd[1]: pbs_server.service: control process exited, code=exited status=3
    Jun 09 16:16:35 nd1 systemd[1]: Failed to start pbs-server.
    Jun 09 16:16:35 nd1 systemd[1]: Unit pbs_server.service entered failed state.
    Jun 09 16:16:35 nd1 systemd[1]: pbs_server.service failed.
    

    You may find the port has been used.

    You can change the pbs port_num in /etc/services, to other port has not been used.
    Then execute

    
    sudo systemctl restart pbs_server pbs_mom pbs_sched trqauthd
    

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.