27 params.template addRequiredParam<NonlinearVariableName>(
28 "variable",
"The name of the variable that this ADRayKernel operates on");
39 Moose::VarKindType::VAR_SOLVER,
40 std::is_same<
T, Real>::value ?
Moose::VarFieldType::VAR_FIELD_STANDARD
41 :
Moose::VarFieldType::VAR_FIELD_VECTOR),
43 _var(this->mooseVariableField()),
46 _grad_u(_var.adGradSln()),
47 _phi(_assembly.phi(_var))
56 mooseError(
"Not valid on coordinate systems other than XYZ");
63 mooseError(
"ADRayKernels do not currently support explicit solves.");
70 mooseAssert(_current_subdomain_id == _assembly.currentSubdomainID(),
"Subdomain IDs not in sync");
71 mooseAssert(_fe_problem.currentlyComputingJacobian() || _fe_problem.currentlyComputingResidual(),
72 "Not computing residual or Jacobian");
74 if (_fe_problem.currentlyComputingJacobian())
76 else if (_fe_problem.currentlyComputingResidual())
84 prepareVectorTag(_assembly, _var.number());
86 precalculateResidual();
87 for (_qp = 0; _qp < _JxW.size(); _qp++)
88 for (_i = 0; _i < _test.size(); _i++)
89 _local_re(_i) += raw_value(_JxW[_qp] * computeQpResidual());
91 accumulateTaggedLocalResidual();
98 _subproblem.prepareShapes(_var.number(), _tid);
100 for (
auto & r : _residuals)
102 _residuals.resize(_test.size(), 0);
104 precalculateResidual();
105 for (_qp = 0; _qp < _JxW.size(); _qp++)
106 for (_i = 0; _i < _test.size(); _i++)
107 _residuals[_i] += _JxW[_qp] * computeQpResidual();
109 addJacobian(_assembly, _residuals, _var.dofIndices(), _var.scalingFactor());
Base class for an AD ray kernel that contributes to the residual and/or Jacobian.
static InputParameters validParams()
void onSegment() override final
Called on each segment of a Ray.
ADRayKernelTempl(const InputParameters ¶ms)
void computeJacobian()
Computes and contributes to the Jacobian for a segment.
void computeResidual()
Computes and contributes to the residual for a segment.
MooseVariableField< T > & variable()
The MooseVariable this RayKernel contributes to.
Base class for a RayKernel that integrates along a Ray segment.
static InputParameters validParams()
void mooseError(Args &&... args) const
const std::set< SubdomainID > & meshSubdomains() const
void addMooseVariableDependency(MooseVariableFieldBase *var)
FEProblemBase & _fe_problem
The FEProblemBase.
MooseMesh & _mesh
The MooseMesh.
virtual void haveADObjects(bool have_ad_objects)
Moose::CoordinateSystemType getCoordSystem(SubdomainID sid) const
static InputParameters validParams()