FAQ/Installation and Running

From OpenFOAMWiki
< FAQ
Revision as of 10:51, 25 December 2013 by Wyldckat (Talk | contribs)


1 FAQ Section 2: Installation and Running

Problems with the installation and running of applications


1.1 How to install OpenFOAM and any of its variants?

These are the known installation instructions for OpenFOAM and many of its variants:

  1. The instructions for the official OpenFOAM versions are provided at the OpenFOAM Foundation website.
  2. The instructions for the Extend variant foam-extend are provided at the Wikki website, in the page Download & Install.
  3. The instructions for installing FreeFOAM are provided at their official website: FreeFOAM Installation Instructions
  4. Instructions written by the community are mostly centralized here at openfoamwiki.net, in the page Installation.
  5. Questions about installing any of these versions/variants can be asked at the (unofficial) forum at CFD-Online:

1.2 Which platforms are supported by OpenFOAM ?

Ports to other operating systems that have been discussed on the message board are

1.3 Why isn't there a Windows port of OpenFOAM ?

Actually, nowadays, there are a few ports for Windows. The only feasible way in the past, was to port OpenFOAM to Windows using Cygwin, an application that implements the most common UNIX APIs on Windows. Now MinGW is the more popular porting solution, because while it still integrades parts of Cygwin (MinGW forked from version 1.3.3 of Cygwin [1]), it can run natively in Windows and be linked with other native Windows libraries and applications.

One problem is that the file-system NTFS, that is used by most modern Windows Versions, is (by default) only case-preserving (hello.c and Hello.C are the same file, when in the same folder). The OpenFOAM-sources need a fully case-sensitive file-system and can't even be unpacked properly on a Windows system (see [2]). There is a possibility of enabling full case-sensitivity in Windows [3], but can lead to some Windows programs to not work properly.

1.3.1 (Cross-)Compiling with Cygwin

A (relatively old) way to compile OpenFOAM on cygwin is described on the Message-Board. The resultant binary distribution of version 1.3 is available here (and there is a relating discussion thread on the Message-Board). This port does not include FoamX and paraFoam, although postprocessing can be done with ParaView by using foamToVTK, and FoamX exists for OpenFOAM 1.4.x. This port is not part of the official distribution.

Another unofficial port of OpenFOAM 1.4.x is available here, with FoamX and ParaView. Support is available here and here.

FreeFOAM should prove to be more successful, but it's still in development, and uses CMake instead of wmake.

Cygwin 1.5 introduced a mount type named managed mounts, that can handle fully case sensitive files and folders, and some special characters that Linux can use and Windows can't [4]. In theory, if OpenFOAM is built under this interpretation layer, than it should be compilable directly in Windows. After some testing, it was discovered that OpenFOAM has some very long path names, which aren't handled properly by Cygwin's managed mounts, due to path size limit [5].

With Cygwin 1.7, managed mounts were dropped and POSIX mounts were introduced [6], as well as file paths increased to 4096 characters [7]. The POSIX mount relies on a hidden feature of Windows [8], that enables NTFS POSIX compatibility system, also used by Interix's SFU/SUA [9], thus enabling full case sensitivity. In other words, as of Cygwin 1.7, it is possible to compile and cross-compile OpenFOAM directly in Windows, without major reconstruction of the files and structure of the source code. Nonetheless, the whole build system has to be done under Cygwin's layer, because the flag obcaseinsensitive doesn't actually make all of Windows applications aware of full file name case sensitivity. For more information, see Using Cygwin for cross-compiling OpenFOAM.

1.3.2 (Cross-)Compiling with MinGW

There are already a few variants of cross-compiling with MinGW and one port that compiles directly in Windows with MinGW and CodeBlocks. The complete list is available here in the wiki. This link is part of a full step-by-step tutorial on how to Cross Compile OpenFOAM in Linux for Windows with MinGW and Mingw-w64.

1.4 How do I port OpenFOAM to an unsupported platform ?

If your platform is not some kind of UNIX-flavour you're probably going to have a hard time.

For a starter see Porting to a new platform.

1.5 Why is OpenFOAM built and installed in my home directory ?

Building and installing and running OpenFOAM in your home directory gives you some advantages. It is common practice to share the home directories across all machines machines on a network. In this setup all computers will have access to and run the same binaries compiled by the same compiler to help ensure consistent results. It also makes sharing data for cluster work easier. Also to really leverage the power of OpenFOAM you will want to write code to link to and extend it. If it was installed in a common directory individual users programs could clash via naming conflicts etc...


Unfortunately this is not a winning situation for everybody. If you build and install OpenFOAM in your home directory you can't use it on heterogeneous machines on a network, i.e. a z80 based machine cannot run OpenFOAM compiled for a 6502 based machine, unless it has emulation software in which case it would be slow. Fear not because it is possible to configure OpenFOAM to compile and install in a common directory on each machine to accommodate heterogeneous machines on a network.

1.6 Why am I not able to install the official OpenFOAM Deb packages on Ubuntu ?

If when following the instructions from the official instructions Ubuntu Deb Pack Installation you get an error like this:

The following packages have unmet dependencies:
 openfoam221 : Depends: g++ but it is not installable
               Depends: libreadline-dev but it is not installable
               Depends: libopenmpi1.3 but it is not going to be installed
               Depends: libptscotch-5.1 but it is not going to be installed
               Depends: flex
               Depends: libscotch-dev but it is not going to be installed
               Depends: libopenmpi-dev but it is not going to be installed
               Depends: libxt-dev but it is not going to be installed
               Depends: openmpi-bin but it is not going to be installed
               Recommends: libptscotch-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Then the problem is that the necessary repository universe is not installed, as explained here: Repositories/Ubuntu

To fix the problem, follow these steps:

  1. Edit the file /etc/apt/sources.list:
    sudo nano /etc/apt/sources.list
  2. You should find contents similar to this:
    # /etc/apt/sources.list
     
    deb http://archive.ubuntu.com/ubuntu/ precise main restricted
    deb http://security.ubuntu.com/ubuntu/ precise-security main restricted
    deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted
  3. Append to each line the word universe (you can add multiverse as well if you want to):
    # /etc/apt/sources.list
     
    deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe
    deb http://security.ubuntu.com/ubuntu/ precise-security main restricted universe
    deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe
  4. Hit the key combination Ctrl+X, press the Y key, then the Enter or Return key.
  5. Now, update the list of packages by running:
    sudo apt-get update

And it's done. You can now proceed with the official installation instructions: Ubuntu Deb Pack Installation


1.7 Building and installing ParaView

1.7.1 Building ParaView and plug-ins without Qt

Instructions on how to build ParaView 3.12.0 and the official OpenFOAM 2.2 plug-ins for ParaView, are available at the CFD-Online OpenFOAM forum, here: OpenFOAM 2.2.2 on a server (no X) - post #7 to #9


1.8 Why do I get the error message "fileName::stripInvalid() called for invalid"?

There are several threads at the CFD-Online Forums which give examples of such situations. One of the most describing one is this: reconstructPar --> fileName::stripInvalid() called for invalid fileName commandtouse

In summary, this error message always appears when a file name is provided that OpenFOAM considers invalid. This is because OpenFOAM follows a strict rule to use file names as if they were C/C++ coding names, where the following characteristics must be followed:

  • A name can start with an alphabet character or an underscore.
  • A name cannot have spaces in it.
  • A name cannot start with a digit (0 to 9), but it can have digits in any other place of its name.
  • A name cannot have quote symbols, namely: " '
  • A name can be a composite of several names, by using dots and parenthesis, namely: . ( )
  • A name cannot have unconventional symbols, including there characters: \ / : ; , |

This rule mostly applies to the names of items inside OpenFOAM dictionaries, where the only exception is regular expressions can be used inside dictionaries.

Facts about "FAQ/Installation and Running"RDF feed
FaqdescriptionProblems with the installation and running of applications +
FaqnameInstallation and Running +
Faqnumber2 +