Getting information on elements in PyDPF

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
100 Answers 500 Comments 250 Likes First Anniversary
✭✭✭✭
edited June 2023 in Structures

In PyDPF, how can I get:

  • the APDL element type (ie SOLID185, PLANE182, ...)
  • the APDL element type id (ie getting  the "1" value in et,1,185)
Tagged:

Best Answer

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭
    Answer ✓

    For the APDL element type, use:

    import ansys.dpf.core as dpf
    model = dpf.Model(r"c:\temp\file.rst")
    mesh = model.metadata.meshed_region
    mesh.available_property_fields
    field = mesh.property_field("apdl_element_type")
    

    For the APDL element type id, use:

    op = dpf.operators.metadata.property_field_provider_by_name()
    op.inputs.streams_container.connect(model.metadata.streams_provider.outputs.streams_container)
    op.inputs.property_name.connect("mapdl_element_type_id")
    field = op.eval()
    field.data
    

Answers

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 361
    25 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited March 20

    FYI... for a list of element type ids in the results file you can use this: (mech DPF implementation)

    import mech_dpf
    import Ans.DataProcessing as dpf
    my_data_sources = dpf.DataSources(Model.Analyses[1].ResultFileName)
    op = dpf.operators.metadata.property_field_provider_by_name() # operator instantiation
    op.inputs.data_sources.Connect(my_data_sources)
    op.inputs.property_name.Connect('mapdl_element_type_id')
    my_property_field = op.outputs.property_field.GetData()
    Ids = set(my_property_field.Data)
    Ids