Minimizing Thermal Resistance Through Structural Design
Heat transfer engineering is a critical discipline in electronics cooling, aerospace, and materials science. In this post, we’ll tackle a classic structural optimization problem: how should we distribute high-conductivity material within a domain to maximize heat flow (minimize thermal resistance)?
Problem Formulation
We consider a 2D square domain $\Omega$ with a heat source and a heat sink. The goal is to find the optimal distribution of two materials — a high-conductivity material ($k_1$) and a low-conductivity base material ($k_0$) — subject to a volume constraint on the high-conductivity material.
Governing Equation
The steady-state heat conduction equation:
$$-\nabla \cdot (k(\mathbf{x}) \nabla T) = Q \quad \text{in } \Omega$$
with boundary conditions:
$$T = T_{\text{sink}} \quad \text{on } \Gamma_D, \qquad -k \frac{\partial T}{\partial n} = 0 \quad \text{on } \Gamma_N$$
Thermal Compliance (Objective to Minimize)
The thermal compliance (analogous to structural compliance) is:
$$C = \int_\Omega Q \cdot T , d\Omega$$
Minimizing $C$ is equivalent to minimizing thermal resistance, or maximizing heat flow from source to sink.
SIMP Interpolation
Using the Solid Isotropic Material with Penalization (SIMP) scheme:
$$k(\rho) = k_0 + \rho^p (k_1 - k_0)$$
where $\rho \in [0, 1]$ is the design variable (material density) and $p$ is the penalization exponent (typically $p = 3$).
Sensitivity Analysis
The sensitivity of the objective with respect to $\rho_e$:
$$\frac{\partial C}{\partial \rho_e} = -p \rho_e^{p-1}(k_1 - k_0) \int_{\Omega_e} |\nabla T|^2 , d\Omega_e$$
Optimality Criteria Update
$$\rho_e^{\text{new}} = \rho_e \cdot \left( \frac{-\partial C / \partial \rho_e}{\lambda} \right)^{1/2}$$
clipped to $[\rho_{\min}, 1]$, where $\lambda$ is found by bisection to satisfy the volume constraint.
Python Implementation
1 | import numpy as np |
Code Breakdown
1. SIMP Material Interpolation
The core of topology optimization is the SIMP scheme. Each element gets a density $\rho_e \in [0,1]$, and its conductivity is:
$$k_e = k_0 + \rho_e^p (k_1 - k_0)$$
With $p=3$, intermediate densities are heavily penalized, pushing the solution toward a crisp 0-or-1 design.
1 | ke_coeff = k0 + rho_phys**penal * (k1 - k0) |
The ratio $k_1/k_0 = 100$ means high-conductivity “channels” carry 100× more heat than the base material.
2. FEM Assembly — Bilinear Quad Element
The element conductance matrix for a unit square bilinear element is derived analytically:
$$[K_e] = k_e \int_{\Omega_e} [\nabla N]^T [\nabla N] , d\Omega$$
The result is the $4\times4$ matrix KE assembled once and reused for all elements (scaled by $k_e$). Global assembly loops over all elements and scatters contributions into the global sparse matrix:
1 | K[dofs[i], dofs[j]] += ke_val * KE[i, j] |
Dirichlet BCs (right edge fixed at $T=0$) are applied by extracting the free-DOF submatrix and solving:
$$[K_{ff}]{T_f} = {f_f}$$
3. Sensitivity Filtering
Raw sensitivities are noisy at the element level. A density filter smooths them:
$$\tilde{\partial C / \partial \rho_e} = \frac{1}{H_e \hat{\rho}e} \sum{f \in N_e} H_{ef} \hat{\rho}_f \frac{\partial C}{\partial \hat{\rho}_f}$$
where $H_{ef} = \max(0, r_{\min} - |e - f|)$ is the filter weight. This prevents checkerboard instabilities and mesh-dependent results.
4. Optimality Criteria (OC) Update
Instead of gradient descent, we use the Optimality Criteria method, which exploits the KKT conditions:
$$\rho_e^{\text{new}} = \min\left(1,, \min\left(\rho_e + m,, \max\left(\rho_{\min},, \max\left(\rho_e - m,, \rho_e \sqrt{\frac{-\partial C/\partial \rho_e}{\lambda}}\right)\right)\right)\right)$$
The Lagrange multiplier $\lambda$ is found by bisection to enforce the volume constraint $\sum \rho_e = V_f \cdot N_e$.
Graphs and Results

Panel-by-panel explanation:
Top-left — Optimal Material Distribution: The optimizer discovers branching, tree-like “thermal highways” connecting the heat source (left edge) to the sink (right edge). These high-density channels ($\rho \approx 1$) guide heat with minimal resistance — analogous to how veins branch in biological systems.
Top-center — Temperature Field: The temperature drops steeply across the optimized structure. The channels create nearly isothermal “pools” near the source, with a sharp gradient along the conducting paths — exactly what minimal thermal resistance looks like.
Top-right — Convergence History: Thermal compliance drops sharply in the first 20 iterations as the optimizer carves out channels, then plateaus as the design refines. The volume fraction (red dashed) converges to exactly 40% as required.
Bottom-left — 3D Density Surface: The 3D view reveals the hierarchical branching structure. The peaks ($\rho=1$) form a connected network; valleys ($\rho \approx 0$) are the base material acting as insulation.
Bottom-center — 3D Temperature Surface: The temperature “landscape” shows a steep cliff from left (hot source) to right (cold sink), with the optimized channels acting as ramps guiding heat downhill efficiently.
Bottom-right — Density Evolution Snapshots: At early iterations the density is nearly uniform. By iteration 20, channels begin to emerge. By iteration 40+ the branching structure is well-established, showing the self-organizing nature of topology optimization.

Heat Flux Analysis:
Left — Heat Flux Magnitude: The color reveals that flux is concentrated inside the high-conductivity channels (red/orange), while the background material barely carries any heat (yellow/white). This validates that the optimizer has successfully directed heat flow.
Right — Material + Flux Overlay: Red arrows following the blue channels confirm that heat flows preferentially through the optimized paths. The branching structure distributes heat collection across the entire left boundary, funneling it efficiently to the right sink.
Key Takeaways
The SIMP-based topology optimization naturally discovers dendrite-like branching structures — a pattern ubiquitous in nature (blood vessels, river deltas, leaf veins) because branching is the mathematically optimal way to distribute flow with minimal resistance.
The thermal compliance was reduced by over 60–70% compared to a uniform material distribution, using only 40% high-conductivity material. This means the structured design carries roughly 3× more heat for the same material cost — a powerful result with direct applications in heat sink design, PCB thermal management, and cooling channel layout.