Exemple #1
0
    def add_to(self, writer):
        """Add the mechanical constraints"""
        lines = WC.Lines()
        self.lines = lines
        lines.add("MODES=CALC_MODES(MATR_RIGI=RIGIDITE,")
        nbl = len("MODES=CALC_MODES(")
        lines.init_idt = " " * nbl
        lines.add("MATR_MASS=MASSE,")

        lines.add("OPTION='" + self._option + "',")

        lines.init_idt = " " * nbl
        lines.add("CALC_FREQ=_F(")
        lines.init_idt = " " * (nbl + len("CALC_FREQ=_F("))

        if self._option == "PLUS_PETITE":
            lines.add("NMAX_FREQ=" + str(self._modeList[0]) + ",)")
        elif self._option == "BANDE":
            lines.add("FREQ=(" + str(self._modeList[0]) + "," +
                      str(self._modeList[1]) + "),)")
        else:  # case "CENTRE"
            lines.add("FREQ=" + str(self._modeList[0]) + ",")
            lines.add("NMAX_FREQ=" + str(self._modeList[1]) + ",)")
        lines.init_idt = " " * nbl
        lines.add(");")

        writer.subs("calc_modes", lines.build_part())
Exemple #2
0
    def add_to(self, writer):
        lines = WC.Lines()
        self.lines = lines
        if str(self._dataCara[0]) in ["DKT", "DST", "COQUE_3D"]:
            lines.add("CAREL=AFFE_CARA_ELEM(MODELE=MODELE,")
            lines.init_idt = " " * len("CAREL=AFFE_CARA_ELEM(")
            lines.add("COQUE=_F(GROUP_MA = 'TOUT',")
            lines.init_idt = " " * len("CAREL=AFFE_CARA_ELEM(COQUE=_F(")
            lines.add("EPAIS = " + str(self._dataCara[1]) + "),")
            lines.init_idt = " " * len("CAREL=AFFE_CARA_ELEM(")
            lines.add(");")
        elif str(self._dataCara[0]) in ["POU_D_E", "POU_D_T"]:
            lines.add("CAREL=AFFE_CARA_ELEM(MODELE=MODELE,")
            lines.init_idt = " " * len("CAREL=AFFE_CARA_ELEM(")
            lines.add("POUTRE=_F(GROUP_MA = 'TOUT',")
            lines.init_idt = " " * len("CAREL=AFFE_CARA_ELEM(POUTRE=_F(")
            # lines.init_idt = " "*len("POUTRE = _F(")

            if str(self._dataCara[1]) == 'Pleine':
                if str(self._dataCara[2]) == 'RECTANGLE':
                    lines.add("SECTION = 'RECTANGLE',")
                    lines.add("CARA = ('HY', 'HZ',),")
                    lines.add("VALE = (" + str(self._dataCara[3]) + "," +
                              str(self._dataCara[4]) + "),)")
                elif str(self._dataCara[2]) == 'CARRE':
                    lines.add("SECTION = 'RECTANGLE',")
                    lines.add("CARA = 'H',")
                    lines.add("VALE = " + str(self._dataCara[3]) + ",)")
                else:
                    lines.add("SECTION = 'CERCLE',")
                    lines.add("CARA = 'R',")
                    lines.add("VALE = " + str(self._dataCara[3]) + ",)")
            else:
                if str(self._dataCara[2]) == 'RECTANGLE':
                    lines.add("SECTION = 'RECTANGLE',")
                    lines.add("CARA = ( 'HY', 'HZ', 'EPY', 'EPZ',),")
                    lines.add("VALE = (" + str(self._dataCara[3]) + "," +
                              str(self._dataCara[4]) + "," +
                              str(self._dataCara[5]) + "," +
                              str(self._dataCara[6]) + "),)")
                elif str(self._dataCara[2]) == 'CARRE':
                    lines.add("SECTION = 'RECTANGLE',")
                    lines.add("CARA = ('H', 'EP',),")
                    lines.add("VALE = (" + str(self._dataCara[3]) + "," +
                              str(self._dataCara[4]) + "),)")
                else:
                    lines.add("SECTION = 'CERCLE',")
                    lines.add("CARA = ('R', 'EP',),")
                    lines.add("VALE = (" + str(self._dataCara[3]) + "," +
                              str(self._dataCara[4]) + "),)")
            lines.init_idt = " " * len("CAREL=AFFE_CARA_ELEM(")
            lines.add(");")

        else:
            lines.add("")

        writer.subs("Cara_Elem", lines.build_part())
Exemple #3
0
    def add_to(self, writer):
        lines = WC.Lines()
        self.lines = lines
        if str(self._dataCara[0]) in [
                "DKT", "DST", "COQUE_3D", "POU_D_E", "POU_D_T"
        ]:
            lines.add("CARA_ELEM=CAREL,")

        writer.subs("Cara_Key", lines.build_part())
Exemple #4
0
 def add_to(self, writer):
     """Add the mechanical constraints"""
     lines = WC.Lines()
     self.lines = lines
     for j in range(len(self._crackName)):
             lines.init_idt = ""
             lines.add( "NB_FOND=RECU_TABLE(CO="+self._crackName[j] +",NOM_TABLE='NB_FOND_FISS')" )
             lines.add( "dict = NB_FOND.EXTR_TABLE().values()" )
             lines.add( "nb_fond = dict['NOMBRE'][0]" )
             lines.add( "DETRUIRE(CONCEPT=_F(NOM=NB_FOND),INFO=1)" )
             lines.add("")
             lines.add( "G"+str(j+1)+"= [None]*nb_fond")
             if self._dim == 3:
                 lines.add( "F_G_"+str(j+1)+"= [None]*nb_fond")
                 lines.add( "F_K1_"+str(j+1)+"= [None]*nb_fond")
             lines.add("")
             lines.add( "for i in range(nb_fond) :")
             lines.add("")
             lines.init_idt = " "*len("for")
             lines.add( "G"+str(j+1)+"[i]=CALC_G(THETA=_F(FISSURE="+self._crackName[j]+",")
             lines.init_idt = " "*len("   G2[i]=CALC_G(")
             lines.add( "NUME_FOND=i+1,")
             lines.add( "R_INF=2*h,")
             lines.add( "R_SUP=5*h,),")
             lines.init_idt = " "*len("   G2[i]=CA")
             lines.add( "RESULTAT=RESU,")
             lines.add( "OPTION='CALC_K_G')")
             lines.init_idt = " "*len("for")
             lines.add( "IMPR_TABLE(TABLE=G"+str(j+1) +"[i])")
             lines.add("")
             if self._dim == 3:
                 lines.init_idt = " "*len("for")
                 lines.add( "F_G_"+str(j+1) +"[i]=RECU_FONCTION(TABLE=G"+str(j+1) +"[i],PARA_X='ABSC_CURV',PARA_Y='G')")
                 lines.init_idt = " "*len("for")
                 lines.add( "F_K1_"+str(j+1) +"[i]=RECU_FONCTION(TABLE=G"+str(j+1) +"[i],PARA_X='ABSC_CURV',PARA_Y='K1')")
                 lines.init_idt = " "*len("for")
                 lines.add( "IMPR_FONCTION(FORMAT='XMGRACE',UNITE=29,COURBE=_F(FONCTION = F_G_"+str(j+1) +"[i],")
                 lines.init_idt = " "*len("   IMPR_FONCTION(")
                 lines.add( "LEGENDE= 'Crack "+self._crackName[j]+" Crack front #'+str(i+1)),")
                 lines.init_idt = " "*len("   IMPR_FONCTION(")
                 lines.add( "LEGENDE_X='S',LEGENDE_Y='G')")
                 lines.init_idt = " "*len("for")
                 lines.add( "IMPR_FONCTION(FORMAT='XMGRACE',UNITE=30,COURBE=_F(FONCTION = F_K1_"+str(j+1) +"[i],")
                 lines.init_idt = " "*len("   IMPR_FONCTION(")
                 lines.add( "LEGENDE= 'Crack "+self._crackName[j]+" Crack front #'+str(i+1)),")
                 lines.init_idt = " "*len("   IMPR_FONCTION(")
                 lines.add( "LEGENDE_X='S',LEGENDE_Y='K\sI')")
                 lines.add("")
     writer.subs(self.pattern_key, lines.build_part())
 def _write_mesh_change(self, writer):
     """Write the mesh change"""
     bloc = ""
     grps = self._grp_names_for_mesh
     model = writer.get(Modelisation)
     if grps and model:
         lines = WC.Lines()
         cmd = "MAIL=MODI_MAILLAGE("
         lines.add(cmd + "reuse=MAIL,")
         lines.init_idt = " " * len(cmd)
         lines.add("MAILLAGE=MAIL,")
         opt = "ORIE_PEAU_%sD=_F(GROUP_MA=%s,),"
         lines.add(opt % (model.give_dim(), tuple(grps)))
         lines.add(");")
         bloc = lines.build_part()
     writer.subs("mesh_change_key", bloc)
Exemple #6
0
    def add_to(self, writer):
        '''add the material'''

        if (len(self._group_pairs)):
            self.lines = WC.Lines()
            self.lines.add("CHA3=AFFE_CHAR_MECA(")
            self.lines.add("MODELE=MODX,")
            self.lines.add("LIAISON_MAIL=(")
            for gp in self._group_pairs:
                self.lines.add("_F(")
                self.lines.add("GROUP_MA_MAIT='%s'," % (gp[0]))
                self.lines.add("GROUP_MA_ESCL='%s'," % (gp[1]))
                self.lines.add("TYPE_RACCORD='MASSIF',),")
            self.lines.add("));")
            writer.subs(self.pattern_key, self.lines.build_part())
        else:
            writer.subs(self.pattern_key, "")
Exemple #7
0
 def add_to(self, writer):
     '''add the material'''
     if (len(self._group_pairs)):
         self.lines = WC.Lines()
         self.lines.add("CONTA=DEFI_CONTACT(MODELE= MODX,")
         self.lines.add("FORMULATION = 'CONTINUE',")
         self.lines.add("LISSAGE = 'OUI',")
         self.lines.add("FROTTEMENT = 'COULOMB',")
         self.lines.add("ZONE=(")
         for gp in self._group_pairs:
             self.lines.add("_F(")
             self.lines.add("COULOMB=%s," % (gp[2]))
             self.lines.add("INTEGRATION='GAUSS',")
             self.lines.add("CONTACT_INIT='OUI',")
             self.lines.add("GROUP_MA_MAIT='%s'," % (gp[0]))
             self.lines.add("GROUP_MA_ESCL='%s',)," % (gp[1]))
         self.lines.add("));")
         writer.subs(self.pattern_key, self.lines.build_part())
     else:
         writer.subs(self.pattern_key, "")
Exemple #8
0
 def add_to(self, writer):
     '''add the material'''
     self.lines = WC.Lines()
     self.add_part(writer)
     writer.subs(self.pattern_key, self.lines.build_part())
Exemple #9
0
 def add_to(self, writer):
     """Add the mechanical constraints"""
     lines = WC.Lines()
     self.lines = lines
     lines.add('['+','.join(self._ListName)+']')
     writer.subs(self.pattern_key, lines.build_part())
Exemple #10
0
    def add_to(self, writer):
        """Add the mechanical constraints"""
        lines = WC.Lines()
        self.lines = lines
        if self._refPlace == "in" :
            distance = "dist"
            cond = "MAILLAGE=MAILLAGE,"
            self.pattern_key = "fissureXFEM_definition_key_in"
        elif self._refPlace == "in2" :
            distance = "distdist"
            cond = "MAILLAGE=MA[i_raff],"
            self.pattern_key = "fissureXFEM_definition_key_in2"
        else :
            distance = ""
            cond = "MAILLAGE=MA[ind_mail],"
            self.pattern_key = "fissureXFEM_definition_key"

        for i in range(len( self._crackList[0])):
            if  self._crackList[1][i] == "Ellipse":
                lines.init_idt = " "*len(distance)
                lines.add( self._crackList[0][i]+"=DEFI_FISS_XFEM(" + cond)
                lines.init_idt = " " * len("=DEFI_FISS_XFEM(")
                lines.add("DEFI_FISS=(")
                a = [self._crackDef[self._crackList[0][i]+"SEMI-MAJOR-AXIS-Ellipse"],self._crackDef[self._crackList[0][i]+"SEMI-MINOR-AXIS-Ellipse"],  \
                        (self._crackDef[self._crackList[0][i]+"CENTER_x_Ellipse"],self._crackDef[self._crackList[0][i]+"CENTER_y_Ellipse"], self._crackDef[self._crackList[0][i]+"CENTER_z_Ellipse"]),  \
                        (self._crackDef[self._crackList[0][i]+"VECT_X_x_Ellipse"],self._crackDef[self._crackList[0][i]+"VECT_X_y_Ellipse"], self._crackDef[self._crackList[0][i]+"VECT_X_z_Ellipse"]),  \
                        (self._crackDef[self._crackList[0][i]+"VECT_Y_x_Ellipse"],self._crackDef[self._crackList[0][i]+"VECT_Y_y_Ellipse"], self._crackDef[self._crackList[0][i]+"VECT_Y_z_Ellipse"])]
                self.const =  CrackAnalyisis("FORM_FISS",  self._crackList[1][i].upper(),*a)

                self.const.add_to(self, writer)
                lines.add("),);")

            elif  self._crackList[1][i] == "Cylinder":
                lines.init_idt = " "*len(distance)
                lines.add( self._crackList[0][i]+"=DEFI_FISS_XFEM(" + cond)
                lines.init_idt = " " * len("=DEFI_FISS_XFEM(")
                lines.add("DEFI_FISS=(")
                a = [self._crackDef[self._crackList[0][i]+"SEMI-MAJOR-AXIS-Cylinder"],self._crackDef[self._crackList[0][i]+"SEMI-MINOR-AXIS-Cylinder"],  \
                        (self._crackDef[self._crackList[0][i]+"CENTER_x_Cylinder"],self._crackDef[self._crackList[0][i]+"CENTER_y_Cylinder"], self._crackDef[self._crackList[0][i]+"CENTER_z_Cylinder"]),  \
                        (self._crackDef[self._crackList[0][i]+"VECT_X_x_Cylinder"],self._crackDef[self._crackList[0][i]+"VECT_X_y_Cylinder"], self._crackDef[self._crackList[0][i]+"VECT_X_z_Cylinder"]),  \
                        (self._crackDef[self._crackList[0][i]+"VECT_Y_x_Cylinder"],self._crackDef[self._crackList[0][i]+"VECT_Y_y_Cylinder"], self._crackDef[self._crackList[0][i]+"VECT_Y_z_Cylinder"])]
                self.const =  CrackAnalyisis("FORM_FISS",  "CYLINDRE",*a)

                self.const.add_to(self, writer)
                lines.add("),);")
            elif  self._crackList[1][i] == "Rectangle":
                lines.init_idt = " "*len(distance)
                lines.add( self._crackList[0][i]+"=DEFI_FISS_XFEM(" + cond)
                lines.init_idt = " " * len("=DEFI_FISS_XFEM(")
                lines.add("DEFI_FISS=(")
                a = [self._crackDef[self._crackList[0][i]+"SEMI-MAJOR-AXIS-Rectangle"],self._crackDef[self._crackList[0][i]+"SEMI-MINOR-AXIS-Rectangle"],  \
                        (self._crackDef[self._crackList[0][i]+"CENTER_x_Rectangle"],self._crackDef[self._crackList[0][i]+"CENTER_y_Rectangle"], self._crackDef[self._crackList[0][i]+"CENTER_z_Rectangle"]),  \
                        (self._crackDef[self._crackList[0][i]+"VECT_X_x_Rectangle"],self._crackDef[self._crackList[0][i]+"VECT_X_y_Rectangle"], self._crackDef[self._crackList[0][i]+"VECT_X_z_Rectangle"]),  \
                        (self._crackDef[self._crackList[0][i]+"VECT_Y_x_Rectangle"],self._crackDef[self._crackList[0][i]+"VECT_Y_y_Rectangle"], self._crackDef[self._crackList[0][i]+"VECT_Y_z_Rectangle"])]
                self.const =  CrackAnalyisis("FORM_FISS",  self._crackList[1][i].upper(),*a)

                self.const.add_to(self, writer)
                lines.add("),);")
            elif  self._crackList[1][i] == "Half_Plane":
                lines.init_idt = " "*len(distance)
                lines.add( self._crackList[0][i]+"=DEFI_FISS_XFEM(" + cond)
                lines.init_idt = " " * len("=DEFI_FISS_XFEM(")
                lines.add("DEFI_FISS=(")
                a = [(self._crackDef[self._crackList[0][i]+"Pfon_x_Half_Plane"],self._crackDef[self._crackList[0][i]+"Pfon_y_Half_Plane"], self._crackDef[self._crackList[0][i]+"Pfon_z_Half_Plane"]),  \
                        (self._crackDef[self._crackList[0][i]+"Norm_x_Half_Plane"],self._crackDef[self._crackList[0][i]+"Norm_y_Half_Plane"], self._crackDef[self._crackList[0][i]+"Norm_z_Half_Plane"]),  \
                        (self._crackDef[self._crackList[0][i]+"Dtan_x_Half_Plane"],self._crackDef[self._crackList[0][i]+"Dtan_y_Half_Plane"], self._crackDef[self._crackList[0][i]+"Dtan_z_Half_Plane"])]
                self.const =  CrackHalfPlane("FORM_FISS",  "DEMI_PLAN",*a)

                self.const.add_to(self, writer)
                lines.add("),);")
            elif  self._crackList[1][i] == "Half_Line":
                lines.init_idt = " "*len(distance)
                lines.add( self._crackList[0][i]+"=DEFI_FISS_XFEM(" + cond)
                lines.init_idt = " " * len("=DEFI_FISS_XFEM(")
                lines.add("DEFI_FISS=(")
                a = [(self._crackDef[self._crackList[0][i]+"Pfon_x_Half_Line"],self._crackDef[self._crackList[0][i]+"Pfon_y_Half_Line"], self._crackDef[self._crackList[0][i]+"Pfon_z_Half_Line"]),  \
                        (self._crackDef[self._crackList[0][i]+"Dtan_x_Half_Line"],self._crackDef[self._crackList[0][i]+"Dtan_y_Half_Line"], self._crackDef[self._crackList[0][i]+"Dtan_z_Half_Line"])]
                self.const =  CrackHalfLine("FORM_FISS", "DEMI_DROITE",*a)

                self.const.add_to(self, writer)
                lines.add("),);")
            elif  self._crackList[1][i] == "Segment":
                lines.init_idt = " "*len(distance)
                lines.add( self._crackList[0][i]+"=DEFI_FISS_XFEM(" + cond)
                lines.init_idt = " " * len("=DEFI_FISS_XFEM(")
                lines.add("DEFI_FISS=(")
                a = [(self._crackDef[self._crackList[0][i]+"PFON_ORIG_x_Segment"],self._crackDef[self._crackList[0][i]+"PFON_ORIG_y_Segment"], self._crackDef[self._crackList[0][i]+"PFON_ORIG_z_Segment"]),  \
                        (self._crackDef[self._crackList[0][i]+"PFON_EXTR_x_Segment"],self._crackDef[self._crackList[0][i]+"PFON_EXTR_y_Segment"], self._crackDef[self._crackList[0][i]+"PFON_EXTR_z_Segment"])]
                self.const =  CrackSegment("FORM_FISS",  self._crackList[1][i].upper(),*a)

                self.const.add_to(self, writer)
                lines.add("),);")
        writer.subs(self.pattern_key, lines.build_part())