×
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

Creating new Field in ODB File

Creating new Field in ODB File

Creating new Field in ODB File

(OP)
Hi,
I am trying to create new field in ODB file. But for testing purpose, I just decided to read "old" stress field and re-create it as new one. So, I read S23 from ODB, create array (Element label, time, stress 23), and create new Field with the same values.
When I print out the values (Elt number, Stress), I have the same values.
But the contours look different.

Can anyone help?

Leon
#Opening ODB
odb = openOdb(path='out34.odb')
step1 = odb.steps['Step-1']
frames = odb.steps['Step-1'].frames
numFrames = len(frames)
lastFrame = odb.steps['Step-1'].frames[-1]
myInstance = odb.rootAssembly.instances['BOX-1']
numNodes = len(myInstance.nodes)
numElements = len(myInstance.elements)
# Nodes and elements
N = myInstance.nodes
EL = myInstance.elements
#-Creating Array of 3 columns: Ti
ncolum=3
strehi=np.empty((ncolum, numElements*numFrames), dtype=object)
Nums=0.
for x in odb.steps['Step-1'].frames:Element No, Step Time, Stress S23
currentsteptime = x.frameValue
print ' Time/Incr is ', currentsteptime, x.incrementNumber
stress=x.fieldOutputs['S'].getSubset(position=CENTROID)
maxstr=0.
nustr=0.
for S in stress.values:
strehi [1, Nums*numElements+nustr]=currentsteptime
strehi [0, Nums*numElements+nustr]=S.elementLabel
s11=S.data[0]
s13=S.data[5]
strehi [2, Nums*numElements+nustr]=s23
nustr=nustr+1
Nums=Nums+1
# Adding new Field to ODB
field1 = lastFrame.FieldOutput(name='Mgu04', description='none', type=SCALAR)
elmdata=()
elmNo=[]
elmdata=[(strehi [2, index],) for index in range(numElements*(numFrames-1), numElements*numFrames)]
for index in range(numElements):
ind2=index+numElements*(numFrames-1)
elmNo.append(index+1)
val2=strehi [2, ind2]
field1.addData(position=CENTROID, instance=myInstance, labels=elmNo, data=elmdata)

RE: Creating new Field in ODB File

Make a small example, check that the script is running with that example and then post the two files.

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