stress_von_mises Operator with nodal stress order of output

Hi

I am working on script that have to extract data - node ids, coordinates, displacement and Von misses stress to csv. As coordinates and displacement works fine, stress seems to be working differently, order of output is different - not sorted by node ids.
below is part of the code that is extracting stress.

 stress_von_mises = ops.result.stress_von_mises(data_sources=model)
    # Restrict scoping to named selection
    stress_von_mises.inputs.mesh_scoping.connect(nodal_scope)
    stress_von_mises.inputs.time_scoping.connect(LS)
    stress_von_mises.inputs.requested_location.connect('Nodal')
fields_stress=np.asmatrix(stress_von_mises.outputs.fields_container.get_data()[0].data)

While i am using above method first element of array is not a stress at first node that i am extracting from scoping with method as below.

node_ids=nodal_scope.ids

While i am using same methodology for displacement it works fine. I don't understand why this is happening with stress.

displacement = ops.result.displacement(data_sources=model)
    # Restrict scoping to named selection
    displacement.inputs.mesh_scoping.connect(nodal_scope)
    displacement.inputs.time_scoping.connect(LS)
fields_disp=np.asmatrix(displacement.outputs.fields_container.get_data()[0].data)

Do you know how i can retrieve the order that stress are written into the field ?

as the code need to be efficient i can't use extraction with for loop and extracting by one node at the time (get_entity_data_by_id for example)

Tagged:

Answers

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 367
    25 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    How do you know the “correct” order of the calculated values? Are you matching values with some other validated method?
    If you have a reproducible case of the values not matching the order of the nodal scoping ids this should be filed as a defect.

  • kacper.J
    kacper.J Member Posts: 4
    Name Dropper First Comment
    **

    so i know a nodes from node_ids=nodal_scope.ids i am using for displacement and data written from DPF match with result i am taking from APDL, but while i am taking the first data from stress field its not the same as in apdl for first node at node_ids=nodal_scope.ids

    anyway i found a way to extract node ids directly from field container and it solved a problem in this way order of ids match with order of stress

    stress_von_mises.outputs.fields_container()[0].scoping.ids[0]