CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Installation (
-   -   OpenFOAM-1.6 installation script !! (

sayed November 19, 2009 05:36

OpenFOAM-1.6 installation script !!
hello people

i'm new in the world of simulation ,, i have chose openfoam cause it is opensource and it is completely free , i'm also new in the world of linux :D ,,
i use mandriva 2010 on my computer ,, and i tried to install OpenFOAM many times , i really lose much time :confused: , and i can't install the software cause it may want an expert in linux ,, so i wish some expert in linux and in openfoam write installation script to be excited using bash shell directly ,, for the beginners users like me (i think it is a common problem)

thank you very much ..

wyldckat November 20, 2009 07:24

Greetings sayed,

If you can change from Mandriva 2010 to Ubuntu 9.04, then you have two scripts available here. If you can't change, use that script as a reference!

Best regards,

fs82 November 20, 2009 07:46

If you just want to perform some calculations with OpenFoam download the Binary Packs for your plattform (linux 32bit or linux64bit) and enjoy. Read the documentation carefully because after downloading and unpacking there are some steps necessary to add OpenFoam to your system environment.
If you download the Source Packs for OpenFoam there is a script called Allwmake. But this is all documented in the documentation.
And by the way ... a basic linux knowlege is always neccesary. Even if there are scripts which helps you with the installation and even if they might work without any problems, for using OpenFoam you must be used to Linux basics. Have a look here, this is for my opinion a very nice introduction:

kind regards,

sayed November 20, 2009 11:57

thanks Bruno ,,

it seem that i have to download Ubuntu 9.04 and install it even if it may take much time to download 4.5 GB ,, it may be the only solution until now !


sayed November 20, 2009 13:41

hey Fabian ,

thanks for your advices and for the book

i really tried to learn some shell commands , i tried to use this commands as the README file says , i will say what i did exactilly in steps :

1) i make a new directory i called it "OpenFOAM" in that location "/root"

2) using the command tar i extract both "OpenFOAM-1.6.General.gtgz" and "ThirdParty-1.6.General.gtgz" on "OpenFOAM" ,, i now have on my "/root/OpenFOAM" two other directorys "OpenFOAM-1.6" and "ThirdParty-1.6"

3) because i don't have ".bashrc" on the home directory i just copy the ".bashrc" which is on "/root" directory into "/home" directory ,, and i opened it using vi editor and i added that statement "/root/OpenFOAM/OpenFOAM-1.6/etc/bashrc" on the last line .

4) i sourced the "/home/.bashrc" file using the command
"source /home/.bashrc"

5) i got that on the screen

[root@localhost home]# source .bashrc
bash: TMOUT: readonly variable

Warning in /root/OpenFOAM/OpenFOAM-1.6/etc/
Cannot find /root/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/linux installation.
Please install this compiler version or if you wish to use the system compiler,
change the 'compilerInstall' setting to 'System' in this file

that is all ,, any one have away to fix this nightmare problem may i have problem , may i do something wrong , or may be i must install some other packages

in windows i just take 5 min to install the most largest software
just next next , blah blah blah :D

and i'm now in linux spend 7 days to install openfoam and i failed till
now !

thanks every body

suitup November 20, 2009 14:54

why dont you use mads cookbook?

its quite easy with it, i just had some problems with it under ubuntu.
so i tried it under opensuse by manuell installing the libs with yast and got it working.

good luck

wyldckat November 20, 2009 20:52

T'is the season...
1 Attachment(s)
Hello Sayed,

That error message indicated that you should edit "OpenFOAM/OpenFOAM-1.6/" and change OpenFOAM to System...

But since it would just lead you to reach another stand still, well, I decided to take the Man-driven Linux... pardon, Mandriva Linux for a spin. So here is an early Christmas gift (or favorite gift giving season) :) over a month early. Attached to this post is mads cookbook with a little tweaking of my own, to get it running in Mandriva 2010 32bit.

I tweaked it to Mandriva's gurmpi instead of Ubuntu's apt-get. It now uses Mandriva's gcc-4.4.1 and Paraview and OpenMPI comes already built, as the cookbook script already defined it, so it's one less hassle of a build tour. Oh, and it sets the multi-processor variable to use the maximum number of cores possible in your machine ;) So, if you've got dual, triple, quad or even octopus core, it'll build in no time ;)

NOTE: You don't need to use the root account to run this. Just run it in your normal user account.

Download and unpack and run with:

tar -xzf installOF.tar.gz

And the rest will be done for you. Well, actually, it'll still ask you if you want to install a list of things, necessary to build OpenFOAM. I advise you to read the script, before actually running it, so you can learn a few things ;)

Just to give you a head's up: the function patchItUp changes the files bashrc and to: use 32bit and maximum number of cores; and use the Mandriva's gcc-4.4.1 ("System" in

Just a final note... I haven't finish building OpenFOAM with this script, so I still don't know if all goes well.

Oh, and if you want to know how your OpenFOAM is coming along during the build, open a new terminal and do:

cd ~/OpenFOAM/OpenFOAM-1.6
tail -f make.log

This way you can see what is going on during the process. Ctrl+C will break the tailing, but not the building process.

Best Regards,

sayed November 21, 2009 02:33

thanks Bruno for your kindly help ,, i did run your scipt on my mandriva 2010 , and it donlowd the packages and do a good stuff ,, but a problem occur and i don't think the installation happened, scince it may takes 3 hours :) , i got this message :

Compiling OpenFOAM...output is in make.log
Checking installation - you should see NO criticals...
Executing homesayedghribOpenFOAMOpenFOAM-1.6.xbinfoamInstallationTest

Checking basic setup...
Shell bash
Host localhost
OS Linux version

Checking main OpenFOAM env variables...
Environment_variable Set_to_file_or_directory Valid Crit
$WM_PROJECT_INST_DIR homesayedghribOpenFOAM yes yes
$WM_PROJECT_USER_DIR ...sayedghribOpenFOAMsayedghrib-1.6.x no no
$WM_THIRD_PARTY_DIR ...sayedghribOpenFOAMThirdParty-1.6.x yes yes

Checking the OpenFOAM env variables set on the PATH...
Environment_variable Set_to_file_or_directory Valid Path Crit
$WM_PROJECT_DIR homesayedghribOpenFOAMOpenFOAM-1.6.x yes yes yes

$FOAM_APPBIN ...1.6.xapplicationsbinlinuxGccDPOpt no yes
$FOAM_SITE_APPBIN ...penFOAMsite1.6.xbinlinuxGccDPOpt no no
$FOAM_USER_APPBIN ...1.6.xapplicationsbinlinuxGccDPOpt no no
$WM_DIR ...dghribOpenFOAMOpenFOAM-1.6.xwmake yes yes yes

Checking the OpenFOAM env variables set on the LD_LIBRARY_PATH...
Environment_variable Set_to_file_or_directory Valid Path Crit
$FOAM_LIBBIN ...OAMOpenFOAM-1.6.xliblinuxGccDPOpt no yes
$FOAM_SITE_LIBBIN ...penFOAMsite1.6.xliblinuxGccDPOpt no no
$FOAM_USER_LIBBIN ...Msayedghrib-1.6.xliblinuxGccDPOpt no no
$MPI_ARCH_PATH ...penmpi-1.3.3platformslinuxGccDPOpt yes yes yes

Third party software
Software Version Location
WARNING gcc version does not match gcc supplied with this release of OpenFOAM
Supplied version 4.3.3
User version
Minimum required 4.3.1

WARNING Conflicting installations
OpenFOAM settings bingcc
current path

gzip 1.3.12 usrbingzip
tar 1.22 bintar
WARNING Conflicting installations
OpenFOAM settings homesayedghribOpenFOAMOpenFOAM-1.6.xapplicationsbinlinuxGccDPOpticoFoam
current path


Base configuration ok.

The foam installation contains 2 critical error(s).

Review the output for warning messages and consult
the installation guide for trouble shooting.



sayed November 21, 2009 03:51

by the way , can you tell me which linux i should install for perfect performance of openfoam , and have all packages that it needs ,, i see that almost no one here use mandriva ,, so i must change ?

i completed download of Open Suse 11.2 is it fit the bill ?

i'm now downloading Ubuntu 9.04 it is now 1% it may take 1 day for complete downloading

and i'm ready to download any edition of linux that recommended for openfoam ,, i'm really want to began my real simulation issues (mathematical and numerical solutions of NSE's , and put my geometry boundary conditions ... etc ) i want to began fun :) cause i lost much time



wyldckat November 21, 2009 06:27

1 Attachment(s)
Hello Sayed,

You have CD versions of ubuntu 9.04 here, so you won't need to download the whole DVD.
OpenSUSE should be ok too.

As for the script, like I said, I hadn't yet run it to the end. I finally did, and it's still missing a few miserable packages.

The attached file is the same script, with the missing packages included.
The script is missing something that can only be done with the root account... login to your root account, and do:

ln -s /usr/bin/gcc /bin/gcc
ln -s /usr/bin/c++ /bin/c++

This will do simbolic links of gcc and c++, so OpenFOAM can use them.

Now, to salvage the build already done so far, do this:
  1. Logout root account, and do:

    gurpmi libbinutils2-devel libxrandr2-devel libxcursor-devel libxinerama1-devel
    This installs the missing packages.
  2. No finally do:

    ./Allwmake >make2.log 2>&1

You can tail the make2.log file.

If at the end of foamInstallationTest you get one critical error, and it is this:

gcc      4.4.1
WARNING:  Conflicting installations:
          OpenFOAM settings        : /bin/gcc
          current path            : /usr/bin/gcc

Then you're safe, because there is now a simbolic linking the two :).

Now try following the User guide available online or the local one "OpenFOAM-1.6.x/doc/Guides-a4/UserGuide.pdf".

I hope that solves it. At least for me it did the trick.

Best regards,

sayed November 21, 2009 07:33

hi bruno

i got that message

urpmi database is locked, process 6224 is already using it (/usr/bin/perl /usr/sbin/urpmi.update Non-free Backports)

when i typed that command

gurpmi libbinutils2-devel libxrandr2-devel libxcursor-devel libxinerama1-devel

it firist asked me if i want to install those packages ,, then asked for the root password ,, that is in a user graphical interface

i tried to kill the so called process 6224 by using the command "kill 6224"

then retype the command ,, it give me the same error but with a different process number ! " like it plays with me " :d

wyldckat November 21, 2009 08:40


urpmi database is locked, process 6224 is already using it (/usr/bin/perl /usr/sbin/urpmi.update Non-free Backports)
Arg... I hate when that happens... the system must be updating at that time.

Try using the graphical user interface "Install & Remove Software", and on that new window, to the left of the search box, set both dropdowns to "All". Then search for each of the packages I told on the last post, and pick them and Apply when you've picked the ones I said. This graphical interface might be able to get priorities to install the packages!

sayed November 21, 2009 09:50

i'm now on Open Suse 11.2 ,, what script should i use now

Open Suse 11.2 is excelent ,, mandriva makes me sick , really a very big difference

fs82 November 21, 2009 15:44

Oh man what the hell are you doing ;) It is not like windows, just clicking next, next, next and so on. By the way, clicking next until a loadbar apears isnt the right way to install software under windows.

1) For my opinion the Linux version is equal. Use the one you like. The most popular is Suse and Ubuntu.

2) Understand the difference between a root and a user. The system administrator is root and nobody could access anything which is owned by root until he enters a passwort. So if you install OpenFoam as root und put it into the root/ directory you will never have access to it as a user. This is quite different to windows were most people work als system administor and could access anything to anytime.

3) Go to the OpenFoam page and download the Binary Packs for OpenFoam and Thirdparty. I assume you have a 64bit system so you have to choose "Linux 64bits" as plattform. Download them and remember the path where you have downloaded them.

4) Open a terminal. If you have Suse click on the green Button in you task bar and look for system or something like this. If you have opened a terminal you should be in your home. Type: "mkdir Source" This will create a Source directory. Again type "mkdir Source/OpenFoam" and this will create a new directory called OpenFoam. Then copy the downloaded files to this OpenFoam directory ("cp <path to your download files> ~/Source/OpenFoam").

5) Go into your Source/OpenFoam directory ("cd Source/OpenFoam") and type "tar -xzf OpenFOAM-1.6.linux64GccDPOpt.gtgz" and "tar -xzf ThirdParty-1.6.linux64Gcc.gtgz" This will unpack your OpenFoam. This will take a while.

6) type "cd" to go back to your home directory. I hope you have installed an editor. I would not recommend "vi" for beginners but e.g. "kate" is very nice and easy to install (use yast2 if you use Suse oder synaptic if you use Ubuntu to install). type "kate .bashrc" (note the dot in front of bashrc this is important!) to your terminal and kate will inform you that he will create a new file. Just enter the following line to your new .bashrc:

. $HOME/Source/OpenFoam/OpenFOAM-1.6/etc/bashrc

and close the file. Type "bash" and try e.g. "channelFoam".

If you get an error somewhere post the steps you have performed successfully and the error message.


sayed November 21, 2009 16:44

hey Fabian ,, i did what you say and i got this message

sayedghrib@linux-kxey:~> bash

Warning in /home/sayedghrib/OpenFOAM/OpenFOAM-1.6/etc/
Cannot find /home/sayedghrib/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/linux installation.
Please install this compiler version or if you wish to use the system compiler,
change the 'compilerInstall' setting to 'System' in this file


wyldckat November 21, 2009 17:29

Hello Sayed,


Originally Posted by sayed (Post 237188)

Warning in /home/sayedghrib/OpenFOAM/OpenFOAM-1.6/etc/
Cannot find /home/sayedghrib/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/linux installation.
Please install this compiler version or if you wish to use the system compiler,
change the 'compilerInstall' setting to 'System' in this file

You now have two choices:
  1. Build gcc-4.3.3, by doing:

    ./makeGcc gcc-4.3.3

    And wait a while.
  2. OR Edit "/home/sayedghrib/OpenFOAM/OpenFOAM-1.6/etc/", go to the line that says "compilerInstall=OpenFOAM" and change to "compilerInstall=System". Now start a new terminal.
And voilá, depending on your choice, you now have either gcc-4.3.3 up and running, OR you have openSUSE 11.2's gcc-4.4.1 (I think), for compiling OpenFOAM.

By the way, there is already a few posts about installing OpenFOAM in openSUSE 11.2! Use the search link in this forum ;)

Best regards,

fs82 November 22, 2009 07:17

I am sorry I think I know the error. Editing or compailing wouldn't help. It is my fault, because the environment variable FOAM_INST_DIR is wrong. Depending on this variable OpenFoam knows were it its installed and where he have to look for files. So please go back to your .bashrc (type "kate ~/.bashrc) and remove the line:

. $HOME/Source/OpenFoam/OpenFOAM-1.6/etc/bashrc

If you have done so please enter this lines:

export FOAM_INST_DIR=$HOME/Source/OpenFoam
. $foamDotFile

save and close kate and type "bash" in your terminal. Do you still get errors please let me know :-D


sayed November 25, 2009 10:14

hey guys ,

i compiled openfoam successfully after dayes of tries
thank you Bruno and Fabian for your help and replies

i have question ,, is it not easy to learn simulation using openfoam and how long to be professional in it , also how can i start to explore the program and check the examples

fs82 November 25, 2009 10:20

Allright sounds good. But you didnt compile OpenFoam. If you have done it my way, you only installed a binary package which is allready compiled. What you have done is to tell your SUSE where it could find the new program. If you want to compile it you have to download the source pack and type ./Allwmake in your OpenFoam directory. But this is much more complicated and I would recommend to start with the tutorials and lean about using Openfoam and working with linux and if you gain some experience try it out to compile the whole openfoam package. So read the documentation and try out some tutorials this is the way to start.


wyldckat November 25, 2009 10:27

Hello Sayed,

On this thread, you have some pointers on what to do to learn how to use OpenFOAM. On this post, you have a few books about CFD that might be of some help. And here, you have a list of the official documents that OpenCFD has about OpenFOAM :) So, for starters, follow the user guide!

If you have other questions about some cases, try using this forum's search function, because there are already many answers to usual questions ;)

Best regards,

All times are GMT -4. The time now is 01:42.