Télécharger top_mma_infill.dgibi
************************************************************************ * Example of topological optimization * * Density method + penalization (SIMP) * * * * This test case is based on the following article and reproduces * * the case in fig. 5 : * * Wu, Aage, Westermann, Sigmund (2018) * * "Infill Optimization for Additive Manufacturing - Approaching * * Bone-like Porous Structures" * * IEEE Transactions on Visualization and Computer Graphics, * * vol. 24, no. 2, pp. 1127-1140 * * https://doi.org/10.1109/TVCG.2017.2655523 * * * * Application to a beam under bending in 2D plane stresses * * with an additional infill constraint * * * * Optimization algorithm: Method of Moving Asymptotes * * * * Problem: minimize the compliance with: * * a constraint on the global volume fraction * * a constraint on the local volume fraction * * * * min C(x) = u^T.F * * s.t. G1(x) = vf(x)/volfrac - 1 < 0 * * G2(x) = p-norm(vf)/alpha - 1 < 0 * * * * /+----------------------------------------------+ * * /| | * * /| | * * /| | * * /| | * * /| p2 + | * * /| | | * * /| | | * * /| | v Force * * /| | * * /+----------------------------------------------+ * * * ************************************************************************ ** 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) / choose 400 and 200 to match the case in the article l = 120. ; h = 60. ; e = 1. ; ** Mesh parameters / choose 400 and 200 to match the case in the article nelx = 120 ; nely = 60 ; ** 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 * rinfill : radius of the local volume fraction constraint * ainfill : upper bound for the local volume fraction * pinfill : aggregation coefficient of the local volume fraction constrainsts penal = 3. ; volfrac = 0.5 ; ft = 2 ; rmin = 1.5 * l / nelx ; beta = 1 ; move = 0.2 ; changmax = 0.01 ; xmin = 0. ; xmax = 1. ; rinfill = 6. * l / nelx ; ainfill = 0.6 ; pinfill = 16. ; ** 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 ks = kfil * ung ; kfil = NFIL kfil ks ; ** Filtering matrix for the infill constraint ks = kin * ung ; kin = NFIL kin ks ; ** Initialization of the table for the MMA * initial values of the design variables x tmma . 'X' = lx ; * bounds for x tmma . 'XMIN' = xmin ; tmma . 'XMAX' = xmax ; * asymptotes * other parameters tmma . 'A0' = 1. ; tmma . 'MOVE' = move ; ** Lets's start a timer ** Topology optimization loop loopbeta = 0 ; REPE b1 150 ; 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: g1 = vf(x)/volfrac - 1 * value g1 = (vfx / volfrac) - 1. ; * sensitivity (gradient with respect to the physical variable) dg1 = ve / vtot / volfrac ; * constraint function: g2 = p-norm(vf(x))/alpha - 1 * value xbar = HFILT xphys mod kin ptg ; gpmoy = AGRE 'PMOY' lxbar pinfill ; g2 = (gpmoy / ainfill) - 1. ; * sensitivity (gradient with respect to the physical variable) tmp = gpmoy / ((AGRE 'PMOM' lxbar pinfill) / nx) ; dg2 = (1. / (nx * ainfill)) * tmp * (xbar ** (pinfill - 1.)) ; * 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 ; dg1 = HFILT dg1 mod kfil ptg ; dg2 = HFILT dg2 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 ; dg1tilde = dg1 * dx ; dg1 = HFILT dg1tilde mod kfil ptg ; dg2tilde = dg2 * dx ; dg2 = HFILT dg2tilde mod kfil ptg ; FINSI ; * information about the current topology SI itrac ; FINSI ; * update the topology by optimization tmma . 'F0VAL' = c ; MMA tmma ; lxnew = tmma . 'X' ; * 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 * 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 ; lx = lxnew ; * ft = 3 --> updatind the slope of the thresholding function SI (ft EGA 3) ; SI ((beta < 128) 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 ; FIN ;
© Cast3M 2003 - Tous droits réservés.
Mentions légales