https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ValueThresholdMarker.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
11#include "FEProblem.h"
12#include "MooseEnum.h"
13
15
18{
20
21 params.addParam<Real>("coarsen",
22 "The threshold value for coarsening. Elements with variable "
23 "values beyond this will be marked for coarsening.");
24 params.addParam<Real>("refine",
25 "The threshold value for refinement. Elements with variable "
26 "values beyond this will be marked for refinement.");
28 "The refinement state based on a threshold value compared to the specified variable.");
29 return params;
30}
31
33 : QuadraturePointMarker(parameters),
34 _coarsen_set(parameters.isParamValid("coarsen")),
35 _coarsen(parameters.get<Real>("coarsen")),
36 _refine_set(parameters.isParamValid("refine")),
37 _refine(parameters.get<Real>("refine")),
38 _invert(parameters.get<bool>("invert"))
39{
41 {
42 Real diff = _refine - _coarsen;
43 if ((diff > 0 && _invert) || (diff < 0 && !_invert))
44 mooseError("Invalid combination of refine, coarsen, and invert values specified");
45 }
46}
47
50{
51 if (!_invert)
52 {
53 if (_refine_set && _u[_qp] > _refine)
54 return REFINE;
55
56 if (_coarsen_set && _u[_qp] < _coarsen)
57 return COARSEN;
58 }
59 else
60 {
61 if (_refine_set && _u[_qp] < _refine)
62 return REFINE;
63
64 if (_coarsen_set && _u[_qp] > _coarsen)
65 return COARSEN;
66 }
67
68 return _third_state;
69}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
registerMooseObject("MooseApp", ValueThresholdMarker)
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 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
@ REFINE
Definition Marker.h:64
@ COARSEN
Definition Marker.h:62
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.
ValueThresholdMarker(const InputParameters &parameters)
virtual MarkerValue computeQpMarker() override
Override this to compute a marker value at each quadrature point.
static InputParameters validParams()