How to export nodal displacements from a modal analysis using DPF?

Rohith Patchigolla
Rohith Patchigolla Member, Moderator, Employee Posts: 193
100 Comments 25 Answers Second Anniversary 25 Likes
✭✭✭✭

How to export nodal displacements from a modal analysis using DPF?

Tagged:

Answers

  • Rohith Patchigolla
    Rohith Patchigolla Member, Moderator, Employee Posts: 193
    100 Comments 25 Answers Second Anniversary 25 Likes
    ✭✭✭✭

    For extracting displacements from Modal analysis, please find below an example script, which prints ux, uy and uz for node 310 for Mode 6. This can be further expanded to loop over each mode and export displacements for all nodes.

    import mech_dpf
    import Ans.DataProcessing as dpf
    
    #Extract Modal analysis system
    analysis = Model.Analyses[0]
    ds = dpf.DataSources(analysis.ResultFileName)
    
    #mesh scoping
    my_scoping = dpf.Scoping()
    my_scoping.Location="Nodal"
    my_scoping.Ids = [310]
    
    #Time list
    timelist = dpf.operators.metadata.time_freq_provider(data_sources=ds).outputs.gettime_freq_support().TimeFreqs.Data
    time_index_list = range(1,timelist.Count+1,1)
    
    disp_fc = dpf.operators.result.displacement(time_scoping=time_index_list, data_sources=ds, mesh_scoping = my_scoping).outputs.getfields_container()
    
    #Print ux, uy and uz for Mode 6 for Node 310
    print(disp_fc[5].Data)