- Example 1: Get the maximum over time of the total deformation.
- Example 2: Get the average total deformation on all time steps.
Example 1: Maximum Over Time of the Total Deformation
Please note that this result is already available natively in Mechanical: Insert a Total Deformation result and change the “Definition/By” section to “Maximum Over Time”:


dataSource = dpf.DataSources(analysis.ResultFileName)
It is important to define the Time Scoping appropriately: by default, DPF will operate on the last time step only, and here we want to make sure all the time steps are considered so that for each node we get the maximum value on all the time steps. This can be achieved by checking the number of results sets and selecting them all.
For some operators such as the max_over_time_by_entity that is used here, the result will be a field container without any label. That would cause the Python Result to raise an error. To overcome this, a ‘time’ label should be added to the fields container.
Finally, to plot the results back on the model, the forward_field() method should be used to send the field to an operator to be able to plot it.
The complete script is as follows:

Example 2: Average Total Deformation on All Time Steps
Again, the chain of operators will be quite simple:
