Compilation of Openfoam in Redhat Linux: Tar XVF Openfoam-2.1.0.Tgz
Compilation of Openfoam in Redhat Linux: Tar XVF Openfoam-2.1.0.Tgz
There are some other Third party tools also required for compilation.
Gcc-4.4.3
Gmp-5.0.1
Mpfr-2.4.2
Cmake-2.8.3
Qt-4.6.2
Flex-2.5.35
Create one Directory. And that Directory should be named like OpenFOAM under
opt
Copy the OpenFOAM-2.0.1 and ThirdParty-2.1.0 and all other Thirdparty tools,
mentioned above in to newly
Created directory ( OpenFOAM).
Before compiling OpenFOAM,
check the gcc version. gcc
version Gcc is
nothing but
compiler.
And check the gcc version of
OpenFOAM. Those Information is
also available in the bashrc file.
By default it was set to Gcc. Then
see the
OpenFOAM2.1.0/etc/config/settings.sh file.
Here Gcc is like gcc-4.6.2.
According to OpenFOAM website,
they mentioned like gcc-4.4.3 is
recommended and gcc-4.3.3 is
also acceptable.
So, see the lines related to Gcc in
sttings .sh file. Pickup gcc-4.4.3
content, Under Gcc-4.4.3 there
are two more thirdparty tools like
gmp-5.0.1 and mpfr-2.4.2.
Change Gcc version from Gcc to
Gcc44 in the bashrc file.
One more change in the bashrc file. In the beginning of the lines there is a line called
foamInstall. By default it is set to $HOME/WM_PROJECT. Comment out that line
using # symbol. And uncomment out the line like opt/WM_PROJECT by removing the
# symbol. Because, All the OpenFOAM files are under opt.
In OpenFOAM-2.1.0/etc/bashrc , see the foamCompiler lines. By default it is set to
system. Change it to OpenFOAM. So that compiler will take the Gcc44 only.
Go to opt location and enter in to OpenFOAM directory. And Again enter in to
OpenFOAM-2.10 directory. Then source the settings file by using command like
source etc/bashrc
Then it will give the warning like gcc-4.4.3 is not available in the thirdParty Ignore this
warning and continue to the next step below:
Put compressed files of gcc-4.4.3, mpfr-2.4.2 and gmp-5.0.1 in the thirdparty directory.
First uncompress those folders. There is a makeGcc script in the thirdparty directory.
We need to edit this script. Change the gcc version from 4.5.2 to gcc-4.4.3. And there is
a n another thirdParty library called mpc. This library does not require for versions
before gcc-4.5. currently we are using gcc-4.4.3. So mpc does not require.
So comment all the information related to mpc . (i.e) delete all the information related
to mpc. And also comment out line No from 194 to 235 in the makeGcc script.
Then run the makeGcc script . It will take half an hour time approx. It depend up on the
processor speed.
Then source the OpenFOAM settings once again. Above mentioned warning will not
appear from this time. Because,l We compiled latest Gcc version. Now check the Gcc
version, Using command like gcc version . It should be like Gcc-4.4.3.
Compilation of Flex
Then type the following lines. These lines are nothing but setting the environment
variables of Flex for OpenFOAM compilation.
export LD_LIBRARY_PATH=/opt/OpenFOAM/flex/lib:$LD_LIBRARY_PATH
export PATH=/opt/OpenFOAM/flex/bin:PATH
Then check the version of Flex, Using command like flex version. It will show like
2.5.35.
As per mentioned in the above lines, Under newly created directory called flex, There is
a subfolder called include. In include directory, there is a file name called
FlexLexer.H. Copy that file in to the OpenFOAM-2.1.0/src/OpenFOAM/include.
OpenFOAM compilation:
Paraview Compilation.
For compiling the Paraview, Two more thirdparty tools will require. Those are like
Cmake-2.8.3 and Qt-4.6.2
Download Cmake-2.8.3.tar.gz and uncompress the file.
Compile the cmake-2.8.3 using makeCmake script. Be sure that, In makeCmake script,
version will be the same that what we are having current.
Ex: If we have cmake-2.8.3 means in the script itself version is like cmake-2.8.3 only.
Then run the makeCmake script. It will create libraries and binaries.
Then set the environment variables like
export PATH=/opt/OpenFOAM/ThirdParty-2.1.0/cmake-2.8..3/bin:PATH
Then compile qt . Download Qt-4.6.2 uncompress the file and start compilation using
makeQt script. Be sure that you should have the same version in that script.
Set the environment variables for qt like
export LD_LIBRARY_PATH= opt/OpenFOAM/ThirdParty2.1.0/platforms/linux64Gcc44/qt-4.6.2/lib:$LD_LIBRARY_PATH