tmdsimpy.utils.continuation.print_vprnm_amp_phase_stats

tmdsimpy.utils.continuation.print_vprnm_amp_phase_stats(XlamP, dirP_prev, fname, h, control_order, output_order, output_recov_harmonic_list)

Saves VPRNM Amplitude and Phase 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 for basic VPRNM, see module for other options.

Parameters:
XlamP(N+1,) numpy.ndarray

Solution at the current step in physical coordinates (including continuation parameter) to a VPRNM amplitude control set of equations. First entries are harmonic displacements, XlamP[-4] is cosine force scaling, XlamP[-3] is sine force scaling, XlamP[-2] is frequency (rad/s), XlamP[-1] is amplitude level.

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 VPRNM solution.

control_orderint, zero or positive

Order of the derivative that is controlled. order=0 means displacement output, order=2 means acceleration output Solely determines the header for the column, but does not effect any of the values since VPRNM directly controls the derivative order of the amplitude.

output_orderint, zero or positive

Order of the derivative that is output. order=0 means displacement output, order=2 means acceleration output.

output_recov_harmonic_listlist of tuples

Each tuple contains 1. a (Ndof,) numpy.ndarray describing the output DOF and 2. an int describing which harmonic should be output. Behavior is undefined if output harmonic is not included in h.

Returns:
None.

See also

tmdsimpy.Continuation

Class for continuation where this function is intended to be used as a callback function.

tmdsimpy.VibrationSystem.vprnm_amp_phase_res

VPRNM residual function. This assumes that XlamP matches the unknowns vector for this residual function.

combine_callback_funs

Function for combining multiple callback functions for Continuation.

continuation_save

Function 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 VPRNM residual at a given lam value.

The output includes (for the current solution) force magnitude, frequency, and the amplitude at the DOFs and harmonics defined by output_recov_harmonic_list at displacement derivative order. Other functions in this module correspond to other variants of VPRNM/HBM.

Examples

Define a callback function handle to pass to tmdsimpy.Continuation as

>>> import numpy as np 
... 
... h = np.arange(5)
... control_order = 2 # Acceleration
... output_order = 2 # Acceleration
... 
... output_recov1 = np.array([1, 0, 0])
... output_harmonic1 = 1
... 
... output_recov2 = np.array([0, 1, 0])
... output_harmonic2 = 3
...
... output_recov_harmonic_list = [(output_recov1, output_harmonic1),
...                               (output_recov2, output_harmonic2)]
... 
... callback_fun = lambda XlamP, dirP_prev : print_vprnm_amp_phase_stats(
...                    XlamP, dirP_prev, 'vprnm_sum.dat', h, control_order,
...                    output_order, output_recov_harmonic_list)