Palabos vs OpenFOAM on cloudHPC: lattice Boltzmann and finite volume on two classic benchmarks

Published by Ruggero Poletto on

Cylinder validation: Cd, Cl, Strouhal and Δp vs resolution for Palabos and OpenFOAM

TL;DR

  • Cylinder at Re = 100 (Schäfer–Turek 2D-2): both codes converge to the reference values. OpenFOAM lands inside all four reference bands with only 76k cells (Cd,max 3.228, Cl,max 0.999, St 0.301). Palabos gets there in lift, Strouhal and Δp but stays +2 % on drag at 80 nodes per diameter because of its staircase cylinder wall.
  • 3D Taylor–Green vortex at Re = 1600, 256³: Palabos reproduces the DNS dissipation rate within 1.0 % RMS (peak 0.01315 vs 0.01306); OpenFOAM is at 3.9 % and peaks early.
  • Speed and cost (256³, 96 vCPU): Palabos 3.6 min / €3.47 vs OpenFOAM 85 min / €33.50: about 23× faster and 10× cheaper on the same grid.
  • Scaling: Palabos goes from 23 min on 8 vCPU to 3.6 min on 96 vCPU (6.4× speed-up), but the cheapest run is the smallest machine (€0.90).
  • Right tool for the job: curved walls and complex boundaries at modest cell counts → OpenFOAM. Large, mostly-fluid, unsteady domains where throughput is everything → lattice Boltzmann.
Vortex street behind the cylinder, Palabos at 80 nodes per diameter

Why compare lattice Boltzmann and finite volume now

Lattice Boltzmann (LBM) codes are moving from research tools into engineering workflows: urban wind, data-centre cooling, porous media, biomedical flows. Their selling point is throughput: a simple, local update on a uniform grid that maps very well onto modern CPUs and GPUs. The question engineers ask us is practical: for the same physics, is an LBM code more accurate, faster, or cheaper than the finite-volume solver I already know?

We answered it on cloudHPC with two open-source codes:

  • Palabos, the Parallel Lattice Boltzmann Solver from the University of Geneva (C++, MPI);
  • OpenFOAM (ESI edition), the reference open-source finite-volume CFD toolbox.

A third code, OpenLB, was part of the plan. Its cases are ready, but its GPU build on cloudHPC needs a platform fix first; it will get its own follow-up post (see What we learned).

Results at a glance

CaseMetricReferencePalabos (finest)OpenFOAM (finest)
Cylinder 2D-2, Re = 100Cd,max3.22–3.243.296 (+2.0 %)3.228
Cl,max0.99–1.011.0040.999
Strouhal0.295–0.3050.3020.301
Δp [Pa]2.46–2.502.508 (+1.1 %)2.492
Taylor–Green 256³, Re = 1600Peak dissipation ε0.01306 at t = 8.940.01315 at t = 8.910.01179 at t = 8.40
RMS error of ε(t)—1.0 %3.9 %
Solve time / cost, 96 vCPU—217 s / €3.475105 s / €33.50

Bold = inside the reference band (cylinder) or best of the two (Taylor–Green).

How the runs were set up

  • Solvers: Palabos (current release on cloudHPC, compiled automatically from our C++ program, MPI) and OpenFOAM ESI (latest release on cloudHPC, pimpleFoam).
  • Hardware: cloudHPC hypercore instances (physical cores only, latest CPU generation). Validation runs on preemptible (spot) machines; all timing runs on regular instances, so no preemption could distort the times.
  • No turbulence model anywhere: both codes solve the flow directly.
  • Same lattice/grid parameters across resolutions: Palabos D2Q9/D3Q19 with acoustic scaling (lattice velocity of the mean inflow 0.05, Mach ≈ 0.09); OpenFOAM second-order in space (linear) and time (backward).
  • All input files are available on request and the step-by-step setup is below.

Case 1: Schäfer–Turek 2D-2, unsteady flow around a cylinder

Case 1 setup: channel 2.2 × 0.41 m, cylinder D = 0.1 m at (0.2, 0.2), parabolic inflow

Setup. The DFG benchmark of Schäfer & Turek (1996): a 2.2 × 0.41 m channel, a cylinder of diameter 0.1 m slightly off the centreline, parabolic inflow with mean velocity 1 m/s, ν = 10⁻³ m²/s, so Re = 100. The flow sheds a regular von Kármán street. We measure maximum drag and lift coefficient, the Strouhal number and the pressure difference between the front and back of the cylinder, and compare them with the published reference intervals. Each run simulates 8 s and the metrics use the last 3 s.

  • Palabos: regularized BGK, local velocity/pressure boundaries, cylinder as a staircase of bounce-back nodes with momentum-exchange force evaluation. Resolutions: 20, 40 and 80 nodes per diameter (36k to 579k nodes).
  • OpenFOAM: structured O-grid built with blockMesh (5k, 19k and 76k cells), parabolic inlet with the fixedProfile boundary condition, forceCoeffs and probes function objects.

Results.

Cylinder validation: Cd, Cl, Strouhal and Δp vs resolution for Palabos and OpenFOAM
RunSizeCd,maxCl,maxStΔp [Pa]MachineCost
Palabos N = 2036k nodes3.5581.1420.2952.558hypercore 8, one job€0.33 (all three)
Palabos N = 40145k nodes3.3411.0310.3012.519
Palabos N = 80579k nodes3.2961.0040.3022.508
OpenFOAM M204.7k cells3.1620.8830.2912.453hypercore 2€0.08
OpenFOAM M4019k cells3.2150.9790.2992.487hypercore 2€0.14
OpenFOAM M8076k cells3.2280.9990.3012.492hypercore 2€0.53
Reference (Schäfer & Turek)3.22–3.240.99–1.010.295–0.3052.46–2.50

What we learned.

  • Body-fitted meshes win on curved walls. OpenFOAM’s O-grid follows the cylinder exactly, so 76k cells are enough to sit inside every reference band. Palabos approaches the band from above and, at 80 nodes per diameter, still over-predicts peak drag by 2 %: the staircase wall makes the cylinder effectively a little larger. LBM codes offer curved (interpolated) wall treatments for exactly this reason; with them the error drops at much lower resolution. This is the point to check before choosing an LBM code for external aerodynamics.
  • Watch the acoustics in LBM. Lattice Boltzmann is weakly compressible. Our first Palabos run started the inflow impulsively and excited the channel’s acoustic quarter-wave mode (about 1.3 Hz, the lattice speed of sound over four channel lengths), which polluted the drag signal. A smooth 2 s ramp of the inflow, as recommended in the LBM literature and in OpenLB’s own example, removed it. Finite-volume incompressible solvers do not have this issue.
  • Throughput is already visible in 2D. Palabos ran the finest case (579k nodes, 128,000 time steps) in 3 minutes on 8 cores at 404 million lattice updates per second (MLUPS).

Case 2: 3D Taylor–Green vortex at Re = 1600

Case 2 setup: periodic 2π box, analytical initial velocity and pressure fields

Setup. A periodic box [0, 2π]³ initialised with the Taylor–Green velocity and pressure fields (V₀ = 1 m/s, L = 1 m, ν = 1/1600 m²/s). The vortices stretch, break down into small-scale turbulence around t ≈ 9 and decay. We record the volume-averaged kinetic energy Eₖ every 0.05 s and compare its dissipation rate ε = −dEₖ/dt with the DNS of Brachet et al. (1983). There are no walls and no boundary conditions, so the comparison isolates the numerical method.

  • Palabos: D3Q19, BGK collision (the regularized model was 7× slower in 3D for this case), consistent initial density from the analytical pressure.
  • OpenFOAM: pimpleFoam, cyclic patches, initial fields with #codeStream, fixed Δt (Courant ≈ 0.2), kinetic energy from volFieldValue.
  • Grids: 128³ (2.1 M) and 256³ (16.8 M) nodes/cells.

Accuracy.

Dissipation rate vs time for Palabos and OpenFOAM at 128³ and 256³ against the Brachet DNS
GridCodePeak εat tRMS error vs DNS
—Brachet et al. DNS0.013068.94—
128³Palabos0.012528.542.4 %
OpenFOAM0.013498.458.1 %
256³Palabos0.013158.911.0 %
OpenFOAM0.011798.403.9 %

Speed, scaling and cost (256³).

Solve time and billed cost vs vCPU for Palabos and OpenFOAM at 256³
CodevCPUSolve timeThroughputSpeed-up vs 8 vCPUParallel efficiencyBilled cost
Palabos81390 s98 MLUPS1.0×100 %€0.90
16944 s145 MLUPS1.5×74 %€1.31
32532 s257 MLUPS2.6×65 %€1.87
48333 s411 MLUPS4.2×70 %€2.10
96217 s629 MLUPS6.4×53 %€3.47
OpenFOAM3213067 s6.53 s/step1.0× (vs 32)100 %€27.03
4810441 s5.22 s/step1.25×83 %€32.39
965105 s2.55 s/step2.56×85 %€33.50

What we learned.

  • On a periodic, fully resolved flow, LBM is both faster and closer to the DNS. At 256³ Palabos needs 3.6 minutes on 96 cores and matches the reference within 1 %. OpenFOAM needs 85 minutes on the same machine for a 3.9 % error. The difference is the algorithm: Palabos does one local, memory-bound update per node per step; OpenFOAM solves a pressure equation every step, and at 16.8 M cells the GAMG solver needs up to 25 iterations per final corrector.
  • Palabos is memory-bandwidth bound. Doubling cores does not halve the time (53 % efficiency at 96 vCPU). Buy cores for turnaround, not for savings: the 8-vCPU run is the cheapest (€0.90), the 96-vCPU run the fastest (3.6 min).
  • OpenFOAM scales well, so for it the big machine is nearly free. From 32 to 96 vCPU it runs 2.56× faster at 85 % efficiency, and the cost per run only rises from €27 to €34. From 48 to 96 vCPU it is 2.05× faster, slightly better than ideal.
  • The pressure solver dominates the cost of finite-volume runs at this size. That is the honest price of an incompressible formulation, and also where OpenFOAM users can gain the most (solver settings, tolerances, time-step size).

Failures as they happened on cloudHPC

Benchmarks are only useful if they show what went wrong too.

  • Impulsive start in Palabos (cylinder): acoustic standing wave in the drag signal, Cd,max too high at N = 40. Fix: 2 s cosine ramp of the inflow.
  • Pressure probes on the wall: at (0.15, 0.2) and (0.25, 0.2) the probe falls on a solid bounce-back node in a staircase cylinder and returns Δp = 0. Fix: sample the first fluid node in front of and behind the cylinder.
  • OpenFOAM fixedProfile with a vector polynomial: the exponent must be a vector too, ((14.63 0 0) (1 1 1)), otherwise the case stops with Expected a ‘(‘ while reading VectorSpace.
  • OpenLB: the cloudHPC build is a CUDA build; on a CPU machine it stops with libcuda.so.1: cannot open shared object file, and on the T4 GPU nodes it reported No CUDA device found. It is being fixed on the platform side; OpenLB results will follow in a separate post.

Run times and costs

BatchRunsInstancesCost
Cylinder 2D-2Palabos N20/40/80, OpenFOAM M20/40/80hypercore 8 and 2, spot€1.08
Taylor–Green 128³Palabos (8 vCPU), OpenFOAM (16 vCPU)hypercore, spot€0.96
Taylor–Green 256³, Palabos8 / 16 / 32 / 48 / 96 vCPUhypercore, regular€9.65
Taylor–Green 256³, OpenFOAM32 / 48 / 96 vCPUhypercore, regular€92.92
Taylor–Green 256³, OpenFOAM16 vCPU, stopped to limit costhypercore, regular€6.82

Billed costs include instance start-up, compilation (Palabos) and result upload, which is why short runs on large machines cost relatively more.

How to run these cases on cloudHPC

Palabos

  1. Put your C++ program (a .cpp with main()) and exactly one .xml parameter file in a folder. To run several cases in one job, use one sub-folder per case: they run one after the other, each on all cores.
  2. Your own CMakeLists.txt is ignored: cloudHPC compiles the program against its Palabos build (C++17, optimised, MPI). Code that builds with the standard Palabos examples builds here too.
  3. Pick hypercore or highcore (one MPI process per physical core). For 3D LBM, check the collision model’s speed first: in our test plain BGK ran at 25 MLUPS on two cores against 3.5 MLUPS for the regularized BGK.
  4. Logs: log.compile for compilation errors, log.<program> for the run.

OpenFOAM

  1. Upload a standard case (0/, constant/, system/). Without constant/polyMesh, cloudHPC runs blockMesh (or snappyHexMesh / cfMesh) automatically, then decomposePar with the right number of subdomains.
  2. #codeStream initial conditions and coded boundary conditions are compiled on the machine.
  3. Use hypercore or highcore with at least ~50k cells per core; at 256³ the pressure solve dominates, so test solver tolerances before a long run.
  4. Results are reconstructed automatically and a case.foam file is created for ParaView.

Both: use regular instances for timing studies and spot instances for everything else; download your results, storage is cleaned after 60 days.

FAQ

Is lattice Boltzmann more accurate than finite volume?

Not in general. In our tests Palabos was more accurate on the periodic Taylor–Green vortex (1.0 % vs 3.9 % RMS error at 256³), while OpenFOAM was more accurate on the cylinder with fewer cells, because its body-fitted mesh represents the curved wall exactly.

How much faster is Palabos than OpenFOAM?

On the 256³ Taylor–Green vortex with 96 vCPU, Palabos solved in 217 s and OpenFOAM in 5105 s, about 23× faster, at roughly a tenth of the cost. The gap depends on the case: flows dominated by complex walls or needing local refinement narrow it.

Does Palabos scale well on cloud CPUs?

It scales, but it is memory-bandwidth bound: 6.4× speed-up from 8 to 96 vCPU (53 % efficiency). The smallest machine gives the lowest cost per run, larger machines the shortest turnaround.

Why did the LBM drag oscillate at the start of the cylinder run?

LBM is weakly compressible: an impulsive inflow launches pressure waves that resonate in the channel. A smooth ramp of the inflow over a few flow-through times removes them.

Can I run OpenLB on cloudHPC?

OpenLB is installed as a GPU (CUDA) build. A platform issue currently prevents it from running; the OpenLB part of this comparison will be published as soon as it is fixed.

References

  • M. Schäfer, S. Turek, Benchmark Computations of Laminar Flow Around a Cylinder, in: Flow Simulation with High-Performance Computers II, Notes on Numerical Fluid Mechanics 48, Vieweg, 1996, pp. 547–566. doi:10.1007/978-3-322-89849-4_39
  • M. E. Brachet, D. I. Meiron, S. A. Orszag, B. G. Nickel, R. H. Morf, U. Frisch, Small-scale structure of the Taylor–Green vortex, Journal of Fluid Mechanics 130 (1983) 411–452. doi:10.1017/S0022112083001159
  • J. Latt et al., Palabos: Parallel Lattice Boltzmann Solver, Computers & Mathematics with Applications 81 (2021) 334–350. doi:10.1016/j.camwa.2020.03.022
  • H. G. Weller, G. Tabor, H. Jasak, C. Fureby, A tensorial approach to computational continuum mechanics using object-oriented techniques, Computers in Physics 12 (1998) 620–631. doi:10.1063/1.168744
  • Palabos project: palabos.unige.ch · OpenFOAM: openfoam.com
  • Brachet et al. dissipation-rate data at Re = 1600 as distributed with the OpenLB tgv3d example: openlb.net
  • AWS HPC Blog, Lattice Boltzmann simulation with Palabos on AWS using Graviton-based Amazon EC2 Hpc7g instances: aws.amazon.com

CloudHPC is a HPC provider to run engineering simulations on the cloud. CloudHPC provides from 1 to 224 vCPUs for each process in several configuration of HPC infrastructure - both multi-thread and multi-core. Current software ranges includes several CAE, CFD, FEA, FEM software among which OpenFOAM, FDS, Blender and several others.

New users benefit of a FREE trial of 300 vCPU/Hours to be used on the platform in order to test the platform, all each features and verify if it is suitable for their needs


Categories: OpenFOAMPalabos