www.mooseframework.org
FunctionDiracSource.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "FunctionDiracSource.h"
11 #include "Function.h"
12 
14 
15 template <>
18 {
20  params.addRequiredParam<FunctionName>(
21  "function", "The function to use for controlling the specified dirac source.");
22  params.addRequiredParam<Point>("point", "The x,y,z coordinates of the point");
23  return params;
24 }
25 
27  : DiracKernel(parameters), _function(getFunction("function")), _p(getParam<Point>("point"))
28 {
29 }
30 
31 void
33 {
34  addPoint(_p);
35 }
36 
37 Real
39 {
40  return -_test[_i][_qp] * _function.value(_t, _p);
41 }
virtual Real value(Real t, const Point &p)
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero...
Definition: Function.C:38
unsigned int _qp
Quadrature point index.
Definition: DiracKernel.h:184
void addPoint(const Elem *elem, Point p, unsigned id=libMesh::invalid_uint)
Add the physical x,y,z point located in the element "elem" to the list of points this DiracKernel wil...
Definition: DiracKernel.C:195
InputParameters validParams< FunctionDiracSource >()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void addPoints() override
This is where the DiracKernel should call addPoint() for each point it needs to have a value distribu...
FunctionDiracSource(const InputParameters &parameters)
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
InputParameters validParams< DiracKernel >()
Definition: DiracKernel.C:21
const VariableTestValue & _test
Values of test functions at QPs.
Definition: DiracKernel.h:207
unsigned int _i
i-th, j-th index for enumerating shape and test functions
Definition: DiracKernel.h:195
registerMooseObject("MooseApp", FunctionDiracSource)
virtual Real computeQpResidual() override
This is the virtual that derived classes should override for computing the residual.
A DiracKernel is used when you need to add contributions to the residual by means of multiplying some...
Definition: DiracKernel.h:45