Vous êtes sur la page 1sur 5


2 OpenCFD binaries
Valid versions: OF version 16.png
Installing OpenFOAM from binary files is very good if you are a first time user. You
can quickly install the software with minimal complications. The process consists of
five simple steps:
1. Download the binary files
2. Unpack the binary files to your home directory
3. Add environmental variables
4. Test the installation
5. Getting Started
This assumes that you will be installing openFOAM in your home directory. There are
many possible variations on this installation procedure (for example, you don't need to
install to your home directory.) But you should probably go with the simplest method
first time around.

1.2.1 Download the Binary Files

These files are all compiled and ready to go. All you have to do is download them. Go
to: http://www.opencfd.co.uk/openfoam/download.html
1. At the top of the page is a pull down menu. Select whether you want binaries
for Linux 32 bit or Linux 64 bit.
2. Create a directory in your home directory. Open up a console window and type
the following in at the command line:
mkdir $HOME/OpenFOAM

1. Download the following files into this directory. These will install the
compiled binary files, the source code, documentation, example files,
necessary supporting libraries, etc. Everything you would expect in a program.
It just comes in four separate packages
1. OpenFOAM-1.6.General.gtgz
2. OpenFOAM-1.6.linux64GccDPOpt.gtgz
3. ThirdParty-1.6.General.gtgz
4. ThirdParty-1.6.linux64Gcc.gtgz

1.2.2 Unpack the Binary Files

You have downloaded all four files. Now unpack all the files to the same OpenFOAM
directory that you created before. That is the $HOME/OpenFOAM directory. Use
whatever tool you prefer to unpack the files. I prefer to use a graphical interface that
does the work for me. You can also use the command line by typing



Congratulations. You now have the binary files unpacked. That was most of the work.
Next, you just need to add the environmental variables.

1.2.3 Environmental Variables

The environmental variables will allow the linux system to understand the various
OpenFOAM commands. Fortunately, you don't need to add the environmental
variables. All you need to do is add one line which will point the system to a file in
OpenFOAM that has all the environmental variables.
The environment variable settings for openFOAM are contained in files in an etc/
directory in the OpenFOAM release. e.g. in $HOME/OpenFOAM/OpenFOAM1.6/etc/
EITHER if running bash or ksh, source the etc/bashrc file by adding the following
line to the end of your $HOME/.bashrc file:
. $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc

Then update the environment variables by sourcing the $HOME/.bashrc file by typing
in the terminal:
. $HOME/.bashrc

Notice the periods at the beginning of the line and before the .bashrc filename.
OR if running tcsh or csh, source the etc/cshrc file by adding the following line to the
end of your $HOME/.cshrc file:
source $HOME/OpenFOAM/OpenFOAM-1.6/etc/cshrc

Then update the environment variables by sourcing the $HOME/.cshrc file by typing
in the terminal:
source $HOME/.cshrc

Note If you are in doubt about which shell you are running, type:
echo $SHELL

You will know you have done it correctly if you don't get any return from the
command line when you source your .bashrc file. See this example:
> . $HOME/.bashrc

1.2.4 Test the Installation

To check your installation setup, execute the foamInstallationTest script (in the bin/
directory of the OpenFOAM installation). If no problems are reported, proceed to
getting started with OpenFOAM; otherwise, go back and check you have installed the
software correctly and/or contact your system administrator. Type the following code
in the command line to navigate to the location of the foamInstallationTest script and
execute it:
> cd ~/OpenFOAM/OpenFOAM-1.4.1/bin
> foamInstallationTest

That will execute the script. A successful test will produce output that looks like this:
Checking basic setup...
Linux version
-----------------------------------------------------------------------------Checking main OpenFOAM env variables...
-----------------------------------------------------------------------------Environment_variable Set_to_file_or_directory
-----------------------------------------------------------------------------$WM_PROJECT_INST_DIR /home/nicholas/OpenFOAM
$WM_PROJECT_USER_DIR /home/nicholas/OpenFOAM/nicholas-1.6
$WM_THIRD_PARTY_DIR /home/nicholas/OpenFOAM/ThirdParty-1.6
-----------------------------------------------------------------------------Checking the OpenFOAM env variables set on the PATH...
-----------------------------------------------------------------------------Environment_variable Set_to_file_or_directory
Path Crit
yes yes

...1.6/applications/bin/linux64GccDPOpt yes
yes yes
...penFOAM/site/1.6/bin/linux64GccDPOpt no
...1.6/applications/bin/linux64GccDPOpt no
...nicholas/OpenFOAM/OpenFOAM-1.6/wmake yes
yes yes
-----------------------------------------------------------------------------Checking the OpenFOAM env variables set on the LD_LIBRARY_PATH...
-----------------------------------------------------------------------------Environment_variable Set_to_file_or_directory
Path Crit
...OAM/OpenFOAM-1.6/lib/linux64GccDPOpt yes
yes yes
...penFOAM/site/1.6/lib/linux64GccDPOpt no
...OAM/nicholas-1.6/lib/linux64GccDPOpt no
...nmpi-1.3.3/platforms/linux64GccDPOpt yes
yes yes
-----------------------------------------------------------------------------Third party software
-----------------------------------------------------------------------------Software Version
icoFoam 1.6
-----------------------------------------------------------------------------Base configuration ok.
Critical systems ok.

The important part are the last lines which state the basic configuration and critical
systems are both good. If these two lines do not say OK, you need to look through the
details of the test results to see what went wrong.

If these two lines do say OK, congratulations! You have successfully installed
OpenFOAM. The last step is to setup the files for using OpenFOAM and run a simple
test case.

1.2.5 Getting Started

We will setup a project directory that all subsequent projects can be run from. And
then we will run a simple test case to ensure everything works. Create a project
directory within the $HOME/OpenFOAM directory named $LOGNAME-1.6 (e.g.
chris-1.6 for user chris and OpenFOAM version 1.6)
>cd $HOME/OpenFOAM
>mkdir $LOGNAME-1.6

and create a directory named run within it, e.g. by typing:

mkdir -p $FOAM_RUN/run

Copy the tutorial examples directory in the OpenFOAM distribution to the run
directory. If the OpenFOAM environment variables are set correctly, then the
following command will be correct:
cp -r $WM_PROJECT_DIR/tutorials $FOAM_RUN

Run the first example case of incompressible laminar flow in a cavity. Type the
following into the command line:
>cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity

Your screen should look like this

When you have executed all four commands, the paraview post-processor should
It doesn't look like much, but notice the bottom left corner. The list for Mesh Parts
has four items in it. And the list for Volume Fields has two items in it. This tells you
that paraview successfully read the data file. You can now happily use OpenFOAM.