19 #include "libmesh/quadrature.h" 26 params.
addCoupledVar(
"scalar_variable",
"Primary coupled scalar variable");
27 params.
addParam<
bool>(
"compute_scalar_residuals",
true,
"Whether to compute scalar residuals");
29 "compute_field_residuals",
true,
"Whether to compute residuals for the field variable.");
35 _use_scalar(isParamValid(
"scalar_variable") ? true : false),
36 _compute_scalar_residuals(!_use_scalar ? false : getParam<bool>(
"compute_scalar_residuals")),
37 _compute_field_residuals(getParam<bool>(
"compute_field_residuals")),
38 _kappa_var_ptr(_use_scalar ? getScalarVar(
"scalar_variable", 0) : nullptr),
39 _kappa_var(_use_scalar ? _kappa_var_ptr->number() : 0),
40 _k_order(_use_scalar ? _kappa_var_ptr->order() : 0),
41 _kappa(_use_scalar ? _kappa_var_ptr->adSln() : _ad_zero)
53 std::vector<Real> scalar_residuals(
_k_order);
void computeResidual() override
Compute this object's contribution to the residual.
void addResidualsAndJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided incoming residuals and derivatives for the Jacobian, corresponding to the provided d...
const MooseArray< Real > & _JxW
The current quadrature point weight value.
unsigned int number() const
Get variable number coming from libMesh.
std::vector< ADReal > _scalar_residuals
virtual void initScalarQpResidual()
Put necessary evaluations depending on qp but independent of test functions here. ...
void addResiduals(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided incoming residuals corresponding to the provided dof indices.
void computeJacobian() override
Compute this object's contribution to the diagonal Jacobian entries.
unsigned int _h
Used internally to iterate over each scalar component.
const unsigned int _k_order
Order of the scalar variable, used in several places.
static InputParameters validParams()
void computeResidualAndJacobian() override
Compute this object's contribution to the residual and Jacobian simultaneously.
const MooseVariableScalar *const _kappa_var_ptr
(Pointer to) Scalar variable this kernel operates on
virtual void computeScalarResidualsForJacobian()
compute the _scalar_residuals member for filling the Jacobian.
virtual void computeOffDiagJacobian(unsigned int jvar) override
Computes d-_var-residual / d-jvar as well as d-_kappa-residual / d-jvar.
virtual void computeResidual() override
Compute this object's contribution to the residual.
void computeOffDiagJacobianScalar(unsigned int) override
Computes jacobian block with respect to a scalar variable.
const QBase *const & _qrule
active quadrature rule
virtual const std::vector< dof_id_type > & dofIndices() const
Get local DoF indices.
static InputParameters validParams()
ADKernelScalarBase(const InputParameters ¶meters)
const MooseArray< Real > & _coord
The scaling factor to convert from cartesian to another coordinate system (e.g rz, spherical, etc.)
Assembly & _assembly
Reference to this Kernel's assembly object.
void computeResidualAndJacobian() override
Computes residual and jacobian block for field and scalar variables.
const bool _compute_field_residuals
Whether to compute field contributions for this instance.
MooseVariableFE< T > & _var
This is a regular kernel so we cast to a regular MooseVariable.
const bool _compute_scalar_residuals
Whether to compute scalar contributions for this instance.
virtual void computeJacobian() override
Compute this object's contribution to the diagonal Jacobian entries.
virtual ADReal computeScalarQpResidual()
Method for computing the scalar part of residual at quadrature points.
void scalingFactor(const std::vector< Real > &factor)
Set the scaling factor for this variable.
unsigned int _qp
The current quadrature point index.