Line data Source code
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 : 15 : InputParameters 16 207 : AuxRayKernel::validParams() 17 : { 18 207 : auto params = RayKernelBase::validParams(); 19 : 20 414 : params.addRequiredParam<AuxVariableName>( 21 : "variable", "The name of the aux variable that this AuxRayKernel applies to"); 22 : 23 207 : return params; 24 0 : } 25 : 26 : // Static mutex definition 27 : Threads::spin_mutex AuxRayKernel::_add_value_mutex; 28 : 29 112 : AuxRayKernel::AuxRayKernel(const InputParameters & params) 30 : : RayKernelBase(params), 31 : MooseVariableInterface<Real>(this, 32 112 : _fe_problem.getAuxiliarySystem() 33 224 : .getVariable(_tid, params.get<AuxVariableName>("variable")) 34 112 : .isNodal(), 35 : "variable", 36 : Moose::VarKindType::VAR_AUXILIARY, 37 : Moose::VarFieldType::VAR_FIELD_STANDARD), 38 112 : _aux(_fe_problem.getAuxiliarySystem()), 39 336 : _var(*mooseVariable()) 40 : { 41 : if (_var.feType() != FEType(CONSTANT, MONOMIAL)) 42 2 : paramError("variable", "Only CONSTANT MONOMIAL variables are supported"); 43 : 44 110 : addMooseVariableDependency(mooseVariable()); 45 110 : } 46 : 47 : void 48 20664 : 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); 52 20664 : _var.setNodalValue(value); 53 20664 : _var.add(_aux.solution()); 54 20664 : }