https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ValueRangeMarker.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#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}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
registerMooseObject("MooseApp", ValueRangeMarker)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
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.
MarkerValue
This mirrors the main refinement flag values in libMesh in Elem::RefinementState but adds "dont_mark"...
Definition Marker.h:60
static InputParameters validParams()
const VariableValue & _u
Holds the solution at current quadrature points.
MarkerValue _third_state
The behavior to use when "in-between" other states (what to do on the fringe)
unsigned int _qp
The current quadrature point.
virtual MarkerValue computeQpMarker() override
Override this to compute a marker value at each quadrature point.
ValueRangeMarker(const InputParameters &parameters)
static InputParameters validParams()