Close

11th July 2023

Download v11 | macOS

OpenFOAM 11 is a major new release of OpenFOAM, accompanied by ParaView 5.10.1, compiled with the official OpenFOAM reader module.  It is packaged for Ubuntu 20.04, 22.04 and 23.04.  For macOS, we provide instructions below on using Docker for Mac to provide a self-contained environment for OpenFOAM 11 that includes code, runtime, system tools and libraries.  Requirements for Docker for Mac are macOS 10.14 or newer and at least 4GB of RAM.

Step 1: Before Installing Docker

  1. The user requires superuser password authentication to execute the following commands with sudo. If in doubt, talk to your system administrator.
  2. Ensure you have a network connection to download packages via http(s).
  3. The user can choose to enable graphical applications from the container.  This is generally beneficial because it allows applications like gnuPlot to run (used for monitoring data, e.g. residuals with foamMonitor).  However…
  4. The speed of ParaView running from the Docker container is very slow.  For much better performance, users can install ParaView directly on macOS.  Note, however, that builds of ParaView direct from its producer, Kitware, do not contain the official reader module for OpenFOAM data, but instead use a native reader module that is not fully functional.
  5. OpenFOAM file names are case-sensitive.  If you wish to output data to an OpenFOAM-compatible file system, which we recommend, check whether your file system is case-sensitive before proceeding.

Step 2: Installing Docker for Mac

Follow the Instructions for Installing Docker for Mac.

Step 3: Installing openfoam11-macos

OpenFOAM 11 is launched from a script named openfoam11-macos.  The script is available from the OpenFOAM Download Site and needs to be located somewhere on the user’s PATH for convenient execution.  The following commands will then install in the system-wide /usr/local/bin directory and make the script executable:

sudo curl --create-dirs -o /usr/local/bin/openfoam11-macos http://dl.openfoam.org/docker/openfoam11-macos
sudo chmod 755 /usr/local/bin/openfoam11-macos

Step 4: Enabling Graphical Applications (optional, recommended)

The Docker container runs Ubuntu Linux which uses the X Window System (“X11”, or “X”) to display graphical applications, such a ParaView, gnuPlot and gedit.  Graphical applications can be displayed in the host macOS by connecting the application programs from the container to an X server on the host.  macOS does not run an X server by default, so the user needs to install and run one; the most popular is Xquartz, which can be run as follows:

  1. Go to the Xquartz website, select the latest download and install.
  2. Start XQuartz.
  3. Select XQuartzPreferencesSecurity
  4. Check “Allow connections from network clients” and “Authenticate connections”.
  5. Shut down and Restart XQuartz.

Step 5: Case-sensitive filing system

If the user’s filing system is not case-sensitive, then they can create a case-sensitive volume using the openfoam-macos-file-system script.  Install the script in the system-wide /usr/local/bin directory and make it executable by:

sudo curl -o /usr/local/bin/openfoam-macos-file-system http://dl.openfoam.org/docker/openfoam-macos-file-system
sudo chmod 755 /usr/local/bin/openfoam-macos-file-system

In default-mode, the script will create a volume named openfoam with size of 10GB, mounted at $HOME/openfoam, which includes a run directory corresponding to the $FOAM_RUN environment variable in the Docker container.  The defaults can be overridden using options listed by running with the help option by:

openfoam-macos-file-system -h

In particular, the user can set the size of the volume for their OpenFOAM data with “-s <size>” where size is in GB.  Commands exist to create, mount, unmount, delete and compact the volume:

  1. openfoam-macos-file-system -s 20 create : creates a 20GB file system.
  2. openfoam-macos-file-system mount : mounts the file system.
  3. openfoam-macos-file-system unmount : unmounts the file system.
  4. openfoam-macos-file-system automount : mounts the file system, automatically on machine boot.
  5. openfoam-macos-file-system delete : deletes the file system permanently, losing all data.

Step 6: Launching openfoam11-macos

The Docker container mounts the user’s file system so that case files are stored permanently. The container mounts the directory from where openfoam11-macos is launched by default, but the user can also specify the directory using the “-d” option.  Mounting the user’s $HOME directory is disallowed.  Where a case-sensitive volume has been created, the container mount directory would typically coincide with the mount directory (or sub-directory) of the volume.  For example, for a case-sensitive volume mounted in the default location, $HOME/openfoam, the Docker container is run without ParaView as follows:

cd $HOME/openfoam
openfoam11-macos

To run the container with ParaView, use the “-p” option, i.e.

openfoam11-macos -p

The first time the container is launched, there is a short wait while the image downloads and unpacks.  Note that mounted directory is represented in the container environment by the WM_PROJECT_USER_DIR environment variable.

Step 7: Testing openfoam11-macos

Assuming the run directory already exists (if not, run “mkdir -p $FOAM_RUN”), copy across the steady-state backward facing step example, generate the mesh with blockMesh and run foamRun with the incompressibleFluid solver module

cd $FOAM_RUN
cp -r $FOAM_TUTORIALS/incompressibleFluid/pitzDailySteady .
cd pitzDailySteady
blockMesh
foamRun
paraFoam

If ParaView is included in the container, then it can be run from the container by typing:

paraFoam

Refer to the OpenFOAM User Guide to get started.

Step 8: Exiting Docker

When finished using OpenFOAM in Docker exit the environment by typing:

exit

Reporting Issues

If you encounter an issue with this installation, please report it to the OpenFOAM Issue Tracking system.