OpenFOAM – Installation

Installation of OpenFOAM on a Personal Computer

OpenFOAM is already installed on the HPC computer vilje, however it is not convinient to do development and debugging directly on that. Also, a lot of simple 2D simulations can be done within reasonable time on a normal workstation or a laptop. This is a quick summary of the options you have when it comes to installing OpenFOAM on your computer. The guide is divided in three parts, depending on your current operating system. In each section there are several alternatives, and they are ranked after whet gives you the best user experience and performance. However, this might also often be the inverse of the simplicity, i.e. the solution with the best performance is often the most difficult solution.

Windows

OpenFOAM is originally developed and distributed for Linux, but there are still a few options in running OpenFOAM on your computer if you have Windows today:

1. Dual boot Linux/Windows

The best solution is to install Linux beside your original Windows installation. With this solution you are able to choose between Windows and Linux when you start the computer. The Ubuntu windows installer is one of the simplest dual-boot solutions available, but this is still a risky process. You should backup all your files, emails, bookmarks etc. before you install.

For systems with poor graphics performance and/or little RAM, we generally recommend the Xubuntu flavor of Ubuntu.

After the installation of your Linux-distribution of choice, proceed to the Linux-section for installation instructions for OpenFOAM.

Advantages:

  • The best CPU/memory performance possible on the system
  • All memory are available to OpenFOAM
  • Good I/O performance

Disadvantages:

  • Technically the most difficult alternative
  • Risk of corrupting existing Windows installation
  • Some proprietary hardware might not work

2. Running Linux as a virtual computer (recommended)

If you have a sufficient amount of memory available (at least 2 GB, preferably 4 GB) running Linux as a virtual computer inside Windows might be a good choice. This can be done with VirtualBox and a Linux distribution of your choice. You should look for a Linux distribution with low memory and graphic requirements. Xubuntu is again a good choice.

The procedure is pretty simple: Install VirtualBox and create a virtual machine. Install Linux in this machine. After the installation is finished it is recommended to install the virtualbox guest addons to improve performance. Then proceed to the linux section in the bottom of this article for instructions on how to install OpenFOAM from precompiled binaries.

A small tutorial for installing Ubuntu as a virtual computer inside Windows is provided by OpenFOAM. As previously mentioned we do however recommend Xubuntu as the distribution of choice due to it’s smaller memory footprint.

Advantages:

  • Medium good I/O performance
  • No setup of wireless network, bluetooth etc.
  • Easy setup of system and quick boot
  • You do not have to carry a USB stick, all files are located on your harddrive

Disadvantages:

  • Not necessarily the best CPU/memory performance (however not far from if virtualization support is available on CPU)
  • Only a part of the memory will be available to Linux and OpenFOAM

3. Booting Linux from a USB memory stick

Modern computers can boot operating systems from USB memory sticks. That means that you can install an operating system on a memory stick and boot your computer from that. The advantage is that you can keep your existing windows installation as it is. There exist a pre-configured linux distribution with OpenFOAM that can be loaded onto a USB stick, called GeekoCFD. This distribution is based on OpenSUSE and the KDE desktop, and everything that is needed to run OpenFOAM and Paraview is included by default. The distribution is regularly updated. Follow the instructions given on the download page to install it.

You should be aware that there are a huge difference between USB memory sticks when it comes to performance. You should at least have 8 GB (16 GB recommended) of storage, and it must have a decent read/write performance. The cheapest memory sticks that you get for free as advertisement is not suited at all, as these might have read/write speeds down to 2 MB/sec. It is recommended to buy a large (both in storage space and physical size) memory stick from well-known brand. These are available at for instance the campus bookstores.

Advantages:

  • The best CPU/memory performance possible on the system
  • All memory are available to OpenFOAM
  • It is portable between different computers, possibly also on some computer labs on campus

Disadvantages:

  • Some proprietary hardware might not work
  • Poor I/O performance
  • Little storage space for analysis data

4. Running a Windows-version of OpenFOAM

There exist a version of OpenFOAM for Windows named blueCFD. Try it on your own risk.

Advantages:

  • Easy installation (hopefully, not tested)
  • All storage space available to OpenFOAM
  • All memory available to OpenFOAM

Disadvantages:

  • Poor calculation performance (only one thread)
  • Proprietary solution
  • Might not be easy to develop new solvers
  • Extensions such as swak4Foam will probably not work
  • Not used by many people, difficult to get help

Apple OS X

As the architecture of Mac OS is not far from various BSD-flavors, with again is not very far from Linux. There exist several solutions:

1. Compiling from source

You can compile the newest version of OpenFOAM from source. This can give you highly optimized binaries for your system, but is not for the novice. Instructions are found on the OpenFOAM wikiDo not try this unless you know what you are doing!

Advantages:

  • The best CPU/memory performance possible on the system
  • All memory are available to OpenFOAM
  • Good I/O performance

Disadvantages:

  • Technically the most difficult alternative
  • Time-consuming installation/compilation

2. Pre-built binaries (recommended)

There are published unofficial pre-built binaries of OpenFOAM with irregular intervals. You can for example try to this page.

Advantages:

  • The best CPU/memory performance possible on the system
  • All memory are available to OpenFOAM
  • Good I/O performance

Disadvantages:

  • Not used by many people, difficult to get help
  • Not regularly updated

3. Running Linux as a virtual computer

VirtualBox is also available for Mac, and the same procedure and advises as given for Windows applies to Mac. See above.

Linux

1. Installing a pre-built binary package (recommended)

As OpenFOAM is a native Linux application there exist “official” binary packages for various distributions. Please consult the official download page to get the necessary instructions.

Advantages:

  • The best CPU/memory performance possible on the system
  • All memory are available to OpenFOAM
  • Good I/O performance
  • Good user community using these packages, easy to get help
  • Easy to develop new solvers at you are “guaranteed” that your installation is correct
  • Extensions such as swak4Foam is installed without problems

Disadvantages:

  • None

2. Compiling from source

This is for the technical people that need to link against special packages, remove or add features in the solvers, add debug symbols etc. Not recommended unless you know what you are doing.

Instructions are found at the official download page.

Advantages:

  • The best CPU/memory performance possible on the system
  • All memory are available to OpenFOAM
  • Good I/O performance
  • Good user community using these packages, easy to get help
  • Easy to develop new solvers at you are “guaranteed” that your installation is correct
  • Extensions such as swak4Foam is installed without problems
  • Possible to create debug builds

Disadvantages:

  • Difficult
  • Time-consuming installation/compilation