CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (http://www.cfd-online.com/Forums/openfoam-installation/)
-   -   64bitrhel5 OF installation instructions (http://www.cfd-online.com/Forums/openfoam-installation/57337-64bitrhel5-installation-instructions.html)

mirko May 2, 2008 14:20

Hi, here is an exploded sum
 
Hi,

here is an exploded summary of how I installed the development version onto my machine. Please comment and correct

*WARNING* do not use these instructions blindly !!!
There are probably mistakes in them. Check on this topic to see what other users will comment and correct.

Installation from the OpenFOAM-1.4.1-dev package

* Tested on

OpenFOAM-1.4.1-dev version, 64-bit RedHat Enterprise Linux 5, x86_64 architecture for user openfoam with home directory /home/openfoam and bash shell.

* WARNING

The instructions here are believed to be correct. It is very likely that there are mistakes in this document. Stay tuned for further corrections.

* Intended audience:

- Novice OpenFOAM users
- Not very skilled in system maintenance and program development
- Reasonably well profficient in the Unix/Linux environment

* Installation overview:

- File download
- Prep
- Compiler and debugger installation
- Specification of the build environment
- Utility installation
- OpenFOAM installation
- OpenFOAM testing

* Conventions in this document

OpenFOAM can be installed on 32- and 64-bit environments. The main difference is that the various utility binaries are installed in ~/OpenFOAM/linux or ~/OpenFOAM/linux64 directory respectively. When I refer to the OpenFOAM/linux(64) directory, I mean either OpenFOAM/linux or OpenFOAM/linux64. Choose the appropriate one for your system.


* Additional comments

OpenFOAM is intended to operate within its own mini-development environment. The sources should be compiled using the compiler similar or slightly better than the one that is used by the OpenFOAM development team. (The compilation currently fails with gcc-4.3, but works very well with gcc-4.2).

This is accomplished as follows:

- The compiler and debugger are installed in $HOME/OpenFOAM/linux(64).
- The build environment (and PATH) is set-up to use that compiler.

The OpenFOAM build and operating environment is defined in files ~/$HOME/OpenFOAM/$HOME/OpenFOAM-1.4.1-dev/.bashrc and ~/$HOME/OpenFOAM/$HOME/OpenFOAM-1.4.1-dev/.$HOME/OpenFOAM-1.4.1-dev/bashrc. During the installation procedure, we will modify these files and add calls to them to ~/.bashrc. Before compiling any files, we will invoke those files to set-up the compilation environment.

The compiler and debugger installation is not more complicated than the usual linux software installation, and is the simplest part of OpenFOAM installation.

The build procedure is a bit unusual as it involves tools other than make: cmake and wmake.

At the end of the installation and test procedure we will have the following directory tree

~
.- OpenFOAM
..- LinuxSrc
..- linux(64)
..- OpenFOAM-1.4.1-dev
..- ${LOGNAME}-1.4.1-dev

* Required software

OpenFOAM uses either Paraview of DX result visualization. Java is used for the graphical front-end (note that seasoned OpenFOAM users suggest using the command line for speed and efficiency).

The user is responsible to install the following software:

- svn (subversion) or svk for OpenFOAM download (we give the exact svn/svk command to download OpenFOAM
- gnu make (ether gmake or make)
- lam-mpi for ???
- mico for ???
- zlib for ???

Sources for some of the other packages are:
- http://www.lam-mpi.org/7.1/download.php
- http://www.open-mpi.org/
- http://www.mico.org/
- http://www.zlib.net/

* Prepare directory structure

Have the following directories ready:

~/OpenFOAM
~/OpenFOAM/linuxSrc
~/OpenFOAM/linux64 or ~/OpenFOAM/linux

* File download

** OpenFOAM-dev download

> cd ~/OpenFOAM

Downloading of source files into ~/OpenFOAM/OpenFOAM-1.4.1-dev:

Use the SVN check-out command:

> svn co https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Core/O penFOAM-1.4.1-dev

Or use SVK. SVK setup:

> svk depotmap --init
> svk mirror https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Core/O penFOAM-1.4.1-dev //OpenFOAM-1.4.1-dev
> svk sync //OpenFOAM-1.4.1-dev

Ready to check-out

** gcc download

> cd $HOME/OpenFOAM/linuxSrc

# download using standard ftp
> ftp ftp.gnu.org
cd /gnu/gcc/gcc-4.1.0/
bin
get gcc-4.1.0.tar.bz2
exit
>

** gdb download

Same as for gcc

** Java JSDK download and installation

# download from a nearby SourceForge mirror
> cd $HOME/OpenFOAM/linux(64)/
> wget http://umn.dl.sourceforge.net/source...2_05.linux.tgz

# extraction and installation
> tar -zxvf j2sdk1.4.2_05.linux.tgz

# cleanup
> rm j2sdk1.4.2_05.linux.tgz

** Paraview download

> cd $HOME/OpenFOAM/linuxSrc
> wget http://www.paraview.org/files/v2.4/p...w-2.4.4.tar.gz

> tar -zxvf ./paraview-2.4.4.tar.gz
> mkdir -p paraview-2.4.4/lib/paraview-2.4

** Build of compilation utilities

To reassure the novices (like myself) -- these two steps are among the simplest and shortest of the whole procedure.

gcc:

> cd $HOME/OpenFOAM/linuxSrc
> tar xzf gcc-4.2.2.tgz
> mkdir gcc-4.2.2-obj
> cd gcc-4.2.2-obj
> ../gcc-4.2.2/configure --prefix=$HOME/OpenFOAM/linux64/gcc-4.2.2 --exec-prefix=$HOME/OpenFOAM/linux64/gcc-4.2.2 --enable-languages=c,c++ --enable-shared
> gmake bootstrap
> gmake
> gmake install

gdb:

> cd ~/OpenFOAM/linuxSrc
> tar xzf gdb-6.8.tar.gz
> cd gdb-6.8
> ./configure --prefix=~/OpenFOAM/linux64/gdb-6.8
> gmake
> gmake install

* Modify local environment to use the installed gdb and gcc

Before proceeding to build the other utilities and $OpenFOAM, we will modify the local envoronment to use them.

Modify $HOME/OpenFOAM/OpenFOAM-1.3/.bashrc. We need to adjust the following lines in the file to point to the correct compiler and debugger: Change the strings gcc-4.2.2 and gdb-6.8 to whatever version matches your install.

if [ "$WM_COMPILER" = "Gcc" -o "$machineTest" = "Linux" -a "$WM_COMPILER" = "" ]; then
export WM_COMPILER_DIR=$WM_PROJECT_INST_DIR/$WM_ARCH/gcc-4.2.2$WM_COMPILER_ARCH
WM_COMPILER_BIN="$WM_COMPILER_DIR/bin:$WM_COMPILER_DIR/../gdb-6.8/bin"
WM_COMPILER_LIB=$WM_COMPILER_DIR/lib${WM_COMPILER_LIB_ARCH}:$WM_COMPILER_DIR/lib :
fi


Add the following line to the end of ~/.bashrc, (include the comments if you are over 40 years old)
# Set WM_64 if your system is 64-bit
WM_64=yes
# Set up OpenFOAM build and operating environment
source ~/$HOME/OpenFOAM/$HOME/OpenFOAM-1.4.1-dev/.bashrc


Now apply the changes
> . ~/.bashrc

To see whether the changes have effect, do
> set | grep WM_
WM_64=yes
WM_ARCH=linux64
WM_COMPILER=Gcc
WM_COMPILER_ARCH=
WM_COMPILER_BIN=/home/openfoam/OpenFOAM/linux64/gcc-4.2.1/bin:/home/openfoam/Ope nFOAM/linux64/gcc-4.2.1/../gdb-6.4/bin
WM_COMPILER_DIR=/home/openfoam/OpenFOAM/linux64/gcc-4.2.1
WM_COMPILER_LIB=/home/openfoam/OpenFOAM/linux64/gcc-4.2.1/lib64:/home/openfoam/O penFOAM/linux64/gcc-4.2.1/lib:
WM_COMPILER_LIB_ARCH=64
WM_COMPILE_OPTION=Opt
WM_DECOMP_INC=-DFACE_DECOMP
WM_DECOMP_LIBS='-lfaceDecompFiniteElement -lfaceDecompositionMotionSolver'
WM_DIR=/home/openfoam/OpenFOAM/OpenFOAM-1.4.1/wmake
WM_JAVAC_OPTION=Opt
WM_LINK_LANGUAGE=c++
WM_MPLIB=OPENMPI
WM_NCOMPPROCS=2
WM_OPTIONS=linux64GccDPOpt
WM_PRECISION_OPTION=DP
WM_PROJECT=OpenFOAM
WM_PROJECT_DIR=/home/openfoam/OpenFOAM/OpenFOAM-1.4.1
WM_PROJECT_INST_DIR=/home/openfoam/OpenFOAM
WM_PROJECT_LANGUAGE=c++
WM_PROJECT_USER_DIR=/home/openfoam/OpenFOAM/openfoam-1.4.1
WM_PROJECT_VERSION=1.4.1

and check if it makes sense. Also, verify that the compiler is in PATH:
> echo $PATH | tr : \\n
/home/openfoam/OpenFOAM/linux64/paraview-2.4.4/bin
/home/openfoam/OpenFOAM/OpenFOAM-1.4.1-dev/src/lam-7.1.4/platforms/linux64GccDPO pt/bin
/home/openfoam/OpenFOAM/OpenFOAM-1.4.1-dev/src/mico-2.3.12/platforms/linux64GccD POpt/bin
/home/openfoam/OpenFOAM/linux64/j2sdk1.4.2_05/bin
/home/openfoam/OpenFOAM/linux64/gcc-4.2.2/bin
/home/openfoam/OpenFOAM/linux64/gcc-4.2.2/../gdb-6.8/bin
/home/openfoam/OpenFOAM/openfoam-1.4.1-dev/applications/bin/linux64GccDPOpt
/home/openfoam/OpenFOAM/OpenFOAM-1.4.1-dev/applications/bin/linux64GccDPOpt
/home/openfoam/OpenFOAM/OpenFOAM-1.4.1-dev/wmake
/home/openfoam/OpenFOAM/OpenFOAM-1.4.1-dev/bin
/usr/kerberos/bin
/usr/local/bin
/usr/bin
/bin
/usr/X11R6/bin

Finally, for the paranoid:
> which g++
~/OpenFOAM/linux64/gcc-4.2.2/bin/g++
confirms that we have the correct compiler in our path.

And to really, really confirm that $OpenFOAM does see g++ use foamInstallationTest. This utility tests the OpenFOAM environment. It will test the compiler and many other things. It should report the compiler to be OK, but icoFOAM missing:

> ~/$HOME/OpenFOAM/$HOME/OpenFOAM-1.4.1-dev/bin/foamInstallationTest

Look for this section:
Software versions
-------------------------------------------------------------------------------
Software Version Location
-------------------------------------------------------------------------------
gcc 4.2.2 /home/openfoam/OpenFOAM/linux64/gcc-4.2.2/bin/gcc
java 1.4.2_05 /home/openfoam/OpenFOAM/linux64/j2sdk1.4.2_05/bin/java
gzip 1.3.5 /usr/bin/gzip
tar 1.3.5 /bin/tar
icoFOAM ... ERROR MESSAGE

You will see an error message for icoFOAM, because OpenFOAM is not installed yet. But gcc should point to the installed compiler. Otherwise you may see an error message because of the compiler version mismatch.

If the compiler is not found it is most likely because one or more of the following:
- The compiler is not in ~/OpenFOAM/linux(64)
- $HOME/OpenFOAM/.bashrc does not point to the installed compiler
- ~/.bashrc does not point to $HOME/OpenFOAM/.bashrc
- ~/.bashrc has not been sourced


Once these tests check-out, we are ready to build the rest of the system.



cmake:

(I did not follow this procedure as cmake was on the system)

> cd ~/OpenFOAM/linuxSrc
> tar xzf cmake-2.4.7.tar.gz
> cd cmake-2.4.7
> ./configure --prefix=~/OpenFOAM/linux(64)/cmake-2.4.7
> gmake
> gmake install


dx build

> cd ~/OpenFOAM/linuxSrc
> tar xzf dx-4.4.4.tgz
> cd dx-4.4.4
> ./configure --prefix=~/OpenFOAM/linux/dx-4.4.4 --enable-shared
> gmake
> gmake install

Note -- I could not build dx because of following errors:

make[4]: Entering directory `/home/openfoam/OpenFOAM/linuxSrc/dx-4.4.4/src/uipp/dxuilib'
g++ -DHAVE_CONFIG_H -I. -I. -I../../../include -I./../base -I../../../include -I./../dxui -Dlinux -m64 -fPIC -fpermissive -c -o EditorWindow.o EditorWindow.C
In file included from /usr/local/include/Xm/XmP.h:1646,
from /usr/local/include/Xm/ManagerP.h:29,
from /usr/local/include/Xm/ScrolledWP.h:32,
from EditorWindow.C:35:
/usr/include/X11/VendorP.h:87: error: previous declaration of 'VendorShellClassRec vendorShellClassRec' with 'C++' linkage
/usr/local/include/Xm/VendorSP.h:58: error: conflicts with new declaration with 'C' linkage


Because of this, I had to remove the following directory from the OpenFOAM distribution:
OpenFOAM-1.4.1-dev/applications/utilities/postProcessing/graphics/dxFoamExec

dx is not essential. One can use paraview for visualization.


paraview build


> cd ~/OpenFOAM/linuxSrc
> tar xvzf paraview-2.4.4.tgz
> mkdir paraview-2.4.4-obj
> cd paraview-2.4.4-obj
> cmake -i ../paraview-2.4.4

You will be prompted for build options:

Would you like to see advanced options? [No]: No
Please wait while cmake processes CMakeLists.txt files....

You will be offered a chance to change many options. Here are the ones that you will need to change from the default values:

Variable Name: BUILD_SHARED_LIBS
Description: Build VTK with shared libraries.
Current Value: OFF
New Value (Enter to keep current value): yes

Variable Name: CMAKE_INSTALL_PREFIX
Description: Install path prefix, prepended onto install directories.
Current Value: /usr/local
New Value (Enter to keep current value): ~/OpenFOAM/linux64/paraview-2.4.4

Once cmake is done, start the build:
> gmake
# and go for lunch. It will take a bit
> gmake install

And then copy some files

> cd ~/OpenFOAM/linuxSrc
> mkdir ~/OpenFOAM/linux(64)/paraview-2.4.4/include
> cp ./paraview-2.4.4/VTK/Common/vtk* ~/OpenFOAM/linux(64)/paraview-2.4.4/include/
> cp ./paraview-2.4.4/VTK/Filtering/vtk* ~/OpenFOAM/linux(64)/paraview-2.4.4/include/
> cp ./paraview-2.4.4-obj/VTK/vtk* ~/OpenFOAM/linux(64)/paraview-2.4.4/include/
> cp ./paraview-2.4.4-obj/ParaViewConfig.cmake ~/OpenFOAM/linux(64)/paraview-2.4.4/lib/paraview-2.4/


In case you have to re-do the build (new compiler, or other reasons) first do a clean:
> gmake clean
and then repeat the build process


OpenFOAM build:

# go to the $HOME/OpenFOAM-1.4.1-dev directory by executing the following command
> foam
# and build foam
> ./Allwmake
# and go for dinner. This also takes a while.

In case you need to re-do the OpenFOAM compilation, do
> foam
> wmake/wcleanAll
and the repeat the installation

* First tests

First check out if everything looks ok
> foam
> bin/foamInstallationTest
should give an OK.

Also icoFoam should run, but return an error:
> icoFOAM
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.4.1-dev |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

Exec : icoFoam
Date : May 02 2008
Time : 14:00:06
Host : CYSSHD1
PID : 28085

Usage: icoFoam <root> <case> [-parallel]


--> FOAM FATAL ERROR : Wrong number of arguments, expected 2 found 0


FOAM exiting
>

* Run tutorials

Finally we run the tutorials, which exercise OpenFOAM a bit more. Citing README that comes with OpenFOAM:

Create a project directory within the $HOME/OpenFOAM directory named
<username>-1.4.2 (e.g. 'chris-1.4.2' for user chris) and create a
directory named 'run' within it, e.g. by typing:

> mkdir -p $HOME/OpenFOAM/${LOGNAME}-1.4.1/run

Copy the 'tutorial' examples directory in the OpenFOAM distribution to the
'run' directory. If OpenFOAM environment variables are set correctly, then
the following command will be correct:

> cp -r $WM_PROJECT_DIR/tutorials $HOME/OpenFOAM/${LOGNAME}-1.4.1/run

Run the first example case of incompressible laminar flow in a cavity:

> cd $HOME/OpenFOAM/${LOGNAME}-1.4.1/run/tutorials/icoFoam
> blockMesh . cavity
> icoFoam . cavity



* Acknowledgments

This document is based on the wiki instructions (http://openfoamwiki.net/index.php/Ho...mpile_OpenFOAM) and Hrvoje's build instructions for the -dev version (buildinstructions.txt). I also benefited from discussion and encouragment of several people on and off the discussion board.

The wisdom presented here is theirs, the mistakes mine.

reza August 12, 2008 15:21

Mirko, Do you get get gcc-4.
 
Mirko,
Do you get get gcc-4.1.0.tar.bz2 in the gcc dowload part and then will do:
tar xzf gcc-4.2.2.tgz
in the gcc download?

reza August 12, 2008 18:07

Dear Mirko, In gdb part I g
 
Dear Mirko,

In gdb part I get this error after gmake:

make[1]: Entering directory `/home/reza/OpenFOAM/linuxSrc/gdb-6.4'
Configuring in ./libiberty
configure: error: expected an absolute directory name for --prefix: ~/OpenFOAM/linux/gdb-6.4
make[1]: *** [configure-libiberty] Error 1
make[1]: Leaving directory `/home/reza/OpenFOAM/linuxSrc/gdb-6.4'
make: *** [all] Error 2

Do you have any idea how to solve it?


All times are GMT -4. The time now is 23:35.