www.mooseframework.org
ValueRangeMarker.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #include "ValueRangeMarker.h"
11 #include "FEProblem.h"
12 #include "MooseEnum.h"
13 
15 
18 {
20 
21  params.addRequiredParam<Real>("lower_bound", "The lower bound value for the range.");
22  params.addRequiredParam<Real>("upper_bound", "The upper bound value for the range.");
23  params.addParam<Real>("buffer_size",
24  0.0,
25  "A buffer zone value added to both ends of the range "
26  "where a third_state marker can be returned.");
27 
28  params.addClassDescription("Mark elements for adaptivity based on the supplied upper and lower "
29  "bounds and the specified variable.");
30  return params;
31 }
32 
34  : QuadraturePointMarker(parameters),
35  _lower_bound(parameters.get<Real>("lower_bound")),
36  _upper_bound(parameters.get<Real>("upper_bound")),
37  _buffer_size(parameters.get<Real>("buffer_size")),
38  _inside(getParam<bool>("invert") ? COARSEN : REFINE),
39  _outside(getParam<bool>("invert") ? REFINE : COARSEN)
40 {
42  mooseError("Invalid bounds specified (upper_bound < lower_bound)");
43 
44  if (_buffer_size < 0.0)
45  mooseError("Buffer size must be non-negative: ", _buffer_size);
46 }
47 
50 {
51  // Is the variable value inside the range?
52  if (_u[_qp] >= _lower_bound && _u[_qp] <= _upper_bound)
53  return _inside;
54 
55  // How about the buffer zone?
57  return _third_state;
58 
59  // Must be outside the range
60  return _outside;
61 }
const VariableValue & _u
Holds the solution at current quadrature points.
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1147
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
MarkerValue
This mirrors the main refinement flag values in libMesh in Elem::RefinementState but adds "dont_mark"...
Definition: Marker.h:53
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...
unsigned int _qp
The current quadrature point.
static InputParameters validParams()
static InputParameters validParams()
ValueRangeMarker(const InputParameters &parameters)
virtual MarkerValue computeQpMarker() override
Override this to compute a marker value at each quadrature point.
registerMooseObject("MooseApp", ValueRangeMarker)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
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 addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
MarkerValue _outside
MarkerValue _third_state
The behavior to use when "in-between" other states (what to do on the fringe)
MarkerValue _inside