OpenFOAM
Videos
Overview: OpenFOAM 14 CFD Toolkit on Ubuntu 24.04 on Azure: overview (watch on YouTube)
Launch and log in: OpenFOAM 14 CFD Toolkit on Ubuntu 24.04 on Azure: launch and log in (watch on YouTube)
Deep Dive: OpenFOAM 14 CFD Toolkit on Ubuntu 24.04 on Azure: deep dive (watch on YouTube)
Overview
OpenFOAM is a leading open-source toolkit for computational fluid dynamics (CFD). It ships a large library of solvers and physics models covering incompressible and compressible flow, heat transfer, turbulence, multiphase flow and reacting flow. It also includes mesh generation, mesh manipulation and post-processing utilities, so a complete simulation workflow from geometry to results runs entirely on the command line.
This SecureAnyCloud image packages OpenFOAM 14 on Ubuntu 24.04 on Azure. It uses the OpenFOAM Foundation distribution from openfoam.org, released under the GNU General Public License version 3.
This image is a headless compute appliance. OpenFOAM has no web interface. You connect over SSH and run meshers, solvers and utilities from the command line, exactly as you would on a local workstation or an HPC login node. The whole toolkit is installed under /opt/openfoam14 and is placed on the PATH of every interactive login shell, so there is nothing to build, source or configure before your first run.
The modular solver runtime. OpenFOAM 11 and later replaced the old per-application solvers with a single modular runtime, foamRun. A case describes its mesh, physics and numerics as plain-text dictionaries and selects a physics module with the solver keyword in system/controlDict. You then run the case in two steps: generate the mesh with blockMesh (or snappyHexMesh), and launch the solver with foamRun. The bundled lid-driven cavity tutorial used throughout this guide selects solver incompressibleFluid; and needs no extra flags.
Security by design. This appliance holds no secret and runs no network service:
- No baked-in credential of any kind. OpenFOAM is a toolkit, not a service, so the image contains no product password, no service account and no shared key. The only routable listener is SSH on port 22, which authenticates with your own Azure-injected key.
- A unique host identity per VM. The SSH host keys and the machine ID are regenerated on first boot, so no two VMs launched from this image share a host fingerprint.
- Proven, not assumed. Before an image is published, it is verified by solving a bundled tutorial end to end: meshing, running the solver and checking the real result files. The machine you launch is verified to run a simulation, not merely to contain the software.
What you get:
- OpenFOAM 14 (package
openfoam14, version20260724) installed from the official openfoam.org apt repository under/opt/openfoam14, with the complete set of solvers, meshers and utilities - The full tutorials tree at
/opt/openfoam14/tutorials, covering every solver family and ready to copy and run - ParaView and
paraFoamfor post-processing and visualization /etc/profile.d/openfoam.sh, which loads the OpenFOAM environment for every interactive login shell so the toolkit is on yourPATHat once- The openfoam.org apt source left in place, so
sudo apt update && sudo apt install --only-upgrade openfoam14keeps the toolkit current - Unattended security upgrades left enabled, so the operating system keeps receiving patches
Prerequisites
You need an active Azure subscription, an SSH public key, a VNet and subnet in the target region, and a subscription to this listing on Azure Marketplace.
Configure a network security group (NSG) that allows TCP 22 for SSH administration. This appliance opens no other port.
Recommended virtual machine size: CFD is compute-bound and memory-bound. Standard_F4s_v2 (4 vCPU, 8 GB RAM) is a sensible starting point for the tutorials and for small to medium cases. For production meshes, choose a compute-optimized size with more vCPU and memory, such as Standard_F16s_v2, Standard_F32s_v2 or an HB-series HPC size, and run the solver in parallel as shown later in this guide. Standard_B2s (2 vCPU, 4 GB) is adequate for evaluation and for working through this guide.
Deploy the virtual machine
Deploy from the Azure Portal by selecting the image from Azure Marketplace, choosing your VM size and supplying your SSH public key for the azureuser account. Alternatively, deploy from the Azure CLI.
Run these commands on your own workstation, not on the VM:
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:openfoam-ubuntu-24-04:default:latest
az vm create \
--resource-group my-resource-group \
--name my-openfoam-vm \
--image sac1647283583153:openfoam-ubuntu-24-04:default:latest \
--size Standard_F4s_v2 \
--admin-username azureuser \
--generate-ssh-keys \
--public-ip-sku StandardConnect over SSH once the VM is running:
ssh azureuser@<vm-ip>Confirm the toolkit is ready
The OpenFOAM environment loads automatically for interactive login shells, so blockMesh, foamRun, snappyHexMesh and the rest of the toolkit are already on your PATH when you connect. In scripts and non-login shells, load the environment explicitly by sourcing the shipped environment file. Every command block in this guide does this, so each block is self-contained:
. /opt/openfoam14/etc/bashrc echo "OpenFOAM version: $WM_PROJECT_VERSION" command -v blockMesh foamRun snappyHexMesh checkMeshExpected output
OpenFOAM version: 14 /opt/openfoam14/platforms/linux64GccDPInt32Opt/bin/blockMesh /opt/openfoam14/platforms/linux64GccDPInt32Opt/bin/foamRun /opt/openfoam14/platforms/linux64GccDPInt32Opt/bin/snappyHexMesh /opt/openfoam14/platforms/linux64GccDPInt32Opt/bin/checkMeshThe bundled tutorials cover every solver family and are the fastest way to see the toolkit at work. List them:
. /opt/openfoam14/etc/bashrc ls "$FOAM_TUTORIALS"Expected output
Allclean incompressibleVoF Allrun isothermalFilm Alltest isothermalFluid XiFluid legacy compressibleMultiphaseVoF mesh compressibleVoF movingMesh film multiRegion fluid multicomponentFluid incompressibleDenseParticleFluid ... incompressibleDriftFlux incompressibleFluid incompressibleMultiphaseVoFSet up a working copy of a tutorial
Do not run cases in the read-only system tutorials directory. Copy a case into your own working directory first. This guide uses the classic lid-driven cavity, an incompressible flow in a square cavity with a moving top wall:
. /opt/openfoam14/etc/bashrc mkdir -p "$HOME/run" rm -rf "$HOME/run/cavity" cp -r "$FOAM_TUTORIALS/incompressibleFluid/cavity" "$HOME/run/cavity" ls "$HOME/run/cavity"Expected output
0 constant systemA case is three directories of plain text. 0 holds the initial and boundary conditions for each field, constant holds the mesh and physical properties, and system holds the run control, discretization schemes and solver settings. foamRun reads the solver incompressibleFluid; line in system/controlDict to pick the physics module.
Generate the mesh
blockMesh builds the mesh from the block description in system/blockMeshDict, and checkMesh validates its geometry and topology:
. /opt/openfoam14/etc/bashrc cd "$HOME/run/cavity" blockMesh 2>&1 | tail -14 checkMesh 2>&1 | tail -6Expected output
Mesh Information ---------------- boundingBox: (0 0 0) (0.1 0.1 0.01) nPoints: 882 nCells: 400 nFaces: 1640 nInternalFaces: 760 ---------------- Patches ---------------- patch 0 (start: 760 size: 20) name: movingWall patch 1 (start: 780 size: 60) name: fixedWalls patch 2 (start: 840 size: 800) name: frontAndBack End Non-orthogonality check OK. Face pyramids OK. Max skewness = 1.66533e-14 OK. Coupled point location match (average 0) OK. Mesh OK.The cavity is now ready to solve: a 400-cell mesh with three named patches, and checkMesh reporting Mesh OK.
Run the solver
Launch the solver. foamRun reads solver incompressibleFluid; from system/controlDict, advances the flow to the case end time (endTime 10) and writes results at the configured interval:
. /opt/openfoam14/etc/bashrc cd "$HOME/run/cavity" foamRun 2>&1 | tail -14Expected output
Courant Number mean: 0.122786 max: 0.251756 Time = 10s smoothSolver: Solving for Ux, Initial residual = 3.32735e-05, Final residual = 1.72577e-06, No Iterations 1 smoothSolver: Solving for Uy, Initial residual = 3.20368e-05, Final residual = 1.70576e-06, No Iterations 1 GAMG: Solving for p, Initial residual = 4.44198e-05, Final residual = 3.98854e-06, No Iterations 2 time step continuity errors : sum local = 6.57107e-09, global = -3.27564e-20 smoothSolver: Solving for epsilon, Initial residual = 6.89439e-05, Final residual = 4.04349e-06, No Iterations 1 smoothSolver: Solving for k, Initial residual = 0.000133634, Final residual = 8.22366e-06, No Iterations 1 ExecutionTime = 3.39612 s ClockTime = 4 s EndFalling residuals and small, stable continuity errors show that the solver is converging. End on the final line shows that the run completed cleanly. This small case solves in a few seconds.
Inspect the results
Every write interval produces a time directory that holds the solved fields. List the directories, then look inside the final one:
. /opt/openfoam14/etc/bashrc cd "$HOME/run/cavity" foamListTimes | tail -5 ls ls 10Expected output
8 8.5 9 9.5 10 0 1.5 3 4.5 6 7.5 9 constant 0.5 10 3.5 5 6.5 8 9.5 system 1 2 4 5.5 7 8.5 U epsilon k nut p phi uniformThe 10 directory holds the final solved velocity field U, pressure p, turbulence fields epsilon, k and nut, and the face flux phi. Derive quantities from the solved fields with the postProcess utility. For example, the following command computes the Cartesian components of velocity at the latest time:
. /opt/openfoam14/etc/bashrc cd "$HOME/run/cavity" postProcess -func 'components(U)' -latestTime 2>&1 | tail -8Expected output
Executing functionObjects functionObjects::components components(U) writing field: Ux functionObjects::components components(U) writing field: Uy functionObjects::components components(U) writing field: Uz EndpostProcess writes the individual velocity components alongside the solved fields, ready to sample, plot or export. This is a complete CFD workflow, from geometry to mesh to solution to derived quantities, run entirely from the command line.
Visualize the results
paraFoam launches ParaView on the case for interactive 3D visualization. ParaView is a graphical application, so use it over an X11-forwarded SSH session (ssh -X azureuser@<vm-ip>). On a headless server, it is more common to generate a case file and open the results in ParaView on your own workstation:
. /opt/openfoam14/etc/bashrc cd "$HOME/run/cavity" touch case.foamCopy the case directory to a machine with ParaView installed and open case.foam, or run paraFoam directly if you have an X server. For automated or batch post-processing, the postProcess utility and the function object framework (sampling lines and surfaces, computing forces and integrating fluxes) cover most needs without a GUI.
Run in parallel
Real cases are solved across multiple cores. OpenFOAM decomposes the mesh with decomposePar, runs the solver under MPI and then reconstructs the result. On a multi-core VM, run:
. /opt/openfoam14/etc/bashrc cd "$HOME/run/cavity"
# write a decomposeParDict for N subdomains (create one if the case has none) decomposePar -force > log.decomposePar 2>&1 mpirun -np 4 foamRun -parallel > log.foamRun.parallel 2>&1 reconstructPar > log.reconstructPar 2>&1 tail -3 log.reconstructParSet numberOfSubdomains to the number of cores you want to use, and keep it at or below the VM's vCPU count. decomposePar splits the mesh into that many subdomains, mpirun -np N foamRun -parallel solves them together, and reconstructPar merges the per-processor results back into single time directories.
The cavity is far too small to benefit from parallelism, but the workflow is identical for a production mesh, where parallelism is essential.
Server components
Component Version Purpose
OpenFOAM (openfoam14) 20260724 (release 14) Full CFD toolkit: solvers, meshers, utilities, tutorials
blockMesh, snappyHexMesh 14 Mesh generation
foamRun, foamMultiRun 14 Modular solver runtime
checkMesh, postProcess, foamDictionary 14 Mesh validation, post-processing, case editing
ParaView / paraFoam bundled with OpenFOAM 14 Visualization
Open MPI Ubuntu 24.04 Parallel (distributed) solver runs
Ubuntu Server 24.04 LTS Operating system
Filesystem layout
Path Purpose
/opt/openfoam14 The OpenFOAM 14 installation (binaries, libraries, source, docs)
/opt/openfoam14/etc/bashrc The OpenFOAM environment file
/opt/openfoam14/platforms/linux64GccDPInt32Opt/bin Solver, mesher and utility binaries
/opt/openfoam14/tutorials The full tutorials tree, one directory per solver family
/opt/openfoam14/COPYING The GNU General Public License version 3
/etc/profile.d/openfoam.sh Loads the OpenFOAM environment for interactive login shells
/etc/apt/sources.list.d/openfoam.list The openfoam.org apt source, for updates
$HOME/run Suggested working directory for your own cases (not created by the image)
Network ports
Port Bound to Purpose
22 all interfaces SSH administration and command line access
This appliance runs no network service and opens no other port. In the NSG, restrict TCP 22 to your own management address range.
Keeping OpenFOAM up to date
The openfoam.org apt source ships in the image, so you can pull newer OpenFOAM 14 point releases as the Foundation publishes them. Run:
sudo apt update
sudo apt install --only-upgrade openfoam14To move to a future major release (for example, a later openfoamNN package), install that package alongside the current one. Packages from openfoam.org coexist under /opt, and you select one by sourcing its own etc/bashrc.
Troubleshooting
blockMesh: command not found or the OpenFOAM commands are missing. The environment is not loaded in this shell. Source it with . /opt/openfoam14/etc/bashrc. It loads automatically for interactive login shells, but non-login shells and scripts must source it explicitly.
FOAM FATAL IO ERROR or cannot find file when running a solver. You are not in a valid case directory, or the mesh has not been generated yet. Change into the case directory, and run blockMesh before foamRun.
FOAM FATAL ERROR: ... has not been read or a missing dictionary. The case is incomplete, or the module named by solver in system/controlDict does not match the case's fields. Start from a copy of a bundled tutorial, which is consistent by construction, and modify it incrementally.
A parallel run fails to start. Check that numberOfSubdomains in system/decomposeParDict matches the -np value passed to mpirun, and that it does not exceed the VM's vCPU count. After changing it, run decomposePar -force again.
Confirm the toolkit at any time:
. /opt/openfoam14/etc/bashrc echo "$WM_PROJECT_VERSION" foamInstallationTest 2>&1 | tail -20foamInstallationTest checks the whole installation and reports each component as ok.
Security recommendations
- Restrict TCP 22 to your own address range. SSH is the only listener. Scope the NSG rule to your management network rather than opening it to the internet.
- Run simulations as a normal user, not root. OpenFOAM is designed to run as an ordinary user, and the
azureuseraccount is all you need. - Keep OpenFOAM and the operating system updated with the commands above, and leave unattended security upgrades enabled.
- Take Azure snapshots or store results off the VM. Simulation output on the OS disk is not backed up. Copy finished cases to blob storage, or snapshot the disk on a schedule that matches how much compute you can afford to repeat.
Support
SecureAnyCloud images are backed by 24/7 support. For help with this image, contact support through the Azure Marketplace listing or visit secureanycloud.com.
OPENFOAM is a registered trademark of OpenCFD Ltd, and is used here nominatively only to identify the software packaged. This image packages the unmodified OpenFOAM Foundation (openfoam.org) distribution of OpenFOAM 14, which is distributed under the GNU General Public License version 3. The license text ships on the image at /opt/openfoam14/COPYING.
SecureAnyCloud is not affiliated with, endorsed by, or sponsored by OpenCFD Ltd or the OpenFOAM Foundation.
Deploy on Azure
Launch OpenFOAM 14 Computational Fluid Dynamics Toolkit on Ubuntu 24.04 on Azure with 24/7 support from SecureAnyCloud.
View this image
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com