https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADArrayKernel.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://www.mooseframework.org
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 "KernelBase.h"
14#include "ADFunctorInterface.h"
15
20 public MooseVariableInterface<RealEigenVector>,
22{
23public:
25
27
28 virtual void computeResidual() override;
29 virtual void computeJacobian() override;
30 virtual void computeOffDiagJacobian(unsigned int jvar) override;
31 virtual void jacobianSetup() override;
32
33 virtual const ArrayMooseVariable & variable() const override { return _var; }
34
35protected:
40 virtual void computeQpResidual(ADRealEigenVector & residual) = 0;
41
45 virtual void initQpResidual() {}
46
49
52
56
59
62
65
68
70 const unsigned int _count;
71
72 // Pre-allocated vector for storing the AD array residual of the kernel
73 std::vector<ADReal> _local_ad_re;
74
75private:
77 ADRealEigenVector _work_vector;
78
80 const Elem * _my_elem = nullptr;
81};
OutputTools< RealEigenVector >::VariablePhiGradient ArrayVariablePhiGradient
Definition MooseTypes.h:390
OutputTools< RealEigenVector >::VariablePhiValue ArrayVariablePhiValue
Definition MooseTypes.h:389
OutputTools< RealEigenVector >::VariableTestGradient ArrayVariableTestGradient
Definition MooseTypes.h:396
std::vector< std::vector< Eigen::Map< RealDIMValue > > > MappedArrayVariablePhiGradient
Definition MooseTypes.h:391
OutputTools< RealEigenVector >::VariableTestValue ArrayVariableTestValue
Definition MooseTypes.h:395
Base class for array variable (equation) kernels using automatic differentiation.
virtual void computeResidual() override
Compute this object's contribution to the residual.
const unsigned int _count
Number of components of the array variable.
virtual const ArrayMooseVariable & variable() const override
Returns the variable that this object operates on.
virtual void initQpResidual()
Put necessary evaluations depending on qp but independent on test functions here.
std::vector< ADReal > _local_ad_re
ArrayMooseVariable & _var
This is an array kernel so we cast to a ArrayMooseVariable.
virtual void computeJacobian() override
Compute this object's contribution to the diagonal Jacobian entries.
const ArrayVariablePhiGradient & _grad_phi
gradient of the shape function
virtual void jacobianSetup() override
Gets called just before the Jacobian is computed and before this object is asked to do its job.
virtual void computeOffDiagJacobian(unsigned int jvar) override
Computes this object's contribution to off-diagonal blocks of the system Jacobian matrix.
virtual void computeQpResidual(ADRealEigenVector &residual)=0
Compute this Kernel's contribution to the residual at the current quadrature point,...
const ArrayVariableTestGradient & _grad_test
gradient of the test function
const ArrayVariablePhiValue & _phi
the current shape functions
const ADArrayVariableValue & _u
Holds the solution at current quadrature points.
const ADArrayVariableGradient & _grad_u
Holds the solution gradient at current quadrature points.
const ArrayVariableTestValue & _test
the current test function
static InputParameters validParams()
ADRealEigenVector _work_vector
Work vector for residual and diag jacobian.
const MappedArrayVariablePhiGradient & _array_grad_test
const Elem * _my_elem
Cache variable to prevent multiple invocations of Jacobian computation for one element (recall that A...
An interface for accessing Moose::Functors for systems that care about automatic differentiation,...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
This is the common base class for the three main kernel types implemented in MOOSE,...
Definition KernelBase.h:29
forward declarations
Definition MooseArray.h:18
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Interface for objects that need to get values of MooseVariables.