Difference between revisions of "Installation"

From OpenFOAMWiki
(Trying to consolidate installation related stuff and make existing info more easily accessible, still some way to go)
Line 1: Line 1:
This is a list of wiki pages about installation
+
OpenFOAM is [http://www.opencfd.co.uk/openfoam/download.html available for download] as source code and binary files for linux and linux-like operating systems.  An official Windows binary is not provided. 
  
* [[Basic Installation Steps]]
+
=OpenFOAM=
* [[Howto install OpenFOAM-1.6.x (git repository version)]]
+
 
* [[Howto compile OpenFOAM]]
+
==General Instructions==
 +
 
 +
===OpenCFD git repository===
 +
 
 +
OpenCFD provide a repository using the [http://en.wikipedia.org/wiki/Git_(software) git distributed version control system].
 +
 
 +
{{VersionInfo}}{{Version1.6}}
 +
====Unpacking====
 +
 
 +
To get the sources you will need to do the following
 +
<pre>
 +
cd ~/OpenFOAM/
 +
git clone http://repo.or.cz/r/OpenFOAM-1.6.x.git/
 +
cd OpenFOAM-1.6.x
 +
git pull
 +
</pre>
 +
 
 +
You will also need to install the ThirdParty source, from [http://www.opencfd.co.uk/openfoam/linux.html http://www.opencfd.co.uk/openfoam/linux.html], make sure you get the right version (ie 32 or 64 bit)
 +
 
 +
To install this you need to unpack this file in the OpenFOAM directory (the code below assumes that the tar file is in <tt>~/OpenFOAM/</tt>
 +
 
 +
<pre>
 +
cd ~/OpenFOAM/
 +
tar -zxf ThirdParty-1.6.General.gtgz
 +
</pre>
 +
 
 +
====Set-up====
 +
Before compiling you will need to set up the openfoam environment. Firstly - set wmake to use the system compiler
 +
 
 +
in <tt>~/OpenFOAM/OpenFOAM-1.6.x/etc/settings.sh</tt> change the line (line no 98)
 +
<pre>
 +
compilerInstall=OpenFOAM
 +
</pre>
 +
to
 +
<pre>
 +
compilerInstall=System
 +
</pre>
 +
 
 +
Next source the OF settings
 +
<pre>
 +
. ~/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc
 +
</pre>
 +
 
 +
Your session should now be set up to run OF-1.6 (but there won't be anything to run yet)
 +
 
 +
===Compiling===
 +
 
 +
Next step is to compile OF.
 +
 
 +
Set the number of processors to use, in this case 4
 +
<pre>
 +
export WM_NCOMPPROCS=4
 +
</pre>
 +
 
 +
Compile the ThirdParty stuff
 +
<pre>
 +
cd ~/OpenFOAM/
 +
ln -s ThirdParty-1.6 ThirdParty-1.6.x
 +
cd ThirdParty-1.6.x
 +
./Allwmake
 +
</pre>
 +
 
 +
Assuming you have no errors, we can now compile OpenFOAM
 +
re-source the settings (to pick up newly created directories)
 +
<pre>
 +
cd ~/OpenFOAM/OpenFOAM-1.6.x
 +
. etc/bashrc
 +
</pre>
 +
 
 +
Then compile away
 +
<pre>
 +
./Allwmake
 +
</pre>
 +
 
 +
When it finishes (hopefully) you should have a completely working installation.
 +
 
 +
===Compile OpenCFD release===
 +
{{VersionInfo}}{{Version1.4}}
 +
 
 +
This is a step-by-step installation guide to OpenFOAM on 32 bit machines. It is highly focused on Linux-newbies, thus many steps might
 +
look superfluous on more experienced users. The character ">" is used to signal that what follows on that specific line is to be typed in a command line.
 +
 
 +
- Make a directory for your OpenFOAM installation by typing:
 +
  > mkdir $HOME/OpenFOAM
 +
  > cd $HOME/OpenFOAM
 +
  > mkdir linux
 +
 
 +
- Download the following six archives from the opencfd-homepage to the $HOME/OpenFOAM directory:
 +
  > OpenFOAM-1.4.1.General.gtgz
 +
  > OpenFOAM-1.4.1.linuxGccDOpt.gtgz
 +
  > OpenFOAM-1.4.1.linuxGccSOpt.gtgz
 +
  > gcc-4.2.1.linux.tgz
 +
  > j2sdk1.4.2_05.linux.tgz
 +
  > paraview-2.4.4.linux.tgz
 +
 
 +
- Open a terminal and type:
 +
  > ls /usr/include/features.h
 +
  a) EITHER "/usr/include/features.h" is written to screen. Do not do any further.
 +
  b) OR "cannot access /usr/include/features.h: No such file or directory"
 +
    is written to screen. You need the build essentials to compile your own
 +
    boundary conditions, thus type the following in a terminal:
 +
    > aptitude install build-essential gcc
 +
 
 +
- Unpack the archives by typing the following command:
 +
  > cd $HOME/OpenFOAM
 +
  > tar -xzf OpenFOAM-1.4.1.General.gtgz
 +
  > tar -xzf OpenFOAM-1.4.1.linuxGCCDPOpt.gtgz
 +
  > tar -xzf OpenFOAM-1.4.1.linuxGCCSPOpt.gtgz
 +
  > tar -xzf gcc-4.2.1.linux.tgz linux/
 +
  > mv *.tgz linux/.
 +
  > cd linux
 +
  > tar -xzf gcc-4.2.1.linux.tgz
 +
  > tar -xzf j2sdk1.4.2_05.linux.tgz
 +
  > tar -xzf paraview-2.4.4.linux.tgz
 +
 
 +
- You need to set some environmental variables to be able to run OpenFOAM. This is done in the following way:
 +
 
 +
  a) EITHER, if running bash or ksh (if in doubt type 'echo $SHELL'), do the
 +
    following:
 +
    > nano $HOME/.bashrc (this open a text-editor in your command window)
 +
    In the end of the file you type:
 +
    . $HOME/OpenFOAM/OpenFOAM-1.4.1/.OpenFOAM-1.4.1/bashrc
 +
    Press 'CTRL-X' to quit nano and agree to save changes.
 +
 
 +
  a) OR, if running tcsh or csh (if in doubt type 'echo $SHELL'), do the
 +
    following:
 +
    > nano $HOME/.cshrc (this open a text-editor in your command window)
 +
    In the end of the file you type:
 +
    source $HOME/OpenFOAM/OpenFOAM-1.4.1/.OpenFOAM-1.4.1/cshrc
 +
    Press 'CTRL-X' to quit nano and agree to save changes.
 +
 
 +
- Open a new command-window. This will read $HOME/.bashrc and set all the necessary environmental variables. To check the installation do:
 +
  > cd ~/OpenFOAM/OpenFOAM-1.4.1/bin
 +
  > sh foamInstallationTest
 +
 
 +
- On single-machine setups, the installation test will probably produce a report which looks like this in the last couple of lines:
 +
 +
  ==============================================================================
 +
  Checking networking...
 +
 
 +
  -------------------------------------------------------------------------------
 +
  Action                  Result                                      Crit
 +
  -------------------------------------------------------------------------------
 +
  Pinging_ngj-ubuntu      Successful                                  yes
 +
  Pinging_localHost        Successful                                  yes
 +
  Test_rsh:                Unsuccessful_connection_refused*            yes
 +
  Test_ssh:                Unsuccessful_connection_refused*            yes
 +
  FATAL ERROR: No remote shell available.
 +
              Foam1.4.1 enviroment requires either ssh and/or rsh.
 +
              Contact your system administrator.
 +
 +
 +
  -------------------------------------------------------------------------------
 +
 +
  The system test has evoked 1 fatal error(s).
 +
 +
  Critical systems ok.
 +
 +
  Review the output for warning messages and consult
 +
  the installation guide for trouble shooting.
 +
  ==============================================================================
 +
 
 +
  This fatal error is due the test_rsh and test_ssh critiria, though they are
 +
  irrelevant on single-machine installations, i.e. only relevant for parallel-
 +
  processing on multiple machine.
 +
 
 +
- To setup the a working directory, follow step 6 in the ~/OpenFOAM/OpenFOAM-1.4.1/README file.
 +
 
 +
- You are now ready to begin working with OpenFOAM.
 +
 
 +
- Have fun:)
 +
 
 +
===OpenCFD binaries===
 +
 
 +
===OpenFOAM-dev subversion repository===
 +
 
 +
==System specific tips and experiences==
 +
 
 +
===OpenSuSE===
 +
{{VersionInfo}}{{Version1.6}} [[User:Hoogs/Installation#1.6.x|1.6.x on 11.1, x86_64]] |
 +
 
 +
===Gentoo===
 +
{{VersionInfo}}{{Version1.5}}
 +
 
 +
OpenFOAM and Paraview are now both in the main portage tree. For installation just type
 +
 
 +
<bash>
 +
emerge openfoam-meta paraview
 +
</bash>
 +
 
 +
In order to get OpenFOAM running, add the following line to your ~/.bashrc
 +
 
 +
  alias startOF15="source /usr/lib/OpenFOAM/OpenFOAM-1.5/etc/bashrc"
 +
 
 +
And each time you want to use OpenFOAM just type '''''startOF15''''' in the active terminal.
 +
 
 +
===Ubuntu/Debian===
 +
 
 +
====Ubuntu Intrepid 8.1====
 +
{{VersionInfo}}{{Version1.5}}
 +
 
 +
You have to add the following line to /etc/apt/sources.list either with your preferred text editor or package manager.
 +
 
 +
  deb http://ppa.launchpad.net/cae-team/ppa/ubuntu intrepid main
 +
 
 +
Then you have to update your repository list, for example with
 +
 
 +
<bash>
 +
sudo apt-get update
 +
</bash>
 +
 
 +
After that you can install openfoam and paraview just by typing
 +
 
 +
<bash>
 +
sudo apt-get install openfoam paraview
 +
</bash>
 +
 
 +
In order to get OpenFOAM running, add the following line to your ~/.bashrc
 +
 
 +
  alias startOF15="source /usr/lib/OpenFOAM-1.5/etc/bashrc"
 +
 
 +
And each time you want to use OpenFOAM just type '''''startOF15''''' in the active terminal.
 +
 
 +
====OpenFOAM-dev-1.5 under Ubuntu Intrepid 8.10====
 +
{{VersionInfo}}{{Version1.5}}
 +
 
 +
In order to install the OpenFOAM-dev-1.5 version as debian package under Ubuntu Intrepid 8.10 you have to add the following line to /etc/apt/sources.list either with your preferred text editor or package manager.
 +
 
 +
  deb http://ppa.launchpad.net/cae-team/ppa/ubuntu intrepid main
 +
 
 +
Then you have to update your repository list, for example with
 +
 
 +
<bash>
 +
sudo apt-get update
 +
</bash>
 +
 
 +
After that you can install the openfoam-dev-1.5 package just by typing
 +
 
 +
<bash>
 +
sudo apt-get install openfoam-dev-1.5
 +
</bash>
 +
 
 +
In order to get OpenFOAM running, add the following line to your ~/.bashrc
 +
 
 +
  alias startOF15dev="source /usr/lib/OpenFOAM-1.5-dev/etc/bashrc"
 +
 
 +
And each time you want to use OpenFOAM just type '''''startOF15dev''''' in the active terminal.
 +
 
 +
====Debian====
 +
 
 +
You can check, if you can install the openfoam binaries, like with Ubuntu Intrepid 8.10. If this not applies, e.g. due to dependency problems, then you have to add the following line to the /etc/apt/sources.list
 +
 
 +
  deb-src http://ppa.launchpad.net/cae-team/ppa/ubuntu intrepid main
 +
 
 +
Update you repository list
 +
 
 +
<bash>
 +
sudo apt-get update
 +
</bash>
 +
 
 +
After adding this line, you have to compile the debian source package of openfoam and/or paraview at your own by typing
 +
 
 +
<bash>
 +
apt-get -b source openfoam
 +
</bash>
 +
 
 +
and/or
 +
 
 +
<bash>
 +
apt-get -b source openfoam-dev-1.5
 +
</bash>
 +
 
 +
and/or
 +
 
 +
<bash>
 +
apt-get -b source parafoam
 +
</bash>
 +
 
 +
For further information about debian source packages, follow [http://www.debian.org/doc/manuals/apt-howto/ch-sourcehandling.en.html these guidlines].
 +
 
 +
In order to get OpenFOAM running, add the following line to your ~/.bashrc
 +
 
 +
  alias startOF15="source /usr/lib/OpenFOAM-1.5/etc/bashrc"
 +
 
 +
And each time you want to use OpenFOAM just type '''''startOF15''''' in the active terminal.
 +
 
 +
=Paraview and paraFoam=
 +
 
 +
==Troubleshooting paraFoam==
 +
{{VersionInfo}}{{Version1.5}}
 +
 
 +
If you have problems with paraFoam and the dev version you might have to recompile paraFoam (see http://www.opencfd.co.uk/openfoam/doc/README.html#Paraview). If paraFoam loads, but doesn't know which reader to use to display your OpenFoam results, recompiling the PV3FoamReader should suffice.
 +
 
 +
To do so, first make sure the environment variable $ParaView_INST_DIR contains the correct path (in my version of OF-1.5-dev there was a typo, a wrong "-"). If not, correct it in ~/OpenFOAM/OpenFOAM-1.5-dev/etc/apps/paraview3/bashrc and re-source ~/.bashrc. Then proceed with ./Allwclean and ./Allwmake in ~/OpenFOAM/OpenFOAM-1.5-dev/applications/utilities/postProcessing/graphics/PV3FoamReader.

Revision as of 03:40, 3 September 2009

OpenFOAM is available for download as source code and binary files for linux and linux-like operating systems. An official Windows binary is not provided.

1 OpenFOAM

1.1 General Instructions

1.1.1 OpenCFD git repository

OpenCFD provide a repository using the git distributed version control system.

Valid versions: OF version 16.png

1.1.1.1 Unpacking

To get the sources you will need to do the following

cd ~/OpenFOAM/
git clone http://repo.or.cz/r/OpenFOAM-1.6.x.git/
cd OpenFOAM-1.6.x
git pull

You will also need to install the ThirdParty source, from http://www.opencfd.co.uk/openfoam/linux.html, make sure you get the right version (ie 32 or 64 bit)

To install this you need to unpack this file in the OpenFOAM directory (the code below assumes that the tar file is in ~/OpenFOAM/

cd ~/OpenFOAM/
tar -zxf ThirdParty-1.6.General.gtgz

1.1.1.2 Set-up

Before compiling you will need to set up the openfoam environment. Firstly - set wmake to use the system compiler

in ~/OpenFOAM/OpenFOAM-1.6.x/etc/settings.sh change the line (line no 98)

compilerInstall=OpenFOAM

to

compilerInstall=System

Next source the OF settings

. ~/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc

Your session should now be set up to run OF-1.6 (but there won't be anything to run yet)

1.1.2 Compiling

Next step is to compile OF.

Set the number of processors to use, in this case 4

export WM_NCOMPPROCS=4

Compile the ThirdParty stuff

cd ~/OpenFOAM/
ln -s ThirdParty-1.6 ThirdParty-1.6.x
cd ThirdParty-1.6.x
./Allwmake

Assuming you have no errors, we can now compile OpenFOAM re-source the settings (to pick up newly created directories)

cd ~/OpenFOAM/OpenFOAM-1.6.x
. etc/bashrc

Then compile away

./Allwmake

When it finishes (hopefully) you should have a completely working installation.

1.1.3 Compile OpenCFD release

Valid versions: OF version 14.png

This is a step-by-step installation guide to OpenFOAM on 32 bit machines. It is highly focused on Linux-newbies, thus many steps might look superfluous on more experienced users. The character ">" is used to signal that what follows on that specific line is to be typed in a command line.

- Make a directory for your OpenFOAM installation by typing:

 > mkdir $HOME/OpenFOAM
 > cd $HOME/OpenFOAM
 > mkdir linux

- Download the following six archives from the opencfd-homepage to the $HOME/OpenFOAM directory:

 > OpenFOAM-1.4.1.General.gtgz
 > OpenFOAM-1.4.1.linuxGccDOpt.gtgz
 > OpenFOAM-1.4.1.linuxGccSOpt.gtgz
 > gcc-4.2.1.linux.tgz
 > j2sdk1.4.2_05.linux.tgz
 > paraview-2.4.4.linux.tgz

- Open a terminal and type:

 > ls /usr/include/features.h
 a) EITHER "/usr/include/features.h" is written to screen. Do not do any further.
 b) OR "cannot access /usr/include/features.h: No such file or directory" 
    is written to screen. You need the build essentials to compile your own 
    boundary conditions, thus type the following in a terminal:
    > aptitude install build-essential gcc

- Unpack the archives by typing the following command:

 > cd $HOME/OpenFOAM
 > tar -xzf OpenFOAM-1.4.1.General.gtgz
 > tar -xzf OpenFOAM-1.4.1.linuxGCCDPOpt.gtgz
 > tar -xzf OpenFOAM-1.4.1.linuxGCCSPOpt.gtgz
 > tar -xzf gcc-4.2.1.linux.tgz linux/
 > mv *.tgz linux/.
 > cd linux
 > tar -xzf gcc-4.2.1.linux.tgz
 > tar -xzf j2sdk1.4.2_05.linux.tgz
 > tar -xzf paraview-2.4.4.linux.tgz

- You need to set some environmental variables to be able to run OpenFOAM. This is done in the following way:

 a) EITHER, if running bash or ksh (if in doubt type 'echo $SHELL'), do the 
    following:
    > nano $HOME/.bashrc (this open a text-editor in your command window)
    In the end of the file you type:
    . $HOME/OpenFOAM/OpenFOAM-1.4.1/.OpenFOAM-1.4.1/bashrc
    Press 'CTRL-X' to quit nano and agree to save changes.
 a) OR, if running tcsh or csh (if in doubt type 'echo $SHELL'), do the 
    following:
    > nano $HOME/.cshrc (this open a text-editor in your command window)
    In the end of the file you type:
    source $HOME/OpenFOAM/OpenFOAM-1.4.1/.OpenFOAM-1.4.1/cshrc
    Press 'CTRL-X' to quit nano and agree to save changes.

- Open a new command-window. This will read $HOME/.bashrc and set all the necessary environmental variables. To check the installation do:

 > cd ~/OpenFOAM/OpenFOAM-1.4.1/bin
 > sh foamInstallationTest

- On single-machine setups, the installation test will probably produce a report which looks like this in the last couple of lines:

 ==============================================================================
 Checking networking...
  
 -------------------------------------------------------------------------------
 Action                   Result                                       Crit
 -------------------------------------------------------------------------------
 Pinging_ngj-ubuntu       Successful                                   yes 
 Pinging_localHost        Successful                                   yes 
 Test_rsh:                Unsuccessful_connection_refused*             yes
 Test_ssh:                Unsuccessful_connection_refused*             yes
 FATAL ERROR: No remote shell available.
              Foam1.4.1 enviroment requires either ssh and/or rsh.
              Contact your system administrator.


 -------------------------------------------------------------------------------

 The system test has evoked 1 fatal error(s).

 Critical systems ok.

 Review the output for warning messages and consult 
 the installation guide for trouble shooting.
 ==============================================================================
 This fatal error is due the test_rsh and test_ssh critiria, though they are 
 irrelevant on single-machine installations, i.e. only relevant for parallel-
 processing on multiple machine.

- To setup the a working directory, follow step 6 in the ~/OpenFOAM/OpenFOAM-1.4.1/README file.

- You are now ready to begin working with OpenFOAM.

- Have fun:)

1.1.4 OpenCFD binaries

1.1.5 OpenFOAM-dev subversion repository

1.2 System specific tips and experiences

1.2.1 OpenSuSE

Valid versions: OF version 16.png 1.6.x on 11.1, x86_64 |

1.2.2 Gentoo

Valid versions: OF version 15.png

OpenFOAM and Paraview are now both in the main portage tree. For installation just type

 
emerge openfoam-meta paraview

In order to get OpenFOAM running, add the following line to your ~/.bashrc

 alias startOF15="source /usr/lib/OpenFOAM/OpenFOAM-1.5/etc/bashrc"

And each time you want to use OpenFOAM just type startOF15 in the active terminal.

1.2.3 Ubuntu/Debian

1.2.3.1 Ubuntu Intrepid 8.1

Valid versions: OF version 15.png

You have to add the following line to /etc/apt/sources.list either with your preferred text editor or package manager.

 deb http://ppa.launchpad.net/cae-team/ppa/ubuntu intrepid main

Then you have to update your repository list, for example with

 
sudo apt-get update

After that you can install openfoam and paraview just by typing

 
sudo apt-get install openfoam paraview

In order to get OpenFOAM running, add the following line to your ~/.bashrc

 alias startOF15="source /usr/lib/OpenFOAM-1.5/etc/bashrc"

And each time you want to use OpenFOAM just type startOF15 in the active terminal.

1.2.3.2 OpenFOAM-dev-1.5 under Ubuntu Intrepid 8.10

Valid versions: OF version 15.png

In order to install the OpenFOAM-dev-1.5 version as debian package under Ubuntu Intrepid 8.10 you have to add the following line to /etc/apt/sources.list either with your preferred text editor or package manager.

 deb http://ppa.launchpad.net/cae-team/ppa/ubuntu intrepid main

Then you have to update your repository list, for example with

 
sudo apt-get update

After that you can install the openfoam-dev-1.5 package just by typing

 
sudo apt-get install openfoam-dev-1.5

In order to get OpenFOAM running, add the following line to your ~/.bashrc

 alias startOF15dev="source /usr/lib/OpenFOAM-1.5-dev/etc/bashrc"

And each time you want to use OpenFOAM just type startOF15dev in the active terminal.

1.2.3.3 Debian

You can check, if you can install the openfoam binaries, like with Ubuntu Intrepid 8.10. If this not applies, e.g. due to dependency problems, then you have to add the following line to the /etc/apt/sources.list

 deb-src http://ppa.launchpad.net/cae-team/ppa/ubuntu intrepid main

Update you repository list

 
sudo apt-get update

After adding this line, you have to compile the debian source package of openfoam and/or paraview at your own by typing

 
apt-get -b source openfoam

and/or

 
apt-get -b source openfoam-dev-1.5

and/or

 
apt-get -b source parafoam

For further information about debian source packages, follow these guidlines.

In order to get OpenFOAM running, add the following line to your ~/.bashrc

 alias startOF15="source /usr/lib/OpenFOAM-1.5/etc/bashrc"

And each time you want to use OpenFOAM just type startOF15 in the active terminal.

2 Paraview and paraFoam

2.1 Troubleshooting paraFoam

Valid versions: OF version 15.png

If you have problems with paraFoam and the dev version you might have to recompile paraFoam (see http://www.opencfd.co.uk/openfoam/doc/README.html#Paraview). If paraFoam loads, but doesn't know which reader to use to display your OpenFoam results, recompiling the PV3FoamReader should suffice.

To do so, first make sure the environment variable $ParaView_INST_DIR contains the correct path (in my version of OF-1.5-dev there was a typo, a wrong "-"). If not, correct it in ~/OpenFOAM/OpenFOAM-1.5-dev/etc/apps/paraview3/bashrc and re-source ~/.bashrc. Then proceed with ./Allwclean and ./Allwmake in ~/OpenFOAM/OpenFOAM-1.5-dev/applications/utilities/postProcessing/graphics/PV3FoamReader.