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 
16 template <>
19 {
21 
22  params.addRequiredParam<Real>("lower_bound", "The lower bound value for the range.");
23  params.addRequiredParam<Real>("upper_bound", "The upper bound value for the range.");
24  params.addParam<Real>("buffer_size",
25  0.0,
26  "A buffer zone value added to both ends of the range "
27  "where a third_state marker can be returned.");
28 
29  params.addClassDescription("Mark elements for adaptivity based on the supplied upper and lower "
30  "bounds and the specified variable.");
31  return params;
32 }
33 
35  : QuadraturePointMarker(parameters),
36  _lower_bound(parameters.get<Real>("lower_bound")),
37  _upper_bound(parameters.get<Real>("upper_bound")),
38  _buffer_size(parameters.get<Real>("buffer_size")),
39  _inside(getParam<bool>("invert") ? COARSEN : REFINE),
40  _outside(getParam<bool>("invert") ? REFINE : COARSEN)
41 {
43  mooseError("Invalid bounds specified (upper_bound < lower_bound)");
44 
45  if (_buffer_size < 0.0)
46  mooseError("Buffer size must be non-negative: ", _buffer_size);
47 }
48 
51 {
52  // Is the variable value inside the range?
53  if (_u[_qp] >= _lower_bound && _u[_qp] <= _upper_bound)
54  return _inside;
55 
56  // How about the buffer zone?
58  return _third_state;
59 
60  // Must be outside the range
61  return _outside;
62 }
const VariableValue & _u
Holds the solution at current quadrature points.
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:55
void mooseError(Args &&... args) const
Definition: MooseObject.h:147
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.
ValueRangeMarker(const InputParameters &parameters)
InputParameters validParams< QuadraturePointMarker >()
virtual MarkerValue computeQpMarker() override
Override this to compute a marker value at each quadrature point.
registerMooseObject("MooseApp", ValueRangeMarker)
InputParameters validParams< ValueRangeMarker >()
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