Télécharger topoptim.procedur

Retour à la liste

Numérotation des lignes :

  1. * TOPOPTIM PROCEDUR FD218221 23/11/29 21:15:13 11799
  2.  
  3. ************************************************************************
  4. ** Topology optimization procedure.
  5. **
  6. ** Author:
  7. ** Guenhael Le Quilliec (LaMe - Polytech Tours)
  8. **
  9. ** Version:
  10. ** 3.0 2021/04/15 Improving the structure of TOPOPTIM for developers
  11. ** and adding a new filtering function.
  12. ** 2.4 2021/04/14 Fixing an issue with TET4 in frozen area
  13. ** 2.3 2021/03/19 Modification of default value of 'OC_L2'
  14. ** 2.2 2018/02/09 Make it compatible with the new version of TOPOSAUV
  15. ** allowing early stop and restart of the optimization
  16. ** 2.1 2017/11/11 Compliant mechanism output displacement maximization
  17. ** 2.0 2017/04/18 Geometric restrictions, non-linear, multiobjective,
  18. ** multiphysic, customizable topology optimization
  19. ** 1.1 2015/11/02 Check if volume fraction > proportion of frozen area
  20. ** 1.0 2014/04/28 Linear mono-objective topology optimization
  21. ************************************************************************
  22.  
  23. DEBP TOPOPTIM tab0*'TABLE' ;
  24.  
  25. SAUT 3 'LIGN' ;
  26. MESS '+-----------------------------------------------------------------------------+' ;
  27. MESS '| |' ;
  28. MESS '| |' ;
  29. MESS '| DEBUT DE LA PROCEDURE |' ;
  30. MESS '| |' ;
  31. MESS '| ______ ______ ______ ______ ______ ______ __ __ __ |' ;
  32. MESS '| /\__ _\/\ __ \ /\ == \/\ __ \ /\ == \/\__ _\/\ \ /\ =-./ \ v3.0 |' ;
  33. MESS '| \/_/\ \/\ \ \/\ \\ \ _-/\ \ \/\ \\ \ _-/\/_/\ \/\ \ \\ \ \-./\ \ ---- |' ;
  34. MESS '| \ \_\ \ \_____\\ \_\ \ \_____\\ \_\ \ \_\ \ \_\\ \_\ \ \_\ |' ;
  35. MESS '| \/_/ \/_____/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_/ \/_/ |' ;
  36. MESS '| _______________________________________________________________ |' ;
  37. MESS '| /\______________________________________________________________\ |' ;
  38. MESS '| \/______________________________________________________________/ |' ;
  39. MESS '| |' ;
  40. MESS '| |' ;
  41. MESS '+-----------------------------------------------------------------------------+' ;
  42. SAUT 1 'LIGN' ;
  43.  
  44.  
  45. * Preprocessing
  46. * *************
  47. TOPOBOOT tab0 ;
  48.  
  49. * Information
  50. * ***********
  51. TOPOINFO tab0 ;
  52.  
  53. * Tables
  54. wtab0 = tab0.'WTABLE' ;
  55. bool0 = wtab0.'BOOL' ;
  56.  
  57. * Initializations
  58. Lstobj0 = PROG ; Lstchg0 = PROG ; Lstp0 = PROG ; Lstq0 = PROG ; Lstnbel0 = LECT ;
  59.  
  60. **********************************************************************
  61. * OPTIMIZATION LOOP *
  62. **********************************************************************
  63. REPE loop0 (tab0.'MAX_CYCLES' - wtab0.'CYCLE' + 1) ;
  64.  
  65. * Initializations
  66. xOld0 = wtab0.'TOPOLOGIE' ;
  67. wtab0.'OBJECTIF' = 0.0 ;
  68. wtab0.'SENSIBILITE' = wtab0.'ZERO'.(1) ;
  69.  
  70. * Update factor values
  71. * ********************
  72. TOPOFCTR Tab0 ;
  73.  
  74. * Density fields
  75. * **************
  76. TOPODENS Tab0 ;
  77.  
  78. * Mesh, model, material and contact of active zone
  79. * ************************************************
  80. TOPOACTI Tab0 ;
  81.  
  82. * Solve FE problem(s)
  83. * *******************
  84. TOPORESO tab0 ;
  85.  
  86. * User defined procedure
  87. * **********************
  88. SI tab0.'PROCEDURE_TOPOPERS' ; TOPOPERS tab0 ; FINS ;
  89.  
  90. * Calculate the objective value and the sensitivity field
  91. * *******************************************************
  92. TOPOSENS tab0 ;
  93.  
  94. * Add some restrictions
  95. * *********************
  96. SI bool0.'RESTRICTIONS' ; TOPORSTR tab0 ; FINS ;
  97.  
  98. * Sensitivity filtering
  99. * *********************
  100. TOPOFILT tab0 ;
  101.  
  102. * Topology update
  103. * ***************
  104. TOPOLOGY tab0 ;
  105.  
  106. * Compute the change
  107. wtab0.'CHANGE' = MAXI (ABS (wtab0.'TOPOLOGIE' - xOld0)) ;
  108. * Number of active elements
  109. nbel0 = NBEL wtab0.'MAILLAGE'.'A' ;
  110. * Save progression information
  111. Lstobj0 = Lstobj0 ET wtab0.'OBJECTIF' ;
  112. Lstchg0 = Lstchg0 ET wtab0.'CHANGE' ;
  113. Lstp0 = Lstp0 ET wtab0.'FACTEUR_P' ;
  114. Lstq0 = Lstq0 ET wtab0.'FACTEUR_Q' ;
  115. Lstnbel0 = Lstnbel0 ET nbel0 ;
  116.  
  117. * Save output data
  118. * ****************
  119. TOPOSAUV tab0 ;
  120.  
  121. * Save the number of the last completed cycle
  122. tab0.'CYCLE' = wtab0.'CYCLE' ;
  123.  
  124. * Plot to screen
  125. SI tab0.'TRAC' ;
  126. tmp1 = wtab0.'TOPOLOGIE' ;
  127. SI bool0.'ZONE_FIGEE' ;
  128. tmp1 = tmp1 + wtab0.'UN'.(2) ;
  129. FINS ;
  130. SI bool0.'MECANIQUE' ;
  131. tmp2 = wtab0.'MECANIQUE'.'MODELE'.'A' ;
  132. SINO ;
  133. tmp2 = wtab0.'THERMIQUE'.'MODELE'.'A' ;
  134. FINS ;
  135. tmp1 = REDU tmp1 tmp2 ;
  136. SI ((NON bool0.'CAS_MULTIPLES') ET (NON bool0.'MECANISME') ET bool0.'MECANIQUE' ET bool0.'PASAPAS') ;
  137. tmp1 tmp2 = tmp1 tmp2 PLUS wtab0.'RESOLUTION'.'A'.'DEPLACEMENTS'.(wtab0.'NB_PAS') ;
  138. FINS ;
  139. TRAC tmp1 tmp2 (PROG 0.0 'PAS' (1.0 / 56.0) 1.0) 'NCLK' ;
  140. FINS ;
  141.  
  142. * Write progression to screen
  143. SI (NON bool0.'PASAPAS') ;
  144. MESS (CHAI wtab0.'CYCLE'*6 ' ' '|'
  145. 'FORMAT' '(ES14.7E2)' wtab0.'OBJECTIF' '|'
  146. 'FORMAT' '(ES14.7E2)' wtab0.'CHANGE' '|'
  147. 'FORMAT' '(ES14.7E2)' wtab0.'FACTEUR_P' '|'
  148. 'FORMAT' '(ES14.7E2)' wtab0.'FACTEUR_Q' '|'
  149. nbel0*77) ;
  150. FINS ;
  151.  
  152. * Convergence test
  153. SI ((wtab0.'CHANGE' < tab0.'CRITERE') OU (EGA wtab0.'CYCLE' tab0.'MAX_CYCLES')) ;
  154. tab0.'CONVERGENCE' = wtab0.'CHANGE' < tab0.'CRITERE' ;
  155. QUIT loop0 ;
  156. FINS ;
  157.  
  158. * Write progression to screen (After the convergence test in case of step by step resolution since there will be a summary at the end)
  159. SI bool0.'PASAPAS' ;
  160. SAUT 1 'LIGN' ;
  161. MESS '+-----------------------------------------------------------------------------+' ;
  162. MESS '| |' ;
  163. MESS '| TOPOPTIM : Progression |' ;
  164. MESS '| |' ;
  165. MESS (CHAI '|' 'Cycle'*38 wtab0.'CYCLE'/40 '|'*79) ;
  166. MESS '| |' ;
  167. MESS '| Objective | Max change | Penalty fac. P| GSF factor Q | Nb. elem. |' ;
  168. MESS (CHAI '|' 'FORMAT' '(ES14.7E2)' (EXTR Lstobj0 &loop0) ' |'
  169. 'FORMAT' '(ES14.7E2)' (EXTR Lstchg0 &loop0) ' |'
  170. 'FORMAT' '(ES14.7E2)' (EXTR Lstp0 &loop0) ' |'
  171. 'FORMAT' '(ES14.7E2)' (EXTR Lstq0 &loop0) ' |'
  172. nbel0*76 '|'*79) ;
  173. MESS '| |' ;
  174. MESS '+-----------------------------------------------------------------------------+' ;
  175. SAUT 1 'LIGN' ;
  176. FINS ;
  177.  
  178. * Number of the next cycle
  179. wtab0.'CYCLE' = wtab0.'CYCLE' + 1 ;
  180.  
  181. FIN loop0 ;
  182. **********************************************************************
  183. * END OPTIMIZATION LOOP *
  184. **********************************************************************
  185.  
  186. * Cleaning
  187. OTER tab0 'WTABLE' ; MENA 'OBLI' ;
  188.  
  189. * Write information to screen
  190. SI (EXIS tab0 'RESOLUTION_PASAPAS') ;
  191. SAUT 1 'LIGN' ;
  192. MESS '+-----------------------------------------------------------------------------+' ;
  193. MESS '| |' ;
  194. MESS '| TOPOPTIM : Bilan |' ;
  195. MESS '| |' ;
  196. MESS '+-----------------------------------------------------------------------------+' ;
  197. SAUT 1 'LIGN' ;
  198. MESS ' Cycle | Objective | Max change |Penalty fac. P| GSF factor Q | Nb. elem.' ;
  199. REPE loop0 (DIME Lstobj0) ;
  200. MESS (CHAI &loop0*6 ' ' '|'
  201. 'FORMAT' '(ES14.7E2)' (EXTR Lstobj0 &loop0) '|'
  202. 'FORMAT' '(ES14.7E2)' (EXTR Lstchg0 &loop0) '|'
  203. 'FORMAT' '(ES14.7E2)' (EXTR Lstp0 &loop0) '|'
  204. 'FORMAT' '(ES14.7E2)' (EXTR Lstq0 &loop0) '|'
  205. (EXTR Lstnbel0 &loop0)*77) ;
  206. FIN loop0 ;
  207. FINS ;
  208. SAUT 1 'LIGN' ;
  209. SI tab0.'CONVERGENCE' ;
  210. MESS ' Convergence apres' ' ' (DIME Lstobj0) ' cycles.' ;
  211. SINO ;
  212. MESS ' Nombre maximum de cycles d''optimisation atteint.' ;
  213. FINS ;
  214. SAUT 1 'LIGN' ;
  215. MESS '+-----------------------------------------------------------------------------+' ;
  216. MESS '| |' ;
  217. MESS '| FIN DE LA PROCEDURE |' ;
  218. MESS '| |' ;
  219. MESS '| T O P O P T I M |' ;
  220. MESS '| |' ;
  221. MESS '+-----------------------------------------------------------------------------+' ;
  222. SAUT 3 'LIGN' ;
  223.  
  224. FINP ;
  225.  
  226.  
  227.  
  228.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales