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 const auto & fe_type = mooseVariableBase()->feType();
29 if (fe_type.order != CONSTANT || fe_type.family != MONOMIAL)
30 paramError("variable", "Must be of type CONSTANT MONOMIAL");
31 if (fe_type.p_refinement && _subproblem.doingPRefinement())
32 paramError("variable",
33 "p_refinement can push the MONOMIAL order above CONSTANT, which is not supported");
34}
35
36Real
38{
39 // Only check if the user asked to compute p level
40 // if it's not p level then presume that h adaptivity level was asked
41 switch (_level_type)
42 {
43 case LevelType::P:
44 return static_cast<Real>(_current_elem->p_level());
45 default:
46 return static_cast<Real>(_current_elem->level());
47 }
48}
registerMooseObject("MooseApp", ElementAdaptivityLevelAux)
SubProblem & _subproblem
Subproblem this kernel is part of.
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
const libMesh::FEType & feType() const
Get the type of finite element object.
MooseVariableBase * mooseVariableBase() const
Get the variable that this object is using.
bool doingPRefinement() const