
Once OpenFOAM has been built and installed, running it requires a
properly defined environment prior to executing any applications or
solvers. For a runtime environment, the absolute minimum is the
following:
| Enviroment |
Use |
WM_PROJECT_DIR |
The installation location of OpenFOAM |
PATH |
Must include platforms-specific OpenFOAM bin directory |
LD_LIBRARY_PATH |
Must include platforms-specific OpenFOAM lib directory, and MPI library variants |
There are various ways to setup a minimum or fuller environment. Which
one you choose is largely personal preference and depends on how much
flexibility or permanence is desired.
[[TOC]]
Transient (one-time) use
In many cases it is desirable to activate or use a particular OpenFOAM
version without any additional setup.
Depending on your packaging system (or system administrator), an
OpenFOAM shell session command may be
available as a convenient means of defining and using an OpenFOAM
environment. For example,
The shell session can be particularly useful when running a single
OpenFOAM application from within a workflow. For example,
Manually
To manually activate a particular OpenFOAM version, source its
corresponding etc/bashrc file:
After using the desired OpenFOAM commands, the wmUnset alias can be
used to remove it again.
NOTE:
The /path/to/openfoam location will depend on the OpenFOAM version
and installation.
Persistent selection
Depending on your packaging system (or system administrator), an
openfoam-selector may be available
to define the preferred OpenFOAM version for the login shell.
Manual
For a persistent OpenFOAM environment, the OpenFOAM bashrc file can be
sourced from your ~/.bashrc file by adding a line resembling the
following to that file:
It is usually prudent to check the existence of the file prior to
sourcing it:
NOTE:
The /path/to/openfoam location will depend on the OpenFOAM version
and installation.
Copyright (C) 2019-2021 OpenCFD Ltd.