https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NonlinearEigenSystem.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
12// MOOSE includes
13#include "DirichletBC.h"
14#include "EigenDirichletBC.h"
15#include "ArrayDirichletBC.h"
17#include "EigenProblem.h"
18#include "IntegratedBC.h"
19#include "KernelBase.h"
20#include "NodalBC.h"
21#include "TimeIntegrator.h"
22#include "SlepcSupport.h"
23#include "DGKernelBase.h"
24#include "ScalarKernelBase.h"
25#include "MooseVariableScalar.h"
26#include "ResidualObject.h"
27
28#include "libmesh/libmesh_config.h"
29#include "libmesh/petsc_matrix.h"
30#include "libmesh/sparse_matrix.h"
31#include "libmesh/diagonal_matrix.h"
32#include "libmesh/petsc_shell_matrix.h"
33#include "libmesh/petsc_solver_exception.h"
34#include "libmesh/slepc_eigen_solver.h"
35
36#ifdef LIBMESH_HAVE_SLEPC
37
38namespace Moose
39{
40
41void
42assemble_matrix(EquationSystems & es, const std::string & system_name)
43{
44 EigenProblem * p = es.parameters.get<EigenProblem *>("_eigen_problem");
45 auto & eigen_system = es.get_system<libMesh::CondensedEigenSystem>(system_name);
46 NonlinearEigenSystem & eigen_nl =
47 p->getNonlinearEigenSystem(/*nl_sys_num=*/eigen_system.number());
48
49 // If this is a nonlinear eigenvalue problem,
50 // we do not need to assemble anything
51 if (p->isNonlinearEigenvalueSolver(eigen_nl.number()))
52 {
53 // If you want an efficient eigensolver,
54 // please use PETSc 3.13 or newer.
55 // We need to do an unnecessary assembly,
56 // if you use PETSc that is older than 3.13.
57#if PETSC_RELEASE_LESS_THAN(3, 13, 0)
58 if (eigen_system.has_matrix_B())
59 p->computeJacobianTag(*eigen_system.current_local_solution,
60 eigen_system.get_matrix_B(),
61 eigen_nl.eigenMatrixTag());
62#endif
63 return;
64 }
65
66#if !PETSC_RELEASE_LESS_THAN(3, 13, 0)
67 // If we use shell matrices and do not use a shell preconditioning matrix,
68 // we only need to form a preconditioning matrix
69 if (eigen_system.use_shell_matrices() && !eigen_system.use_shell_precond_matrix())
70 {
71 p->computeJacobianTag(*eigen_system.current_local_solution,
72 eigen_system.get_precond_matrix(),
73 eigen_nl.precondMatrixTag());
74 return;
75 }
76#endif
77 // If it is a linear generalized eigenvalue problem,
78 // we assemble A and B together
79 if (eigen_system.generalized())
80 {
81 p->computeJacobianAB(*eigen_system.current_local_solution,
82 eigen_system.get_matrix_A(),
83 eigen_system.get_matrix_B(),
84 eigen_nl.nonEigenMatrixTag(),
85 eigen_nl.eigenMatrixTag());
86#if LIBMESH_HAVE_SLEPC
88 LibmeshPetscCallA(
89 p->comm().get(),
90 MatScale(cast_ref<PetscMatrix<Number> &>(eigen_system.get_matrix_B()).mat(), -1.0));
91#endif
92 return;
93 }
94
95 // If it is a linear eigenvalue problem, we assemble matrix A
96 {
97 p->computeJacobianTag(*eigen_system.current_local_solution,
98 eigen_system.get_matrix_A(),
99 eigen_nl.nonEigenMatrixTag());
100
101 return;
102 }
103}
104}
105
106NonlinearEigenSystem::NonlinearEigenSystem(EigenProblem & eigen_problem, const std::string & name)
108 eigen_problem, eigen_problem.es().add_system<libMesh::CondensedEigenSystem>(name), name),
109 _eigen_sys(eigen_problem.es().get_system<libMesh::CondensedEigenSystem>(name)),
110 _eigen_problem(eigen_problem),
111 _solver_configuration(nullptr),
112 _n_eigen_pairs_required(eigen_problem.getNEigenPairsRequired()),
113 _work_rhs_vector_AX(addVector("work_rhs_vector_Ax", false, PARALLEL)),
114 _work_rhs_vector_BX(addVector("work_rhs_vector_Bx", false, PARALLEL)),
115 _precond_matrix_includes_eigen(false),
116 _preconditioner(nullptr),
117 _num_constrained_dofs(0)
118{
120 cast_ptr<libMesh::SlepcEigenSolver<Number> *>(_eigen_sys.eigen_solver.get());
121
122 if (!solver)
123 mooseError("A slepc eigen solver is required");
124
125 // setup of our class @SlepcSolverConfiguration
127 std::make_unique<SlepcEigenSolverConfiguration>(eigen_problem, *solver, *this);
128
130
131 _Ax_tag = eigen_problem.addVectorTag("Ax_tag");
132
133 _Bx_tag = eigen_problem.addVectorTag("Eigen");
134
135 _A_tag = eigen_problem.addMatrixTag("A_tag");
136
137 _B_tag = eigen_problem.addMatrixTag("Eigen");
138
139 // By default, _precond_tag and _A_tag will share the same
140 // objects. If we want to include eigen contributions to
141 // the preconditioning matrix, and then _precond_tag will
142 // point to part of "B" objects
143 _precond_tag = eigen_problem.addMatrixTag("Eigen_precond");
144
145 // We do not rely on creating submatrices in the solve routine
147}
148
149void
151{
152 // If it is an eigen dirichlet boundary condition, we should skip it because their
153 // contributions should be zero. If we do not skip it, preconditioning matrix will
154 // be singular because boundary elements are zero.
155 if (_precond_matrix_includes_eigen && !dynamic_cast<EigenDirichletBC *>(&object) &&
156 !dynamic_cast<EigenArrayDirichletBC *>(&object))
157 object.useMatrixTag(_precond_tag, {});
158
159 auto & vtags = object.getVectorTags({});
160 auto & mtags = object.getMatrixTags({});
161
162 const bool eigen = (vtags.find(_Bx_tag) != vtags.end()) || (mtags.find(_B_tag) != mtags.end());
163
164 if (eigen && !_eigen_sys.generalized())
165 object.mooseError("This object has been marked as contributing to B or Bx but the eigen "
166 "problem type is not a generalized one");
167
168 // If it is an eigen kernel, mark its variable as eigen
169 if (eigen)
170 {
171 // Note: the object may be on the displaced system
172 auto sys = object.parameters().get<SystemBase *>("_sys");
173 for (const auto var : object.variables())
174 {
175 const auto & vname = var->name();
176 if (hasScalarVariable(vname))
177 sys->getScalarVariable(0, vname).eigen(true);
178 else
179 sys->getVariable(0, vname).eigen(true);
180 }
181
182 // Associate the eigen matrix tag and the vector tag
183 // if this is a eigen kernel
184 object.useMatrixTag(_B_tag, {});
185 object.useVectorTag(_Bx_tag, {});
186 }
187 else
188 {
189 // Noneigen Vector tag
190 object.useVectorTag(_Ax_tag, {});
191 // Noneigen Matrix tag
192 object.useMatrixTag(_A_tag, {});
193 // Noneigen Kernels
194 object.useMatrixTag(_precond_tag, {});
195 }
196}
197
198void
200{
201 if (!(_num_constrained_dofs = dofMap().n_constrained_dofs()))
202 return;
203
205 const auto m = cast_int<numeric_index_type>(_eigen_sys.local_non_condensed_dofs_vector.size());
206 auto M = m;
209 {
211 // A bit ludicrously MatCopy requires the matrix being copied to to be assembled
213 }
215 {
218 }
220 {
223 }
224}
225
226void
232
233void
239
240void
242{
243 const bool presolve_succeeded = preSolve();
244 if (!presolve_succeeded)
245 return;
246
247 std::unique_ptr<NumericVector<Number>> subvec;
248
249 // We apply initial guess for only nonlinear solver
251 {
253 {
256 }
257 else
259 }
260
261 const bool time_integrator_solve = std::any_of(_time_integrators.begin(),
262 _time_integrators.end(),
263 [](auto & ti) { return ti->overridesSolve(); });
264 if (time_integrator_solve)
265 mooseAssert(_time_integrators.size() == 1,
266 "If solve is overridden, then there must be only one time integrator");
267
268 if (time_integrator_solve)
269 _time_integrators.front()->solve();
270 else
271 system().solve();
272
273 for (auto & ti : _time_integrators)
274 {
275 if (!ti->overridesSolve())
276 ti->setNumIterationsLastSolve();
277 ti->postSolve();
278 }
279
280 // store solve information
282 {
283 auto snes = getSNES();
284
285 // nonlinear iterations
286 PetscInt nl_its;
287 LibmeshPetscCallA(_eigen_problem.comm().get(), SNESGetIterationNumber(snes, &nl_its));
288 _n_iters = nl_its;
289
290 // linear iterations
291 PetscInt l_its;
292 LibmeshPetscCallA(_eigen_problem.comm().get(), SNESGetLinearSolveIterations(snes, &l_its));
293 _n_linear_iters = l_its;
294
295 // final residual
296 PetscReal norm;
297 LibmeshPetscCall(SNESGetFunctionNorm(snes, &norm));
298 _final_residual = norm;
299 }
300
301 // store eigenvalues
302 unsigned int n_converged_eigenvalues = getNumConvergedEigenvalues();
303
305
306 if (_n_eigen_pairs_required < n_converged_eigenvalues)
307 n_converged_eigenvalues = _n_eigen_pairs_required;
308
309 _eigen_values.resize(n_converged_eigenvalues);
310 for (unsigned int n = 0; n < n_converged_eigenvalues; n++)
312
313 // Update the solution vector to the active eigenvector
314 if (n_converged_eigenvalues)
316
319}
320
321unsigned int
323{
324 if (!_time_integrators.empty())
325 mooseError("Not implemented for time integrators.");
327 mooseError("Only implemented for nonlinear eigenvalue solvers.");
328
329 return _n_iters;
330}
331
332unsigned int
334{
335 if (!_time_integrators.empty())
336 mooseError("Not implemented for time integrators.");
338 mooseError("Only implemented for nonlinear eigenvalue solvers.");
339
340 return _n_linear_iters;
341}
342
343Real
345{
347 mooseError("Only implemented for nonlinear eigenvalue solvers.");
348
349 return _final_residual;
350}
351
352void
354{
355 // Tell libmesh not to close matrices before solve
356 _eigen_sys.get_eigen_solver().set_close_matrix_before_solve(false);
357
359 {
360 // Condensed Matrix A
362 {
363 Mat mat = cast_ref<PetscMatrix<Number> &>(_eigen_sys.get_condensed_matrix_A()).mat();
364
366 }
367
368 // Condensed Matrix B
370 {
371 Mat mat = cast_ref<PetscMatrix<Number> &>(_eigen_sys.get_condensed_matrix_B()).mat();
372
374 }
375
376 // Condensed Preconditioning matrix
378 {
379 Mat mat = cast_ref<PetscMatrix<Number> &>(_eigen_sys.get_condensed_precond_matrix()).mat();
380
382 }
383 }
384 else
385 {
386 // Matrix A
388 {
389 Mat mat = cast_ref<PetscMatrix<Number> &>(_eigen_sys.get_matrix_A()).mat();
390
392 }
393
394 // Matrix B
396 {
397 Mat mat = cast_ref<PetscMatrix<Number> &>(_eigen_sys.get_matrix_B()).mat();
398
400 }
401
402 // Preconditioning matrix
404 {
405 Mat mat = cast_ref<PetscMatrix<Number> &>(_eigen_sys.get_precond_matrix()).mat();
406
408 }
409 }
410
411 // Shell matrix A
413 {
414 Mat mat = cast_ref<libMesh::PetscShellMatrix<Number> &>(_eigen_sys.get_shell_matrix_A()).mat();
415
416 // Attach callbacks for nonlinear eigenvalue solver
418
419 // Set MatMult operations for shell
421 }
422
423 // Shell matrix B
425 {
426 Mat mat = cast_ref<libMesh::PetscShellMatrix<Number> &>(_eigen_sys.get_shell_matrix_B()).mat();
427
429
430 // Set MatMult operations for shell
432 }
433
434 // Shell preconditioning matrix
436 {
437 Mat mat =
438 cast_ref<libMesh::PetscShellMatrix<Number> &>(_eigen_sys.get_shell_precond_matrix()).mat();
439
441 }
442}
443
444void
445NonlinearEigenSystem::stopSolve(const ExecFlagType &, const std::set<TagID> &)
446{
447 mooseError("did not implement yet \n");
448}
449
450void
455
456bool
461
462unsigned int
464{
465 mooseError("did not implement yet \n");
466 return 0;
467}
468
469NumericVector<Number> &
474
475NumericVector<Number> &
480
481NumericVector<Number> &
486
489{
490 mooseError("did not implement yet \n");
491 return NULL;
492}
493
494SNES
496{
497 EPS eps = getEPS();
498
500 {
501 SNES snes = nullptr;
502 LibmeshPetscCall(Moose::SlepcSupport::mooseSlepcEPSGetSNES(eps, &snes));
503 return snes;
504 }
505 else
506 mooseError("There is no SNES in linear eigen solver");
507}
508
509EPS
511{
513 cast_ptr<libMesh::SlepcEigenSolver<Number> *>(&(*_eigen_sys.eigen_solver));
514
515 if (!solver)
516 mooseError("Unable to retrieve eigen solver");
517
518 return solver->eps();
519}
520
521void
523{
525 {
526 const auto & nodal_bcs = _nodal_bcs.getActiveObjects();
527 for (const auto & nodal_bc : nodal_bcs)
528 {
529 // If this is a dirichlet boundary condition
530 auto nbc = std::dynamic_pointer_cast<DirichletBC>(nodal_bc);
531 // If this is a eigen Dirichlet boundary condition
532 auto eigen_nbc = std::dynamic_pointer_cast<EigenDirichletBC>(nodal_bc);
533 // ArrayDirichletBC
534 auto anbc = std::dynamic_pointer_cast<ArrayDirichletBC>(nodal_bc);
535 // EigenArrayDirichletBC
536 auto aeigen_nbc = std::dynamic_pointer_cast<EigenArrayDirichletBC>(nodal_bc);
537 // If it is a Dirichlet boundary condition, then value has to be zero
538 if (nbc && nbc->variable().eigen() && nbc->getParam<Real>("value"))
540 "Can't set an inhomogeneous Dirichlet boundary condition for eigenvalue problems.");
541 // If it is an array Dirichlet boundary condition, all values should be zero
542 else if (anbc)
543 {
544 auto & values = anbc->getParam<RealEigenVector>("values");
545 for (MooseIndex(values) i = 0; i < values.size(); i++)
546 {
547 if (values(i))
548 mooseError("Can't set an inhomogeneous array Dirichlet boundary condition for "
549 "eigenvalue problems.");
550 }
551 }
552 else if (!nbc && !eigen_nbc && !anbc && !aeigen_nbc)
554 "Invalid NodalBC for eigenvalue problems, please use homogeneous (array) Dirichlet.");
555 }
556 }
557}
558
559std::pair<Real, Real>
561{
562 unsigned int n_converged_eigenvalues = getNumConvergedEigenvalues();
563 if (n >= n_converged_eigenvalues)
564 mooseError(n, " not in [0, ", n_converged_eigenvalues, ")");
565 return _eigen_sys.get_eigenvalue(n);
566}
567
568std::pair<Real, Real>
570{
571 unsigned int n_converged_eigenvalues = getNumConvergedEigenvalues();
572
573 if (n >= n_converged_eigenvalues)
574 mooseError(n, " not in [0, ", n_converged_eigenvalues, ")");
575
576 return _eigen_sys.get_eigenpair(n);
577}
578
579void
580NonlinearEigenSystem::attachPreconditioner(Preconditioner<Number> * preconditioner)
581{
583
584 // If we have a customized preconditioner,
585 // We need to let PETSc know that
586 if (_preconditioner)
587 {
588 LibmeshPetscCall(Moose::SlepcSupport::registerPCToPETSc());
589 // Mark this, and then we can setup correct petsc options
592 }
593}
594
595void
597{
598 // Let us do nothing at the current moment
599}
600
601void
603{
605 "NonlinearEigenSystem::residualAndJacobianTogether is not implemented. It might even be "
606 "nonsensical. If it is sensical and you want this capability, please contact a MOOSE "
607 "developer.");
608}
609
610void
615
616void
621
622std::set<TagID>
624{
626 tags.insert(eigenVectorTag());
627 tags.insert(nonEigenVectorTag());
628 return tags;
629}
630
631std::set<TagID>
633{
635 tags.insert(eigenMatrixTag());
636 tags.insert(nonEigenMatrixTag());
637 return tags;
638}
639
640#else
641
643 const std::string & /*name*/)
644 : libMesh::ParallelObject(eigen_problem)
645{
646 mooseError("Need to install SLEPc to solve eigenvalue problems, please reconfigure libMesh\n");
647}
648
649#endif /* LIBMESH_HAVE_SLEPC */
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
std::array< Real, 2 > values
Definition MortarUtils.C:52
Boundary condition of a Dirichlet type for the eigen side.
Set Dirichlet boundary condition for eigenvalue problems.
Problem for solving eigenvalue problems.
bool negativeSignEigenKernel() const
A flag indicates if a negative sign is used in eigen kernels.
NonlinearEigenSystem & getNonlinearEigenSystem(const unsigned int nl_sys_num)
unsigned int activeEigenvalueIndex() const
Which eigenvalue is active.
virtual void computeJacobianTag(const NumericVector< Number > &soln, SparseMatrix< Number > &jacobian, TagID tag) override
Form a Jacobian matrix for all kernels and BCs with a given tag.
unsigned int getNEigenPairsRequired() const
bool isNonlinearEigenvalueSolver(unsigned int eigen_sys_num) const
void computeJacobianAB(const NumericVector< Number > &soln, SparseMatrix< Number > &jacobianA, SparseMatrix< Number > &jacobianB, TagID tagA, TagID tagB)
Form two Jacobian matrices, where each is associated with one tag, through one element-loop.
virtual void computeResidualTag(const NumericVector< Number > &soln, NumericVector< Number > &residual, TagID tag) override
Form a vector for all kernels and BCs with a given tag.
SolverParams & solverParams(unsigned int solver_sys_num=0)
Get the solver parameters.
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Class for containing MooseEnum item information.
bool hasActiveObjects(THREAD_ID tid=0) const
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread.
Nonlinear eigenvalue system to be solved.
TagID eigenVectorTag() const
Vector tag ID of right hand side.
virtual bool converged() override
Returns the convergence state.
virtual void postAddResidualObject(ResidualObject &object) override
Called after any ResidualObject-derived objects are added to the system.
NumericVector< Number > & residualVectorAX()
dof_id_type _num_constrained_dofs
The number of degrees of freedom constrained at the libMesh level, e.g.
TagID nonEigenVectorTag() const
Vector tag ID of left hand side.
virtual unsigned int getCurrentNonlinearIterationNumber() override
Returns the current nonlinear iteration number.
void computeScalingJacobian() override
Compute a "Jacobian" for automatic scaling purposes.
void computeScalingResidual() override
Compute a "residual" for automatic scaling purposes.
std::set< TagID > defaultMatrixTags() const override
Get the default matrix tags associted with this system.
virtual libMesh::NonlinearSolver< Number > * nonlinearSolver() override
virtual unsigned int nLinearIterations() const override
Return the number of linear iterations.
libMesh::CondensedEigenSystem & _eigen_sys
NonlinearEigenSystem(EigenProblem &problem, const std::string &name)
virtual SNES getSNES() override
Retrieve snes from slepc eigen solver.
void checkIntegrity()
For eigenvalue problems (including standard and generalized), inhomogeneous (Dirichlet or Neumann) bo...
virtual void postInit() override
virtual Real finalNonlinearResidual() const override
Return the final nonlinear residual.
virtual void turnOffJacobian() override
Turn off the Jacobian (must be called before equation system initialization)
virtual void attachPreconditioner(libMesh::Preconditioner< Number > *preconditioner) override
Attach a customized preconditioner that requires physics knowledge.
virtual NumericVector< Number > & RHS() override
NumericVector< Number > & residualVectorBX()
std::set< TagID > defaultVectorTags() const override
Get the default vector tags associated with this system.
libMesh::Preconditioner< Number > * preconditioner() const
void residualAndJacobianTogether() override
Call this method if you want the residual and Jacobian to be computed simultaneously.
virtual void solve() override
Solve the system (using libMesh magic)
std::pair< Real, Real > getConvergedEigenpair(dof_id_type n) const
Return the Nth converged eigenvalue and copies the respective eigen vector to the solution vector.
virtual void stopSolve(const ExecFlagType &exec_flag, const std::set< TagID > &vector_tags_to_close) override
Quit the current solve as soon as possible.
libMesh::Preconditioner< Number > * _preconditioner
TagID nonEigenMatrixTag() const
Matrix tag ID of left hand side.
TagID eigenMatrixTag() const
Matrix tag ID of right hand side.
NumericVector< Number > & _work_rhs_vector_BX
std::pair< Real, Real > getConvergedEigenvalue(dof_id_type n) const
Return the Nth converged eigenvalue.
unsigned int getNumConvergedEigenvalues() const
Get the number of converged eigenvalues.
virtual unsigned int nNonlinearIterations() const override
Return the number of non-linear iterations.
virtual void setupFiniteDifferencedPreconditioner() override
void initializeCondensedMatrices()
Initialize the condensed matrices.
std::unique_ptr< SlepcEigenSolverConfiguration > _solver_configuration
libMesh::CondensedEigenSystem & sys()
virtual void reinit() override
Reinitialize the system when the degrees of freedom in this system have changed.
virtual EPS getEPS()
Retrieve EPS (SLEPc eigen solver)
NumericVector< Number > & _work_rhs_vector_AX
std::vector< std::pair< Real, Real > > _eigen_values
Nonlinear system to be solved.
bool preSolve()
Perform some steps to get ready for the solver.
MooseObjectTagWarehouse< NodalBCBase > _nodal_bcs
std::unique_ptr< libMesh::DiagonalMatrix< Number > > _scaling_matrix
A diagonal matrix used for computing scaling.
virtual libMesh::System & system() override
Get the reference to the libMesh system.
This is the common base class for objects that give residual contributions.
Moose::SolveType _type
bool _customized_pc_for_eigen
const NumericVector< Number > * _current_solution
solution vector from solver
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
Definition SubProblem.C:84
virtual TagID addMatrixTag(TagName tag_name)
Create a Tag.
Definition SubProblem.C:303
Base class for a system (of equations)
Definition SystemBase.h:87
virtual void postInit()
Definition SystemBase.h:166
virtual std::set< TagID > defaultMatrixTags() const
Get the default matrix tags associted with this system.
Definition SystemBase.h:350
std::vector< std::shared_ptr< TimeIntegrator > > _time_integrators
Time integrator.
unsigned int number() const
Gets the number of this system.
virtual bool hasScalarVariable(const std::string &var_name) const
Definition SystemBase.C:876
virtual const std::string & name() const
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
NumericVector< Number > & solution()
Definition SystemBase.h:215
virtual std::set< TagID > defaultVectorTags() const
Get the default vector tags associated with this system.
Definition SystemBase.h:343
virtual void reinit()
Reinitialize the system when the degrees of freedom in this system have changed.
Definition SystemBase.h:172
std::vector< dof_id_type > local_non_condensed_dofs_vector
void initialize_condensed_dofs(const std::set< dof_id_type > &global_condensed_dofs_set=std::set< dof_id_type >())
SparseMatrix< Number > & get_condensed_matrix_B()
virtual std::pair< Real, Real > get_eigenpair(dof_id_type i) override
SparseMatrix< Number > & get_condensed_precond_matrix()
bool has_condensed_precond_matrix() const
SparseMatrix< Number > & get_condensed_matrix_A()
void set_solver_configuration(SolverConfiguration &solver_configuration)
void set_initial_space(NumericVector< Number > &initial_space_in)
virtual std::pair< Real, Real > get_eigenvalue(dof_id_type i)
const SparseMatrix< Number > & get_matrix_B() const
const SparseMatrix< Number > & get_precond_matrix() const
const ShellMatrix< Number > & get_shell_matrix_A() const
unsigned int get_n_converged() const
const ShellMatrix< Number > & get_shell_precond_matrix() const
bool has_shell_precond_matrix() const
const ShellMatrix< Number > & get_shell_matrix_B() const
const SparseMatrix< Number > & get_matrix_A() const
std::unique_ptr< EigenSolver< Number > > eigen_solver
const EigenSolver< Number > & get_eigen_solver() const
virtual std::unique_ptr< NumericVector< T > > get_subvector(const std::vector< numeric_index_type > &)
virtual void restore_subvector(std::unique_ptr< NumericVector< T > >, const std::vector< numeric_index_type > &)
const Parallel::Communicator & _communicator
const Parallel::Communicator & comm() const
const T & get(std::string_view) const
virtual void init(const numeric_index_type m, const numeric_index_type n, const numeric_index_type m_l, const numeric_index_type n_l, const numeric_index_type nnz=30, const numeric_index_type noz=10, const numeric_index_type blocksize=1)=0
virtual void close()=0
virtual void solve()
PETSC_EXTERN PetscErrorCode registerPCToPETSc()
Let PETSc know there is a preconditioner.
PetscErrorCode mooseSlepcEPSGetSNES(EPS eps, SNES *snes)
Retrieve SNES from EPS.
void setOperationsForShellMat(EigenProblem &eigen_problem, Mat mat, bool eigen)
Set operations to shell mat.
void attachCallbacksToMat(EigenProblem &eigen_problem, Mat mat, bool eigen)
Attach call backs to mat.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
@ ST_JFNK
Jacobian-Free Newton Krylov.
Definition MooseTypes.h:903
void assemble_matrix(EquationSystems &es, const std::string &system_name)
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...