core¶
model_setup¶
This module contains the functions for setting up the WFE model.
- This includes:
Creating the relevant dof dict data
Applying the boundary conditions
Sorting M, K and dofs to left and right faces
Creating node dict data
- pywfe.core.model_setup.generate_dof_info(dof: dict, axis=0)¶
Generates the dof dictionary, including which face each dof is on. Also rolls sets the waveguide axis and created index array if none given.
- Parameters:
- dofdict
DESCRIPTION.
- axisTYPE, optional
DESCRIPTION. The default is 0.
- Returns:
- dofTYPE
DESCRIPTION.
- pywfe.core.model_setup.apply_boundary_conditions(K, M, dof, null, nullf)¶
Applies boundary conditions according to null constraint matrices. Resorts and removes degrees of freedom as needed. (NOT FINISHED)
- Parameters:
- Kndarray
(ndof, ndof) sized array of type float or complex.
- Mndarray
(ndof, ndof) sized array of type float or complex.
- dofdict
dof dictionary.
- nullndarray
(ndof, ndof) sized array of type float.
- nullfndarray
(ndof, ndof) sized array of type float.
- Returns:
- Kndarray
(ndof, ndof) sized array of type float or complex.
- Mndarray
(ndof, ndof) sized array of type float or complex.
- dofdict
dof dictionary.
- pywfe.core.model_setup.order_system_faces(K, M, dof)¶
- Parameters:
- Kndarray
(ndof, ndof) sized array of type float or complex.
- Mndarray
(ndof, ndof) sized array of type float or complex.
- dofdict
dof dictionary.
- Returns:
- Kndarray
(ndof, ndof) sized array of type float or complex.
- Mndarray
(ndof, ndof) sized array of type float or complex.
- dofdict
dof dictionary.
- pywfe.core.model_setup.substructure_matrices(K, M, dof)¶
Creates dictionaries for the submatrices of K and M
- Parameters:
- Kndarray
(ndof, ndof) sized array of type float or complex.
- Mndarray
(ndof, ndof) sized array of type float or complex.
- dofdict
dof dictionary.
- Returns:
- K_subdict
dictionary of substructured stiffness matrices.
- M_subdict
dictionary of substructured mass matrices.
- pywfe.core.model_setup.create_node_dict(dof)¶
Creates node dictionary for nodes on the left face of the model
- Parameters:
- dofdict
dof dictionary.
- Returns:
- nodedict
node dictionary.
eigensolvers¶
This module contains different solvers for the WFE eigenproblem.
- pywfe.core.eigensolvers.transfer_matrix(DSM)¶
Classical transfer matrix formulation of the WFE eigenproblem.
The transfer function is defined as
\[\begin{split}\mathbf{T} = \begin{bmatrix} -D_{LR}^{-1} D_{LL} & D_{LR}^{-1} \\ -D_{RL}+D_{RR} D_{LR}^{-1} D_{LL} & -D_{RR} D_{LR}^{-1} \end{bmatrix}\end{split}\]which leads to the eigenvalue problem
\[T \mathbf{\Phi} = \lambda \mathbf{\Phi}\]The left eigenvectors can be found by considering \(\mathbf{T}^{T}\)
- Parameters:
- DSM(N,N) ndarray (float or complex)
The dynamic stiffness matrix of the system. NxN array of type float or complex.
- Returns:
- valsndarray
1-D array of length N type complex.
- left_eigenvectorsndarray
NxN array of type float or complex. Column i is vector corresponding to vals[i]
- right_eigenvectorsndarray
NxN array of type float or complex. Column i is vector corresponding to vals[i]
- pywfe.core.eigensolvers.polynomial(DSM)¶
[unfinished] Polynomial form of the eigenproblem
- Parameters:
- DSM(N,N) ndarray (float or complex)
The dynamic stiffness matristrucaxisym-x of the system. NxN array of type float or complex.
- Returns:
- valsndarray
1-D array of length N type complex.
- left_eigenvectorsndarray
NxN array of type float or complex. Column i is vector corresponding to vals[i]
- right_eigenvectorsndarray
NxN array of type float or complex. Column i is vector corresponding to vals[i]
classify_modes¶
This module contains the functionality needed to sort eigensolutions of the WFE method into positive and negative going waves.
- pywfe.core.classify_modes.classify_wavemode(f, eigenvalue, eigenvector, threshold)¶
Identify if a wavemode is positive going or negative going
- Parameters:
- ffloat
frequency of eigensolution.
- eigenvaluecomplex
Eigenvalue to be checked.
- eigenvectornodarray, complex
Corresponding eigenvector.
- thresholdfloat
Threshold for classification. How close to unity does an eigenvalue have to be?
- Returns:
- directionstr
'right'or'left'.
- pywfe.core.classify_modes.sort_eigensolution(f, eigenvalues, right_eigenvectors, left_eigenvectors)¶
Sort the eigensolution into positive and negative going waves
- Parameters:
- ffloat
Frequency of eigensolution.
- eigenvaluesndarray, complex
Eigenvalues solved at this frequency.
- right_eigenvectorsndarray, complex
Right eigenvectors solved at this frequency.
- left_eigenvectorsTYPE
Left eigenvectors solved at this frequency..
- Returns:
- named tuple
Eigensolution tuple.
forced_problem¶
This module contains the functionality needed to apply forces to a WFE model.
- pywfe.core.forced_problem.calculate_excited_amplitudes(eigensolution, force)¶
Calculates the directly excited amplitudes subject to a given force and modal solution.
- Parameters:
- eigensolutionnamedtuple
eigensolution.
- forcenp.ndarray
force vector.
- Returns:
- e_plusnp.ndarray
directly excited modal amplitudes (positive).
- e_minusnp.ndarray
directly excited modal amplitudes (negative).
- pywfe.core.forced_problem.generate_reflection_matrices(eigensolution, A_right, B_right, A_left, B_left)¶
Calculates the reflection matrices from boundary matrices.
- Parameters:
- eigensolutionTYPE
DESCRIPTION.
- A_rightnp.ndarray
A matrix on the right boundary.
- B_rightnp.ndarray
B matrix on the right boundary.
- A_leftnp.ndarray
A natrix on the left boundary.
- B_leftnp.ndarray
B matrix on the left boundary.
- Returns:
- R_rightnp.ndarray
Right reflection matrix.
- R_leftnp.ndarray
Left reflection matrix.
- pywfe.core.forced_problem.calculate_propagated_amplitudes(e_plus, e_minus, k_plus, L, R_right, R_left, x_r, x_e=0)¶
Calculates the ampltiudes of waves after propagation to response point
- Parameters:
- e_plusnp.ndarray
positive directly excited amplitudes.
- e_minusnp.ndarray
negative directly excited amplitudes.
- k_plusnp.ndarray
wavenumber array.
- Lfloat
Length of waveguide.
- R_rightnp.ndarray
Right reflection matrix.
- R_leftnp.ndarray
Left reflection matrix.
- x_rfloat, np.ndarray
Response distance.
- x_efloat,
Excitation distance. The default is 0.
- Returns:
- b_plusnp.ndarray
positive propagated amplitudes.
- b_minusnp.ndarray
negative propagated amplitudes.
- pywfe.core.forced_problem.calculate_modal_displacements(eigensolution, b_plus, b_minus)¶
Calculates the displacement of each mode (last axis is modal)
- Parameters:
- eigensolutionnamedtuple
eigensolution.
- b_plusnp.ndarray
positive propagated amplitudes.
- b_minusnp.ndarray
negative propagated amplitudes.
- Returns:
- q_j_plusnp.ndarray
positive going modal displacements.
- q_j_minusnp.ndarray
negative going modal displacements.
- pywfe.core.forced_problem.calculate_modal_forces(eigensolution, b_plus, b_minus)¶
Calculates the internal forces of each mode (last axis is modal)
- Parameters:
- eigensolutionnamedtuple
eigensolution.
- b_plusnp.ndarray
positive propagated amplitudes.
- b_minusnp.ndarray
negative propagated amplitudes.
- Returns:
- f_j_plusnp.ndarray
Positive going modal forces.
- f_j_minusnp.ndarray
Negative going modal forces.