PyDPF: How to scope SURF154 elements and plot contour of applied load on them?

Tomas Musil
Tomas Musil Member Posts: 5
First Comment
**

Hi team,

Is it possible to scope surface elements SURF154 by PyDPF? Note the surface elements have been defined by APDL Snippet prior solution. Following code returns just one element type in my case - SHELL181. SURF154 is missing.

import Ans.DataProcessing as dpf

analysis = ExtAPI.DataModel.Project.Model.Analyses[0]
dataSources = dpf.DataSources(analysis.ResultFileName)
model = dpf.Model(dataSources)

mesh = model.Mesh
apdl_et = mesh.GetPropertyField('apdl_element_type')
apdl_et_list = set(apdl_et.Data)
print(apdl_et_list)

On the other hand, if ACT reader is used, both element types are present. I am also able to get a list of their element Ids.

model = ExtAPI.DataModel.Project.Model
analysis = model.Analyses[0]

reader = analysis.GetResultsData()
mesh = reader.CreateMeshData()
elem_ids = mesh.ElementIds

results = reader.GetResult('PNUM')
results.SelectComponents(['ENAM'])

elem_names = set([results.GetElementValues(elem_id) for elem_id in elem_ids])
print(elem_names)

surf_ids = [elem_ids[index] for index, elem_name in enumerate(elem_names) if elem_name[0] == 154]
surf_ids.sort()

reader.Dispose()

Could be the list of surface element Ids used in some way for getting a contour of applied on load on these elements by Python Result?

Thank you for any hint.

Tagged:

Best Answer

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 391
    100 Likes 25 Answers 100 Comments Second Anniversary
    ✭✭✭✭
    edited April 15 Answer ✓

    I do not believe SURF154 elements are supported with DPF in this way as of 25.1.

    In the context of PyDPF you can also use PyMAPDL and get a list of the element ids from apdl scripting.
    In the context of mech_dpf you can use the results reader as you indicated to get a list of element ids

    results = reader.GetResult('PNUM')
    results.SelectComponents(['ENAM'])
    

    You can also in the future make a component for the elements with:

    ESEL,S,ENAME,,154
    CM,MySurfElems,ELEM
    ALLSEL
    

    You could then use the scoping operator based on named selections and it will work in current version:

    op = dpf.operators.scoping.on_named_selection()
    op.inputs.requested_location.Connect(dpf.locations.elemental)
    op.inputs.named_selection_name.Connect('MySurfElems'.upper())
    op.inputs.data_sources.Connect(dataSource)
    my_mesh_scoping = op.outputs.mesh_scoping.GetData()
    print my_mesh_scoping