misplaced node fixed

main
harvo 2 years ago
parent 9d98d9f08a
commit 767c529040

3
.gitignore vendored

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

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

@ -1,7 +1,7 @@
# Vector-U,A,V,RF
# Tensors-S
# Scalars-PEEQ
def U(displacement, outfile, reop_N):
def U(displacement, outfile, stg_n):
# Access Spatial displacement
fieldValues = displacement.values
for valueX in fieldValues:
@ -12,14 +12,13 @@ def U(displacement, outfile, reop_N):
# Spatial displacement, <DataArray>
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Spatial_displacement" +
'"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_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')
# </DataArray>
def A(acceleration, outfile, reop_N):
def A(acceleration, outfile, stg_n):
# Access Spatial acceleration
fieldValues = acceleration.values
for valueX in fieldValues:
@ -29,14 +28,13 @@ def A(acceleration, outfile, reop_N):
# Spatial acceleration, <DataArray>
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Spatial_acceleration" +
'"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_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')
# </DataArray>
def V(velocity, outfile, reop_N):
def V(velocity, outfile, stg_n):
# Access Spatial velocity
fieldValues = velocity.values
for valueX in fieldValues:
@ -46,14 +44,13 @@ def V(velocity, outfile, reop_N):
# Spatial velocity, <DataArray>
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Spatial_velocity" +
'"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_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')
# </DataArray>
def RF(Reaction_force, outfile, reop_N):
def RF(Reaction_force, outfile, stg_n):
# Access Reaction force
fieldValues = Reaction_force.values
for valueX in fieldValues:
@ -63,14 +60,13 @@ def RF(Reaction_force, outfile, reop_N):
# Reaction force
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Reaction_force" +
'"'+" "+"NumberOfComponents="+'"'+"3"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_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')
# </DataArray>
def PEEQ(Equivalent_plastic_strain, outfile, reop_N):
def PEEQ(Equivalent_plastic_strain, outfile, stg_n):
# Equivalent plastic strain
node_Equivalent_plastic_strain = Equivalent_plastic_strain.getSubs(
position=ELEMENT_NODAL)
@ -80,14 +76,13 @@ def PEEQ(Equivalent_plastic_strain, outfile, reop_N):
# Equivalent plastic strain, <DataArray>
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name=" +
'"'+"Equivalent_plastic_strain"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_N:
for i in stg_n:
pd = PEEQ_data
outfile.write('%11.8e' % pd+'\n')
outfile.write('</DataArray>'+'\n')
# </DataArray>
def Stress(Stress, outfile, reop_N):
def Stress(Stress, outfile, stg_n):
# access Stress components
node_Stress = Stress.getSubset(position=ELEMENT_NODAL)
fieldValues = node_Stress.values
@ -109,27 +104,28 @@ def Stress(Stress, outfile, reop_N):
# Stress components, <DataArray>
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" "+"Name="+'"'+"Stress_Components" +
'"'+" "+"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
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')
# </DataArray>
def NT11(Temperature, outfile, reop_N):
def NT11(Temperature, outfile, stg_n):
# Equivalent plastic strain
fieldValues = Temperature.values
for valueX in fieldValues:
NT11_data = valueX.data
# Equivalent plastic strain, <DataArray>
NT11_data = []
outfile.write("<"+"DataArray"+" "+"type="+'"'+"Float32"+'"'+" " +
"Name="+'"'+"Temperature"+'"'+" "+"format="+'"'+"ascii"+'"'+">"+'\n')
for i in reop_N:
temp = NT11_data
outfile.write('%11.8e' % temp+'\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')
# </DataArray>
# print "Reading U, A, V, RF ......"
# time1 = time()
@ -244,7 +240,7 @@ def NT11(Temperature, outfile, reop_N):
# Logarithmic_strain_Max_Principal, <DataArray>
# 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
# X = L2[k][7]
# outfile.write('%11.8e'%X+'\n')
@ -253,7 +249,7 @@ def NT11(Temperature, outfile, reop_N):
# #Logarithmic strain Min.Principal, <DataArray>
# 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
# X = L2[k][8]
# outfile.write('%11.8e'%X+'\n')
@ -262,7 +258,7 @@ def NT11(Temperature, outfile, reop_N):
# Plastic strain Max.Principal, <DataArray>
# 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
# X = L3[k][7]
# outfile.write('%11.8e'%X+'\n')
@ -271,7 +267,7 @@ def NT11(Temperature, outfile, reop_N):
# #Plastic strain Min.Principal, <DataArray>
# 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
# X = L3[k][8]
# outfile.write('%11.8e'%X+'\n')
@ -280,7 +276,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Mises, <DataArray>
# 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
# X = smises
# outfile.write('%11.8e'%X+'\n')
@ -289,7 +285,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Max.Principal, <DataArray>
# 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
# X = maxPrincipal
# outfile.write('%11.8e'%X+'\n')
@ -298,7 +294,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Mid.Principal, <DataArray>
# 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
# X = midPrincipal
# outfile.write('%11.8e'%X+'\n')
@ -307,7 +303,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Min.Principal, <DataArray>
# 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
# X = minPrincipal
# outfile.write('%11.8e'%X+'\n')
@ -316,7 +312,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Pressure, <DataArray>
# 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
# X = press
# outfile.write('%11.8e'%X+'\n')
@ -325,7 +321,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Tresca, <DataArray>
# 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
# X = tresca
# outfile.write('%11.8e'%X+'\n')
@ -334,7 +330,7 @@ def NT11(Temperature, outfile, reop_N):
# #Stress Third_Invariant, <DataArray>
# 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
# X = inv3
# outfile.write('%11.8e'%X+'\n')

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