Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
ADKernelScalarBase.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "ADKernel.h"
13 
24 {
25 public:
27 
29 
34  {
35  mooseAssert(_kappa_var_ptr, "kappa pointer should have been set in the constructor");
36  return *_kappa_var_ptr;
37  }
38 
39  virtual void computeResidual() override;
40  virtual void computeJacobian() override;
44  virtual void computeOffDiagJacobian(unsigned int jvar) override;
49  void computeOffDiagJacobianScalar(unsigned int /*jvar_num*/) override;
50 
54  void computeResidualAndJacobian() override;
55 
56 protected:
61 
69  virtual void computeScalarResidualsForJacobian();
70 
75  virtual Real computeQpOffDiagJacobianScalar(unsigned int /*jvar*/) { return 0; }
76 
81  virtual Real computeScalarQpJacobian() { return 0; }
82 
87  virtual Real computeScalarQpOffDiagJacobian(const unsigned int /*jvar_num*/) { return 0; }
88 
93  virtual Real computeScalarQpOffDiagJacobianScalar(const unsigned int /*svar_num*/) { return 0; }
94 
98  virtual void initScalarQpResidual() {}
99 
101  const bool _use_scalar;
102 
105 
108 
111 
113  const unsigned int _kappa_var;
114 
116  const unsigned int _k_order;
117 
120 
122  unsigned int _h;
123  unsigned int _l;
124  std::vector<ADReal> _scalar_residuals;
125 };
126 
127 inline ADReal
129 {
130  mooseError(
131  "A scalar_variable has been set and compute_scalar_residuals=true, ",
132  "but the computeScalarQpResidual method was not overridden. Accidental call of base class?");
133  return 0;
134 }
const ADVariableValue & _kappa
Reference to the current solution at the current quadrature point.
std::vector< ADReal > _scalar_residuals
virtual void initScalarQpResidual()
Put necessary evaluations depending on qp but independent of test functions here. ...
const MooseVariableScalar & scalarVariable() const
The scalar variable that this kernel operates on.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const bool _use_scalar
Whether a scalar variable is declared for this kernel.
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.
DualNumber< Real, DNDerivativeType, true > ADReal
Definition: ADRealForward.h:46
static InputParameters validParams()
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&#39;s contribution to the residual.
virtual Real computeScalarQpOffDiagJacobianScalar(const unsigned int)
Method for computing an off-diagonal jacobian component at quadrature points.
void computeOffDiagJacobianScalar(unsigned int) override
Computes jacobian block with respect to a scalar variable.
const unsigned int _kappa_var
The unknown scalar variable ID.
virtual Real computeScalarQpJacobian()
Method for computing the scalar variable part of Jacobian at quadrature points Added solely for Gener...
ADKernelScalarBase(const InputParameters &parameters)
virtual Real computeScalarQpOffDiagJacobian(const unsigned int)
Method for computing an off-diagonal jacobian component at quadrature points.
forward declarations
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void computeResidualAndJacobian() override
Computes residual and jacobian block for field and scalar variables.
Class for scalar variables (they are different).
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
const bool _compute_field_residuals
Whether to compute field contributions for this instance.
const InputParameters & parameters() const
Get the parameters of the object.
const bool _compute_scalar_residuals
Whether to compute scalar contributions for this instance.
This ADKernel adds standardized methods for assembling to a primary scalar variable associated with t...
virtual void computeJacobian() override
Compute this object&#39;s contribution to the diagonal Jacobian entries.
virtual Real computeQpOffDiagJacobianScalar(unsigned int)
For coupling scalar variables Added solely for GenericKernelScalar override; should not be used...
virtual ADReal computeScalarQpResidual()
Method for computing the scalar part of residual at quadrature points.