DfAM.in

DfAM Practitioner Program › Module 6 › Lesson 30

Module 6 · Lesson 30 of 42 · about 1 hour

Topology Optimisation: Numerical Implementation

Sensitivities, filters, projection, optimality criteria and MMA; the 99- and 88-line codes

Why This Topic Matters

Where we are: Lesson 29 stated the problem. This topic shows how it is actually solved, at a level that lets you read and modify a research code.

Motivation: Commercial tools hide the algorithm, but their settings (filter radius, penalty, move limit) only make sense if you know what they do. Research requires changing the code itself.

Analogy: Learning to drive is easier in a simple car with the bonnet open. The short educational codes are that car.

Industry practice: The 99-line and 88-line MATLAB codes are the starting point for a large share of published research on topology optimisation.

State of the art: Robust length-scale control, efficient solvers for very large problems and differentiable programming frameworks are current implementation topics.

The Optimisation Loop

1. Analyse: assemble the stiffness matrix with the current densities and solve for the displacements.

2. Evaluate: compute the objective and the constraints.

3. Differentiate: compute the sensitivity of the objective and constraints with respect to every density. The adjoint method gives all of them for the cost of about one extra solution.

4. Regularise: filter the sensitivities or the densities to remove numerical artefacts and impose a minimum length scale.

5. Update: change the densities with an optimality-criteria rule or a mathematical-programming method.

6. Check: stop when the largest density change falls below a tolerance; otherwise repeat.

Checkerboards, Mesh Dependence and Filters

Without regularisation the solution shows checkerboard patterns, which are a numerical artefact of low-order elements that appear falsely stiff.

The solution also depends on the mesh: finer meshes give ever finer members, because the unregularised problem has no smallest length scale.

Sensitivity filter: each element's sensitivity is replaced by a weighted average over a neighbourhood of radius r_min (Sigmund). Simple and effective.

Density filter: the densities themselves are averaged, and the physical density used in the analysis is the filtered one.

Projection: a smoothed step function pushes filtered densities back towards zero and one, giving crisp boundaries while keeping the length scale.

The filter radius is therefore a design parameter: it sets the minimum member size in the result (used again in Lesson 31).

Updating the Design

Optimality criteria: at the optimum the ratio of stiffness gain to volume cost is the same for every intermediate element. The update multiplies each density by that ratio raised to a damping power.

The Lagrange multiplier of the volume constraint is found by bisection so that the volume limit is met exactly at every iteration.

A move limit restricts the change of each density per iteration, which stabilises the process.

Method of moving asymptotes (MMA): a general-purpose algorithm by Svanberg that handles many constraints of any sign. It is the usual choice beyond compliance problems.

Continuation: the penalty exponent or the projection sharpness is raised gradually, which helps to avoid poor local optima.

The problem is non-convex, so different starting points or settings can give different, similarly good, designs.

Reading the Educational Codes

Key Relations: Filter, Projection and Update

Equations for: Key relations: filter, projection and update

Worked Example: One Filter Step and One Update Step by Hand

Equations for: Worked example: one filter step and one update step by hand

Revision Notes: Numerical Implementation

Explore Further

Code paper: Sigmund, 'A 99 line topology optimization code written in Matlab', Structural and Multidisciplinary Optimization 21, 2001.

Code paper: Andreassen et al., 'Efficient topology optimization in MATLAB using 88 lines of code', Structural and Multidisciplinary Optimization 43, 2011.

3D code: Liu and Tovar, 'An efficient 3D topology optimization code written in Matlab', Structural and Multidisciplinary Optimization 50, 2014.

Projection: Wang, Lazarov and Sigmund, 'On projection methods, convergence and robust formulations in topology optimization', Structural and Multidisciplinary Optimization 43, 2011.

Coding exercise (Lab 8): Run the 88-line code for an MBB beam with filter radii of 1.5, 3 and 6 elements. Describe how the layout and the compliance change.

Quick Check

Pick an answer for each question, then check.

1. The main purpose of the filter in density-based topology optimisation is to

2. In the optimality-criteria update, the Lagrange multiplier is chosen so that