https://mooseframework.inl.gov
CoupledVarThresholdElementSubdomainModifier.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 
12 #include "libmesh/quadrature.h"
13 
15 
18 {
20  params.addClassDescription("Modify the element subdomain ID if a coupled variable satisfies the "
21  "criterion for the threshold (above, equal, or below)");
22  params.addRequiredCoupledVar("coupled_var",
23  "Coupled variable whose value is used in the criterion");
24  return params;
25 }
26 
28  const InputParameters & parameters)
29  : ThresholdElementSubdomainModifier(parameters), _v(coupledValue("coupled_var"))
30 {
31 }
32 
33 Real
35 {
36  Real avg_val = 0;
37 
38  for (unsigned int qp = 0; qp < _qrule->n_points(); ++qp)
39  avg_val += _v[qp] * _JxW[qp] * _coord[qp];
40  avg_val /= _current_elem_volume;
41 
42  return avg_val;
43 }
const MooseArray< Real > & _coord
virtual Real computeValue() override
Compute the value used in the criterion.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Real & _current_elem_volume
The current element volume (available during execute())
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const QBase *const & _qrule
const MooseArray< Real > & _JxW
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...
const VariableValue & _v
The coupled variable used in the criterion.
registerMooseObject("MooseApp", CoupledVarThresholdElementSubdomainModifier)