Télécharger toposens.procedur

Retour à la liste

Numérotation des lignes :

  1. * TOPOSENS PROCEDUR FD218221 24/01/24 21:15:01 11828
  2. * TOPOSENS PROCEDUR CB215821 21/04/15 14:10:01 9715
  3.  
  4. ************************************************************************
  5. ** Procedure called by TOPOPTIM for calculating the sensitivity field
  6. ** and the objective value.
  7. **
  8. ** Author:
  9. ** Guenhael Le Quilliec (LaMe - Polytech Tours)
  10. **
  11. ** Version:
  12. ** 1.0 2021/04/15
  13. ************************************************************************
  14.  
  15. DEBP TOPOSENS tab0*'TABLE' ;
  16.  
  17. * Input data
  18. * **********
  19.  
  20. vdM0 = tab0.'RAPPORT_RAIDEURS_MECANIQUES' ;
  21. vdT0 = tab0.'RAPPORT_RAIDEURS_THERMIQUES' ;
  22. WghtMcn0 = tab0.'POIDS_MECANISME' ;
  23. WghtM0 = tab0.'POIDS_ENERGIE_DEFO' ;
  24. WghtT0 = tab0.'POIDS_TEMPERATURE' ;
  25. wtab0 = tab0.'WTABLE' ;
  26. bool0 = wtab0.'BOOL' ;
  27. zero1 = wtab0.'ZERO'.(1) ;
  28. p0 = wtab0.'FACTEUR_P' ;
  29. bmsh1 = wtab0.'MAILLAGE'.'GRAVITE' ;
  30. mdlA = wtab0.'RESOLUTION'.'A' ;
  31. SI bool0.'CAS_MULTIPLES' ;
  32. case_nb0 = wtab0.'NB_CAS' ;
  33. FINS ;
  34. SI bool0.'PASAPAS' ;
  35. NbStp0 = wtab0.'NB_PAS' ;
  36. FINS ;
  37. SI bool0.'MECANIQUE' ;
  38. volElM1 = wtab0.'MECANIQUE'.'VOLUME'.(1) ;
  39. modM1 = wtab0.'MECANIQUE'.'MODELE'.(1) ;
  40. FINS ;
  41. SI bool0.'THERMIQUE' ;
  42. volElT1 = wtab0.'THERMIQUE'.'VOLUME'.(1) ;
  43. modT1 = wtab0.'THERMIQUE'.'MODELE'.(1) ;
  44. FINS ;
  45. x0 = wtab0.'TOPOLOGIE' ;
  46. obj0 = wtab0.'OBJECTIF' ;
  47. dc0 = wtab0.'SENSIBILITE' ;
  48.  
  49. * Active mesh, model, material and resolution belonging to msh1
  50. * *************************************************************
  51.  
  52. mshA = INTE wtab0.'MAILLAGE'.'A' wtab0.'MAILLAGE'.(1) ;
  53. SI bool0.'MECANIQUE' ;
  54. modMA = REDU wtab0.'MECANIQUE'.'MODELE'.(0) mshA ;
  55. matMA = REDU tab0.'WTABLE'.'MECANIQUE'.'CARACTERISTIQUES'.'A' mshA ;
  56. FINS ;
  57. SI bool0.'THERMIQUE' ;
  58. modTA = REDU wtab0.'THERMIQUE'.'MODELE'.(0) mshA ;
  59. matTA = REDU tab0.'WTABLE'.'THERMIQUE'.'CARACTERISTIQUES'.'A' mshA ;
  60. FINS ;
  61.  
  62. * Mechanism objective value and the sensitivity field
  63. * ***************************************************
  64.  
  65. SI bool0.'MECANISME' ;
  66. SI bool0.'CAS_MULTIPLES' ;
  67. REPE loop0 case_nb0 ;
  68. SI bool0.'PASAPAS' ;
  69. sigAE = REDU (mdlA.&loop0.'MECANISME_ENTREE'.'CONTRAINTES'.NbStp0) mshA ;
  70. epsAE = ELAS modMA sigAE matMA ;
  71. sigAS = REDU (mdlA.&loop0.'MECANISME_SORTIE'.'CONTRAINTES'.NbStp0) mshA ;
  72. * epsAS = ELAS modMA sigAS matMA ;
  73. SINO ;
  74. * sigAE = REDU (mdlA.&loop0.'MECANISME_ENTREE'.'CONTRAINTES') mshA ;
  75. epsAE = REDU (mdlA.&loop0.'MECANISME_ENTREE'.'DEFORMATIONS') mshA ;
  76. sigAS = REDU (mdlA.&loop0.'MECANISME_SORTIE'.'CONTRAINTES') mshA ;
  77. * epsAS = REDU (mdlA.&loop0.'MECANISME_SORTIE'.'DEFORMATIONS') mshA ;
  78. FINS ;
  79. * 1/2.Cijkl.[1/2(diUEj+djUEi)].[1/2(dkUSl+dlUSk)]
  80. * =1/2.Cijkl.EPSEij.EPSSkl
  81. * =1/2.EPSEij.SIGSij
  82. eneA = ENER modMA sigAS epsAE ;
  83. * Element field of the strain energy density at barycenter
  84. eneA = (INTG 'ELEM' eneA modMA matMA) / (REDU volElM1 modMA) ;
  85. * Total strain energy
  86. tmp0 = INTG eneA modMA matMA ;
  87. * Objective function:
  88. obj0 = obj0 + (WghtMcn0 * tmp0 / case_nb0) ;
  89. * Rigidity property field at barycenter
  90. tmp0 = CHAN 'CHAM' (EXCO 'YOUN' matMA 'SCAL') modMA 'GRAVITE' ' ' ;
  91. * 1/2.EPSEij.EPSSij
  92. tmp0 = zero1 + (REDU (eneA/tmp0) modM1) ;
  93. * Sensitivity field:
  94. dc0 = dc0 + ((WghtMcn0 / case_nb0) * tmp0 * ((1.0 - vdM0) * p0 * (x0**(p0 - 1.0)))) ;
  95. * Objective function:
  96. *TODO obj0 = obj0 + (0.0 / case_nb0) ;
  97. FIN loop0 ;
  98. SINO ;
  99. SI bool0.'PASAPAS' ;
  100. sigAE = REDU (mdlA.'MECANISME_ENTREE'.'CONTRAINTES'.NbStp0) mshA ;
  101. epsAE = ELAS modMA sigAE matMA ;
  102. sigAS = REDU (mdlA.'MECANISME_SORTIE'.'CONTRAINTES'.NbStp0) mshA ;
  103. * epsAS = ELAS modMA sigAS matMA ;
  104. SINO ;
  105. * sigAE = REDU (mdlA.'MECANISME_ENTREE'.'CONTRAINTES') mshA ;
  106. epsAE = REDU (mdlA.'MECANISME_ENTREE'.'DEFORMATIONS') mshA ;
  107. sigAS = REDU (mdlA.'MECANISME_SORTIE'.'CONTRAINTES') mshA ;
  108. * epsAS = REDU (mdlA.'MECANISME_SORTIE'.'DEFORMATIONS') mshA ;
  109. FINS ;
  110. * 1/2.Cijkl.[1/2(diUEj+djUEi)].[1/2(dkUSl+dlUSk)]
  111. * =1/2.Cijkl.EPSEij.EPSSkl
  112. * =1/2.EPSEij.SIGSij
  113. eneA = ENER modMA sigAS epsAE ;
  114. * Element field of the strain energy density at barycenter
  115. eneA = (INTG 'ELEM' eneA modMA matMA) / (REDU volElM1 modMA) ;
  116. * Total strain energy
  117. tmp0 = INTG eneA modMA matMA ;
  118. * Objective function:
  119. obj0 = obj0 + (WghtMcn0 * tmp0) ;
  120. * Rigidity property field at barycenter
  121. tmp0 = CHAN 'CHAM' (EXCO 'YOUN' matMA 'SCAL') modMA 'GRAVITE' ' ' ;
  122. * 1/2.EPSEij.EPSSij
  123. tmp0 = zero1 + (REDU (eneA/tmp0) modM1) ;
  124. * Sensitivity field:
  125. dc0 = dc0 + (WghtMcn0 * tmp0 * ((1.0 - vdM0) * p0 * (x0**(p0 - 1.0)))) ;
  126. FINS ;
  127. FINS ;
  128.  
  129. * Strain energy objective value and the sensitivity field
  130. * *******************************************************
  131.  
  132. *SI (bool0.'MECANIQUE' ET ((ABS WghtM0) > tab0.'PRECISION')) ;
  133. SI (bool0.'MECANIQUE' ET (NEG WghtM0 0.0)) ;
  134. SI bool0.'CAS_MULTIPLES' ;
  135. REPE loop0 case_nb0 ;
  136. SI bool0.'PASAPAS' ;
  137. sigA = REDU (mdlA.&loop0.'CONTRAINTES'.NbStp0) mshA ;
  138. epsA = ELAS modMA sigA matMA ;
  139. SINO ;
  140. sigA = REDU (mdlA.&loop0.'CONTRAINTES') mshA ;
  141. epsA = REDU (mdlA.&loop0.'DEFORMATIONS') mshA ;
  142. FINS ;
  143. * 1/2.Cijkl.[1/2(diUj+djUi)].[1/2(dkUl+dlUk)]
  144. * =1/2.Cijkl.EPSij.EPSkl
  145. * =1/2.EPSij.SIGij
  146. * =Element field of the elastic strain energy density at
  147. * integration points:
  148. eneA = ENER modMA sigA epsA ;
  149. * Element field of the strain energy density at barycenter
  150. eneA = (INTG 'ELEM' eneA modMA matMA) / (REDU volElM1 modMA) ;
  151. * Objective function:
  152. * Add the total elastic strain energy * weight / nb of cases
  153. obj0 = obj0 + (WghtM0 * (INTG eneA modMA matMA) / case_nb0) ;
  154. * Rigidity property field at barycenter
  155. tmp0 = CHAN 'CHAM' (EXCO 'YOUN' matMA 'SCAL') modMA 'GRAVITE' ' ' ;
  156. * 1/2.EPSij.EPSij
  157. tmp0 = zero1 + (REDU (eneA/tmp0) modM1) ;
  158. * Sensitivity field:
  159. dc0 = dc0 + ((WghtM0 / case_nb0) * tmp0 * ((vdM0 - 1.0) * p0 * (x0**(p0 - 1.0)))) ;
  160. FIN loop0 ;
  161. SINO ;
  162. SI bool0.'PASAPAS' ;
  163. sigA = REDU (mdlA.'CONTRAINTES'.NbStp0) mshA ;
  164. epsA = ELAS modMA sigA matMA ;
  165. SINO ;
  166. sigA = REDU (mdlA.'CONTRAINTES') mshA ;
  167. epsA = REDU (mdlA.'DEFORMATIONS') mshA ;
  168. FINS ;
  169. * 1/2.Cijkl.[1/2(diUj+djUi)].[1/2(dkUl+dlUk)]
  170. * =1/2.Cijkl.EPSij.EPSkl
  171. * =1/2.EPSij.SIGij
  172. * =Element field of the elastic strain energy density at
  173. * integration points:
  174. eneA = ENER modMA sigA epsA ;
  175. * Element field of the strain energy density at barycenter
  176. eneA = (INTG 'ELEM' eneA modMA matMA) / (REDU volElM1 modMA) ;
  177. * Total strain energy
  178. tmp0 = INTG eneA modMA matMA ;
  179. * Objective function
  180. obj0 = obj0 + (WghtM0 * tmp0) ;
  181. * Rigidity property field at barycenter
  182. tmp0 = CHAN 'CHAM' (EXCO 'YOUN' matMA 'SCAL') modMA 'GRAVITE' ' ' ;
  183. * 1/2.EPSij.EPSij
  184. tmp0 = zero1 + (REDU (eneA/tmp0) modM1) ;
  185. * Sensitivity field
  186. dc0 = dc0 + (WghtM0 * tmp0 * ((vdM0 - 1.0) * p0 * (x0**(p0 - 1.0)))) ;
  187. FINS ;
  188. FINS ;
  189.  
  190. * Thermal compliance objective value and the sensitivity field
  191. * ************************************************************
  192.  
  193. *SI (bool0.'THERMIQUE' ET ((ABS WghtT0) > tab0.'PRECISION')) ;
  194. SI (bool0.'THERMIQUE' ET (NEG WghtT0 0.0)) ;
  195. SI bool0.'CAS_MULTIPLES' ;
  196. REPE loop0 case_nb0 ;
  197. * Temperature node field
  198. SI bool0.'PASAPAS' ;
  199. TA = REDU (mdlA.&loop0.'TEMPERATURES'.NbStp0) mshA ;
  200. SINO ;
  201. TA = REDU (mdlA.&loop0.'TEMPERATURES') mshA ;
  202. FINS ;
  203. * 1/2.K.grad(T).grad(T)
  204. * =1/2.K.grad(T)^2
  205. * =Element field of the thermal compliance density at integration points:
  206. * (without 1/2 nor K, they will be added locally for better performances)
  207. grdTA = GRAD modTA TA ;
  208. cmp0 = EXTR grdTA 'COMP' ;
  209. eneA = PSCA grdTA grdTA cmp0 cmp0 ;
  210. * Element field at barycenter
  211. eneA = (INTG 'ELEM' eneA modTA matTA) / (REDU volElT1 modTA) ;
  212. * Conductivity field at barycenter: K
  213. tmp0 = CHAN 'CHAM' (EXCO 'K' matTA 'SCAL') modTA 'GRAVITE' ' ' ;
  214. * Integration (with K)
  215. tmp0 = INTG (eneA * tmp0) modTA matTA ;
  216. * Objective function (with 1/2)
  217. obj0 = obj0 + (WghtT0 * 0.5 * tmp0 / case_nb0) ;
  218. * Switch the model of the element field eneA
  219. * from Therm to Mecha
  220. tmp0 = zero1 + (REDU eneA modT1) ;
  221. SI bool0.'MECANIQUE' ;
  222. tmp0 = TOPOCHAN tmp0 modM1 bmsh1 ;
  223. FINS ;
  224. * Sensitivity field (with 1/2)
  225. dc0 = dc0 + ((WghtT0 * 0.5 / case_nb0) * tmp0 * ((vdT0 - 1.0) * p0 * (x0**(p0 - 1.0)))) ;
  226. FIN loop0 ;
  227. SINO ;
  228. * Temperature node field
  229. SI bool0.'PASAPAS' ;
  230. TA = REDU (mdlA.'TEMPERATURES'.NbStp0) mshA ;
  231. SINO ;
  232. TA = REDU (mdlA.'TEMPERATURES') mshA ;
  233. FINS ;
  234. * 1/2.K.grad(T).grad(T)
  235. * =1/2.K.grad(T)^2
  236. * =Element field of the thermal compliance density at integration points:
  237. * (without 1/2 nor K, they will be added locally for better performances)
  238. grdTA = GRAD modTA TA ;
  239. cmp0 = EXTR grdTA 'COMP' ;
  240. eneA = PSCA grdTA grdTA cmp0 cmp0 ;
  241. * Element field at barycenter
  242. eneA = (INTG 'ELEM' eneA modTA matTA) / (REDU volElT1 modTA) ;
  243. * Conductivity field at barycenter: K
  244. tmp0 = CHAN 'TYPE' (EXCO 'K' matTA 'SCAL') ' ' ;
  245. ** mess 'tmp0 * eneA' ;
  246. tmp0 = INTG (eneA * tmp0) modTA matTA ;
  247. ** tmp0 = CHAN 'GRAVITE' modTA (EXCO 'K' matTA 'SCAL') ' ' ;
  248. ** mess 'tmp0 (6b)' ; list resu tmp0 ;
  249. * Integration (with K)
  250. ** mess 'tmp0 * eneA' ;
  251. ** tmp0 = INTG (eneA * tmp0) modTA matTA ;
  252. * Objective function (with 1/2)
  253. obj0 = obj0 + (WghtT0 * 0.5 * tmp0) ;
  254. * Switch the model of the element field eneA
  255. * from Therm to Mecha
  256. tmp0 = zero1 + (REDU eneA modT1) ;
  257. SI bool0.'MECANIQUE' ;
  258. tmp0 = TOPOCHAN tmp0 modM1 bmsh1 ;
  259. FINS ;
  260. * Sensitivity field (with 1/2)
  261. dc0 = dc0 + ((WghtT0 * 0.5) * tmp0 * ((vdT0 - 1.0) * p0 * (x0**(p0 - 1.0)))) ;
  262. FINS ;
  263. FINS ;
  264.  
  265. * Output data
  266. * ***********
  267.  
  268. * Save the objectove value and the sensitivity field
  269. tab0.'WTABLE'.'OBJECTIF' = obj0 ;
  270. tab0.'WTABLE'.'SENSIBILITE' = dc0 ;
  271.  
  272. FINP ;
  273.  
  274.  
  275.  
  276.  
  277.  

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