pyHarm.Reductors.GlobalHarmonicReductor ======================================= .. py:module:: pyHarm.Reductors.GlobalHarmonicReductor Classes ------- .. autoapisummary:: pyHarm.Reductors.GlobalHarmonicReductor.GlobalHarmonicReductor Module Contents --------------- .. py:class:: GlobalHarmonicReductor(data: dict, expl_dofs: pandas.DataFrame, *args) Bases: :py:obj:`pyHarm.Reductors.ABCReductor.ABCReductor` The global harmonic reductor is a reductor aiming at reducing the number of harmonics considered in the problem while solving. Hence in linear situation, it is expected that the problem is gonna be reduced solely to the harmonics being involved in the forcing. The reduction method is based on Gastaldi et al. proposal in : - A method to solve the efficiency-accuracy trade-off of multi-harmonic balance calculation of structures with friction contacts. This Reductor is global in the sense that it keeps all the dofs of a certain harmonic number even if only one dof needs this harmonic number. Attributes : max_nh (int): maximum number of harmonics. data (dict): dictionary of input + missing parameters from default dictionary. tot_dofs (int): total number of dofs. disp_cut_off (float): displacement cut off parameter used to put compute the criterion err_admissible (float): admissible error commited on the representation of the input displacement using limited amount of harmonics h_always_kept (np.ndarray): harmonic numbers that shall be kept in any condition verbose (bool): parameter to display info at each update of the number of harmonics tol_update (float): tolerance over the jacobian that tells if an update of the number of harmonics might be necessary .. py:attribute:: factory_keyword :type: str :value: 'globalHarmonic' keyword that is used to call the creation of this class in the factory. :type: str .. py:attribute:: default dictionary containing default parameters. :type: dict .. py:method:: __post_init__(*args) A post init method to be customized if needed when building new class. .. py:method:: update_reductor(xpred, J_f, expl_dofs, *args) Updates the number of harmonics to be solved. The update is made according to Gastaldi et al. paper named : - A method to solve the efficiency-accuracy trade-off of multi-harmonic balance calculation of structures with friction contacts (2017) A tolerance on the change of the Jacobian has been added in order to avoid costly update if the Jacobian remains identical to previous update. :param xpred: point predicted as the new starting point for the next iteration of the analysis process. :type xpred: np.ndarray :param J_f: full jacobian with respect to displacement and angular frequency (contains the correction equation residual). :type J_f: np.ndarray .. attribute:: phi Updated transformation matrix generated depending of the number of harmonics to keep. :type: np.ndarray :returns: same displacement vector given in input after passing through the reductor np.ndarray: same jacobian matrix given in input after passing through the reductor pd.DataFrame: same explicit dof DataFrame after passing through the reductor :rtype: np.ndarray .. py:method:: expand(q: numpy.ndarray) -> numpy.ndarray Applies the inverse transformation matrix to the reduced size displacement. :param q: vector of transformed displacement. :type q: np.ndarray :returns: vector of original displacement. :rtype: np.ndarray .. py:method:: reduce_vector(x: numpy.ndarray) -> numpy.ndarray Transforms the displacement vector. :param x: vector of displacement. :type x: np.ndarray :returns: vector of reduced displacement. :rtype: np.ndarray .. py:method:: reduce_matrix(dJdxom: numpy.ndarray, *args) -> numpy.ndarray From original matrix, performs the transformation to get the reduced matrix. :param dJdxom: full size jacobian matrix with respect to displacement and angular frequency. :type dJdxom: np.ndarray :returns: reduced jacobian matrix with respect to displacement and angular frequency. :rtype: np.ndarray .. py:method:: build_phi(nh_kept) Creates the masking phi matrix based on the harmonic numbers that are to be kept. :param nh_kept: Harmonic numbers to keep in the reduced vector. :type nh_kept: np.ndarray .. attribute:: phi Updated transformation matrix. :type: np.nd.array .. py:method:: harmonic_index(H) Provides the index of dofs corresponding to the required harmonic number. :param H: Harmonic number. :type H: int :returns: array of dof numbers associated to the required harmonic number. :rtype: np.nd.array .. py:method:: _get_criterion(FE, xpred, J_uc) Calculates the criterion based on proposal and the provided admissible error. :param FE: Linearized residual obtained by multiplying the jacobian with the displacement xpred. :type FE: np.ndarray :param xpred: predicted starting point for the next analysis step. :type xpred: np.ndarray :param J_uc: cross harmonic matrix. :type J_uc: np.ndarray :returns: array of booleans that indicates if the criterion is reached. :rtype: np.ndarray[bool] .. py:method:: _harmonic_selection(criterion) " Based on the criterion values and the harmonics that are set to be kept all the time, creates the array with all the harmonics to keep in the calculation. :param criterion: array of booleans that indicates if the criterion is reached. :type criterion: np.ndarray[bool] :returns: array of harmonic numbers to keep. :rtype: np.ndarray .. py:method:: _display_infos(update_nh, harmonic_to_keep) Displays the harmonics that are kept if verbose is set to True. :param update_nh: True if updating the reducer has been necessary. :type update_nh: bool :param harmonic_to_keep: array of harmonic numbers to keep. :type harmonic_to_keep: np.ndarray .. py:method:: _update_nh_kept(J_f, J_uc) Low computational sub-criterion to know if the number of harmonics to keep has to be updated based on changes of the Jacobian. :param J_f: Full size jacobian with respect to displacement and angular frequency. :type J_f: np.ndarray :param J_uc: Cross harmonic part of the jacobian. :type J_uc: np.ndarrray :returns: True if updating the reducer has been necessary. :rtype: bool .. py:method:: _max_disp_norm_per_dof(xpred) Obtains normalisation value for dof based on maximal value over the harmonic number of the dof. :param xpred: predicted starting point for the next analysis step. :type xpred: np.ndarray :returns: infinite norm of the harmonics for each dof. :rtype: np.ndarray .. py:method:: _get_uncoupled_jacobian(J_f) Returns the cross Harmonic terms in the Jacobian for criterion computation. :param J_f: full size jacobian. :type J_f: np.ndarray :returns: Cross harmonic components :rtype: np.ndarray .. py:method:: _get_combinaisons_sub_node_dof() Returns a combination of (substructure, node, dof_number) based on the explicit dof DataFrame. .. attribute:: combinaisons combination of each sub, node, dof possible onto the system. :type: tuple[str,int,int] .. py:method:: _get_index_block(h) Returns an array containing the indexes of dofs for a given harmonic number. :param h: harmonic number. :type h: int :returns: indexes of dofs for a given harmonic number. :rtype: np.ndarray .. py:method:: _get_mshg_block(h) Generates the meshgrid to get a block of a matrix. :param h: harmonic number. :type h: int :returns: meshgrid to get the corresponding block of a matrix. :rtype: np.ndarray .. py:method:: _get_output_expl_dofs() Obtains the modified explicit dof DataFrame after passing through the reducer. :returns: Modified explicit dof DataFrame after passing through the reducer. :rtype: np.ndarray