https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ADFunctionDirichletBC Class Reference

Boundary condition of a Dirichlet type. More...

#include <ADFunctionDirichletBC.h>

Inheritance diagram for ADFunctionDirichletBC:
[legend]

Public Member Functions

 ADFunctionDirichletBC (const InputParameters &parameters)
 
virtual void computeValue (NumericVector< Number > &current_solution) override
 Method to preset the nodal value if applicable.
 
const MooseVariableFE< T > & variable () const override
 
bool shouldSetComp (unsigned short i) const
 
MooseVariableBasemooseVariableBase () const
 Get the variable that this object is using.
 
MooseVariableField< T > & mooseVariableField ()
 Return the MooseVariableField object that this interface acts on.
 
MooseVariableFE< T > * mooseVariable () const
 Return the MooseVariableFE object that this interface acts on.
 
MooseVariableFV< T > * mooseVariableFV () const
 Return the MooseVariableFV object that this interface acts on.
 
MooseLinearVariableFV< T > * mooseLinearVariableFV () const
 Return the MooseLinearVariableFV object that this interface acts on.
 
template<>
const Moose::Functor< Real > * defaultFunctor (const std::string &name)
 
template<>
const Moose::Functor< ADReal > * defaultFunctor (const std::string &name)
 

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.
 

Protected Member Functions

virtual ADReal computeQpValue () override
 Compute the value of the Dirichlet BC at the current quadrature point.
 
virtual Moose::ADType< Real >::type computeQpResidual () override
 Compute this NodalBC's contribution to the residual at the current quadrature point.
 
virtual const OutputTools< T >::VariableValuevalue ()
 The value of the variable this object is operating on.
 
virtual const OutputTools< T >::VariableValuevalueOld ()
 The old value of the variable this object is operating on.
 
virtual const OutputTools< T >::VariableValuevalueOlder ()
 The older value of the variable this object is operating on.
 
virtual const OutputTools< T >::VariableValuedot ()
 The time derivative of the variable this object is operating on.
 
virtual const OutputTools< T >::VariableValuedotDot ()
 The second time derivative of the variable this object is operating on.
 
virtual const OutputTools< T >::VariableValuedotOld ()
 The old time derivative of the variable this object is operating on.
 
virtual const OutputTools< T >::VariableValuedotDotOld ()
 The old second time derivative of the variable this object is operating on.
 
virtual const VariableValuedotDu ()
 The derivative of the time derivative of the variable this object is operating on with respect to this variable's coefficients.
 
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.
 
virtual const OutputTools< T >::VariableGradientgradient ()
 The gradient of the variable this object is operating on.
 
virtual const OutputTools< T >::VariableGradientgradientOld ()
 The old gradient of the variable this object is operating on.
 
virtual const OutputTools< T >::VariableGradientgradientOlder ()
 The older gradient of the variable this object is operating on.
 
virtual const OutputTools< T >::VariableSecondsecond ()
 The second derivative of the variable this object is operating on.
 
virtual const OutputTools< T >::VariableSecondsecondOld ()
 The old second derivative of the variable this object is operating on.
 
virtual const OutputTools< T >::VariableSecondsecondOlder ()
 The older second derivative of the variable this object is operating on.
 
virtual const OutputTools< T >::VariableTestSecondsecondTest ()
 The second derivative of the test function.
 
virtual const OutputTools< T >::VariableTestSecondsecondTestFace ()
 The second derivative of the test function on the current face.
 
virtual const OutputTools< T >::VariablePhiSecondsecondPhi ()
 The second derivative of the trial function.
 
virtual const OutputTools< T >::VariablePhiSecondsecondPhiFace ()
 The second derivative of the trial function on the current face.
 
std::string deduceFunctorName (const std::string &name) const
 Small helper to look up a functor name through the input parameter keys.
 
template<typename T >
const Moose::Functor< T > & getFunctor (const std::string &name)
 Retrieves a functor from the subproblem.
 
template<typename T >
const Moose::Functor< T > & getFunctor (const std::string &name, THREAD_ID tid)
 Retrieves a functor from the subproblem.
 
template<typename T >
const Moose::Functor< T > & getFunctor (const std::string &name, SubProblem &subproblem)
 Retrieves a functor from the passed-in subproblem.
 
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.
 
bool isFunctor (const std::string &name) const
 Checks the subproblem for the given functor.
 
bool isFunctor (const std::string &name, const SubProblem &subproblem) const
 Checks the passed-in subproblem for the given functor.
 
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.
 
template<typename T >
void checkFunctorSupportsSideIntegration (const std::string &name, bool qp_integration)
 Throws error if the functor does not support the requested side integration.
 
template<typename T >
const Moose::Functor< T > & getFunctorByName (const std::string &name)
 Retrieves a functor from the subproblem.
 

Protected Attributes

const Function_function
 The function describing the Dirichlet condition.
 
 usingTransientInterfaceMembers
 
MooseVariableFE< T > & _var
 The variable that this NodalBC operates on.
 
const Node *const & _current_node
 current node being processed
 
const unsigned int _qp = 0
 Pseudo-"quadrature point" index (Always zero for the current node)
 
const Moose::ADType< T >::type & _u
 Value of the unknown variable this BC is acting on.
 
std::vector< bool > _set_components
 
bool _nodal
 Whether or not this object is acting only at nodes.
 
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
 
void addResidual (const T &residual, const std::vector< dof_id_type > &dof_indices)
 process the residual into the global data structures
 
template<typename ADResidual >
void addJacobian (const ADResidual &residual, const std::vector< dof_id_type > &dof_indices)
 process the Jacobian into the global data structures
 
virtual bool isADObject () const override
 Whether this interface is for an AD object.
 
template<typename T >
const Moose::Functor< T > & getFunctorByName (const std::string &name, SubProblem &subproblem, THREAD_ID tid)
 Retrieves a functor from the passed-in subproblem.
 
template<typename T >
const Moose::Functor< T > * defaultFunctor (const std::string &name)
 Helper function to parse default functor values.
 
template<>
const Moose::Functor< Real > * defaultFunctor (const std::string &name)
 
template<>
const Moose::Functor< ADReal > * defaultFunctor (const std::string &name)
 

Private Attributes

Assembly_undisplaced_assembly
 A reference to the undisplaced assembly in order to ensure data gets correctly incorporated into the global residual/Jacobian.
 
const MooseObject_moose_object
 
const InputParameters_fi_params
 Parameters of the object with this interface.
 
const std::string _fi_name
 The name of the object that this interface belongs to.
 
SubProblem *const _fi_subproblem
 Pointer to subproblem if the subproblem pointer parameter was set.
 
const THREAD_ID _fi_tid
 Current threaded it.
 
std::vector< std::unique_ptr< Moose::Functor< Real > > > _default_real_functors
 Storage vector for Moose::Functor<Real> default objects.
 
std::vector< std::unique_ptr< Moose::Functor< ADReal > > > _default_ad_real_functors
 Storage vector for Moose::Functor<ADReal> default objects.
 

Detailed Description

Boundary condition of a Dirichlet type.

Sets the values of a nodal variable at nodes to values specified by a function

Definition at line 19 of file ADFunctionDirichletBC.h.

Constructor & Destructor Documentation

◆ ADFunctionDirichletBC()

ADFunctionDirichletBC::ADFunctionDirichletBC ( const InputParameters parameters)

Definition at line 27 of file ADFunctionDirichletBC.C.

28 : ADDirichletBCBaseTempl<Real>(parameters), _function(getFunction("function"))
29{
30}
Base class for automatic differentiation Dirichlet BCs.
const Function & _function
The function describing the Dirichlet condition.

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 
)
privateinherited

process the Jacobian into the global data structures

Definition at line 127 of file ADNodalBC.C.

129{
130 mooseAssert(dof_indices.size() <= _set_components.size(),
131 "The number of dof indices must be less than the number of settable components");
132 if (!std::is_same_v<T, RealVectorValue>)
133 mooseAssert(dof_indices.size() == _var.count(),
134 "The number of dof indices should match the variable count");
135
136 for (const auto i : index_range(dof_indices))
138 // If we store into the displaced assembly for nodal bc objects the data never actually makes
139 // it into the global Jacobian
141 Moose::Span(&conversionHelper(residual, i), 1),
142 Moose::Span(&dof_indices[i], 1),
143 /*scaling_factor=*/1);
144}
if(!dmm->_nl) SETERRQ(PETSC_COMM_WORLD
std::vector< bool > _set_components
Definition ADNodalBC.h:50
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
Assembly & _undisplaced_assembly
A reference to the undisplaced assembly in order to ensure data gets correctly incorporated into the ...
Definition ADNodalBC.h:80
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
auto index_range(const T &sizable)

◆ addResidual()

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

process the residual into the global data structures

Definition at line 113 of file ADNodalBC.C.

115{
116 mooseAssert(dof_indices.size() <= _set_components.size(),
117 "The number of dof indices must be less than the number of settable components");
118
119 for (const auto i : index_range(dof_indices))
121 setResidual(_sys, conversionHelper(residual, i), dof_indices[i]);
122}

◆ 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 261 of file FunctorInterface.h.

262{
263 const std::string functor_name = deduceFunctorName(name);
264 const auto & functor = getFunctor<T>(name);
265 if (qp_integration)
266 {
267 if (!functor.supportsElemSideQpArg())
268 mooseError("Quadrature point integration was requested, but the functor '",
269 functor_name,
270 "' does not support this.");
271 }
272 else
273 {
274 if (!functor.supportsFaceArg())
275 mooseError("Face info integration was requested, but the functor '",
276 functor_name,
277 "' does not support this.");
278 }
279}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
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 ( )
finaloverrideprivateinherited

Definition at line 161 of file ADNodalBC.C.

162{
163 const std::vector<dof_id_type> & dof_indices = _var.dofIndices();
164 if (dof_indices.empty())
165 return;
166
167 const auto residual = computeQpResidual();
168
169 addJacobian(residual, dof_indices);
170}
virtual Moose::ADType< T >::type computeQpResidual()=0
Compute this NodalBC's contribution to the residual at the current quadrature point.
const std::vector< dof_id_type > & dofIndices() const final
Get local DoF indices.

◆ computeOffDiagJacobian()

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

Definition at line 188 of file ADNodalBC.C.

189{
190 // Only need to do this once because AD does all the derivatives at once
191 if (jvar_num == _var.number())
193}
void computeJacobian() override final
Definition ADNodalBC.C:161
unsigned int number() const
Get variable number coming from libMesh.

◆ computeOffDiagJacobianScalar()

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

Definition at line 197 of file ADNodalBC.C.

198{
199 // scalar coupling will have been included in the all-at-once handling in computeOffDiagJacobian
200}

◆ computeQpResidual()

Moose::ADType< Real >::type ADDirichletBCBaseTempl< Real >::computeQpResidual ( )
overrideprotectedvirtualinherited

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

Implements ADNodalBCTempl< T, Base >.

Definition at line 32 of file ADDirichletBCBaseTempl.C.

61{
62 return _u - computeQpValue();
63}
virtual Moose::ADType< Real >::type computeQpValue()=0
Compute the value of the Dirichlet BC 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

◆ computeQpValue()

ADReal ADFunctionDirichletBC::computeQpValue ( )
overrideprotectedvirtual

Compute the value of the Dirichlet BC at the current quadrature point.

Implements ADDirichletBCBaseTempl< Real >.

Definition at line 33 of file ADFunctionDirichletBC.C.

34{
35 return _function.value(_t, *_current_node);
36}
const Node *const & _current_node
current node being processed
Definition ADNodalBC.h:42
virtual Real value(Real t, const Point &p) const
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero,...
Definition Function.C:30

◆ computeResidual()

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

Definition at line 148 of file ADNodalBC.C.

149{
150 const std::vector<dof_id_type> & dof_indices = _var.dofIndices();
151 if (dof_indices.empty())
152 return;
153
154 const auto residual = MetaPhysicL::raw_value(computeQpResidual());
155
156 addResidual(residual, dof_indices);
157}
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
auto raw_value(const Eigen::Map< T > &in)

◆ computeResidualAndJacobian()

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

Definition at line 174 of file ADNodalBC.C.

175{
176 const std::vector<dof_id_type> & dof_indices = _var.dofIndices();
177 if (dof_indices.empty())
178 return;
179
180 const auto residual = computeQpResidual();
181
182 addResidual(MetaPhysicL::raw_value(residual), dof_indices);
183 addJacobian(residual, dof_indices);
184}

◆ computeValue()

void ADDirichletBCBaseTempl< Real >::computeValue ( NumericVector< Number > &  current_solution)
overridevirtualinherited

Method to preset the nodal value if applicable.

Definition at line 27 of file ADDirichletBCBaseTempl.C.

34{
35 mooseAssert(this->_preset, "BC is not preset");
36
37 if (_var.isNodalDefined())
38 {
39 const auto n_comp = _current_node->n_comp(_sys.number(), _var.number());
41 for (const auto i : make_range(n_comp))
42 {
43 const auto dof_idx = _current_node->dof_number(_sys.number(), _var.number(), i);
44 if constexpr (std::is_same<T, Real>::value)
45 {
46 mooseAssert(n_comp == 1, "This should only be unity");
47 current_solution.set(dof_idx, value);
48 }
49 else
50 {
51 if (shouldSetComp(i))
52 current_solution.set(dof_idx, value(i));
53 }
54 }
55 }
56}
bool shouldSetComp(unsigned short i) const
Definition ADNodalBC.h:30
virtual bool isNodalDefined() const override
Is this variable defined at nodes.
virtual const OutputTools< T >::VariableValue & value()
The value of the variable this object is operating on.
virtual void set(const numeric_index_type i, const T value)=0
IntRange< T > make_range(T beg, T end)

◆ deduceFunctorName() [1/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 71 of file FunctorInterface.C.

72{
73 return deduceFunctorName(name, _fi_params);
74}
const InputParameters & _fi_params
Parameters of the object with this interface.

◆ deduceFunctorName() [2/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 39 of file FunctorInterface.C.

40{
41 if (params.isParamValid(name))
42 {
43 if (params.have_parameter<MooseFunctorName>(name))
44 return params.get<MooseFunctorName>(name);
45 // variables, functor material properties, functions, and post-processors are also functors
46 else if (params.have_parameter<MaterialPropertyName>(name))
47 return params.get<MaterialPropertyName>(name);
48 else if (params.have_parameter<VariableName>(name))
49 return params.get<VariableName>(name);
50 else if (params.have_parameter<std::vector<VariableName>>(name))
51 {
52 const auto & var_names = params.get<std::vector<VariableName>>(name);
53 if (var_names.size() != 1)
54 mooseError("We only support a single variable name for retrieving a functor");
55 return var_names[0];
56 }
57 else if (params.have_parameter<NonlinearVariableName>(name))
58 return params.get<NonlinearVariableName>(name);
59 else if (params.have_parameter<FunctionName>(name))
60 return params.get<FunctionName>(name);
61 else if (params.have_parameter<PostprocessorName>(name))
62 return params.get<PostprocessorName>(name);
63 else
64 mooseError("Invalid parameter type for retrieving a functor");
65 }
66 else
67 return name;
68}
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,...
std::string name(const ElemQuality q)

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

◆ defaultFunctor() [1/5]

template<typename T >
const Moose::Functor< T > * FunctorInterface::defaultFunctor ( const std::string &  name)
privateinherited

Helper function to parse default functor values.

This is implemented as a specialization for supported types and returns NULL in all other cases.

Definition at line 254 of file FunctorInterface.h.

255{
256 return nullptr;
257}

◆ defaultFunctor() [2/5]

template<>
const Moose::Functor< Real > * FunctorInterface::defaultFunctor ( const std::string &  name)
privateinherited

◆ defaultFunctor() [3/5]

template<>
const Moose::Functor< ADReal > * FunctorInterface::defaultFunctor ( const std::string &  name)
privateinherited

◆ defaultFunctor() [4/5]

template<>
const Moose::Functor< Real > * FunctorInterface::defaultFunctor ( const std::string &  name)
inherited

Definition at line 78 of file FunctorInterface.C.

79{
80 std::istringstream ss(name);
81 Real real_value;
82
83 // check if the string parsed cleanly into a Real number
84 if (ss >> real_value && ss.eof())
85 {
86 _default_real_functors.emplace_back(std::make_unique<Moose::Functor<Real>>(
87 std::make_unique<Moose::ConstantFunctor<Real>>(real_value)));
88 auto & default_property = _default_real_functors.back();
89 return default_property.get();
90 }
91
92 return nullptr;
93}
std::vector< std::unique_ptr< Moose::Functor< Real > > > _default_real_functors
Storage vector for Moose::Functor<Real> default objects.
Class template for creating constant functors.
This is a wrapper that forwards calls to the implementation, which can be switched out at any time wi...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ defaultFunctor() [5/5]

template<>
const Moose::Functor< ADReal > * FunctorInterface::defaultFunctor ( const std::string &  name)
inherited

Definition at line 97 of file FunctorInterface.C.

98{
99 std::istringstream ss(name);
100 Real real_value;
101
102 // check if the string parsed cleanly into a Real number
103 if (ss >> real_value && ss.eof())
104 {
105 _default_ad_real_functors.emplace_back(std::make_unique<Moose::Functor<ADReal>>(
106 std::make_unique<Moose::ConstantFunctor<ADReal>>(real_value)));
107 auto & default_property = _default_ad_real_functors.back();
108 return default_property.get();
109 }
110
111 return nullptr;
112}
std::vector< std::unique_ptr< Moose::Functor< ADReal > > > _default_ad_real_functors
Storage vector for Moose::Functor<ADReal> default objects.

◆ 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}
const DofValues & dofValuesDot() const override
const FieldVariableValue & uDot() const
element dots
MooseVariableFE< T > * _variable
bool _nodal
Whether or not this object is acting only at nodes.

◆ 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}
const FieldVariableValue & uDotDot() const
const DofValues & dofValuesDotDot() const override

◆ 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)
242 else
243 return _variable->duDotDotDu();
244}
const VariableValue & duDotDotDu() const
const MooseArray< libMesh::Number > & dofValuesDuDotDotDu() const override

◆ 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)
182 else
183 return _variable->uDotDotOld();
184}
const DofValues & dofValuesDotDotOld() const override
const FieldVariableValue & uDotDotOld() const

◆ 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
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 FieldVariableValue & uDotOld() const
const DofValues & dofValuesDotOld() const override

◆ 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, \emph not the actual name of the functor created in the input file
Returns
The functor

Definition at line 217 of file FunctorInterface.h.

218{
219 mooseAssert(_fi_subproblem, "This must be non-null");
220 return getFunctor<T>(name, *_fi_subproblem, _fi_tid);
221}
const THREAD_ID _fi_tid
Current threaded it.
SubProblem *const _fi_subproblem
Pointer to subproblem if the subproblem pointer parameter was set.

Referenced by GenericFunctorGradientMaterialTempl< is_ad >::GenericFunctorGradientMaterialTempl(), GenericFunctorMaterialTempl< is_ad >::GenericFunctorMaterialTempl(), GenericVectorFunctorMaterialTempl< is_ad >::GenericVectorFunctorMaterialTempl(), MaterialFunctorConverterTempl< T >::MaterialFunctorConverterTempl(), and ParsedFunctorMaterialTempl< is_ad >::ParsedFunctorMaterialTempl().

◆ getFunctor() [2/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, \emph 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 202 of file FunctorInterface.h.

203{
204 return getFunctor<T>(name, subproblem, _fi_tid);
205}

◆ getFunctor() [3/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, \emph 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 193 of file FunctorInterface.h.

194{
195 // Check if the supplied parameter is a valid input parameter key
196 std::string functor_name = deduceFunctorName(name);
197 return getFunctorByName<T>(functor_name, subproblem, tid);
198}

◆ getFunctor() [4/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, \emph 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 209 of file FunctorInterface.h.

210{
211 mooseAssert(_fi_subproblem, "This must be non-null");
212 return getFunctor<T>(name, *_fi_subproblem, tid);
213}

◆ getFunctorByName() [1/2]

template<typename T >
const Moose::Functor< T > & FunctorInterface::getFunctorByName ( 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 actual name of the functor created in the input file
Returns
The functor

Definition at line 225 of file FunctorInterface.h.

226{
227 mooseAssert(_fi_subproblem, "This must be non-null");
228 return getFunctorByName<T>(name, *_fi_subproblem, _fi_tid);
229}

◆ getFunctorByName() [2/2]

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

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 actual name of the functor to retrieve instead of the parameter name
subproblemThe subproblem to query for the functor
tidThe thread ID used to retrieve the functor from the subproblem
Returns
The functor

Definition at line 233 of file FunctorInterface.h.

236{
237 // Check if it's just a constant
238 const auto * const default_functor = defaultFunctor<T>(name);
239 if (default_functor)
240 return *default_functor;
241
242 return subproblem.getFunctor<T>(name, tid, _fi_name, isADObject());
243}
virtual bool isADObject() const =0
Whether this interface is for an AD object.
const std::string _fi_name
The name of the object that this interface belongs to.
const Moose::Functor< T > & getFunctor(const std::string &name, const THREAD_ID tid, const std::string &requestor_name, bool requestor_is_ad)

◆ 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}
const FieldVariableGradient & gradSln() const override
element gradients

Referenced by DiffusionFluxAux::computeValue().

◆ 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}
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}
const FieldVariableGradient & gradSlnOlder() const

◆ isADObject()

virtual bool ADFunctorInterface::isADObject ( ) const
inlineoverrideprivatevirtualinherited

Whether this interface is for an AD object.

Implements FunctorInterface.

Definition at line 34 of file ADFunctorInterface.h.

34{ return true; }

◆ 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, \emph not the actual name of the functor created in the input file
Returns
Whether the subproblem has the specified functor

Definition at line 124 of file FunctorInterface.C.

125{
126 mooseAssert(_fi_subproblem, "This must be non-null");
127 return isFunctor(name, *_fi_subproblem);
128}
bool isFunctor(const std::string &name) const
Checks the subproblem for the given functor.

Referenced by FunctorInterface::isFunctor().

◆ 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, \emph 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 115 of file FunctorInterface.C.

116{
117 // Check if the supplied parameter is a valid input parameter key
118 std::string functor_name = deduceFunctorName(name);
119
120 return subproblem.hasFunctor(functor_name, _fi_tid);
121}
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

◆ 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{
72 "The variable defined in ", _moose_object.name(), " is not a MooseLinearVariableFV!");
74}
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
const MooseObject & _moose_object
MooseLinearVariableFV< T > * _linear_fv_variable

◆ mooseVariable()

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

◆ 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.

Referenced by ElementAdaptivityLevelAux::ElementAdaptivityLevelAux(), ElementLpNormAux::ElementLpNormAux(), and VolumeAux::VolumeAux().

◆ 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.

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

Referenced by DiracKernelTempl< T >::DiracKernelTempl(), and InternalSideIndicatorTempl< ComputeValueType >::InternalSideIndicatorTempl().

◆ 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}
MooseVariableFV< T > * _fv_variable

◆ 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.

279{
280 if (_nodal)
281 mooseError("second derivatives are not defined at nodes");
282
283 return _variable->secondSln();
284}
const FieldVariableSecond & secondSln() const
element seconds

Referenced by MooseVariableFV< OutputType >::getDirichletBoundaryFaceValue().

◆ 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}
const FieldVariableSecond & secondSlnOld() const

◆ 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}
const FieldVariableSecond & secondSlnOlder() const

◆ 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:1329

◆ 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}
const VariablePhiSecond & secondPhiFace(const MooseVariableField< Real > &) const
Definition Assembly.h:1342

◆ 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}
const FieldVariablePhiSecond & secondPhi() const override final
Return the rank-2 tensor of second derivatives of the variable's elemental shape functions.

◆ 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}
const FieldVariablePhiSecond & secondPhiFace() const override final
Return the rank-2 tensor of second derivatives of the variable's shape functions on an element face.

◆ shouldSetComp()

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

Definition at line 30 of file ADNodalBC.h.

30{ return _set_components[i]; }

◆ validParams()

InputParameters ADFunctionDirichletBC::validParams ( )
static

Definition at line 18 of file ADFunctionDirichletBC.C.

19{
21 params.addClassDescription("Imposes the essential boundary condition $u=g$, where $g$ "
22 "is calculated by a function.");
23 params.addParam<FunctionName>("function", 0, "The function describing the Dirichlet condition");
24 return params;
25}
static InputParameters validParams()
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.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.

◆ 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.

89{
90 if (_nodal)
91 return _variable->dofValues();
92 else
93 return _variable->sln();
94}
const DofValues & dofValues() const override
dof values getters
const FieldVariableValue & sln() const override
element solutions

Referenced by NodalConstraint::computeJacobian(), ConservativeAdvectionBCTempl< is_ad >::computeQpResidual(), BodyForceTempl< is_ad >::computeQpResidual(), ArrayBodyForce::computeQpResidual(), ElementUOAux::computeValue(), MeshDivisionAux::computeValue(), and ParsedVectorAux::computeValue().

◆ 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}
const FieldVariableValue & slnOld() const override
const DofValues & dofValuesOld() 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}
const FieldVariableValue & slnOlder() const override
const DofValues & dofValuesOlder() const override

◆ variable()

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

Definition at line 28 of file ADNodalBC.h.

28{ return _var; }

Member Data Documentation

◆ _current_node

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

current node being processed

Definition at line 42 of file ADNodalBC.h.

Referenced by computeQpValue(), ADVectorFunctionDirichletBC::computeQpValue(), and FunctorDirichletBC::computeQpValue().

◆ _default_ad_real_functors

std::vector<std::unique_ptr<Moose::Functor<ADReal> > > FunctorInterface::_default_ad_real_functors
privateinherited

Storage vector for Moose::Functor<ADReal> default objects.

Definition at line 188 of file FunctorInterface.h.

Referenced by FunctorInterface::defaultFunctor().

◆ _default_real_functors

std::vector<std::unique_ptr<Moose::Functor<Real> > > FunctorInterface::_default_real_functors
privateinherited

Storage vector for Moose::Functor<Real> default objects.

Definition at line 185 of file FunctorInterface.h.

Referenced by FunctorInterface::defaultFunctor().

◆ _fi_name

const std::string FunctorInterface::_fi_name
privateinherited

The name of the object that this interface belongs to.

Definition at line 176 of file FunctorInterface.h.

Referenced by FunctorInterface::getFunctorByName().

◆ _fi_params

const InputParameters& FunctorInterface::_fi_params
privateinherited

Parameters of the object with this interface.

Definition at line 173 of file FunctorInterface.h.

Referenced by FunctorInterface::deduceFunctorName().

◆ _fi_subproblem

SubProblem* const FunctorInterface::_fi_subproblem
privateinherited

Pointer to subproblem if the subproblem pointer parameter was set.

Definition at line 179 of file FunctorInterface.h.

Referenced by FunctorInterface::getFunctor(), FunctorInterface::getFunctor(), FunctorInterface::getFunctorByName(), and FunctorInterface::isFunctor().

◆ _fi_tid

const THREAD_ID FunctorInterface::_fi_tid
privateinherited

◆ _field_variable

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

Definition at line 230 of file MooseVariableInterface.h.

◆ _function

const Function& ADFunctionDirichletBC::_function
protected

The function describing the Dirichlet condition.

Definition at line 30 of file ADFunctionDirichletBC.h.

Referenced by computeQpValue().

◆ _fv_variable

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

Definition at line 228 of file MooseVariableInterface.h.

◆ _linear_fv_variable

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

Definition at line 229 of file MooseVariableInterface.h.

◆ _moose_object

template<typename T >
const MooseObject& MooseVariableInterface< T >::_moose_object
privateinherited

◆ _mvi_assembly

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

Definition at line 233 of file MooseVariableInterface.h.

◆ _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
protectedinherited

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 >
std::vector<bool> ADNodalBCTempl< T, Base >::_set_components
protectedinherited

Definition at line 50 of file ADNodalBC.h.

Referenced by ADNodalBCTempl< T, Base >::shouldSetComp().

◆ _u

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

Value of the unknown variable this BC is acting on.

Definition at line 48 of file ADNodalBC.h.

Referenced by ADArrayDirichletBC::computeQpResidual(), and ADVectorMatchedValueBC::computeQpResidual().

◆ _undisplaced_assembly

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

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

Definition at line 80 of file ADNodalBC.h.

◆ _var

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

The variable that this NodalBC operates on.

Definition at line 39 of file ADNodalBC.h.

Referenced by ADArrayDirichletBC::ADArrayDirichletBC(), and ADNodalBCTempl< T, Base >::variable().

◆ _variable

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

Definition at line 227 of file MooseVariableInterface.h.

◆ usingTransientInterfaceMembers

ADDirichletBCBaseTempl< Real >::usingTransientInterfaceMembers
protectedinherited

Definition at line 39 of file ADDirichletBCBaseTempl.h.


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