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 "FunctorDiracKernel.h" 11 : 12 : registerMooseObject("MooseApp", FunctorDiracKernel); 13 : 14 : InputParameters 15 15035 : FunctorDiracKernel::validParams() 16 : { 17 15035 : InputParameters params = ADDiracKernel::validParams(); 18 60140 : params.addRequiredParam<MooseFunctorName>("functor", "Source functor"); 19 60140 : params.addRequiredParam<Point>("point", "Source point"); 20 15035 : params.addClassDescription("Computes a dirac source using a functor."); 21 15035 : return params; 22 0 : } 23 : 24 25 : FunctorDiracKernel::FunctorDiracKernel(const InputParameters & parameters) 25 100 : : ADDiracKernel(parameters), _functor(getFunctor<ADReal>("functor")), _p(getParam<Point>("point")) 26 : { 27 25 : } 28 : 29 : void 30 450 : FunctorDiracKernel::addPoints() 31 : { 32 450 : addPoint(_p); 33 450 : } 34 : 35 : ADReal 36 588 : FunctorDiracKernel::computeQpResidual() 37 : { 38 : mooseAssert(_current_point == _p, "Current point must be user-provided point"); 39 588 : const Moose::ElemQpArg space_arg = {_current_elem, _qp, _qrule, _current_point}; 40 588 : return -_test[_i][_qp] * _functor(space_arg, Moose::currentState()); 41 : }