While trying to retrieve nodal acceleration for all frequencies of different RPM sets in Harmonic Analysis using DPF operator "AX", I get the following error:
This is a bug in 2021R1 (DPF). The workaround to this is using the displacement operator UX and do a double derivative of UX to get acceleration using cplx_derive operator.
UX
cplx_derive
I have this example code which retrieves Nodal acceleration for a defined Named selection "node" (containing 1 node) in Mechanical and prints out the acceleration amplitude for that node in X for each frequency and rpm set in a Harmonic Analysis.
Assumption: Each RPM set has same number of solution intervals. In case of different solution intervals, please adjust the code to get the correct rpm set number.
import math import mech_dpf mech_dpf.setExtAPI(ExtAPI) import Ans.DataProcessing as dpf from collections import defaultdict # Data Source ds = mech_dpf.GetDataSources(0) # Adjust analysis system index time_provider = dpf.operators.metadata.time_freq_provider() time_provider.inputs.data_sources.Connect(ds) # Number of frequencies freqs = time_provider.outputs.time_freq_support.GetData() numSets = freqs.NumberSets ids = [index + 1 for index in range(numSets)] # Get number of RPMs analysis = Model.Analyses[0].AnalysisSettings # Adjust analysis system index n_rpms = analysis.NumberOfRPMs n_freqs_per_rpm = int(len(ids) / n_rpms) node_scoping = dpf.data.Scoping() node_scoping.Ids = ExtAPI.DataModel.GetObjectsByName("node")[0].Ids freq_scoping = dpf.data.Scoping() freq_scoping.Ids = ids # Displacement X u_x = dpf.Operator("UX") u_x.Connect(0, freq_scoping) u_x.Connect(1, node_scoping) u_x.Connect(4, ds) # Velocity X - Single Derivative u_d_x = dpf.Operator("cplx_derive") u_d_x.Connect(0, u_x) # Acceleration X - Double Derivative u_d2_x = dpf.Operator("cplx_derive") u_d2_x.Connect(0, u_d_x) for freq_index in ids: real = u_d2_x.GetOutputAsFieldsContainer(0).GetFieldByTimeId(freq_index).Data[0] imaginary = u_d2_x.GetOutputAsFieldsContainer(0).GetImaginaryField(freq_index).Data[0] amplitude = (real ** 2 + imaginary ** 2) ** 0.5 rpm_set = math.ceil(freq_index / float(n_freqs_per_rpm)) print "RPM Set - %s, Frequency - %s, Accleration X - %s" % (rpm_set, freq_index, amplitude)
ACEL is not in the RST for harmonic response. You can calculate it by scaling displacement by (2pi()FREQ)^2