Depending on your packaging system (or system administrator), various OpenFOAM shell sessions may be available. For example,
/usr/bin/openfoam -> openfoam2006 /usr/bin/openfoam2006 /usr/bin/openfoam1912
They provide the simplest means of starting OpenFOAM immediately and can be used for an interactive bash session, or to run a single OpenFOAM command within the OpenFOAM environment.
-help option for the respective shell session
openfoam2006 -help) displays some useful information.
The purpose of the OpenFOAM shell session is simply convenience.
- quickly set and use an interactive environment for OpenFOAM.
- use a single OpenFOAM application without preliminary setup of an OpenFOAM environment.
- use OpenFOAM applications from a parallel installation with a different precision.
- entrypoint for container scripts.
Calling an OpenFOAM shell session without any arguments opens an
interactive bash session with the respective OpenFOAM environment
and sources your usual
~/.bashrc environment, to ensure that other
paths and aliases are as expected.
$ openfoam Using: OpenFOAM-2006 - see www.openfoam.com Arch: linux64GccDPInt32Opt (mpi=openmpi-system) OpenFOAM shell session - use exit to quit OpenFOAM-2006:~/ mark$
Although the OpenFOAM environment is sourced after your home
~/.bashrc, it is advisable to ensure that there are no circular
references from within your
If an OpenFOAM shell session is 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: ...
It is also possible to execute arbitrary shell sequences with the
-c option. For example,
$ openfoam2006 -c 'echo "openfoam=$WM_PROJECT_DIR uses $WM_OPTIONS"'
openfoam=/usr/lib/openfoam/openfoam2006 uses linux64GccDPInt32Opt
- OpenFOAM shell sessions are included as part of Debian and RPM packages.
Never attempt to embed the shell session wrapper as part of
~/.bashrc- this may cause an infinite loop!
Copyright (C) 2020 OpenCFD Ltd.