www.mooseframework.org
NonlinearEigenSystem.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef NONLINEAREIGENSYSTEM_H
16 #define NONLINEAREIGENSYSTEM_H
17 
18 #include "libmesh/libmesh_config.h"
19 
20 #include "NonlinearSystemBase.h"
21 
22 #include "libmesh/transient_system.h"
23 #include "libmesh/eigen_system.h"
24 
25 // forward declarations
26 class EigenProblem;
27 class KernelBase;
28 
29 #if LIBMESH_HAVE_SLEPC
30 
35 {
36 public:
37  NonlinearEigenSystem(EigenProblem & problem, const std::string & name);
38 
39  virtual void solve() override;
40 
44  virtual void stopSolve() override;
45 
50  virtual unsigned int getCurrentNonlinearIterationNumber() override;
51 
52  virtual void setupFiniteDifferencedPreconditioner() override;
53 
59  virtual bool converged() override;
60 
61  virtual NumericVector<Number> & RHS() override;
62 
63  virtual void addEigenKernels(std::shared_ptr<KernelBase> kernel, THREAD_ID tid) override;
64 
70  virtual unsigned int getNumConvergedEigenvalues() const
71  {
72  return _transient_sys.get_n_converged();
73  };
74 
75  virtual NonlinearSolver<Number> * nonlinearSolver() override;
76 
77  virtual NumericVector<Number> & solutionOld() override
78  {
79  return *_transient_sys.old_local_solution;
80  }
81 
82  virtual NumericVector<Number> & solutionOlder() override
83  {
84  return *_transient_sys.older_local_solution;
85  }
86 
87  virtual TransientEigenSystem & sys() { return _transient_sys; }
88 
94  void checkIntegrity();
95 
103  virtual const std::pair<Real, Real> getNthConvergedEigenvalue(dof_id_type n);
104 
110  virtual const std::vector<std::pair<Real, Real>> & getAllConvergedEigenvalues()
111  {
112  return _eigen_values;
113  }
114 
115 protected:
116  TransientEigenSystem & _transient_sys;
118  std::vector<std::pair<Real, Real>> _eigen_values;
120 };
121 
122 #else
123 
124 class NonlinearEigenSystem : public libMesh::ParallelObject
125 {
126 public:
127  NonlinearEigenSystem(EigenProblem & problem, const std::string & name);
128 
133  bool converged() { return false; }
134 
135  void checkIntegrity() {}
136 };
137 
138 #endif
139 
140 #endif /* NONLINEAREIGENSYSTEM_H */
Nonlinear eigenvalue system to be solved.
virtual const std::vector< std::pair< Real, Real > > & getAllConvergedEigenvalues()
Get the number of converged eigenvalues.
virtual NumericVector< Number > & solutionOlder() override
virtual TransientEigenSystem & sys()
virtual void addEigenKernels(std::shared_ptr< KernelBase > kernel, THREAD_ID tid) override
virtual const std::string & name()
Definition: SystemBase.h:453
virtual NonlinearSolver< Number > * nonlinearSolver() override
bool converged()
Returns the convergence state.
NonlinearEigenSystem(EigenProblem &problem, const std::string &name)
Nonlinear system to be solved.
This is the common base class for the two main kernel types implemented in MOOSE, EigenKernel and Ker...
Definition: KernelBase.h:47
virtual const std::pair< Real, Real > getNthConvergedEigenvalue(dof_id_type n)
Return the Nth converged eigenvalue.
virtual unsigned int getNumConvergedEigenvalues() const
Get the number of converged eigenvalues.
virtual bool converged() override
Returns the convergence state.
virtual void stopSolve() override
Quit the current solve as soon as possible.
virtual void setupFiniteDifferencedPreconditioner() override
virtual unsigned int getCurrentNonlinearIterationNumber() override
Returns the current nonlinear iteration number.
TransientEigenSystem & _transient_sys
PetscInt n
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Definition: EigenProblem.h:32
std::vector< std::pair< Real, Real > > _eigen_values
virtual NumericVector< Number > & RHS() override
unsigned int _n_eigen_pairs_required
virtual void solve() override
Solve the system (using libMesh magic)
virtual NumericVector< Number > & solutionOld() override
void checkIntegrity()
For eigenvalue problems (including standard and generalized), inhomogeneous (Dirichlet or Neumann) bo...
unsigned int THREAD_ID
Definition: MooseTypes.h:79