www.mooseframework.org
Eigenvalues.C
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 #include "Eigenvalues.h"
16 
17 // MOOSE includes
18 #include "NonlinearEigenSystem.h"
19 
20 #include "libmesh/libmesh_config.h"
21 
22 template <>
25 {
27  return params;
28 }
29 
31  : GeneralVectorPostprocessor(parameters),
32  _eigen_values_real(declareVector("eigen_values_real")),
33  _eigen_values_imag(declareVector("eigen_values_imag")),
34  _nl_eigen(dynamic_cast<NonlinearEigenSystem *>(&_fe_problem.getNonlinearSystemBase()))
35 {
36  if (!_nl_eigen)
37  mooseError("Given system is not a NonlinearEigenSystem \n");
38 }
39 
40 void
42 {
43 }
44 
45 void
47 {
48 #if LIBMESH_HAVE_SLEPC
49  const std::vector<std::pair<Real, Real>> & eigenvalues = _nl_eigen->getAllConvergedEigenvalues();
50  unsigned int n_converged_eigenvalues = eigenvalues.size();
51  _eigen_values_real.resize(n_converged_eigenvalues);
52  _eigen_values_imag.resize(n_converged_eigenvalues);
53  for (unsigned int n = 0; n < n_converged_eigenvalues; n++)
54  {
55  _eigen_values_real[n] = eigenvalues[n].first;
56  _eigen_values_imag[n] = eigenvalues[n].second;
57  }
58 #else
59  _eigen_values_real.clear();
60  _eigen_values_imag.clear();
61 #endif
62 }
Nonlinear eigenvalue system to be solved.
virtual const std::vector< std::pair< Real, Real > > & getAllConvergedEigenvalues()
Get the number of converged eigenvalues.
This class is here to combine the VectorPostprocessor interface and the base class VectorPostprocesso...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Eigenvalues(const InputParameters &parameters)
Definition: Eigenvalues.C:30
InputParameters validParams< GeneralVectorPostprocessor >()
NonlinearEigenSystem * _nl_eigen
Definition: Eigenvalues.h:38
InputParameters validParams< Eigenvalues >()
Definition: Eigenvalues.C:24
VectorPostprocessorValue & _eigen_values_real
Definition: Eigenvalues.h:36
virtual void execute() override
Execute method.
Definition: Eigenvalues.C:46
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition: Eigenvalues.C:41
PetscInt n
void mooseError(Args &&...args) const
Definition: MooseObject.h:80
VectorPostprocessorValue & _eigen_values_imag
Definition: Eigenvalues.h:37