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 canfindamultitude 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 13 ). 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-
121
fully solved large-scale compliance minimization prob-
lems using a dual-approach but other approaches based
on genetic algorithms or other semi-random approaches
require thousands of function evaluations even for small
number of elements and must be considered impractical.
Apart from above mentioned approaches, which all
solve well defined problems (e.g. minimization of com-
pliance) a number of heuristic or intuition based ap-
proaches have been shown to decrease compliance or
other objective functions. Among these methods are so-
called evolutionary design methods (see e.g. Xie and
Steven 1997; Baumgartner et al. 1992). Apart from be-
ing very easy to understand and implement (at least
for the compliance minimization case), the main moti-
vation for the evolutionary approaches seems to be that
mathematically based or continuous variable approaches
“involve some complex calculus operations and mathe-
matical programming” (citation from Li et al. 1999) and
they contain “mathematical methods of some complex-
ity” (citation from Zhao et al. 1998) whereas the evo-
lutionary approach “takes advantage of powerful com-
puting technology and intuitive concepts of evolution
processes in nature” (citation from Li et al. 1999). Two
things can be argued against this. First, the evolutionary
approaches become complicated themselves, once more
complex objectives than compliance minimization are
considered and second, as shown in this paper, the “math-
ematically based” approaches for compliance minimiza-
tion are simple to implement as well and are compu-
tationally equally efficient. Furthermore, mathematical
programming based methods can easily be extended to
other non-compliance objectives such as non-self-adjoint
and multiphysics problems and to problems with multiple
constraints (e.g. Sigmund 1999). Extensions of the evolu-
tionary approach to such cases seem more questionable.
The complete Matlab code is given in the Appendix.
The remainder of the paper consists of definition and
discussion of the optimization problem (Sect. 2), com-
ments about the Matlab implementation (Sect. 3) fol-
lowed by a discussion of extensions (Sect. 4) and a conclu-
sion (Sect. 5).
2
The topology optimization problem
A number of simplifications are introduced to simplify the
Matlab code. First, the design domain is assumed to be
rectangular and discretized by square finite elements. In
this way, the numbering of elements and nodes is simple
(column by column starting in the upper left corner) and
the aspect ratio of the structure is given by the ratio of
elements in the horizontal (nelx) and the vertical direc-
tion (nely).1
1 Names in type-writer style refer to Matlab variable names
that differ from the obvious (see the Matlab code in the
Appendix)
A topology optimization problem based on the power-
law approach, where the objective is to minimize compli-
ance can be written as
min
x
: c(x) =UTKU=
N∑
e=1
(xe)
p uTe k0 ue
subject to :
V (x)
V0
= f
: KU= F
: 000< xmin ≤ x≤ 111
,
(1)
where U and F are the global displacement and force
vectors, respectively, K is the global stiffness matrix, ue
and ke are the element displacement vector and stiffness
matrix, respectively, x is the vector of design variables,
xmin is a vector of minimum relative densities (non-zero
to avoid singularity), N (= nelx×nely) is the number
of elements used to discretize the design domain, p is the
penalization power (typically p = 3), V (x) and V0 is the
material volume and design domain volume, respectively
and f (volfrac) is the prescribed volume fraction.
The optimization problem (1) could be solved using
several different approaches such as Optimality Criteria
(OC) methods, Sequential Linear Programming (SLP)
methods or the Method of Moving Asymptotes (MMA by
Svanberg 1987) and others. For simplicity, we will here
use a standard OC-method.
Following Bendsøe (1995) a heuristic updating scheme
for the design variables can be formulated as
xnewe =
max(xmin, xe−m)
if xeB
η
e ≤ max(xmin, xe−m) ,
xeB
η
e
if max(xmin, xe−m)< xeBηe
本文档为【Ole Sigmund的99行拓扑优化Matlab程序】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。