没有合适的资源?快使用搜索试试~ 我知道了~
首页matlab实现水平集方法
matlab实现水平集方法
5星 · 超过95%的资源 需积分: 49 165 下载量 186 浏览量
更新于2023-03-16
评论 14
收藏 382KB PDF 举报
学习水平集方法的基础知识,用matlab实现水平集,与matlab99行拓扑优化类似。入门级程序代码
资源详情
资源评论
资源推荐
Struct Multidisc Optim (2010) 41:453–464
DOI 10.1007/s00158-009-0430-0
EDUCATIONAL ARTICLE
A discrete level-set topology optimization code
written in Matlab
Vivien J. Challis
Received: 26 November 2008 / Revised: 7 August 2009 / Accepted: 8 August 2009 / Published online: 25 September 2009
© Springer-Verlag 2009
Abstract This paper presents a compact Matlab im-
plementation of the level-set method for topology
optimization. The code can be used to minimize the
compliance of a statically loaded structure. Simple code
modifications to extend the code for different and mul-
tiple load cases are given. The code is inspired by a Mat-
lab implementation of the solid isotropic material with
penalization (SIMP) method for topology optimization
(Sigmund, Struct Multidiscipl Optim 21:120–127, 2001).
Including the finite element solver and comments, the
code is 129 lines long. The code is intended for educa-
tional purposes, and in particular it could be used along-
side the Matlab implementation of the SIMP method
for topology optimization to demonstrate the similari-
ties and differences between the two approaches.
Keywords Topology optimization · Level-set method ·
Matlab code · Education
1 Introduction
This paper presents a simple Matlab implementation
of the level-set method for topology optimization ap-
plied to compliance minimization of statically loaded
structures. The code is intended for educational pur-
Electronic supplementary material The online of this article
(doi:10.1007/s00158-009-0430-0) contains supplementary
material, which is available to authorized users.
V. J. Challis (
B
)
Department of Mathematics, The University of Queensland,
Brisbane, Queensland 4072, Australia
e-mail: vchallis@maths.uq.edu.au
poses and can be downloaded as supplementary mate-
rial available with this article. This article is inspired
by a similar one (Sigmund 2001) which presented a
simple Matlab implementation of the solid isotropic
material with penalization (SIMP) method for topology
optimization.
Level-set methods for moving interface problems
were first developed by Osher and Sethian (1988); the
methods are by now well-developed and used in a
wide variety of research areas (see, e.g., Sethian 1999;
Osher and Fedkiw 2002). The level-set method was first
applied to topology optimization only recently (Sethian
and Wiegmann 2000; Osher and Santosa 2001;Wang
et al. 2003; Allaire et al. 2004) and a number of re-
search groups around the world have used the approach
successfully as an alternative to the traditional material
distribution approach for topology optimization (see
the recent monograph by Bendsøe and Sigmund (2004)
for an overview of the traditional approach). Recent
examples of success with level-set based methods for
topology optimization include optimization of the ro-
bust compliance (de Gournay et al. 2008) and design of
multifunctional materials (Challis et al. 2008a).
The Matlab code provides insight into the main
facets of the level-set algorithm for topology optimiza-
tion and in particular provides concrete implementa-
tion details. This will be useful for those new to field of
topology optimization as well as those who have only
used other topology optimization approaches. Unlike
some other implementations of the level-set method
(e.g., Allaire et al. 2004), the author’s implementa-
tion avoids the use of intermediate densities. Hence
clear boundaries of the structure exist at all iterations
of the algorithm. The author and collaborators have
found this particularly useful to allow optimization for
454 V.J. Challis
fracture toughness (Challis et al. 2008b) and in the
setting of fluid flow (Challis and Guest 2009).
To the author’s knowledge, two other level-set
topology optimization codes are freely available.
One is available at http://www.cmap.polytechnique.fr/
∼allaire/freefem_en.html. It uses the free software tool-
box FreeFem++ and is an extension of the work of
Allaire and Pantz (2006). The other level-set code
is written in Matlab and is available at http://www2.
acae.cuhk.edu.hk/∼cmdl/download.htm. However, the
code in this article is simpler and shorter, having been
particularly designed with an educational setting in
mind.
The Matlab implementation presented here includes
major aspects of the level-set algorithm in a simple way,
and is accompanied by the detailed descriptions in this
paper. Sigmund’s (2001) Matlab implementation of the
SIMP algorithm was 99 lines long. The code presented
here is also very compact, and is 129 lines in total.
Excluding the finite element code and comments, the
level-set topology optimization code is only 63 lines.
The remainder of the paper is as follows. The topol-
ogy optimization problem and algorithm are outlined
in Section 2. The code is explained in Section 3. Exten-
sions to the code for different and multiple load cases
are given in Section 4. The discussion in Section 5
addresses how to choose the various parameters of
the algorithm and describes other possible extensions.
Conclusions are drawn in Section 6. The code itself is
given in the Appendix.
2 Topology optimization algorithm
The optimization problem is to minimize the compli-
ance of a solid structure subject to a constraint on the
volume of material used. The following is the mathe-
matical description of the problem:
min
x
: c(x) = U
T
KU =
N
e=1
u
T
e
k
e
u
e
=
N
e=1
x
e
u
T
e
k
1
u
e
subject to : V(x)= V
req
(1)
: KU = F
: x
e
= 0 or x
e
= 1 ∀ e = 1,...,N
where x = (x
1
,...,x
N
) is the vector of element “densi-
ties”, with entries of x
e
= 0 for a void element and x
e
=
1 for a solid element, where e is the element index. c(x)
is the compliance objective function. F and U are the
global force and displacement vectors, respectively, and
K is the global stiffness matrix. The equation KU = F is
therefore the elasticity equations as discretized with the
finite element method. u
e
is the element displacement
vector and k
e
is the element stiffness matrix for element
e. k
1
is the element stiffness matrix corresponding to a
solid element. N is the total number of elements in the
design domain, V(x) is the number of solid elements
and V
req
is the required number of solid elements.
The level-set method (Allaire et al. 2004;Wangetal.
2003) is used to find a local minimum for the optimiza-
tion problem. The approach derives its name from the
use of a level-set function for describing the structure.
If the structure occupies some domain , the level-set
function has the following property:
ψ(p)
⎧
⎨
⎩
< 0 if p ∈ ,
= 0 if p ∈ ∂,
> 0 if p /∈ ,
(2)
where p is any point in the design domain, and ∂ is the
boundary of .
The following evolution equation is used to update
the level-set function and hence the structure:
∂ψ
∂t
=−v|∇ψ|−ωg, (3)
where t represents time, v(p) and g(p) are scalar fields
over the design domain, and ω is a positive parameter
which determines the influence of the term involving g.
The field v determines geometric motion of the bound-
ary of the structure and is chosen based on the shape
derivative of the optimization objective. The term in-
volving g is a forcing term which determines the nucle-
ation of new holes within the structure and is chosen
based on the topological derivative of the optimization
objective.
If the parameter ω is zero, (3) is the standard
Hamilton-Jacobi evolution equation for a level-set
function ψ under a normal velocity of the boundary
v(p), taking the boundary normal in the outward di-
rection from (e.g., Sethian 1999; Osher and Fedkiw
2002). The simpler equation without the term involving
g is typically used in level-set methods for topology
optimization (e.g., Allaire et al. 2004;Wangetal.2003).
However, on two dimensional problems this standard
evolution equation has the major drawback that new
void regions cannot be nucleated within the structure
(Allaire et al. 2004). Here, the additional forcing term
involving g is added following Burger et al. (2004)to
ensure that new holes can nucleate within the structure
during the optimization process.
To build a topology optimization algorithm, the
level-set function can be discretized with gridpoints
centered on the elements of the mesh. If c
e
represents
Discrete level-set topology optimization code written in Matlab 455
the position of the center of element e, then the dis-
cretized level-set function satisfies:
(c
e
)
< 0 if x
e
= 1,
> 0 if x
e
= 0.
(4)
The discrete level-set function can then be updated to
find a new structure by solving (3) numerically. is
initialized as a signed distance function and an upwind
finite difference scheme is used so that the evolution
equation can be accurately solved. In addition, the time
step for the finite difference scheme is chosen to satisfy
the CFL stability condition
t ≤
h
max |v|
, (5)
where h is the minimum distance between adjacent
gridpoints in the spatial discretization and the maxi-
mum is taken over all gridpoints (e.g., Sethian 1999;
Osher and Fedkiw 2002).
As stated above, the two scalar fields v and g are
typically chosen based on the shape and topological
sensitivities of the optimization objective, respectively.
In order to satisfy the volume constraint, here they are
chosen using the shape and topological sensitivities of
the Lagrangian
L = c(x) +λ
k
V(x) − V
req
+
1
2
k
V(x) − V
req
2
,
(6)
where λ
k
and
k
are parameters which change with
each iteration k of the optimization algorithm. They are
updated using the scheme
λ
k+1
= λ
k
+
1
k
V(x) − V
req
,
k+1
= α
k
, (7)
where α ∈ (0, 1) is a fixed parameter. This implements
the augmented Lagrangian multiplier method for con-
strained optimization, as used for topology optimiza-
tion with the level-set method by Luo et al. (2008a).
The normal velocity v is chosen as a descent direc-
tion for the Lagrangian L using its shape derivative
(e.g., Allaire et al. 2004;Wangetal.2003). In the case
of traction-free boundary conditions on the moving
boundary, the shape sensitivity of the compliance ob-
jective c(x) is the negative of the strain energy density:
(e.g., Allaire et al. 2004)
δc
δ
|
e
=−u
T
e
k
e
u
e
. (8)
The shape sensitivity of the volume V(x) is
δV
δ
|
e
= 1. (9)
Using these shape sensitivities, the normal velocity v
within element e at iteration k of the algorithm is
v|
e
=−
δL
δ
|
e
= u
T
e
k
e
u
e
−λ
k
−
1
k
V(x) − V
req
. (10)
Based on Burger et al. (2004), the forcing term g
should be taken as
g =−sign(ψ)δ
T
L, (11)
where δ
T
L is the topological sensitivity of the
Lagrangian L. For compliance minimization, nucleat-
ing solid areas within the void regions of the design is
pointless because such solid regions will not take any
load. Therefore holes should only be nucleated within
the solid structure and
g =
δ
T
L if ψ<0
0 if ψ ≥ 0.
(12)
The topological sensitivity of the compliance objective
function in two dimensions with traction-free boundary
conditions on the nucleated hole and the unit ball as the
model hole is (e.g., Allaire et al. 2005)
δ
T
c|
e
=
π(λ +2μ)
2μ(λ +μ)
4μu
T
e
k
e
u
e
+(λ − μ)u
T
e
(k
Tr
)
e
u
e
(13)
where u
T
e
(k
Tr
)
e
u
e
is the finite element approximation
to the product tr(σ )tr() where σ is the stress tensor
and is the strain tensor. In (13), λ and μ are the
Lamé constants for the solid material. The topological
sensitivity of the volume V(x) when the model hole is
the unit ball is
δ
T
V|
e
=−π. (14)
Putting these results into the definition of the
Lagrangian and using (12) gives the source term g.
Those readers interested in more discussion of the
algorithm are referred to the publications referenced
above. Also, many more details are revealed by the
Matlab implementation and are discussed in the follow-
ing section.
3 Explanation of Matlab implementation
Following Sigmund (2001), several assumptions are
made to simplify the Matlab code. In particular, the
optimization domain is assumed to be rectangular
and split into square finite elements. There are nelx
elements along the horizontal direction and nely
剩余11页未读,继续阅读
u010485289
- 粉丝: 3
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论3