Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ADNodalBCTempl< T, Base > Class Template Referenceabstract

Base class for deriving any automatic differentiation boundary condition of a integrated type. More...

#include <ADNodalBC.h>

Inheritance diagram for ADNodalBCTempl< T, Base >:
[legend]

Public Member Functions

 ADNodalBCTempl (const InputParameters &parameters)
 
const MooseVariableFE< T > & variable () const override
 
bool shouldSetComp (unsigned short i) const
 
template<>
InputParameters validParams ()
 
template<>
InputParameters validParams ()
 
MooseVariableBasemooseVariableBase () const
 Get the variable that this object is using. More...
 
MooseVariableField< T > & mooseVariableField ()
 Return the MooseVariableField object that this interface acts on. More...
 
MooseVariableFE< T > * mooseVariable () const
 Return the MooseVariableFE object that this interface acts on. More...
 
MooseVariableFV< T > * mooseVariableFV () const
 Return the MooseVariableFV object that this interface acts on. More...
 
MooseLinearVariableFV< T > * mooseLinearVariableFV () const
 Return the MooseLinearVariableFV object that this interface acts on. More...
 

Static Public Member Functions

static InputParameters validParams ()
 
static std::string deduceFunctorName (const std::string &name, const InputParameters &params)
 Helper to look up a functor name through the input parameter keys. More...
 

Protected Member Functions

virtual Moose::ADType< T >::type computeQpResidual ()=0
 Compute this NodalBC's contribution to the residual at the current quadrature point. More...
 
virtual const OutputTools< T >::VariableValuevalue ()
 The value of the variable this object is operating on. More...
 
virtual const OutputTools< T >::VariableValuevalueOld ()
 The old value of the variable this object is operating on. More...
 
virtual const OutputTools< T >::VariableValuevalueOlder ()
 The older value of the variable this object is operating on. More...
 
virtual const OutputTools< T >::VariableValuedot ()
 The time derivative of the variable this object is operating on. More...
 
virtual const OutputTools< T >::VariableValuedotDot ()
 The second time derivative of the variable this object is operating on. More...
 
virtual const OutputTools< T >::VariableValuedotOld ()
 The old time derivative of the variable this object is operating on. More...
 
virtual const OutputTools< T >::VariableValuedotDotOld ()
 The old second time derivative of the variable this object is operating on. More...
 
virtual const VariableValuedotDu ()
 The derivative of the time derivative of the variable this object is operating on with respect to this variable's coefficients. More...
 
virtual const VariableValuedotDotDu ()
 The derivative of the second time derivative of the variable this object is operating on with respect to this variable's coefficients. More...
 
virtual const OutputTools< T >::VariableGradientgradient ()
 The gradient of the variable this object is operating on. More...
 
virtual const OutputTools< T >::VariableGradientgradientOld ()
 The old gradient of the variable this object is operating on. More...
 
virtual const OutputTools< T >::VariableGradientgradientOlder ()
 The older gradient of the variable this object is operating on. More...
 
virtual const OutputTools< T >::VariableSecondsecond ()
 The second derivative of the variable this object is operating on. More...
 
virtual const OutputTools< T >::VariableSecondsecondOld ()
 The old second derivative of the variable this object is operating on. More...
 
virtual const OutputTools< T >::VariableSecondsecondOlder ()
 The older second derivative of the variable this object is operating on. More...
 
virtual const OutputTools< T >::VariableTestSecondsecondTest ()
 The second derivative of the test function. More...
 
virtual const OutputTools< T >::VariableTestSecondsecondTestFace ()
 The second derivative of the test function on the current face. More...
 
virtual const OutputTools< T >::VariablePhiSecondsecondPhi ()
 The second derivative of the trial function. More...
 
virtual const OutputTools< T >::VariablePhiSecondsecondPhiFace ()
 The second derivative of the trial function on the current face. More...
 
std::string deduceFunctorName (const std::string &name) const
 Small helper to look up a functor name through the input parameter keys. More...
 
template<typename T >
const Moose::Functor< T > & getFunctor (const std::string &name)
 Retrieves a functor from the subproblem. More...
 
template<typename T >
const Moose::Functor< T > & getFunctor (const std::string &name, THREAD_ID tid)
 Retrieves a functor from the subproblem. More...
 
template<typename T >
const Moose::Functor< T > & getFunctor (const std::string &name, SubProblem &subproblem)
 Retrieves a functor from the passed-in subproblem. More...
 
template<typename T >
const Moose::Functor< T > & getFunctor (const std::string &name, SubProblem &subproblem, THREAD_ID tid)
 Retrieves a functor from the passed-in subproblem. More...
 
bool isFunctor (const std::string &name) const
 Checks the subproblem for the given functor. More...
 
bool isFunctor (const std::string &name, const SubProblem &subproblem) const
 Checks the passed-in subproblem for the given functor. More...
 
Moose::ElemArg makeElemArg (const Elem *elem, bool correct_skewnewss=false) const
 Helper method to create an elemental argument for a functor that includes whether to perform skewness corrections. More...
 
template<typename T >
void checkFunctorSupportsSideIntegration (const std::string &name, bool qp_integration)
 Throws error if the functor does not support the requested side integration. More...
 

Protected Attributes

MooseVariableFE< T > & _var
 The variable that this NodalBC operates on. More...
 
const Node *const & _current_node
 current node being processed More...
 
const unsigned int _qp = 0
 Pseudo-"quadrature point" index (Always zero for the current node) More...
 
const Moose::ADType< T >::type & _u
 Value of the unknown variable this BC is acting on. More...
 
const std::array< bool, 3 > _set_components
 
bool _nodal
 Whether or not this object is acting only at nodes. More...
 
MooseVariableFE< T > * _variable = nullptr
 
MooseVariableFV< T > * _fv_variable = nullptr
 
MooseLinearVariableFV< T > * _linear_fv_variable = nullptr
 
MooseVariableField< T > * _field_variable = nullptr
 
Assembly_mvi_assembly
 

Private Member Functions

void computeResidual () override final
 
void computeJacobian () override final
 
void computeResidualAndJacobian () override
 
void computeOffDiagJacobian (unsigned int jvar) override final
 
void computeOffDiagJacobianScalar (unsigned int jvar) override final
 
template<typename ADResidual >
void addResidual (const ADResidual &residual, const std::vector< dof_id_type > &dof_indices)
 process the residual into the global data structures More...
 
template<typename ADResidual >
void addJacobian (const ADResidual &residual, const std::vector< dof_id_type > &dof_indices)
 process the Jacobian into the global data structures More...
 

Private Attributes

Assembly_undisplaced_assembly
 A reference to the undisplaced assembly in order to ensure data gets correctly incorporated into the global residual/Jacobian. More...
 

Detailed Description

template<typename T, typename Base>
class ADNodalBCTempl< T, Base >

Base class for deriving any automatic differentiation boundary condition of a integrated type.

Definition at line 21 of file ADNodalBC.h.

Constructor & Destructor Documentation

◆ ADNodalBCTempl()

template<typename T , typename Base >
ADNodalBCTempl< T, Base >::ADNodalBCTempl ( const InputParameters parameters)

Definition at line 56 of file ADNodalBC.C.

57  : Base(parameters),
59  true,
60  "variable",
62  std::is_same<T, Real>::value ? Moose::VarFieldType::VAR_FIELD_STANDARD
64  ADFunctorInterface(this),
65  _var(*this->mooseVariable()),
67  _u(_var.adNodalValue()),
69  {std::is_same<T, RealVectorValue>::value ? this->template getParam<bool>("set_x_comp")
70  : true,
71  std::is_same<T, RealVectorValue>::value ? this->template getParam<bool>("set_y_comp")
72  : true,
73  std::is_same<T, RealVectorValue>::value ? this->template getParam<bool>("set_z_comp")
74  : true}),
75  _undisplaced_assembly(_fe_problem.assembly(_tid, _sys.number()))
76 {
77  _subproblem.haveADObjects(true);
78 
79  addMooseVariableDependency(this->mooseVariable());
80 }
const Node *const & node() const
const Moose::ADType< T >::type & _u
Value of the unknown variable this BC is acting on.
Definition: ADNodalBC.h:48
const std::array< bool, 3 > _set_components
Definition: ADNodalBC.h:50
MooseVariableFE< T > * mooseVariable() const
Return the MooseVariableFE object that this interface acts on.
Assembly & _undisplaced_assembly
A reference to the undisplaced assembly in order to ensure data gets correctly incorporated into the ...
Definition: ADNodalBC.h:81
virtual const OutputTools< T >::VariableValue & value()
The value of the variable this object is operating on.
MooseVariableFE< T > & _var
The variable that this NodalBC operates on.
Definition: ADNodalBC.h:39
const Node *const & _current_node
current node being processed
Definition: ADNodalBC.h:42
Interface for objects that need to get values of MooseVariables.
ADFunctorInterface(const MooseObject *moose_object)
const Moose::ADType< OutputType >::type & adNodalValue() const

Member Function Documentation

◆ addJacobian()

template<typename T , typename Base >
template<typename ADResidual >
void ADNodalBCTempl< T, Base >::addJacobian ( const ADResidual &  residual,
const std::vector< dof_id_type > &  dof_indices 
)
private

process the Jacobian into the global data structures

Definition at line 114 of file ADNodalBC.C.

116 {
117  mooseAssert(dof_indices.size() <= _set_components.size(),
118  "The number of dof indices must be less than the number of settable components");
119 
120  for (const auto i : index_range(dof_indices))
121  if (_set_components[i])
122  // If we store into the displaced assembly for nodal bc objects the data never actually makes
123  // it into the global Jacobian
125  std::array<ADReal, 1>{{conversionHelper(residual, i)}},
126  std::array<dof_id_type, 1>{{dof_indices[i]}},
127  /*scaling_factor=*/1);
128 }
void addJacobian(const ADResidual &residual, const std::vector< dof_id_type > &dof_indices)
process the Jacobian into the global data structures
Definition: ADNodalBC.C:114
const std::array< bool, 3 > _set_components
Definition: ADNodalBC.h:50
Assembly & _undisplaced_assembly
A reference to the undisplaced assembly in order to ensure data gets correctly incorporated into the ...
Definition: ADNodalBC.h:81
auto index_range(const T &sizable)

◆ addResidual()

template<typename T , typename Base >
template<typename ADResidual >
void ADNodalBCTempl< T, Base >::addResidual ( const ADResidual &  residual,
const std::vector< dof_id_type > &  dof_indices 
)
private

process the residual into the global data structures

Definition at line 100 of file ADNodalBC.C.

102 {
103  mooseAssert(dof_indices.size() <= _set_components.size(),
104  "The number of dof indices must be less than the number of settable components");
105 
106  for (const auto i : index_range(dof_indices))
107  if (_set_components[i])
108  setResidual(_sys, raw_value(conversionHelper(residual, i)), dof_indices[i]);
109 }
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:73
const std::array< bool, 3 > _set_components
Definition: ADNodalBC.h:50
auto index_range(const T &sizable)

◆ checkFunctorSupportsSideIntegration()

template<typename T >
void FunctorInterface::checkFunctorSupportsSideIntegration ( const std::string &  name,
bool  qp_integration 
)
protectedinherited

Throws error if the functor does not support the requested side integration.

Parameters
[in]nameName of functor or functor parameter
[in]qp_integrationTrue if performing qp integration, false if face info

Definition at line 236 of file FunctorInterface.h.

237 {
238  const std::string functor_name = deduceFunctorName(name);
239  const auto & functor = getFunctor<T>(name);
240  if (qp_integration)
241  {
242  if (!functor.supportsElemSideQpArg())
243  mooseError("Quadrature point integration was requested, but the functor '",
244  functor_name,
245  "' does not support this.");
246  }
247  else
248  {
249  if (!functor.supportsFaceArg())
250  mooseError("Face info integration was requested, but the functor '",
251  functor_name,
252  "' does not support this.");
253  }
254 }
std::string name(const ElemQuality q)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
static std::string deduceFunctorName(const std::string &name, const InputParameters &params)
Helper to look up a functor name through the input parameter keys.

◆ computeJacobian()

template<typename T , typename Base >
void ADNodalBCTempl< T, Base >::computeJacobian ( )
finaloverrideprivate

Definition at line 145 of file ADNodalBC.C.

146 {
147  const std::vector<dof_id_type> & dof_indices = _var.dofIndices();
148  if (dof_indices.empty())
149  return;
150 
151  const auto residual = computeQpResidual();
152 
153  addJacobian(residual, dof_indices);
154 }
void addJacobian(const ADResidual &residual, const std::vector< dof_id_type > &dof_indices)
process the Jacobian into the global data structures
Definition: ADNodalBC.C:114
virtual Moose::ADType< T >::type computeQpResidual()=0
Compute this NodalBC&#39;s contribution to the residual at the current quadrature point.
const std::vector< dof_id_type > & dofIndices() const final
Get local DoF indices.
MooseVariableFE< T > & _var
The variable that this NodalBC operates on.
Definition: ADNodalBC.h:39

◆ computeOffDiagJacobian()

template<typename T , typename Base >
void ADNodalBCTempl< T, Base >::computeOffDiagJacobian ( unsigned int  jvar)
finaloverrideprivate

Definition at line 172 of file ADNodalBC.C.

173 {
174  // Only need to do this once because AD does all the derivatives at once
175  if (jvar_num == _var.number())
176  computeJacobian();
177 }
unsigned int number() const
Get variable number coming from libMesh.
void computeJacobian() override final
Definition: ADNodalBC.C:145
MooseVariableFE< T > & _var
The variable that this NodalBC operates on.
Definition: ADNodalBC.h:39

◆ computeOffDiagJacobianScalar()

template<typename T , typename Base >
void ADNodalBCTempl< T, Base >::computeOffDiagJacobianScalar ( unsigned int  jvar)
finaloverrideprivate

Definition at line 181 of file ADNodalBC.C.

182 {
183  // scalar coupling will have been included in the all-at-once handling in computeOffDiagJacobian
184 }

◆ computeQpResidual()

template<typename T, typename Base>
virtual Moose::ADType<T>::type ADNodalBCTempl< T, Base >::computeQpResidual ( )
protectedpure virtual

Compute this NodalBC's contribution to the residual at the current quadrature point.

Implemented in ADDirichletBCBaseTempl< T >, ADDirichletBCBaseTempl< RealVectorValue >, ADDirichletBCBaseTempl< Real >, and ADVectorMatchedValueBC.

◆ computeResidual()

template<typename T , typename Base >
void ADNodalBCTempl< T, Base >::computeResidual ( )
finaloverrideprivate

Definition at line 132 of file ADNodalBC.C.

133 {
134  const std::vector<dof_id_type> & dof_indices = _var.dofIndices();
135  if (dof_indices.empty())
136  return;
137 
138  const auto residual = computeQpResidual();
139 
140  addResidual(residual, dof_indices);
141 }
virtual Moose::ADType< T >::type computeQpResidual()=0
Compute this NodalBC&#39;s contribution to the residual at the current quadrature point.
const std::vector< dof_id_type > & dofIndices() const final
Get local DoF indices.
MooseVariableFE< T > & _var
The variable that this NodalBC operates on.
Definition: ADNodalBC.h:39
void addResidual(const ADResidual &residual, const std::vector< dof_id_type > &dof_indices)
process the residual into the global data structures
Definition: ADNodalBC.C:100

◆ computeResidualAndJacobian()

template<typename T , typename Base >
void ADNodalBCTempl< T, Base >::computeResidualAndJacobian ( )
overrideprivate

Definition at line 158 of file ADNodalBC.C.

159 {
160  const std::vector<dof_id_type> & dof_indices = _var.dofIndices();
161  if (dof_indices.empty())
162  return;
163 
164  const auto residual = computeQpResidual();
165 
166  addResidual(residual, dof_indices);
167  addJacobian(residual, dof_indices);
168 }
void addJacobian(const ADResidual &residual, const std::vector< dof_id_type > &dof_indices)
process the Jacobian into the global data structures
Definition: ADNodalBC.C:114
virtual Moose::ADType< T >::type computeQpResidual()=0
Compute this NodalBC&#39;s contribution to the residual at the current quadrature point.
const std::vector< dof_id_type > & dofIndices() const final
Get local DoF indices.
MooseVariableFE< T > & _var
The variable that this NodalBC operates on.
Definition: ADNodalBC.h:39
void addResidual(const ADResidual &residual, const std::vector< dof_id_type > &dof_indices)
process the residual into the global data structures
Definition: ADNodalBC.C:100

◆ deduceFunctorName() [1/2]

std::string FunctorInterface::deduceFunctorName ( const std::string &  name,
const InputParameters params 
)
staticinherited

Helper to look up a functor name through the input parameter keys.

Parameters
nameThe input parameter name that we are trying to deduce the functor name for
paramsThe input parameters object that we will be checking for parameters named name
Returns
The functor name

Definition at line 28 of file FunctorInterface.C.

Referenced by FunctorInterface::checkFunctorSupportsSideIntegration(), FunctorInterface::deduceFunctorName(), FunctorInterface::getFunctor(), and FunctorInterface::isFunctor().

29 {
30  if (params.isParamValid(name))
31  {
32  if (params.have_parameter<MooseFunctorName>(name))
33  return params.get<MooseFunctorName>(name);
34  // variables, functor material properties, functions, and post-processors are also functors
35  else if (params.have_parameter<MaterialPropertyName>(name))
36  return params.get<MaterialPropertyName>(name);
37  else if (params.have_parameter<VariableName>(name))
38  return params.get<VariableName>(name);
39  else if (params.have_parameter<std::vector<VariableName>>(name))
40  {
41  const auto & var_names = params.get<std::vector<VariableName>>(name);
42  if (var_names.size() != 1)
43  mooseError("We only support a single variable name for retrieving a functor");
44  return var_names[0];
45  }
46  else if (params.have_parameter<NonlinearVariableName>(name))
47  return params.get<NonlinearVariableName>(name);
48  else if (params.have_parameter<FunctionName>(name))
49  return params.get<FunctionName>(name);
50  else if (params.have_parameter<PostprocessorName>(name))
51  return params.get<PostprocessorName>(name);
52  else
53  mooseError("Invalid parameter type for retrieving a functor");
54  }
55  else
56  return name;
57 }
std::string name(const ElemQuality q)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
bool have_parameter(std::string_view name) const
A wrapper around the Parameters base class method.
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.

◆ deduceFunctorName() [2/2]

std::string FunctorInterface::deduceFunctorName ( const std::string &  name) const
protectedinherited

Small helper to look up a functor name through the input parameter keys.

Definition at line 60 of file FunctorInterface.C.

61 {
62  return deduceFunctorName(name, _fi_params);
63 }
const InputParameters & _fi_params
Parameters of the object with this interface.
static std::string deduceFunctorName(const std::string &name, const InputParameters &params)
Helper to look up a functor name through the input parameter keys.

◆ dot()

template<typename T >
const OutputTools< T >::VariableValue & MooseVariableInterface< T >::dot ( )
protectedvirtualinherited

The time derivative of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 148 of file MooseVariableInterface.C.

149 {
150  if (_nodal)
151  return _variable->dofValuesDot();
152  else
153  return _variable->uDot();
154 }
bool _nodal
Whether or not this object is acting only at nodes.
const FieldVariableValue & uDot() const
element dots
MooseVariableFE< T > * _variable
const DoFValue & dofValuesDot() const override

◆ dotDot()

template<typename T >
const OutputTools< T >::VariableValue & MooseVariableInterface< T >::dotDot ( )
protectedvirtualinherited

The second time derivative of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 158 of file MooseVariableInterface.C.

159 {
160  if (_nodal)
161  return _variable->dofValuesDotDot();
162  else
163  return _variable->uDotDot();
164 }
bool _nodal
Whether or not this object is acting only at nodes.
const DoFValue & dofValuesDotDot() const override
const FieldVariableValue & uDotDot() const
MooseVariableFE< T > * _variable

◆ dotDotDu()

template<typename T >
const VariableValue & MooseVariableInterface< T >::dotDotDu ( )
protectedvirtualinherited

The derivative of the second time derivative of the variable this object is operating on with respect to this variable's coefficients.

This is useful for creating Jacobian entries for residual statements that use _u_dotdot

Returns
The reference to be stored off and used later.

Definition at line 238 of file MooseVariableInterface.C.

239 {
240  if (_nodal)
241  return _variable->dofValuesDuDotDotDu();
242  else
243  return _variable->duDotDotDu();
244 }
const MooseArray< libMesh::Number > & dofValuesDuDotDotDu() const override
bool _nodal
Whether or not this object is acting only at nodes.
const VariableValue & duDotDotDu() const
MooseVariableFE< T > * _variable

◆ dotDotOld()

template<typename T >
const OutputTools< T >::VariableValue & MooseVariableInterface< T >::dotDotOld ( )
protectedvirtualinherited

The old second time derivative of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 178 of file MooseVariableInterface.C.

179 {
180  if (_nodal)
181  return _variable->dofValuesDotDotOld();
182  else
183  return _variable->uDotDotOld();
184 }
bool _nodal
Whether or not this object is acting only at nodes.
const FieldVariableValue & uDotDotOld() const
MooseVariableFE< T > * _variable
const DoFValue & dofValuesDotDotOld() const override

◆ dotDu()

template<typename T >
const VariableValue & MooseVariableInterface< T >::dotDu ( )
protectedvirtualinherited

The derivative of the time derivative of the variable this object is operating on with respect to this variable's coefficients.

This is useful for creating Jacobian entries for residual statements that use _u_dot

Returns
The reference to be stored off and used later.

Definition at line 228 of file MooseVariableInterface.C.

229 {
230  if (_nodal)
231  return _variable->dofValuesDuDotDu();
232  else
233  return _variable->duDotDu();
234 }
const MooseArray< libMesh::Number > & dofValuesDuDotDu() const override
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariableFE< T > * _variable
const VariableValue & duDotDu() const

◆ dotOld()

template<typename T >
const OutputTools< T >::VariableValue & MooseVariableInterface< T >::dotOld ( )
protectedvirtualinherited

The old time derivative of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 168 of file MooseVariableInterface.C.

169 {
170  if (_nodal)
171  return _variable->dofValuesDotOld();
172  else
173  return _variable->uDotOld();
174 }
const DoFValue & dofValuesDotOld() const override
const FieldVariableValue & uDotOld() const
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariableFE< T > * _variable

◆ getFunctor() [1/4]

template<typename T >
const Moose::Functor< T > & FunctorInterface::getFunctor ( const std::string &  name)
protectedinherited

Retrieves a functor from the subproblem.

This method also leverages the ability to create default functors if the user passed an integer or real in the input file

Parameters
nameThe name of the functor to retrieve. This should match the functor parameter name, not the actual name of the functor created in the input file
Returns
The functor

Definition at line 200 of file FunctorInterface.h.

Referenced by MaterialFunctorConverterTempl< T >::MaterialFunctorConverterTempl().

201 {
202  mooseAssert(_fi_subproblem, "This must be non-null");
203  return getFunctor<T>(name, *_fi_subproblem, _fi_tid);
204 }
std::string name(const ElemQuality q)
SubProblem *const _fi_subproblem
Pointer to subproblem if the subproblem pointer parameter was set.
const THREAD_ID _fi_tid
Current threaded it.

◆ getFunctor() [2/4]

template<typename T >
const Moose::Functor< T > & FunctorInterface::getFunctor ( const std::string &  name,
THREAD_ID  tid 
)
protectedinherited

Retrieves a functor from the subproblem.

This method also leverages the ability to create default functors if the user passed an integer or real in the input file

Parameters
nameThe name of the functor to retrieve. This should match the functor parameter name, not the actual name of the functor created in the input file
tidThe thread ID used to retrieve the functor from this interface's subproblem
Returns
The functor

Definition at line 192 of file FunctorInterface.h.

193 {
194  mooseAssert(_fi_subproblem, "This must be non-null");
195  return getFunctor<T>(name, *_fi_subproblem, tid);
196 }
std::string name(const ElemQuality q)
SubProblem *const _fi_subproblem
Pointer to subproblem if the subproblem pointer parameter was set.

◆ getFunctor() [3/4]

template<typename T >
const Moose::Functor< T > & FunctorInterface::getFunctor ( const std::string &  name,
SubProblem subproblem 
)
protectedinherited

Retrieves a functor from the passed-in subproblem.

This method also leverages the ability to create default functors if the user passed an integer or real in the input file

Parameters
nameThe name of the functor to retrieve. This should match the functor parameter name, not the actual name of the functor created in the input file
subproblemThe subproblem to query for the functor
Returns
The functor

Definition at line 185 of file FunctorInterface.h.

186 {
187  return getFunctor<T>(name, subproblem, _fi_tid);
188 }
std::string name(const ElemQuality q)
const THREAD_ID _fi_tid
Current threaded it.

◆ getFunctor() [4/4]

template<typename T >
const Moose::Functor< T > & FunctorInterface::getFunctor ( const std::string &  name,
SubProblem subproblem,
THREAD_ID  tid 
)
protectedinherited

Retrieves a functor from the passed-in subproblem.

This method also leverages the ability to create default functors if the user passed an integer or real in the input file

Parameters
nameThe name of the functor to retrieve. This should match the functor parameter name, not the actual name of the functor created in the input file
subproblemThe subproblem to query for the functor
tidThe thread ID used to retrieve the functor from the subproblem
Returns
The functor

Definition at line 176 of file FunctorInterface.h.

177 {
178  // Check if the supplied parameter is a valid input parameter key
179  std::string functor_name = deduceFunctorName(name);
180  return getFunctorByName<T>(functor_name, subproblem, tid);
181 }
static std::string deduceFunctorName(const std::string &name, const InputParameters &params)
Helper to look up a functor name through the input parameter keys.

◆ gradient()

template<typename T >
const OutputTools< T >::VariableGradient & MooseVariableInterface< T >::gradient ( )
protectedvirtualinherited

The gradient of the variable this object is operating on.

This is computed by default and should already be available as _grad_u

Returns
The reference to be stored off and used later.

Definition at line 248 of file MooseVariableInterface.C.

249 {
250  if (_nodal)
251  mooseError("gradients are not defined at nodes");
252 
253  return _variable->gradSln();
254 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const FieldVariableGradient & gradSln() const override
element gradients
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariableFE< T > * _variable

◆ gradientOld()

template<typename T >
const OutputTools< T >::VariableGradient & MooseVariableInterface< T >::gradientOld ( )
protectedvirtualinherited

The old gradient of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 258 of file MooseVariableInterface.C.

259 {
260  if (_nodal)
261  mooseError("gradients are not defined at nodes");
262 
263  return _variable->gradSlnOld();
264 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariableFE< T > * _variable
const FieldVariableGradient & gradSlnOld() const override

◆ gradientOlder()

template<typename T >
const OutputTools< T >::VariableGradient & MooseVariableInterface< T >::gradientOlder ( )
protectedvirtualinherited

The older gradient of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 268 of file MooseVariableInterface.C.

269 {
270  if (_nodal)
271  mooseError("gradients are not defined at nodes");
272 
273  return _variable->gradSlnOlder();
274 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariableFE< T > * _variable
const FieldVariableGradient & gradSlnOlder() const

◆ isFunctor() [1/2]

bool FunctorInterface::isFunctor ( const std::string &  name) const
protectedinherited

Checks the subproblem for the given functor.

This will not query default functors potentially stored in this object, e.g. this method will return false if the user passed an int or real to the functor param in the input file

Parameters
nameThe name of the functor to check. This should match the functor parameter name, not the actual name of the functor created in the input file
Returns
Whether the subproblem has the specified functor

Definition at line 113 of file FunctorInterface.C.

114 {
115  mooseAssert(_fi_subproblem, "This must be non-null");
116  return isFunctor(name, *_fi_subproblem);
117 }
SubProblem *const _fi_subproblem
Pointer to subproblem if the subproblem pointer parameter was set.
bool isFunctor(const std::string &name) const
Checks the subproblem for the given functor.

◆ isFunctor() [2/2]

bool FunctorInterface::isFunctor ( const std::string &  name,
const SubProblem subproblem 
) const
protectedinherited

Checks the passed-in subproblem for the given functor.

This will not query default functors potentially stored in this object, e.g. this method will return false if the user passed an int or real to the functor param in the input file

Parameters
nameThe name of the functor to check. This should match the functor parameter name, not the actual name of the functor created in the input file
subproblemThe subproblem to query for the functor
Returns
Whether the subproblem has the specified functor

Definition at line 104 of file FunctorInterface.C.

105 {
106  // Check if the supplied parameter is a valid input parameter key
107  std::string functor_name = deduceFunctorName(name);
108 
109  return subproblem.hasFunctor(functor_name, _fi_tid);
110 }
bool hasFunctor(const std::string &name, const THREAD_ID tid) const
checks whether we have a functor corresponding to name on the thread id tid
Definition: SubProblem.C:1271
const THREAD_ID _fi_tid
Current threaded it.
static std::string deduceFunctorName(const std::string &name, const InputParameters &params)
Helper to look up a functor name through the input parameter keys.

◆ makeElemArg()

Moose::ElemArg FunctorInterface::makeElemArg ( const Elem *  elem,
bool  correct_skewnewss = false 
) const
protectedinherited

◆ mooseLinearVariableFV()

template<typename T >
MooseLinearVariableFV< T > * MooseVariableInterface< T >::mooseLinearVariableFV ( ) const
inherited

Return the MooseLinearVariableFV object that this interface acts on.

Definition at line 68 of file MooseVariableInterface.C.

69 {
71  mooseError(
72  "The variable defined in ", _moose_object.name(), " is not a MooseLinearVariableFV!");
73  return _linear_fv_variable;
74 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
MooseLinearVariableFV< T > * _linear_fv_variable
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
const MooseObject & _moose_object

◆ mooseVariable()

template<typename T >
MooseVariableFE< T > * MooseVariableInterface< T >::mooseVariable ( ) const
inherited

Return the MooseVariableFE object that this interface acts on.

Definition at line 78 of file MooseVariableInterface.C.

Referenced by ADIntegratedBCTempl< T >::ADIntegratedBCTempl(), ADInterfaceKernelTempl< T >::ADInterfaceKernelTempl(), ADKernelTempl< T >::ADKernelTempl(), and InterfaceKernelTempl< T >::InterfaceKernelTempl().

79 {
80  if (!_variable)
81  mooseError(
82  "_variable is null in ", _moose_object.name(), ". Are you using a finite volume variable?");
83  return _variable;
84 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
MooseVariableFE< T > * _variable
const MooseObject & _moose_object

◆ mooseVariableBase()

template<typename T>
MooseVariableBase* MooseVariableInterface< T >::mooseVariableBase ( ) const
inlineinherited

Get the variable that this object is using.

Returns
The variable this object is using.

Definition at line 50 of file MooseVariableInterface.h.

50 { return _var; };
MooseVariableBase * _var
The variable this object is acting on.

◆ mooseVariableField()

template<typename T >
MooseVariableField< T > & MooseVariableInterface< T >::mooseVariableField ( )
inherited

Return the MooseVariableField object that this interface acts on.

Definition at line 354 of file MooseVariableInterface.C.

Referenced by DiracKernelTempl< T >::DiracKernelTempl().

355 {
356  return *_field_variable;
357 }
MooseVariableField< T > * _field_variable

◆ mooseVariableFV()

template<typename T >
MooseVariableFV< T > * MooseVariableInterface< T >::mooseVariableFV ( ) const
inherited

Return the MooseVariableFV object that this interface acts on.

Definition at line 57 of file MooseVariableInterface.C.

58 {
59  if (!_fv_variable)
60  mooseError("_fv_variable is null in ",
62  ". Did you forget to set fv = true in the Variables block?");
63  return _fv_variable;
64 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
MooseVariableFV< T > * _fv_variable
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
const MooseObject & _moose_object

◆ second()

template<typename T >
const OutputTools< T >::VariableSecond & MooseVariableInterface< T >::second ( )
protectedvirtualinherited

The second derivative of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 278 of file MooseVariableInterface.C.

Referenced by MooseLinearVariableFV< Real >::getBoundaryCondition(), and MooseVariableFV< Real >::getDirichletBoundaryFaceValue().

279 {
280  if (_nodal)
281  mooseError("second derivatives are not defined at nodes");
282 
283  return _variable->secondSln();
284 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariableFE< T > * _variable
const FieldVariableSecond & secondSln() const
element seconds

◆ secondOld()

template<typename T >
const OutputTools< T >::VariableSecond & MooseVariableInterface< T >::secondOld ( )
protectedvirtualinherited

The old second derivative of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 288 of file MooseVariableInterface.C.

289 {
290  if (_nodal)
291  mooseError("second derivatives are not defined at nodes");
292 
293  return _variable->secondSlnOld();
294 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const FieldVariableSecond & secondSlnOld() const
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariableFE< T > * _variable

◆ secondOlder()

template<typename T >
const OutputTools< T >::VariableSecond & MooseVariableInterface< T >::secondOlder ( )
protectedvirtualinherited

The older second derivative of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 298 of file MooseVariableInterface.C.

299 {
300  if (_nodal)
301  mooseError("second derivatives are not defined at nodes");
302 
303  return _variable->secondSlnOlder();
304 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
bool _nodal
Whether or not this object is acting only at nodes.
const FieldVariableSecond & secondSlnOlder() const
MooseVariableFE< T > * _variable

◆ secondPhi()

template<typename T >
const OutputTools< T >::VariablePhiSecond & MooseVariableInterface< T >::secondPhi ( )
protectedvirtualinherited

The second derivative of the trial function.

Returns
The reference to be stored off and used later.

Definition at line 328 of file MooseVariableInterface.C.

329 {
330  if (_nodal)
331  mooseError("second derivatives are not defined at nodes");
332 
334  mooseError("second order shape function derivatives not available for linear FV variables");
335 
337 }
const VariablePhiSecond & secondPhi() const
Definition: Assembly.h:1299
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
MooseLinearVariableFV< T > * _linear_fv_variable
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariableFE< T > * _variable

◆ secondPhiFace()

template<typename T >
const OutputTools< T >::VariablePhiSecond & MooseVariableInterface< T >::secondPhiFace ( )
protectedvirtualinherited

The second derivative of the trial function on the current face.

This should be called in e.g. IntegratedBC when you need second derivatives of the trial function function on the boundary.

Returns
The reference to be stored off and used later.

Definition at line 341 of file MooseVariableInterface.C.

342 {
343  if (_nodal)
344  mooseError("second derivatives are not defined at nodes");
345 
347  mooseError("second order shape function derivatives not available for linear FV variables");
348 
350 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
MooseLinearVariableFV< T > * _linear_fv_variable
bool _nodal
Whether or not this object is acting only at nodes.
const VariablePhiSecond & secondPhiFace(const MooseVariableField< Real > &) const
Definition: Assembly.h:1312
MooseVariableFE< T > * _variable

◆ secondTest()

template<typename T >
const OutputTools< T >::VariableTestSecond & MooseVariableInterface< T >::secondTest ( )
protectedvirtualinherited

The second derivative of the test function.

Returns
The reference to be stored off and used later.

Definition at line 308 of file MooseVariableInterface.C.

309 {
310  if (_nodal)
311  mooseError("second derivatives are not defined at nodes");
312 
313  return _variable->secondPhi();
314 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const FieldVariablePhiSecond & secondPhi() const override final
Return the rank-2 tensor of second derivatives of the variable&#39;s elemental shape functions.
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariableFE< T > * _variable

◆ secondTestFace()

template<typename T >
const OutputTools< T >::VariableTestSecond & MooseVariableInterface< T >::secondTestFace ( )
protectedvirtualinherited

The second derivative of the test function on the current face.

This should be called in e.g. IntegratedBC when you need second derivatives of the test function function on the boundary.

Returns
The reference to be stored off and used later.

Definition at line 318 of file MooseVariableInterface.C.

319 {
320  if (_nodal)
321  mooseError("second derivatives are not defined at nodes");
322 
323  return _variable->secondPhiFace();
324 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
bool _nodal
Whether or not this object is acting only at nodes.
const FieldVariablePhiSecond & secondPhiFace() const override final
Return the rank-2 tensor of second derivatives of the variable&#39;s shape functions on an element face...
MooseVariableFE< T > * _variable

◆ shouldSetComp()

template<typename T, typename Base>
bool ADNodalBCTempl< T, Base >::shouldSetComp ( unsigned short  i) const
inline

Definition at line 30 of file ADNodalBC.h.

30 { return _set_components[i]; }
const std::array< bool, 3 > _set_components
Definition: ADNodalBC.h:50

◆ validParams() [1/3]

template<typename T , typename Base >
InputParameters ADNodalBCTempl< T, Base >::validParams ( )
static

Definition at line 26 of file ADNodalBC.C.

Referenced by ADVectorMatchedValueBC::validParams(), GenericNodalBC< true >::validParams(), and ADDirichletBCBaseTempl< Real >::validParams().

27 {
28  return Base::validParams();
29 }
InputParameters validParams()

◆ validParams() [2/3]

template<>
InputParameters ADNodalBCTempl< RealVectorValue, NodalBCBase >::validParams ( )

Definition at line 33 of file ADNodalBC.C.

34 {
36  // The below parameters are useful for vector Nodal BCs
37  params.addParam<bool>("set_x_comp", true, "Whether to set the x-component of the variable");
38  params.addParam<bool>("set_y_comp", true, "Whether to set the y-component of the variable");
39  params.addParam<bool>("set_z_comp", true, "Whether to set the z-component of the variable");
40  return params;
41 }
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
static InputParameters validParams()
Definition: NodalBCBase.C:13

◆ validParams() [3/3]

template<>
InputParameters ADNodalBCTempl< RealVectorValue, NodalBCBase >::validParams ( )

◆ value()

template<typename T >
const OutputTools< T >::VariableValue & MooseVariableInterface< T >::value ( )
protectedvirtualinherited

The value of the variable this object is operating on.

This is computed by default and should already be available as _u

Returns
The reference to be stored off and used later.

Definition at line 88 of file MooseVariableInterface.C.

Referenced by ReporterPointSource::fillPoint().

89 {
90  if (_nodal)
91  return _variable->dofValues();
92  else
93  return _variable->sln();
94 }
bool _nodal
Whether or not this object is acting only at nodes.
const FieldVariableValue & sln() const override
element solutions
MooseVariableFE< T > * _variable
const DoFValue & dofValues() const override
dof values getters

◆ valueOld()

template<typename T >
const OutputTools< T >::VariableValue & MooseVariableInterface< T >::valueOld ( )
protectedvirtualinherited

The old value of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 108 of file MooseVariableInterface.C.

109 {
110  if (_nodal)
111  return _variable->dofValuesOld();
112  else
113  return _variable->slnOld();
114 }
bool _nodal
Whether or not this object is acting only at nodes.
const DoFValue & dofValuesOld() const override
MooseVariableFE< T > * _variable
const FieldVariableValue & slnOld() const override

◆ valueOlder()

template<typename T >
const OutputTools< T >::VariableValue & MooseVariableInterface< T >::valueOlder ( )
protectedvirtualinherited

The older value of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 128 of file MooseVariableInterface.C.

129 {
130  if (_nodal)
131  return _variable->dofValuesOlder();
132  else
133  return _variable->slnOlder();
134 }
bool _nodal
Whether or not this object is acting only at nodes.
const DoFValue & dofValuesOlder() const override
MooseVariableFE< T > * _variable
const FieldVariableValue & slnOlder() const override

◆ variable()

template<typename T, typename Base>
const MooseVariableFE<T>& ADNodalBCTempl< T, Base >::variable ( ) const
inlineoverride

Definition at line 28 of file ADNodalBC.h.

28 { return _var; }
MooseVariableFE< T > & _var
The variable that this NodalBC operates on.
Definition: ADNodalBC.h:39

Member Data Documentation

◆ _current_node

template<typename T, typename Base>
const Node* const& ADNodalBCTempl< T, Base >::_current_node
protected

current node being processed

Definition at line 42 of file ADNodalBC.h.

◆ _field_variable

template<typename T>
MooseVariableField<T>* MooseVariableInterface< T >::_field_variable = nullptr
protectedinherited

◆ _fv_variable

template<typename T>
MooseVariableFV<T>* MooseVariableInterface< T >::_fv_variable = nullptr
protectedinherited

◆ _linear_fv_variable

template<typename T>
MooseLinearVariableFV<T>* MooseVariableInterface< T >::_linear_fv_variable = nullptr
protectedinherited

◆ _mvi_assembly

template<typename T>
Assembly* MooseVariableInterface< T >::_mvi_assembly
protectedinherited

◆ _nodal

template<typename T>
bool MooseVariableInterface< T >::_nodal
protectedinherited

Whether or not this object is acting only at nodes.

Definition at line 223 of file MooseVariableInterface.h.

◆ _qp

template<typename T, typename Base>
const unsigned int ADNodalBCTempl< T, Base >::_qp = 0
protected

Pseudo-"quadrature point" index (Always zero for the current node)

Definition at line 45 of file ADNodalBC.h.

◆ _set_components

template<typename T, typename Base>
const std::array<bool, 3> ADNodalBCTempl< T, Base >::_set_components
protected

◆ _u

template<typename T, typename Base>
const Moose::ADType<T>::type& ADNodalBCTempl< T, Base >::_u
protected

Value of the unknown variable this BC is acting on.

Definition at line 48 of file ADNodalBC.h.

Referenced by ADVectorMatchedValueBC::computeQpResidual().

◆ _undisplaced_assembly

template<typename T, typename Base>
Assembly& ADNodalBCTempl< T, Base >::_undisplaced_assembly
private

A reference to the undisplaced assembly in order to ensure data gets correctly incorporated into the global residual/Jacobian.

Definition at line 81 of file ADNodalBC.h.

◆ _var

template<typename T, typename Base>
MooseVariableFE<T>& ADNodalBCTempl< T, Base >::_var
protected

The variable that this NodalBC operates on.

Definition at line 39 of file ADNodalBC.h.

Referenced by ADNodalBCTempl< RealVectorValue, ADDirichletBCBase >::variable().

◆ _variable

template<typename T>
MooseVariableFE<T>* MooseVariableInterface< T >::_variable = nullptr
protectedinherited

The documentation for this class was generated from the following files: