OpenFOAM on Your Own Laptop

The teaching is designed so that you should follow the steps I do on a computer. This means that it is highly recommended that you bring your own laptop prepared for one alternative of running OpenFOAM. Below are the alternatives. Please contact me if you run into problems, and hopefully I will be able to help out. Note that there is no time to do any of this when the course has started, so everything must be done before the start of the course. The recommended steps have been marked red. The Linux commands are written for bash shell. The only difference to make it work in tcsh shell is to everywhere change “2>&1 | tee” to “|& tee” (this means that standard output and standard error, i.e. the text that usually ends up in the terminal window, are sent both to the terminal window and the file specified after “tee”. The terminal window then still works as usual, but you can also go back and check if everything went well, by examining that log file.)

1.      Make sure that you have Linux and if possible also OpenFOAM-1.7.x and OpenFOAM-1.5-dev installed. This is the best alternative, since you will the have a fully working Linux and OpenFOAM installation to continue with after the course. It is recommended to use Ubuntu 10.04 LTS, which is the most recent version (and the procedures below have been tested for it). If you have another Linux version and have problems installing OpenFOAM, you can easily use the OpenFOAM installations at Chalmers through ssh, described below.
Here are two alternatives of installing Ubuntu, the first one being the original way, from a CD or usb stick, and the second one being an alternative of installing it from within Windows.

                                 i.            See http://www.ubuntu.com/ for download and installation instructions. Note that when installing Ubuntu you can choose to make a new disk partition for Ubuntu, so that you don't touch your other operating system installation. Then you will be able to boot your laptop both in Ubuntu mode and in the other operating system mode.

                               ii.            Use the Wubi installer at http://wubi-installer.org/. The complete installation is then run from Windows, and the boot procedure will be taken care of by the windows booter rather than the system booter. A new partition is automatically generated (which can be modified if desired). The Ubuntu installation can be removed using the control panel.

Boot Ubuntu. First of all you should add some packages that are needed. Type in a terminal window:

sudo apt-get install gcc flex binutils-dev

(gcc and flex are used during compilation, and a typical problem while compiling OpenFOAM without binutils-dev is: “/usr/bin/ld: cannot find -liberty”)

NOTE: it seems like it is best to first install the 1.6.x version using the script below, since then some needed packages are installed. It might help to do the following if you did not yet install OpenFOAM-1.6.x (I will check exactly which packages are really needed when I have the time some time in the future):

sudo apt-get install cmake g++ flex++ bison python qt4-designer binutils-dev zlib1g-dev

With Ubuntu 10.04 LTS installed, it is time to install OpenFOAM. A good reference for this is http://openfoamwiki.net/index.php/Installation. We will be using different versions of OpenFOAM, and below are some instructions for installing those in Ubuntu 10.04 LTS.

                                 i.            OpenFOAM-1.7 versions
Your system will need to include a recent version of gcc (check with gcc --version, we recommend gcc-4.4.? but gcc-4.3.? is sufficient). If the installed version is not recent source pack for newer versions are available from http://gcc.gnu.org/. To build OpenFOAM you will also need the flex software installed on your system. If that is missing (type flex --version to check), then install it. Installation of Paraview 3.8.0 requires a version of QT that is 3.5.? or newer and cmake which is 2.6.4 or newer.

a.       OpenFOAM-1.7.0 (Ubuntu/Debian pack installation): Follow the instructions at http://www.openfoam.com/download/ubuntu.php. With this alternative, the code will be installed in /opt/openfoam170 rather than in your home directory, and it should be possible to upgrade the installation using the usual updating procedures in Ubuntu.

b.      OpenFOAM-1.7.0 (Source Pack installation with binaries, but without bug fixes): Follow the instructions at http://www.openfoam.com/download/source.php. It is recommended to install the code in $HOME/OpenFOAM. The sequence of commands in a Linux terminal window is:

mkdir $HOME/OpenFOAM
cd $HOME/OpenFOAM
wget http://downloads.sourceforge.net/project/foam/foam/1.7.0/OpenFOAM-1.7.0.gtgz?r=http%3A%2F%2Fwww.openfoam.com%2Fdownload%2Fsource.php&ts=1281596038&mirror=fastbull
wget http://downloads.sourceforge.net/project/foam/foam/1.7.0/ThirdParty-1.7.0.gtgz?r=http%3A%2F%2Fwww.openfoam.com%2Fdownload%2Fsource.php&ts=1281595933&mirror=ignum
tar xzf OpenFOAM-1.7.0.gtgz
tar xzf ThirdParty-1.7.0.gtgz

Then follow the “Setting environment variables” section of the above homepage to make the system aware of your installation.

c.       OpenFOAM-1.7.x (Git repository, without binaries, but with bug fixes – this is the recommended alternative if you want to use the 1.7 version): Follow the instructions at http://www.openfoam.com/download/git.php. It will require that you compile the whole source code, which will take several hours. The sequence of commands in a terminal window is:

mkdir $HOME/OpenFOAM
cd $HOME/OpenFOAM
git clone git://github.com/OpenCFD/OpenFOAM-1.7.x.git
wget http://downloads.sourceforge.net/project/foam/foam/1.7.0/ThirdParty-1.7.0.gtgz?r=http%3A%2F%2Fwww.openfoam.com%2Fdownload%2Fgit.php&ts=1281679549&mirror=switch
tar xzf ThirdParty-1.7.0.gtgz
rm ThirdParty-1.7.0.gtgz
mv ThirdParty-1.7.0 ThirdParty-1.7.x
echo 'alias OF17x=". $HOME/OpenFOAM/OpenFOAM-1.7.x/etc/bashrc"' >> ~/.bashrc

Then open a new terminal window and continue working in that with the following commands:

OF17x
foam
./Allwmake 2>&1 | tee log_Allwmake

The compilation will take something in the order of four hours.
Now we also have to install Paraview 3.8.0 and the PV3FoamReader module, which requires qt to be installed:

cd $HOME/OpenFOAM/ThirdParty-1.7.x
mkdir qt-everywhere-opensource-src-4.6.3
mkdir linuxSrc; cd linuxSrc
wget http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.3.tar.gz
tar xzf qt-everywhere-opensource-src-4.6.3.tar.gz
cd qt-everywhere-opensource-src-4.6.3
./configure -prefix $HOME/OpenFOAM/ThirdParty-1.7.x/qt-everywhere-opensource-src-4.6.3 -opensource -stl 2>&1 | tee log_configure

(-stl might be needed for the GUI. It SHOULD have been activated by default, but there is a problem)
#(choose OpenSource editon and accept conditions)
make 2>&1 | tee log_make #Check this file for error messages! This takes several hours!
make install 2>&1 | tee log_make_install #Check this file for error messages!

Add the following to the end of your $HOME/OpenFOAM/OpenFOAM-1.7.x/etc/apps/paraview3/bashrc file:

export PATH=$WM_THIRD_PARTY_DIR/qt-everywhere-opensource-src-4.6.3/bin:$PATH
export LD_LIBRARY_PATH=$WM_THIRD_PARTY_DIR/qt-everywhere-opensource-src-4.6.3/lib:$LD_LIBRARY_PATH

Open a new terminal window and type:

OF17x

Finally its time for the compilation of Paraview and the PV3FoamReader module:

cd $WM_THIRD_PARTY_DIR
./Allclean
./makeParaView 2>&1 | tee log_makeParaView
cd $FOAM_UTILITIES/postProcessing/graphics/PV3FoamReader
./Allwclean
./Allwmake 2>&1 | tee log_Allwmake

Time to test:

mkdir -p $FOAM_RUN
cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity $FOAM_RUN
cd $FOAM_RUN/cavity
blockMesh
icoFoam
paraFoam

d.      OpenFOAM-1.7.x Debug version
The purpose of this is to be able to run OpenFOAM-1.7.x with a debugger.
This should work nicely if you have already managed to compile OpenFOAM-1.7.x…
Add a new alias to your ~/.bashrc file:
echo 'alias OF17xDebug="export WM_COMPILE_OPTION=Debug;. $HOME/OpenFOAM/OpenFOAM-1.7.x/etc/bashrc"' >> ~/.bashrc
Open a new terminal window and type:

OF17xDebug
Foam
./Allwmake 2>& | tee log_Allwmake_Debug

Wait some hours, and you are done!
Do the same procedure for all versions you need to debug.

                               ii.            OpenFOAM-1.6 versions:
There are two different 1.6 versions, 1.6 and 1.6.x.
The 1.6 version itself does not have bug-fixes, so only the installation of 1.6.x is here described.

a.       OpenFOAM-1.6.x: Follow the instructions at http://code.google.com/p/openfoam-ubuntu/. In summary, do the following steps in a Linux terminal window:

wget http://openfoam-ubuntu.googlecode.com/hg/installOF.sh
#(version 0.9 of that script is also available at http://www.tfd.chalmers.se/~hani/kurser/OS_CFD/installOF.sh)
chmod +x installOF.sh
./installOF.sh

Type “yes” at all questions and use the default values throughout the installation. It seems like there is a problem with the checking that the files have been downloaded correctly. If the script sais that there seems to be problems with the downloading of files, just answer “no” on the question if it should try and download it again. It is quite sure that the files have been downloaded correctly, it is just the test that is buggy.

                              iii.            OpenFOAM-1.5 versions:
There are three different 1.5 versions, 1.5, 1.5.x, and 1.5-dev. The 1.5 and 1.5.x versions are obsolete, but the 1.5-dev version is highly active and is being updated frequently. It contains lots of additional implementations compared to the other versions. Therefore only the installation of that version is here described

a.       OpenFOAM-1.5-dev (a community-contributed version with lots of useful implementations – this is the version I prefer)
First make sure to download the ThirdParty products:

cd $HOME/OpenFOAM
wget http://downloads.sourceforge.net/project/foam/foam/1.5/ThirdParty.General.gtgz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Ffoam%2Ffiles%2Ffoam%2F&ts=1281702594&mirror=kent
wget http://downloads.sourceforge.net/project/foam/foam/1.5/ThirdParty.linuxGcc.gtgz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Ffoam%2Ffiles%2Ffoam%2F&ts=1281702862&mirror=switch
tar xzf ThirdParty.General.gtgz
tar xzf ThirdParty.linuxGcc.gtgz
rm ThirdParty.General.gtgz
rm ThirdParty.linuxGcc.gtgz

Then get the version you are interested in

sudo apt-get install subversion
svn co https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Core/OpenFOAM-1.5-dev

OpenFOAM-1.5-dev is per default set up to run with the system compiler, which should be a recent one, at minimum gcc 4.3.1, but preferrably more recent. We are fine in Ubuntu 10.04, so add the following to your $HOME/.bashrc file:

echo 'alias OF15dev=". $HOME/OpenFOAM/OpenFOAM-1.5-dev/etc/bashrc"' >> ~/.bashrc

and then continue working in a new terminal window:

OF15dev
foam
./Allwmake 2>&1 | tee log_Allwmake


Originally it would now have been time for compiling Paraview and the PV3FoamReader module, but there seems to be some problem with this, that has been discussed in the forum. For compiling Paraview, one should use the buildParaView3.3-cvs script, but there are some pieces missing. Instead we will use the pre-compiled Paraview 3.8.0, which includes a new nice reader for OpenFOAM (the instructions for this has been taken from http://www.cfd-online.com/Forums/blogs/wyldckat/317-using-official-pre-built-paraview-3-8-0-version-openfoam.html):

rm -rf $ParaView_DIR
mkdir -p $ParaView_DIR
cd $ParaView_DIR

For i?86 (check if the command “uname –m” returns i686):

wget http://www.paraview.org/files/v3.8/ParaView-3.8.0-Linux-i686.tar.gz
tar xzf ParaView-3.8.0-Linux-i686.tar.gz
mv ParaView-3.8.0-Linux-i686/* .
rmdir ParaView-3.8.0-Linux-i686

For x86_64 (check if the command “uname –m” returns x86_64):

wget http://www.paraview.org/files/v3.8/ParaView-3.8.0-Linux-x86_64.tar.gz
tar xzf ParaView-3.8.0-Linux-x86_64.tar.gz
mv ParaView-3.8.0-Linux-x86_64/* .
rmdir ParaView-3.8.0-Linux-x86_64

Now open the file $HOME/OpenFOAM/OpenFOAM-1.5-dev/bin/paraFoam and change

#caseFile="$caseName.foam"
caseFile="$caseName.OpenFOAM"

to:

caseFile="$caseName.foam"
#caseFile="$caseName.OpenFOAM"

Two additional hints from the same page:
* If your Linux installation isn't English, then you better follow these instructions: In the same paraFoam file, add the following after the first block of comments:

export LC_ALL=C

* If you are having problems with rescaling data in Paraview, you might have tripped on a now known bug in ParaView 3.8.0. To get past this, read this post (and its thread): paraview 3.8 auto rescale doesn't work #6

Time to test. In a new terminal window, type:

OF15dev
mkdir -p $FOAM_RUN
cp -r $FOAM_TUTORIALS/icoFoam/cavity $FOAM_RUN
cd $FOAM_RUN/cavity
blockMesh
icoFoam
paraFoam

b.      OpenFOAM-dev-1.5 (this is a debian package of the 1.5-dev version): Follow the instructions at http://openfoamwiki.net/index.php/Installation#OpenFOAM-dev-1.5_under_Ubuntu_Lucid_10.04_LTS. (This gives you access to other nice software as well). Note that this only activates the binaries, so if you want to do development work in OpenFOAM, or to see the source code you must also activate the package named openfoam-dev-1.5-dev by typing:

sudo apt-get install openfoam-dev-1.5-dev

You can also activate the documentation by:

sudo apt-get install openfoam-dev-1.5-doc

The binaries and the source code will be located in /usr/lib/OpenFOAM-1.5-dev
The UserGuide and Programmers Guide will be in /usr/share/doc/openfoam-dev-1.5
The Doxygen documentation will be in /usr/share/doc/openfoam-dev-1.5-dev
Note that the aliases will not work with this installation.

 

                             iv.            PyFoam:
First, just to make sure that we have all the packages we will need later

sudo apt-get install python python-matplotlib python-numpy python-scipy

See http://openfoamwiki.net/index.php/Contrib_PyFoam
Installation instructions:

cd $HOME/OpenFOAM
mkdir linuxSrc; cd linuxSrc
svn co https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder/other/scripting/PyFoam/
cd PyFoam
python setup.py install --prefix=$HOME/OpenFOAM/PyFoam

Add the following lines to the end of your etc/apps/paraview3 file (for all your installed versions):

if [ "$PYTHONPATH" ]
then
    export PYTHONPATH=$FOAM_INST_DIR/PyFoam/lib/python2.6/site-packages:$PYTHONPATH
else
    export PYTHONPATH=$FOAM_INST_DIR/PyFoam/lib/python2.6/site-packages
fi
export PATH=$FOAM_INST_DIR/PyFoam/bin:$PATH

If you get a message “…No module named …” later, check if the Python version differs from the above in your installation, and change the lines above accordingly.

2.      Run OpenFOAM remotely using ssh. If you can’t or don't want to install Linux on your laptop, you should be able to install openssh (http://www.openssh.com/) or putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/) in combination with Cygwin/X, X-Win32, or Exceed, so that you can do an ssh to a Linux computer. Then you can run OpenFOAM remotely through our wireless network. I haven't set up this in Windows or Macintosh myself, so for that part you are on your own (in Linux it is extremely easy). Make sure that you are able to open a terminal window on the remote computer, and that you can open a graphical window on that computer (test by typing "xlogo" in the remote terminal window for instance). This is called "X11 forwarding", if you are searching for instructions on how to make it work. From a Linux machine you log in remotely to the student computers using either of (<CID> should be replaced by your Chalmers user name)

ssh –XY –l <CID> remote1.student.chalmers.se
ssh –XY –l <CID> remote2.student.chalmers.se
ssh –XY –l <CID> remote3.student.chalmers.se
ssh –XY –l <CID> remote4.student.chalmers.se
ssh –XY –l <CID> remote5.student.chalmers.se

Test that you can open a graphical window:

xlogo

do CTRL-C in the terminal window to kill the process.
Set up the environment for OpenFOAM by adding the following lines to the end of your $HOME/.bashrc file:

alias OF15dev='export FOAM_INST_DIR=/chalmers/sw/unsup64/OpenFOAM; . $FOAM_INST_DIR/OpenFOAM-1.5-dev/etc/bashrc'
alias OF16x='export FOAM_INST_DIR=/chalmers/sw/unsup64/OpenFOAM; . $FOAM_INST_DIR/OpenFOAM-1.6.x/etc/bashrc'
alias OF17x='export FOAM_INST_DIR=/chalmers/sw/unsup64/OpenFOAM;. $FOAM_INST_DIR/OpenFOAM-1.7.x/etc/bashrc'

When you are doing a remote login it is the .profile file that is sources, so we also make sure that everything is set up correctly when logging ing remotely, by making a soft link:

          ln –s $HOME/.bashrc $HOME/.profile

Now you just make a new ssh to get a new terminal window and you can activate one of the installed versions of OpenFOAM by typing OF15dev, OF16x, or OF17x. If you want to switch version it is recommended to make a new ssh to get a new terminal window and do the same procedure in that.

Time to test. In a new terminal window, type:

OF15dev
mkdir -p $FOAM_RUN
cp -r $FOAM_TUTORIALS/icoFoam/cavity $FOAM_RUN
cd $FOAM_RUN/cavity
blockMesh
icoFoam
paraFoam

3.      Run OpenFOAM from the 5th OpenFOAM Workshop USB stick. Make sure that you have a 4GB (minimum) USB stick. Make sure that you are allowed to boot your laptop from a USB stick. Go to http://sourceforge.net/projects/openfoam-extend/files/ and download OpenFOAM_kubuntu.tgz (direct link) Unpack it on the stick. Make it bootable: If you are running Linux, go to the boot directory on the stick, using a terminal window, and type "sudo ./bootinst.sh" (bootinst.bat in Windows). See further instructions at: http://www.cfd-online.com/Forums/openfoam-installation/76345-openfoam-dev-live-usb-dvd-based-kubuntu.html. With this alternative you will be running Ubuntu from the stick, so you will have full access to all the functionality in Linux. OpenFOAM-1.5-dev is then also installed. I have a few such sticks with OpenFOAM installed. If someone is interested, I think that it should be possible for you to buy one of those.

Additional information

Here is some additional information that might be useful.

Compilation of gcc-4.3.1 and using it to compile OpenFOAM-1.5-dev

If you don't have the correct version of gcc (4.3.1 or newer, see gcc.gnu.org), then do the following (for 32 bit, some minor changes are required for 64 bit, like linux64 instead of linux):

1.      Install gcc 4.3.1. This requires that either any version of cc or gcc are available already. It also requires that two libraries, mpfr and gmp, are available, which is the reason to the lengthy installation procedure below:

cd $HOME/OpenFOAM/ThirdParty
mkdir gmp-4.3.2
mkdir mpfr-2.3.2
mv gcc-4.3.1 gcc-4.3.1_orig; mkdir -p gcc-4.3.1/platforms/linux
mkdir linuxSrc; cd linuxSrc
wget ftp://ftp.gmplib.org/pub/gmp-4.3.2/gmp-4.3.2.tar.gz
tar xzf gmp-4.3.2.tar.gz
cd gmp-4.3.2
./configure --prefix=$HOME/OpenFOAM/ThirdParty/gmp-4.3.2 2>&1 | tee log_configure
make 2>&1 | tee log_make #Check this file for error messages!
make check 2>&1 | tee log_make_check #Check this file for error messages!
make install 2>&1 | tee log_make_install #Check this file for error messages!
cd ..
wget http://www.mpfr.org/mpfr-2.3.2/mpfr-2.3.2.tar.gz
tar xzf mpfr-2.3.2.tar.gz
cd mpfr-2.3.2
./configure --prefix=$HOME/OpenFOAM/ThirdParty/mpfr-2.3.2 --with-gmp=$HOME/OpenFOAM/ThirdParty/gmp-4.3.2 2>&1 | tee log_configure
make 2>&1 | tee log_make #Check this file for error messages!
make check 2>&1 | tee log_make_check #Check this file for error messages!
make install 2>&1 | tee log_make_install #Check this file for error messages!
cd ..
wget http://gcc-uk.internet.bs/releases/gcc-4.3.1/gcc-4.3.1.tar.gz
tar xzf gcc-4.3.1.tar.gz
cd gcc-4.3.1
make distclean #This is only necessary if gcc has been built before, but doesn't hurt
./configure --prefix=$HOME/OpenFOAM/ThirdParty/gcc-4.3.1/platforms/linux -enable-languages=c,c++ --with-gmp=$HOME/OpenFOAM/ThirdParty/gmp-4.3.2 --with-mpfr=$HOME/OpenFOAM/ThirdParty/mpfr-2.3.2 2>&1 | tee log_configure
make 2>&1 | tee log_make #Check this file for error messages!
make install 2>&1 | tee log_make_install #Check this file for error messages!

Before compiling OpenFOAM-1.5-dev we need to make sure that our freshly compiled gcc will be used, which is done by a change in $WM_PROJECT_DIR/etc/settings.h:
Change:

#compilerInstall=OpenFOAM
compilerInstall=System

to:

compilerInstall=OpenFOAM
#compilerInstall=System

Then open a new terminal window and do the following:

OF15dev
foam
./Allwmake 2>&1 | tee log_Allwmake

The compilation will take something in the order of four hours.

Problem with flex

If you get an error message saying something like: “error: no ‘int yyFlexLexer::ywrap()’ member function declared in class ‘yyFlexer’”, then that can be solved by compiling your own flex-2.5.35:

 

mkdir -p $WM_THIRD_PARTY_DIR/flex-2.5.35
cd $WM_THIRD_PARTY_DIR/linuxSrc
wget http://downloads.sourceforge.net/project/flex/flex/flex-2.5.35/flex-2.5.35.tar.gz?r=http%3A%2F%2Fflex.sourceforge.net%2F&ts=1282292981&mirror=garr
tar xzf flex-2.5.35.tar.gz
cd flex-2.5.35
./configure --prefix $WM_THIRD_PARTY_DIR/flex-2.5.35 2>&1 | tee log_configure
make 2>&1 | tee log_make
make install 2>&1 | tee log_make_install

Set in settings.sh:

export PATH=$WM_THIRD_PARTY_DIR/flex-2.5.35/bin:$PATH

For all the files that complained about flex, add in Make/options:
-I$(WM_THIRD_PARTY_DIR)/flex-2.5.35/include

Install VTK to make a GUI with a visualization window

Here I dump some preliminary information on how to install VTK in FoDAT

For some reason you need the tk_dev package in order to use Python wrap.

cd $HOME/OpenFOAM/linuxSrc

wget http://www.vtk.org/files/release/5.6/vtk-5.6.1.tar.gz

tar xzf vtk-5.6.1.tar.gz

cd ..

mkdir VTK-build

cd VTK-build

ccmake ../linuxSrc/VTK

In ccmake, press ‘c’ to configure, and ‘Enter’ to change values:

Make sure to set:

BUILD_SHARED_LIBS to ON

VTK_WRAP_PYTHON to ON

CMAKE_INSTALL_PREFIX to $HOME/OpenFOAM/VTK-build (or wherever you have put it)

Then press ‘c’ to configure again and ‘g’ to save the configuration and exit, and continue in the terminal window…

make

Before the next command it seems to be necessary to do “export PYTHONPATH=$FOAM_INST_DIR/VTK-build/lib/python2.4/site-packages”

make install

Then it failed since there was a directory missing. I just added it and run make install again.

Then set:

export LD_LIBRARY_PATH=/chalmers/sw/unsup64/OpenFOAM/VTK-build/bin:$FOAM_INST_DIR/VTK-build/lib/python2.4/site-packages/VTK-5.6.1-py2.4.egg/vtk:$FOAM_INST_DIR/VTK-build/lib/vtk-5.6:$LD_LIBRARY_PATH

export PYTHONPATH=/chalmers/sw/unsup64/OpenFOAM/VTK/Wrapping/Python:/chalmers/sw/unsup64/OpenFOAM/VTK-build/bin:$FOAM_INST_DIR/VTK-build/lib/python2.4/site-packages:$PYTHONPATH

i.e. note that the original VTK directory can not be removed. Don’t know why Wrapping is not installed to VTK-build.

Install PyQt4 to make a GUI

Here I dump some preliminary information on how to install PyQt4 in FoDAT:

First make sure that qt was installed in the same location as it is located, i.e. DON’T MOVE QT after it has been installed – it remembers the original path!

First source OpenFOAM and the available qt installation (see above for OF-1.7.x. Note: QMAKESPEC, below, should not be set before installing qt):

OF17x

Then install SIP:

cd $FOAM_INST_DIR

mkdir sip-4.11.2

cd $FOAM_INST_DIR/linuxSrc/sip-4.11.2

python configure.py –b $FOAM_INST_DIR/sip-4.11.2 –e $FOAM_INST_DIR/sip-4.11.2 –d $FOAM_INST_DIR/sip-4.11.2 –v $FOAM_INST_DIR/sip-4.11.2

Then install PyQt-x11-gpl-4.8.1:

cd $FOAM_INST_DIR/linuxSrc/PyQt-x11-gpl-4.8.1

export PYTHONPATH=$FOAM_INST_DIR/sip-4.11.2

export QTDIR=$FOAM_INST_DIR/ThirdParty-1.7.x/qt-everywhere-opensource-src-4.6.3

export QMAKESPEC=$QTDIR/mkspecs/linux-g++-64

python configure.py --verbose --confirm-license -b $FOAM_INST_DIR/PyQt-x11-gpl-4.8.1 -d $FOAM_INST_DIR/PyQt-x11-gpl-4.8.1

make

make install

The following is probably not needed:

export LD_LIBRARY_PATH=$FOAM_INST_DIR/PyQt-x11-gpl-4.8.1/PyQt:$LD_LIBRARY_PATH

The following IS needed:

export PYTHONPATH=$FOAM_INST_DIR/PyQt-x11-gpl-4.8.1:$PYTHONPATH

Qt documentation:

doc.qt.nokia.com