rayleigh-benard2d¶
English | Japanese
« Home · « Heat transfer and phase change
Thermal LBM -- 2D Rayleigh-Benard convection: a fluid layer heated from below and cooled from above, between two rigid (no-slip) horizontal plates, periodic in the horizontal. The buoyant instability sets in above a critical Rayleigh number; below it the layer stays in pure conduction (Nu = 1), above it steady convection rolls form (Nu > 1).
Geometry¶

Animation¶
Fields¶
The fields this computation wrote at its last output step, plotted as they are. 3D cases show the mid-plane.


Results¶
The classic problem of a fluid layer heated from below and cooled from above. Nx = 97 × Ny = 48, Ra = 5000, Pr = 0.71, U = 0.05, perturbation amplitude 1e-3. Mapping: ν = U·H·√(Pr/Ra) = 0.05 × 48 × √(0.000142) = 0.02860, α = ν/0.71 = 0.04028, gβ = 0.05²/48 = 5.208e-5, τ_f = 0.5858, τ_g = 0.6208. The width is Nx = round(2.0158 × 48) = 97 — the lowest mode of the periodic box is matched to the critical wavenumber a_c = 3.117 (2π/a_c = 2.0158), so exactly 1 pair of rolls fits. Ra/Ra_c = 5000/1707.762 = 2.93 times supercritical. Wall-clock time 1.56 s.
The log traces the textbook three acts of linear instability exactly:
- Conduction + perturbation decay: Nu ≈ 0.995–1.000, KE ~1e-10 (step 0–6000).
- Exponential growth: over step 6000–9000, dKE sticks at 3.40e-1 → 3.48e-1 — a constant growth rate at which KE grows by a factor e^0.348 ≈ 1.42 every reporting interval of 750 steps, i.e. the growth of the linear eigenmode. Nu is still ≈ 1.0002.
- Nonlinear saturation: Nu_hot = 2.108944 = Nu_cold (imbalance 0.00%), KE = 9.8039e-5, v_max = 17.64 (in units of α/H); judged steady at step 52500. growth_sigma = 8.4955e-06 on the RESULT line.
🧩 About the module gate. This driver too is nothing more than a change of wall settings in thermal_ddf.hpp
(left/right set to Periodic, Dirichlet moved to top/bottom). That swap itself is
gated by the ctest thermal_rayleigh_benard: on a periodic plate layer,
Ra = 1200 → Nu = 0.9999 (below Ra_c = 1708, pure conduction), Ra = 4000 →
Nu = 1.924 (supercritical, convection) — a pass/fail test that brackets the Clever–Busse
rigid-wall critical value Ra_c = 1707.76 from both sides (docs/design/module-architecture-design.md).
This transition exposed a defect in which the module assumed a square box, and a fix
was made generalizing H to "the distance between the Dirichlet walls".
Governing equations¶
Rayleigh–Bénard stability with rigid–rigid boundaries (Chandrasekhar 1961, Ch. II):
\[
Ra=\frac{g\beta\,\Delta T\,H^3}{\nu\alpha},\qquad
Ra_c=1707.762,\quad a_c=3.117
\]
For Ra < Ra_c heat is carried by conduction only (Nu = 1); above it, steady convection rolls form and Nu > 1 (supercritical bifurcation). The numerical method is the same DDF thermal LBM as thermal-cavity2d (D2Q9 + D2Q5, Guo buoyancy); the only change is ThermalParams:
\[
T_{\rm bottom}=+\tfrac12,\;T_{\rm top}=-\tfrac12\ (\text{Dirichlet}),\qquad
\text{left/right: periodic}
\]
A single-mode small temperature perturbation (amp = 1e-3) serves as the seed, and its growth rate and saturated Nusselt number are the diagnostics. For the Nu(Ra) trend of supercritical steady 2D rolls, Clever & Busse (1974) is the reference.
Code walkthrough¶
Source (213 lines).
%%{init: {'themeVariables': {'fontSize': '11px'}}}%%
flowchart TB
T["Top plate, cold T=−1/2 (Dirichlet, no-slip)"]
M["97×48 layer (Lx = 2.02H = 1 wavelength of the critical mode)<br/>DDF thermal LBM / periodic left-right"]
B["Bottom plate, hot T=+1/2 (Dirichlet, no-slip)"]
B --> M --> T
- Setup — derive Nx = 2.0158·Ny from Ny = 48. Prepare the wall types and the perturbation field.
- March — every 750 steps, record Nu_hot, mean KE, and the drift of both. Stop when Nu and KE have become steady at the same time (converge = 1).
- Growth rate — fit the exponential-growth interval from the KE time series (sigma in RESULT).
- Output — T/u fields and KE time-series CSV, gallery animation (shows the roll formation).
Build & run¶
cmake -S native -B native/build && cmake --build native/build -j
./native/build/orheo-rayleigh-benard2d
rayleigh_benard2d [Nx] [Ny] [Ra] [steps] [Pr] [out_prefix] [U] [amp]
Cost of the computation that made the figures on this page (Miyabi-G Grace CPU (72 cores, -stdpar=multicore)): 1.6 s wall.
Things to try¶
- Bracket the critical point yourself:
rayleigh_benard2d 97 48 1600and 1800 — see whether Nu stays at 1 or departs from it just below/above Ra_c = 1708 (a nastier setting than the ctest's 1200/4000). - Detune the box width: with Nx = 64 (a ≠ a_c) the growth rate and saturated Nu should drop. Gives a feel for wavenumber selection.
- Set amp to 1e-5: the linear growth interval becomes longer and the growth-rate fit becomes more stable. Confirm that σ does not depend on amp.
- Ra = 1e5: the same strong-convection regime as the ctest's composite test (Nu ≈ 3.9). Raise Ny to resolve the boundary layers and compare.
Validation¶
| Tier | T1 — automatic gate |
| QoI | Nu |
| Reference | Clever & Busse (1974) critical Ra=1708; Nu(Ra) scaling |
| Gate | 🧩 module gate (thermal_rayleigh_benard) |
Source & run details¶
| Item | Value |
|---|---|
| Target | orheo-rayleigh-benard2d |
| Source | native/benchmarks/rayleigh_benard2d.cpp |
| Lattice | D2Q9 + D2Q5 (DDF) |
| GPU twin | no |
| Modules | thermal_ddf.hpp |
| Gallery run | 2026-07-27 @ 7628c0cf |
| Args | `` |
| Wall time | 1.56 s |
| CPU time | 106.22 s |
| Device | Miyabi-G Grace CPU (72 cores, -stdpar=multicore) |
Computation log¶
The actual output of this computation (head and tail).
rayleigh_benard2d Nx=97 Ny=48 Ra=5000 Pr=0.710 U=0.0500 amp=1.0e-03 nu=0.02860 alpha=0.04028 gbeta=5.208e-05 tau_f=0.5858 tau_g=0.6208
step 0: Nu_hot=0.999953 KE=5.6490e-11 dNu=1.00e+09 dKE=1.77e+19
step 750: Nu_hot=0.995258 KE=3.4223e-10 dNu=4.72e-03 dKE=8.35e-01
step 1500: Nu_hot=0.997204 KE=6.1972e-10 dNu=1.95e-03 dKE=4.48e-01
step 2250: Nu_hot=0.998340 KE=8.3271e-10 dNu=1.14e-03 dKE=2.56e-01
step 3000: Nu_hot=0.999036 KE=1.0819e-09 dNu=6.97e-04 dKE=2.30e-01
step 3750: Nu_hot=0.999467 KE=1.4747e-09 dNu=4.31e-04 dKE=2.66e-01
step 4500: Nu_hot=0.999732 KE=2.1207e-09 dNu=2.65e-04 dKE=3.05e-01
step 5250: Nu_hot=0.999893 KE=3.1572e-09 dNu=1.62e-04 dKE=3.28e-01
step 6000: Nu_hot=0.999994 KE=4.7840e-09 dNu=1.01e-04 dKE=3.40e-01
step 6750: Nu_hot=1.000062 KE=7.3054e-09 dNu=6.78e-05 dKE=3.45e-01
step 7500: Nu_hot=1.000117 KE=1.1191e-08 dNu=5.57e-05 dKE=3.47e-01
step 8250: Nu_hot=1.000178 KE=1.7163e-08 dNu=6.03e-05 dKE=3.48e-01
step 9000: Nu_hot=1.000259 KE=2.6334e-08 dNu=8.10e-05 dKE=3.48e-01
...
step 48750: Nu_hot=2.108966 KE=9.8041e-05 dNu=1.26e-06 dKE=4.99e-06
step 49500: Nu_hot=2.108960 KE=9.8041e-05 dNu=2.78e-06 dKE=6.44e-06
step 50250: Nu_hot=2.108954 KE=9.8040e-05 dNu=2.99e-06 dKE=5.80e-06
step 51000: Nu_hot=2.108949 KE=9.8040e-05 dNu=2.44e-06 dKE=4.16e-06
step 51750: Nu_hot=2.108946 KE=9.8039e-05 dNu=1.60e-06 dKE=2.34e-06
step 52500: Nu_hot=2.108944 KE=9.8039e-05 dNu=7.82e-07 dKE=8.23e-07
converged (Nu & KE stationary) at step 52500
Nu_hot=2.10894 Nu_cold=2.10894 (imbalance 0.00%) vmax=17.64 growth_sigma=8.4955e-06 (used 52501 steps)
RESULT Ra=5000 Nx=97 Ny=48 Nu_hot=2.108944 Nu_cold=2.108944 sigma=8.495485e-06 vmax=17.644680 used=52501
References¶
- Lord Rayleigh, Phil. Mag. 32 (1916) 529 — origin of the problem.
- S. Chandrasekhar, Hydrodynamic and Hydromagnetic Stability (1961), Ch. II — Ra_c = 1707.762, a_c = 3.117 (rigid–rigid).
- R. M. Clever & F. H. Busse, J. Fluid Mech. 65 (1974) 625 — Nu(Ra) of supercritical 2D rolls.
- X. He, S. Chen & G. D. Doolen, J. Comput. Phys. 146 (1998) 282; Z. Guo, C. Zheng & B. Shi, Phys. Rev. E 65 (2002) 046308.