Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
ElementLengthAux.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 // MOOSE includes
11 #include "ElementLengthAux.h"
12 #include "MooseMesh.h"
13 
15 
18 {
20  params.addRequiredParam(
21  "method", MooseEnum("min max"), "The size calculation to perform ('min' or 'max').");
22  params.addClassDescription(
23  "Compute the element size using Elem::hmin() or Elem::hmax() from libMesh.");
24  return params;
25 }
26 
28  : AuxKernel(parameters), _use_min(getParam<MooseEnum>("method") == "min")
29 {
30  if (isNodal())
31  paramError("variable", "This AuxKernel only supports Elemental fields");
32 }
33 
34 Real
36 {
37  if (_use_min)
38  return _current_elem->hmin();
39  return _current_elem->hmax();
40 }
ElementLengthAux(const InputParameters &parameters)
virtual Real computeValue() override
Returns the min/max of the current element.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
registerMooseObject("MooseApp", ElementLengthAux)
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...
static InputParameters validParams()
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
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 ...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Elem *const & _current_elem
Current element (valid only for elemental kernels)
Definition: AuxKernel.h:204
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...
static InputParameters validParams()
Definition: AuxKernel.C:27
const bool _use_min
The type of calculation to perform min or max.
Computes the min or max of element length.
bool isNodal() const
Nodal or elemental kernel?
Definition: AuxKernel.h:86