DPF Error: The Label Space Request in this collection has more than one entry

I am currently working with a model that has a "surface coating" applied in Mechanical and trying to pull results using the DPF.

Essentially it appears the DPF is pulling two different element shapes from my selected mesh ids (most likely both the 3D elements on the part and the 2D shells created by the surface coating).

Is there a specific command that needs to be used to specify the shape when pulling values using DPF? I don't see a way to specify the specific shape type with "GetFieldByTimeId". The documentation has a "requested location" option, but its input is a string which is a little confusing what should be entered.

 
        stress_op = dpf.operators.result.stress_principal_1()
        stress_op.inputs.mesh_scoping.Connect(node_scoping)
        stress_op.inputs.data_sources.Connect(data_sources)
        stress_op.inputs.streams_container.Connect(streams_container)
        stress_op.inputs.time_scoping.Connect(time_scoping)
        stress_fields_container = stress_op.outputs.fields_container.GetData()

Answers

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

    I assume you want the stresses on the surface elements. You can get rid of the multiple element shapes by using a mesh scoping that is set to only the Ids of the surface elements. You should also set the location property of the scoping to be elemental.

    You can still request nodal, elemental, or element-nodal results, but the mesh scoping is elemental as you only want the results from the surface elements.

    Below is an example of requesting the nodal averaged stresses of ONLY a particular surface element. You could use the list of all surface element Ids to expand to all the 2D elements.

    Op=dpf.operators.result.stress_von_mises()
    Op.inputs.data_sources.Connect(DataSource)
    Op.inputs.requested_location.Connect(dpf.locations.nodal)
    TimeScoping = dpf.Scoping()
    TimeScoping.Ids = [TimeId]
    Op.inputs.time_scoping.Connect(TimeScoping)
    MeshScoping=dpf.Scoping()
    MeshScoping.Location = dpf.locations.elemental
    MeshScoping.Ids=[ElemId]
    Op.inputs.mesh_scoping.Connect(MeshScoping)
    FC = Op.outputs.fields_container.GetData()
    
    

    Here is also a useful snippet to get the element ids from a surface coating object in the tree since those elements don't exist in Mechanical. Assumes the first analysis and an object named "Surface Coating"

    #Get the APDL material ID of the coating
    Analysis=Model.Analyses[0]
    SolverData = Analysis.Solution.SolverData
    Coating = ExtAPI.DataModel.GetObjectsByName("Surface Coating")[0]
    Data = SolverData.GetObjectData(Coating)
    MatId = Data.MaterialId
    
    
    #Use the material ID to get the element scoping
    DataSource = dpf.DataSources(Analysis.ResultFileName)
    scop_ename = dpf.operators.scoping.on_property()
    scop_ename.inputs.data_sources.Connect(DataSource)
    scop_ename.inputs.requested_location.Connect('Elemental')
    scop_ename.inputs.property_name.Connect('material')
    scop_ename.inputs.property_id.Connect(MatId)
    my_mesh_scoping = scop_ename.outputs.mesh_scoping.GetData()
    print(list(my_mesh_scoping.Ids))
    


  • dafedin
    dafedin Member Posts: 21
    10 Comments First Anniversary Name Dropper
    **
    edited September 2023

    In this case, do I get results on shell elements in the local (elemental) coordinate system? if so, how do I translate results to a global coordinate system? Can I use the following DPF operator for this purpose:
    dpf.operators.result.stress_rotation_by_euler_nodes()