- Linux, Unix-like systems
- Packaging systems
- Darwin (Mac-OS)
- Windows (cross-compiled)
|spack||package openfoam||Actively maintained by OpenCFD||notes|
|EasyBuild||package OpenFOAM||Maintained independently, with input from OpenCFD|
|debian, RPM||See precompiled||Actively maintained by OpenCFD|
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
The installation of OpenFOAM with easybuild will generally require the latest (development version) of easybuild.
The support for Darwin is complete, but less well tested than Linux.
Compilation uses the system clang compiler.
The Darwin build (and operation) requires a case-sensitive file system.
(For older systems, this can be created as a disk image and mounted)
- ThirdParty CGAL will normally need to be compiled without mpfr/gmp.
This should be done manually prior to building OpenFOAM or other
ThirdParty. For example,
cd $WM_THIRD_PARTY_DIR ./makeCGAL gmp-none mpfr-none
wmake/rules/darwin64Clang/cgalfile avoids references to gmp/mpfr libraries.
Windows 64bit binaries can be generated on 64bit Linux by cross-compilation.
Sometimes it is useful to switch between entire sets of configuration
preferences without re-editing the files each time. This is the
purpose of the
FOAM_CONFIG_ETC variable. It specifies an absolute
path, or a path relative to the project directory where various
configuration files can be found. These are selected in preference to
the normal shipped configuration files.
This allows swapping in a set of different preferences without modifying the regular settings. See cross-compilation for an example of its use.
Different compiler versions
By default, OpenFOAM handles newer/older non-system compilers as
ThirdParty installations and uses the combination of
WM_COMPILER_TYPE to select them. In some cases, however, it is
more convenient to install prebuilt compiler binaries as system
compilers (e.g., using deb or rpm packages). These compilers are
typically distinguished by an additional version suffix (eg,
WM_COMPILE_CONTROL environment can be used to add the additional
resolution necessary. For example,
export WM_COMPILER=Gcc export WM_COMPILE_CONTROL="version=11"
This will add the suffix
-11 to the regular compiler names.
Note, that is normally good practice to add some compiler version
information into the build name as well. For example,
export WM_COMPILER=Clang130 export WM_COMPILE_CONTROL="version=13.0"
Be certain to verify that the rules have actually been set as expected:
wmake -show-cxx wmake -show-path-cxx
If this change represents your standard default compiler definition,
then place the information into the
etc/prefs.sh file (see the
etc/bashrc file for some details) and re-source your OpenFOAM
environment. If you would like to selectively enable this compiler
definition, a common means is to place the same definition information
into a user configuration file (for example,
and then specify that configuration when sourcing your OpenFOAM
environment. For example,
source /path/to/OpenFOAM-version/etc/bashrc clang130
bashrc will locate and use the configuration file, after which the
compiler will be properly selected. Again, to verify everything has actually
been set properly:
wmake -show-cxx wmake -show-path-cxx
Processor-specific builds are typically handled by creating a new compilation option. For example, to create Broadwell-specific options:
$ cd wmake/rules/linux64Gcc $ cp c++Opt c++OptBdw
edit this file and then use WM_COMPILE_OPTION=OptBdw in the
before re-sourcing the OpenFOAM environment.
Since OpenFOAM is purely C++ code, there is no need to apply special
processor-specific optimizations for C code (the regular
optimization is fine) since these components only appear as part of the
wmake build toolchain itself.
Copyright (C) 2020-2021 OpenCFD Ltd.