https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADNodalBC.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
13#include "NodalBCBase.h"
14#include "ADDirichletBCBase.h"
15#include "ADFunctorInterface.h"
16
20template <typename T, typename Base>
21class ADNodalBCTempl : public Base, public MooseVariableInterface<T>, public ADFunctorInterface
22{
23public:
25
26 ADNodalBCTempl(const InputParameters & parameters);
27
28 const MooseVariableFE<T> & variable() const override { return _var; }
29
30 bool shouldSetComp(unsigned short i) const { return _set_components[i]; }
31
32protected:
37
40
42 const Node * const & _current_node;
43
45 const unsigned int _qp = 0;
46
48 const typename Moose::ADType<T>::type & _u;
49
50 std::vector<bool> _set_components;
51
52 using Base::_fe_problem;
53 using Base::_subproblem;
54 using Base::_sys;
55 using Base::_tid;
56 using Base::addJacobian;
57 using Base::addMooseVariableDependency;
58 using Base::setResidual;
59
60private:
61 void computeResidual() override final;
62 void computeJacobian() override final;
63 void computeResidualAndJacobian() override;
64 void computeOffDiagJacobian(unsigned int jvar) override final;
65 void computeOffDiagJacobianScalar(unsigned int jvar) override final;
66
70 void addResidual(const T & residual, const std::vector<dof_id_type> & dof_indices);
71
75 template <typename ADResidual>
76 void addJacobian(const ADResidual & residual, const std::vector<dof_id_type> & dof_indices);
77
81};
82
83template <>
85
86template <>
88
90using ADVectorNodalBC = ADNodalBCTempl<RealVectorValue, NodalBCBase>;
91using ADArrayNodalBC = ADNodalBCTempl<RealEigenVector, NodalBCBase>;
Base class for automatic differentiation Dirichlet BCs.
An interface for accessing Moose::Functors for systems that care about automatic differentiation,...
Base class for deriving any automatic differentiation boundary condition of a integrated type.
Definition ADNodalBC.h:22
virtual Moose::ADType< T >::type computeQpResidual()=0
Compute this NodalBC's contribution to the residual at the current quadrature point.
const Moose::ADType< T >::type & _u
Value of the unknown variable this BC is acting on.
Definition ADNodalBC.h:48
const unsigned int _qp
Pseudo-"quadrature point" index (Always zero for the current node)
Definition ADNodalBC.h:45
static InputParameters validParams()
Definition ADNodalBC.C:26
bool shouldSetComp(unsigned short i) const
Definition ADNodalBC.h:30
void computeJacobian() override final
Definition ADNodalBC.C:161
void computeResidual() override final
Definition ADNodalBC.C:148
const MooseVariableFE< T > & variable() const override
Definition ADNodalBC.h:28
std::vector< bool > _set_components
Definition ADNodalBC.h:50
void computeOffDiagJacobian(unsigned int jvar) override final
Definition ADNodalBC.C:188
void computeOffDiagJacobianScalar(unsigned int jvar) override final
Definition ADNodalBC.C:197
void addResidual(const T &residual, const std::vector< dof_id_type > &dof_indices)
process the residual into the global data structures
Definition ADNodalBC.C:113
MooseVariableFE< T > & _var
The variable that this NodalBC operates on.
Definition ADNodalBC.h:39
void addJacobian(const ADResidual &residual, const std::vector< dof_id_type > &dof_indices)
process the Jacobian into the global data structures
Definition ADNodalBC.C:127
const Node *const & _current_node
current node being processed
Definition ADNodalBC.h:42
void computeResidualAndJacobian() override
Definition ADNodalBC.C:174
Assembly & _undisplaced_assembly
A reference to the undisplaced assembly in order to ensure data gets correctly incorporated into the ...
Definition ADNodalBC.h:80
Keeps track of stuff related to assembling.
Definition Assembly.h:110
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Class for stuff related to variables.
Interface for objects that need to get values of MooseVariables.
Base class for deriving any boundary condition that works at nodes.
Definition NodalBCBase.h:28