How to extract force reactions using DPF inside mechanical ?

Vishnu
Vishnu Member, Employee Posts: 198
Name Dropper First Anniversary Solution Developer Community of Practice Member First Comment
edited June 2023 in Structures
Tagged:

Comments

  • Vishnu
    Vishnu Member, Employee Posts: 198
    Name Dropper First Anniversary Solution Developer Community of Practice Member First Comment
    edited May 2023

    Below is a simple code to extract the Y Reaction using DPF inside mechanical


    import mech_dpf
    import Ans.DataProcessing as dpf
    
    #Result Data
    analysis1 = ExtAPI.DataModel.Project.Model.Analyses[0]
    dataSource = dpf.DataSources(analysis1.Solution.ResultFilePath)
    
    #model
    my_model = dpf.Model(analysis1.Solution.ResultFilePath)
    
    #my mesh
    my_mesh = my_model.Mesh
    
    #Time list
    timelist = dpf.operators.metadata.time_freq_provider(data_sources=dataSource).outputs.gettime_freq_support().TimeFreqs.Data
    
    reaction = dpf.operators.result.reaction_force(time_scoping=timelist,data_sources=dataSource)
    Y_reaction = dpf.operators.logic.component_selector_fc(fields_container=reaction,component_number=1).outputs.fields_container.GetData()[0]
    
    print(sum(Y_reaction.Data))
    
    #Release Locked RST
    my_model.ReleaseStreams()