18#include "libmesh/threads.h"
19#include "libmesh/quadrature.h"
31 mooseWarning(
"NonlocalKernel is a computationally expensive experimental capability used only "
32 "for integral terms.");
53 DenseVector<Number> diag(rows);
54 for (
unsigned int i = 0; i < rows; i++)
58 var->sys().solution().add_vector(diag, var->dofIndices());
75 const auto phi_size = jvar.dofIndices().size();
78 for (
_j = 0;
_j < phi_size;
98 unsigned int n_total_dofs = var_alldofindices.size();
101 for (
_k = 0;
_k < n_total_dofs;
105 auto it = local_dofindices.find(var_alldofindices[
_k]);
106 if (it == local_dofindices.end())
134 const std::vector<dof_id_type> & jv_alldofindices = jv.
allDofIndices();
135 unsigned int n_total_dofs = jv_alldofindices.size();
138 for (
_k = 0;
_k < n_total_dofs;
142 auto it = local_dofindices.find(jv_alldofindices[
_k]);
143 if (it == local_dofindices.end())
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
bool _has_diag_save_in
The aux variables to save the diagonal Jacobian contributions to.
const MooseArray< Real > & _coord
The scaling factor to convert from cartesian to another coordinate system (e.g rz,...
unsigned int _qp
The current quadrature point index.
const MooseArray< Real > & _JxW
The current quadrature point weight value.
unsigned int _j
current index for the shape function
std::vector< MooseVariableFEBase * > _diag_save_in
unsigned int _i
current index for the test function
const QBase *const & _qrule
active quadrature rule
MooseVariable & _var
This is a regular kernel so we cast to a regular MooseVariable.
const VariablePhiValue & _phi
the current shape functions
virtual Real computeQpOffDiagJacobian(unsigned int)
For coupling standard variables.
const VariableTestValue & _test
the current test function
static InputParameters validParams()
virtual Real computeQpJacobian()
Compute this Kernel's contribution to the Jacobian at the current quadrature point.
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
virtual const std::vector< dof_id_type > & dofIndices() const
Get local DoF indices.
const std::vector< dof_id_type > & allDofIndices() const
Get all global dofindices for the variable.
unsigned int number() const
Get variable number coming from libMesh.
const std::vector< dof_id_type > & dofIndices() const final
Get local DoF indices.
This class provides an interface for common operations on field variables of both FE and FV types wit...
virtual void computeNonlocalJacobian() override
computeNonlocalJacobian and computeNonlocalOffDiagJacobian methods are introduced for providing the j...
virtual void computeNonlocalOffDiagJacobian(unsigned int jvar) override
Computes Jacobian entries corresponding to nonlocal dofs of the jvar.
NonlocalKernel(const InputParameters ¶meters)
virtual bool globalDoFEnabled(MooseVariableFEBase &, dof_id_type)
optimization option for executing nonlocal jacobian calculation only for nonzero elements
virtual void getUserObjectJacobian(unsigned int, dof_id_type)
Optimization option for getting jocobinas from userobject once per dof.
virtual Real computeQpNonlocalOffDiagJacobian(unsigned int, dof_id_type)
virtual Real computeQpNonlocalJacobian(dof_id_type)
Compute this Kernel's contribution to the Jacobian corresponding to nolocal dof at the current quadra...
virtual void computeJacobian() override
computeJacobian and computeQpOffDiagJacobian methods are almost same as Kernel except for few additio...
virtual void computeOffDiagJacobian(unsigned int jvar) override
Computes d-residual / d-jvar... storing the result in Ke.
static InputParameters validParams()
THREAD_ID _tid
The thread ID for this kernel.
virtual void precalculateJacobian()
MooseMesh & _mesh
Reference to this Kernel's mesh object.
Assembly & _assembly
Reference to this Kernel's assembly object.
const MooseVariableFieldBase & getVariable(unsigned int jvar_num) const
Retrieve the variable object from our system associated with jvar_num.
SystemBase & _sys
Reference to the EquationSystem object.
virtual void precalculateOffDiagJacobian(unsigned int)
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
DenseMatrix< Number > _local_ke
Holds local Jacobian entries as they are accumulated by this Kernel.
void accumulateTaggedLocalMatrix()
Local Jacobian blocks will be appended by adding the current local kernel Jacobian.
void prepareMatrixTag(Assembly &assembly, unsigned int ivar, unsigned int jvar)
Prepare data for computing element jacobian according to the active tags.
void accumulateTaggedNonlocalMatrix()
Nonlocal Jacobian blocks will be appended by adding the current nonlocal kernel Jacobian.
void prepareMatrixTagNonlocal(Assembly &assembly, unsigned int ivar, unsigned int jvar)
Prepare data for computing nonlocal element jacobian according to the active tags.
DenseMatrix< Number > _nonlocal_ke
Holds nonlocal Jacobian entries as they are accumulated by this Kernel.