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

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
-
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) #SMISC13FYI, 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.
- import mech_dpf
- import Ans.DataProcessing as dpf
- op = dpf.operators.result.smisc() # operator instantiation
- op.inputs.time_scoping.Connect(my_time_scoping)# optional
- op.inputs.mesh_scoping.Connect(my_mesh_scoping)# optional
- op.inputs.fields_container.Connect(my_fields_container)# optional
- op.inputs.streams_container.Connect(my_streams_container)# optional
- op.inputs.data_sources.Connect(my_data_sources)
- op.inputs.bool_rotate_to_global.Connect(my_bool_rotate_to_global)# optional
- op.inputs.mesh.Connect(my_mesh)# optional
- op.inputs.item_index.Connect(my_item_index)# optional
- op.inputs.num_components.Connect(my_num_components)# optional
- op.inputs.read_cyclic.Connect(my_read_cyclic)# optional
- my_fields_container = op.outputs.fields_container.GetData()
0 -
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:
- analysis = ExtAPI.DataModel.Project.Model.Analyses[0]
- reader = analysis.GetResultsData()
- 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.
- import mech_dpf
- import Ans.DataProcessing as dpf
- elem_id = 123
- analysis = ExtAPI.DataModel.Project.Model.Analyses[0]
- dataSources = dpf.DataSources()
- dataSources.SetResultFilePath(analysis.ResultFileName)
- elem_scoping = dpf.Scoping()
- elem_scoping.Ids = [elem_id]
- elem_scoping.Location = 'Elemental'
- op_smisc = dpf.operators.result.smisc()
- op_smisc.inputs.data_sources.Connect(dataSources)
- op_smisc.inputs.mesh_scoping.Connect(elem_scoping)
- op_smisc.inputs.item_index.Connect(13)
- elem_smisc = op_smisc.outputs.fields_container.GetData()
- pressure = elem_smisc[0].Data
- 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?
- import mech_dpf
- import Ans.DataProcessing as dpf
- analysis = ExtAPI.DataModel.Project.Model.Analyses[0]
- dataSources = dpf.DataSources()
- dataSources.SetResultFilePath(analysis.ResultFileName)
- op_scope_et = dpf.operators.scoping.on_property()
- op_scope_et.inputs.data_sources.Connect(dataSources)
- op_scope_et.inputs.requested_location.Connect('Elemental')
- op_scope_et.inputs.property_name.Connect('mapdl_element_type')
- op_scope_et.inputs.property_id.Connect(154)
- scoping_et = op_scope_et.outputs.getmesh_scoping()
- 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?
0