Télécharger topochar.procedur

Retour à la liste

Numérotation des lignes :

  1. * TOPOCHAR PROCEDUR FD218221 25/12/18 21:15:03 12429
  2.  
  3. ************************************************************************
  4. ** Procedure called by TOPOPTIM for updating:
  5. ** - mechanical and thermal loadings,
  6. ** - boundary conditions (mechanical and thermal),
  7. ** - compliant mechanism springs.
  8. **
  9. ** Author:
  10. ** Guenhael Le Quilliec (LaMe - Polytech Tours)
  11. **
  12. ** Version:
  13. ** 1.0 2024/04/16 Previously part of TOPOBOOT, now called in the
  14. ** optimization loop to handle updates (e.g. if
  15. ** the loading depends on physical densities).
  16. ************************************************************************
  17.  
  18. * TODO voir pour ne mettre à jour que ce qui le nécessite via TOPOMODI
  19. * en particulier si TOPOUPDT est VRAI ?
  20.  
  21. DEBP TOPOCHAR tab*'TABLE' ;
  22.  
  23. * Input data
  24. * **********
  25.  
  26. Wtab = tab.'WTABLE' ;
  27. Ltab = Wtab.'LOGIQUE' ;
  28.  
  29. * Loading updates whenever TOPOPTIM is called, or at each cycle if
  30. * PROCEDURE_TOPOUPDT is VRAI
  31. SI ((EGA Wtab.'ITERATION' 1) OU tab.'PROCEDURE_TOPOUPDT') ;
  32.  
  33. res = Wtab.'RESOLUTION_B' ;
  34.  
  35. * Mechanical boundary conditions
  36. nbrbdcM = 0 ;
  37. SI (EXIS res 'BLOCAGES_MECANIQUES') ;
  38. nbrbdcM = 1 ;
  39. bdcMB = res.'BLOCAGES_MECANIQUES' ;
  40. SI (EGA (TYPE bdcMB) 'TABLE') ;
  41. REPE itr (DIME bdcMB) ;
  42. SI (EXIS bdcMB &itr) ;
  43. nbrbdcM = &itr ;
  44. FINS ;
  45. FIN itr ;
  46. SI (EGA nbrbdcM 1) ;
  47. bdcMB = bdcMB.(1) ;
  48. FINS ;
  49. FINS ;
  50. FINS ;
  51.  
  52. * Thermal boundary conditions
  53. nbrbdcT = 0 ;
  54. SI (EXIS res 'BLOCAGES_THERMIQUES') ;
  55. nbrbdcT = 1 ;
  56. bdcTB = res.'BLOCAGES_THERMIQUES' ;
  57. SI (EGA (TYPE bdcTB) 'TABLE') ;
  58. REPE itr (DIME bdcTB) ;
  59. SI (EXIS bdcTB &itr) ;
  60. nbrbdcT = &itr ;
  61. FINS ;
  62. FIN itr ;
  63. SI (EGA nbrbdcT 1) ;
  64. bdcTB = bdcTB.(1) ;
  65. FINS ;
  66. FINS ;
  67. FINS ;
  68.  
  69. * Mechanical and thermal loadings
  70. nbrldg = 1 ;
  71. ldg = res.'CHARGEMENT' ;
  72. SI (EGA (TYPE ldg) 'TABLE') ;
  73. REPE itr (DIME ldg) ;
  74. SI (EXIS ldg &itr) ;
  75. nbrldg = &itr ;
  76. FINS ;
  77. FIN itr ;
  78. SI (EGA nbrldg 1) ;
  79. ldg = ldg.(1) ;
  80. FINS ;
  81. FINS ;
  82. * Loading modification detection
  83. SI (NON (EXIS res 'SENSIBILITE_NORMALISEE_CHARGEMENT')) ;
  84. SI ((TOPOMODI tab (CHAI 'CHARGEMENT') ldg) ET (Wtab.'ITERATION' > 1)) ;
  85. SAUT 1 'LIGN' ;
  86. MESS ' /!\ Le chargement a ete modifie depuis la precedente iteration.' ;
  87. MESS ' Si le chargement est dependant de la topologie, il faut' ;
  88. MESS ' alors aussi fournir sa sensibilite.' ;
  89. SAUT 1 'LIGN' ;
  90. FINS ;
  91. FINS ;
  92.  
  93. * Compliant mechanism output loading
  94. nbrldg1 = 0 ;
  95. SI Ltab.'MECANISME' ;
  96. nbrldg1 = 1 ;
  97. ldg1 = tab.'MECANISME' ;
  98. SI (EGA (TYPE ldg1) 'TABLE') ;
  99. REPE itr (DIME ldg1) ;
  100. SI (EXIS ldg1 &itr) ;
  101. nbrldg1 = &itr ;
  102. FINS ;
  103. FIN itr ;
  104. SI (EGA nbrldg1 1) ;
  105. ldg1 = ldg1.(1) ;
  106. FINS ;
  107. FINS ;
  108. * Mechanism modification detection
  109. * SI (NON (EXIS res 'SENSIBILITE_NORMALISEE_MECANISME')) ;
  110. SI ((TOPOMODI tab (CHAI 'MECANISME') ldg) ET (Wtab.'ITERATION' > 1)) ;
  111. SAUT 1 'LIGN' ;
  112. MESS ' /!\ Le mechanisme a ete modifie depuis la precedente iteration.' ;
  113. MESS ' TOPOPTIM n''est pas compatible avec un mechanisme dependant' ;
  114. MESS ' de la topologie.' ;
  115. SAUT 1 'LIGN' ;
  116. FINS ;
  117. * FINS ;
  118. FINS ;
  119.  
  120. * Number and names of components for forces and displacements
  121. SI Ltab.'MECANIQUE' ;
  122. modMB = Wtab.'MECANIQUE'.'MODELE_B' ;
  123. cpnldgM = EXTR modMB 'FORC' ;
  124. cpnU = EXTR modMB 'DEPL' ;
  125. nbrcpnM = DIME cpnU ;
  126. FINS ;
  127. * Number and names of components for thermal fluxes and temperatures
  128. SI Ltab.'THERMIQUE' ;
  129. modTB = Wtab.'THERMIQUE'.'MODELE_B' ;
  130. cpnldgT = EXTR modTB 'FORC' ;
  131. cpnT = EXTR modTB 'DEPL' ;
  132. nbrcpnT = DIME cpnT ;
  133. FINS ;
  134.  
  135. * Multiple loads and/or boundary conditions cases
  136. nbrcas = MAXI (LECT nbrldg nbrldg1 nbrbdcT nbrbdcM) ;
  137. Wtab.'NB_CAS' = nbrcas ;
  138. Ltab.'CAS_MULTIPLES' = nbrcas > 1 ;
  139. SI Ltab.'CAS_MULTIPLES' ;
  140. SI (((nbrldg > 1) ET (NEG nbrldg nbrcas)) OU
  141. ((nbrldg1 > 1) ET (NEG nbrldg1 nbrcas)) OU
  142. ((nbrbdcT > 1) ET (NEG nbrbdcT nbrcas)) OU
  143. ((nbrbdcM > 1) ET (NEG nbrbdcM nbrcas))) ;
  144. MESS 'Le nombre de cas de charges ne correspond pas au nombre de cas de conditions aux limites.'
  145. ' Lorsque superieurs a 1, le nombre de cas de charge et de cas de conditions aux limites doivent correspondre.';
  146. ERRE 'Veuillez verifier vos donnees d''entree.' ;
  147. FINS ;
  148. * Transform a single load into a table of identical loads
  149. SI (EGA nbrldg 1) ;
  150. tmp = TABL ;
  151. REPE itr nbrcas ;
  152. tmp.&itr = ldg ;
  153. FIN itr ;
  154. ldg = tmp ;
  155. FINS ;
  156. * Transform a single compliant mechanism load into a table of
  157. * identical compliant mechanism loads
  158. SI (EGA nbrldg1 1) ;
  159. tmp = TABL ;
  160. REPE itr nbrcas ;
  161. tmp.&itr = ldg1 ;
  162. FIN itr ;
  163. ldg1 = tmp ;
  164. FINS ;
  165. * Transform mechanica boundary conditions into a table of identical
  166. * mechanical boundary conditions
  167. SI (EGA nbrbdcM 1) ;
  168. tmp = TABL ;
  169. REPE itr nbrcas ;
  170. tmp.&itr = bdcMB ;
  171. FIN itr ;
  172. bdcMB = tmp ;
  173. FINS ;
  174. * Transform thermal boundary conditions into a table of identical
  175. * thermal boundary conditions
  176. SI (EGA nbrbdcT 1) ;
  177. tmp = TABL ;
  178. REPE itr nbrcas ;
  179. tmp.&itr = bdcTB ;
  180. FIN itr ;
  181. bdcTB = tmp ;
  182. FINS ;
  183. FINS ;
  184. Wtab.'CHARGEMENT' = ldg ;
  185. SI Ltab.'MECANISME' ;
  186. Wtab.'MECANISME' = ldg1 ;
  187. FINS ;
  188. SI Ltab.'MECANIQUE' ;
  189. Wtab.'MECANIQUE'.'BLOCAGES' = bdcMB ;
  190. FINS ;
  191. SI Ltab.'THERMIQUE' ;
  192. Wtab.'THERMIQUE'.'BLOCAGES' = bdcTB ;
  193. FINS ;
  194. SI Ltab.'MECANIQUE' ;
  195. SI Ltab.'THERMIQUE' ;
  196. SI Ltab.'CAS_MULTIPLES' ;
  197. REPE itr nbrcas ;
  198. Wtab.'MECANIQUE'.'CHARGEMENT' = TABL ;
  199. Wtab.'MECANIQUE'.'CHARGEMENT'.&itr = EXCO cpnldgM 'NOID' ldg.&itr ;
  200. FIN itr ;
  201. SINO ;
  202. Wtab.'MECANIQUE'.'CHARGEMENT' = EXCO cpnldgM 'NOID' ldg ;
  203. FINS ;
  204. SINO ;
  205. Wtab.'MECANIQUE'.'CHARGEMENT' = ldg ;
  206. FINS ;
  207. FINS ;
  208. SI Ltab.'THERMIQUE' ;
  209. SI Ltab.'MECANIQUE' ;
  210. SI Ltab.'CAS_MULTIPLES' ;
  211. REPE itr nbrcas ;
  212. Wtab.'THERMIQUE'.'CHARGEMENT' = TABL ;
  213. Wtab.'THERMIQUE'.'CHARGEMENT'.&itr = EXCO cpnldgT 'NOID' ldg.&itr ;
  214. FIN itr ;
  215. SINO ;
  216. Wtab.'THERMIQUE'.'CHARGEMENT' = EXCO cpnldgT 'NOID' ldg ;
  217. FINS ;
  218. SINO ;
  219. Wtab.'THERMIQUE'.'CHARGEMENT' = ldg ;
  220. FINS ;
  221. FINS ;
  222.  
  223. * Springs used for compliant mechanism optimization
  224. SI Ltab.'MECANISME' ;
  225. SI Ltab.'CAS_MULTIPLES' ;
  226. spr = TABL ;
  227. REPE itr nbrcas ;
  228. spr.&itr = VIDE 'RIGIDITE'/'RIGIDITE' ;
  229. SI Ltab.'PASAPAS' ;
  230. tmp = EXTR (DIME savtim) savtim ;
  231. tmp = (TIRE ldg.&itr tmp) + (TIRE ldg1.&itr tmp) ;
  232. SINO ;
  233. tmp = ldg.&itr + ldg1.&itr ;
  234. FINS ;
  235. tmp1 = EXTR tmp 'MAIL' ;
  236. tmp2 = NBNO tmp1 ;
  237. REPE itr1 nbrcpnM ;
  238. tmp3 = EXTR cpnldgM &itr1 ;
  239. tmp4 = EXTR cpnU &itr1 ;
  240. REPE itr2 tmp2 ;
  241. tmp5 = tmp1 POIN &itr2 ;
  242. tmp6 = (ABS (EXTR tmp tmp3 tmp5)) * 0.1 ;
  243. spr.&itr = spr.&itr ET (APPU tmp4 tmp6 tmp5) ;
  244. FIN itr2 ;
  245. FIN itr1 ;
  246. FIN itr ;
  247. SINO ;
  248. spr = VIDE 'RIGIDITE'/'RIGIDITE' ;
  249. SI Ltab.'PASAPAS' ;
  250. tmp = EXTR (DIME savtim) savtim ;
  251. tmp = (TIRE ldg tmp) + (TIRE ldg1 tmp) ;
  252. SINO ;
  253. tmp = ldg + ldg1 ;
  254. FINS ;
  255. tmp1 = EXTR tmp 'MAIL' ;
  256. tmp2 = NBNO tmp1 ;
  257. REPE itr nbrcpnM ;
  258. tmp3 = EXTR cpnldgM &itr ;
  259. tmp4 = EXTR cpnU &itr ;
  260. REPE itr1 tmp2 ;
  261. tmp5 = tmp1 POIN &itr1 ;
  262. tmp6 = (ABS (EXTR tmp tmp3 tmp5)) * 0.1 ;
  263. spr = spr ET (APPU tmp4 tmp6 tmp5) ;
  264. FIN itr1 ;
  265. FIN itr ;
  266. FINS ;
  267. Wtab.'RESSORTS' = spr ;
  268. FINS ;
  269.  
  270. FINS ;
  271.  
  272. FINP ;
  273.  
  274.  
  275.  

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