thermal-cavity2d¶
英語 | 日本語
Thermal LBM -- 2D Boussinesq natural convection in a differentially-heated square cavity (de Vahl Davis 1983 benchmark). Driver ONLY: the physics lives in openrheo_amr/thermal_ddf.hpp (double-distribution-function thermal LBM, D2Q9 momentum + D2Q5 temperature, Guo buoyancy), which this file sets up, marches and reports. Migrated from an inlined implementation as the first benchmark of docs/design/module-architecture-design.md -- the same module backs tests/test_thermal_ddf (de Vahl Davis Nu) and tests/test_thermal_rayleigh_benard (the same stepper with the hot walls moved to the horizontal boundaries), so the physics now has one home instead of one copy per case.
概要: 側面加熱の正方キャビティ自然対流(de Vahl Davis ベンチマーク)。Nusselt 数が公表値 2.243 に対し 0.05% 一致。物理は thermal_ddf モジュールにあり、壁条件を変えるだけでレイリー・ベナールにもなる。
Geometry¶

Animation¶
Fields¶
この計算が最後の出力ステップで書き出した場をそのまま描いたもの。3D ケースは中央断面。


Results¶
de Vahl Davis (1983) の側方加熱正方キャビティ、Ra = 1e4、Pr = 0.71、 N = 128、浮力速度 U = 0.1。写像は ν = U·N·√(Pr/Ra) = 0.1 × 128 × √(7.1e-5) = 0.10785、α = ν/Pr = 0.15191、gβ = U²/(ΔT·N) = 0.01/128 = 7.813e-5、τ_f = 3ν + 1/2 = 0.8236、τ_g = 3α + 1/2 = 0.9557 — ログ 1 行目と全桁一致。壁時計 10.51 秒。
- 収束:Nu_hot は立ち上がりで 2.373(step 8000)までオーバーシュート したのち減衰振動し、step 42000 で dNu/Nu < 5e-7 を満たして停止。
- Nusselt 数:Nu_hot = Nu_cold = 2.244091(熱収支不均衡 0.00%)。 de Vahl Davis のベンチマーク値 2.243 に対し (2.244091 − 2.243)/2.243 = +0.049%。
- 速度極値(U_ref = α/H スケール):|u_max| = 16.187(y/H = 0.176)、 |v_max| = 19.645(x/H = 0.879)。文献値 16.178(y = 0.823)・19.617 (x = 0.119)に対し 0.06% / 0.14%。位置は 1 − 0.176 = 0.824、 1 − 0.879 = 0.121 で、回転向きの鏡映を除けば文献位置と一致する。
🧩 モジュールゲートの話。この駆動部は 148 行しかない。物理は
thermal_ddf.hpp(DDF 熱 LBM モジュール)にあり、ctest thermal_ddf が
N = 64 で Nu = 2.2431 vs 2.243(0.00%)の黄金ゲートを常設している
(docs/design/module-architecture-design.md)。インライン実装からの移行時には
この RESULT 行(Nu 2.244091、u_max −16.187181、v_max −19.645266、
step 42000 収束)がビット同一であることが移行の合格条件だった。
モジュール抽出の際に Nusselt 積分の H/ΔT 因子を落とすバグが実際に出て、
ゲートが即座に検出した — この数字は飾りではなく回帰網である。
Governing equations¶
Boussinesq 近似の自然対流。非圧縮 NS + 浮力と温度移流拡散:
\[
\partial_t\boldsymbol{u}+\boldsymbol{u}\cdot\nabla\boldsymbol{u}
=-\nabla p+\nu\nabla^2\boldsymbol{u}+g\beta T\,\hat{\boldsymbol{y}},\qquad
\partial_t T+\boldsymbol{u}\cdot\nabla T=\alpha\nabla^2 T
\]
支配群は Ra = gβΔT H³/(να) と Pr = ν/α。LBM は二重分布関数(DDF): D2Q9 BGK が運動量を、D2Q5 BGK が温度を運び、浮力は Guo 強制で入る (He–Chen–Doolen 1998 / Guo 2002)。格子写像は U = √(gβΔT H) を小さく 固定して低 Mach を保ち、
\[
\nu=UH\sqrt{Pr/Ra},\quad \alpha=\nu/Pr,\quad g\beta=U^2/(\Delta T\,H)
\]
壁は四面ノースリップ(ハーフウェイ・バウンスバック)、温度は左 T = +1/2 (高温)・右 T = −1/2 のアンチ・バウンスバック Dirichlet、上下断熱。
Code walkthrough¶
ソース(148 行)と thermal_ddf.hpp。
%%{init: {'themeVariables': {'fontSize': '11px'}}}%%
flowchart LR
H["左壁 高温 T=+1/2<br/>アンチBB Dirichlet<br/>ノースリップ"] --> C2["128×128 キャビティ<br/>D2Q9+D2Q5 DDF / Guo 浮力<br/>上下:断熱・ノースリップ"]
C2 --> C["右壁 低温 T=−1/2<br/>アンチBB Dirichlet<br/>ノースリップ"]
- ThermalParams — square(128)、Ra、Pr、壁種別(左右 Dirichlet / 上下 Adiabatic)を設定するだけ。格子・平衡・強制は全てモジュール側。
- 初期場 — thermal_linear_profile(伝導直線)から開始。
- 行進 — thermal step を回し、2000 ステップごとに hot 壁 Nu の 相対ドリフトを監視。5e-7 を切ったら停止。
- 報告 — Nu_hot/Nu_cold(収支検査)、速度極値と位置、RESULT 行。 ORHEO_WIKI_DUMP 有効時は T・u 場をギャラリーへ。
Build & run¶
cmake -S native -B native/build && cmake --build native/build -j
./native/build/orheo-thermal-cavity2d
thermal_cavity2d [N] [Ra] [steps] [Pr] [out_prefix] [U]
このページの図を作った計算のコスト(Miyabi-G Grace CPU (72 cores, -stdpar=multicore)): 10.5 s wall。
Things to try¶
- Ra 掃引:
thermal_cavity2d 128 1e5→ 1e6。de Vahl Davis 系列の Nu(Ra) をなぞる。境界層が薄くなるので N も上げること。 - N 収束:N = 64/128/256 で Nu の格子収束を測る(ctest は N = 64 で 既に 0.00% だが、速度極値の位置はより解像に敏感)。
- U を下げる:U = 0.05 で圧縮性誤差(Ma²)の寄与を分離。Nu の 4 桁目が動くかどうか。
- rayleigh_benard2d と見比べる:同じモジュールの壁設定替えだけで 別の古典問題になる — ThermalParams の diff を読むのが一番早い。
Validation¶
| Tier | T1 — 自動ゲートあり |
| QoI | Nu, u_max |
| Reference | de Vahl Davis (1983) Int.J.Numer.Meth.Fluids 3:249 -- Nu, u_max |
| Gate | 🧩 モジュールゲート (thermal_ddf) |
| Measured | 2.244091 (rel. err +0.05%) — cross-code run (thermal_cavity) |
Source & run details¶
| Item | Value |
|---|---|
| Target | orheo-thermal-cavity2d |
| Source | native/benchmarks/thermal_cavity2d.cpp |
| Lattice | D2Q9 + D2Q5 (DDF) |
| GPU twin | no |
| Modules | thermal_ddf.hpp |
| Gallery run | 2026-07-27 @ 7628c0cf |
| Args | `` |
| Wall time | 10.51 s |
| CPU time | 370.34 s |
| Device | Miyabi-G Grace CPU (72 cores, -stdpar=multicore) |
Computation log¶
この計算の実際の出力(先頭と末尾)。
thermal_cavity2d N=128 Ra=1e+04 Pr=0.710 U=0.100 nu=0.10785 alpha=0.15191 gbeta=7.813e-05 tau_f=0.8236 tau_g=0.9557
step 0: Nu_hot=1.00000 dNu/Nu=1.00e+09
step 2000: Nu_hot=1.11724 dNu/Nu=1.05e-01
step 4000: Nu_hot=1.82400 dNu/Nu=3.87e-01
step 6000: Nu_hot=2.36510 dNu/Nu=2.29e-01
step 8000: Nu_hot=2.37307 dNu/Nu=3.36e-03
step 10000: Nu_hot=2.26905 dNu/Nu=4.58e-02
step 12000: Nu_hot=2.22279 dNu/Nu=2.08e-02
step 14000: Nu_hot=2.22648 dNu/Nu=1.66e-03
step 16000: Nu_hot=2.24035 dNu/Nu=6.19e-03
step 18000: Nu_hot=2.24628 dNu/Nu=2.64e-03
step 20000: Nu_hot=2.24583 dNu/Nu=1.97e-04
step 22000: Nu_hot=2.24429 dNu/Nu=6.89e-04
step 24000: Nu_hot=2.24372 dNu/Nu=2.54e-04
...
step 34000: Nu_hot=2.24409 dNu/Nu=1.01e-05
step 36000: Nu_hot=2.24408 dNu/Nu=2.83e-06
step 38000: Nu_hot=2.24409 dNu/Nu=1.27e-06
step 40000: Nu_hot=2.24409 dNu/Nu=1.35e-06
step 42000: Nu_hot=2.24409 dNu/Nu=3.61e-07
converged (dNu/Nu < 5e-7) at step 42000
Nu_hot=2.2441 Nu_cold=2.2441 (imbalance 0.00%)
u_max=-16.187 (y/H=0.176) v_max=-19.645 (x/H=0.879) [U_ref=alpha/H]
RESULT Ra=10000 N=128 Nu_hot=2.244091 Nu_cold=2.244091 umax=-16.187181 vmax=-19.645266
References¶
- G. de Vahl Davis, Int. J. Numer. Methods Fluids 3 (1983) 249 — ベンチマーク値 Nu = 2.243、u_max = 16.178 (y = 0.823)、 v_max = 19.617 (x = 0.119)(Ra = 1e4)。
- X. He, S. Chen & G. D. Doolen, J. Comput. Phys. 146 (1998) 282 — DDF 熱 LBM。
- Z. Guo, C. Zheng & B. Shi, Phys. Rev. E 65 (2002) 046308 — 強制項。