* TOPOBOOT PROCEDUR FD218221 25/12/18 21:15:02 12429 ************************************************************************ ** Procedure called by TOPOPTIM for preprocessing input data before ** starting the topology optimization loop. ** ** Author: ** Guenhael Le Quilliec (LaMe - Polytech Tours) ** ** Version: ** 3.0 2025/12/01 Various updates and improvements for TOPOPTIM V4.0. ** 2.0 2021/04/22 Made compatible with Cast3M-2020 for linear ** thermo-mechanical resolution ** 1.0 2021/04/15 Initial version ************************************************************************ * * TOPOBOOT sections: * ------------------ * * - Initialization * - TOPOPTIM version < 4.0 input data verification * - General options * - Base (B) resolution model (mod) and material characteristics (mat) * - Mechanism (mcn) * - Base (B), frozen (F), design (D) and contact (cnt) meshes (msh) * - Initialization of active (A) and intersection (I) meshes * - Design (D) and frozen (F) model and material characteristics * - Constraints (g & G) * - Objective (O) * - Optimizer * - Design variables (X) * - Restrictions * - Filtering of some sensitivities or the intermediate density (S) * - Binarization by projection of the physical density (Y) * - Physical density penalization (Z) * - Convergence * - Parameters evolving over optimization cycles * - On-the-fly monitoring * - Output data * - Unitary (uni) and volume (V) element fields * - Default model, characteristics, unitary and volume element fields * - Design zone (D) various data: zero field, centroids & total volume * - Restart (R) * - Initial design variables (X) and physical densities (Y) * ********************************************************************** DEBP TOPOBOOT tab*'TABLE' ; ********************************************************************** * Initialization * ********************************************************************** * Start timer * Working (W) table (tab) Wtab = tab.'WTABLE' ; * Boolean/Logiocal (L) table (tab) Ltab = Wtab.'LOGIQUE' ; * Define "Not a Number" Wtab.'NAN' = LOG -1.0 ; * Define empty variable * Table of pointers used by TOPOMODI * Number of the last completed cycle tab.'CYCLE' = 0 ; FINS ; cyc = (ENTI (tab.'CYCLE')) + 1 ; Wtab.'CYCLE' = cyc ; * Number of the current iteration and its timer Wtab.'ITERATION' = 0 ; Wtab.'HORLOGE' = 0.0 ; ********************************************************************** * TOPOPTIM version < 4.0 input data verification * ********************************************************************** * Check old input names for compatibility tmp.&itr ' a ete renomme' ' ' oldtab.(tmp.&itr) '.') ; FINS ; FIN itr ; * Check old name of hat filter SI (EGA tab.'FILTRE' 'MATRICE') ; ' a ete renomme CHAPEAU.') ; FINS ; FINS ; * Check old index of initial topology ' initiale est donnee a l''indice 1.') ; FINS ; FINS ; ********************************************************************** * General options * ********************************************************************** * Numerical precision tab.'PRECISION' = 1.0e-9 ; FINS ; * Division by zero protection tab.'ZERO_DIVISION' = 0.001 ; FINS ; * Maximum distance for node fusion tab.'ELIM_CRITERE' = 1.0e-9 ; FINS ; * User-defined procedure called just before the resolution, which * can be used to update the loading and any other data * if they (partly or totally) depend on topology tab.'PROCEDURE_TOPOUPDT' = FAUX ; FINS ; * Personal procedure that can be used, among others, to * calculate/modify the sensitivity field and objective value tab.'PROCEDURE_TOPOPERS' = FAUX ; FINS ; ********************************************************************** * Base (B) resolution model (mod) and material characteristics (mat) * ********************************************************************** * Table of the resolution (res) data of the base (B) finite element * model resB = tab.'RESOLUTION_PASAPAS' ; SINO ; resB = tab.'RESOLUTION_LINEAIRE' ; FINS ; Wtab.'RESOLUTION_B' = resB ; * Base (B) mechanical (M), thermal (T), and contact (cnt) models (mod) modB = resB.'MODELE' ; Ltab.'MECANIQUE' = LM ; SI LM ; Wtab.'MECANIQUE'.'MODELE_B' = modMB ; FINS ; Ltab.'THERMIQUE' = LT ; SI LT ; Wtab.'THERMIQUE'.'MODELE_B' = modTB ; FINS ; Ltab.'CONTACT' = Lcnt ; SI Lcnt ; Wtab.'CONTACT'.'MODELE_B' = modcntB ; FINS ; * Base (B) mechanical (M), thermal (T), and contact (cnt) material * characteristics (mat) matB = resB.'CARACTERISTIQUES' ; SI LM ; Wtab.'MECANIQUE'.'CARACTERISTIQUES_B' = matMB ; FINS ; SI LT ; Wtab.'THERMIQUE'.'CARACTERISTIQUES_B' = matTB ; FINS ; SI Lcnt ; Wtab.'CONTACT'.'CARACTERISTIQUES_B' = matcntB ; FINS ; ********************************************************************** * Mechanism (mcn) * ********************************************************************** * Compliant mechanism synthesis topology optimization Ltab.'MECANISME' = Lmcn ; * Solve the problem also without springs tab.'MECANISME_ZERO_SPRING' = FAUX ; FINS ; * Verification * !!!!!!!!!!!! * Check that a mechanical model exists SI (Lmcn ET (NON LM)) ; MESS 'Pour effectuer une optimisation de mecanisme deformable,' ; MESS 'il faut imperativement preciser un modele mecanique.' ; ERRE 'Veuillez preciser le modele mecanique a utiliser.' ; FINS ; ********************************************************************** * Base (B), frozen (F), design (D) and contact (cnt) meshes (msh) * ********************************************************************** * Base (B) mesh * ************* * Remark: without contact mesh, only mechanical or thermal SI LM ; SINO ; FINS ; Wtab.'MAILLAGE_B' = mshB ; * Frozen area (F) mesh * ******************** FINS ; Ltab.'ZONE_FIGEE' = LF ; SI LF ; mshF = tab.'ZONE_FIGEE' ; SINO ; mshD = mshB ; FINS ; * Design (D) mesh * *************** SI LF ; SINO ; mshD = mshB ; FINS ; * Contact (cnt) mesh * ****************** SI Lcnt ; FINS ; * Verification * !!!!!!!!!!!! * Check that the number of elements of thermal and mechanical meshes * equals that of the base mesh, otherwise the procedure can't work SI (LM ET LT) ; ERRE 'Veuillez adapter vos modeles en consequence.' ; FINS ; FINS ; ********************************************************************** * Initialization of active (A) and intersection (I) meshes * ********************************************************************** * Initialize active (A) & intersection (I) zones with empty meshes * Remark: this is needed by TOPOACTI at first iteration Wtab.'MAILLAGE_I' = Wtab.'MAILLAGE_A' ; ********************************************************************** * Design (D) and frozen (F) model and material characteristics * ********************************************************************** SI LF ; SI LM ; Wtab.'MECANIQUE'.'MODELE_F' = modMF ; Wtab.'MECANIQUE'.'CARACTERISTIQUES_F' = matMF ; FINS ; SI LT ; Wtab.'THERMIQUE'.'MODELE_F' = modTF ; Wtab.'THERMIQUE'.'CARACTERISTIQUES_F' = matTF ; FINS ; SINO ; SI LM ; modMD = modMB ; matMD = matMB ; FINS ; SI LT ; modTD = modTB ; matTD = matTB ; FINS ; FINS ; Wtab.'MAILLAGE_D' = mshD ; SI LM ; Wtab.'MECANIQUE'.'MODELE_D' = modMD ; Wtab.'MECANIQUE'.'CARACTERISTIQUES_D' = matMD ; FINS ; SI LT ; Wtab.'THERMIQUE'.'MODELE_D' = modTD ; Wtab.'THERMIQUE'.'CARACTERISTIQUES_D' = matTD ; FINS ; ********************************************************************** * Constraints (g & G) * ********************************************************************** * List of constraints * Maximum volume fraction constraint * Remark: No longer optional since TOPOPTIM V4, as this data now * indicates not only the maximum volume but also whether a * maximum volume constraint is desired. SI Ltab.'CONTRAINTE_VOLUME' ; FINS ; * Maximum von Mises stress constraint * TODO could be either a scalar or a field? Ltab.'VERBART' = FAUX ; Ltab.'CONIGLIO' = FAUX ; SI Ltab.'CONTRAINTE_SIGMA_VM' ; ERRE 'La contrainte de von Mises limite SIGMA_VM_LIMITE doit etre renseignee.' ; FINS ; FINS ; SI (EGA tab.'SIGMA_VM_LIMITATION' 'VERBART') ; Ltab.'VERBART' = VRAI ; SINO ; Ltab.'CONIGLIO' = VRAI ; FINS ; SINO ; Ltab.'CONTRAINTE_SIGMA_VM' = VRAI ; Ltab.'VERBART' = VRAI ; FINS ; FINS ; SI Ltab.'CONTRAINTE_SIGMA_VM' ; FINS ; * Aggregation Wtab.'AGREGATION' = tab.'AGREGATION' ; SINO ; * SI (Ltab.'VERBART' OU Ltab.'CONIGLIO') ; * Wtab.'AGREGATION' = MOT 'KSL' ; * FINS ; FINS ; * And its parameter Wtab.'AGREGATION_P' = tab.'AGREGATION_P' ; SINO ; SI (EGA Wtab.'AGREGATION' 'KSL') ; Wtab.'AGREGATION_P' = 8.0 ; FINS ; FINS ; FINS ; * Verification * !!!!!!!!!!!! * Check that a constraint is set MESS 'Il manque une contrainte d''optimisation.' ERRE 'Par exemple, indiquez une valeur pour FRACTION_VOLUME_LIMITE.' ; FINS ; ********************************************************************** * Objective (O) * ********************************************************************** * Type of objective function * ************************** * Remark: mechanism synthesis uses compliance objective function type SI Ltab.'CONTRAINTE_VOLUME' ; SINO ; FINS ; FINS ; Ltab.'OBJECTIF_COMPLIANCE' = EGA tab.'OBJECTIF' 'COMPLIANCE' ; Ltab.'OBJECTIF_VOLUME' = EGA tab.'OBJECTIF' 'FRACTION_VOLUME' ; * Weights for multi-objective applications * **************************************** tab.'POIDS_MECANISME' = 1.0 ; FINS ; SI Lmcn ; tab.'POIDS_ENERGIE_DEFO' = 0.0 ; SINO ; tab.'POIDS_ENERGIE_DEFO' = 1.0 ; FINS ; FINS ; SI Lmcn ; tab.'POIDS_TEMPERATURE' = 0.0 ; SINO ; tab.'POIDS_TEMPERATURE' = 1.0 ; FINS ; FINS ; * Verification * !!!!!!!!!!!! FINS ; ********************************************************************** * Optimizer * ********************************************************************** * Default optimization algorithm * ****************************** FINS ; * Optimality criterion (OC) * ************************* * Damping factor (D) * Default value of D tab.'OC_D' = 0.5 ; FINS ; * Grey Scale Factor (Q) * Default value of Q tab.'OC_Q' = 1.0 ; FINS ; * Initial lower bound for the Lagrangian multiplier tab.'OC_L1' = 0.0 ; FINS ; * Initial upper bound for the Lagrangian multiplier *SI (NON (EXIS tab 'OC_L2')) ; * tab.'OC_L2' = 1.0e5 ; *FINS ; * Minimal value for the upper bound tab.'OC_L2_MIN' = 1.0e-40 ; FINS ; * Convergence criterion for the bi-sectioning algorithm tab.'OC_CRITERE' = 1.0e-8 ; FINS ; * Maximum number of iterations for the bi-sectioning algorithm tab.'OC_MAX_IT' = 100000 ; FINS ; * Lower bound for B (where B**D is the ratio between the new and the * previous topology fields) tab.'OC_B_MIN' = 1.0e-10 ; FINS ; * Method of Moving Asymptotes (MMA) * ********************************* * Coefficient(s) C of MMA * TODO à adapter le jour où on proposerra d'appliquer plus d'une contrainte * TODO cette valeur par défaut est-elle judicieuse en cas de contrainte de * sur le volume? SINO ; FINS ; FINS ; * Coefficient to be applied on the objective function so that it remains * between 1 and 100 tab.'MMA_COEF_OBJECTIF' = 1.0 ; SI (EGA tab.'OBJECTIF' 'COMPLIANCE') ; * tab.'MMA_COEF_OBJECTIF' = Wtab.'NAN' ; tab.'MMA_COEF_OBJECTIF' = 0.0 ; FINS ; SI (EGA tab.'OBJECTIF' 'FRACTION_VOLUME') ; tab.'MMA_COEF_OBJECTIF' = 100.0 ; FINS ; FINS ; * Verification * !!!!!!!!!!!! * With OC, only maximum volume fraction must be set SI ((EGA tab.'OPTIMISEUR' 'OC') ET (NON Ltab.'CONTRAINTE_VOLUME'))); ERRE 'Seule une contrainte sur le volume est autorisee avec OC. Tentez d''utiliser l''optimiseur MMA.' ; FINS ; * Stress constraint is compatible only with MMA and a mechanical model should be defined SI Ltab.'CONTRAINTE_SIGMA_VM' ; SI (NEG tab.'OPTIMISEUR' 'MMA') ; ERRE 'Seul l''optimiseur MMA est compatible avec une contrainte de von Mises maximale.' ; FINS ; SI (NON Ltab.'MECANIQUE') ; ERRE 'Un modele mecanique est indispensable pour imposer une contrainte de von Mises maximale.' ; FINS ; FINS ; ********************************************************************** * Design variables (X) * ********************************************************************** * Move (absolute value of the increment) threshold of the design * variable between two cycles tab.'X_CHANGE_SEUIL' = 0.2 ; FINS ; * Design variable minimum threshold SI Lmcn ; tab.'X_MIN_SEUIL' = 0.001 ; SINO ; tab.'X_MIN_SEUIL' = 0.0 ; FINS ; FINS ; ********************************************************************** * Restrictions * ********************************************************************** * Procedure to add a geometric restrictions ********************************************************************** * Filtering of some sensitivities or the intermediate density (S) * ********************************************************************** * Type of filter FINS ; * Parameters for Helmholtz (PDE) filter SI (EGA tab.'FILTRE' 'EDP'); * Filter radius ERRE 'Veuillez preciser un rayon de filtrage.' ; FINS ; FINS ; * Default Helmholtz (PDE) filter identification data Wtab.'FILTRE_EDP_ID'.'RAYON' = 0.0 ; * Parameters for hat filter SI (EGA tab.'FILTRE' 'CHAPEAU'); * Filter radius ERRE 'Veuillez preciser un rayon de filtrage.' ; FINS ; * Filter exponent tab.'FILTRE_CHAPEAU_EXPOSANT' = 1.0 ; FINS ; * Filter weight minimum threshold tab.'FILTRE_CHAPEAU_CRITERE' = 0.0 ; FINS ; FINS ; * Default hat filter identification data (compatible with SAUV/REST) Wtab.'FILTRE_CHAPEAU_ID'.'RAYON' = 0.0 ; Wtab.'FILTRE_CHAPEAU_ID'.'EXPOSANT' = 0.0 ; Wtab.'FILTRE_CHAPEAU_ID'.'CRITERE' = 0.0 ; * Parameters for Gibiane filter type SI (EGA tab.'FILTRE' 'GIBIANE'); * Filter rate tab.'FILTRE_GIBIANE_TAUX' = 1 ; FINS ; FINS ; * Field to be filtered Ltab.'FILTRE_SENSIBILITE_OBJECTIF' = FAUX ; Ltab.'FILTRE_SENSIBILITES_CONTRAINTES' = FAUX ; Ltab.'FILTRE_DENSITE' = FAUX ; 'SENSIBILITE_OBJECTIF' 'SENSIBILITES_CONTRAINTES') tab.'FILTRER') ; SI (EGA tab.'FILTRER' 'DENSITE') ; Ltab.'FILTRE_DENSITE' = VRAI ; FINS ; SI (EGA tab.'FILTRER' 'SENSIBILITE_OBJECTIF') ; SI (NON Ltab.'CONTRAINTE_VOLUME') ; ' qu''en cas de contrainte sur le volume.') ; FINS ; Ltab.'FILTRE_SENSIBILITE_OBJECTIF' = VRAI ; FINS ; SI (EGA tab.'FILTRER' 'SENSIBILITES_CONTRAINTES') ; SI (Ltab.'CONTRAINTE_VOLUME') ; ' qu''en cas de contrainte sur von Mises.') ; FINS ; Ltab.'FILTRE_SENSIBILITES_CONTRAINTES' = VRAI ; FINS ; SINO ; ERRE 'Le champ a filtrer n''est pas reconnu.' ; FINS ; SINO ; SI Ltab.'CONTRAINTE_VOLUME' ; Ltab.'FILTRE_SENSIBILITE_OBJECTIF' = VRAI ; SINO ; Ltab.'FILTRE_SENSIBILITES_CONTRAINTES' = VRAI ; FINS ; FINS ; * Verification * !!!!!!!!!!!! *SI (Ltab.'FILTRE_DENSITE' ET (NEG tab.'FILTRE' 'CHAPEAU')) ; ** If the density is filtered then the "modified filter" is needed ** to get the X derivative. This is possible only with the hat ** filter. * ERRE (CHAI 'Seul le filtre de type CHAPEAU permet de filtrer la' * ' DENSITE. Veuillez adapter les parametres d''entree.') ; *FINS ; ********************************************************************** * Binarization by projection of the physical density (Y) * ********************************************************************** * Physical density projection with a hyperbolic sigmoid function * ************************************************************** * TODO Créer une erreure ou une alerte si OC_Q est actif en même temps que la projection (car ils ont le même but) * Idem s'il est actif avec MMA?... Ltab.'PROJECTION_VOLUME_CONSTANT' = FAUX ; FINS ; SI (EGA tab.'PROJECTION' 'GUEST_2004') ; Wtab.'PROJECTION_SEUIL' = 0.0 ; FINS ; * Constant density threshold projection or constant volume projection SI ((EGA tab.'PROJECTION' 'SIGMOID_TANH') ET Wtab.'PROJECTION_SEUIL' = 0.5 ; Ltab.'PROJECTION_VOLUME_CONSTANT' = VRAI ; FINS ; Wtab.'PROJECTION_SEUIL' = tab.'PROJECTION_SEUIL' ; FINS ; * Maximum iterations of the volume-preserving bisection algorithm tab.'PROJECTION_MAX_IT' = 100 ; FINS ; * Bisection algorithm criterion on the volume-preserving threshold value tab.'PROJECTION_SEUIL_CRITERE' = 1.0e-7 ; FINS ; * Bisection algorithm criterion on the volume-preserving difference rate tab.'PROJECTION_VOLUME_CRITERE' = 1.0e-3 ; FINS ; * Verification * !!!!!!!!!!!! SI ((NEG tab.'PROJECTION' 'SIGMOID_TANH') ET ' avec la fonction de projection' ' ' tab.'PROJECTION' '.') ; FINS ; ********************************************************************** * Physical density penalization (Z) * ********************************************************************** * Penalization function FINS ; * Penalty factor (P) tab.'PENALISATION_P' = 3.0 ; FINS ; * List of material components that are proportional to the penalized * physical densities (Z) FINS ; * Ratio between the mechanical stiffness of the voids and the material SI (Lmcn OU LT) ; tab.'RAPPORT_RAIDEURS_MECANIQUES' = 1.0e-8 ; SINO ; tab.'RAPPORT_RAIDEURS_MECANIQUES' = 0.0 ; FINS ; FINS ; * Ratio between the thermal stiffness of the voids and the material tab.'RAPPORT_RAIDEURS_THERMIQUES' = 0.001 ; FINS ; * Minimal threshold value of the penalized physical densities (Z) to * save mesh elements tab.'SEUIL_ELEMENTS_ACTIFS' = 1.0e-9 ; FINS ; ********************************************************************** * Convergence * ********************************************************************** * Maximum number of optimization cycles tab.'MAX_CYCLES' = 100 ; FINS ; * Convergence criterion tab.'CONVERGENCE_CRITERE' = 0.01 ; FINS ; * Initialize or reset convergence logical tab.'CONVERGENCE' = FAUX ; * Stop optimization trigger Ltab.'STOP' = FAUX ; * Verification * !!!!!!!!!!!! * Make sure the optimization loop will start SI ((Wtab.'CYCLE') > tab.'MAX_CYCLES') ; FINS ; ********************************************************************** * Parameters evolving over optimization cycles * ********************************************************************** * Input parameters that may be evolutions over optimization cycles * (otherwise they are scalar values) * Initialization call to TOPOEVAL * Remark: this can be needed for the call to TOPOPHYS at the end of * TOPOBOOT. TOPOEVOL tab ; ********************************************************************** * On-the-fly monitoring * ********************************************************************** * Plot results on-the-fly FINS ; * Table of data for visualization * User list of variable names to be printed on the fly FINS ; SINO ; FINS ; * Full list of variable names to be printed on the fly * Remark: order will be preserved when printed SI Ltab.'CONTRAINTE_SIGMA_VM' ; FINS ; SI (Ltab.'CONTRAINTE_VOLUME' ET (NEG tab.'OPTIMISEUR' 'OC')) ; * Not shown in the case of volume minimization as the objective * corresponds to volume fraction and is already displayed * OU Ltab.'OBJECTIF_VOLUME' FINS ; * Add any requested variables * Time / cycle * Number of active elements SI (NON ((LM ET (tab.'RAPPORT_RAIDEURS_MECANIQUES' > tab.'SEUIL_ELEMENTS_ACTIFS')) OU (LT ET (tab.'RAPPORT_RAIDEURS_THERMIQUES' > tab.'SEUIL_ELEMENTS_ACTIFS')))) ; FINS ; Wtab.'VISU'.'VARIABLES' = tmp ; ********************************************************************** * Output data * ********************************************************************** * Logical to save data on a file FINS ; * Save data that might be needed in case of restart tab.'SAUVEGARDE_DE_REPRISE' = VRAI ; FINS ; * Cycles to be saved FINS ; * Data to be saved FINS ; tab.'MES_SAUVEGARDES'.'X' = VRAI ; FINS ; tab.'MES_SAUVEGARDES'.'X_FILTRE' = VRAI ; FINS ; tab.'MES_SAUVEGARDES'.'TOPOLOGIE' = VRAI ; FINS ; tab.'MES_SAUVEGARDES'.'MAILLAGE' = VRAI ; FINS ; tab.'MES_SAUVEGARDES'.'RESOLUTION' = FAUX ; FINS ; * Only for step-by-step resolution * Save time list SINO ; tmp = resB.'TEMPS_SAUVES' ; FINS ; Wtab.'TEMPS_SAUVES' = tmp ; FINS ; * List of names of output evolutions * Copy 'VISU'.'VARIABLES' without 'EVOLUTIONS' * tmp = MOTS ; * REPE itr (DIME Wtab.'VISU'.'VARIABLES') ; * tmp1 = EXTR Wtab.'VISU'.'VARIABLES' &itr ; * SI (NON (EXIS Wtab.'EVOLUTIONS' tmp1)) ; * tmp = tmp ET (MOTS tmp1) ; * FINS ; * FIN itr ; tmp = Wtab.'VISU'.'VARIABLES' ; * Save them by default tab.'EVOLUTIONS_SAUVEES' = tmp ; SINO ; FINS ; FINS ; * Table of output evolutions FINS ; * Table of evolution default colors Wtab.'EVOLUTIONS_COULEUR' = tmp ; * Design variable output table FINS ; * Intermediate densities output table FINS ; * Topology output table FINS ; * Mesh output table FINS ; * Resolution output table FINS ; ********************************************************************** * Unitary (uni) and volume (V) element fields * ********************************************************************** * For the mechanical (M) model SI LM ; * Unitary field * Volume of each element * Change the unitary field so that it is not considered as constant * to avoid problems with the function POIN 'SUPE' uniMD = VMD / VMD ; Wtab.'MECANIQUE'.'UNIT_D' = uniMD ; Wtab.'MECANIQUE'.'VOLUME_D' = VMD ; SI LF ; * Unitary field * Volume of each element Wtab.'MECANIQUE'.'UNIT_F' = uniMF ; Wtab.'MECANIQUE'.'VOLUME_F' = VMF ; FINS ; FINS ; * For the thermal (T) model SI LT ; * Unitary field * In thermal mode, 'GRAVITE' option is not respected * This issue is resolved by using CHAN 'GRAVITE' * Volume of each element * In thermal mode, INTG 'ELEM' is not given at 'GRAVITE' even if * input fields were defined at 'GRAVITE' * This problem is solved by using CHAN 'GRAVITE' * Divide the element volume field by itself to get uniTD so that * it is not considered as constant and avoid problems with the * function POIN 'SUPE' uniTD = VTD / VTD ; Wtab.'THERMIQUE'.'UNIT_D' = uniTD ; Wtab.'THERMIQUE'.'VOLUME_D' = VTD ; SI LF ; * Unitary field * In thermal mode, 'GRAVITE' option is not respected * This issue is resolved by using CHAN 'GRAVITE' * Volume of each element * In thermal mode, INTG 'ELEM' is not given at 'GRAVITE' even if * input fields were defined at 'GRAVITE' * This problem is solved by using CHAN 'GRAVITE' * Divide the element volume field by itself to get uniTF so that * it is not considered as constant and avoid problems with the * function POIN 'SUPE' uniTF = VTF / VTF ; Wtab.'THERMIQUE'.'UNIT_F' = uniTF ; Wtab.'THERMIQUE'.'VOLUME_F' = VTF ; FINS ; FINS ; ********************************************************************** * Default model, characteristics, unitary and volume element fields * ********************************************************************** SI LM ; * If a mechanical (M) model exists Wtab.'MODELE_B' = modMB ; Wtab.'MODELE_D' = modMD ; Wtab.'CARACTERISTIQUES_B' = matMB ; Wtab.'CARACTERISTIQUES_D' = matMD ; SI LF ; Wtab.'MODELE_F' = modMF ; Wtab.'CARACTERISTIQUES_F' = matMF ; FINS ; uniD = uniMD ; SI LF ; uniF = uniMF ; FINS ; Wtab.'VOLUME_D' = VMD ; Wtab.'VOLUME_F' = VMF ; SINO ; * If only a thermal (T) model exists Wtab.'MODELE_B' = modTB ; Wtab.'MODELE_D' = modTD ; Wtab.'CARACTERISTIQUES_B' = matTB ; Wtab.'CARACTERISTIQUES_D' = matTD ; SI LF ; Wtab.'MODELE_F' = modTF ; Wtab.'CARACTERISTIQUES_F' = matTF ; FINS ; uniD = uniTD ; SI LF ; uniF = uniTF ; FINS ; Wtab.'VOLUME_D' = VTD ; Wtab.'VOLUME_F' = VTF ; FINS ; Wtab.'UNIT_D' = uniD ; SI LF ; Wtab.'UNIT_F' = uniF ; FINS ; ********************************************************************** * Design zone (D) various data: zero field, centroids & total volume * ********************************************************************** * Zero element field Wtab.'ZERO_D' = uniD * 0.0 ; * Node mesh of the centroids SI LF ; SI LM ; * VtotF = INTG uniF modMF matMF ; SINO ; * VtotF = INTG uniF modTF matTF ; FINS ; * Wtab.'VOLUME_TOTAL_B' = VtotD + VtotF ; SINO ; SI LM ; SINO ; FINS ; * Wtab.'VOLUME_TOTAL_B' = VtotD ; FINS ; Wtab.'VOLUME_TOTAL_D' = VtotD ; ********************************************************************** * Restart (R) * ********************************************************************** * Remark: The following inputs are not supposed to be provided by the * user. They are supposed to be generated by TOPOPTIM during a * previous call. * List of restarts * **************** * Initialize or update the list of restarts SI (EGA Wtab.'CYCLE' 1) ; SINO ; * It should exist, but this prevents any error if it's missing FINS ; tab.'REPRISES' = tab.'REPRISES' ET cyc ; FINS ; * Restart data table * ****************** Rtab = tab.'RTABLE' ; * Initialize TOPOMODI for loading and mechanism SI Ltab.'MECANISME' ; FINS ; * If any hat filter matrix exists * We will try to use it Wtab.'FILTRE_CHAPEAU_NORMALISE' = Rtab.'FILTRE_CHAPEAU_NORMALISE' ; * If a modified matrix exists too * We will try to use it Wtab.'FILTRE_CHAPEAU_MODIFIE' = Rtab.'FILTRE_CHAPEAU_MODIFIE' ; FINS ; * Get their corresponding identification data Wtab.'FILTRE_CHAPEAU_ID' = Rtab.'FILTRE_CHAPEAU_ID' ; * Finally, as Wtab.'MAILLAGE_GRAVITE_D' was recreated, the saved * hat filter matrix is not compatible. We need to fuse the * matrix mesh nodes with those of Wtab.'MAILLAGE_GRAVITE_D' tmp1 = Wtab.'MAILLAGE_GRAVITE_D' ; ELIM tmp1 tmp2 tab.'ELIM_CRITERE' ; * This situation should never happen. Nevertheless, if it * does, then we will force the regeneration of the hat filter * matrix by resetting one of its identification data FINS ; FINS ; * Reload the previous MMA table Wtab.'MMA' = Rtab.'MMA' ; FINS ; * Use the last density threshold projection * if it has been saved in Rtab and if constant volume projection Wtab.'PROJECTION_SEUIL' = Rtab.'PROJECTION_SEUIL' ; FINS ; FINS ; ********************************************************************** * Initial design variables and physical densities * ********************************************************************** * If floats are given as initial design variables (X) * or initial physical densities (Y) * transform them into a homogeneous fields on B * ------------------------------------------------------------------ tab.'X'.cyc = uniD * tab.'X'.cyc ; SI LF ; * Combine the field on D with the unitary field on F * This creates a 2-zone field merged into a single zone * field, preserving the original element order using REDU FINS ; FINS ; FINS ; tab.'X_FILTRE'.cyc = uniD * tab.'X_FILTRE'.cyc ; SI LF ; * Combine the field on D with the unitary field on F * This creates a 2-zone field merged into a single zone * field, preserving the original element order using REDU Wtab.'MODELE_B' ; FINS ; FINS ; FINS ; tab.'TOPOLOGIE'.cyc = uniD * tab.'TOPOLOGIE'.cyc ; SI LF ; * Combine the field on D with the unitary field on F * This creates a 2-zone field merged into a single zone * field, preserving the original element order using REDU Wtab.'MODELE_B' ; FINS ; FINS ; FINS ; * If there are initial design variables (X) * and/or initial intermediate densities (S) * and/or initial physical densities (Y) * and/or a restart table (that always contains X, S and Y) * then we will use those data at best to initilize X, S and Y * ----------------------------------------------------------- * Initialization * If some initial values are provided SI (LX OU LS OU LY OU LRtab) ; * Define at least X * ----------------- * By default we will use X, S and Y from user defined input * otherwise from Rtab SI LX ; XB = tab.'X'.cyc ; FINS ; SI LS ; SB = tab.'X_FILTRE'.cyc ; FINS ; SI LY ; YB = tab.'TOPOLOGIE'.cyc ; FINS ; SI LRtab ; RXB = tab.'RTABLE'.'X_B' ; RSB = tab.'RTABLE'.'S_B' ; RYB = tab.'RTABLE'.'Y_B' ; FINS ; * If the only existing X, S and Y are from Rtab SI (LRtab ET (NON LX) ET (NON LS) ET (NON LY)) ; * We will use them together XB = RXB ; LX = VRAI ; SB = RSB ; LS = VRAI ; YB = RYB ; LY = VRAI ; FINS ; * If X is given with Rtab SI (LRtab ET LX ET (NON LS) ET (NON LY)) ; * If it is the same as the one in Rtab SI (EGA XB RXB) ; * Then we can use S and Y from Rtab SB = RSB ; LS = VRAI ; YB = RYB ; LY = VRAI ; FINS ; FINS ; * Verification * !!!!!!!!!!!! * If X does not exist at this step * Remark: It means Rtab didn't exist either, otherwise X would have * been taken from Rtab. SI (NON LX) ; SI LS ; FINS ; SI (LS ET LY) ; FINS ; SI LY ; FINS ; tmp = CHAI tmp ' pour le prochain cycle sans avoir fourni' ' les variables de conceptions correspondantes' ; SI (NON LS) ; FINS ; SI (NON LY) ; FINS ; FINS ; * If Y is missing but not S SI ((LS ET (NON LY)) OU ((NON LS) ET LY)); tmp = CHAI 'Vous avez fourni des valeurs imposees des' ' variables de conceptions et' ; SI LS ; FINS ; SI LY ; FINS ; SI (NON LS) ; FINS ; SI (NON LY) ; FINS ; ' pouvez ne fournir que les variables de' ' conceptions seules.') ; FINS ; * Projection of X, S and Y on D * ----------------------------- * This projection is used for remeshing compatibility but * also in case the active zone was updated or the model etc... * but also because X, S and Y are given on B while we * need them only on D. * Logical for identical S and X LSegaX = FAUX ; SI (LS ET LX) ; * If they are identical LSegaX = EGA SB XB ; FINS ; * Logical for identical Y and S LYegaS = FAUX ; SI (LY ET LS) ; * If they are identical LYegaS = EGA YB SB ; FINS ; * Logical for identical Y and X LYegaX = FAUX ; SI (LY ET LX) ; * If they are identical LYegaX = EGA YB XB ; FINS ; SI LM ; * Project the input topology element field at the centroids of * the elements of the model modMD SI LX ; FINS ; SI (LS ET (NON LSegaX)) ; FINS ; SI (LY ET (NON LYegaS) ET (NON LYegaX)) ; FINS ; SINO ; * Project the input topology element field at the centroids of * the elements of the model modTD SI LX ; * In thermal mode, 'GRAVITE' option is not respected * This issue is resolved using CHAN 'GRAVITE' FINS ; SI (LS ET (NON LSegaX)) ; * In thermal mode, 'GRAVITE' option is not respected * This issue is resolved using CHAN 'GRAVITE' FINS ; SI (LY ET (NON LYegaS) ET (NON LYegaX)) ; * In thermal mode, 'GRAVITE' option is not respected * This issue is resolved using CHAN 'GRAVITE' FINS ; FINS ; SI LSegaX ; SD = XD ; FINS ; SI LYegaS ; YD = SD ; FINS ; SI LYegaX ; YD = XD ; FINS ; * Add requested restrictions on X in case they are not already respected * ---------------------------------------------------------------------- * It must be done on initial X as further calls to TOPORSTR during * optimisation loop will affect only the increments of X, not X itself. * Remark: Y does not respect the restrictions in the case of density * filtering and does not need to (but it usuallly close to respect them). * Save X * ------ Wtab.'X_D' = XD ; * Save S and Y or generate them from X if they do not exist * --------------------------------------------------------- SI (LS ET LY) ; Wtab.'S_D' = SD ; Wtab.'Y_D' = YD ; SINO ; * Generate S and Y from X on D * Remark: this is done using the filtering and projection * parameters of the current cycle while S and Y shoud * have been generated at the end of the previous cycle * with the previous parameters. TOPOPHYS tab ; FINS ; SINO ; SI (NEG cyc 1) ; ERRE 'Veuillez preciser la topologie du nouveau cycle.' ; SINO ; SI Ltab.'CONTRAINTE_VOLUME' ; Wtab.'X_D' = uniD * tab.'FRACTION_VOLUME_LIMITE' ; SINO ; Wtab.'X_D' = uniD * 0.5 ; FINS ; * Get Y from X on D TOPOPHYS tab ; FINS ; FINS ; * Remark : After TOPOPHYS, we may not respect the volume fraction of * Y in the case of volume constraint at first iteration. * It should not be a problem either with OC nor MMA. * We could scale the fields to fit the volume fraction but * it should be done preserving X_MIN_SEUIL<X<1... FINP ;
© Cast3M 2003 - Tous droits réservés.
Mentions légales