|
|
|
# Vector-U,A,V,RF
|
|
|
|
# Tensors-S
|
|
|
|
# Scalars-PEEQ
|
|
|
|
def U(displacement, outfile, stg_n):
|
|
|
|
# Access Spatial displacement
|
|
|
|
fieldValues = displacement.values
|
|
|
|
for valueX in fieldValues:
|
|
|
|
ux = valueX.data[0]
|
|
|
|
uy = valueX.data[1]
|
|
|
|
uz = valueX.data[2]
|
|
|
|
|
|
|
|
# Spatial displacement, <DataArray>
|
|
|
|
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Spatial_displacement" +
|
|
|
|
'"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
for i in stg_n:
|
|
|
|
X, Y, Z = ux, uy, uz
|
|
|
|
outfile.write('%11.8e' % X+' '+'%11.8e' % Y+' '+'%11.8e' % Z+'\n')
|
|
|
|
outfile.write("</DataArray>"+'\n')
|
|
|
|
|
|
|
|
|
|
|
|
def A(acceleration, outfile, stg_n):
|
|
|
|
# Access Spatial acceleration
|
|
|
|
fieldValues = acceleration.values
|
|
|
|
for valueX in fieldValues:
|
|
|
|
ax = valueX.data[0]
|
|
|
|
ay = valueX.data[1]
|
|
|
|
az = valueX.data[2]
|
|
|
|
# Spatial acceleration, <DataArray>
|
|
|
|
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Spatial_acceleration" +
|
|
|
|
'"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
for i in stg_n:
|
|
|
|
X, Y, Z = ax, ay, az
|
|
|
|
outfile.write('%11.8e' % X+' '+'%11.8e' % Y+' '+'%11.8e' % Z+'\n')
|
|
|
|
outfile.write("</DataArray>"+'\n')
|
|
|
|
|
|
|
|
|
|
|
|
def V(velocity, outfile, stg_n):
|
|
|
|
# Access Spatial velocity
|
|
|
|
fieldValues = velocity.values
|
|
|
|
for valueX in fieldValues:
|
|
|
|
vx = valueX.data[0]
|
|
|
|
vy = valueX.data[1]
|
|
|
|
vz = valueX.data[2]
|
|
|
|
# Spatial velocity, <DataArray>
|
|
|
|
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Spatial_velocity" +
|
|
|
|
'"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
for i in stg_n:
|
|
|
|
X, Y, Z = vx, vy, vz
|
|
|
|
outfile.write('%11.8e' % X+' '+'%11.8e' % Y+' '+'%11.8e' % Z+'\n')
|
|
|
|
outfile.write("</DataArray>"+'\n')
|
|
|
|
|
|
|
|
|
|
|
|
def RF(Reaction_force, outfile, stg_n):
|
|
|
|
# Access Reaction force
|
|
|
|
fieldValues = Reaction_force.values
|
|
|
|
for valueX in fieldValues:
|
|
|
|
rfx = valueX.data[0]
|
|
|
|
rfy = valueX.data[1]
|
|
|
|
rfz = valueX.data[2]
|
|
|
|
# Reaction force
|
|
|
|
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Reaction_force" +
|
|
|
|
'"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
for i in stg_n:
|
|
|
|
X, Y, Z = rfx, rfy, rfz
|
|
|
|
outfile.write('%11.8e' % X+' '+'%11.8e' % Y+' '+'%11.8e' % Z+'\n')
|
|
|
|
outfile.write("</DataArray>"+'\n')
|
|
|
|
|
|
|
|
|
|
|
|
def PEEQ(Equivalent_plastic_strain, outfile, stg_n):
|
|
|
|
# Equivalent plastic strain
|
|
|
|
node_Equivalent_plastic_strain = Equivalent_plastic_strain.getSubs(
|
|
|
|
position=ELEMENT_NODAL)
|
|
|
|
fieldValues = node_Equivalent_plastic_strain.values
|
|
|
|
for valueX in fieldValues:
|
|
|
|
PEEQ_data = valueX.data
|
|
|
|
# Equivalent plastic strain, <DataArray>
|
|
|
|
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name=" +
|
|
|
|
'"'+"Equivalent_plastic_strain"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
for i in stg_n:
|
|
|
|
pd = PEEQ_data
|
|
|
|
outfile.write('%11.8e' % pd+'\n')
|
|
|
|
outfile.write('</DataArray>'+'\n')
|
|
|
|
|
|
|
|
|
|
|
|
def Stress(Stress, outfile, stg_n):
|
|
|
|
# access Stress components
|
|
|
|
node_Stress = Stress.getSubset(position=ELEMENT_NODAL)
|
|
|
|
fieldValues = node_Stress.values
|
|
|
|
for valueX in fieldValues:
|
|
|
|
s11 = valueX.data[0]
|
|
|
|
s22 = valueX.data[1]
|
|
|
|
s33 = valueX.data[2]
|
|
|
|
s12 = valueX.data[3]
|
|
|
|
s23 = valueX.data[4]
|
|
|
|
s13 = valueX.data[5]
|
|
|
|
|
|
|
|
# L1[valueX.nodeLabel-1][7] += valueX.mises
|
|
|
|
# L1[valueX.nodeLabel-1][8] += valueX.maxPrincipal
|
|
|
|
# L1[valueX.nodeLabel-1][9] += valueX.midPrincipal
|
|
|
|
# L1[valueX.nodeLabel-1][10] += valueX.minPrincipal
|
|
|
|
# L1[valueX.nodeLabel-1][11] += valueX.press
|
|
|
|
# L1[valueX.nodeLabel-1][12] += valueX.tresca
|
|
|
|
# L1[valueX.nodeLabel-1][13] += valueX.inv3
|
|
|
|
# Stress components, <DataArray>
|
|
|
|
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Components" +
|
|
|
|
'"'+" "+"NumberOfComponents="+'"'+"9"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
for i in stg_n:
|
|
|
|
XX, XY, XZ, YX, YY, YZ, ZX, ZY, ZZ = s11, s12, s13, s12, s22, s23, s13, s23, s33
|
|
|
|
outfile.write('%11.8e' % XX+' '+'%11.8e' % XY+' '+'%11.8e' % XZ+' '+'%11.8e' % YX+' '+'%11.8e' %
|
|
|
|
YY+' '+'%11.8e' % YZ+' '+'%11.8e' % ZX+' '+'%11.8e' % ZY+' '+'%11.8e' % ZZ+'\n')
|
|
|
|
outfile.write("</DataArray>"+'\n')
|
|
|
|
|
|
|
|
|
|
|
|
def NT11(Temperature, outfile, stg_n):
|
|
|
|
# Equivalent plastic strain
|
|
|
|
fieldValues = Temperature.values
|
|
|
|
NT11_data = []
|
|
|
|
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" " +
|
|
|
|
"Name="+'"'+"Temperature"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
|
|
|
|
for valueX in fieldValues:
|
|
|
|
# i = valueX.nodeLabel
|
|
|
|
# print(i, valueX.data)
|
|
|
|
NT11_data.append(valueX.data)
|
|
|
|
# Equivalent plastic strain, <DataArray>
|
|
|
|
for idx in range(len(NT11_data)):
|
|
|
|
outfile.write('%11.8e' % NT11_data[stg_n[idx]]+'\n')
|
|
|
|
outfile.write('</DataArray>'+'\n')
|
|
|
|
|
|
|
|
# print "Reading U, A, V, RF ......"
|
|
|
|
# time1 = time()
|
|
|
|
# #Access Spatial displacement
|
|
|
|
# displacement = N_Frame.fieldOutputs['U']
|
|
|
|
# fieldValues = displacement.values
|
|
|
|
# for valueX in fieldValues :
|
|
|
|
# i = valueX.nodeLabel
|
|
|
|
# L0[i-1][0] = valueX.data[0] ux
|
|
|
|
# L0[i-1][1] = valueX.data[1] uy
|
|
|
|
# L0[i-1][2] = valueX.data[2] uz
|
|
|
|
|
|
|
|
# #Access Spatial acceleration
|
|
|
|
# acceleration = N_Frame.fieldOutputs['A']
|
|
|
|
# fieldValues = acceleration.values
|
|
|
|
# for valueX in fieldValues :
|
|
|
|
# i = valueX.nodeLabel
|
|
|
|
# L0[i-1][3] = valueX.data[0] ax
|
|
|
|
# L0[i-1][4] = valueX.data[1] ay
|
|
|
|
# L0[i-1][5] = valueX.data[2] az
|
|
|
|
# #Access Spatial velocity
|
|
|
|
# velocity = N_Frame.fieldOutputs['V']
|
|
|
|
# fieldValues = velocity.values
|
|
|
|
# for valueX in fieldValues :
|
|
|
|
# i = valueX.nodeLabel
|
|
|
|
# L0[i-1][6] = valueX.data[0] vx
|
|
|
|
# L0[i-1][7] = valueX.data[1] vy
|
|
|
|
# L0[i-1][8] = valueX.data[2] vz
|
|
|
|
# #Access Reaction force
|
|
|
|
# Reaction_force = N_Frame.fieldOutputs['RF']
|
|
|
|
# fieldValues = Reaction_force.values
|
|
|
|
# for valueX in fieldValues :
|
|
|
|
# i = valueX.nodeLabel
|
|
|
|
# L0[i-1][9] = valueX.data[0] rfx
|
|
|
|
# L0[i-1][10] = valueX.data[1] rfy
|
|
|
|
# L0[i-1][11] = valueX.data[2] rfz
|
|
|
|
# print "Time elapsed: ", time() - time1, "s"
|
|
|
|
|
|
|
|
# print "Reading Stress ......"
|
|
|
|
# time1 = time()
|
|
|
|
# #access Stress components
|
|
|
|
# Stress = N_Frame.fieldOutputs['S']
|
|
|
|
# node_Stress = Stress.getSubset(position=ELEMENT_NODAL)
|
|
|
|
# fieldValues = node_Stress.values
|
|
|
|
# for valueX in fieldValues :
|
|
|
|
# L1[valueX.nodeLabel-1][0] += 1
|
|
|
|
# L1[valueX.nodeLabel-1][1] += valueX.data[0] s11
|
|
|
|
# L1[valueX.nodeLabel-1][2] += valueX.data[1] s22
|
|
|
|
# L1[valueX.nodeLabel-1][3] += valueX.data[2] s33
|
|
|
|
# L1[valueX.nodeLabel-1][4] += valueX.data[3] s12
|
|
|
|
# L1[valueX.nodeLabel-1][5] += valueX.data[4] s23
|
|
|
|
# L1[valueX.nodeLabel-1][6] += valueX.data[5] s13
|
|
|
|
|
|
|
|
# L1[valueX.nodeLabel-1][7] += valueX.mises
|
|
|
|
# L1[valueX.nodeLabel-1][8] += valueX.maxPrincipal
|
|
|
|
# L1[valueX.nodeLabel-1][9] += valueX.midPrincipal
|
|
|
|
# L1[valueX.nodeLabel-1][10] += valueX.minPrincipal
|
|
|
|
# L1[valueX.nodeLabel-1][11] += valueX.press
|
|
|
|
# L1[valueX.nodeLabel-1][12] += valueX.tresca
|
|
|
|
# L1[valueX.nodeLabel-1][13] += valueX.inv3
|
|
|
|
# # can first ave
|
|
|
|
# print "Time elapsed: ", time() - time1, "s"
|
|
|
|
|
|
|
|
# print "Reading Equivalent plastic strain ......"
|
|
|
|
# time1 = time()
|
|
|
|
# #Equivalent plastic strain
|
|
|
|
# Equivalent_plastic_strain = N_Frame.fieldOutputs['PEEQ']
|
|
|
|
# node_Equivalent_plastic_strain = Equivalent_plastic_strain.getSubset(position=ELEMENT_NODAL)
|
|
|
|
# fieldValues = node_Equivalent_plastic_strain.values
|
|
|
|
# for valueX in fieldValues :
|
|
|
|
# L4[valueX.nodeLabel-1][0] += 1
|
|
|
|
# L4[valueX.nodeLabel-1][1] += valueX.data
|
|
|
|
# print "Time elapsed: ", time() - time1, "s"
|
|
|
|
|
|
|
|
|
|
|
|
# print "Reading Logarithmic strain ......"
|
|
|
|
# time1 = time()
|
|
|
|
# #Logarithmic strain components
|
|
|
|
# Logarithmic_strain = N_Frame.fieldOutputs['LE']
|
|
|
|
# node_Logarithmic_strain = Logarithmic_strain.getSubset(position=ELEMENT_NODAL)
|
|
|
|
# fieldValues = node_Logarithmic_strain.values
|
|
|
|
# for valueX in fieldValues :
|
|
|
|
# L2[valueX.nodeLabel-1][0] += 1
|
|
|
|
# L2[valueX.nodeLabel-1][1] += valueX.data[0]
|
|
|
|
# L2[valueX.nodeLabel-1][2] += valueX.data[1]
|
|
|
|
# L2[valueX.nodeLabel-1][3] += valueX.data[2]
|
|
|
|
# L2[valueX.nodeLabel-1][4] += valueX.data[3]
|
|
|
|
# L2[valueX.nodeLabel-1][5] += valueX.data[4]
|
|
|
|
# L2[valueX.nodeLabel-1][6] += valueX.data[5]
|
|
|
|
|
|
|
|
# L2[valueX.nodeLabel-1][7] += valueX.maxPrincipal
|
|
|
|
# L2[valueX.nodeLabel-1][8] += valueX.minPrincipal
|
|
|
|
# print "Time elapsed: ", time() - time1, "s"
|
|
|
|
# print "Reading Plastic strain ......"
|
|
|
|
# time1 = time()
|
|
|
|
# #Plastic strain components
|
|
|
|
# Plastic_strain = N_Frame.fieldOutputs['PE']
|
|
|
|
# node_Plastic_strain = Plastic_strain.getSubset(position=ELEMENT_NODAL)
|
|
|
|
# fieldValues = node_Plastic_strain.values
|
|
|
|
# for valueX in fieldValues :
|
|
|
|
# L3[valueX.nodeLabel-1][0] += 1
|
|
|
|
# L3[valueX.nodeLabel-1][1] += valueX.data[0]
|
|
|
|
# L3[valueX.nodeLabel-1][2] += valueX.data[1]
|
|
|
|
# L3[valueX.nodeLabel-1][3] += valueX.data[2]
|
|
|
|
# L3[valueX.nodeLabel-1][4] += valueX.data[3]
|
|
|
|
# L3[valueX.nodeLabel-1][5] += valueX.data[4]
|
|
|
|
# L3[valueX.nodeLabel-1][6] += valueX.data[5]
|
|
|
|
|
|
|
|
# L3[valueX.nodeLabel-1][7] += valueX.maxPrincipal
|
|
|
|
# L3[valueX.nodeLabel-1][8] += valueX.minPrincipal
|
|
|
|
# print "Time elapsed: ", time() - time1, "s"
|
|
|
|
|
|
|
|
# Logarithmic_strain_Max_Principal, <DataArray>
|
|
|
|
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Logarithmic_strain_Max_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
# for i in stg_n:
|
|
|
|
# k = node[stg_n[i]].label-1
|
|
|
|
# X = L2[k][7]
|
|
|
|
# outfile.write('%11.8e'%X+'\n')
|
|
|
|
# outfile.write('</DataArray>'+'\n')
|
|
|
|
# #</DataArray>
|
|
|
|
|
|
|
|
# #Logarithmic strain Min.Principal, <DataArray>
|
|
|
|
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Logarithmic_strain_Min_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
# for i in stg_n:
|
|
|
|
# k = node[stg_n[i]].label-1
|
|
|
|
# X = L2[k][8]
|
|
|
|
# outfile.write('%11.8e'%X+'\n')
|
|
|
|
# outfile.write('</DataArray>'+'\n')
|
|
|
|
# #</DataArray>'''
|
|
|
|
|
|
|
|
# Plastic strain Max.Principal, <DataArray>
|
|
|
|
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Plastic_strain_Max_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
# for i in stg_n:
|
|
|
|
# k = node[stg_n[i]].label-1
|
|
|
|
# X = L3[k][7]
|
|
|
|
# outfile.write('%11.8e'%X+'\n')
|
|
|
|
# outfile.write('</DataArray>'+'\n')
|
|
|
|
# #</DataArray>
|
|
|
|
|
|
|
|
# #Plastic strain Min.Principal, <DataArray>
|
|
|
|
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Plastic_strain_Min_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
# for i in stg_n:
|
|
|
|
# k = node[stg_n[i]].label-1
|
|
|
|
# X = L3[k][8]
|
|
|
|
# outfile.write('%11.8e'%X+'\n')
|
|
|
|
# outfile.write('</DataArray>'+'\n')
|
|
|
|
# #</DataArray>
|
|
|
|
|
|
|
|
# #Stress Mises, <DataArray>
|
|
|
|
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Mises"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
# for i in stg_n:
|
|
|
|
# k = node[stg_n[i]].label-1
|
|
|
|
# X = smises
|
|
|
|
# outfile.write('%11.8e'%X+'\n')
|
|
|
|
# outfile.write('</DataArray>'+'\n')
|
|
|
|
# #</DataArray>
|
|
|
|
|
|
|
|
# #Stress Max.Principal, <DataArray>
|
|
|
|
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Max_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
# for i in stg_n:
|
|
|
|
# k = node[stg_n[i]].label-1
|
|
|
|
# X = maxPrincipal
|
|
|
|
# outfile.write('%11.8e'%X+'\n')
|
|
|
|
# outfile.write('</DataArray>'+'\n')
|
|
|
|
# #</DataArray>
|
|
|
|
|
|
|
|
# #Stress Mid.Principal, <DataArray>
|
|
|
|
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Mid_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
# for i in stg_n:
|
|
|
|
# k = node[stg_n[i]].label-1
|
|
|
|
# X = midPrincipal
|
|
|
|
# outfile.write('%11.8e'%X+'\n')
|
|
|
|
# outfile.write('</DataArray>'+'\n')
|
|
|
|
# #</DataArray>
|
|
|
|
|
|
|
|
# #Stress Min.Principal, <DataArray>
|
|
|
|
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Min_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
# for i in stg_n:
|
|
|
|
# k = node[stg_n[i]].label-1
|
|
|
|
# X = minPrincipal
|
|
|
|
# outfile.write('%11.8e'%X+'\n')
|
|
|
|
# outfile.write('</DataArray>'+'\n')
|
|
|
|
# #</DataArray>
|
|
|
|
|
|
|
|
# #Stress Pressure, <DataArray>
|
|
|
|
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Pressure"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
# for i in stg_n:
|
|
|
|
# k = node[stg_n[i]].label-1
|
|
|
|
# X = press
|
|
|
|
# outfile.write('%11.8e'%X+'\n')
|
|
|
|
# outfile.write('</DataArray>'+'\n')
|
|
|
|
# #</DataArray>
|
|
|
|
|
|
|
|
# #Stress Tresca, <DataArray>
|
|
|
|
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Tresca"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
# for i in stg_n:
|
|
|
|
# k = node[stg_n[i]].label-1
|
|
|
|
# X = tresca
|
|
|
|
# outfile.write('%11.8e'%X+'\n')
|
|
|
|
# outfile.write('</DataArray>'+'\n')
|
|
|
|
# #</DataArray>
|
|
|
|
|
|
|
|
# #Stress Third_Invariant, <DataArray>
|
|
|
|
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Third_Invariant"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
|
|
|
|
# for i in stg_n:
|
|
|
|
# k = node[stg_n[i]].label-1
|
|
|
|
# X = inv3
|
|
|
|
# outfile.write('%11.8e'%X+'\n')
|
|
|
|
# outfile.write('</DataArray>'+'\n')
|
|
|
|
# #</DataArray>
|