Go to the documentation of this file.
18 #include "libmesh/libmesh_config.h"
22 #if defined(LIBMESH_HAVE_SLEPC)
24 #include "libmesh/condensed_eigen_system.h"
26 #include "libmesh/dof_map.h"
27 #include "libmesh/equation_systems.h"
28 #include "libmesh/int_range.h"
29 #include "libmesh/libmesh_logging.h"
30 #include "libmesh/numeric_vector.h"
31 #include "libmesh/parallel.h"
37 const std::string & name_in,
38 const unsigned int number_in)
39 :
Parent(es, name_in, number_in),
42 condensed_dofs_initialized(false)
52 std::set<dof_id_type> local_non_condensed_dofs_set;
55 #if LIBMESH_ENABLE_CONSTRAINTS
58 local_non_condensed_dofs_set.insert(i);
61 for (
const auto & dof : global_dirichlet_dofs_set)
63 local_non_condensed_dofs_set.erase(dof);
68 for (
const auto & dof : local_non_condensed_dofs_set)
84 this->
comm().sum(n_global_non_condensed_dofs);
93 LOG_SCOPE(
"solve()",
"CondensedEigenSystem");
144 const unsigned int maxits =
145 es.
parameters.
get<
unsigned int>(
"linear solver maximum iterations");
147 const unsigned int nev =
150 const unsigned int ncv =
153 std::pair<unsigned int, unsigned int> solve_data;
179 LOG_SCOPE(
"get_eigenpair()",
"CondensedEigenSystem");
197 temp->init (n, n_local,
false,
PARALLEL);
199 std::pair<Real, Real> eval =
eigen_solver->get_eigenpair (i, *temp);
206 solution->set(index,(*temp)(temp->first_local_index()+j));
221 #endif // LIBMESH_HAVE_SLEPC
std::unique_ptr< SparseMatrix< Number > > condensed_matrix_B
A second (condensed) system matrix for generalized eigenvalue problems.
void set_n_converged(unsigned int nconv)
Set the _n_converged_eigenpairs member, useful for subclasses of EigenSystem.
const EquationSystems & get_equation_systems() const
std::unique_ptr< SparseMatrix< Number > > matrix_A
The system matrix for standard eigenvalue problems.
virtual void solve() override
Override to solve the condensed eigenproblem with the dofs in local_non_condensed_dofs_vector strippe...
virtual void solve() override
Assembles & solves the eigen system.
The libMesh namespace provides an interface to certain functionality in the library.
const Parallel::Communicator & comm() const
std::unique_ptr< EigenSolver< Number > > eigen_solver
The EigenSolver, defining which interface, i.e solver package to use.
virtual std::pair< Real, Real > get_eigenpair(dof_id_type i) override
Override get_eigenpair() to retrieve the eigenpair for the condensed eigensolve.
dof_id_type first_dof(const processor_id_type proc) const
bool is_constrained_dof(const dof_id_type dof) const
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
bool have_parameter(const std::string &) const
std::unique_ptr< SparseMatrix< Number > > matrix_B
A second system matrix for generalized eigenvalue problems.
bool assemble_before_solve
Flag which tells the system to whether or not to call the user assembly function during each call to ...
The IntRange templated class is intended to make it easy to loop over integers which are indices of a...
CondensedEigenSystem(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
Constructor.
virtual std::pair< Real, Real > get_eigenpair(dof_id_type i)
void initialize_condensed_dofs(const std::set< dof_id_type > &global_condensed_dofs_set=std::set< dof_id_type >())
Loop over the dofs on each processor to initialize the list of non-condensed dofs.
This is the EquationSystems class.
std::vector< dof_id_type > local_non_condensed_dofs_vector
Vector storing the local dof indices that will not be condensed.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Manages consistently variables, degrees of freedom, and coefficient vectors for eigenvalue problems.
This class handles the numbering of degrees of freedom on a mesh.
std::unique_ptr< SparseMatrix< Number > > condensed_matrix_A
The (condensed) system matrix for standard eigenvalue problems.
const DofMap & get_dof_map() const
dof_id_type n_dofs() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool condensed_dofs_initialized
A private flag to indicate whether the condensed dofs have been initialized.
void set_n_iterations(unsigned int its)
Set the _n_iterations member, useful for subclasses of EigenSystem.
const T & get(const std::string &) const
virtual void update()
Update the local values to reflect the solution on neighboring processors.
dof_id_type n_global_non_condensed_dofs() const
dof_id_type end_dof(const processor_id_type proc) const
virtual void assemble() override
Assembles the system matrix.
Parameters parameters
Data structure holding arbitrary parameters.