nx_heat_transfer_test.nx source
↩ module page · 29 lines · 1206 B
1// nx_heat_transfer_test.nx -- smoke for nx_heat_transfer. Proves Fourier
2// conduction flux and the Biot / Fourier dimensionless numbers that decide
3// a thermal process (cold spot + heat penetration).
4// Exit code = failed assertion number; 0 = all pass.
5
6import "nx_syscalls.nx"
7import "nx_heat_transfer.nx"
8
9func main() -> i64 {
10 // --- conduction flux: k=0.6 W/m.K, dT=50 K, L=10 mm -> 3000 W/m^2 ---
11 if ht_conduction_flux_wm2(6, 50, 10) != 3000 { return 1 }
12
13 // --- Biot number (h=100, Lc=10 mm, k=0.6) = 1.666 -> gradients matter ---
14 if ht_biot_milli(100, 10, 6) != 1666 { return 2 }
15 if ht_is_lumped(1666) != 0 { return 3 }
16 // a metal can (h=10, Lc=5 mm, k=40) is lumped
17 if ht_biot_milli(10, 5, 400) != 1 { return 4 }
18 if ht_is_lumped(1) != 1 { return 5 }
19 // boundary at Bi = 0.1
20 if ht_is_lumped(99) != 1 { return 6 }
21 if ht_is_lumped(100) != 0 { return 7 }
22
23 // --- Fourier number (alpha=0.14 mm^2/s, t=600 s, Lc=10 mm) = 0.84 ---
24 if ht_fourier_milli(14, 600, 10) != 840 { return 8 }
25 if ht_penetrated(840) != 1 { return 9 } // Fo >= 0.2 -> center reached
26 if ht_penetrated(150) != 0 { return 10 } // Fo 0.15 -> not yet
27
28 return 0
29}