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