https://mooseframework.inl.gov
MFEMEigenvaluesPostprocessor.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 
10 #ifdef MOOSE_MFEM_ENABLED
11 
13 #include "MFEMEigenproblem.h"
14 #include "MFEMEigensolverBase.h"
15 
17 
20 {
22  params.addClassDescription("Retrieves the eigenvalues from an eigensolve for exporting.");
23  return params;
24 }
25 
27  : MFEMVectorPostprocessor(parameters), _eigenvalues(this->declareVector("eigenvalues"))
28 {
29 }
30 
31 void
33 {
34 }
35 
36 void
38 {
41  if (!eigensolver)
42  mooseError("The solver is not an eigensolver, cannot retrieve eigenvalues.");
43 
44  mfem::Array<mfem::real_t> eigenvalues;
45  eigensolver->getEigenvalues(eigenvalues);
46 
47  const auto ev_dim = getMFEMProblem().getParam<int>("num_modes");
48  _eigenvalues.resize(ev_dim);
49 
50  for (int i = 0; i < ev_dim; i++)
51  _eigenvalues[i] = eigenvalues[i];
52 }
53 
54 #endif
MFEMProblem & getMFEMProblem()
Return the owning MFEM problem.
Definition: MFEMObject.h:45
MFEMProblemData & getProblemData()
Method to get the current MFEMProblemData object storing the current data specifying the FE problem...
Definition: MFEMProblem.h:263
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition: MooseBase.h:416
static InputParameters validParams()
MFEMEigenvaluesPostprocessor(const InputParameters &parameters)
Base class for eigensolvers.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
registerMooseObject("MooseApp", MFEMEigenvaluesPostprocessor)
VectorPostprocessorValue & _eigenvalues
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition: MooseBase.h:281
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
Exports eigenvalues from an eigensolver.
virtual void execute() override
Perform the main work for this object.
virtual void initialize() override
Perform any pre-execution setup for this object.
std::shared_ptr< MFEMSolverBase > jacobian_solver