On June 26, 2010, OpenFOAM 1.7.0 has been released. But It does not provide any compiled packages but Ubuntu/Debian binary packages.
I have been using OpenFOAM for years without compiling the whole OpenFOAM and ThirdParty packages. It's time to do it myself.
Before compiling the packages, you must prepare some necessary packages on your system:
- binutils-static # it provides
libiberty.a
and others - python-devel # if you want the python support in paraview
- qt-devel # I suppose you like it. Yes, it provides
qmake-qt4
- cmake # it is mandatory for compiling paraview
- flex
Please use yum
to install them:
sudo yum install -y binutils-static python-devel qt-devel cmake flex
Of course, I believe you have gcc 4.4-x which is recommended by OpenFOAM.
the $HOME/OpenFOAM
directory is supposed as your OpenFOAM installation folder. And I guess you have downloaded the source packages files.
1) enter into the OpenFOAM installation folder and unpack the zipped files
tar xvf /path/OpenFOAM-1.7.0.gtgz tar xvf /path/ThirdParty-1.7.0.gtgz
2) setting the environment variables
adding the line to your $HOME/.bashrc
. $HOME/OpenFOAM/OpenFOAM-1.7.0/etc/bashrc
and type . $HOME/.bashrc
to execute the file and make the OpenFOAM variables available.
3) Check the system
execute foamSystemCheck
4) Build the source
cd $WM_PROJECT_DIR ./Allwmake
5) Compile ParaView 3.8.0 and PV3FoamReader module
cd $WM_THIRD_PARTY_DIR ./Allclean ./makeParaView
compiling PV3blockMeshReader and PV3FoamReader ParaView plugins as usual for OpenFOAM utilities:
cd $FOAM_UTILITIES/postProcessing/graphics/PV3Readers ./Allwclean ./Allwmake
6) Test Installation
foamInstallationTest
ISSUES:
Most of the time, the compilation would have errors like
-lfiniteVolume -lOpenFOAM -liberty -ldl -lm -o /home/xyz/OpenFOAM/OpenFOAM-1.7.x/applications/bin/linux64GccDPOpt/potentialFoam
/usr/bin/ld: Make/linux64GccDPOpt/potentialFoam.o: undefined reference to symbol 'Foam::OPstream::write(Foam::Pstream::commsTypes, int, char const*, long)'
/usr/bin/ld: note: 'Foam::OPstream::write(Foam::Pstream::commsTypes, int, char const*, long)' is defined in DSO /home/xyz/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt/openmpi-1.4.1/libPstream.so so try adding it to the linker command line
/home/sheldon/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt/openmpi-1.4.1/libPstream.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [/home/xyz/OpenFOAM/OpenFOAM-1.7.x/applications/bin/linux64GccDPOpt/potentialFoam] Error 1
make[2]: Leaving directory `/home/xyz/OpenFOAM/OpenFOAM-1.7.x/applications/solvers/basic/potentialFoam'
make[1]: *** [potentialFoam] Error 2
This error is caused by DSO links. The DSO link library should be stated explicitly in Fedora 13. So the file ./Make/options
in the solver directory should be edited with the DSO library.
Make a batch file in your home bin directory, named patchFoamLib
, with the content
#! /bin/sh sed -i '$ s|$|\ \\|' $1 sed -i '$ a\ \ \ \ $(FOAM_MPI_LIBBIN)/libPstream.so' $1
and make it executable. In the Terminal, use the command
patchFoamLib Make/options
if you want to patch the file of options
in one time, use the command
cd $WM_PROJECT_DIR/applications/solvers/ find . -iname 'options' -execdir patchFoamLib {}\;
I hope this would help you compile your own OpenFOAM successfully.
On July 30, Laurence R. McGlashan [2] suggested editing the wmake/rules/linux64Gcc/general
file, which is easier than editing the all options files:
PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl $(FOAM_MPI_LIBBIN)/libPstream.so
This would be a better solution.
Sometimes, if errors happen with like this, there's a need a manual editing for options file with the missing library. if the error reports the missing link is libincompressibleTurbulenceModels, the following should be added to the EXE_LIBS options (you know I mean this is in file options
)
-lincompressibleTurbulenceModels
Or other OpenFOAM model libraries.
Reference
[1] OpenFOAM. Source pack installation. http://www.openfoam.com/download/source.php, <2010-06-30>
[2] http://www.cfd-online.com/Forums/openfoam-installation/78360-openfoam-1-7-x-fedora-13-a.html, <2010-07-30>
Thanks for the wiki
I have this problem
http://www.cfd-online.com/Forums/openfoam-installation/78360-openfoam-1-7-x-fedora-13-a.html
Do you have any idea???
Please add the line to the
EXE_LIBS
option in the file./Make/options
in the solver directory.and this option should be
then remake it.
Some other errors like this should be edit the options file like the above.
Because the DSO link library should be declared explicitly in Fedora 13.