import os
import numpy as np
import matplotlib.pyplot as plt
DATA = "data"
plt.rcParams.update({"figure.dpi": 130, "font.size": 10, "axes.grid": True,
"grid.alpha": 0.3, "axes.axisbelow": True,
"figure.facecolor": "white", "savefig.bbox": "tight"})
C_PECLET, C_TBF, C_TBFNS = "#2a78d6", "#e34948", "#f0a04b"
def ld(name):
p = os.path.join(DATA, name + ".npz")
return np.load(p, allow_pickle=True) if os.path.exists(p) else None
pec, tbf, tbfns = ld("peclet_closed"), ld("tbf_closed_t150"), ld("tbf_closed_nosmooth_t150")
RUNS = ((pec, C_PECLET, "peclet.flow"), (tbf, C_TBF, "TBFsolver"),
(tbfns, C_TBFNS, "TBFsolver, no smoothing"))
T0, T1 = 50.0, 150.0
def first(a): # TBFsolver stores 3-vectors, peclet the vertical component
a = np.asarray(a)
return a[:, 0] if a.ndim == 2 else aA bubble column, run twice: peclet.flow vs TBFsolver
Sixteen deformable bubbles rising in a closed column between two walls, on the same grid from the same initial state, in peclet’s multiple-marker VoF and in TBFsolver — the reference implementation of that method — with an isolated-bubble, a drafting-pair and a published-swarm check to say where they agree and where they do not.
What this measures
A bubble column is the simplest bubbly flow with a large-scale structure of its own: gas rises, the liquid it displaces has to come back down, and in a closed column it does so along the walls. This page runs one such column with two codes that implement the same method:
- TBFsolver (Cifani et al., “Highly scalable DNS solver for turbulent bubble-laden channel flow”, Computers & Fluids 2018) — the MPI+OpenMP Fortran code that introduced multiple-marker VoF on moving blocks: every bubble carries its own volume-fraction field on its own small box, so two bubbles that touch can never merge numerically.
peclet.flow— the same container (one Weymouth–Yue geometric VoF field per bubble on a moving box, the union colour \(\max_k C_k\) for density and viscosity, each bubble’s own balanced-force surface tension summed into the momentum equation) on Kokkos.
Both runs use the same 128 × 96 × 64 cubic grid, the same 16 bubble centres, the same physical parameters and the same closed-column forcing, so every difference below is a difference of discretisation, not of set-up.
An earlier version of this page ran peclet without momentum advection, which peclet.flow then did by default, and with the Laplacian form of the viscous term. Its peclet numbers were wrong, and so was its conclusion that the two codes differ in the column. The numbers here are with momentum advection and the full viscous stress (peclet.flow 9cb691a, 2026-10-25), except the CPU timings in Cost, which are labelled.
Three defects, none of which the regression suite could see:
- Colliding bubbles blew up — garbage curvature on sub-cell debris one marker leaves inside another (below).
- A bubble touching the lower wall leaked volume (up to 3 % per bubble within 40 time units): the per-bubble advection read a non-zero velocity on the lower domain face, where the wall has none.
- Bubbles collected at the lower wall — in the case and in its mirror image. The variable viscosity sat half a cell off the staggered control volume, which made the viscous term first order and, in the wall-normal direction, asymmetric. A mirror-symmetry test now guards it.
These fixes are in every result on this page.
The case
Units: bubble diameter \(D\), liquid density \(\rho_l\) and gravity \(g\) are 1. The bubbles are case E1 of Loisy, Naso & Spelt (J. Fluid Mech. 816, 2017) — Archimedes number \(Ar = \sqrt{\rho_l(\rho_l-\rho_g) g D^3}/\mu_l = 29.9\) and Bond number \(Bo = (\rho_l-\rho_g) g D^2/\sigma = 2.0\), weakly ellipsoidal bubbles whose isolated rise Reynolds number is about 31 (Loth 2008) — with density and viscosity ratios \(\rho_g/\rho_l = \mu_g/\mu_l = 0.02\) as in Bunner & Tryggvason (J. Fluid Mech. 466, 2002).
| column | \(8D\) tall (periodic), \(6D\) between the no-slip walls, \(4D\) deep (periodic) |
| grid | 128 × 96 × 64 cubic cells, \(D/h = 16\) (checks at 24) |
| bubbles | 16, a perturbed 4 × 2 × 2 array; void fraction 4.36 % |
| forcing | \((\rho - \langle\rho\rangle)\,g\) along the column, and zero net volume flux |
| run | \(t = 0 \ldots 150\,\sqrt{D/g}\); statistics over \(t \in [50, 150]\) |
| pressure | exact variable-coefficient projection, MG-PCG to relative residual \(10^{-8}\) |
The zero-net-flux constraint makes this a batch column: without it, the liquid descending along the walls feels an upward wall friction that nothing balances, and the whole column develops a growing net upflow. Both codes remove the mean volume flux every step (TBFsolver flowCtrl 2, peclet set_superficial_velocity(True, "x", 0.0)).
TBFsolver by default smooths density and viscosity across the interface; peclet does not. We ran TBFsolver both ways.
Rise speed
The observable is the drift velocity — the gas-phase mean velocity relative to the volume-averaged mixture velocity, positive upward — computed identically from both codes’ fields.
fig, ax = plt.subplots(figsize=(6.5, 3.2))
ax.axvspan(T0, T1, color="0.93", zorder=0)
for z, c, lab in RUNS:
ax.plot(z["t"], z["rise_speed"], color=c, lw=1.1, label=lab)
ax.set_xlabel(r"$t\,\sqrt{g/D}$")
ax.set_ylabel(r"drift velocity $/\sqrt{gD}$")
ax.legend(loc="lower right")
plt.show()
for z, c, lab in RUNS:
m = (z["t"] >= T0) & (z["t"] <= T1)
a, ul = z["alpha_y"][m], z["u_liq_y"][m]
slip = -(first(z["u_gas"][m]) - (a * ul).sum(1) / a.sum(1))
w = z["rise_speed"][m]
print(f"{lab:24s} drift {w.mean():.3f} +- {w.std():.3f} slip relative to the "
f"liquid around the gas {slip.mean():.3f}")
peclet.flow drift 0.806 +- 0.014 slip relative to the liquid around the gas 0.813
TBFsolver drift 0.778 +- 0.024 slip relative to the liquid around the gas 0.780
TBFsolver, no smoothing drift 0.811 +- 0.025 slip relative to the liquid around the gas 0.804
peclet’s mean drift, 0.806, is 0.6 % below TBFsolver’s without smoothing (0.811) and 3.6 % above TBFsolver with smoothing (0.778). Measured against the liquid that surrounds the gas, the slip is 0.813 in peclet and 0.804 in TBFsolver without smoothing (+1.1 %). peclet does not smooth, so the like-for-like comparison is with TBFsolver without smoothing.
The column’s structure
fig, axs = plt.subplots(1, 2, figsize=(7.5, 3.2))
for z, c, lab in RUNS:
m = (z["t"] >= T0) & (z["t"] <= T1)
axs[0].plot(z["y"], z["alpha_y"][m].mean(axis=0), color=c, label=lab)
axs[1].plot(z["y"], z["u_liq_y"][m].mean(axis=0), color=c, label=lab)
axs[0].set_xlabel("$y/D$"); axs[0].set_ylabel(r"void fraction $\langle\alpha\rangle$")
axs[1].set_xlabel("$y/D$"); axs[1].set_ylabel(r"liquid velocity $/\sqrt{gD}$")
axs[0].legend(fontsize=8)
plt.tight_layout(); plt.show()
Both codes put the gas in the core and keep it off the walls: over the central quarter of the gap the void fraction is 0.053 in peclet, 0.054 in TBFsolver without smoothing and 0.052 with it. The liquid comes down along both walls, at most 0.175 in peclet against 0.197 and 0.224 in TBFsolver, and is nearly at rest in the core in all three runs (below 0.01).
Conservation
fig, ax = plt.subplots(figsize=(6.5, 3.0))
for z, c, lab in RUNS:
v = z["marker_volume_total"] if "marker_volume_total" in z else z["gas_volume"]
ax.plot(z["t"], v / v[0] - 1, color=c, label=lab)
ax.set_xlabel(r"$t\,\sqrt{g/D}$"); ax.set_ylabel("relative gas volume change")
ax.legend(); plt.show()
peclet: \(+2.7\times10^{-11}\) after 96 779 steps, with the pressure solved to \(10^{-8}\). TBFsolver: \(-1.2\,\%\) (with smoothing), \(-1.4\times10^{-4}\) (without).
The column taken apart
The column mixes everything — single-bubble drag, wake interaction, near-contact — so we separated them. All peclet runs below use the same build as the column.
One bubble. In the same walled box, at \(D/h = 16\); the terminal speed is the mean drift over the last ten time units (it still creeps up by about \(10^{-3}\) per time unit at the end):
| terminal rise speed, \(D/h = 16\) | peclet | TBFsolver, no smoothing | TBFsolver |
|---|---|---|---|
| box 4 × 4 × 4 \(D\) (periodic image 4 \(D\) above) | 1.229 | 1.309 | 1.155 |
| box 8 × 4 × 4 \(D\) | 1.063 | 1.122 | 0.989 |
| box 2 × 4 × 4 \(D\) (in its own wake at the column’s spacing) | 1.600 | 1.746 | 1.522 |
At \(D/h = 16\) peclet is 5–8 % below TBFsolver without smoothing; TBFsolver’s smoothing slows the bubble by 12–13 %. Most of the difference to TBFsolver without smoothing is TBFsolver’s resolution. Refined in the 4 × 4 × 4 box, peclet stays where it is and TBFsolver comes down towards it:
| 4 × 4 × 4 \(D\) box | \(D/h = 16\) | 24 | 32 |
|---|---|---|---|
| peclet | 1.229 | 1.222 | 1.222 |
| TBFsolver, no smoothing | 1.309 | 1.280 | 1.262 |
| peclet vs. TBFsolver | −6.1 % | −4.6 % | −3.2 % |
TBFsolver still falls by 1.4 % from 24 to 32; a linear extrapolation in \(h\) of its two finest values gives 1.207, within 1.2 % of peclet. A model difference of about 1 % cannot be excluded without a finer TBFsolver run. In peclet the lone bubble does not depend on the advection scheme (Koren instead of SOU: −0.1 %), on the time step (halved: −0.4 %) or on the marker container (a single colour field: 0.0 %). It does depend on the form of the viscous term: with the Laplacian the earlier version of this page used, it rises at 1.429, 16 % faster.
Two bubbles. A trailing bubble released 2 \(D\) below a leading one, offset sideways by \(0.1D\), catches up, comes into near contact and passes:
| drafting pair | closest film (centre–centre) | trailing bubble passes at |
|---|---|---|
| peclet, \(D/h = 16\) | \(+0.0085D\) = 0.14 cells (0.91 \(D\)) | \(t = 14.4\) |
| peclet, \(D/h = 24\) | \(-0.0034D\), overlap 0.08 cells (0.86 \(D\)) | \(t = 13.85\) |
| TBFsolver (no smoothing), \(D/h = 16\) | \(-0.051D\), overlap 0.8 cells (0.74 \(D\)) | \(t = 12.1\) |
| TBFsolver (no smoothing), \(D/h = 24\) | \(-0.033D\), overlap 0.8 cells (0.74 \(D\)) | \(t = 13.1\) |
Both codes bring the bubbles to within a cell of each other: peclet to a film of a fraction of a cell, TBFsolver to an overlap of about one cell. The passing times move together under refinement, from 2.3 time units apart at \(D/h = 16\) to 0.75 at 24. A film below one cell is not resolved lubrication in either code.
The single-field VoF path in peclet (one colour field for both bubbles) follows the multiple-marker pair to \(2\times10^{-6}D\) up to \(t = 8.5\) and to \(1.5\times10^{-5}D\) at \(t = 8.7\). At \(t = 8.75\), with the film at \(0.10D\) = 1.6 cells, its two bubbles merge. One colour field cannot keep this film open; the multiple markers can.
Many bubbles. In the start-up transient peclet is 1.5–4 % below TBFsolver without smoothing at \(D/h = 16\) and 1.5–3 % below at \(D/h = 24\); peclet itself changes by less than 0.4 % between the two grids. The \(D/h = 24\) runs end at \(t = 60\), so their statistics window, \(t \in [50, 60]\), is a tenth of the \(D/h = 16\) one: we compare drift and slip there, not the noisier profiles.
rows = [("peclet.flow, D/h = 16", pec), ("peclet.flow, D/h = 24", ld("peclet_closed_d24_t60")),
("TBFsolver no smoothing, D/h = 16", tbfns),
("TBFsolver no smoothing, D/h = 24", ld("tbf_closed_nosmooth_d24_t60")),
("TBFsolver, D/h = 16", tbf), ("TBFsolver, D/h = 24", ld("tbf_closed_d24_t5"))]
print(f"{'':34s}" + "".join(f" t = {k}" for k in range(1, 6)) + " drift, slip [50, 60]")
for lab, z in rows:
if z is None:
continue
vals = [z["rise_speed"][np.argmin(abs(z["t"] - k))] for k in range(1, 6)]
line = f"{lab:34s}" + "".join(f" {v:.3f}" for v in vals)
m = (z["t"] >= 50.0) & (z["t"] <= 60.0)
if z["t"][-1] >= 60.0 - 1e-2:
a, ul = z["alpha_y"][m], z["u_liq_y"][m]
slip = -(first(z["u_gas"][m]) - (a * ul).sum(1) / a.sum(1))
line += f" {z['rise_speed'][m].mean():.3f}, {slip.mean():.3f}"
print(line) t = 1 t = 2 t = 3 t = 4 t = 5 drift, slip [50, 60]
peclet.flow, D/h = 16 0.734 0.881 0.957 1.003 1.033 0.793, 0.794
peclet.flow, D/h = 24 0.735 0.878 0.953 1.000 1.029 0.810, 0.806
TBFsolver no smoothing, D/h = 16 0.759 0.895 0.972 1.029 1.076 0.760, 0.754
TBFsolver no smoothing, D/h = 24 0.756 0.896 0.968 1.016 1.057 0.808, 0.808
TBFsolver, D/h = 16 0.713 0.840 0.920 0.963 0.992 0.750, 0.735
TBFsolver, D/h = 24 0.724 0.863 0.928 0.971 1.000
At \(D/h = 24\) the drift over \([50, 60]\) is 0.810 in peclet and 0.808 in TBFsolver without smoothing (+0.2 %); the slip is 0.806 and 0.808 (−0.2 %). How noisy so short a window is shows at \(D/h = 16\): over \([50, 60]\) the two codes give 0.793 and 0.760, over \([50, 150]\) 0.806 and 0.811.
An independent reference. Loisy, Naso & Spelt computed free swarms of exactly these E1 bubbles with a level-set method (one field; bubbles never touch at this void fraction). Eight bubbles in a triply periodic cube at void fraction 3.8 %, \(D/h = 20\), drift over \(t \ge 30\) normalised by the isolated rise speed \(U_0\) (Loth):
| free array, E1, 8 bubbles, \(\phi = 3.8\,\%\) | \(U/U_0\) |
|---|---|
| peclet, multiple-marker, ratios 0.02 / 0.02 | 0.81 |
| peclet, single field, ratios 0.02 / 0.02 | 0.81 |
| peclet, single field, Loisy’s ratios (\(\rho_g/\rho_l = 10^{-3}\), \(\mu_g/\mu_l = 10^{-2}\)) | 0.74 |
| Loisy, Naso & Spelt 2017, fig. 21 | ≈ 0.80 |
The property ratios matter (0.81 → 0.74). At Loisy’s own ratios peclet is 7 % below the level-set result; we have not traced that difference. No bubbles merged in either single-field run (closest gaps \(0.22D\) and \(0.30D\)).
Reading. In the column, peclet and TBFsolver without smoothing agree to about 1 % in drift and slip at both resolutions, and the lone-bubble difference at \(D/h = 16\) closes as TBFsolver is refined. The open point is the 7 % against Loisy et al. at their property ratios.
The collision fix
When two markers overlap, the Weymouth–Yue advection of each one leaves sub-cell debris in cells the other bubble fills: volume fractions of order \(10^{-8}\) to \(10^{-3}\) along the rim of the contact lens. Each such cell passes the “is this interfacial?” test, so the height-function cascade gives it a curvature — garbage, since nothing in its stencil is a real interface: 273 and −428 per cell were measured where the bubble’s own curvature is about 0.4 per cell. Multiplied by \(\sigma\nabla C_k\), that produced a one-step velocity blow-up. The balanced-force pairing of the per-marker forces with the union colour, which had been blamed, is exact for a constant curvature and was not the cause.
The fix, all inside the block container:
- Debris removal with exact return. After every advection, a marker’s cells that are interfacial but have no cell above \(C = \tfrac12\) within two cells are cleared, and their volume goes back to the same marker’s genuine interface, weighted by \(C(1-C)\); values below the wisp threshold (\(10^{-8}\)) likewise. Every marker’s volume is conserved to round-off.
- A curvature bound \(|\kappa| \le 1/\Delta_{\min}\) per cell on the block path, as a backstop.
- A capillary time-step bound for the gas–gas contact while markers overlap.
A two-bubble shear collision that blew up at step 2910 now completes; the bubbly channel that died at step 10 706 runs on with volumes conserved to \(2\times10^{-14}\); MPI runs at 1, 2 and 4 ranks are bitwise identical. Design and gates: doc/vof_overlap_design.md.
Cost
The CPU and GPU timings in the tables below were measured without momentum advection and with the Laplacian viscous term (peclet.flow 353baa8, 2ea4c65, 7af6dee, e4f75df); they have not been re-measured. On the RTX 5080 the column run of this page, with advection and the full viscous stress at 9cb691a, took a median 17 ms per step (14 ms in its 500-step smoke run), against the 13.5 ms in the GPU table. With advection the time step stays at the capillary limit; the run to \(t = 150\) took 2.6 % more steps.
Measured on Snellius genoa nodes (2 × AMD EPYC 9654), pressure to relative residual \(10^{-8}\) (TBFsolver’s FFT solve is direct). The 24-core rows are cores 0–23, one NUMA domain, median of two runs in job 28464076 (2026-10-22), peclet.flow 353baa8 with core v1.7.0 — the code of peclet.flow main (0abafe2) for these layouts; at 12 × 2 main restores the legacy partition, which is the row shown. TBFsolver and the 192-core rows are job 28238662 (2026-10-17, median of three, peclet.flow 2ea4c65, not re-measured).
| ms per step, 24 cores | peclet.flow | TBFsolver |
|---|---|---|
| 1 × 24 threads | 68.0 | — |
| 3 MPI × 8 threads (one rank per CCD) | 78.5 | — |
| 6 × 4 | 81.7 | — |
| 12 × 2 | 82.1 | — |
| 24 × 1 | 85.5 | — |
| 8 × 3 | 100.1 | 45 |
| 192 cores (64 × 3; 2ea4c65) | 57 | 25 |
| ms per step, one GPU | V-cycle "auto" (default) |
V-cycle "fp64" |
peclet.flow |
|---|---|---|---|
| RTX 5080 (workstation, 2026-10-19) | 13.5 | 16.6 | main since 7af6dee |
| H100 (Snellius) | 16.1 | 16.9 | e4f75df, before the coarse-grid work |
Time steps are equal (≈ 1.55 × 10⁻³ in both), so cost per step is cost per simulated time. The 2026-10-03 table solved the pressure to \(10^{-10}\); at that tolerance, at 2ea4c65, the 8 × 3, 1 × 24 and 192-core rows were 139, 80 and 70 ms (then 166–169, 144 and 82–85), and the GPU row 36–37 ms.
On one GPU peclet runs this case 3.3× faster than TBFsolver on 24 CPU cores (2.6× at the 17 ms of the run with advection). On 24 cores, in its best layouts (1 × 24 and 3 × 8), it is 1.5–1.7× slower than TBFsolver; on 192 cores 2.3×. Half of peclet’s CPU step (51 %) is the pressure solve: TBFsolver solves a constant-coefficient Poisson equation directly by FFT (the Dodd–Ferrante splitting); peclet solves the exact variable-coefficient one with multigrid-preconditioned CG, about ten iterations per step. We built and tested the constant-coefficient splitting in peclet too — it is stable, and needs 40 % fewer pressure iterations, but a bubble at rest then carries spurious currents about 5000× larger than with the exact projection, so it is parked, not shipped.
The distributed CPU path has had its communication reworked (core 1.6.0: persistent halo exchange, faces-only stencil halos, on-node shared memory) and a balanced default partition (core 1.7.0, which alone took 24 × 1 from 102 to 86 ms); 8 × 3 is down from 116 ms at 2ea4c65. What remains between the layouts is placement: a genoa CCD has 8 cores sharing one L3, and a 3-thread rank that straddles two CCDs costs about 18 ms per step in the synchronisation-bound kernels. On a genoa-like node, run one rank without MPI (1 × 24), or one rank per CCD (3 × 8); never 8 × 3.
Since the first measurement (2026-09-25: 186–203 ms on 24 cores, 54 ms on the GPU) three performance programmes have landed (step, pressure, and the distributed host path above): a face-form multigrid operator, fused ghost fills, device-resident Krylov scalars, batched per-bubble stages, cheaper curvature, a device-resident coarse-grid solve and leaner host kernels and reductions — all bit-for-bit identical in results. Since 2026-10-17 the GPU step went from 22 to 13.5 ms: faster statistics kernels, the coarse-grid factorisation overlapped on a second stream, and the single-precision multigrid V-cycle under the double-precision CG now the device default (set_pressure_vcycle_precision("auto"); a solve that does not converge with it is restarted in double precision). The host path stays in double precision.
Reproduce this
# the case, shared by both codes
python scripts/case.py
# TBFsolver (patched to read explicit bubble centres: tbfsolver/bubblePositions.patch;
# no-smoothing build: tbfsolver/nosmooth_ablation.patch)
python scripts/make_tbf_case.py --out tbfsolver/run150 && cp TBFsolver tbfsolver/run150/
(cd tbfsolver/run150 && OMP_NUM_THREADS=3 mpirun -np 8 --bind-to none ./TBFsolver > run.log)
python scripts/tbf_read.py tbfsolver/run150 --out data/tbf_closed_t150.npz
# peclet.flow (GPU or CPU build of peclet-flow main, 9cb691a or later: momentum advection and the
# full viscous stress are its defaults)
python scripts/run_peclet.py --out peclet/run
python scripts/peclet_reduce.py peclet/run --out data/peclet_closed.npz --log peclet/run.log
# resolution check: BUBBLE_COLUMN_CELLS_PER_D=24 before either code's commands
# isolated bubble, drafting pair, Loisy free array: scripts/studies/{iso,pair2,run_loisy,run_single}.py
# the picture of the bubbles (Blender 4.5) from the run's final checkpoint: render/README.md