https://mooseframework.inl.gov
ADDiracKernel.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 "DiracKernelBase.h"
13 #include "MooseVariableInterface.h"
14 #include "ADFunctorInterface.h"
15 
20  public MooseVariableInterface<Real>,
21  public ADFunctorInterface
22 {
23 public:
25 
27 
28  virtual void jacobianSetup() override;
29 
30  virtual void computeResidual() override;
31  virtual void computeJacobian() override;
32  virtual void computeOffDiagJacobian(unsigned int jvar) override;
33  virtual void computeResidualAndJacobian() override;
34 
35  virtual const MooseVariableField<Real> & variable() const override { return _var; }
36 
37 protected:
41  virtual ADReal computeQpResidual() = 0;
42 
45 
48 
51 
56 
57 private:
59  void computeADResiduals();
61  void computeFullJacobian();
62 
64  std::vector<ADReal> _ad_residuals;
66  const Elem * _last_jacobian_elem;
67 };
void computeFullJacobian()
Computes the full Jacobian for the current element.
Definition: ADDiracKernel.C:87
void computeADResiduals()
Computes the AD residuals for the current element.
virtual void computeResidual() override
Compute this object&#39;s contribution to the residual.
Definition: ADDiracKernel.C:58
virtual void jacobianSetup() override
Gets called just before the Jacobian is computed and before this object is asked to do its job...
Definition: ADDiracKernel.C:52
std::vector< ADReal > _ad_residuals
AD residuals for the current element.
Definition: ADDiracKernel.h:64
typename OutputTools< T >::VariableTestValue ADTemplateVariableTestValue
Definition: MooseTypes.h:668
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
AD version of DiracKernel.
Definition: ADDiracKernel.h:19
virtual void computeJacobian() override
Compute this object&#39;s contribution to the diagonal Jacobian entries.
Definition: ADDiracKernel.C:71
typename OutputTools< T >::VariablePhiValue ADTemplateVariablePhiValue
Definition: MooseTypes.h:670
typename OutputTools< typename Moose::ADType< T >::type >::VariableValue ADTemplateVariableValue
Definition: MooseTypes.h:648
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
DualNumber< Real, DNDerivativeType, true > ADReal
Definition: ADRealForward.h:42
const ADTemplateVariablePhiValue< Real > & _phi
Values of shape functions at QPs.
Definition: ADDiracKernel.h:47
An interface for accessing Moose::Functors for systems that care about automatic differentiation, e.g.
virtual ADReal computeQpResidual()=0
Computes the residual contribution at the current quadrature point.
virtual void computeResidualAndJacobian() override
Compute this object&#39;s contribution to the residual and Jacobian simultaneously.
Definition: ADDiracKernel.C:94
virtual void computeOffDiagJacobian(unsigned int jvar) override
Computes the off-diagonal Jacobian for variable jvar.
Definition: ADDiracKernel.C:77
typename OutputTools< typename Moose::ADType< T >::type >::VariableGradient ADTemplateVariableGradient
Definition: MooseTypes.h:651
ADDiracKernel(const InputParameters &parameters)
Definition: ADDiracKernel.C:29
const ADTemplateVariableValue< Real > & _u
Holds the solution at current quadrature points.
Definition: ADDiracKernel.h:53
static InputParameters validParams()
Definition: ADDiracKernel.C:21
virtual const MooseVariableField< Real > & variable() const override
Returns the variable that this object operates on.
Definition: ADDiracKernel.h:35
const ADTemplateVariableTestValue< Real > & _test
Values of test functions at QPs.
Definition: ADDiracKernel.h:50
const Elem * _last_jacobian_elem
The element corresponding to previous Jacobian calculation.
Definition: ADDiracKernel.h:66
MooseVariableField< Real > & _var
Variable this kernel acts on.
Definition: ADDiracKernel.h:44
Interface for objects that need to get values of MooseVariables.
const ADTemplateVariableGradient< Real > & _grad_u
Holds the solution gradient at the current quadrature points.
Definition: ADDiracKernel.h:55
DiracKernelBase is the base class for all DiracKernel type classes.