Error extracting nodal forces from beam connection

denck007
denck007 Member Posts: 3
First Comment Name Dropper
**

I am working on building a script to pull forces from beam connections in a model. In my test model I have 2 shells with holes cut in each and a beam connection between them.

In the UI I can place a 'Beam Probe' and get all the data I need, but I cannot seem to get it through DPF. I get the same error with Output Controls -> Nodal Forces turned on.

The error I keep getting is F:233<-Source operator "mapdl::rst::F" not found. Using ANSYS 2023R2. My code is:

import mech_dpf
import Ans.DataProcessing as dpf 

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

# Get the beam elements
op_scope = dpf.operators.scoping.on_mesh_property()
op_scope.inputs.requested_location.Connect("element")
op_scope.inputs.property_name.Connect("beam_elements")
op_scope.inputs.mesh.Connect(model.Mesh)
op_scope.outputs.mesh_scoping.GetData()
# DPF  Scoping: 
#  with Elemental location and 2 entities

op_scope_t = dpf.operators.scoping.transpose()
op_scope_t.inputs.mesh_scoping.Connect(op_scope)
op_scope_t.inputs.meshed_region.Connect(mesh)
op_scope_t.outputs.mesh_scoping.GetDataT1()
# DPF  Scoping: 
#  with Nodal location and 4 entities

op_nodal = dpf.operators.result.nodal_force(data_sources=model.DataSources, mesh_scoping=op_scope_t.outputs.mesh_scoping)
op_nodal.outputs.fields_container.GetData()
# Error F:233<-Source operator "mapdl::rst::F" not found

Best Answer

  • denck007
    denck007 Member Posts: 3
    First Comment Name Dropper
    **
    Answer ✓

    I figured out what happened. I needed to use element_nodal_force not nodal_force in this line: dpf.operators.result.nodal_force(data_sources=model.DataSources, mesh_scoping=op_scope_t.outputs.mesh_scoping)

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 859
    500 Comments Photogenic Name Dropper Solution Developer Community of Practice Member
    ✭✭✭✭

    @denck007 thank you so much for sharing the solution, much appreciated!

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

    FYI, there is some built in capability in the Bolt Tools add on in Mechanical under the connections post wizard to export beam forces and moments or stresses. This allows you to select which beams you want (or all) and also exports all time points

  • denck007
    denck007 Member Posts: 3
    First Comment Name Dropper
    **

    @Mike.Thompson Thanks for that info. It looks like that tool requires beam probes to exist in the tree already, which is not feasible for our use. We are exporting 100's of bolts across many models and managing more tree items is not practical. We had a (12 year old) JScript file that added some APDL code to the beams previously, but it broke in a recent release. The python way is working way better without needing to touch the tree!

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

    @denck007,
    Although you can use this tool to create beam probes in the tree, this is not required. There is a means to export the data without the creation of probes for the exact reason you mentioned about creating lots of tree objects. Please see the attached with video example and model.

    The other thing to consider regarding the beam forces is what coordinate system you are working in. I believe the element nodal forces you are extracting are in the global CS, while many times you want them in the local Beam CS. You can obviously do the transformations and I would recommend DPF to do this, but there is also a result type in the results file for BEAM188 which stores results in terms of axial force, shear force etc... instead of X,Y,Z. This is the result being pulled in the attached example, thus it is all local to the beam orientation also considering large deflection (which you should consider if doing the transformations manually with DPF)

    This forum is for scripting solutions but in this case it is important to know how the results data works to ensure the script is doing what you intend.