Educational article Struct Multidisc Optim 21, 120–127 Springer-Verlag 2001
A 99 line topology optimization code written in Matlab
O. Sigmund
Abstract The paper presents a compact Matlab im-
plementation of a topology optimization code for com-
pliance minimization of statically loaded structures. The
total number of Matlab input lines is 99 including opti-
mizer and Finite Element subroutine. The 99 lines are
divided into 36 lines for the main program, 12 lines for the
Optimality Criteria based optimizer, 16 lines for a mesh-
independency filter and 35 lines for the finite element
code. In fact, excluding comment lines and lines associ-
ated with output and finite element analysis, it is shown
that only 49 Matlab input lines are required for solving
a well-posed topology optimization problem. By adding
three additional lines, the program can solve problems
with multiple load cases. The code is intended for edu-
cational purposes. The complete Matlab code is given in
the Appendix and can be down-loaded from the web-site
http://www.topopt.dtu.dk.
Key words topology optimization, education, optimal-
ity criteria, world-wide web, Matlab code
1
Introduction
The Matlab code presented in this paper is intended
for engineering education. Students and newcomers to
the field of topology optimization can down-load the
code from the web-page http://www.topopt.dtu.dk.
The code may be used in courses in structural optimiza-
tion where students may be assigned to do extensions
such as multiple load-cases, alternative mesh-independ-
ency schemes, passive areas, etc. Another possibility is to
use the program to develop students’ intuition for optimal
design. Advanced students may be asked to guess the op-
timal topology for given boundary condition and volume
Received October 22, 1999
O. Sigmund
Department of Solid Mechanics, Building 404, Technical Uni-
versity of Denmark, DK-2800 Lyngby, Denmark
e-mail: sigmund@fam.dtu.dk
fraction and then the program shows the correct optimal
topology for comparison.
In the literature, one can find a multitude of approaches
for the solving of topology optimization problems. In the
original paper Bendsøe and Kikuchi (1988) a so-called
microstructure or homogenization based approach was
used, based on studies of existence of solutions.
The homogenization based approach has been adopted
in many papers but has the disadvantage that the deter-
mination and evaluation of optimal microstructures and
their orientations is cumbersome if not unresolved (for
noncompliance problems) and furthermore, the resulting
structures cannot be built since no definite length-scale
is associated with the microstructures. However, the ho-
mogenization approach to topology optimization is still
important in the sense that it can provide bounds on the
theoretical performance of structures.
An alternative approach to topology optimization is
the so-called “power-law approach” or SIMP approach
(Solid Isotropic Material with Penalization) (Bendsøe
1989; Zhou and Rozvany 1991; Mlejnek 1992). Here, ma-
terial properties are assumed constant within each elem-
ent used to discretize the design domain and the variables
are the element relative densities. The material proper-
ties are modelled as the relative material density raised
to some power times the material properties of solid ma-
terial. This approach has been criticized since it was ar-
gued that no physical material exists with properties de-
scribed by the power-law interpolation. However, a recent
paper by Bendsøe and Sigmund (1999) proved that the
power-law approach is physically permissible as long as
simple conditions on the power are satisfied (e.g. p ≥ 3
for Poisson’s ratio equal to
1
3
). To ensure existence of so-
lutions, the power-law approach must be combined with
a perimeter constraint, a gradient constraint or with fil-
tering techniques (see Sigmund and Petersson 1998, for
an overview). The power-law approach to topology op-
timization has been applied to problems with multiple
constraints, multiple physics and multiple materials.
Whereas the solution of the above mentioned ap-
proaches is based on mathematical programming tech-
niques and continuous design variables, a number of pa-
pers have appeared on solving the topology optimization
problem as an integer problem. Beckers (1999) success-