Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Topology Optimization

Implement SIMP-based topology optimization using your own code to solve the optimization problem, see slide
19 (“Quardratic penalty-based algorithm for equality constrained minimum compliance problem”). You will
have to augment your existing optimization code with the ability to handle bound constraints (chapter 13.3.2),
since they are needed on all design variables. The volume equality constraint is implemented using the penalty
method. The implementation should include filtering and projection. Try to also increase the penalty factor for
the volume constraint when beta is increased.

The finite element code from the Andreassen paper is available on Black Board as ‘fea88.m’. It takes the
arguments
(nelx,nely,x,penal,ft,rmin,beta,eta)
where nelx and nely are the number of elements in the x and y directions, x is the vector of nelx*nely design
variables, penal is the penalty exponent in SIMP (usually penal=3), ft is the filtering/projection strategy (ft=2:
Only filtering, ft=3: Filtering and projection, ft=any other value: Neither filtering nor projection. Use ft=3.),
rmin, beta, and eta are the parameters of the filter and projection operations.

‘fea88’ returns
[c,dc,v,dv,xPhys,xFil]
where c is the strain energy, dc is the gradient of the strain energy, v is the used volume, and dv is the gradient
of the volume constraint function. xPhys and xFil are the respectively the physical (filtered+projected) and the
filtered densities (different from x if filtering and/or projection is used).

You function must be defined as

function [c0,v0,c,v,xPhys]=TopOpt(Nx,Ny,pars)

where ‘Nx’ and ‘Ny’ are the number of ‘pixels’ in the x and y directions. ‘pars’ is a ‘struct’ with the following
fields:

volFrac: Volume fraction (e.g. 0.5)


rho0: Initial value of all design variables (e.g. 0.5)
beta0: Initial value of beta (e.g. 1)
betaFactor: Multiplier for increasing beta (e.g 2)
betaMax: Maximum value of beta (e.g. 64)
eta: Projection center (e.g. 0.5)
p: SIMP Penalty parameter (e.g. 3)
rfilter: Filter radius (e.g. 3)
mu0: Initial value of volume constraint penalty factor (e.g. 1)
muFactor: Multiplier for volume constraint penalty factor (e.g. 4)
muMax: Maximum value of volume constraint penalty factor (e.g. 1000)
tol: Tolerance used in solving local optimization problem (e.g. 1e-4)
nmax: Maximum number of iterations when solving local optimization
problem (e.g. 100)
Your function must return

c0: Value of c for initial design.


v0: Volume used by initial design.
c: Value of c for optimized design.
v: Volume used by optimized design.
xPhys: Nx*Ny element vector of the optimized, filtered and projected variables.

Please hand in:

1. The ‘TopOpt.m’ file with the ‘TopOpt’ function (note the case).
2. Any additional functions your code depends on (excluding ‘fea88.m’).

Hint 1: You can make your penalty cost function ‘f’ as


function r=F(x,c0,mu,beta,eta,Nx,Ny,pars)
[c,dc,v,dv,~,~]=fea88(Nx,Ny,x,pars.p,3,pars.rfilter,beta,eta);
TargetArea=Nx*Ny*pars.volFrac;
r=c/c0+mu*((v-TargetArea)/TargetArea)^2;
end
f=@(x)(F(x,c0,mu,beta,eta,Nx,Ny,pars));
c0 is a scaling for the compliance term, e.g. the value of c for the initial design.

Hint 2: It is often handy to plot the design during the process, for example using
function plotDesign(x,beta,eta,Nx,Ny,pars)
colormap(gray);
caxis([0 1]); axis equal; axis off;
[c,~,v,~,xPhys,xFil]= fea88(Nx,Ny,x,pars.p,3,pars.rfilter,beta,eta);

subplot(3,1,1);
I=1-cat(2, fliplr(reshape(x,[Ny Nx])), reshape(x,[Ny Nx]) );
imagesc(I);
axis image;
title('design variables');

subplot(3,1,2)
F=1-cat(2, fliplr(reshape(xFil,[Ny Nx])), reshape(xFil,[Ny Nx]) );
imagesc(F);
axis image;
title('filtered variables');

subplot(3,1,3)
P=1-cat(2, fliplr(reshape(xPhys,[Ny Nx])), reshape(xPhys,[Ny Nx]) );
imagesc(P);
axis image;
title('projected variables (physical design)');

drawnow;
end

You might also like