1 Introduction
Femlab
, the shape optimization program by Allaire and Pantz (2006) for FreeFem++
, the open source topology optimization program ToPy
by Hunter (2009) for Python
, and the 99-line program for Michell-like truss structures by Sokół (2011) for Mathematica
.TopOpt
, the first topology optimization App for hand-held devices.TOPLSM
making use of the level-set method. Challis (2010) also used the level-set method but with discrete variables in a 129-line program. Suresh (2010) presented a 199-line program ParetoOptimalTracing
that traces the Pareto front for different volume fractions using topological sensitivities. More recently, Talischi et al. (2012a, b) introduced PolyMesher
and PolyTop
for density-based topology optimization using polygonal finite elements. The use of polygonal elements makes these programs suitable for arbitrary non-Cartesian design domains in two dimensions.top3d
that incorporates efficient strategies for three-dimensional topology optimization. This program can be effectively used in personal computers to generate structures of substantial size. This paper explains the use of top3d
in minimum compliance, compliant mechanism, and heat conduction topology optimization problems.top3d
code, and multiple alternative implementations. Finally, Section 7, offers some closing thoughts. The top3d
code is provided in Appendix C and can also be downloaded for free from the website: http://top3dapp.com.2 Theoretical background
2.1 Problem definition and ill-posedness
2.2 Homogenization method
2.3 Density-based approach
3 Finite element analysis
3.1 Equilibrium equation
Node |
ξ
1
|
ξ
2
|
ξ
3
|
---|---|---|---|
1 | −1 | −1 | −1 |
2 | +1 | −1 | −1 |
3 | +1 | +1 | −1 |
4 | −1 | +1 | −1 |
5 | −1 | −1 | +1 |
6 | +1 | −1 | +1 |
7 | +1 | +1 | +1 |
8 | −1 | +1 | +1 |
3.2 Numerical implementation
Node Number | Node coordinates | Node ID | Node Degree of Freedoms | ||
---|---|---|---|---|---|
x | y | z | |||
N
1
| (x
1, y
1, z
1) |
\(\texttt {NID}_{1}^{\dagger }\)
| 3∗NID1−2 | 3∗NID1−1 | 3∗NID1
|
N
2
| (x
1+1, y
1, z
1) | NID2=NID1+(nely+1) | 3∗NID2−2 | 3∗NID2−1 | 3∗NID2
|
N
3
| (x
1+1, y
1+1, z
1) | NID3=NID1+nely | 3∗NID3−2 | 3∗NID3−1 | 3∗NID3
|
N
4
| (x
1, y
1+1, z
1) | NID4=NID1−1 | 3∗NID4−2 | 3∗NID4−1 | 3∗NID4
|
N
5
| (x
1, y
1, z
1+1) |
\(\texttt {NID}_{5} = \texttt {NID}_{1}+\texttt {NID}_{z}^{\ddagger }\)
| 3∗NID5−2 | 3∗NID5−1 | 3∗NID5
|
N
6
| (x
1+1, y
1, z
1+1) | NID6=NID2+NID
z
| 3∗NID6−2 | 3∗NID6−1 | 3∗NID6
|
N
7
| (x
1+1, y
1+1, z
1+1) | NID7=NID3+NID
z
| 3∗NID7−2 | 3∗NID7−1 | 3∗NID7
|
N
8
| (x
1, y
1+1, z
1+1) | NID8=NID4+NID
z
| 3∗NID8−2 | 3∗NID8−1 | 3∗NID8
|
edofMat
with following Matlab lines:
nele
is the total number of elements, nodegrd
contains the node ID of the first grid of nodes in the x-y plane (for z = 0), the column vector edofVec
contains the node IDs of the first node at each element, and the connectivity matrix edofMat
of size nele × 24 containing the node IDs for each element. For the volume in Fig. 2, nelx=4, nely=1, and nelz=2, which results in
KE
(size 24 × 24) is obtained from the lk_H8
subroutine (lines 99-146). Matrices iK
(size 24 nele × 24) and jK
(size nele × 242), reshaped as column vectors, contain the rows and columns identifying the 24 × 24 × nele DOFs in the structure. The three-dimensional array xPhys (size nely × nelx × nelz) corresponds to the physical densities. The matrix sK
(size 242 × nele) contains all element stiffness matrices. The assembly procedure of the (sparse symmetric) global stiffness matrix K
(line 71) avoids the use of nested for
loops.U
is obtained from the solution of the equilibrium equation (16) by pre-multiplying the inverse of the stiffness matrix K
and the vector of nodal forces F
,
freedofs
indicate the unconstrained DOFs. For the cantilevered structure in Fig. 2, the constrained DOFs
jf
, and kf
are the coordinate of the fixed nodes, fixednid
are the node IDs, and fixeddof
are the location of the DOFs. The free DOFs, are then defined as
ndof
is the total number of DOFs. By default, the code constraints the left face of the prismatic structure and assigns a vertical load to the structure’s free-lower edge as depicted in Fig. 2. The user can define different load and support DOFs by changing the corresponding node coordinates (lines 12 and 16). Several examples are presented in Section 6.4 Optimization problem formulation
4.1 Minimum compliance
4.2 Compliant mechanism synthesis
Ud
(Line 74a) is the dummy load displacement field and vector U
(line 74b) is the input load displacement. The codes for the implementation of chain rule are not shown above since they are same as lines 79-80.4.3 Heat conduction
k0
and kmin
are the limits of the material’s thermal conductivity. The chain rule is applied same as before.5 Optimization algorithms
5.1 Sequential quadratic programming
Algorithm 1 SQP Algorithm | |
---|---|
Choose an initial feasible design x
(0); set k←0;
while (convergence criteria are not met) do
Identify active constraint matrix A in (36); Find appropriate step size α
(k); Set x
(k+1) ← x
(k) + α
(k)
d
(k); Set k←k+1
end
while
|
ce
in line 74:
fmincon
. The implementation of using fmincon
as an optimizer in our top3d
program is quite easy, but need some reconstructions of the program (one needs to divide program into different subfunctions, e.g., objective function, constraint function, Hessian function). To further assist on the implementation of an SQP strategy, the reader can find a step-by-step tutorial on our website http://top3dapp.com.5.2 Method of moving asymptotes
Algorithm 2 MMA Algorithm | |
---|---|
Choose an initial feasible design x
(0); set k←0;
while (convergence criteria are not met) do
if
k = 1 or k = 2 then
else
Find appropriate step size α
(k); end
if
Calculate derivate (28); Solve the MMA subproblem (41) to obtain \(\tilde {\mathrm {x}}^{(k+1)}\); Set x
(k−2) ← x
(k−1), x
(k−1) ← x
(k), x
(k) ← x
(k+1); Set k←k+1; end
while
|
mmasub
). The reader may obtain a copy by contacting Prof. Krister Svanberg (http://www.math.kth.se/%7Ekrille/Welcome.html) from KTH in Stockholm Sweden. Although mmasub
has total of 29 input and output variables, its implementation for top3d
is straightforward. The details can be found at http://top3dapp.com.5.3 Optimality criteria
volfrac
represents the volume fraction limit. Initially, the physical densities are assigned a constant uniform value, which is iteratively updated following the OC updating scheme (Algorithm 3).
Algorithm 3 OC Algorithm | |
---|---|
Choose an initial design x
(k); set k←0;
while (convergence criteria are not met) do
FE-analysis using (16) to obtain the corresponding nodal displacement U
(k); Compute objective function, e.g., compliance c, out- put displacement u
out; Sensitivity analysis by using the equations as dis- cussed in Section 4; other filters like those discussed in Section 6.1.4
Set x
(k+1) ← x
(k); Set k←k+1;
end
while
|
6 Numerical examples
nelx
, nely
, and nelz
are number of elements along x, y, and z directions, volfrac
is the volume fraction limit (\(\bar v\)), penal
is the penalization power (p), and rmin
is filter size (R). User-defined variables are set between lines 3 and 18. These variables determine the material model, termination criteria, loads, and supports. The following examples demonstrate the application of the code to minimum compliance problems, and its extension to compliant mechanism synthesis and heat condition.6.1 Minimum compliance
6.1.1 Boundary conditions
6.1.2 Multiple load cases
6.1.3 Active and passive elements
6.1.4 Alternative filters
conv2
(Andreassen et al. 2011), filtering based on Helmholtz type differential equations (Andreassen et al. 2011), Heaviside filter (Guest et al. 2004, 2011), and gray scale filter (Groenwold and Etman 2009). All the filters pursue a simple goal to achieve black-and-white structures. Two of them are chosen, which stand for classic and better performance, as well as easy implementation.ft
(ft=1 for density filter, ft=2 for sensitivity filter)
q
to the program (line 2)
6.1.5 Iterative solver
pcg
, called preconditioned conjugate gradients method, as shown in the following
Mesh size | Direct solver | Iterative solver |
---|---|---|
30 × 10 × 2 | 0.018 sec | 0.129 sec |
60 × 20 × 4 | 0.325 sec | 0.751 sec |
150 × 50 × 10 | 74.474 sec | 22.445 sec |
6.1.6 Continuation strategy
6.2 Compliant mechanism synthesis
6.3 Heat conduction
ndof
, edofMat
.edofMat
is changed in lines 30–35
7 Conclusions
top3d
. In this topology optimization algorithm, the problem formulation follows a density-based approach with a modified SIMP interpolation for physical densities. The finite element formulation makes use of eight-node hexahedral elements for which a closed-form expression of the element stiffness matrix is derived and numerically implemented. The hexahedral finite elements are used to uniformly discretize a prismatic design domain and solve three related topology optimization problems: minimum compliance, compliant mechanism, and heat conduction problems. For each problem, this paper includes the analytical derivation of the sensitivity coefficients used by three gradient-based optimization algorithms: SQP, MMA, and OC, which is implemented by default. For the implementation of SQP, this paper derives an analytic expression for the second order derivative.top3d
is demonstrated through several numerical examples. These examples include problems with a variety of boundary conditions, multiple load cases, active and passive elements, filters, and continuation strategies to mitigate convergence to a local minimum. The architecture of the code allows the user to map node coordinates of node degrees-of-freedom boundary conditions. In addition, the paper provides a strategy to handle large models with the use of an iterative solver. For large-scale finite-element models, the iterative solver is about 30 times faster than the traditional direct solver. While this implementation is limited to linear topology optimization problems with a linear constraint, it provides a clear perspective of the analytical and numerical effort involved in addressing three-dimensional structural topology optimization problems. Finally, additional academic resources such the use of MMA and SQP are available at http://top3dapp.com.