https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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').");
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
34Real
36{
37 if (_use_min)
38 return _current_elem->hmin();
39 return _current_elem->hmax();
40}
registerMooseObject("MooseApp", ElementLengthAux)
bool isNodal() const
Nodal or elemental kernel?
Definition AuxKernel.h:43
const Elem *const & _current_elem
Current element (valid only for elemental kernels)
Definition AuxKernel.h:133
static InputParameters validParams()
Definition AuxKernel.C:27
Computes the min or max of element length.
virtual Real computeValue() override
Returns the min/max of the current element.
const bool _use_min
The type of calculation to perform min or max.
ElementLengthAux(const InputParameters &parameters)
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