Installation instructions, FOAM-extend 4.0 and 4.1, in Ubuntu 19 and 20

From OpenFOAMWiki

Hi,

It seems like you have been active writing installation instructions for FOAM-extend: https://openfoamwiki.net/index.php/Installation/Linux/foam-extend-4.1/Ubuntu

I just installed FOAM-extend-4.1 branch nextRelease in Ubuntu 20.04. I did not follow your instructions completely, and I wonder about the reason for some instructions. My installation seems to wok, but perhaps there is something I need to know.

I did not install the exact list of Ubuntu packages as you list. Are all of those really needed? Here is the list I used, after testing what I needed, including some description of what they are needed for:

Needed for the download and compilation procedure:

sudo apt-get -y install git #To clone the repository.
sudo apt-get -y install rpm #Package manager, to download third-party source code
sudo apt-get -y install curl #For file transfer, to download third-party source code
sudo apt-get -y install flex #For file conversions, e.g. readSTLASCII, chemkinLexer, ansysToFoam, fluent3DMeshToElmer, ...
sudo apt-get -y install mercurial #Alternative to git, for swak4Foam (etc.?)
sudo apt-get -y install cmake #For metis, parmetis (etc.?)
sudo apt-get -y install build-essential #gcc, g++, make, package management tools
sudo apt-get -y install bison #For swak4Foam (etc.?)
sudo apt-get -y install zlib1g-dev #For gzstream.C, scotch(?)

Python 3, for PyFoam:

   sudo apt install -y python3-pip
   pip3 install numpy
   pip3 install scipy
   pip3 install matplotlib
   #Ensure that we have a robust setup for our programming environment:
   sudo apt install -y build-essential libssl-dev libffi-dev python3-dev
   #Not sure if the following is needed/recommended. PyFoam seemed to need python2, executed as 'python'.
   #I first tried package python3-as-python, but it seemed that the syntax was then incorrect.
   #After doing the following, PyFoam was immediately reported as already installed...
       sudo apt install -y python2

Install system alternatives:

sudo apt-get install -y openmpi-bin libopenmpi-dev #Use system installed OpenMPI.

Remove any packages that are no longer needed:

sudo apt autoremove -y

You also switch to gcc version 7 instead of gcc version 9, which is distributed with Ubuntu. What is the reason for that? My compilation goes through, except for the single utility $FOAM_UTILITIES/utilities/postProcessing/POD/vectorSnapshots. Is there something that will not work if the code is compiled with gcc version 9? I do get a lot of warnings, but if the compilation goes through I guess it should be ok. It would be great to know your opinion on this, since you say that an older version should be used.

You have also made comments on compilers at https://openfoamwiki.net/index.php/Installation/Linux/foam-extend-4.0/Ubuntu. In that case you revert back to gcc version 5. What was the reason for doing that? I did not try to compile exactly FOAM-extend-4.0 in Ubuntu 20.04, but it may be useful for me to know from where those instructions origin.

Håkan

Hani (talk)12:52, 10 August 2020

Hello Hakan,

Yes, the package list may not be the minimum requirements. Some of it is there for other packages. E.g. the swak4foam that comes with 4.0 doesn't compile anymore on 20.04 (worked for 18.04). So I decided to use the upstream version for that, which requires bear and libreadline-dev.

Python: As far as I can see 4.0 will need Python2, 4.1 seems to need Python3 (would need to check). I usually install both, since I only use Python 2 for legacy reasons (as in this case). I have not tried to use python3-as-python, but that would most likely break pyFoam for 4.0.

I tried to set the instructions up in a way that they cover most bases, so there may be some packages that are not needed for one version, but for another. Unless they conflict, I left them in.

Compiler toolchain: I stick to the ones I know work. 4.0 did not compile with anything newer than gcc5, so I'll stick to that. 4.1 did cause problems on gcc8, so I reverted to back to gcc7. AFAIK these are also the ones that were used in the development, so are a safe bet.

I started writing these guides for my students and colleagues who have no experience in compiling, so tried to make them fool-proof. If you are experienced in administering a Linux system and compiling complex software packages, there is no harm in doing it differently.

BTW, you can also install pyFoam via pip, which will always pull in the correct version for your version of Python. I haven't included that in the guides, because I have not tested for conflicts, but do run it on a cluster.

Tschenkel (talk)14:05, 10 August 2020
 

One question: Why did you install the "next release" branch? Should that not have been superseded/merged with foam-extend 4.1?

Tschenkel (talk)14:12, 10 August 2020