How to get the average stress weighted by element area over an entire named selection?

maxfirkowski_safran Member Posts: 1
edited May 24 in Structures

Hi, I need to get the average stress value (normal in the z-direction) for an entire 2d named selection in ANSYS Mechanical. The way i wanted to implement it in Python Result was to sum up forces action on each element and then divide it by the total geometry area. Here is a pseudo code of how i wanted to implement it:

_total_internal_force = 0

for my_element in all_elements_in_selection {
total_internal_force += my_element.average_stress_in_z * my_element.area

average_stress = total_internal_force / total_selection_area_

The problem is that I have no idea how to implement it in python results, as I have been unsuccessful at finding any information about operating on stress tensors with iron python in ansys documentation. Could someone help me implement this?