Repository navigation
Add thermal_bc = 3: a lumped solid whose wall temperature follows its heat balance (after #1956) #2058
Description
Summary
Builds on #1956 (surface points, used here for the body's area), whose commits it includes until that merges.
Adds thermal_bc = 3: the IB is one lumped solid whose wall temperature, starting at Twall, evolves with its heat balance
m c_s dT/dt = Q_in + c_s (T − 298.15 K) Ṁ_out + heat_power − ε σ A (T⁴ − T_rad⁴)
- Q_in, Ṁ_out: energy into and mass out of the body, summed over every face between its cells and fluid cells from the same total fluxes the RHS differences (Riemann
flux_nplus viscous/conductive/diffusiveflux_src_n), weighted by the SSP-RK stages (1; ½, ½; ⅙, ⅙, ⅔). Over a step the body gains exactly what the fluid loses, reaction heat and the enthalpy of the gasified carbon included; E_solid = m c_s (T − 298.15 K) matches the formation-enthalpy reference of the gas energy. A face counts on the rank owning its fluid cell. heat_power: e.g. Joule heating of the CM3C carbon rods [W; W/m in 2D]. m =rho_solid·V, V from the geometry (circle per unit depth, sphere, cylinder); A from the surface points.
One temperature per body holds for small Biot number h·R/k_s, which graphite (k_s ≈ 25–100 W/m/K) satisfies for 100 µm particles and mm rods. In the ghost-state reconstruction a thermal_bc = 3 wall behaves as thermal_bc = 1 at its current temperature.
An earlier version took Q from the surface gradient k(T_s − T_IP)/d at the ghost points; that overstated the heat by 19–33% and got worse with resolution (see #1956), so the face fluxes replaced it.
Cost and scaling. Per RK stage and direction, one device pass over the faces, active only when some IB has thermal_bc = 3; per step, one MPI_Allreduce of 3 × num_gbl_ibs values and one device loop over the IBs. Nothing per IB crosses to the host, so moving IBs keep their device-side state. Whether the update runs is decided across all ranks: a rank whose neighbourhood holds no such body still joins the allreduce (decided per rank, this mismatched collectives on 16 ranks). The explicit step is safe: m c_s/(hA) ~ 10⁻² s for a 100 µm graphite particle against flow steps of ~10⁻⁹ s.
Restart. Twall becomes field 21 of restart_data/ib_state. The record width was a literal 20 in four Fortran places and in the toolchain's test harness; it is now ib_state_nfields in m_constants, which the harness reads, and the four writers share s_pack_ib_state in m_helper. Restart files written before this change are not readable after it.
New per-IB inputs: rho_solid, cp_solid, emissivity, T_rad, heat_power. Not supported with igr.
Testing
-
Inert graphite-like sphere (R = 50 µm, T₀ = 1000 K, ρc = 10⁵ J/m³/K) cooling in a closed, reflective box of 300 K air, MI300A:
resolution t T_p analytic* energy gained by gas / lost by solid R = 6h 10 µs 986.7 K 988.1 K 1.001 R = 6h 30 µs 971.9 K 974.5 K 1.000 R = 12h, 16 ranks 10 µs 987.1 K 988.1 K 0.999 Through 60 µs at R = 6h the ratio stays 1.000 (T_p = 953.7 K against 957.6 K analytic); at R = 12h it is 0.999 through 30 µs. At 30 µs the cooling exceeds the analytic estimate by 10% at R = 6h and 7% at R = 12h.
*4πkR(T − T∞)(1 + R/√(παt)) with constant film properties in an unbounded medium; the remaining few-percent gap is in the gas conduction itself (the box is 16R across and k varies ~2.5× across the thermal layer), not in the body's balance, which closes.
-
New case
2D -> Chemistry -> IBM Reacting Surface -> Lumped Wall: the reacting-surface example withthermal_bc = 3, ρc = 10⁴ J/m³/K andib_surface_wrton. -
./mfc.sh test --no-mpi -o IBM(61, including the particle-cloud cases that readib_state) and the reacting-surface example golden: pass. -
Validator:
test_a_lumped_body_needs_its_heat_capacity_and_shape.
./mfc.sh lint passes except the two [dp-acc] thermochem codegen tests, which also fail here without this change (LLNL gfortran 13.3.1's nvptx offload lacks log10).
Tested on LLNL Tuolumne (CCE 19 CPU; OpenMP offload on MI300A).
A fix for this is already written. The pull request was closed only to reduce the number of simultaneously open PRs from this author, not because the work was rejected or found incorrect.
- Closed PR: Add thermal_bc = 3: a lumped solid whose wall temperature follows its heat balance (after #1956) #1957
- Branch:
ib-lumped-temperatureon thesbryngelsonfork, at40bd5f6ac6 - Reopening needs no force-push and no rebase:
gh pr reopen 1957 -R MFlowCode/MFC
Tracked with the pr-to-do label so the whole set is discoverable together.
Filed with Claude Code.
Activity