www.mooseframework.org
QuadraturePointMarker.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "QuadraturePointMarker.h"
16 #include "FEProblem.h"
17 #include "MooseEnum.h"
18 #include "Assembly.h"
19 
20 #include "libmesh/quadrature.h"
21 
22 template <>
25 {
28  MooseEnum third_state("DONT_MARK=-1 COARSEN DO_NOTHING REFINE", "DONT_MARK");
29  params.addParam<MooseEnum>(
30  "third_state",
31  third_state,
32  "The Marker state to apply to values falling in-between the coarsen and refine thresholds.");
33  params.addParam<Real>("coarsen",
34  "The threshold value for coarsening. Elements with variable "
35  "values beyond this will be marked for coarsening.");
36  params.addParam<Real>("refine",
37  "The threshold value for refinement. Elements with variable "
38  "values beyond this will be marked for refinement.");
39  params.addParam<bool>("invert",
40  false,
41  "If this is true then values _below_ 'refine' will be "
42  "refined and _above_ 'coarsen' will be coarsened.");
43  params.addRequiredParam<VariableName>("variable",
44  "The values of this variable will be compared "
45  "to 'refine' and 'coarsen' to see what should "
46  "be done with the element");
47  return params;
48 }
49 
51  : Marker(parameters),
52  Coupleable(this, false),
53  MaterialPropertyInterface(this, blockIDs()),
54  _qrule(_assembly.qRule()),
55  _q_point(_assembly.qPoints()),
56  _qp(0)
57 {
58  const std::vector<MooseVariable *> & coupled_vars = getCoupledMooseVars();
59  for (const auto & var : coupled_vars)
61 }
62 
65 {
66  MarkerValue current_mark = DONT_MARK;
67 
68  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
69  {
70  MarkerValue new_mark = computeQpMarker();
71 
72  current_mark = std::max(current_mark, new_mark);
73  }
74 
75  return current_mark;
76 }
InputParameters validParams< MaterialPropertyInterface >()
InputParameters validParams< Marker >()
Definition: Marker.C:25
const std::vector< MooseVariable * > & getCoupledMooseVars() const
Get the list of coupled variables.
Definition: Coupleable.h:63
Definition: Marker.h:42
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addMooseVariableDependency(MooseVariable *var)
Call this function to add the passed in MooseVariable as a variable that this object depends on...
MarkerValue
This mirrors the main refinement flag values in libMesh in Elem::RefinementState but adds "dont_mark"...
Definition: Marker.h:58
unsigned int _qp
The current quadrature point.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:37
InputParameters validParams< QuadraturePointMarker >()
QuadraturePointMarker(const InputParameters &parameters)
QBase *& _qrule
The quadrature rule for the system.
Interface for objects that needs coupling capabilities.
Definition: Coupleable.h:35
An interface for accessing Materials.
virtual MarkerValue computeElementMarker() override
virtual MarkerValue computeQpMarker()=0
Override this to compute a marker value at each quadrature point.