How to get Nodal stresses using DPF?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 467
100 Answers 250 Likes 100 Comments Second Anniversary
✭✭✭✭
edited June 2023 in Structures

How to get Nodal stresses using DPF?

Tagged:

Answers

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

    DPF can retrieve nodal stresses directly: Example Node ID - 278

    import mech_dpf
    
    mech_dpf.setExtAPI(ExtAPI)
    import Ans.DataProcessing as dpf
    
    dpf.DataProcessingCore.LoadLibrary("math", r"C:\Program Files\ANSYS Inc\v211\aisol\bin\winx64\Ans.Dpf.Math.dll")
    
    ds = mech_dpf.GetDataSources(0)
    
    s1_nodal = dpf.Operator("S1")
    s1_nodal.Connect(4, ds)
    node_scoping = dpf.data.Scoping([278], dpf.enums.location.nodal)  # Node ID and location
    s1_nodal.Connect(1, node_scoping)
    nodal_stress = s1_nodal.GetOutputAsFieldsContainer(0).GetFieldByTimeId(1).Data[0]
    print nodal_stress