************************************************************************ * Example of topological optimization * * Density method + penalization (SIMP) * * * * This test case is a reproduction of the reference code: * * Andreassen, Clausen, Schevenels, Lazarov, & Sigmund (2011) * * "Efficient topology optimization in MATLAB using 88 lines of code" * * Structural and Multidisciplinary Optimization, 43(1), 1-16 * * https://doi.org/10.1007/s00158-010-0594-7 * * * * Application to a beam under bending in 2D plane stresses * * * * Optimization algorithm: Optimality Criteria * * * * Problem: minimize the compliance with a constraint * * on the volume fraction * * * * min C(x) = u^T.F * * s.t. G(x) = vf(x) = volfrac * * * * | * * | Force * * v * * O>+------------------------------------------------------+ * * | p1 | * * | | * * O>| | * * | | * * | | * * O>+------------------------------------------------------+ p2 * * Ʌ * * O * * * ************************************************************************ ** Filtering procedure DEBP HFILT cham1*'MCHAML' mo*'MMODEL' mf*'RIGIDITE' mpt*'MAILLAGE' ; chp2 = mf * chp1 ; FINP cham2 ; ** Global parameters itrac = FAUX ; ** Geometrical parameters (width and height) l = 60. ; h = 20. ; e = 1. ; ** Mesh parameters nelx = 60 ; nely = 20 ; ** Material parameters (isotropic elasticity) e0 = 1. ; emin = e0 / 1.E9 ; nu = 0.3 ; ** Topology optimization parameters * penal : SIMP penalization coefficient * volfrac : minimal volume fraction * ft : = 1 apply filter on the compliance sensitivity field * = 2 apply spatial filter on the density field * = 3 apply spatial filter on the density field + thresholding by heaviside function * rmin : filter radius (in m) * beta : initial value of the slope of the heaviside function (only for ft = 3) * will be doubled every 50 iterations * move : limit of the maximal increment of density * changmax : optimization stop criterion * xmin/xmax : min and max density bounds penal = 3. ; volfrac = 0.5 ; ft = 2 ; rmin = 0.04 * l ; beta = 1 ; move = 0.2 ; changmax = 0.01 ; xmin = 0. ; xmax = 1. ; ** Mesh p0 = 0. 0. ; p1 = 0. h ; ** Mechanical model ** Material properties field with a unit Young modulus ** Boundary conditions ** Load (local force) ** Volume of each element (ve) and total volume (vtot) ** Initial density field xini = volfrac ; change = 1. ; ** Physical density field SI ((ft EGA 1) OU (ft EGA 2)) ; xphys = x ; FINSI ; SI (ft EGA 3) ; xtilde = x ; xphys = 1. - (EXP (-1. * beta * xtilde)) + (xtilde * (EXP (-1. * beta))) ; FINSI ; ** Initial volume fraction ** Gravity centers and filtering matrix * the weight depends on the volume of each element ** Lets's start a timer ** Topology optimization loop loopbeta = 0 ; REPE b1 500 ; loopbeta = loopbeta + 1 ; * penalization of the stiffness matrix (modified SIMP) ep = emin + ((xphys ** penal) * (e0 - emin)) ; * resolution of the FE problem kbc = k ET blo ; * objective function: compliance = u^T.K.u * value * sensitivity (gradient with respect to the physical variable) dc = -1. * penal * (xphys ** (penal - 1.)) * (e0 - emin) * eneun ; * constraint function: g = vf(x) * value g = vfx ; * sensitivity (gradient with respect to the physical variable) dg = ve / vtot ; * ft = 1 --> filtering the complicance sensitivity SI (ft EGA 1) ; FINSI ; * ft = 2,3 --> updating the sensitivies (to become gradients with respect to the design variable) SI (ft EGA 2) ; dc = HFILT dc mod kfil ptg ; dg = HFILT dg mod kfil ptg ; FINSI ; SI (ft EGA 3) ; dx = (beta * (EXP (-1. * beta * xtilde))) + (EXP (-1. * beta)) ; dctilde = dc * dx ; dc = HFILT dctilde mod kfil ptg ; dgtilde = dg * dx ; dg = HFILT dgtilde mod kfil ptg ; FINSI ; * information about the current topology SI itrac ; FINSI ; * update the topology by optimization l1 = 0. ; l2 = 1.E9 ; REPE b2 200 ; SI (((l2 - l1) / (l1 + l2)) < 0.001) ; QUIT b2 ; FINSI ; lmid = 0.5 * (l1 + l2) ; b = -1. * dc / (lmid * dg) ; xnew = x * (b ** 0.5) ; xnew = (xinf * minf) + (xnew * mmil) + (xsup * msup) ; * update the physical density (by filtering and thresholding) SI (ft EGA 1) ; xphys = xnew ; FINSI ; SI (ft EGA 2) ; xphys = HFILT xnew mod kfil ptg ; FINSI ; SI (ft EGA 3) ; xtilde = HFILT xnew mod kfil ptg ; xphys = 1. - (EXP (-1. * beta * xtilde)) + (xtilde * (EXP (-1. * beta))) ; FINSI ; * updating the volume fraction SI (vfx > volfrac) ; l1 = lmid ; SINON ; l2 = lmid ; FINSI ; FIN b2 ; * summary of the current iteration liter = liter ET &b1 ; lobj = lobj ET c ; lvf = lvf ET vfx ; lchange = lchange ET change ; * preparing the next iteration x = xnew ; * ft = 3 --> updatind the slope of the thresholding function SI (ft EGA 3) ; SI ((beta < 512) ET ((loopbeta >EG 50) OU (change <EG changmax))) ; beta = 2 * beta ; loopbeta = 0 ; change = 1. ; FINSI ; FINSI ; * stop criterion SI (change < changmax) ; QUIT b1 ; FINSI ; FIN b1 ; ** Elapsed time ** Plotting the final topology SI itrac ; FINSI ; ** Mesh of the final topology tab1 . 'EPAISSEUR' = e ; tab1 . 'MODELE' = mod ; tab1 . 'TOPOLOGIE' = xphys ; SI itrac ; FINSI ; FIN ;
© Cast3M 2003 - Tous droits réservés.
Mentions légales