chrono::modal::ChUnsymGenEigenvalueSolverKrylovSchur Class Reference

Description

Generalized iterative eigenvalue solver implementing Krylov-Schur shift-and-invert method for real generic matrices.

Features:

  • generalized eigenvalue problem
  • generic (i.e. also unsymmetric) sparse matrices
  • shift-and-invert with complex shift

#include <ChUnsymGenEigenvalueSolver.h>

Inheritance diagram for chrono::modal::ChUnsymGenEigenvalueSolverKrylovSchur:
Collaboration diagram for chrono::modal::ChUnsymGenEigenvalueSolverKrylovSchur:

Public Member Functions

 ChUnsymGenEigenvalueSolverKrylovSchur (std::shared_ptr< ChDirectSolverLScomplex > linear_solver=chrono_types::make_shared< ChSolverSparseComplexLU >())
 Default: uses Eigen::SparseLU as factorization for the shift&invert, otherwise pass a custom complex sparse solver for faster factorization (ex. More...
 
virtual int Solve (const ChSparseMatrix &A, const ChSparseMatrix &B, ChMatrixDynamic< ScalarType > &eigvects, ChVectorDynamic< ScalarType > &eigvals, int num_modes, ScalarType sigma) const override
 Solve the generalized eigenvalue problem A*eigvects = B*eigvects*diag(eigvals) A and B are real; potentially unsymmetric 'eigvects' will be resized to [A.rows() x num_modes] 'eigvals' will be resized to [num_modes] the number of converged eigenvalues is returned. More...
 
- Public Member Functions inherited from chrono::modal::ChUnsymGenEigenvalueSolver
virtual int Solve (const ChSparseMatrix &A, const ChSparseMatrix &B, ChMatrixDynamic< ScalarType > &eigvects, ChVectorDynamic< ScalarType > &eigvals, int num_modes, ScalarType sigma) const =0
 Solve the generalized eigenvalue problem A*eigvects = B*eigvects*diag(eigvals) A and B are real; potentially unsymmetric 'eigvects' will be resized to [A.rows() x num_modes] 'eigvals' will be resized to [num_modes] the number of converged eigenvalues is returned.
 
- Public Member Functions inherited from chrono::modal::ChGeneralizedEigenvalueSolver< std::complex< double > >
double GetTimeMatrixAssembly () const
 Get cumulative time for matrix assembly.
 
double GetTimeEigenSetup () const
 Get cumulative time for the eigensolver setup.
 
double GetTimeEigenSolver () const
 Get cumulative time for the eigensolver solution.
 
double GetTimeSolutionPostProcessing () const
 Get cumulative time for post-solver solution postprocessing.
 

Protected Attributes

std::shared_ptr< ChDirectSolverLScomplexm_linear_solver
 
- Protected Attributes inherited from chrono::modal::ChGeneralizedEigenvalueSolver< std::complex< double > >
ChTimer m_timer_matrix_assembly
 timer for matrix assembly
 
ChTimer m_timer_eigen_setup
 timer for eigensolver setup
 
ChTimer m_timer_eigen_solver
 timer for eigensolver solution
 
ChTimer m_timer_solution_postprocessing
 timer for conversion of eigensolver solution
 
const int m_min_subspace_size
 

Additional Inherited Members

- Public Types inherited from chrono::modal::ChGeneralizedEigenvalueSolver< std::complex< double > >
using ScalarType = std::complex< double >
 
- Static Public Member Functions inherited from chrono::modal::ChUnsymGenEigenvalueSolver
static void GetNaturalFrequencies (const ChVectorDynamic< ScalarType > &eigvals, ChVectorDynamic< double > &natural_freq)
 
static void GetDampedFrequencies (const ChVectorDynamic< ScalarType > &eigvals, ChVectorDynamic< double > &damped_freq)
 
static void GetDampingRatios (const ChVectorDynamic< ScalarType > &eigvals, ChVectorDynamic< double > &damp_ratios)
 
static double GetNaturalFrequency (ScalarType eigval)
 
static ScalarType GetOptimalShift (double frequency)
 
- Static Public Member Functions inherited from chrono::modal::ChGeneralizedEigenvalueSolver< std::complex< double > >
static void SortRitzPairs (ChVectorDynamic< ScalarType > &eigvals, ChMatrixDynamic< ScalarType > &eigvects, std::function< bool(const ChVectorDynamic< ScalarType > &, int, int)> ordering_fun=[](const ChVectorDynamic< std::complex< double >> &eigv, int a, int b) { return std::abs(eigv(a))< std::abs(eigv(b));})
 Sort the eigenvalues and eigenvectors in the order specified by the ordering function in-place.
 
static double GetMaxResidual (const ChSparseMatrix &A, const ChSparseMatrix &B, const ChMatrixDynamic< ScalarType > &eigvects, const ChVectorDynamic< ScalarType > &eigvals)
 
static double GetMaxResidual (const ChSparseMatrix &K, const ChSparseMatrix &M, const ChSparseMatrix &Cq, const ChMatrixDynamic< ScalarType > &eigvects, const ChVectorDynamic< ScalarType > &eigvals)
 
static double GetMaxResidual (const ChSparseMatrix &K, const ChSparseMatrix &R, const ChSparseMatrix &M, const ChSparseMatrix &Cq, const ChMatrixDynamic< ScalarType > &eigvects, const ChVectorDynamic< ScalarType > &eigvals)
 
static double BuildUndampedSystem (const ChSparseMatrix &M, const ChSparseMatrix &K, const ChSparseMatrix &Cq, ChSparseMatrix &A, ChSparseMatrix &B, bool scaleCq)
 Build the quadratic eigenvalue problem matrix for the undamped case. More...
 
static double BuildDampedSystem (const ChSparseMatrix &M, const ChSparseMatrix &R, const ChSparseMatrix &K, const ChSparseMatrix &Cq, ChSparseMatrix &A, ChSparseMatrix &B, bool scaleCq)
 Build the quadratic eigenvalue problem matrix for the damped case. More...
 
static void InsertUniqueRitzPairs (const ChVectorDynamic< ScalarType > &eigvals_source, const ChMatrixDynamic< ScalarType > &eigvects_source, ChVectorDynamic< ScalarType > &eigvals_total, ChMatrixDynamic< ScalarType > &eigvects_total, std::function< double(ScalarType)> freq_from_eigval_fun, int &found_eigs, int num_eigvals_source, double equal_freq_tolerance=1e-4)
 Add unique ritz pairs to a wider set of ritz pairs. More...
 
- Public Attributes inherited from chrono::modal::ChGeneralizedEigenvalueSolver< std::complex< double > >
double tolerance
 tolerance for the iterative solver.
 
int max_iterations
 upper limit for the number of iterations. If too low might not converge.
 
bool verbose
 turn to true to see some diagnostic.
 
bool sort_ritz_pairs
 sort the eigenvalues based on the smallest absolute value
 
- Static Protected Member Functions inherited from chrono::modal::ChGeneralizedEigenvalueSolver< std::complex< double > >
static Eigen::PermutationMatrix< Eigen::Dynamic, Eigen::Dynamic > GetPermutationMatrix (int num_elements, std::function< bool(int, int)> ordering_fun)
 Returns the permutation matrix to sort the given elements based on the ordering function.
 

Constructor & Destructor Documentation

◆ ChUnsymGenEigenvalueSolverKrylovSchur()

chrono::modal::ChUnsymGenEigenvalueSolverKrylovSchur::ChUnsymGenEigenvalueSolverKrylovSchur ( std::shared_ptr< ChDirectSolverLScomplex linear_solver = chrono_types::make_shared<ChSolverSparseComplexLU>())

Default: uses Eigen::SparseLU as factorization for the shift&invert, otherwise pass a custom complex sparse solver for faster factorization (ex.

ChSolverComplexPardisoMKL)

Member Function Documentation

◆ Solve()

int chrono::modal::ChUnsymGenEigenvalueSolverKrylovSchur::Solve ( const ChSparseMatrix A,
const ChSparseMatrix B,
ChMatrixDynamic< ScalarType > &  eigvects,
ChVectorDynamic< ScalarType > &  eigvals,
int  num_modes,
ScalarType  sigma 
) const
overridevirtual

Solve the generalized eigenvalue problem A*eigvects = B*eigvects*diag(eigvals) A and B are real; potentially unsymmetric 'eigvects' will be resized to [A.rows() x num_modes] 'eigvals' will be resized to [num_modes] the number of converged eigenvalues is returned.

< output matrix with eigenvectors as columns, will be resized

< output vector with eigenvalues (real part not zero if some damping), will be resized

< 0 = k-th eigenvalue is real, 1= k-th and k-th+1 are complex conjugate pairs

< 0 = has converged, 1 = hasn't converged

< number of converged eigenvalues

< number of used iterations

< callback for A*v

< initial approx of eigenvector, or random

< size of A

< number of needed eigenvalues

< Krylov restart threshold (largest dimension of krylov subspace)

< max iteration number

< tolerance

Parameters
Ainput A matrix
Binput B matrix

The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_modal/ChUnsymGenEigenvalueSolver.h
  • /builds/uwsbel/chrono/src/chrono_modal/ChUnsymGenEigenvalueSolver.cpp