Go to the documentation of this file.
20 #include "libmesh/libmesh_config.h"
21 #ifdef LIBMESH_HAVE_SLEPC
23 #include "libmesh/diff_system.h"
24 #include "libmesh/eigen_time_solver.h"
25 #include "libmesh/eigen_solver.h"
26 #include "libmesh/sparse_matrix.h"
27 #include "libmesh/enum_eigen_solver_type.h"
38 n_eigenpairs_to_compute(5),
39 n_basis_vectors_to_use(3*n_eigenpairs_to_compute),
40 n_converged_eigenpairs(0),
43 libmesh_experimental();
113 libMesh::out <<
"Calling the EigenSolver." << std::endl;
114 std::pair<unsigned int, unsigned int> solve_data =
140 bool jacobian_computed =
146 bool jacobian_computed2 =
152 return jacobian_computed && jacobian_computed2;
159 bool mass_jacobian_computed =
166 return mass_jacobian_computed;
170 libmesh_error_msg(
"Unrecognized value now_assembling = " <<
now_assembling);
187 bool jacobian_computed =
193 bool jacobian_computed2 =
199 return jacobian_computed && jacobian_computed2;
206 bool mass_jacobian_computed =
213 return mass_jacobian_computed;
217 libmesh_error_msg(
"Unrecognized value now_assembling = " <<
now_assembling);
231 bool jacobian_computed =
237 bool jacobian_computed2 =
243 return jacobian_computed && jacobian_computed2;
250 bool mass_jacobian_computed =
257 return mass_jacobian_computed;
261 libmesh_error_msg(
"Unrecognized value now_assembling = " <<
now_assembling);
266 #endif // LIBMESH_HAVE_SLEPC
virtual bool nonlocal_mass_residual(bool request_jacobian, DiffContext &c)
Subtracts any nonlocal mass vector contributions (e.g.
virtual bool side_constraint(bool request_jacobian, DiffContext &)
Adds the constraint contribution on side of elem to elem_residual.
virtual bool element_residual(bool get_jacobian, DiffContext &) override
Forms either the spatial (Jacobian) or mass matrix part of the operator, depending on which is reques...
bool quiet
Print extra debugging information if quiet == false.
unsigned int n_basis_vectors_to_use
The number of basis vectors to use in the computation.
The libMesh namespace provides an interface to certain functionality in the library.
Real tol
The linear solver tolerance to be used when solving the eigenvalue problem.
SparseMatrix< Number > & add_matrix(const std::string &mat_name)
Adds the additional matrix mat_name to this system.
virtual bool nonlocal_constraint(bool request_jacobian, DiffContext &)
Adds any nonlocal constraint contributions (e.g.
static const Real TOLERANCE
unsigned int maxits
The maximum number of iterations allowed to solve the problem.
virtual ~EigenTimeSolver()
Destructor.
This class provides a specific system class.
virtual void solve() override
Implements the assembly of both matrices A and B, and calls the EigenSolver to compute the eigenvalue...
virtual bool nonlocal_time_derivative(bool request_jacobian, DiffContext &)
Adds any nonlocal time derivative contributions (e.g.
virtual bool nonlocal_residual(bool get_jacobian, DiffContext &) override
Forms the jacobian of the nonlocal terms.
virtual bool element_constraint(bool request_jacobian, DiffContext &)
Adds the constraint contribution on elem to elem_residual.
The matrix associated with the time derivative (mass matrix).
virtual bool element_time_derivative(bool request_jacobian, DiffContext &)
Adds the time derivative contribution on elem to elem_residual.
EigenTimeSolver(sys_type &s)
Constructor.
virtual void init() override
The initialization function.
unsigned int n_converged_eigenpairs
After a solve, holds the number of eigenpairs successfully converged.
SparseMatrix< Number > * matrix
The system matrix.
virtual bool side_mass_residual(bool request_jacobian, DiffContext &)
Subtracts a mass vector contribution on side of elem from elem_residual.
unsigned int n_iterations_reqd
After a solve, holds the number of iterations required to converge the requested number of eigenpairs...
bool have_matrix(const std::string &mat_name) const
double pow(double a, int b)
sys_type & _system
A reference to the system we are solving.
This class provides all data required for a physics package (e.g.
Real elem_solution_derivative
The derivative of elem_solution with respect to the current nonlinear solution.
virtual bool side_residual(bool get_jacobian, DiffContext &) override
Forms the jacobian of the boundary terms.
virtual void reinit() override
The reinitialization function.
NowAssembling now_assembling
Flag which controls the internals of element_residual() and side_residual().
Real elem_solution_rate_derivative
The derivative of elem_solution_rate with respect to the current nonlinear solution,...
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
This class provides an interface to solvers for eigenvalue problems.
const DifferentiablePhysics * get_physics() const
virtual void assembly(bool get_residual, bool get_jacobian, bool apply_heterogeneous_constraints=false, bool apply_no_constraints=false) override=0
Assembles a residual in rhs and/or a jacobian in matrix, as requested.
This is a generic class that defines a solver to handle time integration of DifferentiableSystems.
unsigned int n_eigenpairs_to_compute
The number of eigenvectors/values to be computed.
virtual bool mass_residual(bool request_jacobian, DiffContext &)
Subtracts a mass vector contribution on elem from elem_residual.
virtual bool side_time_derivative(bool request_jacobian, DiffContext &)
Adds the time derivative contribution on side of elem to elem_residual.
The matrix associated with the spatial part of the operator.
std::unique_ptr< EigenSolver< Number > > eigen_solver
The EigenSolver object.
const SparseMatrix< Number > & get_matrix(const std::string &mat_name) const