Line data Source code
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 : 14 : registerMooseObject("MooseApp", ElementLengthAux); 15 : 16 : InputParameters 17 14315 : ElementLengthAux::validParams() 18 : { 19 14315 : InputParameters params = AuxKernel::validParams(); 20 42945 : params.addRequiredParam( 21 28630 : "method", MooseEnum("min max"), "The size calculation to perform ('min' or 'max')."); 22 14315 : params.addClassDescription( 23 : "Compute the element size using Elem::hmin() or Elem::hmax() from libMesh."); 24 14315 : return params; 25 0 : } 26 : 27 26 : ElementLengthAux::ElementLengthAux(const InputParameters & parameters) 28 26 : : AuxKernel(parameters), _use_min(getParam<MooseEnum>("method") == "min") 29 : { 30 26 : if (isNodal()) 31 0 : paramError("variable", "This AuxKernel only supports Elemental fields"); 32 26 : } 33 : 34 : Real 35 16000 : ElementLengthAux::computeValue() 36 : { 37 16000 : if (_use_min) 38 8000 : return _current_elem->hmin(); 39 8000 : return _current_elem->hmax(); 40 : }