misplaced node fixed

main
harvo 2 years ago
parent 9d98d9f08a
commit 767c529040

3
.gitignore vendored

@ -10,4 +10,5 @@
*.prt *.prt
*.sim *.sim
*.sta *.sta
**/output/ **/output/
ABQcaeK.0.00.dmp

@ -71,8 +71,7 @@ class VTKFile(object):
for var_id in ['NT11']: for var_id in ['NT11']:
fieldOutputs = self.N_Frame.fieldOutputs[var_id] fieldOutputs = self.N_Frame.fieldOutputs[var_id]
from utils_odb import NT11 as pq_class from utils_odb import NT11 as pq_class
pq_class(fieldOutputs, self.outfile, range( pq_class(fieldOutputs, self.outfile, self.this_model.stg_n)
0, len(self.this_model.stg_n)))
self.outfile.write("</PointData>"+'\n') self.outfile.write("</PointData>"+'\n')
# </PointData> # </PointData>
@ -128,7 +127,7 @@ class MODEL(object):
# access nodes & elements # access nodes & elements
self.this_instance = this_instance self.this_instance = this_instance
self.count() self.count()
def mesh(self): def mesh(self):
@ -148,7 +147,6 @@ class MODEL(object):
def count(self): def count(self):
node = self.this_instance.nodes node = self.this_instance.nodes
element = self.this_instance.elements element = self.this_instance.elements
# match nodes' label and its order in sequence (for empty nodes in tetra mesh) # match nodes' label and its order in sequence (for empty nodes in tetra mesh)
MLN = node[len(node)-1].label MLN = node[len(node)-1].label
@ -184,7 +182,7 @@ class MODEL(object):
k = element[i].connectivity[j] - 1 k = element[i].connectivity[j] - 1
if (stg_p[k] < 0): if (stg_p[k] < 0):
stg_p[k] = nodecount stg_p[k] = nodecount
stg_n.append(L[k]) stg_n.append(int(L[k]))
stg_e.append(nodecount) stg_e.append(nodecount)
nodecount += 1 nodecount += 1
else: else:
@ -216,14 +214,17 @@ def ConvertOdb2Vtk(odb_path):
print("Step: ", stepname) print("Step: ", stepname)
# frame cycle # access attribute(fieldOutputs) information # frame cycle # access attribute(fieldOutputs) information
for i_frame, N_Frame in enumerate(step[stepname].frames): for i_frame, N_Frame in enumerate(step[stepname].frames):
# if i_frame<len(step[stepname].frames)-1:
# if i_frame > 20:
# continue
# Access a frame # Access a frame
print("writing vtk files Frame:", i_frame) print("Frame:", i_frame)
time_temp = time.time() time_temp = time.time()
# create and open a VTK(.vtu) files # create and open a VTK(.vtu) files
VTKFile(outfile=os.path.join(vtk_path)+stepname + VTKFile(outfile=os.path.join(vtk_path)+stepname +
'_'+instancename+'f%03d' % int(i_frame)+'.vtu', '_'+instancename+'_f%04d' % int(i_frame)+'.vtu',
this_model=this_model, this_model=this_model,
N_Frame=N_Frame) N_Frame=N_Frame)

@ -1,7 +1,7 @@
# Vector-U,A,V,RF # Vector-U,A,V,RF
# Tensors-S # Tensors-S
# Scalars-PEEQ # Scalars-PEEQ
def U(displacement, outfile, reop_N): def U(displacement, outfile, stg_n):
# Access Spatial displacement # Access Spatial displacement
fieldValues = displacement.values fieldValues = displacement.values
for valueX in fieldValues: for valueX in fieldValues:
@ -12,14 +12,13 @@ def U(displacement, outfile, reop_N):
# Spatial displacement, <DataArray> # Spatial displacement, <DataArray>
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Spatial_displacement" + outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Spatial_displacement" +
'"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') '"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_N: for i in stg_n:
X, Y, Z = ux, uy, uz X, Y, Z = ux, uy, uz
outfile.write('%11.8e' % X+' '+'%11.8e' % Y+' '+'%11.8e' % Z+'\n') outfile.write('%11.8e' % X+' '+'%11.8e' % Y+' '+'%11.8e' % Z+'\n')
outfile.write("</DataArray>"+'\n') outfile.write("</DataArray>"+'\n')
# </DataArray>
def A(acceleration, outfile, reop_N): def A(acceleration, outfile, stg_n):
# Access Spatial acceleration # Access Spatial acceleration
fieldValues = acceleration.values fieldValues = acceleration.values
for valueX in fieldValues: for valueX in fieldValues:
@ -29,14 +28,13 @@ def A(acceleration, outfile, reop_N):
# Spatial acceleration, <DataArray> # Spatial acceleration, <DataArray>
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Spatial_acceleration" + outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Spatial_acceleration" +
'"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') '"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_N: for i in stg_n:
X, Y, Z = ax, ay, az X, Y, Z = ax, ay, az
outfile.write('%11.8e' % X+' '+'%11.8e' % Y+' '+'%11.8e' % Z+'\n') outfile.write('%11.8e' % X+' '+'%11.8e' % Y+' '+'%11.8e' % Z+'\n')
outfile.write("</DataArray>"+'\n') outfile.write("</DataArray>"+'\n')
# </DataArray>
def V(velocity, outfile, reop_N): def V(velocity, outfile, stg_n):
# Access Spatial velocity # Access Spatial velocity
fieldValues = velocity.values fieldValues = velocity.values
for valueX in fieldValues: for valueX in fieldValues:
@ -46,14 +44,13 @@ def V(velocity, outfile, reop_N):
# Spatial velocity, <DataArray> # Spatial velocity, <DataArray>
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Spatial_velocity" + outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Spatial_velocity" +
'"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') '"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_N: for i in stg_n:
X, Y, Z = vx, vy, vz X, Y, Z = vx, vy, vz
outfile.write('%11.8e' % X+' '+'%11.8e' % Y+' '+'%11.8e' % Z+'\n') outfile.write('%11.8e' % X+' '+'%11.8e' % Y+' '+'%11.8e' % Z+'\n')
outfile.write("</DataArray>"+'\n') outfile.write("</DataArray>"+'\n')
# </DataArray>
def RF(Reaction_force, outfile, reop_N): def RF(Reaction_force, outfile, stg_n):
# Access Reaction force # Access Reaction force
fieldValues = Reaction_force.values fieldValues = Reaction_force.values
for valueX in fieldValues: for valueX in fieldValues:
@ -63,14 +60,13 @@ def RF(Reaction_force, outfile, reop_N):
# Reaction force # Reaction force
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Reaction_force" + outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Reaction_force" +
'"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') '"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_N: for i in stg_n:
X, Y, Z = rfx, rfy, rfz X, Y, Z = rfx, rfy, rfz
outfile.write('%11.8e' % X+' '+'%11.8e' % Y+' '+'%11.8e' % Z+'\n') outfile.write('%11.8e' % X+' '+'%11.8e' % Y+' '+'%11.8e' % Z+'\n')
outfile.write("</DataArray>"+'\n') outfile.write("</DataArray>"+'\n')
# </DataArray>
def PEEQ(Equivalent_plastic_strain, outfile, reop_N): def PEEQ(Equivalent_plastic_strain, outfile, stg_n):
# Equivalent plastic strain # Equivalent plastic strain
node_Equivalent_plastic_strain = Equivalent_plastic_strain.getSubs( node_Equivalent_plastic_strain = Equivalent_plastic_strain.getSubs(
position=ELEMENT_NODAL) position=ELEMENT_NODAL)
@ -80,14 +76,13 @@ def PEEQ(Equivalent_plastic_strain, outfile, reop_N):
# Equivalent plastic strain, <DataArray> # Equivalent plastic strain, <DataArray>
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name=" + outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name=" +
'"'+"Equivalent_plastic_strain"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') '"'+"Equivalent_plastic_strain"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_N: for i in stg_n:
pd = PEEQ_data pd = PEEQ_data
outfile.write('%11.8e' % pd+'\n') outfile.write('%11.8e' % pd+'\n')
outfile.write('</DataArray>'+'\n') outfile.write('</DataArray>'+'\n')
# </DataArray>
def Stress(Stress, outfile, reop_N): def Stress(Stress, outfile, stg_n):
# access Stress components # access Stress components
node_Stress = Stress.getSubset(position=ELEMENT_NODAL) node_Stress = Stress.getSubset(position=ELEMENT_NODAL)
fieldValues = node_Stress.values fieldValues = node_Stress.values
@ -109,27 +104,28 @@ def Stress(Stress, outfile, reop_N):
# Stress components, <DataArray> # Stress components, <DataArray>
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Components" + outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Components" +
'"'+" "+"NumberOfComponents="+'"'+"9"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') '"'+" "+"NumberOfComponents="+'"'+"9"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_N: for i in stg_n:
XX, XY, XZ, YX, YY, YZ, ZX, ZY, ZZ = s11, s12, s13, s12, s22, s23, s13, s23, s33 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' % 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') YY+' '+'%11.8e' % YZ+' '+'%11.8e' % ZX+' '+'%11.8e' % ZY+' '+'%11.8e' % ZZ+'\n')
outfile.write("</DataArray>"+'\n') outfile.write("</DataArray>"+'\n')
# </DataArray>
def NT11(Temperature, outfile, reop_N): def NT11(Temperature, outfile, stg_n):
# Equivalent plastic strain # Equivalent plastic strain
fieldValues = Temperature.values fieldValues = Temperature.values
for valueX in fieldValues: NT11_data = []
NT11_data = valueX.data
# Equivalent plastic strain, <DataArray>
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" " + outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" " +
"Name="+'"'+"Temperature"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') "Name="+'"'+"Temperature"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_N:
temp = NT11_data for valueX in fieldValues:
outfile.write('%11.8e' % temp+'\n') # 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') outfile.write('</DataArray>'+'\n')
# </DataArray>
# print "Reading U, A, V, RF ......" # print "Reading U, A, V, RF ......"
# time1 = time() # time1 = time()
@ -244,7 +240,7 @@ def NT11(Temperature, outfile, reop_N):
# Logarithmic_strain_Max_Principal, <DataArray> # Logarithmic_strain_Max_Principal, <DataArray>
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Logarithmic_strain_Max_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') # outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Logarithmic_strain_Max_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
# for i in reop_N: # for i in stg_n:
# k = node[stg_n[i]].label-1 # k = node[stg_n[i]].label-1
# X = L2[k][7] # X = L2[k][7]
# outfile.write('%11.8e'%X+'\n') # outfile.write('%11.8e'%X+'\n')
@ -253,7 +249,7 @@ def NT11(Temperature, outfile, reop_N):
# #Logarithmic strain Min.Principal, <DataArray> # #Logarithmic strain Min.Principal, <DataArray>
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Logarithmic_strain_Min_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') # outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Logarithmic_strain_Min_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
# for i in reop_N: # for i in stg_n:
# k = node[stg_n[i]].label-1 # k = node[stg_n[i]].label-1
# X = L2[k][8] # X = L2[k][8]
# outfile.write('%11.8e'%X+'\n') # outfile.write('%11.8e'%X+'\n')
@ -262,7 +258,7 @@ def NT11(Temperature, outfile, reop_N):
# Plastic strain Max.Principal, <DataArray> # Plastic strain Max.Principal, <DataArray>
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Plastic_strain_Max_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') # outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Plastic_strain_Max_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
# for i in reop_N: # for i in stg_n:
# k = node[stg_n[i]].label-1 # k = node[stg_n[i]].label-1
# X = L3[k][7] # X = L3[k][7]
# outfile.write('%11.8e'%X+'\n') # outfile.write('%11.8e'%X+'\n')
@ -271,7 +267,7 @@ def NT11(Temperature, outfile, reop_N):
# #Plastic strain Min.Principal, <DataArray> # #Plastic strain Min.Principal, <DataArray>
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Plastic_strain_Min_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') # outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Plastic_strain_Min_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
# for i in reop_N: # for i in stg_n:
# k = node[stg_n[i]].label-1 # k = node[stg_n[i]].label-1
# X = L3[k][8] # X = L3[k][8]
# outfile.write('%11.8e'%X+'\n') # outfile.write('%11.8e'%X+'\n')
@ -280,7 +276,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Mises, <DataArray> # #Stress Mises, <DataArray>
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Mises"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') # outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Mises"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
# for i in reop_N: # for i in stg_n:
# k = node[stg_n[i]].label-1 # k = node[stg_n[i]].label-1
# X = smises # X = smises
# outfile.write('%11.8e'%X+'\n') # outfile.write('%11.8e'%X+'\n')
@ -289,7 +285,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Max.Principal, <DataArray> # #Stress Max.Principal, <DataArray>
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Max_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') # outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Max_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
# for i in reop_N: # for i in stg_n:
# k = node[stg_n[i]].label-1 # k = node[stg_n[i]].label-1
# X = maxPrincipal # X = maxPrincipal
# outfile.write('%11.8e'%X+'\n') # outfile.write('%11.8e'%X+'\n')
@ -298,7 +294,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Mid.Principal, <DataArray> # #Stress Mid.Principal, <DataArray>
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Mid_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') # outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Mid_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
# for i in reop_N: # for i in stg_n:
# k = node[stg_n[i]].label-1 # k = node[stg_n[i]].label-1
# X = midPrincipal # X = midPrincipal
# outfile.write('%11.8e'%X+'\n') # outfile.write('%11.8e'%X+'\n')
@ -307,7 +303,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Min.Principal, <DataArray> # #Stress Min.Principal, <DataArray>
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Min_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') # outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Min_Principal"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
# for i in reop_N: # for i in stg_n:
# k = node[stg_n[i]].label-1 # k = node[stg_n[i]].label-1
# X = minPrincipal # X = minPrincipal
# outfile.write('%11.8e'%X+'\n') # outfile.write('%11.8e'%X+'\n')
@ -316,7 +312,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Pressure, <DataArray> # #Stress Pressure, <DataArray>
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Pressure"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') # outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Pressure"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
# for i in reop_N: # for i in stg_n:
# k = node[stg_n[i]].label-1 # k = node[stg_n[i]].label-1
# X = press # X = press
# outfile.write('%11.8e'%X+'\n') # outfile.write('%11.8e'%X+'\n')
@ -325,7 +321,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Tresca, <DataArray> # #Stress Tresca, <DataArray>
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Tresca"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') # outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Tresca"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
# for i in reop_N: # for i in stg_n:
# k = node[stg_n[i]].label-1 # k = node[stg_n[i]].label-1
# X = tresca # X = tresca
# outfile.write('%11.8e'%X+'\n') # outfile.write('%11.8e'%X+'\n')
@ -334,7 +330,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Third_Invariant, <DataArray> # #Stress Third_Invariant, <DataArray>
# outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Third_Invariant"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n') # outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Third_Invariant"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
# for i in reop_N: # for i in stg_n:
# k = node[stg_n[i]].label-1 # k = node[stg_n[i]].label-1
# X = inv3 # X = inv3
# outfile.write('%11.8e'%X+'\n') # outfile.write('%11.8e'%X+'\n')

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save