Repository navigation
Mean gas temperature source: mean_temp_wall (thermally developed flow) and immersed-boundary support - #2200
Conversation
…ean_temp_wall) With mean_temp_wall = T_s, the mean gas temperature source becomes the local source of the periodic part psi = T - T_s of a thermally fully developed field T = T_s + psi exp(-beta x) (Sun, Tenneti & Subramaniam, IJHMT 2015): S = beta [rho cp u psi - d(lam psi)/dx - lam dpsi/dx + beta lam psi] The mean_temp controller still sets the source total qdot V_f and, in this mode, holds the flux-weighted mixing-cup temperature T_m instead of the mass mean T_b. beta is the root of qdot V_f = beta (A1 + beta A2), A1 = sum(rho cp u psi dV), A2 = sum(lam psi dV), that tends to qdot V_f / A1; beta, A1 and A2 are logged as columns 7-9 of mean_temp.dat. The uniform source is unchanged when the option is off. The thermostat now accepts no-slip/slip walls in y and z (x stays periodic). Add examples/2D_thermal_channel (plane channel between isothermal walls, the Nu = 7.541 acceptance case) and a test that runs it with mean_temp_wall.
The controller sums run over fluid cells only (zero volume inside a body), and the force and heat source are not applied inside bodies. The validator no longer rejects ib with mean_dpdx/mean_mflux/mean_qdot/mean_temp.
…ontroller gain); skip the thermal_channel example, whose goldens depend on the vendor
…e the thermal-channel thermostat golden at the small gain
|
Claude Code Review Head SHA: 21fbc82 Files changed:
Findings:
|
…require isothermal walls, conduction and a held flow, warn on a complex root
…GPU vendors; the Nu runs check it
… differ by ~1e-7)
… (the controller needs one, MFlowCode#2194)
…d per-cell source terms stored once per step, instead of fypp macros holding code
…tage as before (one shared kernel), not once per step
|
What this fixes / adds. How it was tested
What we found
CI on the current head was still running when this was written. (Hand tests run with Claude Code.) |
|
Reply to the Claude Code Review above (two medium findings):
(Reply written with Claude Code.) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2200 +/- ##
==========================================
+ Coverage 63.71% 64.91% +1.20%
==========================================
Files 90 110 +20
Lines 24569 29538 +4969
Branches 3584 4481 +897
==========================================
+ Hits 15653 19175 +3522
- Misses 6135 6812 +677
- Partials 2781 3551 +770 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
# Conflicts: # toolchain/mfc/test/cases.py
|
Hand test on NVIDIA after the merge with master (#2198 and #2204). wingtip, NVHPC 25.11 (
The conflict in (Hand test run with Claude Code.) |
…o m_body_forces, q_T_sf optional there
Lines of Code
|
…s ghost temperature also moves 8B2A7F3E, FAF04D7A and 3F5FE078 (MFlowCode#2213 inert and trace-species flux walls) and F8D466BD and C02C399E (MFlowCode#2200 thermostat, goldens regenerated for MFlowCode#2205) were generated on master without the isothermal ghost change.
What
Three changes to the mean-source machinery of #2177 and #2182 (
m_body_forces.fpp).mean_temp_wall, a self-similar thermostat for thermally developed flow past isothermal walls. Withmean_temp_wall = T_s, the mean gas temperature source becomes the local source of the periodic partpsi = T - T_sof a thermally fully developed fieldT = T_s + psi exp(-beta x)(Sun, Tenneti & Subramaniam, IJHMT 86, 2015):S = beta [rho cp u psi - d(lam psi)/dx - lam dpsi/dx + beta lam psi]. Themean_tempcontroller still sets the source totalqdot V_f, and in this mode holds the flux-weighted mixing-cup temperatureT_minstead of the mass meanT_b.betais the root ofqdot V_f = beta (A1 + beta A2), withA1the sum of the same discrete terms the source applies (so the balance holds next to bodies and for varying properties) andA2 = sum(lam psi dV);beta,A1andA2are columns 7 to 9 ofmean_temp.dat. The uniform source is unchanged when the option is off. The thermostat now accepts no-slip and slip walls in y and z (x stays periodic). The validator requires, withmean_temp_wall,chem_params%diffusion,mean_mflux(1) > 0(the mixing cup needs a held flow) and every wall and immersed boundary isothermal atmean_temp_wall.mean_dpdx/mean_mfluxandmean_qdot/mean_temp, which the validator rejected: the controller sums (fluid volume, mass flux, work, temperature averages) run over fluid cells only (zero volume inside a body), and the force and the heat source are not applied inside bodies. The two validator rejections are removed.examples/2D_thermal_channel: a plane channel between isothermal walls, the Nu = 7.541 acceptance case (the Nu is computed frommean_temp.dat).Tests:
IBM -> Periodic Circle -> Mean Pressure Gradient(single and two fluid) andIBM Reacting Surface -> Thermostatand-> Wall Temperature. The channel has no golden test: see the end of Verification.Verification
Results change only with
mean_temp_wallset or withiband a mean source together; the existing tests of #2177 and #2182 (Bodyforces,MeanDpdx,Thermostat) are unchanged.Nu = 7.541 (plane channel, constant properties), Tioga. Hot wall (330 K) and cold wall (270 K) pair, whose viscous heating cancels in the average: Nu = 7.7725 (hot) and 7.3224 (cold) at 64 cells across, average 7.548, +0.09% from 7.541; at 32 cells 7.7885 and 7.3238, average 7.556 (+0.20%). Nu is
-qdot H^2 / (k (T_w - T_0))frommean_temp.dat. These ran before #2154 merged; on the final head the 32-cell hot wall gives 7.7821 (7.7885 before the merge).Immersed boundary controller (
IBM -> Periodic Circle -> Mean Pressure Gradientrun for 800 steps): the logged flux settles at 0.04999999 against the target 0.05. An independent mean ofrho uover the fluid cells only, from the saved fields, is 0.0499 (0.24% low, from my geometric fluid mask), while the mean over all cells is 0.0484, 3% low: what a volume that included the body would give.GPU tests, at the final head
014f4fb95(master with #2193 to #2196 merged): AMD MI250X (Tioga, amdflang, OpenMP offload), goldens generated there: the 4 new tests pass;Bodyforces6,MeanDpdx1 andThermostatpass. NVIDIA + NVHPC (A100, OpenACC): the 4 new tests pass against the Tioga goldens at the default tolerance for the immersed-boundary mean-flux tests and at 1e-6 for the two reacting-surface thermostat tests;Bodyforces,MeanDpdxandThermostat(4 tests) pass../mfc.sh precheckand the Python validator tests (179) pass.Merging #2194 exposed one conflict, fixed here: its rule that the temperature controller needs a constant time step rejected the two reacting-surface thermostat tests (the example runs an adaptive step), so they now use
cfl_const_dtand their goldens were regenerated.An independent review led to: the applied source and the
betabalance now share one set of discrete terms (they differed next to bodies); the validator requirements listed above; a one-time message when thebetaquadratic has no real root (it then uses the vertex2 src/A1); and one macro for the repeated "zero inside bodies" pattern.Why the channel has no golden test. A golden of the channel differed between AMD and NVIDIA by up to 7e-3 after five steps even at a controller gain of 0.001, so it would not hold on other CI platforms. The cause is not isolated: the thermochemistry temperature solve stops at a relative tolerance of 1e-6, and both the isothermal wall and the controller (which differences the temperature and divides by dt) go through it. The channel is therefore checked by the Nu runs above, and the example is skipped in the Example suite for the same reason. The four immersed-boundary tests, which use a prescribed-temperature body and a small gain (0.001), agree between vendors at the default tolerance.
Not shown: only the plane channel is verified (the docs say so). The hot and cold wall cases in flows with streamlines of very different speed relax at different rates and
betais not converged there. TheIBM Reacting Surface -> Thermostat -> Wall Temperaturetest exercises that mode as a regression golden only (its temperature gap is far above the few percent the docs advise).nvfortran25.11, OpenACC--gpu acc -g 0 1 2 3 -j 4--gpu mp --mpi -j 4This PR was made with Claude Code (AI).