ACT Python: How to get SMISC items from RST file?

Member Posts: 2
First Comment
**

How could I get SMISC items from RST file by ACT Python? Let's say I have applied pressure by SURF154 elements and I would like to get contour of average pressure on element which is stored in SMISC13.

Answers

  • Member, Employee Posts: 390
    25 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited April 8

    There is a DPF operator for SMISC you can generally use for any of these. Mesh scoping should be on the SURF154 elements of interest and you can get any time points you want with the time scoping options. I believe the "item_index" would be like this:
    op.inputs.item_index.Connect(13) #SMISC13

    FYI, you can also use a user defined result with expression = 'SMISC13'. This is a non-scripting solution that you can use from the UI if you only want the contours in an object. Otherwise you can use a python results object or ACT object with the DPF script.

    1. import mech_dpf
    2. import Ans.DataProcessing as dpf
    3.  
    4. op = dpf.operators.result.smisc() # operator instantiation
    5. op.inputs.time_scoping.Connect(my_time_scoping)# optional
    6. op.inputs.mesh_scoping.Connect(my_mesh_scoping)# optional
    7. op.inputs.fields_container.Connect(my_fields_container)# optional
    8. op.inputs.streams_container.Connect(my_streams_container)# optional
    9. op.inputs.data_sources.Connect(my_data_sources)
    10. op.inputs.bool_rotate_to_global.Connect(my_bool_rotate_to_global)# optional
    11. op.inputs.mesh.Connect(my_mesh)# optional
    12. op.inputs.item_index.Connect(my_item_index)# optional
    13. op.inputs.num_components.Connect(my_num_components)# optional
    14. op.inputs.read_cyclic.Connect(my_read_cyclic)# optional
    15. my_fields_container = op.outputs.fields_container.GetData()
  • Member Posts: 2
    First Comment
    **

    Hi Mike,

    thank you for your reply. I am aware about the possibility I can use the User Defined Result with the expression = 'SMISC13'. Originally I was looking for any scripted solution, my question is related to more complex code.

    Does it mean that it is not possible to obtain SMISC data by ACT Reader? I do not see any of them in the ResultReaderWrapper object:

    1. analysis = ExtAPI.DataModel.Project.Model.Analyses[0]
    2. reader = analysis.GetResultsData()
    3. for name in reader.ResultNames: print(name)

    Dpf approach could be a solution for me but I am little bit struggling with scoping of SURF154 elements. If the SURF154 element is scoped by its element ID, everything is working fine.

    1. import mech_dpf
    2. import Ans.DataProcessing as dpf
    3.  
    4. elem_id = 123
    5.  
    6. analysis = ExtAPI.DataModel.Project.Model.Analyses[0]
    7. dataSources = dpf.DataSources()
    8. dataSources.SetResultFilePath(analysis.ResultFileName)
    9.  
    10. elem_scoping = dpf.Scoping()
    11. elem_scoping.Ids = [elem_id]
    12. elem_scoping.Location = 'Elemental'
    13.  
    14. op_smisc = dpf.operators.result.smisc()
    15. op_smisc.inputs.data_sources.Connect(dataSources)
    16. op_smisc.inputs.mesh_scoping.Connect(elem_scoping)
    17. op_smisc.inputs.item_index.Connect(13)
    18.  
    19. elem_smisc = op_smisc.outputs.fields_container.GetData()
    20. pressure = elem_smisc[0].Data
    21. print(pressure)

    However if I want to scope surface elements based on the APDL element type, I receive an empty field. Note that the same code works correctly for scoping of SHELL181 elements for example. What am I doing wrong in this Dpf code?

    1. import mech_dpf
    2. import Ans.DataProcessing as dpf
    3.  
    4. analysis = ExtAPI.DataModel.Project.Model.Analyses[0]
    5. dataSources = dpf.DataSources()
    6. dataSources.SetResultFilePath(analysis.ResultFileName)
    7.  
    8. op_scope_et = dpf.operators.scoping.on_property()
    9. op_scope_et.inputs.data_sources.Connect(dataSources)
    10. op_scope_et.inputs.requested_location.Connect('Elemental')
    11. op_scope_et.inputs.property_name.Connect('mapdl_element_type')
    12. op_scope_et.inputs.property_id.Connect(154)
    13. scoping_et = op_scope_et.outputs.getmesh_scoping()
    14. print(scoping_et)

    Maybe last additional question, just for my curiosity. Expecting that the ACT ResultReaderWrapper does not return SMISC data; how the User Defined Result obtain this data from RST file? Is there any hidden API on this object for that?

Welcome!

It looks like you're new here. Sign in or register to get started.