OFELI's Logo

An Object Oriented Finite Element Library

EigenProblemSolver Class Reference

Class to find eigenvalues and corresponding eigenvectors of a given matrix in a generalized eigenproblem, i.e. Find scalars l and non-null vectors v such that [K]{v} = l[M]{v} where [K] and [M] are symmetric matrices. The eigenproblem can be originated from a PDE. For this, we will refer to the matrices K and M as Stiffness and Mass matrices respectively. More...

#include <EigenProblemSolver.h>

Public Member Functions

 EigenProblemSolver ()
 Default constructor.
 
 EigenProblemSolver (DSMatrix< real_t > &K, int n=0)
 Constructor for a dense symmetric matrix that computes the eigenvalues. More...
 
 EigenProblemSolver (SkSMatrix< real_t > &K, SkSMatrix< real_t > &M, int n=0)
 Constructor for Symmetric Skyline Matrices. More...
 
 EigenProblemSolver (SkSMatrix< real_t > &K, Vect< real_t > &M, int n=0)
 Constructor for Symmetric Skyline Matrices. More...
 
 EigenProblemSolver (DSMatrix< real_t > &A, Vect< real_t > &ev, int n=0)
 Constructor for a dense matrix that compute the eigenvalues. More...
 
 EigenProblemSolver (Equa &eq, bool lumped=true)
 Consrtuctor using partial differential equation. More...
 
 ~EigenProblemSolver ()
 Destructor.
 
void setMatrix (SkSMatrix< real_t > &K, SkSMatrix< real_t > &M)
 Set matrix instances (Symmetric matrices). More...
 
void setMatrix (SkSMatrix< real_t > &K, Vect< real_t > &M)
 Set matrix instances (Symmetric matrices). More...
 
void setMatrix (DSMatrix< real_t > &K)
 Set matrix instance (Symmetric matrix). More...
 
void setPDE (Equa &eq, bool lumped=true)
 Define partial differential equation to solve. More...
 
int run (int nb=0)
 Run the eigenproblem solver. More...
 
void Assembly (const Element &el, real_t *eK, real_t *eM)
 Assemble element arrays into global matrices. More...
 
void SAssembly (const Side &sd, real_t *sK)
 Assemble side arrays into global matrix and right-hand side. More...
 
int runSubSpace (size_t nb_eigv, size_t ss_dim=0)
 Run the subspace iteration solver. More...
 
void setSubspaceDimension (int dim)
 Define the subspace dimension. More...
 
void setMaxIter (int max_it)
 set maximal number of iterations.
 
void setTolerance (real_t eps)
 set tolerance value More...
 
int checkSturm (int &nb_found, int &nb_lost)
 Check how many eigenvalues have been found using Sturm sequence method. More...
 
int getNbIter () const
 Return actual number of performed iterations.
 
real_t getEigenValue (int n) const
 Return the n-th eigenvalue.
 
void getEigenVector (int n, Vect< real_t > &v) const
 Return the n-th eigenvector. More...
 

Detailed Description

Class to find eigenvalues and corresponding eigenvectors of a given matrix in a generalized eigenproblem, i.e. Find scalars l and non-null vectors v such that [K]{v} = l[M]{v} where [K] and [M] are symmetric matrices. The eigenproblem can be originated from a PDE. For this, we will refer to the matrices K and M as Stiffness and Mass matrices respectively.

Author
Rachid Touzani

Constructor & Destructor Documentation

◆ EigenProblemSolver() [1/5]

EigenProblemSolver ( DSMatrix< real_t > &  K,
int  n = 0 
)

Constructor for a dense symmetric matrix that computes the eigenvalues.

This constructor solves in place the eigenvalues problem and stores them in a vector (No need to use the function runSubSpace). The eigenvectors can be obtained by calling the member function getEigenVector.

Parameters
[in]KMatrix for which eigenmodes are sought.
[in]nNumber of eigenvalues to extract. By default all eigenvalues are computed.

◆ EigenProblemSolver() [2/5]

EigenProblemSolver ( SkSMatrix< real_t > &  K,
SkSMatrix< real_t > &  M,
int  n = 0 
)

Constructor for Symmetric Skyline Matrices.

Parameters
[in]K"Stiffness" matrix
[in]M"Mass" matrix
[in]nNumber of eigenvalues to extract. By default all eigenvalues are computed.
Note
The generalized eigenvalue problem is defined by Kx = aMx, where K and M are referred to as stiffness and mass matrix.

◆ EigenProblemSolver() [3/5]

EigenProblemSolver ( SkSMatrix< real_t > &  K,
Vect< real_t > &  M,
int  n = 0 
)

Constructor for Symmetric Skyline Matrices.

Parameters
[in]K"Stiffness" matrix
[in]MDiagonal "Mass" matrix stored as a Vect instance
[in]nNumber of eigenvalues to extract. By default all eigenvalues are computed.
Note
The generalized eigenvalue problem is defined by Kx = aMx, where K and M are referred to as stiffness and mass matrix.

◆ EigenProblemSolver() [4/5]

EigenProblemSolver ( DSMatrix< real_t > &  A,
Vect< real_t > &  ev,
int  n = 0 
)

Constructor for a dense matrix that compute the eigenvalues.

This constructor solves in place the eigenvalues problem and stores them in a vector (No need to use the function runSubSpace). The eigenvectors can be obtained by calling the member function getEigenVector.

Parameters
[in]AMatrix for which eigenmodes are sought.
[in]evVector containing all computed eigenvalues sorted increasingly.
[in]nNumber of eigenvalues to extract. By default all eigenvalues are computed.
Remarks
The vector ev does not need to be sized before.

◆ EigenProblemSolver() [5/5]

EigenProblemSolver ( Equa eq,
bool  lumped = true 
)

Consrtuctor using partial differential equation.

The used equation class must have been constructed using the Mesh instance

Parameters
[in]eqReference to equation instance
[in]lumpedMass matrix is lumped (true) or not (false) [Default: true]

Member Function Documentation

◆ Assembly()

void Assembly ( const Element el,
real_t eK,
real_t eM 
)

Assemble element arrays into global matrices.

This member function is to be called from finite element equation classes

Parameters
[in]elReference to Element class
[in]eKPointer to element stiffness (or assimilated) matrix
[in]eMPointer to element mass (or assimilated) matrix

◆ checkSturm()

int checkSturm ( int &  nb_found,
int &  nb_lost 
)

Check how many eigenvalues have been found using Sturm sequence method.

Parameters
[out]nb_foundnumber of eigenvalues actually found
[out]nb_lostnumber of eigenvalues missing
Returns
- 0, Successful completion of subroutine.
  • 1, No convergent eigenvalues found.

◆ getEigenVector()

void getEigenVector ( int  n,
Vect< real_t > &  v 
) const

Return the n-th eigenvector.

Parameters
[in]nLabel of eigenvector (They are stored in ascending order of eigenvalues)
[in,out]vVect instance where the eigenvector is stored.

◆ run()

int run ( int  nb = 0)

Run the eigenproblem solver.

Parameters
[in]nbNumber of eigenvalues to be computed. By default, all eigenvalues are computed.

◆ runSubSpace()

int runSubSpace ( size_t  nb_eigv,
size_t  ss_dim = 0 
)

Run the subspace iteration solver.

This function rune the Bathe subspace iteration method.

Parameters
[in]nb_eigvNumber of eigenvalues to be extracted
[in]ss_dimSubspace dimension. Must be at least equal to the number eigenvalues to seek. [Default: nb_eigv]
Returns
1: Normal execution. Convergence has been achieved. 2: Convergence for eigenvalues has not been attained.

◆ SAssembly()

void SAssembly ( const Side sd,
real_t sK 
)

Assemble side arrays into global matrix and right-hand side.

This member function is to be called from finite element equation classes

Parameters
[in]sdReference to Side class
[in]sKPointer to side stiffness

◆ setMatrix() [1/3]

void setMatrix ( DSMatrix< real_t > &  K)

Set matrix instance (Symmetric matrix).

This function is to be used when the default constructor is applied. Case of a standard (not generalized) eigen problem is to be solved

Parameters
[in]KStiffness matrix instance

◆ setMatrix() [2/3]

void setMatrix ( SkSMatrix< real_t > &  K,
SkSMatrix< real_t > &  M 
)

Set matrix instances (Symmetric matrices).

This function is to be used when the default constructor is applied. Case where the mass matrix is consistent.

Parameters
[in]KStiffness matrix instance
[in]MMass matrix instance

◆ setMatrix() [3/3]

void setMatrix ( SkSMatrix< real_t > &  K,
Vect< real_t > &  M 
)

Set matrix instances (Symmetric matrices).

This function is to be used when the default constructor is applied. Case where the mass matrix is (lumped) diagonal and stored in a vector.

Parameters
[in]KStiffness matrix instance
[in]MMass matrix instance where diagonal terms are stored as a vector.

◆ setPDE()

void setPDE ( Equa eq,
bool  lumped = true 
)

Define partial differential equation to solve.

The used equation class must have been constructed using the Mesh instance

Parameters
[in]eqReference to equation instance
[in]lumpedMass matrix is lumped (true) or not (false) [Default: true]

◆ setSubspaceDimension()

void setSubspaceDimension ( int  dim)

Define the subspace dimension.

Parameters
[in]dimSubspace dimension. Must be larger or equal to the number of wanted eigenvalues. By default this value will be set to the number of wanted eigenvalues

◆ setTolerance()

void setTolerance ( real_t  eps)

set tolerance value

Parameters
[in]epsConvergence tolerance for eigenvalues [Default: 1.e-8]





Copyright © 1998-2022 Rachid Touzani