https://mooseframework.inl.gov
AuxRayKernel.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 "AuxRayKernel.h"
11 
12 // MOOSE includes
13 #include "AuxiliarySystem.h"
14 
17 {
18  auto params = RayKernelBase::validParams();
19 
20  params.addRequiredParam<AuxVariableName>(
21  "variable", "The name of the aux variable that this AuxRayKernel applies to");
22 
23  return params;
24 }
25 
26 // Static mutex definition
27 Threads::spin_mutex AuxRayKernel::_add_value_mutex;
28 
30  : RayKernelBase(params),
32  _fe_problem.getAuxiliarySystem()
33  .getVariable(_tid, params.get<AuxVariableName>("variable"))
34  .isNodal(),
35  "variable",
38  _aux(_fe_problem.getAuxiliarySystem()),
39  _var(*mooseVariable())
40 {
41  if (_var.feType() != FEType(CONSTANT, MONOMIAL))
42  paramError("variable", "Only CONSTANT MONOMIAL variables are supported");
43 
45 }
46 
47 void
48 AuxRayKernel::addValue(const Real value)
49 {
50  // TODO: this is horribly inefficient. Consider caching and adding later
51  Threads::spin_mutex::scoped_lock lock(_add_value_mutex);
53  _var.add(_aux.solution());
54 }
VarFieldType
void addValue(const Real value)
Use to accumulate a value into the corresponding AuxVariable from this AuxRayKernel.
Definition: AuxRayKernel.C:48
const libMesh::FEType & feType() const
AuxRayKernel(const InputParameters &params)
Definition: AuxRayKernel.C:29
NumericVector< Number > & solution()
virtual void setNodalValue(const Real &value, unsigned int idx=0) override
MooseVariableFE< Real > & _var
The AuxVariable this AuxRayKernel contributes to.
Definition: AuxRayKernel.h:45
Base object for the RayKernel syntax.
Definition: RayKernelBase.h:27
static InputParameters validParams()
Definition: AuxRayKernel.C:16
MooseVariableFE< Real > * mooseVariable() const
AuxiliarySystem & _aux
The aux system.
Definition: AuxRayKernel.h:42
CONSTANT
static InputParameters validParams()
Definition: RayKernelBase.C:17
VarKindType
virtual const OutputTools< Real >::VariableValue & value()
void paramError(const std::string &param, Args... args) const
virtual void add(libMesh::NumericVector< libMesh::Number > &vector) override
static Threads::spin_mutex _add_value_mutex
Spin mutex object for adding values.
Definition: AuxRayKernel.h:49
MONOMIAL
void addMooseVariableDependency(MooseVariableFieldBase *var)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
VAR_FIELD_STANDARD
const Elem & get(const ElemType type_in)
VAR_AUXILIARY