Installation/Linux/OpenFOAM-2.1.1

From OpenFOAMWiki
< Installation‎ | Linux
Revision as of 10:51, 20 August 2016 by Wyldckat (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Maintainer
The current maintainer of this page is Wyldckat (talk).


Note: This page is still under construction... feel free to help if you can!

1 Introduction

This page aims to explain how to install OpenFOAM OF Version 211.png on any Linux Distribution.

In the following chapters and sections is explained how to generally install OpenFOAM 2.1.1 and related dependencies, such as ParaView:


2 Dedicated instructions

Currently the following sub-pages exist with complete and/or partial instructions for specific Linux Distributions:

Installation/Linux/OpenFOAM-2.1.1/CentOS SL RHELInstallation/Linux/OpenFOAM-2.1.1/DebianInstallation/Linux/OpenFOAM-2.1.1/Fedora
Installation/Linux/OpenFOAM-2.1.1/GentooInstallation/Linux/OpenFOAM-2.1.1/UbuntuInstallation/Linux/OpenFOAM-2.1.1/openSUSE


3 Installing from source code

The official instructions are made available here: Download v2.1.1 | Source Pack

Below are the instructions written/annotated by the members of the community that use OpenFOAM. The level of detail may vary depending on the contributors to this page. The objective is to provide quick instructions on the pages dedicated to each Linux Distribution, as listed in the Dedicated instructions chapter, while the instructions below go into a higher level of detail.

Therefore, feel free to contribute notes and/or summary notes if you so determine to be required. And don't forget that specific instructions for any specific Linux Distribution, should go into their respective pages.


3.1 Preparations

If you do not yet feel comfortable using Linux, then perhaps you better first read the page Working with the Shell and train a bit with the shell/terminal environments, so you can have a better perception of the steps shown below.


3.1.1 Where to install

  • The standard base installation folder is $HOME/OpenFOAM, where all of the version you may wish and want can be placed there.
    Tip: If you're new to Linux or even if you want to do a system-wide installation, use this folder first. Later on it's explained how you can move/copy this installation to another place.
  • You may want to place the base folder for OpenFOAM elsewhere, perhaps based on Linux's Filesystem Hierarchy Standard, such as:
    • /opt/OpenFOAM - /opt is the conventional folder for optional application software packages.
    • /usr/local/OpenFOAM - similar to /opt, but specific for installations for the local machine.
    • /share/OpenFOAM - example of a location that is shared among several machines.

Inside the base folder, OpenFOAM 2.1.1 will have 2 folders assigned to it:

  • OpenFOAM-2.1.1 - This is where this specific version will be installed.
  • ThirdParty-2.1.1 - This is where the respective third-party applications will be stored.

Now, assuming the installation folder is $HOME/OpenFOAM, start a new terminal and run the following commands:

cd
mkdir OpenFOAM
cd OpenFOAM


3.1.2 Download and unpack

Quoting from the official instructions, these are the packages to be downloaded:

Pack File md5sum
OpenFOAM OpenFOAM-2.1.1.tgz dad652c531ea76da4389903e145ef6a5
Third-Party ThirdParty-2.1.1.tgz 1b9d216096f89af206ea79010c376856

You can download them directly from the terminal command line, by running:

wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.1.1.tgz?use_mirror=mesh" -O OpenFOAM-2.1.1.tgz
wget "http://downloads.sourceforge.net/foam/ThirdParty-2.1.1.tgz?use_mirror=mesh" -O ThirdParty-2.1.1.tgz

You can then check if the packages are alright, by visually comparing the md5sum hashes (shown in the table above) to the output from the following command:

md5sum OpenFOAM-2.1.1.tgz ThirdParty-2.1.1.tgz

If all goes well, you can unpack by running the following commands:

tar xf OpenFOAM-2.1.1.tgz
tar xf ThirdParty-2.1.1.tgz

Note: if the previous commands don't work properly, try the standard mode:

tar -xzf OpenFOAM-2.1.1.tgz
tar -xzf ThirdParty-2.1.1.tgz


3.1.3 System packages

Last but not least, there is a list of dependencies on which OpenFOAM relies for building and working. These vary in the scale of both your needs and the permissions you have access to.

Lists of packages necessary for each Linux Distribution can be found at the Dedicated instructions chapter.

Here is a rough outline of the packages that are necessary for building OpenFOAM and related third-party software; keep in mind that most of these required the development version of said packages as well:

For building OpenFOAM itself
gcc g++ binutils make zlib flex bison libreadline
For building ParaView
python libpng libglib Qt, as well as several X11 related libraries and some OpenGL ones (e.g. freeglut).
For building a custom GCC
texinfo byacc. The multilib packages for gcc and libc packages might come in handy, if you are using an x86_64 architecture and want to have both 32 and 64bit installations. Additionally, if texinfo isn't available, then you'll need makeinfo.
Auxiliary tools that might come in handy, sooner or later: wget patch diff git


3.2 Building OpenFOAM

This is going to look very easy and simple, because it's assuming that you already have all of the necessary system packages installed. And keep in mind that these instructions are assuming the base installation folder is the default $HOME/OpenFOAM.

The steps to take are as follows:

  1. Configure the OpenFOAM environment files. This is a lengthy topic, so please read the chapter OpenFOAM Environment Variables from the page Working with the Shell.
  2. Get the OpenFOAM environment up and running. For this, you need to source the etc/bashrc file that OpenFOAM has:
    source $HOME/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc
  3. Go into the folder OpenFOAM-2.1.1:
    cd $WM_PROJECT_DIR
    Or you can use:
    cd $HOME/OpenFOAM/OpenFOAM-2.1.1
  4. Run the script Allwmake:
    ./Allwmake
    • Note: Since there is always a certain level of probability that not everything will build the way it was intended, then you better run Allwmake this way:
      ./Allwmake > log.make 2>&1
      This will:
      • Keep a complete log of the build process in the file log.make.
      • The last part of the command 2>&1 will redirect the error output into the standard output, for keeping a properly historic log of the build process.
        Otherwise, it will be very hard to relate the errors with the place where they occurred.
  5. When the script completes, the prompt will be returned to you.

Next comes the point where you will need to start diagnosing the error messages you're getting. For those, please refer to the respective FAQ sub-section Common errors when building OpenFOAM from source code

3.3 Building ParaView

Check the main wiki page dedicated to building and installing ParaView 3.12 integrated into OpenFOAM: Installation/ParaView/3.12

3.4 Building Code Documentation

TODO... This doesn't need it's own page, but system dependencies may vary...


4 All done!

The conventional way to get started is to read the OpenFOAM User Guide. You will have a copy of it in PDF format, which is pointed out by the following command:

echo $WM_PROJECT_DIR/doc/Guides-a4/UserGuide.pdf

For a less conventional way, have a look at the page Tutorials/Before Getting Started.