pyHarm.Reductors.GlobalHarmonicReductor

Classes

GlobalHarmonicReductor

The global harmonic reductor is a reductor aiming at reducing the number of harmonics considered in the problem while solving.

Module Contents

class pyHarm.Reductors.GlobalHarmonicReductor.GlobalHarmonicReductor(data: dict, expl_dofs: pandas.DataFrame, *args)

Bases: 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

factory_keyword: str = 'globalHarmonic'

keyword that is used to call the creation of this class in the factory.

Type:

str

default

dictionary containing default parameters.

Type:

dict

__post_init__(*args)

A post init method to be customized if needed when building new class.

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.

Parameters:
  • xpred (np.ndarray) – point predicted as the new starting point for the next iteration of the analysis process.

  • J_f (np.ndarray) – full jacobian with respect to displacement and angular frequency (contains the correction equation residual).

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

Return type:

np.ndarray

expand(q: numpy.ndarray) numpy.ndarray

Applies the inverse transformation matrix to the reduced size displacement.

Parameters:

q (np.ndarray) – vector of transformed displacement.

Returns:

vector of original displacement.

Return type:

np.ndarray

reduce_vector(x: numpy.ndarray) numpy.ndarray

Transforms the displacement vector.

Parameters:

x (np.ndarray) – vector of displacement.

Returns:

vector of reduced displacement.

Return type:

np.ndarray

reduce_matrix(dJdxom: numpy.ndarray, *args) numpy.ndarray

From original matrix, performs the transformation to get the reduced matrix.

Parameters:

dJdxom (np.ndarray) – full size jacobian matrix with respect to displacement and angular frequency.

Returns:

reduced jacobian matrix with respect to displacement and angular frequency.

Return type:

np.ndarray

build_phi(nh_kept)

Creates the masking phi matrix based on the harmonic numbers that are to be kept.

Parameters:

nh_kept (np.ndarray) – Harmonic numbers to keep in the reduced vector.

phi

Updated transformation matrix.

Type:

np.nd.array

harmonic_index(H)

Provides the index of dofs corresponding to the required harmonic number.

Parameters:

H (int) – Harmonic number.

Returns:

array of dof numbers associated to the required harmonic number.

Return type:

np.nd.array

_get_criterion(FE, xpred, J_uc)

Calculates the criterion based on proposal and the provided admissible error.

Parameters:
  • FE (np.ndarray) – Linearized residual obtained by multiplying the jacobian with the displacement xpred.

  • xpred (np.ndarray) – predicted starting point for the next analysis step.

  • J_uc (np.ndarray) – cross harmonic matrix.

Returns:

array of booleans that indicates if the criterion is reached.

Return type:

np.ndarray[bool]

_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.

Parameters:

criterion (np.ndarray[bool]) – array of booleans that indicates if the criterion is reached.

Returns:

array of harmonic numbers to keep.

Return type:

np.ndarray

_display_infos(update_nh, harmonic_to_keep)

Displays the harmonics that are kept if verbose is set to True.

Parameters:
  • update_nh (bool) – True if updating the reducer has been necessary.

  • harmonic_to_keep (np.ndarray) – array of harmonic numbers to keep.

_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.

Parameters:
  • J_f (np.ndarray) – Full size jacobian with respect to displacement and angular frequency.

  • J_uc (np.ndarrray) – Cross harmonic part of the jacobian.

Returns:

True if updating the reducer has been necessary.

Return type:

bool

_max_disp_norm_per_dof(xpred)

Obtains normalisation value for dof based on maximal value over the harmonic number of the dof.

Parameters:

xpred (np.ndarray) – predicted starting point for the next analysis step.

Returns:

infinite norm of the harmonics for each dof.

Return type:

np.ndarray

_get_uncoupled_jacobian(J_f)

Returns the cross Harmonic terms in the Jacobian for criterion computation.

Parameters:

J_f (np.ndarray) – full size jacobian.

Returns:

Cross harmonic components

Return type:

np.ndarray

_get_combinaisons_sub_node_dof()

Returns a combination of (substructure, node, dof_number) based on the explicit dof DataFrame.

combinaisons

combination of each sub, node, dof possible onto the system.

Type:

tuple[str,int,int]

_get_index_block(h)

Returns an array containing the indexes of dofs for a given harmonic number.

Parameters:

h (int) – harmonic number.

Returns:

indexes of dofs for a given harmonic number.

Return type:

np.ndarray

_get_mshg_block(h)

Generates the meshgrid to get a block of a matrix.

Parameters:

h (int) – harmonic number.

Returns:

meshgrid to get the corresponding block of a matrix.

Return type:

np.ndarray

_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.

Return type:

np.ndarray