Télécharger topofilt.procedur

Retour à la liste

Numérotation des lignes :

  1. * TOPOFILT PROCEDUR FD218221 25/12/18 21:15:06 12429
  2.  
  3. ************************************************************************
  4. ** Procedure called by verious TOPOPTIM subprocedures for filtering
  5. ** an input field.
  6. **
  7. ** Author:
  8. ** Guenhael Le Quilliec (LaMe - Polytech Tours)
  9. **
  10. ** Version:
  11. ** 4.0 2025/12/16 Field to be filtered is given as input, and modified
  12. ** sensitivity filtering is now available. The field can
  13. ** also be normalized if it is an extensive quantity.
  14. ** Added a third filtering function: Helmholtz (PDE)
  15. ** 3.0 2021/04/19 Added a second filtering function using a filtering
  16. ** matrix generated with the MFIL operator
  17. ** 2.0 2017/11/11 Initial version: default Gibiane filter
  18. ************************************************************************
  19.  
  20. DEBP TOPOFILT tab*'TABLE' fldD*'MCHAML' LdX/'LOGIQUE' LN/'LOGIQUE' ;
  21.  
  22. * Input data
  23. * **********
  24.  
  25. Wtab = tab.'WTABLE' ;
  26. Ltab = Wtab.'LOGIQUE' ;
  27.  
  28. * Default value of modified filter logical (for X derivative)
  29. SI (NON (EXIS LdX)) ;
  30. LdX = FAUX ;
  31. FINS ;
  32.  
  33. * Default value of normalization logical (for non-extensive input fields)
  34. * Remark: Never used by TOPOPTIM, but may be useful elsewhere.
  35. SI (NON (EXIS LN)) ;
  36. LN = FAUX ;
  37. FINS ;
  38.  
  39. modD = Wtab.'MODELE_D' ;
  40.  
  41. * Pre-processing
  42. * **************
  43.  
  44. * If the field is extensive and needs normalization
  45. SI LN ;
  46. VD = Wtab.'VOLUME_D' ;
  47. * Transform it into an intensive field
  48. fldD = fldD / VD ;
  49. FINS ;
  50.  
  51. * Helmholtz (PDE) filter type (Lazarov et Sigmund 2010)
  52. * *****************************************************
  53.  
  54. SI (EGA tab.'FILTRE' 'EDP') ;
  55.  
  56. * Build the Helmholtz (PDE) filter matrix
  57. * ***************************************
  58.  
  59. oldtab = Wtab.'FILTRE_EDP_ID' ;
  60.  
  61. * If the mesh (or more precisely, the model and the frozen area)
  62. * or other filtering parameters have changed, then we update H and Hm.
  63. * Note: for 'MODEL' and 'ZONE_FIGEE', EGA compare their pointers.
  64. SI ((NEG oldtab.'MODEL' Wtab.'RESOLUTION_B'.'MODELE')
  65. OU (NEG oldtab.'ZONE_FIGEE' tab.'ZONE_FIGEE')
  66. OU (NEG oldtab.'RAYON' tab.'FILTRE_EDP_RAYON')) ;
  67. * Verification only due to the division by the number of nodes
  68. SI ((DIME (Wtab.'MAILLAGE_D' ELEM 'TYPE')) > 1) ;
  69. ERRE (CHAI 'Actuellement le filtre EDP n''est compatible'
  70. ' qu''avec des maillages constitues d''un seul'
  71. ' et unique type d''element') ;
  72. FINS ;
  73. * Update identification model, frozen area, and parameters
  74. oldtab.'MODEL' = Wtab.'RESOLUTION_B'.'MODELE' ;
  75. oldtab.'ZONE_FIGEE' = tab.'ZONE_FIGEE' ;
  76. oldtab.'RAYON' = tab.'FILTRE_EDP_RAYON' ;
  77. * Helmholtz filter equivalent radius
  78. Hval = tab.'FILTRE_EDP_RAYON' / 2.0 / (3.0**0.5) ;
  79. * Helmholtz filter model
  80. HmodD = MODE Wtab.'MAILLAGE_D' 'DIFFUSION' 'FICK'
  81. 'INCO' 'CO' 'SCAL' ;
  82. * Helmholtz filter caracteristics
  83. HmatD = MATE HmodD 'KD' (Hval ** 2) 'CDIF' 1.0 ;
  84. * Helmholtz filtering matrix
  85. Wtab.'FILTRE_EDP' = (COND HmodD HmatD) ET (CAPA HmodD HmatD) ;
  86. * Some cleaning
  87. OUBL HmodD ;
  88. OUBL HmatD ;
  89. FINS ;
  90.  
  91. * Filter the input field
  92. * **********************
  93.  
  94. * Get the node field to be filtered
  95. * TODO find a way to remove that limitation...
  96. tmp = NBNO (ELEM Wtab.'MAILLAGE_D' 1) ;
  97. fldD = CHAN 'CHPO' modD (fldD / tmp) 'SOMM' ;
  98. * Resolution and rename the component
  99. fldD = EXCO 'CO' (RESO Wtab.'FILTRE_EDP' fldD) 'SCAL' ;
  100. * Get the element field from node field
  101. fldD = CHAN 'CHAM' fldD modD 'GRAVITE' 'SCALAIRE' ;
  102. * In thermal mode, 'GRAVITE' option is not respected
  103. * This issue is resolved by using CHAN 'GRAVITE'
  104. SI (NON Ltab.'MECANIQUE') ;
  105. fldD = CHAN 'GRAVITE' fldD modD ;
  106. FINS ;
  107.  
  108. FINS ;
  109.  
  110. * Hat filter matrix type (Bruns et Tortorelli 2001)
  111. * *************************************************
  112.  
  113. SI (EGA tab.'FILTRE' 'CHAPEAU') ;
  114.  
  115. * Build the hat filter matrix
  116. * ***************************
  117.  
  118. oldtab = Wtab.'FILTRE_CHAPEAU_ID' ;
  119.  
  120. * If the mesh (or more precisely, the model and the frozen area)
  121. * or other filtering parameters have changed, then we update H and Hm.
  122. * Note: for 'MODEL' and 'ZONE_FIGEE', EGA compare their pointers.
  123. SI ((NEG oldtab.'MODEL' Wtab.'RESOLUTION_B'.'MODELE')
  124. OU (NEG oldtab.'ZONE_FIGEE' tab.'ZONE_FIGEE')
  125. OU (NEG oldtab.'RAYON' tab.'FILTRE_CHAPEAU_RAYON')
  126. OU (NEG oldtab.'EXPOSANT' tab.'FILTRE_CHAPEAU_EXPOSANT')
  127. OU (NEG oldtab.'CRITERE' tab.'FILTRE_CHAPEAU_CRITERE')) ;
  128. * Update identification model, frozen area, and parameters
  129. oldtab.'MODEL' = Wtab.'RESOLUTION_B'.'MODELE' ;
  130. oldtab.'ZONE_FIGEE' = tab.'ZONE_FIGEE' ;
  131. oldtab.'RAYON' = tab.'FILTRE_CHAPEAU_RAYON' ;
  132. oldtab.'EXPOSANT' = tab.'FILTRE_CHAPEAU_EXPOSANT' ;
  133. oldtab.'CRITERE' = tab.'FILTRE_CHAPEAU_CRITERE' ;
  134. * Prepare other data needed for generating the new filtering matrix
  135. VD = Wtab.'VOLUME_D' ;
  136. MESS 'Mise à jour de la matrice du filtre chapeau en cours...' ;
  137. ctrVD = MANU 'CHPO' Wtab.'MAILLAGE_GRAVITE_D' 'SCAL'
  138. (EXTR VD 'VALE' 'SCAL') ;
  139. * Filtering matrix
  140. HD = MFIL ctrVD tab.'FILTRE_CHAPEAU_RAYON'
  141. tab.'FILTRE_CHAPEAU_EXPOSANT'
  142. tab.'FILTRE_CHAPEAU_CRITERE' ;
  143. * Unitary barycenter field
  144. uniD = MANU 'CHPO' Wtab.'MAILLAGE_GRAVITE_D' 'SCAL'
  145. (EXTR Wtab.'UNIT_D' 'VALE' 'SCAL') ;
  146. * Weights (sum of each lines of the filtering matrix
  147. wgtD = uniD * HD ;
  148. * Normalized filtering matrix
  149. Wtab.'FILTRE_CHAPEAU_NORMALISE' = NFIL HD wgtD ;
  150. * Modified filtering matrix
  151. Wtab.'FILTRE_CHAPEAU_MODIFIE' = NFIL HD wgtD 'MODI' ;
  152. * Some cleaning as this matrix might be big
  153. OUBL HD ;
  154. MESS 'Fin de mise à jour de la matrice du filtre chapeau.' ;
  155. FINS ;
  156.  
  157. * Filter the input field
  158. * **********************
  159.  
  160. * Nodal field to be filtered
  161. fldD = MANU 'CHPO' Wtab.'MAILLAGE_GRAVITE_D' 'SCAL' (EXTR fldD 'VALE' 'SCAL') ;
  162. * Filter the nodal field
  163. * Remark: multiplication with the rigidity filtering affects the
  164. * order of the output values
  165. SI LdX ;
  166. fldD = fldD * Wtab.'FILTRE_CHAPEAU_MODIFIE' ;
  167. SINO ;
  168. fldD = fldD * Wtab.'FILTRE_CHAPEAU_NORMALISE' ;
  169. FINS ;
  170. * Filtered element field
  171. * Remark: Wtab.'MAILLAGE_GRAVITE_D' preserves the initial order to extract the values
  172. fldD = MANU 'CHML' modD
  173. 'REPA' 'SCAL' (EXTR fldD 'VALE' Wtab.'MAILLAGE_GRAVITE_D')
  174. 'TYPE' 'SCALAIRE' 'GRAVITE' ;
  175. * In thermal mode, 'GRAVITE' option is not respected
  176. * This issue is resolved by using CHAN 'GRAVITE'
  177. SI (NON Ltab.'MECANIQUE') ;
  178. fldD = CHAN 'GRAVITE' fldD Wtab.'THERMIQUE'.'MODELE_D' ;
  179. FINS ;
  180.  
  181. FINS ;
  182.  
  183. * Default Gibiane filtering
  184. * *************************
  185.  
  186. SI (EGA tab.'FILTRE' 'GIBIANE') ;
  187. SI (tab.'FILTRE_GIBIANE_TAUX' > 0) ;
  188. * Filtering
  189. REPE itr0 tab.'FILTRE_GIBIANE_TAUX' ;
  190. fldD = CHAN 'CHAM' (CHAN 'CHPO' modD fldD 'MOYE') modD 'GRAVITE' ;
  191. FIN itr0 ;
  192. * In thermal mode, 'GRAVITE' option is not respected
  193. * This issue is resolved by using CHAN 'GRAVITE'
  194. SI (NON Ltab.'MECANIQUE') ;
  195. fldD = CHAN 'GRAVITE' fldD modD ;
  196. FINS ;
  197. FINS ;
  198. FINS ;
  199.  
  200. * Post-processing
  201. * ***************
  202.  
  203. * Switch back to extensive quantity field
  204. SI LN ;
  205. fldD = fldD * VD ;
  206. FINS ;
  207.  
  208. FINP fldD ;
  209.  
  210.  
  211.  

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