AEM 535 Basic script to write (temperature) data to an ODB file

preview_player
Показать описание


#write selected frame results for nodal temperatures to an ODB file
#or write nodal temperature from a file to an ODB file
#M. E. Barkey
# 14 December 2016

#with reference from python code from Mustaine
#and
#and

#some of these may not be needed, but I haven't taken the time to sort it out.
import sys
import csv
from odbAccess import *
from abaqusConstants import *
from types import IntType
from numpy import array
from numpy import genfromtxt
import numpy as np
import odbAccess

odbName = 'spt1b'
odb = openOdb(odbName + '.odb', readOnly=False)

#The following is the target ODB

print'------------------------------------------------'
print'Define step and frame to be read from existing ODB'
t = odbSelectResults

#these can be uncommented for some checks of the data
#print '-------------------------------------------'
#print t.__members__
#print '-------------------------------------------'

#note that this must be the part in your file

#the following lines write the entire frame of the first ODB into the target ODB
#the step name, desctription, etc, can all be changed here
newDataSet = odbSelectResults
newResultsStep=odbWrite.Step(name='TestStep3', description = 'user defined', domain=TIME, timePeriod = 0)
newResultsFrame=newResultsStep.Frame(incrementNumber=0, frameValue=0.0)
newResultsField=newResultsFrame.FieldOutput(name='NT11', description='user def', type=SCALAR)

#the following lines read a single column text file of nodes
#then reads a single column text file of corresponding temepatures
#note that the scalar field must be a "sequence of sequences"
#so it must look like this: ( (temp1,) , (temp2,), (temp3,), (temp4,) ... )
#and NOT this: (temp1, temp2, temp3, temp4,...)

#makes sure this is a tuple of integer nodes
n = map(int, nodes)

#this line reads in the temperature values. They must be sequentially corressponding to the nodes.
#it puts them in the proper format (sequence of sequence)


v = mylist

#print v

#the following is the format of the data that will work for 6 nodes
#meblabel = (41312, 41313, 41314, 41315, 41316, 41317)
#mebdata = ( (-100.0,), (-100.0,),(-100.0,),(-100.0,),(-100.0,),(-100.0,))

#un-comment the following line if you want the read-in data to go to a new step
#newResultsStep=odbWrite.Step(name='TestStep4', description = 'user defined', domain=TIME, timePeriod = 0)

newResultsFrame=newResultsStep.Frame(incrementNumber=1, frameValue=1.0)
newResultsField=newResultsFrame.FieldOutput(name='NT11', description='user def', type=SCALAR)

#this is to double check that the correct key has been created--it should be NT11
print '-------------------------------------------'
print '-------------------------------------------'

print
print '-------------------------------------------'

Рекомендации по теме
Комментарии
Автор

I will make a note here that running the script through ABAQUS CAE does not work (reason unknown). You will need to run it through the ABAQUS Command window.

mbarkey.mechanics