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 "ConstantPointSource.h" 11 : 12 : registerMooseObject("MooseApp", ConstantPointSource); 13 : 14 : InputParameters 15 3391 : ConstantPointSource::validParams() 16 : { 17 3391 : InputParameters params = DiracKernel::validParams(); 18 6782 : params.addClassDescription("Residual contribution of a constant point source term."); 19 13564 : params.addRequiredParam<Real>("value", "The value of the point source"); 20 10173 : params.addRequiredParam<std::vector<Real>>("point", "The x,y,z coordinates of the point"); 21 10173 : params.declareControllable("value"); 22 3391 : return params; 23 0 : } 24 : 25 172 : ConstantPointSource::ConstantPointSource(const InputParameters & parameters) 26 : : DiracKernel(parameters), 27 172 : _value(getParam<Real>("value")), 28 688 : _point_param(getParam<std::vector<Real>>("point")) 29 : { 30 172 : _p(0) = _point_param[0]; 31 : 32 172 : if (_point_param.size() > 1) 33 : { 34 172 : _p(1) = _point_param[1]; 35 : 36 172 : if (_point_param.size() > 2) 37 : { 38 133 : _p(2) = _point_param[2]; 39 : } 40 : } 41 172 : } 42 : 43 : void 44 5317 : ConstantPointSource::addPoints() 45 : { 46 5317 : addPoint(_p); 47 5317 : } 48 : 49 : Real 50 18215 : ConstantPointSource::computeQpResidual() 51 : { 52 : // This is negative because it's a forcing function that has been brought over to the left side 53 18215 : return -_test[_i][_qp] * _value; 54 : }