Code to Optimize a Shape for Heat Transfer Using Homogenization

A code was written to optimize the geometry of a of a good conductor to maximize heat transfer by minimizing compliance. The method of homogenization was used, whereby a hypothetical laminate with infinitely small laminate widths is assumed to exist over the whole region, in which the laminate is always oriented with its strong axis in the direction of the temperature gradient. The percentage content of the good conductor is optimized for all elements in the region, using LaGrange multipliers to insure total area of the good conductor did not exceed a given percentage of the region.

The formulation variation is used to determine the change in the objective function in in response to a perturbation of content change. Then, a formula for a perturbation in the content was found that will always (assuming step is sufficiently small) reduce the compliance. This perturbation is calculated for each successive iteration, and the percentage content of material A is optimized. Finally, penalization is used to discretize the results so that any given point is either made of good conductor or bad conductor.

Code was written in FreeFEM, an open-source finite element analysis solver based on C++, to perform iterations, calculate perturbations, and penalize. Code was based on examples by G. Allaire available here. The code is generalized, and can be applied with different regions, different heat loads, different materials, and isotropic and anisotropic conductors.


Example: Optimizing the shape of material B (good conductor, limited to 20% of area), and material A (bad conductor, 80% of area), with a parabolic source of heat imposed. The problem is shown in figure 1. The optimized percentage content of material A in the laminate at each point is shown below in figure 2.

Figure 1: Diagram showing region size boundary conditions, and heat imposed

Figure 2: Percentage content of material A in region in the hypothetical laminate

Penalization was then utilized to discretize the region into either material A or material B. Penalization was integrated into the optimization iteration, with a function below, where θ is the percentage content of material A at each point, and r is a number in the range [.95, .99], in which a lower number gives faster penalization.

As expected, root-like structures developed, which pulls heat from the source to the sink, shown in figure 3.

Figure 3: Optimized shape of material B in the region to maximize heat transfer. Material B has formed roots, which spread out to maximize heat transfer, just like roots of trees, which spread out to maximize water intake.

A final temperature gradient was calculated, shown below in figure 4. A valley-ridge pattern of the temperature is visible at the heat source. This effect occurs where individual roots cause little valleys in the temperature at their point of contact with the heat source.

Figure 4: Temperature in the region after optimizing the shape of a good conductor to minimize compliance.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at

Up ↑

%d bloggers like this: