Precompiled packages
To make OpenFOAM more readily available to a larger range of users, OpenCFD works actively together with the community surrounding respective Linux distributions to provide precompiled binary installations as system packages. The distributions currently include the following:
System |
---|
Debian/Ubuntu |
openSUSE |
CentOS/RedHat/Fedora |
Of these, Debian/Ubuntu and openSUSE generally receive first attention:
- Debian/Ubuntu is a very popular distribution with OpenFOAM users.
- OpenSUSE is historically our internal development platform. Since it is an RPM-based system, it is generally possible to use a well-crafted spec file to subsequently address RedHat-based distributions.
Installation Locations
The packages have been designed to allow simultaneous installation of different OpenFOAM versions without file or package-name collisions. This lets users experiment with different OpenFOAM versions, perform back-to-back comparisons, or simply continue with an older version until completion of a particular project.
The system installation prefix /usr/lib/openfoam
is used, below
which individual versions are located.
For example,
/usr/lib/openfoam/openfoam1912/
/usr/lib/openfoam/openfoam2006/
- ...
The OpenFOAM bash session wrapper will be created under /usr/bin
.
For example,
/usr/bin/openfoam1912
/usr/bin/openfoam2006
- ...
Sub-packages
Satisfying the wishes and requirements of all users is a difficult
task. One user (or sysadmin) wants the "only install what I really
need" approach [more control, less diskspace]. Another group of users
prefers the "just install everything" approach [less control, more
diskspace].
We have attempted to strike a reasonable balance between both. For
any given base package (eg, openfoam1912
etc), there are a variant
of sub-packages ("only-what-I-need"), but also a default
package for
the "install-everything" folks.
Here are some common selections:
User Group | What to install | Runtime | Compilation | Tutorials |
---|---|---|---|---|
minimalist | base | yes | no | no |
traditional | base-dev (devel) | yes | yes | no |
everything | base-default | yes | yes | yes |
The longer descriptions:
Sub-Package | Description | Includes |
---|---|---|
base | OpenFOAM runtime (solver, utils, libraries). Double precision, int32 compilation. | base-common |
base-dev (devel) | Development package. Source code headers and wmake build chain. Needed for developing with OpenFOAM, but also if dynamic code compilation is required. | base, base-tools |
base-tutorials | Tutorials | base-common |
base-default | Meta-package for everything potentially needed | base-dev (devel), base-tutorials |
base-tools | Binaries for OpenFOAM-specific build tools for base-dev (devel) | base-common |
base-common | Version information and share files |
Note the package names for Debian and RPM packages are intentionally
kept very similar, except dev
(Debian) vs. develop
(RPM) names
that follow the respective system conventions.
After installation - using the OpenFOAM environment
The OpenFOAM bash session wrapper provide the simplest means of starting OpenFOAM immediately. For example,
$ openfoam1912
This can be used for an interactive bash session, or to run a single OpenFOAM command within the OpenFOAM environment.
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:
source /usr/lib/openfoam/openfoam1912/etc/bashrc
The exact path used will change depending on the OpenFOAM version.
Never attempt to embed the shell session wrapper as part of your
~/.bashrc
- this may cause an infinite loop!
Package structure (RPM)
To allow smooth installation and use of multiple OpenFOAM versions on the same system, some installations use a meta-package 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 -> openfoam1912
/usr/bin/openfoam1912
/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-1912 - see www.openfoam.com
Arch: linux64GccDPInt32Opt (mpi=openmpi-system)
OpenFOAM shell session - use exit to quit
OpenFOAM-1912:~/
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.
Package Links
System | Links | Status | Notes |
---|---|---|---|
Debian/Ubuntu | dl.openfoam.com/repos/deb/ | Actively maintained by OpenCFD | notes |
openSUSE science | package openfoam, download | Actively maintained by OpenCFD | notes |
Fedora/CentOS/RedHat copr | package openfoam | In development by OpenCFD | notes |
Resources
For precompiled packaging, the following content is provided for reference purposes, and to help when scripting:
System | Files | Scripts |
---|---|---|
common | openfoamVERSION.spec rpmlintrc | create-tar |
openSUSE | ||
CentOS/RedHat | openfoam-selector.spec | copr fetch |
debian/ubuntu | add repo |