Skip to content

OpenFOAMOpenFOAM

OpenFOAM is an open-source Computational Fluid Dynamics (CFD) software.

This Kubernetes chart will deploy OpenFOAM for distributed computing using OpenMPI, which runs a cluster of worker nodes controlled by a single master node.

The latest container images are available from

https://hub.docker.com/r/opencfd/openfoam-default/tags

You can also build OpenFOAM from a custom source using Dockerfiles, starting with

https://develop.openfoam.com/packaging/containers

Helm Chart on GitLab

Installation

Install the app through Rancher.

Login with SSH

Open the App openfoam in Rancher, and check which external port to use for SSH.

ssh -p 30684 openfoam@nodeport.icedc.se -t '/openfoam/run'

Available users are openfoam and root.

Shared volume

Master and worker nodes share the same home directory /home/openfoam by rook-ceph-fs persistent volume.

Sync a file system with SSHFS

Connect with SSHFS

sshfs openfoam@nodeport.icedc.se:/home/openfoam ~/local_dir -C -p 30684

Download with S3 storage

To download result data, rclone can be used with ICE Connect S3 Storage

zip -r motorBike.zip ~/motorBike
rclone copy motorBike.zip s3:my-bucket/motorBike.zip

S3 access and secret keys are configured in ~/.config/rclone/rclone.conf

Add/remove worker nodes

Worker nodes are listed in /kube-openmpi/generated/hostfile

openfoam-master.openfoam slots=64 max_slots=64
openfoam-worker-0.openfoam slots=64 max_slots=64
openfoam-worker-1.openfoam slots=64 max_slots=64

slots represent max available CPU threads, max_slots limits over-subscription, as in the OpenMPI documentation.

By default, worker nodes reserve 1 CPU thread but are allowed to use the maximum number of threads if available. Increase/decrease the number of workers through Rancher.

Nodes can access each other by SSH, e.g.

openfoam@openfoam-master:~$ ssh openfoam-worker-0.openfoam
openfoam@openfoam-worker-0:/$

Run motorBike demo

Log in and perform the initial setup on the master node

cp -r "$FOAM_TUTORIALS"/incompressible/simpleFoam/motorBike ~
cd ~/motorBike
mkdir -p constant/triSurface
cp -f "$FOAM_TUTORIALS"/resources/geometry/motorBike.obj.gz constant/triSurface/
surfaceFeatureExtract
blockMesh
cp system/decomposeParDict.6 system/decomposeParDict
decomposePar
ls -d processor* | xargs -I {} \rm -rf ./{}/0
ls -d processor* | xargs -I {} \cp -r 0.orig ./{}/0 > /dev/null 2>&1
ln -s /kube-openmpi/generated/hostfile .

The following foamJob sends OpenMPI commands to worker nodes

foamJob -screen -parallel snappyHexMesh -overwrite
foamJob -screen -parallel topoSet
foamJob -screen -parallel patchSummary
foamJob -screen -parallel potentialFoam -writephi
foamJob -screen -parallel checkMesh -writeFields '(nonOrthoAngle)' -constant
time foamJob -screen -parallel simpleFoam

Reconstruct the decomposed mesh

reconstructParMesh -constant
reconstructPar -latestTime

Graphical tools such as paraFoam are not supported in the Kubernetes app, because of performance limitations. It is recommended to download the results locally for post-processing.

scp -r -P 30684 openfoam@nodeport.icedc.se:/home/openfoam/motorBike /home/myname

paraview