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.

Testing a 21 ft Model Steel Bridge: Vibration Testing, Destructive Pullout-Testing, Full Scale Cyclic Load Testing

The UC San Diego Steel Bridge Team designs, analyzes, optimizes, and fabricates a model steel bridge. The team optimizes for high stiffness, low weight, and fast constructability.

Extensive testing was performed on the model bridge for the 2022 UC San Diego Steel Bridge Team. The testing was performed to insure sufficient strength of members and connections, to accurately predict local load-deformation behavior of connections and global load-deformation of the whole bridge, and to perform a vibration system identification of the bridge.

21 ft-long steel bridge model, optimize to: (1)weigh 182.1 lb (2)take 2600 lb, 14.3 times self-weight, with a deflection of .31 inches at center span, and (3)be assembled in just 6.5 minutes

1. Vibration Testing

Vibration testing was performed with a home-made setup of accelerometers and Arduino micro-controllers in an attempt to identify system properties. First natural freq. of 7.9 Hz aligns fairly closely with predicted 8.8 Hz from analytical dynamic FEA model. Significant variation observed in higher modes.

Notes on instrumentation:

  • 3-axis accelerometers stick to bridge with magnets (right pic)
  • Arduino nano micro controllers (left pic) communicate with up to 3 accelerometers
  • Computer with C++ and MATLAB to coordinate microcontrollers and compile/postprocess data.
  • Karl Johnson, a UCSD electrical engineering student, coded and integrated the accelerometer system, teaching UCSD steel Bridge members how to sauder and wire circuit boards in the process, and how to communicate with Arduino microcontrollers with laptops. Open source code is published here: GitHub Accelerometer Code
  • Smartphones can also be utilized to record vibration data. Saul and teammates created a document with MATLAB code for how to remotely control your phone as an accelerometer through the MATLAB app, and graph acceleration data. The document is here: Acceleration from MATLAB phone app

2. Destructive Pullout-Testing

The destructive connection testing was used as part of the connection design process. A robust set of design, analysis, prototyping, and testing techniques were used, including:

  • Hand calculations based on AISC § J3 to check for bearing capacity exceedance, net section failure, and pull out failure
  • Finite Element Analysis models using “worst case” loading scenarios for connections with complex geometries (left picture).
  • Destructive prototype testing (center, right) to verify results of hand calculations, Finite Element Analysis, to determine weld strength and loading behavior. Force-deformation results were then applied to “weak members” in a SAP 2000 to accurately estimate bridge deflection, both from local connection deformation and global elastic deformation.

3. Cyclic Loading Tests

We performed 3 full-scale loading and unloading tests prior to competitions to (1)insure sufficient strength and (2)measure experimental deflection and compare to analytical linear-elastic FEA model.

The right figure shows loading curves of the bridge. The pink test was performed after stiffness-increasing
updates were made in preparation for nationals.

The bridge does not fully rebound to initial position, indicating irreversible “play” or other inelastic deformation in the connections. This “play” was quantified through the destructive pull-out testing, allowing the team to accurately model the inelastic behavior of the bridge in SAP 2000. Connection are being built for the 2023 steel bridge with heat-treated chromoly, in order to reduce local yielding of connections and thus reduce inelastic behavior of the bridge. Carefully consideration is being used to balance the goal of local stiffness with the need for ductility.

Truss optimization in Python, C++, and AMPL with a Multi-Objective Function of Weight, Stiffness, and Constructability

I am deriving a mathematical model – and writing optimization code in Python, C++, and AMPL – to be able to optimize trusses (which could be a skyscraper, bridge, crane, etc…) to support a given set of loads, or multiple sets of loads, while (1) minimizing weight, (2) maximizing stiffness, (3) minimizing construction difficulty, or (4) for any multi-objective function that combines these factors. So far, I have been able to optimize for the any of the three factors on their own – albeit only with smaller problems for construction difficulty, due to the discrete variables inherent in evaluating construction difficulty – as well as with for combinations of minimizing weight and maximizing stiffness.

The code is being published under an open-source license on my GitHub. A full document with detailed mathematical derivations and optimization routines for many truss optimization examples is available, also on my GitHub here: TrussOptimizationDoc. Below are some fun examples of optimized trusses.

Minimizing Number of Members and Adding Member Length Constraint

Volume Minimization with Joint Cost to Simplify Constructability

Code adapted from “A Python script for adaptive layout optimization of trusses”, L. He, M. Gilbert, X. Song, Struct.
Multidisc. Optim., 2019.

Optimizing a Balance Between Low Weight and High Stiffness

Create a website or blog at

Up ↑