17 #ifdef gsSpectra_ENABLED
68 m_options.
addReal(
"tol",
"Relative Tolerance",1e-6);
69 m_options.
addReal(
"tolF",
"Residual relative tolerance",-1);
70 m_options.
addReal(
"tolU",
"Solution step relative tolerance",-1);
71 m_options.
addInt(
"maxIt",
"Maximum number of iterations",25);
72 m_options.
addInt(
"verbose",
"Verbose output",0);
73 m_options.
addInt (
"BifurcationMethod",
"Bifurcation Identification based on: 0: Determinant; 1: Eigenvalue",stabmethod::Eigenvalue);
74 m_options.
addString(
"Solver",
"Sparse linear solver",
"SimplicialLDLT");
82 m_maxIterations = m_options.
getInt(
"maxIt");
83 m_verbose = m_options.
getInt(
"verbose");
84 m_stabilityMethod = m_options.
getInt (
"BifurcationMethod");
138 m_DeltaU.setZero(m_dofs);
139 m_deltaU.setZero(m_dofs);
141 m_L = m_DeltaL = m_deltaL = 0.0;
156 return m_stabilityVec;
163 m_solver->compute(jacMat);
165 if (m_solver->info()!=gsEigen::ComputationInfo::Success)
167 gsInfo<<
"Solver error with code "<<m_solver->info()<<
". See Eigen documentation on ComputationInfo \n"
168 <<gsEigen::ComputationInfo::Success<<
": Success"<<
"\n"
169 <<gsEigen::ComputationInfo::NumericalIssue<<
": NumericalIssue"<<
"\n"
170 <<gsEigen::ComputationInfo::NoConvergence<<
": NoConvergence"<<
"\n"
171 <<gsEigen::ComputationInfo::InvalidInput<<
": InvalidInput"<<
"\n";
175 if (
auto * s =
dynamic_cast<typename gsSparseSolver<T>::SimplicialLDLT*
>(m_solver.get()) )
176 m_stabilityVec = s->vectorD();
183 #ifdef gsSpectra_ENABLED
184 index_t number = std::min(static_cast<index_t>(std::floor(jacMat.cols()/5.)),10);
198 es.compute(Spectra::SortRule::LargestAlge,1000,1e-6,Spectra::SortRule::SmallestAlge);
199 if (es.info()!=Spectra::CompInfo::Successful)
201 gsWarn<<
"Spectra did not converge!\n";
209 m_stabilityVec = es.eigenvalues();
211 gsEigen::SelfAdjointEigenSolver<gsMatrix<T>> es2(jacMat);
212 m_stabilityVec = es2.eigenvalues();
215 m_indicator = m_stabilityVec.colwise().minCoeff()[0];
222 bool success =
false;
223 if (m_stabilityMethod == stabmethod::Determinant)
225 else if (m_stabilityMethod == stabmethod::Eigenvalue)
228 gsInfo<<
"bifurcation method unknown!";
231 m_indicator = m_stabilityVec.colwise().minCoeff()[0];
238 T m_L, m_DeltaL, m_deltaL;
241 T m_residual, m_residualIni, m_residualOld;
258 mutable typename gsSparseSolver<T>::uPtr m_solver;
279 #ifndef GISMO_BUILD_LIB
280 #include GISMO_HPP_HEADER(gsStaticBase.hpp)
Shifted Eigenvalue solver for real symmetric matrices.
Definition: gsSpectra.h:359
void addString(const std::string &label, const std::string &desc, const std::string &value)
Adds a option named label, with description desc and value value.
Definition: gsOptionList.cpp:190
virtual gsVector< T > solution() const
Access the solution.
Definition: gsStaticBase.h:95
std::string askString(const std::string &label, const std::string &value="") const
Reads value for option label from options.
Definition: gsOptionList.cpp:106
virtual void initialize()
See gsStaticBase.
Definition: gsStaticBase.h:54
#define index_t
Definition: gsConfig.h:32
gsStatus
Definition: gsStructuralAnalysisTypes.h:20
virtual void defaultOptions()
Get default options.
Definition: gsStaticBase.h:66
const index_t & getInt(const std::string &label) const
Reads value for option label from options.
Definition: gsOptionList.cpp:37
virtual void stepOutput(index_t k)
Stepwise output.
Definition: gsStaticBase.h:63
std::function< bool(gsVector< T > const &, gsVector< T > &)> Residual_t
Residual, Fint-Fext.
Definition: gsStructuralAnalysisTypes.h:65
virtual T indicator(const gsSparseMatrix< T > &jacMat, T shift=-1e-2)
Returns the stability indicator.
Definition: gsStaticBase.h:146
virtual void reset()
Reset the stored solution.
Definition: gsStaticBase.h:135
std::function< bool(gsVector< T > const &, gsSparseMatrix< T > &) > Jacobian_t
Jacobian.
Definition: gsStructuralAnalysisTypes.h:83
virtual bool _computeStabilityDet(const gsSparseMatrix< T > &jacMat)
Computes the stability vector using the determinant of the Jacobian.
Definition: gsStaticBase.h:161
void addInt(const std::string &label, const std::string &desc, const index_t &value)
Adds a option named label, with description desc and value value.
Definition: gsOptionList.cpp:201
Provides a list of labeled parameters/options that can be set and accessed easily.
#define gsWarn
Definition: gsDebug.h:50
std::function< bool(gsVector< T > const &, const T, gsVector< T > &)> ALResidual_t
Arc-Length Residual, Fint-lambda*Fext.
Definition: gsStructuralAnalysisTypes.h:67
virtual void setOptions(gsOptionList &options)
Set the options from options.
Definition: gsStaticBase.h:89
virtual bool converged() const
Returns whether the solver converged or not.
Definition: gsStaticBase.h:126
#define gsInfo
Definition: gsDebug.h:43
virtual index_t iterations() const
Returns the number of iterations.
Definition: gsStaticBase.h:123
virtual void setLoad(const T L)
Set the load.
Definition: gsStaticBase.h:108
virtual gsStatus solve()=0
Solve.
void update(const gsOptionList &other, updateType type=ignoreIfUnknown)
Updates the object using the data from other.
Definition: gsOptionList.cpp:253
Provides a status object and typedefs.
Header file for using Spectra extension.
virtual index_t numDofs()
Returns the number of DoFs of the system.
Definition: gsStaticBase.h:132
virtual void setDisplacement(const gsVector< T > &displacement)
Set the displacement.
Definition: gsStaticBase.h:101
std::function< bool(gsVector< T > const &, gsVector< T > const &, gsSparseMatrix< T > &) > dJacobian_t
Jacobian with solution update as argument.
Definition: gsStructuralAnalysisTypes.h:87
virtual bool _computeStabilityEig(const gsSparseMatrix< T > &jacMat, T shift)
Computes the stability vector using the eigenvalues of the Jacobian, optionally applying a shift...
Definition: gsStaticBase.h:181
void addReal(const std::string &label, const std::string &desc, const Real &value)
Adds a option named label, with description desc and value value.
Definition: gsOptionList.cpp:211
virtual gsVector< T > update() const
Access the update.
Definition: gsStaticBase.h:98
Abstract class for solvers. The solver interface is base on 3 methods: -compute set the system matrix...
Definition: gsSparseSolver.h:66
virtual void setSolution(const gsVector< T > &displacement, const T L)
Set the displacement and the load.
Definition: gsStaticBase.h:111
This is the main header file that collects wrappers of Eigen for linear algebra.
virtual gsVector< T > stabilityVec(const gsSparseMatrix< T > &jacMat, T shift=-1e-2)
Returns the stability vector.
Definition: gsStaticBase.h:153
Class which holds a list of parameters/options, and provides easy access to them. ...
Definition: gsOptionList.h:32
virtual gsOptionList options() const
Get options.
Definition: gsStaticBase.h:92
virtual bool _computeStability(const gsSparseMatrix< T > &jacMat, T shift)
Computes the stability of the Jacobian, optionally applying a shift (if provided) ...
Definition: gsStaticBase.h:220
virtual void initOutput()
Initialize output.
Definition: gsStaticBase.h:61
Real getReal(const std::string &label) const
Reads value for option label from options.
Definition: gsOptionList.cpp:44
virtual void getOptions()
Apply the options.
Definition: gsStaticBase.h:78
virtual gsStatus status() const
Returns the status.
Definition: gsStaticBase.h:129
Base class for static solvers.
Definition: gsStaticBase.h:37