https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ElementAdaptivityLevelAux.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
13
16{
18 params.addClassDescription("stores the element hierarchy in a aux variable");
20 "level", MooseEnum("h p"), "The type of adaptivity level to compute.");
21
22 return params;
23}
24
26 : AuxKernel(parameters), _level_type(getParam<MooseEnum>("level").getEnum<LevelType>())
27{
28 if (mooseVariableBase()->feType() != libMesh::FEType(CONSTANT, MONOMIAL))
29 paramError("variable", "Must be of type CONSTANT MONOMIAL");
30}
31
32Real
34{
35 // Only check if the user asked to compute p level
36 // if it's not p level then presume that h adaptivity level was asked
37 switch (_level_type)
38 {
39 case LevelType::P:
40 return static_cast<Real>(_current_elem->p_level());
41 default:
42 return static_cast<Real>(_current_elem->level());
43 }
44}
registerMooseObject("MooseApp", ElementAdaptivityLevelAux)
const Elem *const & _current_elem
Current element (valid only for elemental kernels)
Definition AuxKernel.h:133
static InputParameters validParams()
Definition AuxKernel.C:27
An aux kernel object which stores the element level in terms of adaptivity in an auxiliary variable.
ElementAdaptivityLevelAux(const InputParameters &parameters)
enum ElementAdaptivityLevelAux::LevelType _level_type
virtual Real computeValue() override
Compute and return the value of the aux variable.
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
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.
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition MooseBase.h:457
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
MooseVariableBase * mooseVariableBase() const
Get the variable that this object is using.