How to get stress values along a path using DPF considering element orientations defined on body?

Kev Member Posts: 41
5 Likes First Comment Name Dropper
edited June 2023 in Structures

Hi guys

Would need help understand how to retrieve stress tensor values on a path considering: element orientations the are defined in the associated body, layer, and position . Similar to a user plot defined on a path:

I have developed the module to retrieve the nodes on the path and I have a named selection of the corresponding bodies. so basically i would like to see how to get SX,SY,SZ ,... using DPF (for example:

import mech_dpf

import Ans.DataProcessing as dpf


dataSource = dpf.DataSources(analysis.ResultFileName)

SX = dpf.operators.result.stress_X

Any help in this regard is highly appreciated guys. :)



  • Kev
    Kev Member Posts: 41
    5 Likes First Comment Name Dropper

    Hi @Mike.Thompson . Sorry to grab your attention this way. Any chance you could help out with this or give me a hint as to where to start looking? Have been held up by this section of my task and could not progress in a while. I have been using a work around which is obtaining the data using user plots. this is alright but as the number of plots and welds increases, it takes a ling time to cycle through steps and update plots at each iteration.

    Would appreciate the help a lot.


  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 240
    First Anniversary First Comment 5 Likes Ansys Employee


    You should be able to use the stress operator for the tensor component (of just stress for the entire tensor). The stress is calculated in the local elemental system in the results file. By default the dpf operators will rotate the values to the global frame, but you can turn this off and leave it in the local elemental system, thus referencing the element orientation.

    This is equal to selecting the "Solution" CS in a mechanical solution native object.

    Since you have the named selection you can set the mesh scoping based on that, and do the time scoping per your desired time points.

    op = dpf.operators.result.stress_X() # operator instantiation
    op.inputs.bool_rotate_to_global.Connect(False)# This will keep the values in the elemental (Solution) CS