* TOPOOBJE PROCEDUR FD218221 25/12/18 21:15:09 12429 ************************************************************************ ** Procedure called by TOPOPTIM to calculate: ** ** 1 - The objective function, which can be: ** - Mechanism output displacement maximization (based on ** compliance); ** - Compliance minimization (or more precisely, "2 * the total ** elastic strain energy" in mechanics and "total thermal ** compliance" in thermal problems); ** - Total volume fraction. ** ** 2 - The volume-normalized objective sensitivity (w.r.t X) ** Defined as ∂obj/∂X / vol1_e ** ** For compliance: ** - ∂cpl/∂X / vol1_e = - dZ/dX * q1_e / vol1_e ** Only the explicit part is included (ignoring U(X) dependence). ** The minus sign compensates for the missing implicit contribution, ** ensuring the optimizer moves densities in the correct direction. ** ** Finally, any requested restrictions and/or filtering are applied. ** ** Author: ** Guenhael Le Quilliec (LaMe - Polytech Tours) ** ** Version: ** 2.0 2025/11/17 Renamed TOPOOBJE and made compatible with ** TOPOPTIM V4.0. Added total volume fraction objective. ** Call TOPORSTR and filter the objective sensitivity at ** the end of TOPOOBJE. ** 1.0 2021/04/15 Initial version of TOPOSENS ************************************************************************ DEBP TOPOOBJE tab*'TABLE' ; * General input data * ****************** Wtab = tab.'WTABLE' ; Ltab = Wtab.'LOGIQUE' ; ********************************************************************** * Compliance and its sensitivity * ********************************************************************** SI Ltab.'OBJECTIF_COMPLIANCE' ; * Input data * ********** wgtmcn = tab.'POIDS_MECANISME' ; wgtM = tab.'POIDS_ENERGIE_DEFO' ; wgtT = tab.'POIDS_TEMPERATURE' ; ctrmshD = Wtab.'MAILLAGE_GRAVITE_D' ; resA = Wtab.'RESOLUTION_A' ; SI Ltab.'CAS_MULTIPLES' ; nbrcas = Wtab.'NB_CAS' ; FINS ; SI Ltab.'MECANIQUE' ; modMD = Wtab.'MECANIQUE'.'MODELE_D' ; FINS ; SI Ltab.'THERMIQUE' ; modTD = Wtab.'THERMIQUE'.'MODELE_D' ; FINS ; * Mesh, model, material, and "physical density derivative factor" (dZ/dY / Z) belonging to I * ****************************************************************************************** mshI = Wtab.'MAILLAGE_I' ; SI Ltab.'MECANIQUE' ; modMI = Wtab.'MECANIQUE'.'MODELE_I' ; ZmatMI = Wtab.'MECANIQUE'.'CARACTERISTIQUES_Z_I' ; dZdY_ZMI = Wtab.'MECANIQUE'.'SENSIBILITE_Z_I' / Wtab.'MECANIQUE'.'Z_I' ; FINS ; SI Ltab.'THERMIQUE' ; modTI = Wtab.'THERMIQUE'.'MODELE_I' ; ZmatTI = Wtab.'THERMIQUE'.'CARACTERISTIQUES_Z_I' ; dZdY_ZTI = Wtab.'THERMIQUE'.'SENSIBILITE_Z_I' / Wtab.'THERMIQUE'.'Z_I' ; FINS ; * Initialization * ************** O = 0.0 ; * Compliance and its sensitivity for mechanisms * ********************************************* SI Ltab.'MECANISME' ; SI Ltab.'CAS_MULTIPLES' ; REPE itr nbrcas ; * Handle and response stress and strain tmp = resA.&itr.'MECANISME_ENTREE'.'MAX_ID' ; tmp = resA.&itr.'MECANISME_SORTIE'.'MAX_ID' ; * epsoutI = ELAS modMI sigoutI ZmatMI ; SINO ; * siginpI = REDU (resA.&itr.'MECANISME_ENTREE'.'CONTRAINTES') mshI ; * epsoutI = REDU (resA.&itr.'MECANISME_SORTIE'.'DEFORMATIONS') mshI ; FINS ; cpl dcpldYI = TOPOCMPL modMI ZmatMI dZdY_ZMI sigoutI epsinpI ; O = O + ((wgtmcn / nbrcas) * cpl) ; dOdYI = ((wgtmcn / nbrcas) * dcpldYI) ; SINO ; dOdYI = dOdYI + ((wgtmcn / nbrcas) * dcpldYI) ; FINS ; FIN itr ; SINO ; * Handle and response stress and strain tmp = resA.'MECANISME_ENTREE'.'MAX_ID' ; tmp = resA.'MECANISME_SORTIE'.'MAX_ID' ; * epsoutI = ELAS modMI sigoutI ZmatMI ; SINO ; * siginpI = REDU (resA.'MECANISME_ENTREE'.'CONTRAINTES') mshI ; * epsoutI = REDU (resA.'MECANISME_SORTIE'.'DEFORMATIONS') mshI ; FINS ; cpl dcpldYI = TOPOCMPL modMI ZmatMI dZdY_ZMI sigoutI epsinpI ; O = O + (wgtmcn * cpl) ; dOdYI = (wgtmcn * dcpldYI) ; SINO ; dOdYI = dOdYI + (wgtmcn * dcpldYI) ; FINS ; FINS ; FINS ; * Compliance and its sensitivity * ****************************** * SI (Ltab.'MECANIQUE' ET ((ABS wgtM) > tab.'PRECISION')) ; SI (Ltab.'MECANIQUE' ET (NEG wgtM 0.0)) ; SI Ltab.'CAS_MULTIPLES' ; REPE itr nbrcas ; tmp = resA.&itr.'MAX_ID' ; SINO ; FINS ; O = O + ((wgtM / nbrcas) * cpl) ; dOdYI = ((-1.0 * wgtM / nbrcas) * dcpldYI) ; SINO ; dOdYI = dOdYI - ((wgtM / nbrcas) * dcpldYI) ; FINS ; FIN itr ; SINO ; tmp = resA.'MAX_ID' ; SINO ; FINS ; O = O + (wgtM * cpl) ; dOdYI = ((-1.0 * wgtM) * dcpldYI) ; SINO ; dOdYI = dOdYI - (wgtM * dcpldYI) ; FINS ; FINS ; FINS ; * Thermal compliance and its sensitivity * ************************************** * SI (Ltab.'THERMIQUE' ET ((ABS wgtT) > tab.'PRECISION')) ; SI (Ltab.'THERMIQUE' ET (NEG wgtT 0.0)) ; SI Ltab.'CAS_MULTIPLES' ; REPE itr nbrcas ; * Temperature nodal field tmp = resA.&itr.'MAX_ID' ; SINO ; FINS ; cpl dcpldYI = TOPOCMPL modTI ZmatTI dZdY_ZTI TA ; * Switch the model of the element field eneK from Therm to Mecha SI Ltab.'MECANIQUE' ; * Remark: values of any element of I missing in D will be set to 0.0 FINS ; O = O + ((wgtT / nbrcas) * cpl) ; dOdYI = ((-1.0 * wgtT / nbrcas) * dcpldYI) ; SINO ; dOdYI = dOdYI - ((wgtT / nbrcas) * dcpldYI) ; FINS ; FIN itr ; SINO ; * Temperature nodal field tmp = resA.'MAX_ID' ; SINO ; FINS ; cpl dcpldYI = TOPOCMPL modTI ZmatTI dZdY_ZTI TA ; * Switch the model of the element field eneK from Therm to Mecha SI Ltab.'MECANIQUE' ; * Remark: values of any element of I missing in D will be set to 0.0 FINS ; O = O + (wgtT * cpl) ; dOdYI = ((-1.0 * wgtT) * dcpldYI) ; SINO ; dOdYI = dOdYI - (wgtT * dcpldYI) ; FINS ; FINS ; FINS ; * Get the objective sensitivity with respect to physical densities Y on D * *********************************************************************** * If it is empty * Return a zero field dOdYD = Wtab.'ZERO_D' ; SINO ; * Use REDU to get O on D from I. * Remark: values of any element of D missing in I will be set to 0.0 FINS ; * Normalization * ************* * Volume-normalized objective sensitivity NdOdYD = dOdYD / Wtab.'VOLUME_D' ; FINS ; ********************************************************************** * Volume ratio and its sensitivity * ********************************************************************** SI Ltab.'OBJECTIF_VOLUME' ; * Input data * ********** uniD = Wtab.'UNIT_D' ; modD = Wtab.'MODELE_D' ; matD = Wtab.'CARACTERISTIQUES_D' ; VtotD = Wtab.'VOLUME_TOTAL_D' ; * Objective to be minimized * ************************* * Total material volume normalized by the total element volume FINS ; O = Wtab.'FRACTION_VOLUME' ; * Volume-normalized objective sensitivity with respect to Y Wtab.'UNIT_D_/_VTOT_D' = uniD / VtotD ; FINS ; NdOdYD = Wtab.'UNIT_D_/_VTOT_D' ; FINS ; ********************************************************************** * Postprocessing of the objective and its sensitivity * ********************************************************************** * Correct the sensitivity * *********************** * Modify sensitivity to get derivative with respect to X instead of Y NdOdXD = TOPODYDX tab NdOdYD ; * Add any requested restrictions * ****************************** * Objective sensitivity filtering * ******************************* SI Ltab.'FILTRE_SENSIBILITE_OBJECTIF' ; tmp = NdOdXD * Wtab.'Y_D' ; FINS ; * Save output data * **************** * Save the compliance value and its sensitivity field before applying restrictions Wtab.'OBJECTIF' = O ; Wtab.'SENSIBILITE_NORMALISEE_OBJECTIF_D' = NdOdXD ; FINP ;
© Cast3M 2003 - Tous droits réservés.
Mentions légales