summary of openfoam installation faq Error: ‘yywrap’ when compiling OpenFOAM-3.0.0 Error: ‘parent directory does not allow write permission’ when compiling Thirdparty Install PyFoam

A summary of FAQ that I met when installing OpenFOAM and third parties is made here.

1. Degrade the version of gcc (gcc-4.8 is used for example)

Firstly, install gcc-4.8 with the command:

1
$ sudo apt-get install gcc-4.8

Secondly, set the default gcc version:

1
2
3
4
5
6
7
8
9
10
$ gcc --version 
# view the current gcc version

$ ls /usr/bin/gcc*
# view the gcc versions that we have

$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100
# Raise the priority of gcc-4.8 to 100

$ sudo update-alternatives --config gcc

That’s all. We can type in gcc --version again to make sure the version of gcc is degraded.

2. Degrade the version of g++

Just refer to the method of degrading gcc and replace all the ‘gcc’ with ‘g++’.

3. Degrade the version of flex (found necessary in OpenFOAM-3.0.0)

Type in the command:

1
$ sudo apt-get install flex-old

4. Install OpenFOAM with normal process

Methods of installing OpenFOAM by compilation can be found in OpenFOAM-Wiki

Error: ‘yywrap’ when compiling OpenFOAM-3.0.0

It is mainly the problem of the version of flex, try degrading flex with the command:

1
$ sudo apt-get install flex-old

Error: ‘parent directory does not allow write permission’ when compiling Thirdparty

It is the problem of access permission, just upgrade the privilege by:

1
2
sudo chown -R $(id-un):$(id-gn) $WM_PROJECT_USER_DIR
echo $WM_PROJECT_USER_DIR

Install PyFoam

1. Install the python-numpy

Type in the following command:

1
$ sudo apt-get install python-numpy

2. Download the up-to-date version of PyFoam

It can be found in OpenFOAM-Wiki

3. Final installation

Open the PyFoam folder and type in the command:

1
sudo python setup.py install