Linux, Unix-like systems
Version | Build |
---|---|
v1906 | Build |
Older versions use a general build guide webpage, which will be replaced by alternative content in the future.
Packaging systems
System | Links | Status | Notes |
---|---|---|---|
openSUSE science | package openfoam, download | Actively maintained by OpenCFD | notes |
Fedora/CentOS/RedHat copr | package openfoam | In development by OpenCFD | notes |
Debian science | package openfoam - see debian search and tracker | Maintained independently, with input from OpenCFD | notes |
spack | package openfoam | Actively maintained by OpenCFD | notes |
EasyBuild | package OpenFOAM | Maintained independently, with input from OpenCFD |
Package structure (RPM)
To allow smooth installation and use of multiple OpenFOAM versions on the same system, we use the following structure:
Package | Comments |
---|---|
openfoam | The top-level meta package that provides links and requirements for the most recent openfoam release |
openfoam-selector | Similar to mpi-selector, used to switch active openfoam versions |
openfoam1906 | The maintenance version for 1906 |
openfoam1812 | The maintenance version for 1812 |
The version-specific packages (eg, openfoam1906
, openfoam1812
)
install into distinct directories so that it is possible to have
multiple versions available on your systems.
The top-level openfoam
package registers which of the
version-specific packages corresponds to the current release.
Finally, the openfoam-selector
package is used to register which
openfoam packages are installed on the system and allows the use to
select one of them.
To display which versions are installed:
$ openfoam-selector --list
openfoam
openfoam1806
openfoam1812
openfoam1906
To set a particular version
$ openfoam-selector --set openfoam1906
To query the current selection:
$ openfoam-selector --query
Most people will find the openfoam-selector-menu
more convenient to
use.
WARNING: Changes made to the openfoam-selector defaults
will not be visible until you start a new shell!
NOTE Similar to the behaviour of the mpi-selector, the values
registered via the openfoam-selector
will not be activated until the
next full login. This is to avoid a possible clash of environments
when a parallel job still being launched. Of course, you can still
simply source the corresponding bashrc
file directly. For example,
$ source /opt/openfoam1906/etc/bashrc
OpenFOAM session
Depending on how your packaging system has done things, an openfoam
session command may be available as an alternative to the
openfoam-selector
mechanism.
On the openSUSE installation, for example:
/usr/bin/openfoam -> openfoam-1906
/usr/bin/openfoam-1812
/usr/bin/openfoam-1906
/usr/bin/openfoam-selector
/usr/bin/openfoam-selector-menu
Using openfoam -help
displays some useful information.
Calling it without any arguments opens an interactive bash session
with an OpenFOAM environment and your usual ~/.bashrc
environment.
$ openfoam
Using: OpenFOAM-1906 (patch=191103) - see www.OpenFOAM.com
Arch: linux64GccDPInt32Opt (mpi=openmpi-system)
OpenFOAM shell session - use exit to quit
OpenFOAM-1906:~/
mark$
If called with arguments, it will setup an OpenFOAM environment before executing a single command. For example,
$ blockMesh -help
blockMesh: Command not found.
$ openfoam blockMesh -help
Usage: blockMesh [OPTIONS]
Options:
...
Although the OpenFOAM environment is sourced after your home
~/.bashrc
, it is advisable to ensure that there are no circular
references from within your ~/.bashrc
file.
openSUSE
For openSUSE users, OpenCFD Ltd. is a maintainer on the community Science Portal and provides RPM binary packages for the most recent openfoam versions. The quick access is via the download page: https://software.opensuse.org//download.html?project=science&package=openfoam and follow the instructions there.
If you already have the Science repository registered on your system,
you should be able to install it directly with zypper
:
sudo zypper install openfoam
Or with a graphical tool such as YaST2:
Fedora/CentOS/RedHat
For RedHat-based system, OpenCFD Ltd. is currently using the copr infrastructure to provide RPM packages. Enable copr for openfoam as per the documentation shown on https://docs.pagure.org/copr.copr/how_to_enable_repo.html
For newer systems:
$ dnf copr enable openfoam/openfoam
Older systems:
$ yum install yum-plugin-copr
$ yum copr enable openfoam/openfoam
Debian/Ubuntu
Support for Debian is expected to further improve in the near future with better use of the openfoam-selector and the openfoam-session mechanisms.
- https://packages.debian.org/source/unstable/openfoam (unstable meaning newer)
- https://packages.debian.org/source/stable/openfoam (stable meaning newer)
Note that the Debian packages may have been created with applications in
/usr/bin
and configuration files under /usr/share/openfoam/etc
.
In this case, you may need to manually define the location of the
OpenFOAM directory as follows:
export WM_PROJECT_DIR=/usr/share/openfoam
spack
The installation of openfoam with spack will generally require the latest (development version) of spack. If this is available, you can install openfoam in various configurations and dependencies, but typically can simply install directly:
$ spack install openfoam
Resources
To help with RPM-based systems, the following content is provided for reference purposes, and to help when scripting:
System | Files | Scripts |
---|---|---|
common | openfoamVERSION.spec lintrc | create-tar |
openSUSE | ||
CentOS/RedHat | openfoam-selector.spec | copr fetch |
Darwin (Mac-OS)
The support for Darwin is complete, but is less well tested than Linux.
- The Darwin build (and operation) requires a case-sensitive file system, which is often created as a disk image and mounted (for older systems).
- Compilation uses the system clang compiler.
Known issues
CGAL
- ThirdParty CGAL will normally need to be compiled without mpfr/gmp.
This should be done manually prior to building OpenFOAM or other
ThirdParty. Eg,
cd $WM_THIRD_PARTY_DIR ./makeCGAL gmp-none mpfr-none
wmake/rules/darwin64Clang/CGAL
file has been adjusted to eliminate references to gmp/mpfr libraries.
Windows
Starting with v1906, Windows source compilation is supported via cross-compilation using the mingw compiler on 64bit Linux to generate a Win64 target. See the version-relevant build information.
--