This repository provides everything needed to build and run a containerized version of foam-extend-4.1 for both Docker and Apptainer (Singularity) environments, suitable for HPC clusters.
- Dockerfiles now use Ubuntu 16.04 and GCC 4.9 (per official release notes).
- Build scripts (
build-foamextended.sh,build-foamextended-optimized.sh) now load images locally by default (--load), with a--no-loadoption to disable this. - Apptainer support: Added
Singularity.def,build-foam-extend-apptainer.sh, andrun-foam-extend-apptainer.shfor easy container creation and execution on HPC systems.
- Base image:
ubuntu:16.04 - Compiler:
gcc-4.9andg++-4.9 - Builds:
foam-extend-4.1from source, applies all required patches and environment setup. - Entrypoint: Automatically configures the shell for foam-extend.
Automates building the Docker image.
Now loads the image locally by default (--load).
Add --no-load to skip loading.
Usage:
./build-foamextended.sh [options]Options:
-u, --usernameDocker Hub username (default: acchapm1)-i, --image-nameImage name (default: foam-extend)-v, --versionImage version tag (default: 4.1)-p, --platformTarget architecture (default: linux/amd64)--no-loadDo not load the image locally after build-h, --helpShow help
Supports multiple optimization levels and flattening.
Loads image locally by default unless --no-load is specified.
Use --push to push to Docker Hub.
- File:
Singularity.def - Base: Ubuntu 16.04, GCC 4.9, all dependencies, builds foam-extend-4.1
- Environment: Sets up all necessary variables for foam-extend
Use the provided script:
./build-foam-extend-apptainer.sh [output_image.sif](Default output: foam-extend-4.1.sif)
Or manually:
apptainer build foam-extend-4.1.sif Singularity.defUse the provided script:
./run-foam-extend-apptainer.sh [image.sif] [host_workdir] [extra_args...]image.sif(optional): Apptainer image (default: foam-extend-4.1.sif)host_workdir(optional): Host directory to mount as/work(default: current directory)extra_args...: Any extra arguments to pass to the container
Example:
./run-foam-extend-apptainer.sh foam-extend-4.1.sif $PWD icoFoam -helpOr run interactively:
apptainer shell foam-extend-4.1.sif#!/bin/bash
#SBATCH --job-name=foam_test
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=4
#SBATCH --mem=4G
#SBATCH --time=01:00:00
CASE_DIR="/path/to/your/case"
SIF_FILE="/path/to/foam-extend-4.1.sif"
apptainer exec --bind "${CASE_DIR}:/work" "${SIF_FILE}" icoFoam- Docker: Build and run locally or on any Docker-enabled system.
- Apptainer: Build and run on any HPC system with Apptainer/Singularity.
- Scripts: Provided for both build and run workflows, with flexible options.
See individual script comments and the Singularity.def for further details.