91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

#詳細注釋版的ABAQUS COH2D4單元批量添加Python腳本 #本程序只適用于二維問題,對于三維COH3D8的批量嵌入只需要轉換二維思維到三維即可,即單元共有邊到單元共有面上添加COH3D8單元,建議詳細閱讀ABAQUS Documentation

資源截圖

代碼片段和文件信息

#!/user/bin/python
#-*-coding:UTF-8-*-
#讀取inp文件
#2D一次或者二次的四邊形Cohesive單元添加COH2D4
import?sys
File_path=‘C:/Users/Administrator/Desktop/‘
Inp_name=‘Job-1.inp‘
NEW_INPNAME=‘Test.inp‘
#CO_SET?startswith
COSTARTS=‘*Elset?elset=CO_SET?instance=WINDSHEID‘
Ori_inp=open(File_path+Inp_name‘r‘)
#讀取節點編號及坐標信息
Node_dic={}
Inp_line=Ori_inp.readlines()
#Inp_val輔助判斷
#結點存儲為字典格式,結點號為索引,其索引內容為結點坐標
Inp_value=0
Inp_value=0
for?i?in?range(len(Inp_line)):
????if?Inp_line[i].startswith(‘*Node‘):
????????Inp_value+=1
????if?Inp_line[i].startswith(‘*Element‘):
????????Inp_value+=1
????????break
????if?Inp_value==1:
???????try:
???????????Node1=[float(cor)?for?cor?in?Inp_line[i+1].split(‘‘)]
???????????Node1[0]=int(Node1[0])
???????????Node_dic[Node1[0]]=[]
???????????Node_dic[Node1[0]].append(Node1[1])
???????????Node_dic[Node1[0]].append(Node1[2])
???????????Node_dic[Node1[0]].append(Node1[3])
???????except:pass


#此程序默認需要添加cohesive單元的區域
Nodel=[]
Inp_value=0
#讀取單元結點編號
Element_dic={}
EL_EIGHT=[]
EL_FOUR=[]
for?i?in?range(len(Inp_line)):
????if?Inp_line[i].startswith(‘*Element‘):
????????Inp_value+=1
????if?Inp_value==1:
???????try:
???????????Node1=[int(cor)?for?cor?in?Inp_line[i+1].split(‘‘)]
???????????Element_dic[Node1[0]]=[]
???????????if?len(Node1)==9:
???????????????EL_EIGHT.append(Node1[0])
???????????????Element_dic[Node1[0]].extend(Node1[1:8])???????????????????????????
???????????elif?len(Node1)==5:
???????????????EL_FOUR.append(Node1[0])
???????????????Element_dic[Node1[0]].extend(Node1[1:5])???#此處用extend更好
???????except:
???????????Inp_value=0


EL_EIGHT.sort()
EL_FOUR.sort()

#讀取需添加cohesive單元的單元集合
#此處需定義單元的結點編號
#CO_ELSET為在inp之前建立的單元集合
#CO_SET為新生成的cohesive單元(命名不清)
Node1=[]
Inp_value=0
ESET_value=0
CO_ELSET=[]
for?i?in?range(len(Inp_line)):
????if?Inp_line[i].startswith(COSTARTS):?
????????Inp_value+=1
????????ESET_value=1
????if?Inp_line[i].startswith(‘*Elset?elset=CO_SET\n‘):
????????Inp_value+=1
????????ESET_value=0
????if??Inp_value?:
????????if?ESET_value:?#整個部件需要插入Cohesive單元
????????????try:
???????????????Node1=[int(cor)?for?cor?in?Inp_line[i+1].split(‘‘)]
???????????????Num=Node1[1]-Node1[0]+1
???????????????for?k?in?range(Num):
??????????????????S=Node1[0]+k
??????????????????CO_ELSET.append(S)
????????????except:
???????????????Inp_value=0
???????????????break?
????????else:?#某個單元集內插入Cohesive單元
????????????try:
???????????????Node1=[int(cor)?for?cor?in?Inp_line[i+1].split(‘‘)]
???????????????for?NODE?in?Node1:
???????????????????CO_ELSET.append(NODE)
????????????except:
???????????????Inp_value=0
???????????????Node1=0
???????????????k=0
???????????????break


#添加cohesive單元的步驟
#(1)形成cohesive單元結點集,并找出其重復次數
#(2)找出重復單元變數,并根據邊數形成cohesive單元
CO_NODE=[]
for?i?in?range(len(CO_ELSET)):
????CO_NODE.extend(Element_dic[CO_ELSET[i]])?#需要添加COHESIVE單元的單元集合所包含的節點集


#尋找重復節點數
CO_NODE_SORT=sorted(CO_NODE)?#集合內單元節點重排序
NODECO=[]
NODECO_DIC={}?#某個鍵(重復節點編號)

評論

共有 條評論