https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
31void
35
36void
38{
39 auto eigensolver = std::dynamic_pointer_cast<Moose::MFEM::EigensolverBase>(
40 getMFEMProblem().getProblemData().jacobian_solver);
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
registerMooseObject("MooseApp", MFEMEigenvaluesPostprocessor)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
VectorPostprocessorValue & _eigenvalues
virtual void execute() override
Perform the main work for this object.
virtual void initialize() override
Perform any pre-execution setup for this object.
MFEMEigenvaluesPostprocessor(const InputParameters &parameters)
MFEMProblem & getMFEMProblem()
Return the owning MFEM problem.
Definition MFEMObject.h:45
static InputParameters validParams()
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition MooseBase.h:406