FAQ/Installation and Running

From OpenFOAMWiki
< FAQ
Revision as of 17:33, 13 August 2014 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.

1.9 How to run the tutorials in OpenFOAM?

First of all, the tutorials being referred to here are the ones addressed in the introduction of chapter 2 in the OpenFOAM User Guide. In other words, the tutorials folder to be used, should be a copy of the original copy of tutorials, which can be done by running:

mkdir -p $FOAM_RUN
cp -r $FOAM_TUTORIALS $FOAM_RUN
cd $FOAM_RUN/tutorials

which will create the default running folder, then copy the tutorials to said folder and then switch to the folder with our new copy of the tutorials. If you're wondering where this folder is located, run:

echo $FOAM_RUN

Now please study chapter 2 in the OpenFOAM User Guide.

Once the chapter is studied, here are a few guidelines regarding OpenFOAM's tutorials:

  1. The simplest way to run a tutorial in OpenFOAM is to run blockMesh followed by the name of the solver, such as icoFoam. To know the name of the solver in question, have a look into the file system/controlDict and see the name defined for the keyword application.
  2. But the situation changes when the case is more complicated. In those cases, there are a couple of helper scripts inside the case folder or inside the parent folder of that case, named Allrun and Allclean. To run them, simply prepend ./ to the script's name, e.g.:
    ./Allrun
    Some examples of tutorials that have these scripts:
    1. In OpenFOAM 2.1, the tutorial incompressible/simpleFoam/motorBike has got the Allrun script.
    2. Also in OpenFOAM 2.1, the tutorial incompressible/icoFoam/cavity does not have the Allrun script, but the parent folder incompressible/icoFoam does have that script. This means that this Allrun script will run all tutorials within the folder incompressible/icoFoam.

1.10 Common errors when building OpenFOAM from source code

This section of the FAQ addresses many of the known common building errors that can occur when building OpenFOAM from source code. It is not a thorough list, but it should at least help with some of the more common issues.

In addition to this, please keep in mind to use a compiler version which is known to be compatible with OpenFOAM, for which a list is being kept in the page Installation/Compatibility_Matrix.

1.10.1 icoFoam or blockMesh cannot be found?

Something went wrong when you tried to build OpenFOAM, but didn't notice it until you tried to run icoFoam or blockMesh and got a message like this:

blockMesh: command not found

And/or perhaps you did notice an error at the end of the build, something like this:

make: *** [multiphase] Error 2
[...]
make: Target `application' not remade because of errors.

Well, both issues are likely related. To diagnose what in fact went wrong, run the Allwmake script once again like this:

./Allwmake > log.make 2>&1

This will make a full log into the file log.make, including errors that are outputted during the building process (i.e. "2>&1" does the redirect of stderr to stdout).

You can then check if there are any errors by opening the file log.make with a text editor and search for lines have the expression "Error " (including the space after the word "Error"). Keep in mind that if your terminal is returning error messages in another language, then you should search for the respective word for "Error".

If you do find errors, the first one is usually the one to blame for all of the other errors after that. Unless of course you've spotted the error explained in the subsection below, namely: Weird error message: make: [install] Error 1 (ignored) - what does it mean? - in that case, you can ignore that particular error message and search for the next one, if there is any.

Once you've spotted the first real error message, search online for the main keywords in that error message, because it has likely already been found by other people and already solved.

1.10.2 Compilation error, something about triad.C:36, what's wrong?

As of OpenFOAM 2.2.0 it was no longer possible to compile OpenFOAM with GCC 4.4 and older. At that time the limitation was introduced in a somewhat artificial way, because the authors no longer could support building OpenFOAM with all versions of GCC from 4.3 to 4.8.

The error message in question is as follows:

primitives/triad/triad.C:36: error: expected initializer before '<' token
primitives/triad/triad.C:39: error: expected initializer before '<' token

More detailed information about this is provided on the following forum thread: Compile Error of OpenFOAM-2.2.0 on RedHat EL5 - but the short solution is simple: upgrade to using GCC 4.5 or newer.

1.10.3 Weird error message: make: [install] Error 1 (ignored) - what does it mean?

This error message usually occurs when building the Scotch library, through OpenFOAM's Allwmake script in the ThirdParty-* folder:

cp: cannot stat `../bin/d[agm]*': No such file or directory
make: [install] Error 1 (ignored)

This particular message occurs usually only occurs when cleaning up the Scotch building folder and can be ignored. If there are any problems, it's not because of this error message.

The explanation is simple: Scotch's building procedure requires one to build it directly in the source code folder, which makes it a requirement to clean up after the building and installation steps are complete, so that one can also build other architectures of OpenFOAM and Scotch. For example, if you need both 32 and 64-bit builds, you will need Scotch's source code folder to be cleaned from the previous build, so that the next build can occur with success.

1.10.4 CMake is refusing to configure my build of ParaView, what's going on?

Usually there are 2 situations where this can occur:

  1. When you're using a CMake version that is not compatible with the CMakeLists.txt present in the source code you're trying to build.
  2. When there is a conflict with another custom installation of CMake.

Therefore, the two above are somewhat related: either you need a newer CMake version or the one you're using is too new. Either way, you will likely have to build a custom CMake version.

For ideas on how to build CMake from source code, please refer to the pages dedicated to detail how to install OpenFOAM and ParaView on Linux: Installation/Linux. For example, see the step #12 on this page/section: Installation/Linux/OpenFOAM-2.2.2/Ubuntu#Ubuntu_10.04

But if the custom build you've made of CMake on purpose for a specific OpenFOAM version isn't working as intended, then perhaps you're getting an error message like this one:

CMake Error at /opt/cmake/Modules/CMakeTestCCompiler.cmake:52

This was discovered in the following forum thread: openfoam 2.3.0 installation in RHEL 5. The solution was as simple as running:

unset CMAKE_ROOT

Then you should be able to use the custom build of CMake you've made for building ParaView.

1.10.5 wget keeps complaining something about an insecure connection?

The error message in question is for example this one:

ERROR: certificate common name `www.github.com' doesn't match requested host name `raw.github.com'.
To connect to raw.github.com insecurely, use `--no-check-certificate'.

As the error message implies, you can use the option --no-check-certificate when using wget. Another somewhat easier solution is to run the following command, before running wget several times:

alias wget="wget --no-check-certificate"

As the command implies, it's an alias for the command wget, which will automatically use the options defined in the command above.

Now, please keep in mind that this can be considered a security risk, because this means that you'll be accessing a secure website through HTTPS, but without a valid certificate for said communication. This is usually because the local copy of the certificate list installed on your system is outdated and you can still go ahead safely with the download. But in some situations it might mean that either the target website is in fact insecure/compromised or that there is a man-in-the-middle attack going on; this could at the very least mean that the data you're getting might be getting corrupted on download.

1.10.6 Unable to build setSet without readline?

The error message occurs something along these lines:

Found <readline/readline.h>  --  enabling readline support.
Making dependency list for source file writePointSet.C
Making dependency list for source file writeFuns.C
Making dependency list for source file writePatch.C
Making dependency list for source file setSet.C

... fast-forwarding a bit to the error message:

[...]
Make/linux64GccDPOpt/writePatch.o Make/linux64GccDPOpt/setSet.o -L/home/ofuser/OpenFOAM/OpenFOAM-2.3.0/platforms/linux64GccDPOpt/lib \
	     -lmeshTools -lreadline -lOpenFOAM -ldl   -lm -o /home/ofuser/OpenFOAM/OpenFOAM-2.3.0/platforms/linux64GccDPOpt/bin/setSet
/usr/bin/ld: cannot find -lreadline
collect2: ld returned 1 exit status
make: *** [/home/ofuser/OpenFOAM/OpenFOAM-2.3.0/platforms/linux64GccDPOpt/bin/setSet] Error 1

Notice the very first line on the start of this description? Namely "enabling readline support"? The reason for this is that the readline library is only partially installed, where the header is present but the respective library isn't.

The quickest solution is to build setSet like this:

$FOAM_UTILITIES/mesh/manipulation/setSet/Allwmake NO_READLINE

If all goes well, it will have built setSet successfully without the readline library.


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