In COMSOL: h_top = 14.4, h_bot = 7.2 W/m²K are fixed constants from t=0. Full convective cooling is applied from the very first second.
In TS: h is recomputed every timestep from the Churchill & Chu correlation at T_mean:
T_mean = float(np.mean(T)) # starts at T_amb = 20°C
ht = calc_h_top(T_mean) # → h ≈ 0 at t=0 !
At t=0, T_mean = T_amb, so ΔT = 0, Ra = 0, h = 0. TS starts with essentially zero convective cooling and only builds up h as the board heats. The full h=14.4 isn’t reached until T_mean ≈ 55°C (ΔT ≈ 35K above ambient).
So early in the transient:
| Time | COMSOL h_top | TS h_top (approx) |
|---|---|---|
| t = 0 s | 14.4 W/m²K | ~0 |
| t = 60 s | 14.4 W/m²K | ~5–8 |
| t = 300 s | 14.4 W/m²K | ~11–13 |
| SS | 14.4 W/m²K | 14.4 |
TS has far less cooling during the transient → rises faster and higher. At SS both converge to the same h, so SS temperatures should match closely. This matches exactly what the chart shows.
Simple fix: evaluate h at a representative ΔT from the start (e.g., use the current local temperature rather than T_mean, or initialise h at the SS value and let it update). The most direct fix to match the COMSOL setup would be to use fixed h values:
# Option: fix h to SS calibrated values (matches COMSOL setup)
ht = calc_h_top(T_AMB + 35.0) # evaluate at design ΔT=35K, constant
hb = calc_h_bottom(T_AMB + 35.0)
Or keep temperature-dependent h but evaluate at a better representative temperature than T_mean.no, I want fix that in comsol, not in TS, teach me how to defin ht and hb in comsol as fucntion of position and temperature.
In COMSOL, you define h as an expression in T directly in the Heat Flux boundary condition. Here’s how:
Step 1 — Define parameters (Global Definitions > Parameters)
| Name | Expression | Description |
|---|---|---|
T_amb | 293.15[K] | Ambient temperature |
k_air | 0.0271[W/(m*K)] | Air conductivity |
nu_air | 1.655e-5[m^2/s] | Kinematic viscosity |
alpha_air | 2.34e-5[m^2/s] | Thermal diffusivity |
L_c | 0.0292[m] | Characteristic length (A/P) |
H_SCALE | 1.76 | Nu calibration multiplier |
Step 2 — Define variables (Global Definitions > Variables)
dT_surf = max(T - T_amb, 0.001[K])
T_film = (T + T_amb) / 2
beta_air = 1 / T_film
Ra = 9.81[m/s^2] * beta_air * dT_surf * L_c^3 / (nu_air * alpha_air)
Nu_top = if(Ra < 1e7, 0.54 * Ra^0.25, 0.15 * Ra^(1/3))
Nu_bot = 0.27 * Ra^0.25
h_top_fn = Nu_top * k_air / L_c * H_SCALE
h_bot_fn = Nu_bot * k_air / L_c * H_SCALE
max(..., 0.001)avoids Ra=0 at t=0 when T=T_amb.
Step 3 — Apply to boundary conditions
Top surface — Heat Flux BC:
- Type:
General inward heat flux - Expression:
h_top_fn * (T_amb - T)
Bottom surface — Heat Flux BC:
- Expression:
h_bot_fn * (T_amb - T)
Alternatively, use the built-in “Convective heat flux” type and enter h_top_fn in the h field — COMSOL will evaluate it locally at each surface node’s current T automatically.
What this achieves
- At t=0: T=T_amb, dT≈0, Ra≈0, h≈0 (matches TS behaviour)
- At SS: Ra≈71,000, h_top≈14.4, h_bot≈7.2 W/m²K (matches calibrated values)
- COMSOL evaluates the expression locally per element at each timestep — better than TS which uses T_mean globally
- The transient h buildup will match TS more closely