def nume_ddl_phy(resu): """Fabrication d'une numerotation des DDL actifs associes a une sd resultat retourne ['N1_DX','N1_DY','N1_DZ','N2_DZ','N3_DZ'...] dans l'ordre alpha-numerique""" from code_aster.Cata.Commands import CREA_CHAMP, DETRUIRE __CHAMP0 = CREA_CHAMP(RESULTAT=resu.obj, OPERATION='EXTR', NUME_ORDRE=1, TYPE_CHAM='NOEU_DEPL_R', NOM_CHAM='DEPL') champy0 = __CHAMP0.EXTR_COMP(topo=1) num_no = champy0.noeud comp = champy0.comp nb_ddl = len(comp) # Recherche des noms des noeuds associes a leur numero maya = resu.maya nume = [] for ind in range(nb_ddl): nom_no = maya.sdj.NOMNOE.get()[num_no[ind] - 1] nume.append(nom_no.strip() + '_' + comp[ind].strip()) DETRUIRE( CONCEPT=_F(NOM=(__CHAMP0, ), ), INFO=1, ) return nume
def compute_mecmode(NOM_CMP, GROUP_NO_INTER, resultat, nbmods, nbmodd): dict_modes = {} dict_modes['NUME_MODE'] = range(nbmods) dict_modes['MCMP'] = [] dict_modes['som'] = [] dict_modes['maxm'] = [] for mods in range(nbmods): nmo = nbmodd + mods + 1 __CHAM = CREA_CHAMP(TYPE_CHAM='NOEU_DEPL_R', OPERATION='EXTR', NUME_ORDRE=nmo, RESULTAT=resultat, NOM_CHAM='DEPL') MCMP = __CHAM.EXTR_COMP(NOM_CMP, [GROUP_NO_INTER]).valeurs #on recupere la composante COMP (dx,dy,dz) des modes MCMP2 = __CHAM.EXTR_COMP(' ', [GROUP_NO_INTER], 0).valeurs if mods == 0: NCMP2 = __CHAM.EXTR_COMP(' ', [GROUP_NO_INTER], topo=1).comp nddi = len(MCMP2) dict_modes['NCMP2'] = NCMP2 dict_modes['nddi'] = nddi PHI = NP.zeros((nddi, nbmods)) PHI[:, mods] = MCMP2 som = NP.sum(MCMP) max1 = NP.max(MCMP) min1 = NP.min(MCMP) maxm = NP.max([abs(max1), abs(min1)]) dict_modes['som'].append(som) dict_modes['maxm'].append(maxm) dict_modes['MCMP'].append(MCMP) DETRUIRE(CONCEPT=_F(NOM=(__CHAM)), INFO=1) dict_modes['PHI'] = PHI return dict_modes
def tr_e2a_glrc_damage(__CH_FOV, ico, cc, nb_comp, var_aster, gr_ma): """ Transformation pour GLRC_DAMAGE """ dic_transfo = {} __F_V_GL = [None] * nb_comp coef = [1.] * nb_comp coef[2] = 0.5 coef[5] = 0.5 li_fonc = [] nom_cmp_f = [] for ivar, var in enumerate(var_aster[:nb_comp]): co = coef[ivar] xi_f = 'X%s' % (ivar + 1) nom_cmp_f.append(xi_f) __F_V_GL[ivar] = FORMULE(VALE=var + '*' + str(co), NOM_PARA=(var)) li_fonc.append(__F_V_GL[ivar]) ccc = cc.copy() ccc.update(TYPE_CHAM='ELGA_NEUT_F', AFFE={ 'GROUP_MA': gr_ma, 'NOM_CMP': nom_cmp_f, 'VALE_F': li_fonc, }) __CH_FOV[ico] = CREA_CHAMP(**ccc) dic_transfo['CH_FONC'] = __CH_FOV[ico] dic_transfo['NOM_CMP_F'] = nom_cmp_f dic_transfo['NOM_CMP'] = var_aster[:nb_comp] return dic_transfo
def asseChamp(self, depl1, depl2): from code_aster.Cata.Commands import CREA_CHAMP _depl = CREA_CHAMP( TYPE_CHAM='NOEU_DEPL_R', OPERATION='ASSE', MODELE=self.model, ASSE=( _F( TOUT='OUI', CHAM_GD=depl1, NOM_CMP=('DY', 'DZ'), CUMUL='NON', ), _F( TOUT='OUI', CHAM_GD=depl2, NOM_CMP=('DY', 'DZ'), CUMUL='OUI', ), _F(TOUT='OUI', CHAM_GD=depl2, NOM_CMP=('DX', ), CUMUL='NON', COEF_R=0.0), ), ) return _depl
def extrChamp(self, resu, inst): from code_aster.Cata.Commands import CREA_CHAMP _depl = CREA_CHAMP(OPERATION='EXTR', TYPE_CHAM='NOEU_DEPL_R', NOM_CHAM='DEPL', INST=inst, RESULTAT=resu) return _depl
def deform_mesh_inverse(self, depl): """Use the displacement of the result to deform the mesh""" from code_aster.Cata.Commands import CREA_CHAMP, MODI_MAILLAGE _depl_inv = CREA_CHAMP(OPERATION='COMB', TYPE_CHAM='NOEU_DEPL_R', COMB=_F(CHAM_GD=depl, COEF_R=-1.)) _debug(_depl_inv, "mesh deformation") _mesh = MODI_MAILLAGE(reuse=self.mesh, MAILLAGE=self.mesh, DEFORME=_F(OPTION='TRAN', DEPL=_depl_inv)) del self.mesh self.mesh = _mesh
def deform_mesh(self, resu): """Use the displacement of the result to deform the mesh""" from code_aster.Cata.Commands import CREA_CHAMP, MODI_MAILLAGE _depl = CREA_CHAMP(OPERATION='EXTR', INST=self.coeur.temps_simu['T1'], TYPE_CHAM='NOEU_DEPL_R', NOM_CHAM='DEPL', RESULTAT=resu) _debug(_depl, "mesh deformation") _mesh = MODI_MAILLAGE(reuse=self.mesh, MAILLAGE=self.mesh, DEFORME=_F(OPTION='TRAN', DEPL=_depl)) del self.mesh self.mesh = _mesh return _depl
def crea_champ(resu, ind_mod): """!Extrait les champs de deplacement d'une sd_resultat aster a partir des DDL de mesure pour un mode donne. Ces DDL sont identiques a ceux de la macro OBSERVATION ayant servi a obtenir le resultat.""" from code_aster.Cata.Commands import CREA_CHAMP from code_aster.Cata.Commands import DETRUIRE __CHANO = CREA_CHAMP( TYPE_CHAM='NOEU_DEPL_R', OPERATION='EXTR', RESULTAT=resu, NOM_CHAM='DEPL', NUME_ORDRE=ind_mod, ) champy = __CHANO.EXTR_COMP(topo=1) vale = champy.valeurs DETRUIRE( CONCEPT=_F(NOM=(__CHANO, ), ), INFO=1, ) return vale
def tr_e2a_vmis_john_cook(__CH_FOV, ico, cc, nb_comp, var_aster, gr_ma): """ Transformation pour VMIS_JOHN_COOK """ dic_transfo = {} __F_V_GL = [None] * nb_comp li_fonc = [] nom_cmp_f = [] # V1 = VAR3 var = 'V3' xi_f = 'X%s' % (1) nom_cmp_f.append(xi_f) __F_V_GL[0] = FORMULE(VALE=var, NOM_PARA=(var)) li_fonc.append(__F_V_GL[0]) # on met les autres à 0 car pas de correspondance for ii in range(2, 6): xi_f = 'X%s' % (ii) nom_cmp_f.append(xi_f) __F_V_GL[ii - 1] = FORMULE(VALE='0.', NOM_PARA=(var)) li_fonc.append(__F_V_GL[ii - 1]) ccc = cc.copy() ccc.update(TYPE_CHAM='ELGA_NEUT_F', AFFE={ 'GROUP_MA': gr_ma, 'NOM_CMP': nom_cmp_f, 'VALE_F': li_fonc, }) __CH_FOV[ico] = CREA_CHAMP(**ccc) dic_transfo['CH_FONC'] = __CH_FOV[ico] dic_transfo['NOM_CMP_F'] = nom_cmp_f dic_transfo['NOM_CMP'] = var_aster[:nb_comp] return dic_transfo
def tr_e2a_vmis_isot_trac(__CH_FOV, ico, cc, nb_comp, var_aster, gr_ma): """ Transformation pour VMIS_ISOT_TRAC """ dic_transfo = {} __F_V_GL = [None] * nb_comp li_fonc = [] nom_cmp_f = [] # V1 = VAR3 var = 'V3' xi_f = 'X%s' % (1) nom_cmp_f.append(xi_f) __F_V_GL[0] = FORMULE(VALE=var, NOM_PARA=(var)) li_fonc.append(__F_V_GL[0]) # V2 on met 0 tout le temps xi_f = 'X%s' % (2) nom_cmp_f.append(xi_f) __F_V_GL[1] = FORMULE(VALE='0.', NOM_PARA=(var)) li_fonc.append(__F_V_GL[1]) ccc = cc.copy() ccc.update(TYPE_CHAM='ELGA_NEUT_F', AFFE={ 'GROUP_MA': gr_ma, 'NOM_CMP': nom_cmp_f, 'VALE_F': li_fonc, }) __CH_FOV[ico] = CREA_CHAMP(**ccc) dic_transfo['CH_FONC'] = __CH_FOV[ico] dic_transfo['NOM_CMP_F'] = nom_cmp_f dic_transfo['NOM_CMP'] = var_aster[:nb_comp] return dic_transfo
def prep_cont2effo(self, ): """ Construction des champs pour le passage des contraintes aux efforts Complète dic_mc_cara avec ces infos. """ from code_aster.Cata.Commands import FORMULE, CREA_CHAMP from Calc_epx.calc_epx_utils import recupere_structure, tolist from Calc_epx.calc_epx_utils import get_group_ma from Calc_epx.calc_epx_cara import export_cara from Calc_epx.calc_epx_struc import DIRECTIVE # 1- RECUPERATION DES INFOS dic_mc_cara = self.dic_mc_cara if self.CARA_ELEM is None: return cara_elem_struc = recupere_structure(self.CARA_ELEM) for mc_cara in dic_mc_cara.keys(): if not cara_elem_struc.has_key(mc_cara): continue donnees_cara = tolist(cara_elem_struc[mc_cara]) epx = {} epx['COMPLEMENT'] = DIRECTIVE('COMPLEMENT', ' ', 2) mode_from_cara = {} dic_gr_cara_supp = {} # analyse du cara_elem [epx, mode_from_cara ] = export_cara(mc_cara, epx, cara_elem_struc[mc_cara], None, None, dic_gr_cara_supp, mode_from_cara) # COQUE ------------------------------------------------------- if mc_cara == 'COQUE': if len(dic_mc_cara[mc_cara]['INSTANCE']) == 0: nbcomp = len(dic_mc_cara[mc_cara]['NOM_CMP']) __FO_CO = [None] * nbcomp nume_X = [1, 1, 1, 2, 2, 2, 1, 1] vale_f = [] nom_cmp_f = [] for i, comp in enumerate(dic_mc_cara[mc_cara]['NOM_CMP']): xnum_i = 'X%s' % (nume_X[i]) xi = 'X%s' % (i + 1) val_fonc = comp + '*' + xnum_i nom_para = (comp, xnum_i) __FO_CO[i] = FORMULE(VALE=val_fonc, NOM_PARA=nom_para) vale_f.append(__FO_CO[i]) nom_cmp_f.append(xi) dic_mc_cara[mc_cara]['VALE_F'] = vale_f dic_mc_cara[mc_cara]['NOM_CMP_F'] = nom_cmp_f for instance in donnees_cara: epais = instance['EPAIS'] gr = get_group_ma(instance) dic_mc_cara[mc_cara]['GROUP_MA'].extend(gr) dic_mc_cara[mc_cara]['INSTANCE'].append({ 'VALE': epais, 'GROUP_MA': gr, 'NOM_CMP': 'X1' }) dic_mc_cara[mc_cara]['INSTANCE'].append({ 'VALE': epais**2 / 6., 'GROUP_MA': gr, 'NOM_CMP': 'X2' }) # BARRE ------------------------------------------------------- elif mc_cara == 'BARRE': if len(dic_mc_cara[mc_cara]['INSTANCE']) == 0: nbcomp = len(dic_mc_cara[mc_cara]['NOM_CMP']) __FO_BA = [None] * nbcomp nume_X = [ 1, ] vale_f = [] nom_cmp_f = [] for i, comp in enumerate(dic_mc_cara[mc_cara]['NOM_CMP']): xnum_i = 'X%s' % (nume_X[i]) xi = 'X%s' % (i + 1) val_fonc = comp + '*' + xnum_i nom_para = (comp, xnum_i) __FO_BA[i] = FORMULE(VALE=val_fonc, NOM_PARA=nom_para) vale_f.append(__FO_BA[i]) nom_cmp_f.append(xi) # creation du champ de fonction dic_mc_cara[mc_cara]['VALE_F'] = vale_f dic_mc_cara[mc_cara]['NOM_CMP_F'] = nom_cmp_f for instance in donnees_cara: cara = instance['CARA'] cara = tolist(cara) if len(cara) != 1 or cara[0] != 'A': raise Exception("""si on tombe la on utilise LIRE_EPX en dehors de CALC_EPX. Il faut ajouter une analyse du CARA_ELEM. """) aire_sect = tolist(instance['VALE'])[0] gr = get_group_ma(instance) dic_mc_cara[mc_cara]['GROUP_MA'].extend(gr) dic_mc_cara[mc_cara]['INSTANCE'].append({ 'VALE': aire_sect, 'GROUP_MA': gr, 'NOM_CMP': 'X1' }) # CAS NON DEVELOPPES ------------------------------------------ elif mc_cara in dic_mc_cara.keys(): raise Exception(""" Le passage des contraintes aux efforts n'est pas programmé pour le mot-clé %s""" % mc_cara) # 2- CREATION DES CHAMPS DE CARACTERISTIQUES ET DE FONCTIONS # POUR CONTRAINTES nb_cara = len(dic_mc_cara.keys()) __CH_CAR = [None] * nb_cara __CH_FON = [None] * nb_cara for icar, mc_cara in enumerate(dic_mc_cara.keys()): if len(dic_mc_cara[mc_cara]['INSTANCE']) > 0: __CH_CAR[icar] = CREA_CHAMP( INFO=self.INFO, TYPE_CHAM='ELGA_NEUT_R', OPERATION='AFFE', MODELE=self.MODELE, PROL_ZERO='OUI', AFFE=dic_mc_cara[mc_cara]['INSTANCE'], ) dic_mc_cara[mc_cara]['CH_CARA'] = __CH_CAR[icar] nom_cmp_f = dic_mc_cara[mc_cara]['NOM_CMP_F'] vale_f = dic_mc_cara[mc_cara]['VALE_F'] gr = dic_mc_cara[mc_cara]['GROUP_MA'] __CH_FON[icar] = CREA_CHAMP( INFO=self.INFO, TYPE_CHAM='ELGA_NEUT_F', OPERATION='AFFE', MODELE=self.MODELE, PROL_ZERO='OUI', AFFE=_F(GROUP_MA=gr, NOM_CMP=nom_cmp_f, VALE_F=vale_f), ) dic_mc_cara[mc_cara]['CH_FONC'] = __CH_FON[icar]
def char_grad_impo_ops(self, RESU_H2, TINIT, TFIN, RESUMECA, GRMAVOL, DIME, Ctot0, CHARGRD0, Vh, R, T, INFO, **args): # macro pour calculer le chargement thermique specfique a la diffusion H2 import numpy as NP import aster from code_aster.Cata.Syntax import _F ier = 0 # La macro compte pour 1 dans la numerotation des commandes self.set_icmd(1) # Le concept sortant dans le contexte de la macro self.DeclareOut('chth', self.sd) # On importe les definitions des commandes a utiliser dans la macro CREA_CHAMP = self.get_cmd('CREA_CHAMP') AFFE_CHAR_THER = self.get_cmd('AFFE_CHAR_THER') CALC_CHAMP = self.get_cmd('CALC_CHAMP') CALC_CHAM_ELEM = self.get_cmd('CALC_CHAM_ELEM') dt = TFIN - TINIT # Recuperation du modele a partir du resultat iret, ibid, __n_modele = aster.dismoi('MODELE', RESU_H2.nom, 'RESULTAT', 'F') __n_modele = __n_modele.rstrip() __MOTH = self.get_concept(__n_modele) # Recuperation du maillage a partir du resultat iret, ibid, nom_ma = aster.dismoi('NOM_MAILLA', RESU_H2.nom, 'RESULTAT', 'F') __MAIL = self.get_concept(nom_ma.strip()) # Recuperation du modele mecanique a partir du resultat iret, ibid, nom_momec = aster.dismoi('MODELE', RESUMECA.nom, 'RESULTAT', 'F') __MOME = self.get_concept(nom_momec.rstrip()) # extraction du champ de cl instant - __C20 = CREA_CHAMP(OPERATION='EXTR', TYPE_CHAM='NOEU_TEMP_R', RESULTAT=RESU_H2, NOM_CHAM='TEMP', INST=TINIT, INFO=INFO) # on suppose que les noeuds du maillage thermique et mecaniqeu sont les # memes (pour eviter un PROJ_CHAMP) lc_t0 = __C20.EXTR_COMP('TEMP', [], 1) c_t0 = lc_t0.valeurs node_th = lc_t0.noeud nbnode = len(node_th) # contruction du terme Grad SigmaH # trace de sigma aux noeuds __SIEQN2 = CALC_CHAMP(INST=TFIN, RESULTAT=RESUMECA, CRITERES='SIEQ_NOEU', INFO=INFO) __SIEQN = PROJ_CHAMP(METHODE='COLLOCATION', RESULTAT=__SIEQN2, MODELE_1=__MOME, MODELE_2=__MOTH, NOM_CHAM='SIEQ_NOEU', TOUT_ORDRE='OUI') __SIEQ = CREA_CHAMP(OPERATION='EXTR', TYPE_CHAM='NOEU_SIEF_R', RESULTAT=__SIEQN, NOM_CHAM='SIEQ_NOEU', INST=TFIN, INFO=INFO) # on renome la CMP pour pouvoir calculer le flux "thermique" __TRSIG = CREA_CHAMP(OPERATION='ASSE', TYPE_CHAM='NOEU_TEMP_R', MODELE=__MOTH, ASSE=(_F(CHAM_GD=__SIEQ, GROUP_MA=GRMAVOL, NOM_CMP='TRSIG', NOM_CMP_RESU='TEMP', COEF_R=1. / 3.), ), INFO=INFO) # calcul du gradient de Trace(Sigma) __MAT1 = DEFI_MATERIAU(THER=_F(LAMBDA=-1., RHO_CP=0.)) __CMT1 = AFFE_MATERIAU( MAILLAGE=__MAIL, AFFE=_F( TOUT='OUI', MATER=__MAT1, ), ) __GRSH = CALC_CHAM_ELEM(MODELE=__MOTH, CHAM_MATER=__CMT1, GROUP_MA=GRMAVOL, OPTION='FLUX_ELGA', TEMP=__TRSIG) gradsighe = __GRSH.EXTR_COMP('FLUX', [], 1) gradsighx = gradsighe.valeurs gradsighy = __GRSH.EXTR_COMP('FLUY', [], 0).valeurs if (DIME == 3): gradsighz = __GRSH.EXTR_COMP('FLUZ', [], 0).valeurs fx = NP.zeros(nbnode) fy = NP.zeros(nbnode) if (DIME == 3): fz = NP.zeros(nbnode) for ino, node in enumerate(node_th): cl = c_t0[ino] grsigx = gradsighx[ino] grsigy = gradsighy[ino] if (DIME == 3): grsigz = gradsighz[ino] fx[ino], fx[ino], fz[ino] = FLUX(cl, grsigx, grsigy, DIME, grsigz, Vh, R, T) else: grsigz = 0. fx[ino], fx[ino] = FLUX(cl, grsigx, grsigy, DIME, grsigz, Vh, R, T) # pour gagner du temps on evite la construction du mot-cle PRE_GRAD_TEMP nomvale = CHARGRD0.nom.ljust(8) + '.CHTH.GRAIN.VALE' nomlima = CHARGRD0.nom.ljust(8) + '.CHTH.GRAIN.LIMA' nomdesc = CHARGRD0.nom.ljust(8) + '.CHTH.GRAIN.DESC' tabvale = aster.getvectjev(nomvale) tabdesc = aster.getvectjev(nomdesc) dicolima = aster.getcolljev(nomlima) nbrvale = len(tabvale) champ = NP.zeros(nbrvale) bidon = NP.zeros(nbrvale) nommai = __MAIL.sdj.NOMMAI.get() connex = __MAIL.sdj.CONNEX.get() groupma = __MAIL.sdj.GROUPEMA.get()[GRMAVOL.ljust(24)] nbzone = tabdesc[1] # print "tabdesc",tabdesc # print "tablima",dicolima for izone in dicolima.keys(): # chaque maille du groupe est affectee for index, ima in enumerate(dicolima[izone]): if ima == 0: break if ima in groupma: # ATTENTION : dans Python, les tableaux commencent a 0 # mais dans la connectivite, les noeuds commencent a 1! lnoeu = NP.array(connex[ima]) - 1 nbno = len(lnoeu) # calcul de la moyenne par maille de fx lflux = fx[lnoeu] flux = NP.add.reduce(lflux) flux = flux / nbno lfluy = fy[lnoeu] fluy = NP.add.reduce(lfluy) fluy = fluy / nbno numa = index # print 'essai, numa, ima',numa, ima, groupma, lnoeu, nbno champ[9 * (numa - 1) + 1] = -flux champ[9 * (numa - 1) + 2] = -fluy aster.putvectjev(nomvale, nbrvale, tuple(range(1, nbrvale + 1)), tuple(champ), tuple(bidon), 1)
def champ_detoile_ops(self, RESU_H2, TINIT, TFIN, RESUMECA, GRMAVOL, DIME, Ctot0, Nl, Kt, a1, a2, a3, INFO, **args): # macro pour calculer le chargement thermique specfique a la diffusion H2 import numpy as NP import aster from code_aster.Cata.Syntax import _F ier = 0 # La macro compte pour 1 dans la numerotation des commandes self.set_icmd(1) # Le concept sortant dans le contexte de la macro self.DeclareOut('NEUTG', self.sd) # On importe les definitions des commandes a utiliser dans la macro DETRUIRE = self.get_cmd('DETRUIRE') CREA_CHAMP = self.get_cmd('CREA_CHAMP') CALC_CHAMP = self.get_cmd('CALC_CHAMP') # Recuperation du modele a partir du resultat iret, ibid, __n_modele = aster.dismoi('MODELE', RESU_H2.nom, 'RESULTAT', 'F') __n_modele = __n_modele.rstrip() __MOTH = self.get_concept(__n_modele) # Recuperation du maillage a partir du resultat iret, ibid, nom_ma = aster.dismoi('NOM_MAILLA', RESU_H2.nom, 'RESULTAT', 'F') __MAIL = self.get_concept(nom_ma.strip()) # Recuperation du modele mecanique a partir du resultat iret, ibid, nom_momec = aster.dismoi('MODELE', RESUMECA.nom, 'RESULTAT', 'F') __MOME = self.get_concept(nom_momec.rstrip()) # extraction du champ de Cl instant - __C20 = CREA_CHAMP(OPERATION='EXTR', TYPE_CHAM='NOEU_TEMP_R', RESULTAT=RESU_H2, NOM_CHAM='TEMP', INST=TINIT, INFO=INFO) __EPEQN2 = CALC_CHAMP(INST=(TINIT, TFIN), RESULTAT=RESUMECA, VARI_INTERNE='VARI_NOEU') __EPEQN = PROJ_CHAMP(METHODE='COLLOCATION', RESULTAT=__EPEQN2, MODELE_1=__MOME, MODELE_2=__MOTH, NOM_CHAM='VARI_NOEU', TOUT_ORDRE='OUI') __VINT1 = CREA_CHAMP(OPERATION='EXTR', TYPE_CHAM='NOEU_VAR2_R', RESULTAT=__EPEQN, NOM_CHAM='VARI_NOEU', INST=TFIN, INFO=INFO) # recopie du champ C20 pour initialiser le futur champ source __chtmp = CREA_CHAMP(OPERATION='AFFE', TYPE_CHAM='NOEU_NEUT_R', MAILLAGE=__MAIL, AFFE=(_F( VALE=0., GROUP_MA=GRMAVOL, NOM_CMP='X1', ), )) nomcham = __chtmp.sdj.nomj() # on suppose que les noeuds du maillage thermique et mecaniqeu sont les # memes (pour eviter un PROJ_CHAMP) lc_t0 = __C20.EXTR_COMP('TEMP', [], 1) c_t0 = lc_t0.valeurs node_th = lc_t0.noeud lp_t1 = __VINT1.EXTR_COMP('V1', [], 1) p_t1 = lp_t1.valeurs node_me = lp_t1.noeud nbnode = len(node_th) assert (nbnode == len(node_me)) detoile = NP.zeros(nbnode) bidon = NP.zeros(nbnode) for ino, node in enumerate(node_th): Cl = c_t0[ino] p1 = p_t1[ino] detoile[ino] = DETOILE(Cl, p1, Ctot0, Nl, Kt, a1, a2, a3) nomvect = '%-19s.VALE' % __chtmp.nom aster.putvectjev(nomvect, nbnode, tuple(range(1, nbnode + 1)), tuple(detoile), tuple(bidon), 1) NEUTG = CREA_CHAMP(OPERATION='DISC', TYPE_CHAM='ELNO_NEUT_R', MODELE=__MOTH, PROL_ZERO='OUI', CHAM_GD=__chtmp, INFO=INFO)
def make_mac_salome(mac, resu1, resu2, unite): from code_aster.Cata.Commands import (LIRE_MAILLAGE, AFFE_MODELE, CREA_CHAMP, DETRUIRE, INFO_EXEC_ASTER, IMPR_RESU, DEFI_FICHIER, CREA_RESU) import random # dimension du MAC nb_l = mac.shape[0] - 1 nb_c = mac.shape[1] - 1 # fabrication d'un maillage au format aster unite_mesh = make_mesh_mac(nb_l, nb_c) __MA = LIRE_MAILLAGE(UNITE=unite_mesh, FORMAT='ASTER') __MO = AFFE_MODELE( MAILLAGE=__MA, AFFE=(_F(TOUT='OUI', MODELISATION='PLAN_ELDI', PHENOMENE='MECANIQUE'), ), ) # affection avec CREA_CHAMP # mcfact = [] # ii=0 # for ind_l in range(1,nb_l+1): # for ind_c in range(1,nb_c+1): # mcfact.append({'MAILLE':'M%s_%s' %(ind_l,ind_c),'NOM_CMP':'X1','VALE':toto[ii]}) # ii+=1 mcfact = [] # aller chercher les nume_ordre et les freq nume_ordre_1 = resu1.get_modes_data()['NUME_ORDRE'] nume_ordre_2 = resu2.get_modes_data()['NUME_ORDRE'] nb_mod1 = len(nume_ordre_1) nb_mod2 = len(nume_ordre_2) freq1 = resu1.get_modes_data()['FREQ'] if not freq1: freq1 = [0.0 for kk in range(nb_mod1)] freq2 = resu2.get_modes_data()['FREQ'] if not freq2: freq2 = [0.0 for kk in range(nb_mod2)] for ind_l in range(1, nb_l + 1): for ind_c in range(1, nb_c + 1): mcfact.append({ 'MAILLE': 'M%s_%s' % (ind_l, ind_c), 'NOM_CMP': 'ERREST', 'VALE': mac[ind_l, ind_c] }) mcfact.append({ 'MAILLE': 'M%s_%s' % (ind_l, ind_c), 'NOM_CMP': 'NUEST', 'VALE': nume_ordre_1[ind_l] }) mcfact.append({ 'MAILLE': 'M%s_%s' % (ind_l, ind_c), 'NOM_CMP': 'SIGCAL', 'VALE': freq1[ind_l] }) mcfact.append({ 'MAILLE': 'M%s_%s' % (ind_l, ind_c), 'NOM_CMP': 'TERMRE', 'VALE': nume_ordre_2[ind_c] }) mcfact.append({ 'MAILLE': 'M%s_%s' % (ind_l, ind_c), 'NOM_CMP': 'TERMR2 ', 'VALE': freq2[ind_c] }) # __CHA = CREA_CHAMP( OPERATION= 'AFFE', # TYPE_CHAM='CART_NEUT_R' , MAILLAGE = MAIL, # AFFE=mcfact) __CHA = CREA_CHAMP(OPERATION='AFFE', MODELE=__MO, PROL_ZERO='OUI', TYPE_CHAM='ELEM_ERRE_R', AFFE=mcfact) IMPR_RESU(UNITE=unite, FORMAT='MED', RESU=_F(CHAM_GD=__CHA)) DETRUIRE(CONCEPT=_F(NOM=( __MA, __MO, __CHA, ))) DEFI_FICHIER(ACTION='LIBERER', UNITE=unite_mesh) return
def tr_a2e_vmis_john_cook(__VARICO, ico, gr_ma, mod, __VARI, nume_ordre, resu): """ Transformation pour VMIS_JOHN_COOK ASTER vers EPX """ CALC_CHAMP(reuse=resu, RESULTAT=resu, CRITERES='SIEQ_ELGA', NUME_ORDRE=nume_ordre) CALC_CHAMP(reuse=resu, CHAM_UTIL=_F(NOM_CHAM='SIEF_ELGA', CRITERE='TRACE', NUME_CHAM_RESU=1), NUME_ORDRE=nume_ordre, RESULTAT=resu) __TRACE = CREA_CHAMP( OPERATION='EXTR', TYPE_CHAM='ELGA_NEUT_R', RESULTAT=resu, NOM_CHAM='UT01_ELGA', PROL_ZERO='OUI', NUME_ORDRE=nume_ordre, ) __VMIS = CREA_CHAMP( OPERATION='EXTR', TYPE_CHAM='ELGA_SIEF_R', RESULTAT=resu, NOM_CHAM='SIEQ_ELGA', NUME_ORDRE=nume_ordre, ) #cel =numpy.sqrt(E_b*(1-Nu_b)/(rho_b*(1+Nu_b)*(1-2*Nu_b))) __AFFE = CREA_CHAMP( OPERATION='AFFE', TYPE_CHAM='ELGA_NEUT_R', MODELE=mod, PROL_ZERO='OUI', AFFE=( _F( GROUP_MA=gr_ma, NOM_CMP=('X1', 'X2', 'X3', 'X4', 'X5'), #VALE=(1.0E-6, cel, 0.,0.,0.)), VALE=(1.0E-6, 0., 0., 0., 0.)), )) __VARICO[ico] = CREA_CHAMP( OPERATION='ASSE', MODELE=mod, TYPE_CHAM='ELGA_VARI_R', PROL_ZERO='OUI', ASSE=( _F( CHAM_GD=__TRACE, GROUP_MA=gr_ma, NOM_CMP='X1', NOM_CMP_RESU='V1', COEF_R=1.0 / 3, ), _F( CHAM_GD=__VMIS, GROUP_MA=gr_ma, NOM_CMP='VMIS', NOM_CMP_RESU='V2', ), _F( CHAM_GD=__VARI, GROUP_MA=gr_ma, NOM_CMP='V1', NOM_CMP_RESU='V3', ), _F( CHAM_GD=__VMIS, GROUP_MA=gr_ma, NOM_CMP='VMIS', NOM_CMP_RESU='V4', ), _F( CHAM_GD=__AFFE, GROUP_MA=gr_ma, NOM_CMP=('X1', 'X2', 'X3', 'X4', 'X5'), NOM_CMP_RESU=('V4', 'V5', 'V6', 'V7', 'V8'), CUMUL='OUI', ), ), )
def force_iss_vari(self, imod, MATR_GENE, NOM_CMP, ISSF, INFO, UNITE_RESU_FORC, UNITE_RESU_IMPE, PRECISION, INTERF, MATR_COHE, TYPE, fini, PAS, fmax): """Force sismique variable en ISS""" import os import numpy as NP from numpy import linalg from math import pi, ceil, sqrt, floor, log, tanh import aster_core import aster from code_aster.Cata.Syntax import _F from Utilitai.Table import Table from Utilitai.Utmess import UTMESS from Utilitai.signal_correlation_utils import (CALC_COHE, get_group_nom_coord, calc_dist2) from code_aster.Cata.Syntax import _F from code_aster.Cata.Commands import (DETRUIRE, LIRE_IMPE_MISS, LIRE_FORC_MISS, CREA_CHAMP, COMB_MATR_ASSE, DYNA_VIBRA) #-------------------------------------------------------------------------------- NB_FREQ = 1 + int((fmax - fini) / PAS) FREQ_INIT = fini from SD.sd_maillage import sd_maillage from SD.sd_nume_ddl_gd import sd_nume_ddl_gd from SD.sd_nume_ddl_gene import sd_nume_ddl_gene from SD.sd_mode_meca import sd_mode_meca from SD.sd_resultat import sd_resultat from SD.sd_cham_gene import sd_cham_gene GROUP_NO_INTER = INTERF['GROUP_NO_INTERF'] # MAILLAGE NUME_DDL nom_bamo = MATR_GENE['BASE'] resultat = MATR_GENE['BASE'] nom_bam2 = nom_bamo.nom #iret,ibid,nume_ddl = aster.dismoi('NUME_DDL',nom_bamo.nom,'RESU_DYNA','F') iret, ibid, nume_ddl = aster.dismoi('NUME_DDL', nom_bam2, 'RESU_DYNA', 'F') iret, ibid, nom_mail = aster.dismoi('NOM_MAILLA', nume_ddl, 'NUME_DDL', 'F') # MODELE, DDLGENE nume_ddlgene = MATR_GENE['NUME_DDL_GENE'] # iret,ibid,nom_modele = aster.dismoi('NOM_MODELE',nume_ddl,'NUME_DDL','F') # nbnot, nbl, nbma, nbsm, nbsmx, dime = maillage.DIME.get() # coordonnees des noeuds # l_coordo = maillage.COORDO.VALE.get() # t_coordo = NP.array(l_coordo) # t_coordo.shape = nbnot, 3 l_nom, noe_interf = get_group_nom_coord(GROUP_NO_INTER, nom_mail) # del nume_ddl, nom_mail, nom_modele # MODES iret, nbmodd, kbid = aster.dismoi('NB_MODES_DYN', nom_bam2, 'RESULTAT', 'F') iret, nbmods, kbid = aster.dismoi('NB_MODES_STA', nom_bam2, 'RESULTAT', 'F') iret, nbmodt, kbid = aster.dismoi('NB_MODES_TOT', nom_bam2, 'RESULTAT', 'F') FSIST = NP.zeros((NB_FREQ, nbmodt)) + 0j nbno, nbval = noe_interf.shape if INFO == 2: texte = 'NOMBRE DE MODES: ' + str( nbmodt) + ' MODES DYNAMIQUES: ' + str( nbmodd) + ' MODES STATIQUES: ' + str(nbmods) aster.affiche('MESSAGE', texte) aster.affiche('MESSAGE', 'COMPOSANTE ' + NOM_CMP) aster.affiche('MESSAGE', 'NBNO INTERFACE : ' + str(nbno)) # ----- boucle sur les modes statiques for mods in range(0, nbmods): nmo = nbmodd + mods + 1 __CHAM = CREA_CHAMP(TYPE_CHAM='NOEU_DEPL_R', OPERATION='EXTR', NUME_ORDRE=nmo, RESULTAT=resultat, NOM_CHAM='DEPL') MCMP2 = __CHAM.EXTR_COMP(' ', [GROUP_NO_INTER], 0).valeurs if mods == 0: NCMP2 = __CHAM.EXTR_COMP(' ', [GROUP_NO_INTER], topo=1).comp nddi = len(MCMP2) PHI = NP.zeros((nddi, nbmods)) PHI[:, mods] = MCMP2 PHIT = NP.transpose(PHI) PPHI = NP.dot(PHIT, PHI) # MODEL fonction de cohérence MODEL = MATR_COHE['TYPE'] print 'MODEL :', MODEL Data_Cohe = {} Data_Cohe['TYPE'] = MODEL Data_Cohe['MAILLAGE'] = nom_mail Data_Cohe['GROUP_NO_INTERF'] = GROUP_NO_INTER Data_Cohe['NOEUDS_INTERF'] = noe_interf Data_Cohe['DIST'] = calc_dist2(noe_interf) if MODEL == 'MITA_LUCO': Data_Cohe['VITE_ONDE'] = MATR_COHE['VITE_ONDE'] Data_Cohe['PARA_ALPHA'] = MATR_COHE['PARA_ALPHA'] #--------------------------------------------------------------------- # BOUCLE SUR LES FREQUENCES for k in range(NB_FREQ): freqk = FREQ_INIT + PAS * k if INFO == 2: aster.affiche('MESSAGE', 'FREQUENCE DE CALCUL: ' + str(freqk)) COHE = CALC_COHE(freqk * 2. * pi, **Data_Cohe) #--------------------------------------------------------- # On desactive temporairement les FPE qui pourraient etre generees (a tord!) par blas aster_core.matfpe(-1) eig, vec = linalg.eig(COHE) vec = NP.transpose(vec) # les vecteurs sont en colonne dans numpy aster_core.matfpe(1) eig = eig.real vec = vec.real # on rearrange selon un ordre decroissant eig = NP.where(eig < 1.E-10, 0.0, eig) order = (NP.argsort(eig)[::-1]) eig = NP.take(eig, order) vec = NP.take(vec, order, 0) #----------------------- # Nombre de modes POD a retenir etot = NP.sum(eig**2) ener = 0.0 nbme = 0 while nbme < nbno: ener = eig[nbme]**2 + ener prec = ener / etot nbme = nbme + 1 if INFO == 2: aster.affiche( 'MESSAGE', 'VALEUR PROPRE ' + str(nbme) + ' : ' + str(eig[nbme - 1])) if prec > PRECISION: break if INFO == 2: aster.affiche('MESSAGE', 'NOMBRE DE MODES POD RETENUS : ' + str(nbme)) aster.affiche('MESSAGE', 'PRECISION (ENERGIE RETENUE) : ' + str(prec)) PVEC = NP.zeros((nbme, nbno)) for k1 in range(0, nbme): PVEC[k1, 0:nbno] = NP.sqrt(eig[k1]) * vec[k1] #----Impedances + force sismique.----------------------------------------------------------------- if k > 0: DETRUIRE(CONCEPT=_F(NOM=(__impe, __fosi)), INFO=1) __impe = LIRE_IMPE_MISS( BASE=resultat, TYPE=TYPE, NUME_DDL_GENE=nume_ddlgene, UNITE_RESU_IMPE=UNITE_RESU_IMPE, ISSF=ISSF, FREQ_EXTR=freqk, ) # on cree __fosi pour RECU_VECT_GENE_C plus loin __fosi = LIRE_FORC_MISS( BASE=resultat, NUME_DDL_GENE=nume_ddlgene, NOM_CMP=NOM_CMP, NOM_CHAM='DEPL', UNITE_RESU_FORC=UNITE_RESU_FORC, ISSF=ISSF, FREQ_EXTR=freqk, ) # -------------- impedance-------------------------------- MIMPE = __impe.EXTR_MATR_GENE() # extraction de la partie modes interface KRS = MIMPE[nbmodd:nbmodt, nbmodd:nbmodt] # -------------- force sismique------------------------------- FSISM = __fosi.EXTR_VECT_GENE_C() FS0 = FSISM[ nbmodd:nbmodt][:] # extraction de la partie modes interface U0 = NP.dot(linalg.inv(KRS), FS0) # projection pour obtenir UO en base physique XI = NP.dot(PHI, U0) XPI = XI # # facteur de correction pour tous les modes (on somme) >> c'est faux SI0 = 0.0 for k1 in range(0, nbme): XOe = abs(NP.sum(PVEC[k1])) / nbno SI0 = SI0 + XOe**2 SI = sqrt(SI0) for idd in range(0, nddi): #nddi: nombre de ddl interface if NCMP2[idd][0:2] == NOM_CMP: XPI[idd] = SI * XI[idd] # retour en base modale QPI = NP.dot(PHIT, XPI) U0 = NP.dot(linalg.inv(PPHI), QPI) FS = NP.dot(KRS, U0) FSISM[nbmodd:nbmodt][:] = FS FSIST[k, nbmods:nbmodt] = FSISM[0:nbmodd][:] FSIST[k, 0:nbmods] = FS return FSIST
def var_int_a2e(compor_gr, resu, mod, nume_ordre): """ Transforme le champ VARI_ELGA pour correspondre aux attentes d'EPX Renvoie un résultat contenant les champs DEPL, SIEF_ELGA et VARI_ELGA transformé du NUME_ORDRE nume_ordre du résultat resu. """ from code_aster.Cata.Commands import CREA_RESU # extraction des champs : __DEPL = CREA_CHAMP( OPERATION='EXTR', TYPE_CHAM='NOEU_DEPL_R', RESULTAT=resu, NOM_CHAM='DEPL', INST=nume_ordre, ) __SIEF = CREA_CHAMP( OPERATION='EXTR', TYPE_CHAM='ELGA_SIEF_R', RESULTAT=resu, NOM_CHAM='SIEF_ELGA', INST=nume_ordre, ) __VARI = CREA_CHAMP( OPERATION='EXTR', TYPE_CHAM='ELGA_VARI_R', RESULTAT=resu, NOM_CHAM='VARI_ELGA', INST=nume_ordre, ) # transformation nb_compor = len(compor_gr) __VARICO = [None] * nb_compor asse = [] for ico, compor in enumerate(compor_gr.keys()): gr_ma = compor_gr[compor] nb_var_epx = cata_compor[compor]['NB_VAR_EPX'] nom_cmp = ['V%i' % ii for ii in range(1, nb_var_epx + 1)] if compor == 'VMIS_JOHN_COOK': tr_a2e_vmis_john_cook(__VARICO, ico, gr_ma, mod, __VARI, nume_ordre, resu) else: vale = [0.] * nb_var_epx __VARICO[ico] = CREA_CHAMP(OPERATION='AFFE', TYPE_CHAM='ELGA_VARI_R', MODELE=MODELE, PROL_ZERO='NON', AFFE=(_F(GROUP_MA='CUBE', NOM_CMP=nom_cmp, VALE=vale), )) UTMESS('A', 'PLEXUS_47', valk=compor) asse.append({ 'GROUP_MA': gr_ma, 'CHAM_GD': __VARICO[ico], 'NOM_CMP': nom_cmp, 'CUMUL': 'NON', 'COEF_R': 1. }) if len(asse) == 0: UTMESS('A', 'PLEXUS_48') __VARITR = CREA_CHAMP( OPERATION='ASSE', MODELE=mod, TYPE_CHAM='ELGA_VARI_R', PROL_ZERO='OUI', ASSE=asse, ) # construction du concept resultat MasquerAlarme('COMPOR2_23') __res = CREA_RESU(OPERATION='AFFE', TYPE_RESU='EVOL_NOLI', NOM_CHAM='DEPL', AFFE=(_F( CHAM_GD=__DEPL, MODELE=mod, INST=1.0, ), )) __res = CREA_RESU( reuse=__res, OPERATION='AFFE', TYPE_RESU='EVOL_NOLI', NOM_CHAM='SIEF_ELGA', AFFE=_F( CHAM_GD=__SIEF, MODELE=mod, INST=1.0, ), ) __res = CREA_RESU( reuse=__res, OPERATION='AFFE', TYPE_RESU='EVOL_NOLI', NOM_CHAM='VARI_ELGA', AFFE=_F( CHAM_GD=__VARITR, MODELE=mod, INST=1.0, ), ) RetablirAlarme('COMPOR2_23') return __res
def compute_nodal_reaction_from_field_on_group(field, model, mat, group, charg, char_cine=None): """ Compute nodal reaction from a displacement field on a specific group. Input: -field: aster displacement field -model: aster model, -mat: assigned material on a mesh -char_cine: dirichlet boundary conditions -group: group where the nodal reaction has to be computed Output: -asterField instance """ ### Create result concept from the displacement field #resu = create_resu(field,model,mat,char_cine) if char_cine: resu = CREA_RESU(OPERATION='AFFE', TYPE_RESU='EVOL_ELAS', NOM_CHAM='DEPL', EXCIT=_F(CHARGE=charg), AFFE=_F( CHAM_GD=field, MODELE=model, CHAM_MATER=mat, INST=0., )) else: resu = CREA_RESU(OPERATION='AFFE', TYPE_RESU='EVOL_ELAS', NOM_CHAM='DEPL', AFFE=_F( CHAM_GD=field, MODELE=model, CHAM_MATER=mat, INST=0., )) resu = CALC_CHAMP( FORCE='REAC_NODA', reuse=resu, MODELE=model, CHAM_MATER=mat, EXCIT=_F(CHARGE=charg), TOUT='OUI', RESULTAT=resu, ) AsterIter = AsterCount.__next__() o[AsterIter] = CREA_CHAMP( OPERATION='EXTR', NOM_CHAM='REAC_NODA', TYPE_CHAM='NOEU_DEPL_R', RESULTAT=resu, INST=0., ) nodalrea = CREA_CHAMP( OPERATION='ASSE', TYPE_CHAM='NOEU_DEPL_R', MODELE=model, ASSE=_F(CHAM_GD=o[AsterIter], GROUP_MA=group), ) DETRUIRE(CONCEPT=(_F(NOM=nodalrea), _F(NOM=resu))) return o[AsterIter]
def asse_champs_gauss(self, dic_champ_cont, dic_champ_var_int, dic_transfo, resu): """ Transformation et assemblage des champs aux points de Gauss. """ from code_aster.Cata.Commands import LIRE_CHAMP, CREA_CHAMP, DETRUIRE from code_aster.Cata.Commands import CREA_RESU, MODI_REPERE info_mode_epx = self.info_mode_epx info_comp_epx = self.info_comp_epx dic_mc_cara = self.dic_mc_cara ll = len(dic_champ_cont.keys()) - 1 nb_SIG1 = len(dic_champ_cont['SANS'].keys()) + ll ll = len(dic_champ_var_int.keys()) - 1 nb_ECR1 = len(dic_champ_var_int['SANS'].keys()) + ll itot = len(resu.LIST_PARA()['INST']) __EFFG = [None] * itot __ECRG = [None] * itot __SIG1 = [None] * nb_SIG1 __ECR1 = [None] * nb_ECR1 dicAffe = [] dicAffe3 = [] lc = { 'INFO': self.INFO, 'UNITE': self.UNITE_MED, 'MODELE': self.MODELE, 'MAILLAGE': self.MAILLAGE, 'PROL_ZERO': 'OUI', } cc = { 'INFO': self.INFO, 'MODELE': self.MODELE, 'PROL_ZERO': 'OUI', 'OPERATION': 'ASSE', } MasquerAlarme('MED_4') for i in xrange(itot): lc['NUME_PT'] = resu.LIST_PARA()['NUME_ORDRE'][i] dicAsse = [] dicAsse3 = [] dicDetr = [] # CONTRAINTES lc['TYPE_CHAM'] = 'ELGA_SIEF_R' for mc_cara in dic_champ_cont.keys(): j = 0 if mc_cara == 'SANS': for champ in dic_champ_cont[mc_cara].keys(): mode_epx = dic_champ_cont[mc_cara][champ] nom_cmp = info_mode_epx[mode_epx]['NOM_CMP'] nom_cmp_med = info_mode_epx[mode_epx]['NOM_CMP_MED'] lcc = lc.copy() lcc.update( NOM_MED=champ, NOM_CMP=nom_cmp, NOM_CMP_MED=nom_cmp_med, ) __SIG1[j] = LIRE_CHAMP(**lcc) dicDetr.append({'NOM': __SIG1[j]}) dicAsse.append({ 'TOUT': 'OUI', 'CHAM_GD': __SIG1[j], 'NOM_CMP': nom_cmp, 'CUMUL': 'OUI', 'COEF_R': 1. }) j += 1 else: nb_champ_cara = len(dic_champ_cont[mc_cara].keys()) dicDetr_cara = [] if nb_champ_cara == 1: champ = dic_champ_cont[mc_cara].keys()[0] mode_epx = dic_champ_cont[mc_cara][champ] nom_cmp = info_mode_epx[mode_epx]['NOM_CMP'] nom_cmp_med = info_mode_epx[mode_epx]['NOM_CMP_MED'] lcc = lc.copy() lcc.update( NOM_MED=champ, NOM_CMP=nom_cmp, NOM_CMP_MED=nom_cmp_med, ) __SIG_AS = LIRE_CHAMP(**lcc) else: __SIG = [None] * nb_champ_cara dicAsse_cara = [] for k, champ in enumerate( dic_champ_cont[mc_cara].keys()): mode_epx = dic_champ_cont[mc_cara][champ] nom_cmp = info_mode_epx[mode_epx]['NOM_CMP'] nom_cmp_med = info_mode_epx[mode_epx][ 'NOM_CMP_MED'] lcc = lc.copy() lcc.update( NOM_MED=champ, NOM_CMP=nom_cmp, NOM_CMP_MED=nom_cmp_med, ) __SIG[k] = LIRE_CHAMP(**lcc) dicAsse_cara.append({ 'TOUT': 'OUI', 'CHAM_GD': __SIG[k], 'NOM_CMP': nom_cmp, 'CUMUL': 'OUI', 'COEF_R': 1. }) dicDetr_cara.append({'NOM': __SIG[k]}) # assemblage ccc = cc.copy() ccc.update( TYPE_CHAM='ELGA_SIEF_R', ASSE=dicAsse_cara, ) __SIG_AS = CREA_CHAMP(**ccc) dicDetr_cara.append({'NOM': __SIG_AS}) cham_para = (dic_mc_cara[mc_cara]['CH_CARA'], __SIG_AS) cham_fonc = dic_mc_cara[mc_cara]['CH_FONC'] # EVAL : passage des contraintes aux efforts __SIG1[j] = CREA_CHAMP( OPERATION='EVAL', TYPE_CHAM='ELGA_NEUT_R', CHAM_F=cham_fonc, CHAM_PARA=cham_para, ) dicDetr.append({'NOM': __SIG1[j]}) nom_cmp = dic_mc_cara[mc_cara]['NOM_CMP'] nom_cmp_f = dic_mc_cara[mc_cara]['NOM_CMP_F'] dicAsse.append({ 'TOUT': 'OUI', 'CHAM_GD': __SIG1[j], 'NOM_CMP': nom_cmp_f, 'NOM_CMP_RESU': nom_cmp, 'CUMUL': 'OUI', 'COEF_R': 1. }) DETRUIRE(CONCEPT=dicDetr_cara, INFO=1) j += 1 # VARIABLES INTERNES lc['TYPE_CHAM'] = 'ELGA_VARI_R' for compo in dic_champ_var_int.keys(): j = 0 if compo == 'SANS': for champ in dic_champ_var_int[compo].keys(): loi = dic_champ_var_int[compo][champ] nb_var_aster = info_comp_epx[loi]['NB_VAR_ASTER'] nom_cmp = info_comp_epx[loi][ 'VAR_ASTER'][:nb_var_aster] nom_cmp_med = info_comp_epx[loi][ 'VAR_EPX'][:nb_var_aster] lcc = lc.copy() lcc.update( NOM_MED=champ, NOM_CMP=nom_cmp, NOM_CMP_MED=nom_cmp_med, ) __ECR1[j] = LIRE_CHAMP(**lcc) dicAsse3.append({ 'TOUT': 'OUI', 'CHAM_GD': __ECR1[j], 'NOM_CMP': nom_cmp, 'CUMUL': 'OUI', 'COEF_R': 1. }) dicDetr.append({'NOM': __ECR1[j]}) j += 1 else: nb_champ_transfo = len(dic_champ_var_int[compo].keys()) dicDetr_transfo = [] if nb_champ_transfo == 1: champ = dic_champ_var_int[compo].keys()[0] loi = dic_champ_var_int[compo][champ] nb_var_epx = info_comp_epx[loi]['NB_VAR_EPX'] nom_cmp = info_comp_epx[loi]['VAR_ASTER'][:nb_var_epx] nom_cmp_med = info_comp_epx[loi][ 'VAR_EPX'][:nb_var_epx] lcc = lc.copy() lcc.update( NOM_MED=champ, NOM_CMP=nom_cmp, NOM_CMP_MED=nom_cmp_med, ) __ECR_AS = LIRE_CHAMP(**lcc) else: __ECR = [None] * nb_champ_transfo dicAsse_transfo = [] for k, champ in enumerate( dic_champ_var_int[compo].keys()): loi = dic_champ_var_int[compo][champ] nb_var_epx = info_comp_epx[loi]['NB_VAR_EPX'] nom_cmp = info_comp_epx[loi][ 'VAR_ASTER'][:nb_var_epx] nom_cmp_med = info_comp_epx[loi][ 'VAR_EPX'][:nb_var_epx] lcc = lc.copy() lcc.update( NOM_MED=champ, NOM_CMP=nom_cmp, NOM_CMP_MED=nom_cmp_med, ) __ECR[k] = LIRE_CHAMP(**lcc) dicAsse_transfo.append({ 'TOUT': 'OUI', 'CHAM_GD': __ECR[k], 'NOM_CMP': nom_cmp, 'CUMUL': 'OUI', 'COEF_R': 1. }) dicDetr_transfo.append({'NOM': __ECR[k]}) # assemblage ccc = cc.copy() ccc.update( TYPE_CHAM='ELGA_VARI_R', ASSE=dicAsse_transfo, ) __ECR_AS = CREA_CHAMP(**ccc) dicDetr_transfo.append({'NOM': __ECR_AS}) cham_para = __ECR_AS cham_fonc = dic_transfo[compo]['CH_FONC'] # EVAL : transormation EPX -> Aster try: __ECR1[j] = CREA_CHAMP( OPERATION='EVAL', TYPE_CHAM='ELGA_NEUT_R', CHAM_F=cham_fonc, CHAM_PARA=cham_para, ) dicDetr.append({'NOM': __ECR1[j]}) except: compor_aster = self.info_comp_epx[compo][ 'COMPOR_ASTER'] UTMESS('F', 'PLEXUS_57', valk=compor_aster) nom_cmp = dic_transfo[compo]['NOM_CMP'] nom_cmp_f = dic_transfo[compo]['NOM_CMP_F'] dicAsse3.append({ 'TOUT': 'OUI', 'CHAM_GD': __ECR1[j], 'NOM_CMP': nom_cmp_f, 'NOM_CMP_RESU': nom_cmp, 'CUMUL': 'OUI', 'COEF_R': 1. }) DETRUIRE(CONCEPT=dicDetr_transfo, INFO=1) j += 1 if dicAsse != []: ccc = cc.copy() ccc.update( TYPE_CHAM='ELGA_SIEF_R', ASSE=dicAsse, ) __EFFG[i] = CREA_CHAMP(**ccc) dic = { 'MODELE': self.MODELE, 'INST': resu.LIST_PARA()['INST'][i], } if self.CHAM_MATER is not None: dic['CHAM_MATER'] = self.CHAM_MATER if self.CARA_ELEM_CONCEPT is not None: dic['CARA_ELEM'] = self.CARA_ELEM_CONCEPT dic['CHAM_GD'] = __EFFG[i] dicAffe.append(dic) if dicAsse3 != []: ccc = cc.copy() ccc.update(TYPE_CHAM='ELGA_VARI_R', ASSE=dicAsse3) __ECRG[i] = CREA_CHAMP(**ccc) dic2 = dic.copy() dic2['CHAM_GD'] = __ECRG[i] dicAffe3.append(dic2) if dicDetr != []: DETRUIRE(CONCEPT=dicDetr, INFO=1) RetablirAlarme('MED_4') MasquerAlarme('COMPOR2_26') MasquerAlarme('COMPOR2_23') if dicAffe != []: resu = CREA_RESU( reuse=resu, OPERATION='AFFE', TYPE_RESU='EVOL_NOLI', NOM_CHAM='SIEF_ELGA', AFFE=dicAffe, ) if dicAffe3 != []: resu = CREA_RESU( reuse=resu, OPERATION='AFFE', TYPE_RESU='EVOL_NOLI', NOM_CHAM='VARI_ELGA', AFFE=dicAffe3, ) RetablirAlarme('COMPOR2_26') RetablirAlarme('COMPOR2_23') if self.modi_repere['COQUE']: from code_aster.Cata.Commands import MODI_REPERE MODI_REPERE(RESULTAT=resu, reuse=resu, REPERE='COQUE_INTR_UTIL', MODI_CHAM=_F(TYPE_CHAM='COQUE_GENE', NOM_CHAM='SIEF_ELGA', NOM_CMP=('NXX', 'NYY', 'NXY', 'MXX', 'MYY', 'MXY', 'QX', 'QY')))