How to extract a frequency response of a node from a harmonic response analysis using DPF ?

Member, Employee Posts: 222
100 Comments 100 Likes Second Anniversary Name Dropper
✭✭✭✭
edited September 2023 in Structures

Extracting Real,Imaginary,Amplitude and Phase

Tagged:

Answers

  • Member, Employee Posts: 222
    100 Comments 100 Likes Second Anniversary Name Dropper
    ✭✭✭✭
    edited July 2023

    Below is an example of how we can extract a displacement_Y frequency response of a node at a particular frequency

    1. #Import statements
    2. import mech_dpf
    3. import Ans.DataProcessing as dpf
    4.  
    5. #Inputs
    6. Freq = 100
    7. node = 21
    8.  
    9. #Result Data
    10. analysis1 = ExtAPI.DataModel.Project.Model.Analyses[1]
    11. dataSource = dpf.DataSources(analysis1.Solution.ResultFilePath)
    12.  
    13. #model
    14. my_model = dpf.Model(analysis1.Solution.ResultFilePath)
    15.  
    16. #my mesh
    17. my_mesh = my_model.Mesh
    18.  
    19. #Time list
    20. timelist = dpf.operators.metadata.time_freq_provider(data_sources=dataSource).outputs.gettime_freq_support().TimeFreqs.Data
    21. time_index_list = range(1,timelist.Count+1,1)
    22. dispfield_container_real_imag = dpf.operators.result.displacement_Y(time_scoping=time_index_list,data_sources=dataSource).outputs.getfields_container()
    23. dispfield_container_amp = dpf.operators.math.amplitude_fc(fields_container = dispfield_container_real_imag).outputs.getfields_container()
    24. dispfield_container_phase = dpf.operators.math.phase_fc(fields_container = dispfield_container_real_imag).outputs.getfields_container()
    25.  
    26. #get resul at a freq
    27. time_index = timelist.IndexOf(Freq)*2
    28. disp_field_real = dispfield_container_real_imag[time_index]
    29. disp_field_imag = dispfield_container_real_imag[time_index+1]
    30. disp_field_amp = dispfield_container_amp[timelist.IndexOf(Freq)]
    31. disp_field_phase = dispfield_container_phase[timelist.IndexOf(Freq)]
    32.  
    33. #get result at a node
    34. node_index = disp_field_amp.ScopingIds.IndexOf(node)
    35. print "result at node-->",node," and at ",Freq, "Hz"
    36. print "real-->",disp_field_real.Data[node_index],disp_field_real.Unit
    37. print "imag-->",disp_field_imag.Data[node_index],disp_field_imag.Unit
    38. print "amplitude-->",disp_field_amp.Data[node_index],disp_field_amp.Unit
    39. print "phase-->",disp_field_phase.Data[node_index],disp_field_phase.Unit
    40.  
    41. #Release Locked RST
    42. my_model.ReleaseStreams()

    output would look like below:

Welcome!

It looks like you're new here. Sign in or register to get started.