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()),
52 _drop_duplicate_points(parameters.
get<bool>(
"drop_duplicate_points")),
53 _point_not_found_behavior(
66 prepareVectorTag(_assembly, _var.number());
68 const std::vector<unsigned int> * multiplicities =
69 _drop_duplicate_points ? NULL : &_local_dirac_kernel_info.getPoints()[_current_elem].second;
70 unsigned int local_qp = 0;
71 Real multiplicity = 1.0;
73 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
75 _current_point = _physical_point[_qp];
76 if (isActiveAtPoint(_current_elem, _current_point))
78 if (!_drop_duplicate_points)
79 multiplicity = (*multiplicities)[local_qp++];
81 for (_i = 0; _i < _test.size(); _i++)
82 _local_re(_i) += multiplicity * computeQpResidual();
86 accumulateTaggedLocalResidual();
93 prepareMatrixTag(_assembly, _var.number(), _var.number());
95 const std::vector<unsigned int> * multiplicities =
96 _drop_duplicate_points ? NULL : &_local_dirac_kernel_info.getPoints()[_current_elem].second;
97 unsigned int local_qp = 0;
98 Real multiplicity = 1.0;
100 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
102 _current_point = _physical_point[_qp];
103 if (isActiveAtPoint(_current_elem, _current_point))
105 if (!_drop_duplicate_points)
106 multiplicity = (*multiplicities)[local_qp++];
108 for (_i = 0; _i < _test.size(); _i++)
109 for (_j = 0; _j < _phi.size(); _j++)
110 _local_ke(_i, _j) += multiplicity * computeQpJacobian();
114 accumulateTaggedLocalMatrix();
117 template <
typename T>
121 if (jvar_num == _var.number())
127 prepareMatrixTag(_assembly, _var.number(), jvar_num);
129 const std::vector<unsigned int> * multiplicities =
130 _drop_duplicate_points ? NULL : &_local_dirac_kernel_info.getPoints()[_current_elem].second;
131 unsigned int local_qp = 0;
132 Real multiplicity = 1.0;
134 for (_qp = 0; _qp < _qrule->n_points(); _qp++)
136 _current_point = _physical_point[_qp];
137 if (isActiveAtPoint(_current_elem, _current_point))
139 if (!_drop_duplicate_points)
140 multiplicity = (*multiplicities)[local_qp++];
142 for (_i = 0; _i < _test.size(); _i++)
143 for (_j = 0; _j < _phi.size(); _j++)
144 _local_ke(_i, _j) += multiplicity * computeQpOffDiagJacobian(jvar_num);
148 accumulateTaggedLocalMatrix();
152 template <
typename T>
159 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...
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
virtual Real computeQpJacobian()
This is the virtual that derived classes should override for computing the Jacobian.
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
This gets called by computeOffDiagJacobian() at each quadrature point.
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.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
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<T> 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()