Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Heat transfer in the flow

A fluid domain with thermal settings carries a temperature field with the flow: a second lattice, D3Q7, advects it with the velocity of the momentum lattice and diffuses it with the fluid’s diffusivity k / (ρ c). The temperature drives the flow back through Boussinesq buoyancy. Obstacles can conduct heat (conjugate heat transfer), with their own conductivity, heat capacity and power, coupled to the fluid at every face they share, and with thermal interface layers between touching solids. A fluid whose material has a phase change melts and freezes: the lattice carries its enthalpy, the latent heat is released at the front, and the flow stops where it has frozen. The solve reports the heat into every wall and each conducting solid’s peak temperature against its limit.

Commandsmodel.fluid_domain.create / .edit (thermal), model.fluid_domain.thermal_boundary, model.fluid_domain.limit, model.material.phase_change, solve.fluid, solve.probe
Step procedure"fluid" on a domain with thermal settings
Solvercrates/lbm (CPU, f64); crates/lbm-gpu (GPU, f32), conducting solids and contacts included
MethodD3Q7 passive scalar with two relaxation times (Krüger et al. 2017; Ginzburg 2005); cell-centred finite-volume conduction in solids (Patankar 1980) coupled through anti-bounce-back links (Li, Mei & Klausner 2013)
Verified byoracle de-vahl-davis-ra1e3 … ra1e6, conjugate-cavity-centred-body, radiation-slab-lattice, stefan-two-phase, frozen-channel-poiseuille, thin-wall-series-conduction; crates/lbm/tests/thermal.rs, crates/lbm/tests/conjugate.rs, crates/lbm/tests/solidification.rs

Synopsis

{"name": "Box", "material": "Air", "min": [0, 0, 0], "max": [100, 100, 10], "spacing": 1,
 "obstacles": ["Sink", "Die", "Lid"],
 "thermal": {
   "initial_temperature": 20,
   "gravity": [0, -9810, 0], "expansion": 2.1e-4,
   "faces": {"y_min": {"type": "temperature", "value": 80}, "y_max": {"type": "flux", "value": 1000}},
   "surfaces": [{"face": {"body": "Sink", "face": "F2:top"}, "condition": {"type": "temperature", "value": 80}}],
   "solids": [{"body": "Die", "material": "Silicon", "power": 5, "limit": 95},
              {"body": "Lid", "material": "Aluminium"}],
   "contacts": [{"bodies": ["Die", "Lid"], "thickness": 0.05, "conductivity": 5}]
 },
 "baffles": [{"name": "Sheet", "axis": "y", "position": 50, "conductance": 0.5}]}

model.fluid_domain.create (or .edit) takes the domain; the numbers are in the display units (the default mm-t-s-N-MPa, with temperatures in °C). Single boundaries and limits change with:

{"domain": "Box", "at": "x_min", "condition": {"type": "adiabatic"}}
{"domain": "Box", "body": "Die", "limit": 95}

(model.fluid_domain.thermal_boundary and model.fluid_domain.limit). A fluid step on the domain (model.step.create, "type": "fluid") solves the flow and the heat together.

Parameters

thermal of the fluid domain (left out, the flow is isothermal):

FieldValueDefaultMeaning
initial_temperaturetemperature0 °CThe temperature everywhere at the start, and the reference T₀ of the buoyancy.
gravityvector[0, 0, 0]Gravity for the buoyancy; zero for none. Separate from the domain’s acceleration, which is a plain body force.
expansion≥ 0, per temperaturenoneVolumetric expansion coefficient β; required with a gravity.
faces.<face>conditionadiabaticThe thermal condition of each box face.
surfaces[{face, condition}], at most 10 000noneConditions on named faces of non-conducting obstacles; their other faces are adiabatic.
solids[{body, material, power, limit, radiation}]noneObstacles that conduct heat.
contacts[{bodies, resistance}] or [{bodies, thickness, conductivity}], at most 10 000noneThermal interface layers between two touching conducting solids.
temperature_zerokelvin0 °CThe temperature the lattice counts from (see Theory); a model from before SI storage keeps the zero of the system it was typed in.

Thermal conditions (faces, surfaces, model.fluid_domain.thermal_boundary):

typeFieldMeaning
adiabatic—No heat crosses it. At an inlet the fluid enters at the initial temperature; at an outlet it leaves at the temperature it has.
temperaturevalueHeld at this temperature; at a velocity inlet the fluid enters at it.
fluxvalue (power per area)A heat flux into the fluid; negative draws heat out. On walls only: a flux on an inlet, outlet or periodic face is refused.

Conducting solid (solids):

FieldValueDefaultMeaning
bodyobstacle namerequiredAn obstacle of the domain, listed once. Its faces exchange heat with the fluid and take no thermal condition.
materialmaterial namerequiredA density, a conductivity (isotropic, or [kx, ky, kz] along the box’s axes) and a specific heat.
powerpower0Heat generated, spread evenly over its cells; negative draws heat out. A powered solid that covers no cell centre is refused.
limittemperature, above 0 KnoneThe highest temperature it may reach (a junction or case limit); the solve reports its peak against it.
radiation{emissivity, ambient}: ε above 0 and at most 1, a temperature at or above 0 KnoneRadiation from its faces that touch the fluid to surroundings at ambient (the enclosure or room), through the fluid taken as transparent: ε σ (T⁴ − T_amb⁴) per area. Faces see only the surroundings (no view factors). CPU backend only: the GPU backend refuses it.

Thermal contact (contacts): bodies, two conducting solids that share at least one cell face; either resistance (per area, K·m²/W in SI) or thickness with conductivity (R = t / k), not both. Solids not listed touch perfectly. One contact per pair.

Thin wall (baffles of the fluid domain, beside thermal, at most 64): a zero-thickness, no-slip sheet across the whole box, separating the passages either side, with its conduction through the thickness as a conductance per area. Without thermal it is a no-slip wall only.

FieldValueMeaning
nametextUnique in the domain; its two sides report as baffle/<name>/low and /high in the heat and force histories.
axisx, y or zThe sheet’s normal.
positionlengthWhere it crosses the axis: on a lattice face strictly inside the box.
conductance≥ 0, power per area and temperatureConductivity over thickness, k / t (or 1 / R); 0 insulates.

Sheets in one domain are parallel and on distinct faces. The first version takes closed boxes (walls, moving walls and slip faces; periodic faces only along the sheet), sheets clear of obstacles, laminar flow without phase change or a free surface, on the CPU; anything else is refused. Where a sheet meets a moving box wall, the links through its edge take the wall’s motion and give it their force, as at an edge of the box. The solve reports, per sheet, its area and, with heat, the mean temperature of its low and high sides and the heat_flux into the sheet from each side (equal and opposite), in the solve’s reply; a saved file keeps each side’s heat history (heat), not yet the side temperatures.

The fluid’s material needs a positive isotropic conductivity and a positive specific heat.

Phase change of the fluid’s material (model.material.phase_change, or phase_change in model.material.create / .edit; null removes it):

{"name": "Water", "phase_change": {"latent_heat": 3.34e11, "solidus": 0, "liquidus": 0}}
FieldValueMeaning
latent_heat> 0, energy per massReleased as the material freezes (mJ/t in mm-t-s: water 3.34e11, J/kg in SI).
solidustemperatureBelow it the material is solid and does not flow.
liquidustemperature, at least the solidusAbove it the material is liquid; equal to the solidus for a pure substance’s isothermal front.

It needs the material’s specific heat. Conducting solids with a phase change are refused (only the fluid melts and freezes), and so is the GPU backend.

Theory

Temperature lattice. D3Q7 (the rest direction and the six axis directions, the first seven of D3Q19), weights ¼ and ⅛, c_s² = ¼, with the equilibrium

g_q^eq = w_q T (1 + 4 c_q·u)

at the velocity the momentum lattice just collided to (the passive-scalar double-distribution model, Krüger et al. 2017, ch. 8). It collides with two relaxation times (Ginzburg 2005): the antisymmetric part of each axis pair, which carries the heat flux, relaxes with

τ_T = 4 α + ½      (α in lattice units, α Δt / Δx²)

which sets the diffusivity; the symmetric part and the rest population relax with τ_T⁺ = ½ + Λ_T / (τ_T − ½). With Λ_T fixed at 1/12 (THERMAL_MAGIC) a steady temperature field, its walls included, does not depend on τ_T, and neither do the local wall heat fluxes (d’Humières & Ginzburg 2009); at 1/12 the heat a held-wall link takes from a conducting field is fourth-order accurate. Below τ_T = ½ + √Λ_T (0.79) the lattice keeps a single relaxation time, Λ_T = (τ_T − ½)²: a fixed Λ_T makes τ_T⁺ grow without bound as τ_T approaches ½, which a von Neumann analysis finds unstable from lattice speeds of 0.02–0.03, where the single relaxation time holds 0.25. The choice and its study are in Collision operators.

Numerical diffusion. The linear equilibrium diffuses less along the flow by (τ_T − ½) u² in lattice units, 4 u² of the diffusivity (Chopard, Falcone & Latt 2009): this bounds the lattice speed a heat problem should run at.

Boundaries. The scalar populations stream along the momentum lattice’s links:

  • a held temperature is an anti-bounce-back, g_q = −g*_q̄ + 2 w_q T_w, which puts the temperature halfway between the cells;
  • an adiabatic wall bounces back;
  • a heat flux through a wall face adds the flux to the bounced population (one axis direction crosses each wall face, so the cell gains exactly that heat);
  • an inlet holds its temperature (the equilibrium at the cell’s velocity); an outlet takes its neighbour’s populations.

Buoyancy. Boussinesq: every cell’s body force per mass gains −β (T − T₀) g, T₀ the initial temperature, through Guo’s forcing as for the constant acceleration.

Temperature scale. The lattice’s temperatures are the model’s kelvin less temperature_zero (0 °C unless the model is older than SI storage). The scheme’s walls are not invariant under a shift of the temperature scale (a wall’s bounce-back carries T u), so the zero is part of the model, never of how it is shown. Single precision (frames, the GPU) keeps the differences that drive the heat.

Turbulence. With Smagorinsky’s model each cell’s turbulent diffusivity α_t = ν_t / Pr_t raises its τ_T by 4 α_t (Turbulence).

Conduction in solids. A cell-centred finite-volume conduction on the lattice’s own cells (Patankar 1980, ch. 4). The heat through the face between two cells is g (T_b − T_a), with g the series conductance of the two half cells along the face’s axis (the harmonic mean, which keeps the flux continuous across a change of material); a held box face adds 2 k (T_w − T), a flux face its flux. An orthotropic conductivity uses each axis’s value on that axis’s faces. Explicit in time, sub-cycled so that every cell’s sum of conductances over its heat capacity stays below one.

Fluid–solid interface. Each D3Q7 link from a fluid cell into a conducting cell is an anti-bounce-back held at the interface temperature

T_i = (k_s T_s + k_f T_f) / (k_s + k_f)

the temperature halfway between the two cell centres at which the conductive fluxes of the two half cells are equal. The heat the link takes from the fluid is given to the solid cell, so the heat leaving the fluid is the heat the solid receives to round-off. That heat is affine in the solid’s temperature, a − b T_s with b = 2 w_q k_s / (k_s + k_f), so the solid takes it point-implicitly: stable for any heat capacity (an explicit link needs Σ b < C, which a corner cell of aluminium in water already breaks). Interface conditions of this kind: Li, Mei & Klausner (2013).

Thermal contacts. A thin layer (a paste, a pad, a gap filler) is not resolved: its resistance per face r adds in series with the two half cells on every face between cells of the two bodies,

g = 1 / (1/(2 k_a) + 1/(2 k_b) + r),   r = R (ρ c)_f Δx / Δt

(Incropera et al. 2011, §3.1.4). Both cells see the same g, so heat is conserved, and a resistance only lowers a conductance, so the sub-cycling limit holds as without it.

Radiation to the surroundings. A solid with radiation loses, through each of its cells’ faces shared with the fluid (one per fluid link into the cell), e (T⁴ − T_amb⁴) per step with e = ε σ Δt / ((ρ c)_f Δx) in lattice heat units, on the absolute temperature T = θ + T₀ (θ the lattice temperature, T₀ the kelvin it counts from). Inside each sub-step the loss is linearised about the cell’s old temperature and taken point-implicitly with the fluid links,

C (T' − T) = Δt' (H − b T' − q(T) − q'(T) (T' − T)),   q = n e (T⁴ − T_amb⁴), q' = 4 n e T³

(n the cell’s fluid faces, H the rest of its heat), so it stays stable however strongly the solid radiates and the heat it loses is exactly what is counted as radiated. At a steady state T’ = T and the loss is the exact quartic. The fluid neither absorbs nor emits: the radiated heat leaves the domain.

Thin walls. A sheet sits on a lattice face, where the halfway rules put a wall. Every momentum link that crosses it bounces back on its own side (Ladd 1994), so no fluid crosses it and it takes no cells. On the scalar lattice the two populations a (leaving the low side) and b (leaving the high side) through each face return as a − H and b + H, and the anti-bounce-back relation (Krüger et al. 2017, ch. 8) gives the two surface temperatures, T_low = 4 (2a − H) and T_high = 4 (2b + H) with the weight 1/8. Fourier’s law through the sheet, H = G (T_low − T_high), then closes it:

H = (a − b) G / (G + 1/8),   G = conductance Δt / ((ρ c)_f Δx)

What one side loses the other gains, face by face, so heat is conserved exactly, zero conductance passes none, and the mix factor stays below 1 for any conductance (no stability limit, no resolved cell). In the steady state the discrete profile is the exact series solution q = ΔT / (L/k_f + 1/G).

Units of the solid. Heat is counted in the fluid’s lattice heat, (ρ c)_f Δx³ per degree. A solid’s lattice conductivity is k Δt / ((ρ c)_f Δx²), its capacity ρ c / (ρ c)_f and its power P Δt / ((ρ c)_f Δx³); a solid with the fluid’s properties behaves exactly as the fluid at rest.

Steady runs. A step run to steady state (steady) scales each solid’s heat capacity down to the smallest that needs at most 4 sub-steps (STEADY_SUBSTEPS), when that is smaller: the steady temperatures do not depend on it, while a solid’s own time constant (seconds to minutes for a heat sink, against milliseconds for the air around it) would otherwise set the run’s length. The run warns that the transient before the steady state is not physical.

Melting and freezing. With a phase change the scalar lattice carries the total enthalpy in temperature units, E = T + (L / c) f_l, where f_l is the liquid fraction (Huang, Wu & Cheng 2013). The rest population’s equilibrium becomes E − T + w₀ T and the others keep w_q T (1 + 4 c_q·u), so the populations sum to E, carry the flux T u and diffuse T:

∂E/∂t + ∇·(T u) = ∇·(α ∇T)

The latent heat is released as E falls, with no source term and no iteration (the enthalpy method, Voller 1990). T and f_l follow from E: solid (f_l = 0, T = E) below the solidus, liquid (f_l = 1, T = E − L/c) above the liquidus plus L/c, and f_l linear in between, T rising from the solidus to the liquidus with it. Walls, inlets and the conjugate interface act on T as before; an inlet holds the enthalpy of its temperature. The flow stops where the fluid has frozen: every cell’s velocity carries the Carman–Kozeny resistance A (1 − f_l)² / (f_l³ + ε) per step, A = 100 and ε = 1e-4 in lattice units (Voller & Prakash 1987; MUSHY), taken implicitly like a porous zone’s (Guo & Zhao 2002). A frozen cell’s velocity is about 2ε/A = 2e-6 of what it would be, a half-frozen cell’s 1/100, and above f_l 0.95 the flow is barely touched.

Algorithm

Set-up:

  1. α = k / (ρ c) of the fluid; τ_T = 4 α Δt / Δx² + ½. τ_T below 0.505 is refused (the grid cannot resolve the diffusivity at this time step; the message gives the cell Péclet number); above 2 the run warns that the transient is coarse in time.
  2. Conditions to lattice units: a flux becomes the temperature per step it adds through one cell face, Δt / ((ρ c)_f Δx) times the flux; held temperatures are taken relative to the zero.
  3. Solids and contacts to lattice units; the conducting cells, their faces and the fluid links into them. The sub-step count is the worst cell’s conductance sum over its capacity, over 0.9; more than 64 sub-steps (MAX_SUBSTEPS) is refused (“shorten the time step”). A contact between solids that share no cell face is refused.
  4. With steady, each solid’s capacity scaled as above.

Each time step:

  1. Buoyancy: every cell’s body force from its current temperature.
  2. The momentum lattice’s collision, streaming and open boundaries (Lattice Boltzmann flow).
  3. Scalar collision with the velocity the momentum lattice collided to (τ_T raised by α_t with turbulence).
  4. Scalar streaming with the wall, interface, inlet and outlet rules above.
  5. Each cell’s temperature (with a phase change, its temperature and liquid fraction from its enthalpy); conduction in the solids by sub-steps, each solving its cells’ balance with the interface heat implicit. The liquid fractions set the next step’s resistance.
  6. A temperature that is not a number stops the run as unstable, naming the step.

The heat each wall face receives is summed over its links like the momentum exchange. Links into inlet and outlet cells are left out: the open boundary sets all their populations after streaming, so that heat never stays in the fluid (counted, a held wall meeting a held inlet reported twice its heat, #675).

Output

solve.fluid adds, with heat:

FieldMeaning
tau_thermalThe scalar lattice’s τ_T.
temperaturemin and max of the fluid’s temperature in the last frame.
heatPer wall with non-zero heat (box face or obstacle face, with its body): the power into it, final and mean over the last quarter of the history; positive into the wall.
solidsPer conducting solid: body, cells, power, heat_to_fluid (final, mean: what its faces give the fluid), radiated (final, mean: the power it radiates to the surroundings, when it radiates), temperature (min, max, mean at the end), capacity_scale (when scaled), peak and peak_time, limit, margin (limit less peak; negative over it), ok.
components_okWhether every solid with a limit stays at or under it; null when none has a limit.
frozenWith a phase change: the share of the fluid frozen at the end, the mean over the fluid cells of 1 − f_l; null without. Reported by the solve, not saved with the results.

The peak is the solid’s steady value when the run stopped as steady (its last frame), else the highest over the run’s frames (a transient peak between two frames is not seen; more frames resolve it). Every frame carries the temperature of every cell.

solve.probe reads the temperature at points (points), the heat into named walls over time (heat), and along a line (line with field temperature or wall_heat_flux). The wall heat flux of a box wall is, at a held temperature, the second-order one-sided difference through the wall and the two cell layers beside it, (8 T_w − 9 T₁ + T₂) / (3 Δx) times k; at a flux face its flux; at an adiabatic face zero. A steady rule may monitor heat on faces and the mean_temperature (Steady state and averaging).

Worked example

The heated-flow sample: air at 20 °C flows at 1 mm/s past the upright L-bracket, whose faces are held at 80 °C. It shows held-temperature surfaces, the heat each face gives the air, and the temperature carried to the outlet. The sample has no buoyancy and no conducting solid.

Geometrythe upright L-bracket (60 × 40 × 50 mm, upright facing the inlet) on the floor of a 130 × 80 × 70 mm box
Cells5 mm: 5 824 (5 504 fluid)
Fluidair, ρ = 1.2 kg/m³, μ = 1.8 × 10⁻⁵ Pa s, k = 0.026 W/(m K), c = 1005 J/(kg K)
Flow boundariesx_min velocity 1 mm/s, x_max pressure 0, floor no-slip, sides and top slip; initial velocity 1 mm/s
Thermalinitial 20 °C; x_min held at 20 °C; every bracket face held at 80 °C (surfaces); other faces adiabatic
StepHeatedFlow: TRT, 180 steps of 0.25 s (45 s), six frames
Unitsmm, t, s, N, MPa; °C, mW
[
  {"command": "file.sample", "params": {"name": "heated-flow"}},
  {"command": "solve.fluid", "params": {"step": "HeatedFlow", "backend": "cpu"}},
  {"command": "results.surface", "params": {"field": "wall_heat_flux"}},
  {"command": "results.slice", "params": {"field": "temperature", "axis": "y", "position": 20}},
  {"command": "results.streamlines", "params": {"show": false}},
  {"command": "solve.probe", "params": {"step": "HeatedFlow", "points": [[92.5, -17.5, 2.5], [92.5, -17.5, 7.5]]}}
]

The outlet values come from solve.probe at the 224 cell centres of the last interior layer, x = 92.5 mm (y = −17.5 to 57.5 mm, z = 2.5 to 67.5 mm, every 5 mm; the probe above shows its first two points); the outlet layer itself, x = 97.5 mm, is an open-boundary layer.

Results from the solve.fluid reply (0.1–0.4 s, Apple M4 Max, CPU), results.surface and solve.probe:

QuantityFieldCraftSource
tau, tau_thermal0.95, 1.362solve.fluid
temperature (fluid)20 to 79.80 °Csolve.fluid
Heat into the bracket, all faces, final−509.0 mW (mean −542.6 mW)sum of heat
Largest face heat: F2:side:l6 (upright’s downstream face, 2 000 mm²)−186.5 mWheat
End faces F2:start, F2:top (y = 0 and 40 mm, mirror images about the mid-plane)−70.53 mW eachheat
Underside F2:side:l1 (on the floor)0results.surface
Largest flux: F2:side:l5 (upright’s top, 320 mm²)−0.1644 mW/mm²results.surface
Outlet temperature, mean of the 224 cells47.52 °C (43.27 to 52.49 °C)solve.probe
Outlet temperature, weighted by the axial velocity45.85 °Csolve.probe
Volume flow through the layer5 311 mm³/s (inlet 1 mm/s × 80 × 70 mm = 5 600 mm³/s)solve.probe
Heat carried through the layer, ρ c Q (T̄ − 20 °C)166 mWfrom the above
mass.relative_change2.2 × 10⁻³solve.fluid

The reply warns that the density varies by 15.9 % at the end (the weakly compressible error).

What to look at. Heat flows from the bracket into the air, so every face’s heat is negative (positive into the wall). The diffusivity α = k / (ρ c) = 21.6 mm²/s against 1 mm/s over the 50 mm upright is a Péclet number of about 2.3: conduction carries heat nearly as fast as the flow, and the warm region reaches upstream of the upright as well as downstream. τ_T = 1.362 is above ½ + √Λ_T (0.79), so the scalar lattice collides with two relaxation times. The run is a transient of 45 s, about a third of a pass through the 130 mm box: the layer before the outlet carries 166 mW of the 509 mW the bracket gives, and the rest is still warming the box. The sample is a display demonstration on a coarse grid, not a converged heat-transfer result.

Verification

Benchmarks (oracle; docs/oracle.md). De Vahl Davis’s differentially heated cavity, Pr 0.71, two-dimensional as a one-cell-thick periodic slab, 64² cells (128² at Ra 10⁶):

CaseQuantityReferenceFieldCraftErrorTolerance
de-vahl-davis-ra1e3mean Nu1.1181.1179−0.012 %0.13 %
largest local Nu1.5051.50730.155 %0.4 %
u H/α max3.6493.6481−0.026 %0.2 %
de-vahl-davis-ra1e4mean Nu2.2432.24640.152 %0.27 %
largest local Nu3.5283.54380.448 %0.55 %
w H/α max19.61719.630.064 %0.23 %
de-vahl-davis-ra1e5mean Nu4.5194.53460.345 %0.73 %
largest local Nu7.7177.73710.261 %0.68 %
smallest local Nu0.7290.74982.85 %6.3 %
de-vahl-davis-ra1e6 (nightly)mean Nu8.88.84760.541 %1.3 %
largest local Nu17.925—known failure1.6 %
u H/α max64.6365.461.28 %1.5 %

docs/oracle.md lists every quantity of these cases (the positions of the extremes and the mid-plane velocities too). The Ra 10⁶ largest local Nusselt number is 2.7 % low on 128 cells and listed as a known failure with its reason.

Conjugate cavity (conjugate-cavity-centred-body): the same cavity at Ra 10⁵ with a centred body of side H/2, 64² cells, against House, Beckermann & Smith (1990), Table 3:

k_s / k_fReference NuFieldCraftErrorTolerance
0.24.62574.63560.214 %0.6 %
14.50614.51510.201 %0.6 %
54.32214.32980.178 %0.6 %

The grid converges at second order from above: on 48 cells +0.5 %, on 64 cells +0.2 %; extrapolated from the two, −0.22 % from the published values (conjugate_cavity_matches_house_et_al, heavy).

Theory (crates/lbm/tests/thermal.rs, crates/lbm/tests/conjugate.rs; CPU):

CaseReferenceToleranceTest
Plates held at 0 and 1, no flowlinear profile, walls halfway between cells1e-9conduction_between_plates_is_linear
Flux through one plate, the other helddrop q H / k; wall heat q A1e-6a_heat_flux_sets_the_gradient_and_the_wall_heat_balances
Plug flow from a held inletthe inlet temperature everywhere1e-3the_flow_carries_the_inlet_temperature
Graetz channel, Pe 200the wall heat the inner layers received; out as ρ c_p Q (T_bulk − T_in)1e-9 / 2 %wall_heat_from_plates_that_start_at_the_inlet_is_what_the_fluid_keeps
Periodic flow with a heat blobtotal temperature conserved1e-10a_periodic_flow_conserves_and_carries_heat
Drifting sinedecays as e^(−α k² t); at rest 0.105 (k Δx)² faster, second order; along the flow the 4 u² deficitorders > 1.8a_drifting_sine_decays_at_the_diffusivity
De Vahl Davis, Ra 10³, 16 cells, TRT and regularisedNu 1.118; hot-wall heat equals cold-wall heat2 %; 1e-3natural_convection_cavity_is_close_on_a_coarse_grid
The same, Ra 10³ on 32 and 10⁴ on 48 cells1.118, 2.2431 %natural_convection_cavity_matches_de_vahl_davis (heavy)
Local wall flux at τ_T 0.8 and 1.4independent of τ_T with Λ_T fixed3e-3 (single relaxation time: > 2e-2)local_wall_heat_flux_does_not_depend_on_the_thermal_relaxation_time
Fluid, conducting slab, fluid in seriesq = ΔT / Σ (L/k), exact discrete solution1e-9a_composite_wall_conducts_in_series
Two solids with a contactjump q R across it1e-9a_contact_resistance_drops_the_temperature_by_q_r
Thin wall between held plates, normal along x, y and z, G 0, 0.05 and 10¹²q = ΔT / (L/k_f + 1/G); side temperatures T_hot − q L_low/k_f and T_cold + q L_high/k_f1e-9thin_wall_matches_series_conduction_on_every_axis (crates/lbm/tests/baffles.rs)
Counter-flowing Couette streams either side of the sheetu = U (1 − 2y) in both passages; the series conduction; equal and opposite shear on the sides1e-9counter_flowing_streams_either_side_of_a_conducting_sheet
Thin wall between held plates (oracle)q = ΔT / (L/k_f + 1/G) and both side temperatures1e-9thin-wall-series-conduction
Thin wall against the same wall resolved, one cell of k = G Δxthe slab’s flux and face temperatures: the series conduction with the fluid path shortened by Δx, ΔT / ((L − Δx)/k_f + 1/G); the thin wall’s, with the whole path1e-6; 1e-9thin_wall_matches_a_resolved_conducting_slab
A sheet in an isothermal flow driven by a moving wall across its edgeeach passage the half box with a resting wall in the sheet’s place, every cell at every step; the moving wall’s force twice the half box’s1e-13; 1e-12sheet_divides_an_isothermal_flow_driven_by_a_moving_wall_across_its_edge
Moving fluid either side, G 0, 0.05, 10¹²each passage’s mass; total heat; G = 0 passes none1e-11baffle_conserves_heat_and_each_passages_mass
A thin wall through commandsunits in and out; side difference = flux / G; refusals1e-9a_thin_wall_reports_both_sides (engine)
Powered die and lid, contactsolids gain power less what leaves, every step1e-9heat_crosses_a_contact_conserved_and_a_contact_must_touch
Heat-generating slabhalf the power to each plate; parabola, error s Δx² / (8 k_s), second order1e-6; 2 %; order > 1.8a_heat_generating_slab_balances_and_converges
Heated wall under a channel flowthe conduction solution2e-3a_heated_wall_under_a_channel_flow_conducts_across_it
Low-capacity cube, strong links (τ_T 0.52)stable, heat balanced every step1e-9a_low_capacity_solid_with_strong_links_stays_stable
Heated block in a channel flowheat balanced every step; at steady state its faces give the fluid its power1e-9; 1e-3a_heated_block_in_a_flow_conserves_heat
Slow block run to steady statecapacity scaled; same temperatures as a long fixed run1e-3 of the risea_steady_run_scales_a_slow_solid_and_lands_on_the_same_temperatures
Conduction limit of the House et al. cavityNu 0.7069, 1, 1.41381.5 %a_conducting_body_in_a_cavity_without_flow_matches_house_et_al
Square array of cylinders, κ 10 and 0.1, 16 cellsRayleigh’s series (Perrins et al. 1979; Godin 2012)1 %; 6 % (measured +0.55 %, −5.66 %)a_square_array_of_cylinders_conducts_as_rayleigh_s_series
Insulating cylinders on 32 and 64 cellsthe series−2.99 %, −1.21 %: first order or betterinsulating_cylinders_converge_at_first_order (heavy)
Slab on the hot plate radiating through the fluid (ε 0.9, to the cold plate’s 293.15 K), 8 and 16 cellsthe top cell’s balance (T₀ − T_c)/R₁ = (T_c − T₁)/R₂ + ε σ (T_c⁴ − T_amb⁴), exact on the lattice; measured: top cell 363.9536 K (8 cells), 362.6096 K (16) to < 10⁻⁹ K, radiation 53 % of the hot plate’s heat, the plates and the radiation closing the balance to round-off10⁻⁶ K; 10⁻⁶a_radiating_slab_balances_conduction_and_radiation
The 16-cell slab in the oraclethe same balance (Incropera & DeWitt, §3.1 and §1.3.1): top cell 362.609625 K, radiated 1.97422 W10⁻⁸ rel.; 10⁻⁶ rel.radiation-slab-lattice
Slab against limits either side of its peakpeak 7.625 °C, pass and fail2 %a_heated_slab_passes_and_fails_limits_either_side_of_its_peak

Melting and freezing (crates/lbm/tests/solidification.rs; CPU):

CaseReferenceMeasuredTolerance
Two-phase Stefan problem: liquid at +0.5 frozen from a wall at −1, melting at 0, L/c = 2 (Stefan numbers 0.5 and 0.25), frozen to 0.3Neumann’s front 2 λ √(α t), λ = 0.38341 (Carslaw & Jaeger 1959, §11.2)front within 0.97 % (64 cells per unit) and 0.27 % (128); temperatures within 9.0e-3 and 1.7e-3 of the 1.5 range1.2 %, 0.4 %; 0.8 %, 0.15 %
The samethe heat into the cold wall is the fall in the total enthalpy1.4e-14, 3.5e-141e-10
Channel between walls at −1 and +1, melting at −0.5, driven along itfrozen on the cold quarter; plane Poiseuille flow Q = a (H − y*)³ / (12 ν) in the liquid; frozen cells still+8.9 % (16 cells), +4.4 % (32): first order; frozen cells at 1e-7 of the peak speed9.5 %, 4.8 %; 5e-7
Water in a box frozen from one face, through commandsunits, the frozen share (a regression pin), refusals0.2216111e-6 relative; water_freezes_on_a_cold_face (engine)

The same two problems run through commands as oracle cases (docs/oracle.md; each case’s README has its refinement study), at the end of the run, 64 cells per unit:

CaseQuantityReferenceFieldCraftErrorTolerance
stefan-two-phasefrozen thickness0.299540.30036+0.27 %0.4 %
T in the solid, y = 0.1484−0.48624−0.485883.6e-41e-3
T in the liquid, y = 0.50780.195430.197672.2e-34e-3
frozen-channel-poiseuillefrozen share0.250.25< 1e-61e-6
largest velocity, a (H − y*)² / (8 ν)7.0312e-47.1344e-4+1.47 %2.2 %
its height0.6250.62226−2.7e-34e-3

Tests: a_freezing_front_follows_neumanns_solution, a_frozen_layer_stops_the_flow. The GPU backend refuses a phase change (melting_and_freezing_are_refused_clearly).

A measurement of a curved conjugate interface, Rahman et al.’s vented cavity with a passive conducting cylinder (40 cells), runs in the heavy job as a regression guardrail: its heated-wall Nusselt number stays within 2 % of the published 4.842449. That is not the 1 % target the case is meant for (rahman_curved_conjugate_coarse_measurement).

GPU against CPU (crates/lbm-gpu/tests/verification.rs): conduction between plates (profile within 5e-5, wall heat within 1e-4 of k ΔT A / H), a heated channel, a held inlet’s wall heat and natural convection, temperature within 2e-5 of the range and heat within 1e-4; composite wall with power, thermal contact, heated block in a channel, a conductor through the inlet and outlet, a conductor filling the box and a low-capacity solid, temperature and heat within 2e-5.

Limitations

  • Solid–fluid interfaces are staircases of cell faces: curved interfaces lose accuracy, an error of first order for insulating inclusions.
  • There is no contact resistance between a solid and the fluid.
  • Thin walls are planar, grid-aligned and span the whole box, without in-plane conduction or heat capacity; inlets and outlets, obstacles touching a sheet, turbulence, phase change, free surfaces, checkpoints and the GPU refuse them for now.
  • Radiation goes from conducting solids to the surroundings only: no exchange between surfaces (no view factors), no radiation from non-conducting obstacles or box walls, a transparent fluid, a gray surface with a constant emissivity; the solid radiates at its cell-centre temperature, half a cell from the surface. The GPU backend refuses it (#839).
  • The fluid’s conductivity is isotropic.
  • A steady run’s transient is not physical when a solid’s capacity is scaled.
  • The numerical diffusion along the flow, 4 u² of the diffusivity in lattice units, bounds the lattice speed of a heat problem.
  • The automatic time step does not take the buoyant velocity into account; it comes from the inlets, walls, pressures, fans and the driving acceleration (Lattice Boltzmann flow).
  • A solid’s peak is read from the frames: a transient peak between two frames is missed.
  • Melting and freezing: the front is diffuse over about one cell, and the liquid sees the frozen layer as a no-slip wall about a third of a cell inside it, so the flow along a front converges at first order (+4.4 % flow rate with 24 cells across the liquid). The mushy-zone resistance is a fixed lattice constant, not a permeability of the material. The density, conductivity and specific heat are the same in both phases, so there is no shrinkage and no change of conductivity on freezing. Filling (a melt front entering an empty mould) needs free-surface flow (#155). The GPU backend and conducting solids refuse a phase change.
  • The heated square cylinder in a channel (Dhiman, Chhabra & Eswaran 2005) is a pending oracle case with its reference values not yet transcribed.

Implementation

  • crates/lbm/src/flow.rs: ThermalState, collide_thermal, stream_thermal, open_boundaries_thermal, refresh_buoyancy, update_temperature, conduct; Phase, MUSHY, freezing (melting and freezing).
  • crates/lbm/src/baffle.rs: Baffle (thin walls: links, the through-wall mix, side results).
  • crates/lbm/src/conduction.rs: SolidHeat::build, series, with_resistance, smallest_capacity, MAX_SUBSTEPS.
  • crates/lbm/src/setup.rs: ThermalSetup, SolidSetup, ContactSetup, thermal_magic, THERMAL_MAGIC, the conversion of conditions, solids and contacts.
  • crates/lbm/src/solve.rs: HeatHistory, SolidResult, Peak, ComponentCheck, FluidResult::components_ok.
  • crates/lbm-gpu/src/lbm.wgsl: the scalar lattice and “Conducting solids”; native.rs solid_data.
  • crates/model/src/fluids.rs: FluidThermal, ThermalCondition, ConductingSolid, ThermalContact; crates/model/src/materials.rs: PhaseChange.
  • crates/engine/src/cmd/define.rs: model.fluid_domain.thermal_boundary, model.fluid_domain.limit, model.material.phase_change; crates/engine/src/cmd/solve.rs: the reply and solve.probe.

References

  • T. Krüger, H. Kusumaatmaja, A. Kuzmin, O. Shardt, G. Silva, E. M. Viggen. The Lattice Boltzmann Method: Principles and Practice. Springer, 2017. doi:10.1007/978-3-319-44649-3
  • I. Ginzburg. Equilibrium-type and link-type lattice Boltzmann models for generic advection and anisotropic-dispersion equation. Adv. Water Resour. 28:1171, 2005.
  • D. d’Humières, I. Ginzburg. Viscosity independent numerical errors for Lattice Boltzmann models: From recurrence equations to “magic” collision numbers. Comput. Math. Appl. 58:823, 2009.
  • B. Chopard, J.-L. Falcone, J. Latt. Eur. Phys. J. Special Topics 171:245–249, 2009.
  • Z. Guo, C. Zheng, B. Shi. Discrete lattice effects on the forcing term in the lattice Boltzmann method. Phys. Rev. E 65:046308, 2002. doi:10.1103/PhysRevE.65.046308
  • S. V. Patankar. Numerical Heat Transfer and Fluid Flow. Hemisphere, 1980.
  • L. Li, R. Mei, J. F. Klausner. Boundary conditions for thermal lattice Boltzmann equation method. J. Comput. Phys. 237:366–395, 2013.
  • F. P. Incropera, D. P. DeWitt, T. L. Bergman, A. S. Lavine. Fundamentals of Heat and Mass Transfer, 7th ed. Wiley, 2011.
  • G. de Vahl Davis. Natural convection of air in a square cavity: a bench mark numerical solution. Int. J. Numer. Methods Fluids 3:249–264, 1983. doi:10.1002/fld.1650030305
  • J. M. House, C. Beckermann, T. F. Smith. Effect of a centered conducting body on natural convection heat transfer in an enclosure. Numer. Heat Transfer A 18(2):213–225, 1990. doi:10.1080/10407789008944791
  • M. M. Rahman, M. A. Alim, S. Saha, M. K. Chowdhury. Mixed Convection in a Vented Square Cavity with a Heat Conducting Horizontal Solid Circular Cylinder. J. Naval Architecture and Marine Engineering 5(2):37–46, 2008. doi:10.3329/jname.v5i2.2504
  • W. T. Perrins, D. R. McKenzie, R. C. McPhedran. Transport properties of regular arrays of cylinders. Proc. R. Soc. Lond. A 369:207–225, 1979.
  • Y. A. Godin. J. Math. Phys. 53:063703, 2012.
  • A. K. Dhiman, R. P. Chhabra, V. Eswaran. Flow and heat transfer across a confined square cylinder in the steady flow regime: effect of Peclet number. Int. J. Heat Mass Transfer 48:4598–4614, 2005. doi:10.1016/j.ijheatmasstransfer.2005.04.033
  • R. Huang, H. Wu, P. Cheng. A new lattice Boltzmann model for solid–liquid phase change. Int. J. Heat Mass Transfer 59:295–301, 2013.
  • V. R. Voller. Fast implicit finite-difference method for the analysis of phase change problems. Numer. Heat Transfer B 17:155–169, 1990.
  • V. R. Voller, C. Prakash. A fixed grid numerical modelling methodology for convection–diffusion mushy region phase-change problems. Int. J. Heat Mass Transfer 30(8):1709–1719, 1987.
  • Z. Guo, T. S. Zhao. Lattice Boltzmann model for incompressible flows through porous media. Phys. Rev. E 66:036304, 2002.
  • H. S. Carslaw, J. C. Jaeger. Conduction of Heat in Solids, 2nd ed. Oxford, 1959 (§11.2, Neumann’s solution).