tmdsimpy.utils.continuation.print_hbm_amp_stats¶
- tmdsimpy.utils.continuation.print_hbm_amp_stats(XlamP, dirP_prev, fname, h, order, output_recov, output_harmonic)¶
Saves HBM amplitude control key statistics to a text file for easy monitoring.
This function is intended for monitoring active runs. For final solution details, save the full solution and plot based on those results, not based on the results written out by this summary file. Function only intended to work when amplitude control is applied with HBM (Harmonic Balance Method).
- Parameters:
- XlamP(N+1,) numpy.ndarray
Solution at the current step in physical coordinates (including continuation parameter) to a HBM amplitude control set of equations. First entries are harmonic displacements, XlamP[-2] is force scaling, XlamP[-1] is frequency (rad/s).
- dirP_prev(N+1,) numpy.ndarray
Direction for prediction from previous step to this step. Can be used to get slope of solution at previous point w.r.t. lam by dividing dirP / dirP[-1]
- fnamestr
Filename to save variables to. The output is a text file. Recommended file extension is ‘.dat’.
- hnumpy.ndarray, sorted
List of harmonics included in HBM solution.
- orderint, zero or positive
Order of the derivative that is output. order=0 means displacement output, order=2 means acceleration output.
- output_recov: (Ndof,) numpy.ndarray
Recovery vector to be used to output response at a specific DOF where Ndof is the number of degrees of freedom of the system.
- output_harmonicint
Which harmonic the amplitude at the output_recov dof should be output for. Behavior is undefined if output_harmonic is not included in h.
- Returns:
- None.
See also
tmdsimpy.ContinuationClass for continuation where this function is intended to be used as a callback function.
tmdsimpy.VibrationSystem.hbm_amp_control_resHBM amplitude control residual function. This assumes that XlamP matches the unknowns vector for this residual function.
combine_callback_funsFunction for combining multiple callback functions for Continuation.
continuation_saveFunction for saving the full solution points.
Notes
Ndof is the number of DOFs of the system while N is the number of unknowns for the HBM residual at a given lam value.
The output includes (for the current solution) frequency, force scaling magnitude, and the amplitude at the DOF defined by output_recov corresponding to output_harmonic and order. Other functions in this module correspond to other variants of HBM.
Examples
Define a callback function handle to pass to tmdsimpy.Continuation as
>>> import numpy as np ... ... h = np.arange(5) ... order = 2 # Acceleration ... output_recov = np.array([1, 0, 0]) ... output_harmonic = 1 ... ... callback_fun = lambda XlamP, dirP_prev : print_hbm_amp_stats(XlamP, ... dirP_prev, 'hbm_sum.dat', h, order, ... output_recov, output_harmonic)