19 #include "libmesh/quadrature.h"
24 template <
typename T, ComputeStage compute_stage>
32 template <
typename T, ComputeStage compute_stage>
41 _var(*this->mooseVariable()),
42 _current_node(_var.node()),
43 _u(_var.template adNodalValue<compute_stage>())
62 template <
typename T, ComputeStage compute_stage>
66 const std::vector<dof_id_type> & dof_indices = _var.dofIndices();
68 auto residual = computeQpResidual();
70 for (
auto tag_id : _vector_tags)
71 if (_sys.hasVector(tag_id))
72 for (
size_t i = 0; i < dof_indices.size(); ++i)
88 template <
typename T, ComputeStage compute_stage>
92 auto ad_offset = _var.number() * _sys.getMaxVarNDofsPerNode();
93 auto residual = computeQpResidual();
94 const std::vector<dof_id_type> & cached_rows = _var.dofIndices();
97 for (
auto tag : _matrix_tags)
98 if (_sys.hasMatrix(tag))
99 for (
size_t i = 0; i < cached_rows.size(); ++i)
100 _fe_problem.assembly(0).cacheJacobianContribution(
118 template <
typename T, ComputeStage compute_stage>
122 if (jvar == _var.number())
126 auto ad_offset = jvar * _sys.getMaxVarNDofsPerNode();
127 auto residual = computeQpResidual();
128 const std::vector<dof_id_type> & cached_rows = _var.dofIndices();
131 dof_id_type cached_col = _current_node->dof_number(_sys.number(), jvar, 0);
134 for (
auto tag : _matrix_tags)
135 if (_sys.hasMatrix(tag))
136 for (
size_t i = 0; i < cached_rows.size(); ++i)
137 _fe_problem.assembly(0).cacheJacobianContribution(
156 template <
typename T, ComputeStage compute_stage>
160 auto ad_offset = jvar * _sys.getMaxVarNDofsPerNode();
161 auto residual = computeQpResidual();
162 const std::vector<dof_id_type> & cached_rows = _var.dofIndices();
164 std::vector<dof_id_type> scalar_dof_indices;
166 _sys.dofMap().SCALAR_dof_indices(scalar_dof_indices, jvar);
171 mooseAssert(scalar_dof_indices.size() == 1,
172 "ADNodalBC only allows coupling of first order SCALAR variables");
175 for (
auto tag : _matrix_tags)
176 if (_sys.hasMatrix(tag))
177 for (
size_t i = 0; i < cached_rows.size(); ++i)
178 _fe_problem.assembly(0).cacheJacobianContribution(
180 scalar_dof_indices[0],