How to get nodal forces or elemental nodal forces using DPF

Nick R
Nick R Member Posts: 12
First Answer 5 Likes First Comment
**
edited June 2023 in Structures

Has anyone been successful in extracting nodal force or elemental nodal force data using dpf? I created a small test model and ensured all data (nodal forces etc.) were written to the results file from workbench. I get the following error when trying to extract any elemental nodal forces:

ENF:288<-mapdl::rst::ENF:292<-mapdl::rst::ENF<-several layers not supported, failed to read element nodal forces from rst file. :line 50

In workbench I can get the forces using a custom result with ENFO or ENFOVECTORS, however dpf does not find them. Is there a trick such as adding an apdl command to save them? or is this feature not in dpf? or am I doing something wrong to extract them?

import mech_dpf as mech_dpf
import Ans.DataProcessing as dpf
mech_dpf.setExtAPI(ExtAPI)

analysis = ExtAPI.DataModel.AnalysisList[0]
path = analysis.WorkingDir + "file.rst"

# Data Sources
my_data_sources = dpf.DataSources(path)
model = dpf.Model(path)

# Time Scoping
op = dpf.operators.metadata.time_freq_provider()
op.inputs.data_sources.Connect(my_data_sources)
my_time_freq_support = op.outputs.time_freq_support.GetData()
my_time_scoping = my_time_freq_support.TimeFreqs

# Mesh
op = dpf.operators.mesh.mesh_provider()
op.inputs.data_sources.Connect(my_data_sources)
my_mesh = op.outputs.mesh.GetData()

# Scoping
op = dpf.operators.scoping.from_mesh()
op.inputs.mesh.Connect(my_mesh)
op.inputs.requested_location.Connect(dpf.locations.elemental_nodal)
my_scoping = op.outputs.scoping.GetData()

# Element Nodal Forces
op = dpf.operators.result.element_nodal_forces() 
op.inputs.time_scoping.Connect(my_time_scoping)
op.inputs.mesh_scoping.Connect(my_scoping)
op.inputs.data_sources.Connect(my_data_sources)
op.inputs.mesh.Connect(my_mesh)
my_fields_container = op.outputs.fields_container.GetData()
Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 467
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭

    Hi @Nick R ,

    Have you set the "Nodal Forces" to "Yes" under Analysis Settings?



  • Nick R
    Nick R Member Posts: 12
    First Answer 5 Likes First Comment
    **

    Hey Ayush!

    I did! I also checked the dpf model and it shows elemental nodal forces under available results. I am using version 2022R2.









  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 467
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭

    Hi Nick,

    The same code seems to work fine for me in 2022R2. I don't get any error when I extract the following:

    f = my_fields_container[0]
    f.GetEntityDataById(1)
    

    Can you try another example maybe? There shouldn't be any error while extracting the results.

    That being said, there are some issues with DPF's ENFO operator, the results extracted don't match Mechanical. Development is working on this issue.

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

    Hi @Nick R , hi @Ayush Kumar I'm under the impression that Nick's model uses layered shells. There might be a limitation on post-processing of forces on layered shells. Just my two cents.

  • Nick R
    Nick R Member Posts: 12
    First Answer 5 Likes First Comment
    **

    @ Pernelle you were correct! Although I didn't have layered shell geometry, instead the layered shells were being generated from an "Element Orientations" applied to a body in the model.

    It sounds like DPF may still be in development for force extraction since it may return different results from APDL and doesn't support all element types, so there may be some risk when compared to using the legacy reader (as of 1/25/2023).

    Thanks!