Writing history output data

History output is output defined for a single point or for values calculated for a portion of the model as a whole, such as energy. Depending on the type of output expected, the historyRegions repository contains data from one of the following:

  • a node

  • an element, or a location in an element

  • a region

Note:

History data from an analysis cannot contain multiple points.

The output from all history requests that relate to a specified point is collected in one HistoryRegion object. You use the HistoryPoint constructor to create the point. For example,

point1 = HistoryPoint(element=instance1.elements[0])

For a full description of the HistoryPoint command, see HistoryPoint(...).

You then use the HistoryRegion constructor to create a HistoryRegion object:

step1 = odb.Step(name='step-1',  
    description='', domain=TIME, timePeriod=1.0)
h1 = step1.HistoryRegion(name='my history',
    description='my stuff',point=point1)

For a full description of the HistoryRegion command, see HistoryRegion(...).

You use the HistoryOutput constructor to add variables to the HistoryRegion object.

h1_u1 = h1.HistoryOutput(name='U1',
    description='Displacement', type=SCALAR)
h1_rf1 = h1.HistoryOutput(name='RF1',
    description='Reaction Force', type=SCALAR)


# Similarly for Step 2

step2 = odb.Step(name='step-2',  
    description='', domain=TIME, timePeriod=1.0)
h2 = step2.HistoryRegion(name='my history',
    description='my stuff', point=point1)
h2_u1 = h2.HistoryOutput(name='U1',
    description='Displacement', type=SCALAR)
h2_rf1 = h2.HistoryOutput(name='RF1',
    description='Reaction Force', type=SCALAR)

Each HistoryOutput object contains a sequence of (frameValue, value) sequences. The HistoryOutput object has a method (addData) for adding data. Each data item is a sequence of (frameValue, value). In a time domain analysis (domain=TIME) the sequence is (stepTime, value). In a frequency domain analysis (domain=FREQUENCY) the sequence is (frequency, value). In a modal domain analysis (domain=MODAL) the sequence is (mode, value).

You add the data values as time and data tuples. The number of data items must correspond to the number of time items. For example,

timeData = (0.0, 0.1, 0.3, 1.0)
u1Data = (0.0, 0.0004, 0.0067, 0.0514)
rf1Data = (27.456, 32.555, 8.967, 41.222)

h1_u1.addData(frameValue=timeData, value=u1Data)
h1_rf1.addData(frameValue=timeData, value=rf1Data)

# similar for step2

timeData = (1.2, 1.9, 3.0, 4.0)
u1Data = (0.8, 0.9, 1.3, 1.5)
rf1Data = (0.9, 1.1, 1.3, 1.5)

h2_u1.addData(frameValue=timeData, value=u1Data)
h2_rf1.addData(frameValue=timeData, value=rf1Data)