stinger4762
Mechanical
- Nov 12, 2016
- 7
Hi all,
I'm trying to transform displacements from the global coordinate system to a user-defined one, however the untransformed and transformed values are the same.
Here's the idea: I have an object that moves in every frame, and I want to find the displacements of that object with respect to another point that is also moving.
Here's the script:
Any help would be fantastic.
Thanks
I'm trying to transform displacements from the global coordinate system to a user-defined one, however the untransformed and transformed values are the same.
Here's the idea: I have an object that moves in every frame, and I want to find the displacements of that object with respect to another point that is also moving.
Here's the script:
Python:
from odbAccess import *
from abaqusConstants import *
import numpy as np
################################user-defined parameters###################################
#user-defined parameters
odb = openOdb(path='C:\Temp\\1704_full_5mm_1.odb')
myAssembly = odb.rootAssembly
subset_csys = myAssembly.instances['PUNCH_BOLSTER-1'].nodeSets['RP']
subset = myAssembly.instances['PUNCH-1'].nodeSets['ALL']
var = 'U'
###########################################################################################
with open('test_transform.txt','w') as f:
for step in odb.steps.values():
print 'Processing Step: ', step.name
for frame in step.frames:
print 'Processing Frame: ', frame.frameId
var_max = 0
node_max = 0
#setting up a new coordinate system to ransform the field outputs
#finding the origin of the coordinate system
csys_data_temp = frame.fieldOutputs['U'].getSubset(region=subset_csys).values[-1]
origin_coords = csys_data_temp.instance.nodes[csys_data_temp.nodeLabel-1].coordinates[0:2] + csys_data_temp.dataDouble #v.data or v.dataDouble if single or full precision was used
#as this is a 2D simulation, we need to add the z-value for the coordinate system
origin_coords = np.append(origin_coords,[0])
#point1 coordinates will be parallel to the x-axis
point1_coords = origin_coords + np.array([1,0,0])
#point2 coordinates will be parallel to the x-axis
point2_coords = origin_coords + np.array([0,1,0])
#defining the new coordinate system
myAssembly.DatumCsysByThreePoints(name='csys_transform',
coordSysType=CARTESIAN,
origin=(origin_coords[0],origin_coords[1],origin_coords[2]),
point1=(point1_coords[0],point1_coords[1],point1_coords[2]),
point2=(point2_coords[0],point2_coords[1],point2_coords[2]))
csys_transform = myAssembly.datumCsyses['csys_transform']
print csys_transform.origin
var_set = frame.fieldOutputs['U'].getSubset(region=subset).getTransformedField(datumCsys=csys_transform)
for v in var_set.values:
if v.magnitude > var_max:
var_max = v.magnitude
node_max = v.nodeLabel
#print 'Maximum displacement is %f for node %d'%(var_max, node_max)
f.write(str(var_max)+'\n')
Any help would be fantastic.
Thanks