How to extract a frequency response of a node from a harmonic response analysis using DPF ?
Vishnu
Member, Employee Posts: 214
✭✭✭✭
Answers
-
Below is an example of how we can extract a displacement_Y frequency response of a node at a particular frequency
#Import statements import mech_dpf
import Ans.DataProcessing as dpf #Inputs
Freq = 100
node = 21 #Result Data
analysis1 = ExtAPI.DataModel.Project.Model.Analyses[1]
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
time_index_list = range(1,timelist.Count+1,1) dispfield_container_real_imag = dpf.operators.result.displacement_Y(time_scoping=time_index_list,data_sources=dataSource).outputs.getfields_container()
dispfield_container_amp = dpf.operators.math.amplitude_fc(fields_container = dispfield_container_real_imag).outputs.getfields_container()
dispfield_container_phase = dpf.operators.math.phase_fc(fields_container = dispfield_container_real_imag).outputs.getfields_container() #get resul at a freq
time_index = timelist.IndexOf(Freq)*2
disp_field_real = dispfield_container_real_imag[time_index]
disp_field_imag = dispfield_container_real_imag[time_index+1]
disp_field_amp = dispfield_container_amp[timelist.IndexOf(Freq)]
disp_field_phase = dispfield_container_phase[timelist.IndexOf(Freq)] #get result at a node
node_index = disp_field_amp.ScopingIds.IndexOf(node)
print "result at node-->",node," and at ",Freq, "Hz"
print "real-->",disp_field_real.Data[node_index],disp_field_real.Unit
print "imag-->",disp_field_imag.Data[node_index],disp_field_imag.Unit
print "amplitude-->",disp_field_amp.Data[node_index],disp_field_amp.Unit
print "phase-->",disp_field_phase.Data[node_index],disp_field_phase.Unit #Release Locked RST
my_model.ReleaseStreams()output would look like below:
0