×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

getTransformedField not working

getTransformedField not working

getTransformedField not working

(OP)
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:

CODE --> 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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources