An Efficient 3D Topology Optimization Code Written in Matlab
An Efficient 3D Topology Optimization Code Written in Matlab
DOI 10.1007/s00158-014-1107-x
EDUCATIONAL ARTICLE
Received: 17 October 2013 / Revised: 19 March 2014 / Accepted: 22 April 2014 / Published online: 25 June 2014
© Springer-Verlag Berlin Heidelberg 2014
Abstract This paper presents an efficient and compact with the ability to find innovative, high-performance struc-
M ATLAB code to solve three-dimensional topology opti- tural layouts, which has attracted the interest of applied
mization problems. The 169 lines comprising this code mathematicians and engineering designers. From the work
include finite element analysis, sensitivity analysis, density of Lucien Schmit in the 1960s (Schmit 1960)—who recog-
filter, optimality criterion optimizer, and display of results. nized the potential of combining optimization methods with
The basic code solves minimum compliance problems. A finite-element analysis for structural design—and the semi-
systematic approach is presented to easily modify the defini- nal paper by Bendsøe and Kikuchi (1988), there have been
tion of supports and external loads. The paper also includes more than eleven thousand journal publications in this area
instructions to define multiple load cases, active and pas- (Compendex list as of September 2013), several reference
sive elements, continuation strategy, synthesis of compliant books (Hassani and Hinton 1998; Bendsøe and Sigmund
mechanisms, and heat conduction problems, as well as the 2003; Christensen and Klarbring 2009), and a number of
theoretical and numerical elements to implement general readily available educational computer tools for M ATLAB
non-linear programming strategies such as SQP and MMA. and other platforms. Some examples of such tools include
The code is intended for students and newcomers in the the topology optimization program by Liu et al. (2005) for
topology optimization. The complete code is provided in Femlab, the shape optimization program by Allaire and
Appendix C and it can be downloaded from http://top3dapp. Pantz (2006) for FreeFem++, the open source topology
com. optimization program ToPy by Hunter (2009) for Python,
and the 99-line program for Michell-like truss structures by
Keywords Topology optimization · M ATLAB · Sokół (2011) for Mathematica.
Compliance · Compliant mechanism · Heat conduction · For M ATLAB, Sigmund (2001) introduced the 99-line
Non-linear programming program for two-dimensional topology optimization. This
program uses stiffness matrix assembly and filtering via
nested loops, which makes the code readable and well-
1 Introduction organized but also makes it slow when solving larger
problems. Andreassen et al. (2011) presented the 88-line
Topology optimization is a computational material distribu- program with improved assembly and filtering strategies.
tion method for synthesizing structures without any precon- When compared to the 99-line code in a benchmark prob-
ceived shape. This freedom provides topology optimization lem with 7500 elements, the 88-line code is two orders of
magnitude faster. From the same research group, Aage et al.
(2013) introduced TopOpt, the first topology optimization
App for hand-held devices.
K. Liu () · A. Tovar Also for M ATLAB, Wang et al. (2004) introduced the
Department of Mechanical Engineering,
199-line program TOPLSM making use of the level-set
Indiana University-Purdue University Indianapolis,
Indianapolis, IN 46202, USA method. Challis (2010) also used the level-set method but
e-mail: [email protected] with discrete variables in a 129-line program. Suresh (2010)
1176 K. Liu and A. Tovar
presented a 199-line program ParetoOptimalTracing compliance. As an illustration, assume that a design has
that traces the Pareto front for different volume fractions one single hole. Then, it is possible to find an improved
using topological sensitivities. More recently, Talischi et al. solution with the same mass and lower compliance when
(2012a, b) introduced PolyMesher and PolyTop for this hole is replaced by two smaller holes. Improved solu-
density-based topology optimization using polygonal finite tions can be successively found by increasing the number
elements. The use of polygonal elements makes these pro- of holes and reducing their size. The design will progress
grams suitable for arbitrary non-Cartesian design domains towards a chattering design within infinite number of holes
in two dimensions. of infinitesimal size. That makes the compliance problem
One of the few contributions to three-dimensional M AT- unbounded and, therefore, ill-posed.
LAB programs is presented by Zhou and Wang (2005). This One alternative to make the compliance problem well-
code, referred to as the 177-line program, is a successor posed is to control the perimeter of the structure (Haber and
to the 99-line program by Sigmund (2001) that inherits Jog 1996; Jog 2002). This method effectively avoids chat-
and amplifies the same drawbacks. Our paper presents a tering configurations, but its implementation is not free of
169-line program referred to as top3d that incorporates complications. It has been reported that the addition of a
efficient strategies for three-dimensional topology opti- perimeter constraint creates fluctuations during the iterative
mization. This program can be effectively used in personal optimization process so internal loops need to be incorpo-
computers to generate structures of substantial size. This rated (Duysinx 1997) Op. cit. (Bendsøe and Sigmund 2003).
paper explains the use of top3d in minimum compli- Also, small variations in the parameters of the algorithm
ance, compliant mechanism, and heat conduction topology lead to dramatic changes in the final layout (Jog 2002).
optimization problems.
The rest of this paper is organized as follows. Section 2 2.2 Homogenization method
briefly reviews theoretical aspects in topology optimiza-
tion with focus on the density-based approach. Section 3 Another alternative is to relax the binary condition and
introduces 3D finite element analysis and its numerical include intermediate material densities in the problem for-
implementation. Section 4 presents the formulation of three mulation. In this way, the chattering configurations become
typical topology optimization problems, namely, minimum part of the problem statement by assuming a periodically
compliance, compliant mechanism, and heat conduction. perforated microstructure. The mechanical properties of the
Section 5 discusses the optimization methods and their material are determined using the homogenization theory.
implementation in the code. Section 6 shows the numer- This method is referred to as the homogenization method
ical implementation procedures and results of three dif- for topology optimization (Bendsøe 1995; Allaire 2001).
ferent topology optimization problems, several extensions The main drawback of this approach is that the optimal
of the top3d code, and multiple alternative implementa- microstructure, which is required in the derivation of the
tions. Finally, Section 7, offers some closing thoughts. The relaxed problem, is not always known. This can be allevi-
top3d code is provided in Appendix C and can also be ated by restricting the method to a subclass of microstruc-
downloaded for free from the website: http://top3dapp.com. tures, possibly suboptimal but fully explicit. This approach,
referred to as partial relaxation, has been utilized by many
authors including Bendsøe and Kikuchi (1988), Allaire
2 Theoretical background and Kohn (1993), Allaire et al. (2004), and references
therein.
2.1 Problem definition and ill-posedness An additional problem with the homogenization meth-
ods is the manufacturability of the optimized structure.
A topology optimization problem can be defined as a binary The “gray” areas found in the final designs contain micro-
programming problem in which the objective is to find scopic length-scale holes that are difficult or impossible
the distribution of material in a prescribed area or volume to fabricate. However, this problem can be mitigated with
referred to as the design domain. A classical formulation, penalization strategies. One approach is to post-process the
referred to as the binary compliance problem, is to find the partially relaxed optimum and force the intermediate den-
“black and white” layout (i.e., solids and voids) that min- sities to take black or white values (Allaire et al. 1996).
imizes the work done by external forces (or compliance) This a posteriori procedure results in binary designs, but it
subject to a volume constraint. is purely numerical and mesh dependent. Other approach
The binary compliance problem is known to be ill-posed is to impose a priori restrictions on the microstructure that
(Kohn and Strang 1986a, b, c). In particular, it is possible implicitly lead to black-and-white designs (Bendsøe 1995).
to obtain a non-convergent sequence of feasible black- Even though penalization methods have shown to be effec-
and-white designs that monotonically reduce the structure’s tive in avoiding or mitigating intermediate densities, they
An efficient 3D topology optimization code written in Matlab 1177
revert the problem back to the original ill-possedness with where the operator dist(i, j ) is the distance between the cen-
respect to mesh refinement. ter of element i and the center of element j , and R is the
size of the neighborhood or filter size. The weight factor
2.3 Density-based approach Hij may be defined as a function of the distance between
neighboring elements, for example
An alternative that avoids the application of homogenization
theory is to relax the binary problem using a continu- Hij = R − dist(i, j ), (5)
ous density value with no microstructure. In this method, where j ∈ Ni . The filtered density x˜i defines a modi-
referred to as the density-based approach, the material dis- fied (physical) density field that is now incorporated in the
tribution problem is parametrized by the material density topology optimization formulation and the SIMP model as
distribution. In a discretized design domain, the mechan-
p
ical properties of the material element, i.e., the stiffness Ei (x̃i ) = Emin + x̃i (E0 − Emin ), x̃i ∈ [0, 1]. (6)
tensor, are determined using a power-law interpolation func-
The regularized SIMP interpolation formula defined by (6)
tion between void and solid (Bendsøe 1989; Mlejnek 1992).
used in this work.
The power law may implicitly penalize intermediate density
values driving the structure towards a black-and-white con-
figuration. This penalization procedure is usually referred
3 Finite element analysis
to as the Solid Isotropic Material with Penalization (SIMP)
method (Zhou and Rozvany 1991). The SIMP method does
3.1 Equilibrium equation
not solve the problem’s ill-possedness, but it is simpler than
other penalization methods.
Following the regularized SIMP method given by (6) and
The SIMP method is based on a heuristic relation
the generalized Hooke’s law, the three-dimensional consti-
between (relative) element density xi and element Young’s
tutive matrix for an isotropic element i is interpolated from
modulus Ei given by
void to solid as
p
Ei = Ei (xi ) = xi E0 , xi ∈]0, 1], (1)
Ci (x̃i ) = Ei (x̃i )C0i , x̃i ∈ [0, 1], (7)
where E0 is the elastic modulus of the solid material and p is
the penalization power (p > 1). A modified SIMP approach where C0i is the constitutive matrix with unit Young’s
is given by modulus. The unit constitutive matrix is given by
p
Ei = Ei (xi ) = Emin + xi (E0 − Emin ), xi ∈ [0, 1], (2) 1
C0i = ×
where Emin is the elastic modulus of the void material, (1 + ν)(1 − 2ν)
⎡1−ν ν ν 0 0 0 ⎤
which is non-zero to avoid singularity of the finite element
stiffness matrix. The modified SIMP approach, as (2), offers ⎢ ν 1−ν ν 0 0 0 ⎥
⎢ ν ν 1−ν 0 0 0 ⎥
⎢ ⎥ , (8)
a number of advantages over the classical SIMP formula- ⎢ 0 0 0 (1 − 2ν)/2 0 0 ⎥
⎣ ⎦
tion, as shown in (1), including the independency between 0 0 0 0 (1 − 2ν)/2 0
the minimum value of the material’s elastic modulus and the 0 0 0 0 0 (1 − 2ν)/2
penalization power (Sigmund 2007).
However, topology optimization methods are likely to where ν is the Poisson’s ratio of the isotropic material.
encounter numerical difficulties such as mesh-dependency, Using the finite element method, the elastic solid element
checkerboard patterns, and local minima (Bendsøe and stiffness matrix is the volume integral of the elements con-
Sigmund 2003). In order to mitigate such issues, resear- stitutive matrix Ci (x̃i ) and the strain–displacement matrix
chers have proposed the use of regularization techniques B in the form of
(Sigmund and Peterson 1998). One of the most common +1 +1 +1
approaches is the use of density filters (Bruns and Tortorelli ki (x̃i ) = BT Ci (x̃i )Bdξ1 dξ2 dξ3 , (9)
−1 −1 −1
2001). A basic filter density function is defined as
where ξe (e = 1, . . . , 3) are the natural coordinates as
j ∈N Hij vj xj shown in Fig. 1, and the hexahedron coordinates of the cor-
x̃i = i , (3)
j ∈Ni Hij vj ners are shown in Table 1. The strain–displacement matrix
where Ni is the neighborhood of an element xi with volume B relates the strain and the nodal displacement u, = Bu.
vi , and Hij is a weight factor. The neighborhood is defined Using the SIMP method, the element stiffness matrix is
as interpolated as
Replacing values in (11), the 24 × 24 element stiffness Consider the discretized prismatic structure in Fig. 2 com-
matrix k0i for an eight-node hexahedral element is posed of eight eight-noded cubic elements. The nodes
identified with a number (node ID) ordered column-wise
⎡ ⎤ up-to-bottom, left-to-right, and back-to-front. The position
k1 k2 k3 k4
1 ⎢ kT k5 k6 kT4 ⎥ of each node is defined with respect to Cartesian coordinate
0
ki = ⎢ 2 ⎥ (12)
(ν + 1)(1 − 2ν) ⎣ kT3 k6 kT5 kT2 ⎦ system with origin at the left-bottom-back corner.
k4 k3 k2 kT1 Within each element, the eight nodes N1 , . . . , N8 are
ordered in counter-clockwise direction as shown in Fig. 3.
where km (m = 1, . . . , 6) are 6 × 6 symmetric matrices (see Note that the “local” node number (Ni ) does not follow the
Appendix A). One can also verify that k0i is positive definite. same rule as the “global” node ID (NIDi ) system in Fig. 2.
The global stiffness matrix K is obtained by the assembly Given the size of the volume (nelx × nely × nelz) and
of element-level counterparts ki , the global coordinates of node N1 (x1 , y1 , z1 ), one can iden-
tify the global node coordinates and node IDs of the other
K(x̃) = n
i=1 ki (x̃i ) = n 0
i=1 Ei (x̃i )ki , (13) seven nodes in that element by the mapping the relationships
as summarized in Table 2.
where n is the total number of elements. Using the global Each node in the structure has three degrees of free-
versions of the element stiffness matrices Ki and K0i , (13) dom (DOFs) corresponding to linear displacements in x-y-z
is expressed as directions (one element has 24 DOFs). The degrees of free-
dom are organized in the nodal displacement vector U
n n
as
K(x̃) = Ki (x̃i ) = Ei (x̃i )K0i . (14)
T
i=1 i=1
U = U1x , U1y , U1z , . . . , U8×nz ,
Node ξ1 ξ2 ξ3 1 3 5 7 9
11 13 15 17 19
1 −1 −1 −1 y 23
25 27 29
21
2 +1 −1 −1 2 x 4 6 8 10
3 +1 +1 −1 12 z 14 16 18 20
4 −1 +1 −1 22 24 26 28 30
5 −1 −1 +1
6 +1 −1 +1
7 +1 +1 +1
8 −1 +1 +1 Fig. 2 Global node IDs in a prismatic structure composed of 8
elements
An efficient 3D topology optimization code written in Matlab 1179
N4 N3 the node IDs for each element. For the volume in Fig. 2,
nelx = 4, nely = 1, and nelz = 2, which results in
⎡ ⎤
N8 N7 4 5 6 · · · 31 32 33 ← Element 1
⎢ 10 11 12 · · · 37 38 39 ⎥ ← Element 2
y ⎢ ⎥
⎢ 16 17 18 · · · 43 44 45 ⎥ ← Element 3
x ⎢ ⎥
z ⎢ 22 23 24 · · · 49 50 51 ⎥ ← Element 4
edofMat = ⎢ ⎢ ⎥
N1 N2 ⎥
⎢ 34 35 36 · · · 61 62 63 ⎥ ← Element 5
⎢ 40 41 42 · · · 67 68 69 ⎥ ← Element 6
⎢ ⎥
N5 N6 ⎣ 46 47 48 · · · 73 74 75 ⎦ ← Element 7
52 53 54 · · · 79 80 81 ← Element 8 .
Fig. 3 Local node numbers within a cubic element
The element connectivity matrix edofMat is used to
assemble the global stiffness matrix K as follows:
Table 2 Illustration of relationships between node number, node coordinates, node ID and node DOFs
x y z
†
NID1 = z1 *(nelx+1)*(nely+1)+x1 ∗(nely+1)+(nely+1 − y1 )
‡
NIDz = (nelx+1)*(nely+1)
1180 K. Liu and A. Tovar
where the indices freedofs indicate the unconstrained The derivative of the volume constraint v(x̃) in (18) with
DOFs. For the cantilevered structure in Fig. 2, the con- respect to the design variable xe is given
strained DOFs
∂v(x̃) ∂v(x̃) ∂ x̃i
= (19)
∂xe ∂ x̃i ∂xe
i∈Ne
where
where jf, and kf are the coordinate of the fixed nodes, ∂v(x̃)
= vi (20)
fixednid are the node IDs, and fixeddof are the ∂ x̃i
location of the DOFs. The free DOFs, are then defined as
and
∂ x̃i Hie ve
= . (21)
∂xe j ∈Ni Hij vj
where ndof is the total number of DOFs. By default, the
code constraints the left face of the prismatic structure and The code uses a mesh with equally sized cubic elements of
assigns a vertical load to the structure’s free-lower edge as unit volume, then vi = vj = ve = 1.
depicted in Fig. 2. The user can define different load and The derivative of the compliance is
support DOFs by changing the corresponding node coordi-
∂c(x̃) ∂c(x̃) ∂ x̃i
nates (lines 12 and 16). Several examples are presented in = (22)
∂xe ∂ x̃i ∂xe
Section 6. i∈Ne
The numerical implementation of minimum compliance where udi (k0i ) is the part of the adjoint vector associated
problem can be done as the following: with element i. In this case, ∂c(k0i )/∂ x̃i may be positive or
negative.
The numerical implementation of the objective function
(31) and sensitivity (32) are
where L is a unit length vector with zeros at all degrees K(k0i )U(k0i ) = F,
of freedom except at the output point where it is one, and
−1 where U(k0i ) now donates the finite element global nodal
U x̃ = K x̃ F. temperature vector, F donates the global thermal load vec-
To obtain the sensitivity of the new cost function c(x̃) in tor, and K(k0i ) donates the global thermal conductivity
(29), let us define a global adjoint vector Ud (x̃) from the matrix. For a material with isotropic properties, conductivity
solution of the adjoint problem is the same in all directions.
The optimization problem for heat conduction is
K(x̃)Ud (x̃) = −L. (30)
find k0i = [x1 , x2, . . . , xe , . . . , xn ]T
Using (30) in (29), the objective function can be expressed
as minimize c(k0i ) = FT U(k0i )
(33)
subject to v x̃ = x̃T v − v̄ 0
c(x̃) = Ud (x̃)T K(x̃)U(x̃). (31)
x ∈ , = {x ∈ n : 0 x 1},
The derivative of c(x̃) with respect to the design variable −1
xe is again obtained by the chain rule, where U x̃ = K x̃ F, and K(x̃) is obtained by the
assembly of element thermal conductivity matrices ki (x̃i ).
∂c(x̃) ∂c(x̃) ∂ x̃i
= , Following the interpolation function in (6), the element
∂xe ∂ x̃i ∂xe conductivity matrix is expressed as
i∈Ne
p
where ∂ x̃i /∂xe is described by (21), and ∂c(x̃)/∂ x̃i can be ki (x̃i ) = kmin + (k0 − kmin )x̃i k0i , (34)
obtained using direct differentiation. The use of the interpo-
where kmin and k0 represent the limits of the material’s
lation given by (6) yields an expression similar to the one
thermal conductivity coefficient and k0i donates the ele-
obtained in (28),
ment conductivity matrix. Note that (34) may be considered
∂c(x̃)
p−1 as the distribution of two material phases: a good thermal
= udi (x̃)T px̃i (E0 − Emin )k0i ui (x̃). (32)
∂ x̃i conduction (k0 ) and the other a poor conductor (kmin ).
1182 K. Liu and A. Tovar
The sensitivity analysis of the cost function in (33) is approximation of the minimum compliance problem in (18)
given by can be expressed as
find d
∂c(x̃) ∂c(x̃) ∂ x̃i
= , 1 T 2 (k) T
∂xe
i∈Ne
∂ x̃i ∂xe minimize d ∇ c d + ∇c(k) d (36)
2
subject to Ad = 0,
where ∂ x̃i /∂xe is described by (21) and
where c(k) is the value of the objective function evaluated at
x(k) and d = x − x(k) , and A is the matrix of active con-
∂c(x̃) p−1
= −ui (x̃)T (k0 − kmin )px̃i k0i ui (x̃). (35) straints. The optimality and feasibility conditions of (36)
∂ x̃i
yield
6 Numerical examples
y
z x
Secondly, defining the corresponding boundary condi-
tions
6.1.1 Boundary conditions Also the force vector (line 22) and displacement vector
(line 23) become more than one column:
The boundary conditions and loading conditions are defined
in lines 12-18. Since the node coordinates and node numbers
The objective function is now the sum of different load
are automatically mapped by the program, defining different
cases
boundary conditions is very simple. To solve a 3D wheel
M M
problem as shown in Fig. 5, which is constrained by planar
joint on the corners with a downward point load in the center c(x̃) = cl (x̃) = FTl Ul x̃ (51)
l=1 l=1
of the bottom, the following changes need to be made:
Firstly, changing loading conditions where M is the number of load cases.
2
y
z x
1
Fig. 6 Topology optimization of cantilever beam with multiple load cases. Left Initial design domain, middle topology optimized beam with one
load case, and right topology optimized beam with two load cases
1186 K. Liu and A. Tovar
y
z x
Fig. 8 Topology optimized design used a mesh with 30 × 10 × 2 ele- filter and gray scale filter, and right optimized design using sensitivity
ments. Left optimized design using density filter, middle left optimized filter and gray scale filter
design using density filter, middle right optimized design using density
1188 K. Liu and A. Tovar
Table 4 Three-dimensional
examples: Cantilever, MBB,
and L-shape problem. Left:
Initial design domains, right:
topology optimized results
and applying gray scale filter. The underlined triangle perform a continuation step. As previously presented by
represents a three-dimensional planar joint. Groenwold and Etman (2010), the continuation step is given
as
6.1.6 Continuation strategy 1 k 20,
pk = (53)
min{pmax , 1.02pk−1 } k > 20,
Convexity is a very preferable property since every local
where k is the iteration number, and pmax is the maximum
minima is also the global minima, and what the pro-
penalization power.
gram is solving for is the global minima. Unfortunately,
Though this methodology is not proven to converge to
the use of SIMP method to achieve binary solution will
the global optimum, it regularizes the algorithm and allows
destroy the convexity of the optimization problem. For such
the comparison of different optimization strategies.
problems, it is possible that for different starting points
Implementing the continuation strategy is done by adding
the program converges to totally different local minima.
a single line after line 68:
In order to penalize intermediate densities and mitigate
the premature convergence to one of the multiple local
minima when solving the non-convex problem, one could
An efficient 3D topology optimization code written in Matlab 1189
Also, since there is only one DOF per node in heat The finite element connectivity matrix edofMat is
condition problems, some variables need to change corre- changed in lines 30–35
spondingly, such as ndof, edofMat.
Change the total number of DOFs and the force vector in
lines 21–22
Sink
y
z x
7 Conclusions
approach with a modified SIMP interpolation for physi- for e = 1, . . . , 3 and q = 1, . . . , 8. The corresponding
cal densities. The finite element formulation makes use shape functions nq in a natural coordinate systems ξe are
of eight-node hexahedral elements for which a closed- defined by
form expression of the element stiffness matrix is derived ⎧ ⎫
⎪
⎪ (1 − ξ1 )(1 − ξ2 )(1 − ξ3 )⎪ ⎪
and numerically implemented. The hexahedral finite ele- ⎪
⎪ ⎪
⎪
⎪
⎪ (1 + ξ )(1 − ξ )(1 − ξ3 ⎪
)⎪
ments are used to uniformly discretize a prismatic design ⎪
⎪ 1 2 ⎪
⎪
⎪
⎪ ⎪
⎪
domain and solve three related topology optimization ⎪
⎪ (1 + ξ )(1 + ξ )(1 − ξ )⎪
⎪
⎪
⎪
1 2 3
⎪
⎪
problems: minimum compliance, compliant mechanism, ⎨
1 (1 − ξ1 )(1 + ξ2 )(1 − ξ3 )⎬
and heat conduction problems. For each problem, this nq (ξe ) = .
8⎪
⎪ (1 − ξ1 )(1 − ξ2 )(1 + ξ3 )⎪ ⎪
paper includes the analytical derivation of the sensitiv- ⎪
⎪ ⎪
⎪
⎪
⎪ (1 + ξ1 )(1 − ξ2 )(1 + ξ3 )⎪ ⎪
ity coefficients used by three gradient-based optimiza- ⎪
⎪ ⎪
⎪
⎪
⎪ ⎪
⎪
tion algorithms: SQP, MMA, and OC, which is imple- ⎪
⎪ (1 + ξ )(1 + ξ )(1 + ξ3 ⎪
)⎪
⎪
⎪
1 2 ⎪
⎪
mented by default. For the implementation of SQP, this ⎩ ⎭
(1 − ξ1 )(1 + ξ2 )(1 + ξ3 )
paper derives an analytic expression for the second order
derivative. Substituting values to (11), the 24 × 24 element stiffness
The use of top3d is demonstrated through several matrix k0i for an eight-node hexahedral element can be
numerical examples. These examples include problems with expressed as ⎡ ⎤
k1 k2 k3 k4
a variety of boundary conditions, multiple load cases, active 1 ⎢ kT k5 k6 kT ⎥
and passive elements, filters, and continuation strategies k0i = ⎢ 2 4 ⎥,
(ν + 1)(1 − 2ν) ⎣ kT3 k6 kT5 kT2 ⎦
to mitigate convergence to a local minimum. The archi-
k4 k3 k2 kT1
tecture of the code allows the user to map node coor-
dinates of node degrees-of-freedom boundary conditions. where
In addition, the paper provides a strategy to handle large ⎡ ⎤
k1 k2 k2 k3 k5 k5
models with the use of an iterative solver. For large- ⎢ k2 k1 k2 k4 k6 k7 ⎥
⎢ ⎥
scale finite-element models, the iterative solver is about ⎢ k2 k2 k1 k4 k7 k6 ⎥
k1 =⎢
⎢ k3
⎥,
30 times faster than the traditional direct solver. While
⎢ k4 k4 k1 k8 k8 ⎥
⎥
this implementation is limited to linear topology opti- ⎣ k5 k6 k7 k8 k1 k2 ⎦
mization problems with a linear constraint, it provides a k5 k7 k6 k8 k2 k1
clear perspective of the analytical and numerical effort ⎡ ⎤
k9 k8 k12 k6 k4 k7
involved in addressing three-dimensional structural topol-
⎢ k8 k9 k12 k5 k3 k5 ⎥
ogy optimization problems. Finally, additional academic ⎢ ⎥
⎢ k10 k10 k13 k7 k4 k6 ⎥
resources such the use of MMA and SQP are available at k2 =⎢
⎢ k6
⎥,
⎢ k5 k11 k9 k2 k10 ⎥
⎥
http://top3dapp.com. ⎣ k4 k3 k5 k2 k9 k12 ⎦
k11 k4 k6 k12 k10 k13
⎡ ⎤
Appendix A: Symbolic expression of k0 k6 k7 k4 k9 k12 k8
⎢ k7 k6 k4 k10 k13 k10 ⎥
⎢ ⎥
This appendix presents the analytical results of the element ⎢ k5 k5 k3 k8 k12 k9 ⎥
k3 =⎢
⎢ k9
⎥,
stiffness matrix k0 as discussed in Section 3. This sym- ⎢ k10 k2 k6 k11 k5 ⎥⎥
bolic expression of k0 is also been used by the program ⎣ k12 k13 k10 k11 k6 k4 ⎦
subroutine lk H8. k k12 k9 k4 k5 k3
⎡ 2 ⎤
Recall that, for an eight-node hexahedral element, the k14 k11 k11 k13 k10 k10
strain-displacement matrix B is defined by ⎢ k11 k14 k11 k12 k9 k8 ⎥
⎢ ⎥
⎡ ⎤ ⎢ k11 k11 k14 k12 k8 k9 ⎥
∂nq (ξe ) k4 =⎢
⎢ k13
⎥,
k14 k7 k7 ⎥
∂n1 (ξe )
0 0 · · · 0 0 k12 k12
⎢ ∂ξ 1 ∂ξ 1 ⎥ ⎢ ⎥
⎢ ∂nq (ξe ) ⎥ ⎣ k10 k9 k8 k7 k14 k11 ⎦
⎢0 ∂n1 (ξe )
0 · · · 0 ⎥
⎢ ∂ξ2 ∂ξ2 ⎥ k k8 k9 k7 k11 k14
⎢ ∂nq (ξe ) ⎥ ⎡ 10 ⎤
⎢0 0 ∂n1 (ξe )
· · · 0 0 ⎥ k1 k2 k8 k3 k5 k4
⎢ ∂ξ3 ∂ξ3 ⎥
B=⎢ ⎥, ⎢ k2 k1 k8 k4 k6 k11 ⎥
⎢ ∂n1 (ξe ) ∂n1 (ξe ) 0 ∂nq (ξe ) ∂nq (ξe )
· · · ∂ξ ⎥ ⎢ ⎥
⎢ ∂ξ2 ∂ξ1 ∂ξ1 0 ⎥ ⎢ k8 k8 k1 k5 k11 k6 ⎥
⎢ 2
⎥ k5 =⎢ ⎥,
⎢ ∂n1 (ξe ) ∂n1 (ξe ) ∂nq (ξe ) ∂nq (ξe ) ⎥ ⎢ k3 k1 k8 k2 ⎥
⎢0 · · · 0 ∂ξ2 ⎥ ⎢ k4 k5 ⎥
⎣ ∂ξ3 ∂ξ2 ∂ξ3
⎦ ⎣ k5 k6 k11 k8 k1 k8 ⎦
∂n1 (ξe ) ∂n1 (ξe ) ∂nq (ξe ) ∂nq (ξe )
∂ξ3 0 ∂ξ1 · · · ∂ξ3 0 ∂ξ1 k4 k11 k6 k2 k8 k1
1192 K. Liu and A. Tovar
⎡ ⎤ ∂ 2c ∂ ∂ki
k14 k11 k7 k13 k10 k12 = −ui T ui
∂ x̃i ∂ x̃j ∂ x̃j ∂ x̃i
⎢ k11 k14 k7 k12 k9 k2 ⎥
⎢ ⎥ ∂ui T ∂ki ∂ki
⎢ k7 k7 k14 k10 k2 k9 ⎥
=− ui − ui T ui
k6 = ⎢ ⎥, ∂ x̃j ∂ x̃i ∂ x̃i ∂ x̃j
⎢ k13 k12 k10 k14 k7 k11 ⎥ ∂ki ∂ui
⎢ ⎥ − ui T (B2)
⎣ k10 k9 k2 k7 k14 k7 ⎦ ∂ x̃i ∂ x̃j
k12 k2 k9 k11 k7 k14 From (B1), the middle term of (B2) goes to zero. In order
to get the expression for ∂ui /∂ x̃j in the first and third terms,
and
let us rewriting (16) as
k1 = −(6ν − 4)/9, ki ui = fi .
k2 = 1/12,
Now if we differentiate both sides with respect to x̃j , we
k3 = −1/9, get
k4 = −(4ν − 1)/12, ∂ki ∂ui
ui + ki = 0,
∂ x̃j ∂ x̃j
k5 = (4ν − 1)/12,
which yields
k6 = 1/18,
∂ui ∂ki
k7 = 1/24, = −k−1
i ui . (B3)
∂ x̃j ∂ x̃j
k8 = −1/12,
k9 = (6ν − 5)/36, Substitute (B3) into (B1), we have
k10 = −(4ν − 1)/24,
T
k11 = −1/24, ∂2c ∂ki ∂ki ∂ki ∂ki
= − −k−1 i ui ui − uTi −k−1
i ui ,
∂ x̃i ∂ x̃j ∂ x̃j ∂ x̃i ∂ x̃i ∂ x̃j
k12 = (4ν − 1)/24,
∂ki
∂ki
= 2uTi k−1 ui ,
k13 = (3ν − 1)/18, ∂ x̃j i
∂ x̃i
k14 = (3ν − 2)/18.
where the last equality holds since
As can be seen from above, the 64 × 64 entries in the
element stiffness matrix can be represented by fourteen uTi
∂ki
k−1
∂ki
ui
i
components (but not independent!). ∂ x̃j ∂ x̃i
!T
∂ki ∂ki
= uTi k−1
i ui
∂ x̃j ∂ x̃i
T T
Appendix B: Derivation of the Hessian Matrix =
∂ki
ui uTi
∂ki
k−1
i
∂ x̃i ∂ x̃j
In this appendix, we will discuss the derivation of the second ∂k ∂k
k−1
i i
= uTi i ui . (B4)
∂ x̃i ∂ x̃j
order derivative of the objective function. Structure compli-
ance will be used as the objective function, the expression
for other objective functions can be derived similarly. As discussed earlier, when i = j , ∂ki /∂ x̃j = 0. When i = j,
Recall that the first order derivative of the compliance is subsituting (B1), (10) and (6) into (B4), we have
given by
∂2c
p−1
∂ x̃2i
= 2 uTi p x̃i (E0 − Emin )k0i [Emin +
∂c ∂ki
= −ui T ui , p
−1
p−1
∂ x̃i ∂ x̃i x̃i (E0 − Emin )k0i p x̃i (E0 − Emin )k0i ui
2
p−1 p −1
where by applying the modified SIMP method (6), we have = 2 p x̃i (E0 − Emin ) Emin + x̃i (E0 − Emin )
uTi k0i ui .
∂ki p−1
= px̃i (E0 − Emin )k0i . (B1) Therefore, the Hessian of the structural compliance is
∂ x̃i
given by:
⎧
Note that for brevity of notation, we omitted the depen- ⎪
⎨0,
∂ 2c i = j,
dence on x̃ in this appendix. = −1
∂ x̃i ∂ x̃j ⎪
⎩2 p x̃p−1 (E − E ) 2 E p 0
min + x̃i (E0 − Emin ) uT
i ki ui , i = j.
A second differentiation of the compliance yields i 0 min
An efficient 3D topology optimization code written in Matlab 1193
Bendsøe MP, Sigmund O (2003) Topology optimization: theory, Liu Z, Korvink JG, Huang I (2005) Structure topology optimization:
method and applications. Springer fully coupled level set method via FEMLAB. Struct Multidiscipl
Bruns TE, Tortorelli DA (2001) Topology optimization of non-linear Optim 6(29):407–417
elastic structures and compliant mechanisms. Comput Methods Mlejnek H (1992) Some aspects of the genesis of structures. Struct
Appl Mech Eng 190(26–27):3443–3459 Optim 5(1–2):64–69
Challis VJ (2010) A discrete level-set topology optimization code Nocedal J, Wright S (2006) Numerical optimization, 2nd edn. Springer
written in matlab. Struct Multidiscip Optim 41(3):453–464 Schmit LA (1960) Structural design by systematic synthesis. In: 2nd
Christensen PW, Klarbring A (2009) An introduction to structural ASCE conference of electrical compounds. Pittsburgh, pp 139–
optimization. Springer 149
Duysinx P (1997) Layout optimization: A mathematical program- Sigmund O (1994) Design of material structures using topology
ming approach, DCAMM report. Technical report, Danish Center optimization, PhD thesis, Technical University of Denmark
of Applied Mathematics and Mechanics, Technical University of Sigmund O (1997) On the design of compliant mechanisms using
Denmark, DK-2800 Lyngby topology optimization. Mech Struct Mach 25(4):495–526
Fleury C (1989) CONLIN: an efficient dual optimizer based on convex Sigmund O (2001) A 99 line topology optimization code written in
approximation concepts. Struct Optim 1(2):81–89 matlab. Struct Multidiscip Optim 21(2):120–127
Groenwold AA, Etman LFP (2009) A simple heuristic for gray-scale Sigmund O (2007) Morphology-based black and white filters for
suppression in optimality criterion-based topology optimization. topology optimization. Struct Multidiscip Optim 33:401–424
Struct Multidiscip Optim 39(2):217–225 Sigmund O, Peterson J (1998) Numerical instabilities in topology
Groenwold AA, Etman LFP (2010) A quadratic approximation for optimization: a survey on procedures dealing with checkerboards,
structural topology optimization. Int J Numer Methods Eng mesh-dependencies and local minima. Struct Optim 16:68–75
82(4):505–524 Sokół T (2011) A 99 line code for discretized michell truss optimiza-
Guest JK, Prevost JH, Belytschko T (2004) Achieving minimum tion written in mathematica. Struct Multidiscip Optim 43(2):181–
length scale in topology optimization using nodal design vari- 190
ables and projection functions. Int J Numer Methods Eng 61:238– Suresh K (2010) A 199-line matlab code for pareto-optimal tracing in
254 topology optimization. Struct Multidiscip Optim 42:665–679
Guest JK, Asadpoure A, Ha SH (2011) Elimiating beta-continuation Svanberg K (1987) The method of moving asymptotes-a new method
from heaviside projection and density filter algorithms. Struct for structural optimzation. Int J Numer Methods Eng 24:359–
Multidiscip Optim 44:443–453 373
Haber R, Jog C (1996) A new approach to variable-topology shape
design using a constraint on perimeter. Struct Optim 11(1):1–12 Talischi C, Paulino GH, Pereira A, Menezes IFM (2012a) Polymesher:
Hassani B, Hinton E (1998) Homogenization and structural topology a general-purpose mesh generator for polygonal elements written
optimization: theory, practice and software. Springer in matlab. Struct Multidiscip Optim 45:309–328
Hestenes MR, Stiefel E (1952) Methods of conjugate gradients for Talischi C, Paulino GH, Pereira A, Menezes IFM (2012b) Polytop: a
solving linear systems. J Res Natl Bur Stand 49(6) matlab implementation of a general topology optimization frame-
Hunter W (2009) Predominantly solid-void three-dimensional topol- work using unstructured polygonal finite element meshes. Struct
ogy optimisation using open source software. Master’s thesis, Multidiscip Optim 45:329–357
University of Stellenbosch Wang MY, Chen S, Xia Q (2004) Structural topology optimization
Jog C (2002) Topology design of structures using a dual algorithm with the level set method. http://www2.acae.cuhk.edu.hk/cmdl/
and a constraint on the perimeter. Int J Numer Methods Eng download.htm
54(7):1007–1019 Wilson RB (1963) A simplicial method for convex programming, PhD
Kohn R, Strang G (1986a) Optimal design and relaxation of variational thesis, Harvard University
problems (part I). Commun Pure Applied Math 39(1):113–137 Zhou M, Rozvany G (1991) The COC algorithm, part II: topological,
Kohn R, Strang G (1986b) Optimal design and relaxation of variational geometrical and generalized shape optimization. Comp Meth Appl
problems (part II). Commun Pure Appl Math 39(2):139–182 Mech Eng 89:309–336
Kohn R, Strang G (1986c) Optimal design and relaxation of variational Zhou S, Wang MY (2005) 3d structural topology optimization with the
problems (part III). Commun Pure Appl Math 39(3):353–377 simp method. http://www2.acae.cuhk.edu.hk/cmdl/download.htm