19 #include "libmesh/libmesh_common.h" 20 #include "libmesh/quadrature.h" 27 if (std::is_same<T, Real>::value)
29 else if (std::is_same<T, RealVectorValue>::value)
32 ::mooseError(
"unsupported DiracKernelTempl specialization");
45 _var(this->mooseVariableField()),
46 _phi(_assembly.phi(_var)),
47 _grad_phi(_assembly.gradPhi(_var)),
49 _grad_test(_var.gradPhi()),
51 _grad_u(_var.gradSln())
63 prepareVectorTag(_assembly, _var.number());
65 const std::vector<unsigned int> * multiplicities =
66 _drop_duplicate_points ? NULL : &_local_dirac_kernel_info.getPoints()[_current_elem].second;
67 unsigned int local_qp = 0;
68 Real multiplicity = 1.0;
70 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
72 _current_point = _physical_point[_qp];
73 if (isActiveAtPoint(_current_elem, _current_point))
75 if (!_drop_duplicate_points)
76 multiplicity = (*multiplicities)[local_qp++];
78 for (_i = 0; _i < _test.size(); _i++)
79 _local_re(_i) += multiplicity * computeQpResidual();
83 accumulateTaggedLocalResidual();
90 prepareMatrixTag(_assembly, _var.number(), _var.number());
92 const std::vector<unsigned int> * multiplicities =
93 _drop_duplicate_points ? NULL : &_local_dirac_kernel_info.getPoints()[_current_elem].second;
94 unsigned int local_qp = 0;
95 Real multiplicity = 1.0;
97 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
99 _current_point = _physical_point[_qp];
100 if (isActiveAtPoint(_current_elem, _current_point))
102 if (!_drop_duplicate_points)
103 multiplicity = (*multiplicities)[local_qp++];
105 for (_i = 0; _i < _test.size(); _i++)
106 for (_j = 0; _j < _phi.size(); _j++)
107 _local_ke(_i, _j) += multiplicity * computeQpJacobian();
111 accumulateTaggedLocalMatrix();
114 template <
typename T>
118 if (jvar_num == _var.number())
124 prepareMatrixTag(_assembly, _var.number(), jvar_num);
126 const std::vector<unsigned int> * multiplicities =
127 _drop_duplicate_points ? NULL : &_local_dirac_kernel_info.getPoints()[_current_elem].second;
128 unsigned int local_qp = 0;
129 Real multiplicity = 1.0;
131 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
133 _current_point = _physical_point[_qp];
134 if (isActiveAtPoint(_current_elem, _current_point))
136 if (!_drop_duplicate_points)
137 multiplicity = (*multiplicities)[local_qp++];
139 for (_i = 0; _i < _test.size(); _i++)
140 for (_j = 0; _j < _phi.size(); _j++)
141 _local_ke(_i, _j) += multiplicity * computeQpOffDiagJacobian(jvar_num);
145 accumulateTaggedLocalMatrix();
149 template <
typename T>
156 template <
typename T>
DiracKernelTempl(const InputParameters ¶meters)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
virtual Real computeQpJacobian()
This is the virtual that derived classes should override for computing the Jacobian.
virtual void computeOffDiagJacobian(unsigned int jvar) override
Computes the off-diagonal Jacobian for variable jvar.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
static InputParameters validParams()
VarKindType
Framework-wide stuff.
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
This gets called by computeOffDiagJacobian() at each quadrature point.
A DiracKernel is used when you need to add contributions to the residual by means of multiplying some...
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
void statefulPropertiesAllowed(bool)
Derived classes can declare whether or not they work with stateful material properties.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void computeJacobian() override
Computes the jacobian for the current element.
Interface for objects that need to get values of MooseVariables.
MooseVariableField< T > & mooseVariableField()
Return the MooseVariableField object that this interface acts on.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
DiracKernelBase is the base class for all DiracKernel type classes.
virtual void computeResidual() override
Computes the residual for the current element.
static InputParameters validParams()