pyHarm.Reductors.NLdofsReductor¶
Classes¶
The nonlinear dofs reductor is a reductor aiming at reducing the system to the nonlinear dofs only while using a linear solver to obtain the solution for the linear dofs. |
Module Contents¶
- class pyHarm.Reductors.NLdofsReductor.NLdofsReductor(data: dict, expl_dofs: pandas.DataFrame, *args)¶
Bases:
pyHarm.Reductors.ABCReductor.ABCReductorThe nonlinear dofs reductor is a reductor aiming at reducing the system to the nonlinear dofs only while using a linear solver to obtain the solution for the linear dofs.
- The reduction method is inspired by the PhD of Colaitis but adapted to the closure equation included in pyHarm before the reduction layer.
Expansion solve the linear problem associated in order to return the solutions for the linear dofs based on the values of the nonlinear dofs
Jacobian matrix is completed with the contribution of linear dofs for the closure equation and the rest of the Jacobian by solving two linear problems
- Attributes :
factory_keyword (str): name to use as input when willing to create an instance of this object. solve (Callable): solve from scipy.linalg module. lu_factor (Callable): lu_factor from scipy.linalg module. lu_solve (Callable): lu_solve from scipy.linalg module.
- factory_keyword: str = 'NLdofs'¶
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__()¶
A post init method to be customized if needed when building new class.
- update_reductor(xpred, J_f, expl_dofs, system, *args)¶
Updates the reducer for the new point.
- 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).
expl_dofs (pd.DataFrame) – explicit dof DataFrame created by the ABCSystem studied.
system (ABCSystem) – System studied.
- J_add¶
Updated jacobian to add onto the non-linear dofs.
- Type:
np.ndarray
- Returns:
same displacement vector given as input after passing through the reductor np.ndarray: same jacobian matrix given as 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¶
Makes a linear solve onto the linear part of the residual and jacobian in order to give the necessary displacement on the linear dofs.
- Parameters:
q (np.ndarray) – vector of reduced displacement.
- Returns:
vector of original displacement with the linear dof being exact solution.
- Return type:
np.ndarray
- _extract_blocks(J, i, j)¶
Extracts blocks of the jacobian matrix.
- Parameters:
J (np.ndarray) – vector of displacement.
i (np.ndarray) – vector of index.
j (np.ndarray) – vector of index.
- Returns:
jacobian block restrained to the meshgrid of indexes i,i. np.ndarray: jacobian block restrained to the meshgrid of indexes i,j. np.ndarray: jacobian block restrained to the meshgrid of indexes j,i.
- 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 jacobian, performs the transformation to get the reduced matrix while adding the linear influence.
- 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
- _update_J_add(dJdxom)¶
Updates the jacobian block to add corresponding to the linear influence.
- Parameters:
dJdxom (np.ndarray) – full size jacobian matrix with respect to displacement and angular frequency.
- Returns:
jacobian to add corresponding to the linear influence.
- Return type:
np.ndarray
- _get_AijAiim1(Aii, Aij)¶
Obtains the linear solution to Aii.T,Aij.T and transposes the results.
- Parameters:
Aii (np.ndarray) – square matrix block of the jacobian.
Aij (np.ndarray) – rectangle matrix block of the jacobian.
- Returns:
linear solution to Aii.T,Aij.T and transpose the results.
- Return type:
np.ndarray
- _get_AijAiim1LU(AiiTLU, Aij)¶
Obtains the linear solution to Aii.T,Aij.T and transposes the results but uses the LU decomposition of Aii.
- Parameters:
AiiTLU (np.ndarray) – LU matrix decomposition of a square transpose block of the jacobian.
Aij (np.ndarray) – rectangle matrix block of the jacobian.
- Returns:
linear solution to AiiTLU,Aij.T and transpose the results.
- Return type:
np.ndarray
- _get_mshg(lines, columns)¶
Obtains the meshgrid for getting the block of matrix.
- Parameters:
lines (np.ndarray) – indexes of lines.
columns (np.ndarray) – indexes of columns.
- Returns:
meshgrid of the block.
- Return type:
tuple[np.ndarray,np.ndarray]
- _add_omega(J, Jom, Cn, Cw)¶
Constructs a matrix by blocks.
- Parameters:
J (np.ndarray) – jacobian with respect to displacement.
Jom (np.ndarray) – jacobian with respect to angular frequency.
Cn (np.ndarray) – correction jacobian with respect to displacement.
Cw (np.array) – correction jacobian with respect to angular frequency.
- Returns:
matrix built with the provided blocks.
- Return type:
np.ndarray
- _add_omega_vec(R)¶
Extends a residual vector by adding a 0 at the end.
- Parameters:
R (np.ndarray) – residual vector.
Cw (np.array) – correction jacobian with respect to angular frequency.
- Returns:
residual vector augmented with a component of 0 at the end.
- Return type:
np.ndarray
- _init_dofs(expl_dofs, system)¶
Constructs the phi matrix that suppresses the linear dofs when applied.
- Parameters:
expl_dofs (pd.DataFrame) – explicit dof DataFrame created by the ABCSystem studied.
system (ABCSystem) – System studied.
- init_dofs¶
initialisation of the indexes of linear and non-linear dof done.
- Type:
bool
- phi_reduce¶
transformation matrix that cuts the linear dofs.
- 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