https://mooseframework.inl.gov
Coupleable.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include <unordered_map>
13 #include "MooseTypes.h"
14 #include "MooseArray.h"
15 #include "MooseVariableFE.h"
16 #include "MooseVariableFV.h"
17 #include "MooseLinearVariableFV.h"
18 #include "InputParameters.h"
19 #include "HasMembers.h"
20 
21 #define usingCoupleableMembers \
22  using Coupleable::_zero; \
23  using Coupleable::_grad_zero; \
24  using Coupleable::_ad_zero; \
25  using Coupleable::_ad_grad_zero
26 
27 // Forward declarations
29 class MooseObject;
30 
31 namespace libMesh
32 {
33 template <typename T>
34 class DenseVector;
35 }
36 
37 template <typename>
40 
46 {
47 public:
54  Coupleable(const MooseObject * moose_object, bool nodal, bool is_fv = false);
55 
60  const std::unordered_map<std::string, std::vector<MooseVariableFieldBase *>> &
62  {
63  return _coupled_vars;
64  }
65 
70  const std::vector<MooseVariableFieldBase *> & getCoupledMooseVars() const
71  {
72  return _coupled_moose_vars;
73  }
74 
79  const std::vector<MooseVariable *> & getCoupledStandardMooseVars() const
80  {
82  }
83 
88  const std::vector<VectorMooseVariable *> & getCoupledVectorMooseVars() const
89  {
91  }
92 
97  const std::vector<ArrayMooseVariable *> & getCoupledArrayMooseVars() const
98  {
100  }
101 
103 
105 
107 
109 
110  const std::set<TagID> & getFEVariableCoupleableVectorTags() const
111  {
113  }
114 
115  const std::set<TagID> & getFEVariableCoupleableMatrixTags() const
116  {
118  }
119 
124 
128  bool hasWritableCoupledVariables() const { return !getWritableCoupledVariables().empty(); }
129 
130 protected:
135  virtual void coupledCallback(const std::string & /*var_name*/, bool /*is_old*/) const {}
136 
143  virtual bool isCoupled(const std::string & var_name, unsigned int i = 0) const;
144 
150  virtual bool isCoupledConstant(const std::string & var_name) const;
151 
157  unsigned int coupledComponents(const std::string & var_name) const;
158 
165  VariableName coupledName(const std::string & var_name, unsigned int comp = 0) const;
166 
172  std::vector<VariableName> coupledNames(const std::string & var_name) const;
173 
181  virtual unsigned int coupled(const std::string & var_name, unsigned int comp = 0) const;
182 
188  std::vector<unsigned int> coupledIndices(const std::string & var_name) const;
189 
197  virtual const VariableValue & coupledValue(const std::string & var_name,
198  unsigned int comp = 0) const;
199 
205  std::vector<const VariableValue *> coupledValues(const std::string & var_name) const;
206 
212  std::vector<const VectorVariableValue *> coupledVectorValues(const std::string & var_name) const;
213 
220  template <bool is_ad>
221  const GenericVariableValue<is_ad> & coupledGenericValue(const std::string & var_name,
222  unsigned int comp = 0) const;
223 
231  template <bool is_ad>
232  const GenericVectorVariableValue<is_ad> & coupledGenericVectorValue(const std::string & var_name,
233  unsigned int comp = 0) const;
234 
241  template <bool is_ad>
242  std::vector<const GenericVariableValue<is_ad> *>
243  coupledGenericValues(const std::string & var_name) const;
244 
251  template <bool is_ad>
252  const GenericVariableValue<is_ad> & coupledGenericDofValue(const std::string & var_name,
253  unsigned int comp = 0) const;
254 
262  template <bool is_ad>
263  const GenericVariableValue<is_ad> & coupledGenericDot(const std::string & var_name,
264  unsigned int comp = 0) const;
265 
273  template <bool is_ad>
274  const GenericVariableValue<is_ad> & coupledGenericDotDot(const std::string & var_name,
275  unsigned int comp = 0) const;
276 
283  virtual const VariableValue & coupledValueLower(const std::string & var_name,
284  unsigned int comp = 0) const;
285 
292  const ADVariableValue & adCoupledValue(const std::string & var_name, unsigned int comp = 0) const;
293 
300  std::vector<const ADVariableValue *> adCoupledValues(const std::string & var_name) const;
301 
308  const ADVariableValue & adCoupledLowerValue(const std::string & var_name,
309  unsigned int comp = 0) const;
310 
318  const ADVectorVariableValue & adCoupledVectorValue(const std::string & var_name,
319  unsigned int comp = 0) const;
320 
327  std::vector<const ADVectorVariableValue *>
328  adCoupledVectorValues(const std::string & var_name) const;
329 
338  virtual const VariableValue &
339  coupledVectorTagValue(const std::string & var_names, TagID tag, unsigned int index = 0) const;
340 
341  virtual const VariableValue & coupledVectorTagValue(const std::string & var_names,
342  const std::string & tag_name,
343  unsigned int index = 0) const;
344 
351  std::vector<const VariableValue *> coupledVectorTagValues(const std::string & var_names,
352  TagID tag) const;
353 
354  std::vector<const VariableValue *> coupledVectorTagValues(const std::string & var_names,
355  const std::string & tag_name) const;
356 
365  virtual const ArrayVariableValue & coupledVectorTagArrayValue(const std::string & var_names,
366  TagID tag,
367  unsigned int index = 0) const;
368 
369  virtual const ArrayVariableValue & coupledVectorTagArrayValue(const std::string & var_names,
370  const std::string & tag_name,
371  unsigned int index = 0) const;
372 
379  std::vector<const ArrayVariableValue *> coupledVectorTagArrayValues(const std::string & var_names,
380  TagID tag) const;
381 
382  std::vector<const ArrayVariableValue *>
383  coupledVectorTagArrayValues(const std::string & var_names, const std::string & tag_name) const;
384 
393  virtual const VariableGradient &
394  coupledVectorTagGradient(const std::string & var_names, TagID tag, unsigned int index = 0) const;
395 
396  virtual const VariableGradient & coupledVectorTagGradient(const std::string & var_names,
397  const std::string & tag_name,
398  unsigned int index = 0) const;
399 
406  std::vector<const VariableGradient *> coupledVectorTagGradients(const std::string & var_names,
407  TagID tag) const;
408 
409  std::vector<const VariableGradient *>
410  coupledVectorTagGradients(const std::string & var_names, const std::string & tag_name) const;
411 
421  virtual const ArrayVariableGradient & coupledVectorTagArrayGradient(const std::string & var_names,
422  TagID tag,
423  unsigned int index = 0) const;
424 
425  virtual const ArrayVariableGradient & coupledVectorTagArrayGradient(const std::string & var_names,
426  const std::string & tag_name,
427  unsigned int index = 0) const;
428 
435  std::vector<const ArrayVariableGradient *>
436  coupledVectorTagArrayGradients(const std::string & var_names, TagID tag) const;
437 
438  std::vector<const ArrayVariableGradient *>
439  coupledVectorTagArrayGradients(const std::string & var_names, const std::string & tag_name) const;
440 
448  virtual const VariableValue &
449  coupledVectorTagDofValue(const std::string & var_name, TagID tag, unsigned int index = 0) const;
450 
451  virtual const VariableValue & coupledVectorTagDofValue(const std::string & var_names,
452  const std::string & tag_name,
453  unsigned int index = 0) const;
454 
461  const ArrayVariableValue & coupledVectorTagArrayDofValue(const std::string & var_name,
462  const std::string & tag_name,
463  unsigned int comp = 0) const;
464 
471  std::vector<const VariableValue *> coupledVectorTagDofValues(const std::string & var_names,
472  TagID tag) const;
473 
474  std::vector<const VariableValue *> coupledVectorTagDofValues(const std::string & var_names,
475  const std::string & tag_name) const;
476 
485  virtual const VariableValue &
486  coupledMatrixTagValue(const std::string & var_names, TagID tag, unsigned int index = 0) const;
487 
488  virtual const VariableValue & coupledMatrixTagValue(const std::string & var_names,
489  const std::string & tag_name,
490  unsigned int index = 0) const;
491 
498  std::vector<const VariableValue *> coupledMatrixTagValues(const std::string & var_names,
499  TagID tag) const;
500 
501  std::vector<const VariableValue *> coupledMatrixTagValues(const std::string & var_names,
502  const std::string & tag_name) const;
503 
511  virtual const VectorVariableValue & coupledVectorValue(const std::string & var_name,
512  unsigned int comp = 0) const;
513 
521  virtual const ArrayVariableValue & coupledArrayValue(const std::string & var_name,
522  unsigned int comp = 0) const;
523 
529  std::vector<const ArrayVariableValue *> coupledArrayValues(const std::string & var_name) const;
530 
543  MooseWritableVariable & writableVariable(const std::string & var_name, unsigned int comp = 0);
544 
554  virtual VariableValue & writableCoupledValue(const std::string & var_name, unsigned int comp = 0);
555 
560 
568  virtual const VariableValue & coupledValueOld(const std::string & var_name,
569  unsigned int comp = 0) const;
570 
576  std::vector<const VariableValue *> coupledValuesOld(const std::string & var_name) const;
577 
583  std::vector<const VectorVariableValue *>
584  coupledVectorValuesOld(const std::string & var_name) const;
585 
593  virtual const VariableValue & coupledValueOlder(const std::string & var_name,
594  unsigned int comp = 0) const;
595 
601  std::vector<const VariableValue *> coupledValuesOlder(const std::string & var_name) const;
602 
609  virtual const VariableValue & coupledValuePreviousNL(const std::string & var_name,
610  unsigned int comp = 0) const;
611 
619  virtual const VectorVariableValue & coupledVectorValueOld(const std::string & var_name,
620  unsigned int comp = 0) const;
621 
629  virtual const VectorVariableValue & coupledVectorValueOlder(const std::string & var_name,
630  unsigned int comp = 0) const;
631 
639  virtual const ArrayVariableValue & coupledArrayValueOld(const std::string & var_name,
640  unsigned int comp = 0) const;
641 
649  virtual const ArrayVariableValue & coupledArrayValueOlder(const std::string & var_name,
650  unsigned int comp = 0) const;
651 
659  virtual const VariableGradient & coupledGradient(const std::string & var_name,
660  unsigned int comp = 0) const;
661 
667  std::vector<const VariableGradient *> coupledGradients(const std::string & var_name) const;
668 
676  const ADVariableGradient & adCoupledGradient(const std::string & var_name,
677  unsigned int comp = 0) const;
678 
686  const ADVariableGradient & adCoupledGradientDot(const std::string & var_name,
687  unsigned int comp = 0) const;
688 
695  std::vector<const ADVariableGradient *> adCoupledGradients(const std::string & var_name) const;
696 
704  template <bool is_ad>
705  const GenericVariableGradient<is_ad> & coupledGenericGradient(const std::string & var_name,
706  unsigned int comp = 0) const;
707 
714  template <bool is_ad>
715  std::vector<const GenericVariableGradient<is_ad> *>
716  coupledGenericGradients(const std::string & var_name) const;
717 
725  const ADVectorVariableGradient & adCoupledVectorGradient(const std::string & var_name,
726  unsigned int comp = 0) const;
727 
734  const ADVariableSecond & adCoupledSecond(const std::string & var_name,
735  unsigned int comp = 0) const;
736 
744  const ADVectorVariableSecond & adCoupledVectorSecond(const std::string & var_name,
745  unsigned int comp = 0) const;
746 
754  virtual const VariableGradient & coupledGradientOld(const std::string & var_name,
755  unsigned int comp = 0) const;
756 
762  std::vector<const VariableGradient *> coupledGradientsOld(const std::string & var_name) const;
763 
771  virtual const VariableGradient & coupledGradientOlder(const std::string & var_name,
772  unsigned int comp = 0) const;
773 
780  virtual const VariableGradient & coupledGradientPreviousNL(const std::string & var_name,
781  unsigned int comp = 0) const;
782 
790  virtual const VariableGradient & coupledGradientDot(const std::string & var_name,
791  unsigned int comp = 0) const;
792 
800  virtual const VariableGradient & coupledGradientDotDot(const std::string & var_name,
801  unsigned int comp = 0) const;
802 
810  virtual const VectorVariableGradient & coupledVectorGradient(const std::string & var_name,
811  unsigned int comp = 0) const;
812 
820  virtual const VectorVariableGradient & coupledVectorGradientOld(const std::string & var_name,
821  unsigned int comp = 0) const;
822 
830  virtual const VectorVariableGradient & coupledVectorGradientOlder(const std::string & var_name,
831  unsigned int comp = 0) const;
832 
840  virtual const ArrayVariableGradient & coupledArrayGradient(const std::string & var_name,
841  unsigned int comp = 0) const;
842 
850  virtual const ArrayVariableGradient & coupledArrayGradientOld(const std::string & var_name,
851  unsigned int comp = 0) const;
852 
860  virtual const ArrayVariableGradient & coupledArrayGradientOlder(const std::string & var_name,
861  unsigned int comp = 0) const;
862 
870  virtual const ArrayVariableGradient & coupledArrayGradientDot(const std::string & var_name,
871  unsigned int comp = 0) const;
872 
880  virtual const VectorVariableCurl & coupledCurl(const std::string & var_name,
881  unsigned int comp = 0) const;
882 
890  virtual const VectorVariableCurl & coupledCurlOld(const std::string & var_name,
891  unsigned int comp = 0) const;
892 
900  virtual const VectorVariableCurl & coupledCurlOlder(const std::string & var_name,
901  unsigned int comp = 0) const;
902 
910  const ADVectorVariableCurl & adCoupledCurl(const std::string & var_name,
911  unsigned int comp = 0) const;
912 
921  virtual const VectorVariableDivergence & coupledDiv(const std::string & var_name,
922  unsigned int comp = 0) const;
923 
932  virtual const VectorVariableDivergence & coupledDivOld(const std::string & var_name,
933  unsigned int comp = 0) const;
934 
943  virtual const VectorVariableDivergence & coupledDivOlder(const std::string & var_name,
944  unsigned int comp = 0) const;
945 
953  virtual const VariableSecond & coupledSecond(const std::string & var_name,
954  unsigned int comp = 0) const;
955 
964  virtual const VariableSecond & coupledSecondOld(const std::string & var_name,
965  unsigned int comp = 0) const;
966 
975  virtual const VariableSecond & coupledSecondOlder(const std::string & var_name,
976  unsigned int comp = 0) const;
977 
984  virtual const VariableSecond & coupledSecondPreviousNL(const std::string & var_name,
985  unsigned int comp = 0) const;
986 
993  virtual const VariableValue & coupledDot(const std::string & var_name,
994  unsigned int comp = 0) const;
995 
1001  std::vector<const VariableValue *> coupledDots(const std::string & var_name) const;
1002 
1010  virtual const VariableValue & coupledDotDot(const std::string & var_name,
1011  unsigned int comp = 0) const;
1012 
1019  virtual const VariableValue & coupledDotOld(const std::string & var_name,
1020  unsigned int comp = 0) const;
1021 
1029  virtual const VariableValue & coupledDotDotOld(const std::string & var_name,
1030  unsigned int comp = 0) const;
1031 
1039  const ADVariableValue & adCoupledDot(const std::string & var_name, unsigned int comp = 0) const;
1040 
1046  std::vector<const ADVariableValue *> adCoupledDots(const std::string & var_name) const;
1047 
1055  const ADVariableValue & adCoupledDotDot(const std::string & var_name,
1056  unsigned int comp = 0) const;
1057 
1066  const ADVectorVariableValue & adCoupledVectorDot(const std::string & var_name,
1067  unsigned int comp = 0) const;
1068 
1076  virtual const VectorVariableValue & coupledVectorDot(const std::string & var_name,
1077  unsigned int comp = 0) const;
1078 
1086  virtual const VectorVariableValue & coupledVectorDotDot(const std::string & var_name,
1087  unsigned int comp = 0) const;
1088 
1096  virtual const VectorVariableValue & coupledVectorDotOld(const std::string & var_name,
1097  unsigned int comp = 0) const;
1098 
1106  virtual const VectorVariableValue & coupledVectorDotDotOld(const std::string & var_name,
1107  unsigned int comp = 0) const;
1108 
1116  virtual const VariableValue & coupledVectorDotDu(const std::string & var_name,
1117  unsigned int comp = 0) const;
1118 
1126  virtual const VariableValue & coupledVectorDotDotDu(const std::string & var_name,
1127  unsigned int comp = 0) const;
1128 
1136  virtual const ArrayVariableValue & coupledArrayDot(const std::string & var_name,
1137  unsigned int comp = 0) const;
1138 
1146  virtual const ArrayVariableValue & coupledArrayDotDot(const std::string & var_name,
1147  unsigned int comp = 0) const;
1148 
1156  virtual const ArrayVariableValue & coupledArrayDotOld(const std::string & var_name,
1157  unsigned int comp = 0) const;
1158 
1166  virtual const ArrayVariableValue & coupledArrayDotDotOld(const std::string & var_name,
1167  unsigned int comp = 0) const;
1168 
1176  virtual const VariableValue & coupledDotDu(const std::string & var_name,
1177  unsigned int comp = 0) const;
1178 
1186  virtual const VariableValue & coupledDotDotDu(const std::string & var_name,
1187  unsigned int comp = 0) const;
1188 
1196  const VariableValue & coupledArrayDotDu(const std::string & var_name,
1197  unsigned int comp = 0) const;
1198 
1205  template <typename T>
1206  const T & coupledNodalValue(const std::string & var_name, unsigned int comp = 0) const;
1207 
1214  template <typename T>
1215  const typename Moose::ADType<T>::type & adCoupledNodalValue(const std::string & var_name,
1216  unsigned int comp = 0) const;
1217 
1224  template <typename T>
1225  const T & coupledNodalValueOld(const std::string & var_name, unsigned int comp = 0) const;
1226 
1233  template <typename T>
1234  const T & coupledNodalValueOlder(const std::string & var_name, unsigned int comp = 0) const;
1235 
1242  template <typename T>
1243  const T & coupledNodalValuePreviousNL(const std::string & var_name, unsigned int comp = 0) const;
1244 
1252  template <typename T>
1253  const T & coupledNodalDot(const std::string & var_name, unsigned int comp = 0) const;
1254 
1262  virtual const VariableValue & coupledNodalDotDot(const std::string & var_name,
1263  unsigned int comp = 0) const;
1264 
1272  virtual const VariableValue & coupledNodalDotOld(const std::string & var_name,
1273  unsigned int comp = 0) const;
1274 
1282  virtual const VariableValue & coupledNodalDotDotOld(const std::string & var_name,
1283  unsigned int comp = 0) const;
1284  // coupled-dof-values-begin
1291  virtual const VariableValue & coupledDofValues(const std::string & var_name,
1292  unsigned int comp = 0) const;
1293 
1300  std::vector<const VariableValue *> coupledAllDofValues(const std::string & var_name) const;
1301 
1308  virtual const VariableValue & coupledDofValuesOld(const std::string & var_name,
1309  unsigned int comp = 0) const;
1310 
1317  std::vector<const VariableValue *> coupledAllDofValuesOld(const std::string & var_name) const;
1318 
1325  virtual const VariableValue & coupledDofValuesOlder(const std::string & var_name,
1326  unsigned int comp = 0) const;
1327 
1334  std::vector<const VariableValue *> coupledAllDofValuesOlder(const std::string & var_name) const;
1335 
1342  virtual const ArrayVariableValue & coupledArrayDofValues(const std::string & var_name,
1343  unsigned int comp = 0) const;
1344  // coupled-dof-values-end
1345 
1352  virtual const ADVariableValue & adCoupledDofValues(const std::string & var_name,
1353  unsigned int comp = 0) const;
1354 
1359  const ADVariableValue & adZeroValue() const;
1360 
1365  const ADVariableGradient & adZeroGradient() const;
1366 
1370  const ADVariableSecond & adZeroSecond() const;
1371 
1376  template <bool is_ad>
1378 
1383  template <bool is_ad>
1385 
1390  template <bool is_ad>
1392 
1393 protected:
1394  // Reference to the interface's input parameters
1396 
1398  const std::string & _c_name;
1400  const std::string & _c_type;
1401 
1402  // Reference to FEProblemBase
1404 
1406  const SystemBase * const _c_sys;
1407 
1409  std::unordered_map<std::string, std::vector<MooseVariableFieldBase *>> _coupled_vars;
1410 
1412  std::vector<MooseVariableFieldBase *> _coupled_moose_vars;
1413 
1415  std::vector<MooseVariable *> _coupled_standard_moose_vars;
1416 
1418  std::vector<VectorMooseVariable *> _coupled_vector_moose_vars;
1419 
1421  std::vector<ArrayMooseVariable *> _coupled_array_moose_vars;
1422 
1424  std::vector<MooseVariableFV<Real> *> _coupled_standard_fv_moose_vars;
1425 
1427  std::vector<MooseLinearVariableFV<Real> *> _coupled_standard_linear_fv_moose_vars;
1428 
1430  const std::unordered_map<std::string, std::string> & _new_to_deprecated_coupled_vars;
1431 
1433  bool _c_nodal;
1434 
1437 
1438  // Argument to allow element-to-nodal coupling
1440 
1443 
1445  mutable std::unordered_map<std::string, std::vector<std::unique_ptr<VariableValue>>>
1447 
1449  mutable std::unordered_map<std::string, std::unique_ptr<MooseArray<ADReal>>> _ad_default_value;
1450 
1452  mutable std::unordered_map<std::string, std::unique_ptr<VectorVariableValue>>
1454 
1456  mutable std::unordered_map<std::string, std::unique_ptr<ArrayVariableValue>> _default_array_value;
1457 
1459  mutable std::unordered_map<std::string, std::unique_ptr<MooseArray<ADRealVectorValue>>>
1461 
1467 
1470 
1473 
1476 
1479 
1482 
1485 
1490 
1494 
1497 
1507 
1513 
1516 
1519 
1522 
1528 
1531 
1537  bool
1538  checkVar(const std::string & var_name, unsigned int comp = 0, unsigned int comp_bound = 0) const;
1539 
1540 private:
1544  template <typename T>
1545  const typename OutputTools<T>::VariableValue &
1546  vectorTagValueHelper(const std::string & var_names, TagID tag, unsigned int index = 0) const;
1547 
1551  template <typename T>
1552  const typename OutputTools<T>::VariableValue & vectorTagValueHelper(const std::string & var_names,
1553  const std::string & tag_name,
1554  unsigned int index = 0) const;
1555 
1559  template <typename T>
1560  const typename OutputTools<T>::VariableValue &
1561  vectorTagDofValueHelper(const std::string & var_name, TagID tag, unsigned int comp = 0) const;
1562 
1566  template <typename T>
1568  const std::string & var_name, const std::string & tag_name, unsigned int comp = 0) const;
1569 
1575  template <typename T>
1576  void
1577  requestStates(const std::string & var_name, const TagName & tag_name, const unsigned int comp);
1578 
1579  enum class FuncAge
1580  {
1581  Curr,
1582  Old,
1583  Older,
1584  };
1585 
1586  enum class VarType
1587  {
1588  Ignore,
1589  Gradient,
1590  Second,
1591  GradientDot,
1592  Dot,
1593  };
1594 
1595  void checkFuncType(const std::string var_name, VarType t, FuncAge age) const;
1596 
1597 protected:
1606  const MooseVariableFieldBase * getFEVar(const std::string & var_name, unsigned int comp) const;
1607 
1608  /*
1609  * Extract pointer to a base coupled field variable. Could be either a finite volume or finite
1610  * element variable
1611  * @param var_name Name of parameter desired
1612  * @param comp Component number of multiple coupled variables
1613  * @return Pointer to the desired variable
1614  */
1615  const MooseVariableFieldBase * getFieldVar(const std::string & var_name, unsigned int comp) const;
1616 
1617  /*
1618  * Extract pointer to a base coupled field variable. Could be either a finite volume or finite
1619  * element variable
1620  * @param var_name Name of variable desired
1621  * @param comp Component number of multiple coupled variables
1622  * @return Pointer to the desired variable
1623  */
1624  MooseVariableFieldBase * getFieldVar(const std::string & var_name, unsigned int comp);
1625 
1629  template <typename T>
1630  const T * getVarHelper(const std::string & var_name, unsigned int comp) const;
1631 
1635  template <typename T>
1636  T * getVarHelper(const std::string & var_name, unsigned int comp);
1637 
1644  MooseVariable * getVar(const std::string & var_name, unsigned int comp);
1645 
1652  VectorMooseVariable * getVectorVar(const std::string & var_name, unsigned int comp);
1653 
1660  ArrayMooseVariable * getArrayVar(const std::string & var_name, unsigned int comp);
1661 
1668  const MooseVariable * getVar(const std::string & var_name, unsigned int comp) const;
1669 
1676  const VectorMooseVariable * getVectorVar(const std::string & var_name, unsigned int comp) const;
1677 
1684  const ArrayMooseVariable * getArrayVar(const std::string & var_name, unsigned int comp) const;
1685 
1692  void validateExecutionerType(const std::string & name, const std::string & fn_name) const;
1693 
1694  template <typename T, typename Func>
1695  std::vector<T> coupledVectorHelper(const std::string & var_name, const Func & func) const
1696  {
1697  const auto components = coupledComponents(var_name);
1698  std::vector<T> vals(components);
1699  for (MooseIndex(components) comp = 0; comp < components; ++comp)
1700  vals[comp] = func(comp);
1701  return vals;
1702  }
1703 
1706 
1707 public:
1714  const ADVariableValue * getADDefaultValue(const std::string & var_name) const;
1715 
1722  const ADVectorVariableValue * getADDefaultVectorValue(const std::string & var_name) const;
1723 
1730  const ADVariableGradient & getADDefaultGradient() const;
1731 
1739 
1746  const ADVariableSecond & getADDefaultSecond() const;
1747 
1754  const ADVectorVariableCurl & getADDefaultCurl() const;
1755 
1756 private:
1763  const VariableValue * getDefaultValue(const std::string & var_name, unsigned int comp) const;
1764 
1771  const VectorVariableValue * getDefaultVectorValue(const std::string & var_name) const;
1772 
1779  const ArrayVariableValue * getDefaultArrayValue(const std::string & var_name) const;
1780 
1784  template <typename T>
1785  const T & getDefaultNodalValue(const std::string & var_name, unsigned int comp = 0) const;
1786 
1787  template <typename T>
1788  const Moose::Functor<T> & getDefaultFunctor(const std::string & var_name) const;
1789 
1791  unsigned int _coupleable_max_qps;
1792 
1794  std::unordered_map<std::string, std::vector<unsigned int>> _optional_var_index;
1795 
1797  std::unordered_map<std::string, std::vector<MooseVariableScalar *>> _c_coupled_scalar_vars;
1798 
1800 
1802 
1804  const bool _is_fv;
1805 
1806  const MooseObject * const _obj;
1807 
1809  const std::set<std::string> _older_state_tags = {Moose::OLD_SOLUTION_TAG,
1811 
1813  std::vector<std::set<MooseWritableVariable *>> _writable_coupled_variables;
1814 };
1815 
1816 template <typename T>
1817 T *
1818 Coupleable::getVarHelper(const std::string & var_name_in, unsigned int comp)
1819 {
1820  const auto var_name = _c_parameters.checkForRename(var_name_in);
1821  auto name_to_use = var_name;
1822 
1823  // First check for supplied name
1824  if (!checkVar(var_name, comp, 0))
1825  {
1826  // See if there is an associated deprecated name that the user may have used instead
1827  auto it = _new_to_deprecated_coupled_vars.find(var_name);
1828  if (it == _new_to_deprecated_coupled_vars.end())
1829  return nullptr;
1830  else
1831  {
1832  auto deprecated_name = it->second;
1833  if (checkVar(deprecated_name, comp, 0))
1834  name_to_use = deprecated_name;
1835  else
1836  return nullptr;
1837  }
1838  }
1839 
1840  auto coupled_vars_it = _coupled_vars.find(name_to_use);
1841 
1842  mooseAssert(coupled_vars_it != _coupled_vars.end(),
1843  "Trying to get a coupled var " << name_to_use << " that doesn't exist");
1844 
1845  if (auto coupled_var = dynamic_cast<T *>(coupled_vars_it->second[comp]))
1846  return coupled_var;
1847  else
1848  {
1849  for (auto & var : _coupled_standard_moose_vars)
1850  if (var->name() == name_to_use)
1851  mooseError("The named variable is a standard variable, try a "
1852  "'coupled[Value/Gradient/Dot/etc]...' function instead");
1853  for (auto & var : _coupled_vector_moose_vars)
1854  if (var->name() == name_to_use)
1855  mooseError("The named variable is a vector variable, try a "
1856  "'coupledVector[Value/Gradient/Dot/etc]...' function instead");
1857  for (auto & var : _coupled_array_moose_vars)
1858  if (var->name() == name_to_use)
1859  mooseError("The named variable is an array variable, try a "
1860  "'coupledArray[Value/Gradient/Dot/etc]...' function instead");
1861  for (auto & var : _coupled_standard_fv_moose_vars)
1862  if (var->name() == name_to_use)
1863  mooseError("The named variable is a finite volume variable, which the coupled[...] routine "
1864  "used does not support. Try using the functor system routines instead.");
1865  mooseError(
1866  "Variable '", name_to_use, "' is of a different C++ type than you tried to fetch it as.");
1867  }
1868 }
1869 
1870 template <typename T>
1871 const T *
1872 Coupleable::getVarHelper(const std::string & var_name, unsigned int comp) const
1873 {
1874  return const_cast<Coupleable *>(this)->getVarHelper<T>(var_name, comp);
1875 }
virtual const ArrayVariableValue & coupledArrayDotDotOld(const std::string &var_name, unsigned int comp=0) const
Old second time derivative of a coupled array variable.
Definition: Coupleable.C:1416
virtual const VariableValue & coupledDofValues(const std::string &var_name, unsigned int comp=0) const
Returns DoFs in the current solution vector of a coupled variable for the local element.
Definition: Coupleable.C:2027
virtual const VariableValue & coupledVectorTagValue(const std::string &var_names, TagID tag, unsigned int index=0) const
Returns value of a coupled variable for a given tag.
Definition: Coupleable.C:619
virtual const VariableGradient & coupledVectorTagGradient(const std::string &var_names, TagID tag, unsigned int index=0) const
Returns gradient of a coupled variable for a given tag.
Definition: Coupleable.C:651
virtual const ArrayVariableValue & coupledArrayValueOlder(const std::string &var_name, unsigned int comp=0) const
Returns an old value from two time steps previous of a coupled array variable.
Definition: Coupleable.C:1118
OutputTools< Real >::VariableGradient VariableGradient
Definition: MooseTypes.h:315
const T & coupledNodalDot(const std::string &var_name, unsigned int comp=0) const
Nodal values of time derivative of a coupled variable.
Definition: Coupleable.C:1965
OutputTools< RealVectorValue >::VariableDivergence VectorVariableDivergence
Definition: MooseTypes.h:335
void validateExecutionerType(const std::string &name, const std::string &fn_name) const
Checks to make sure that the current Executioner has set "_is_transient" when old/older values are co...
Definition: Coupleable.C:2118
virtual bool isCoupled(const std::string &var_name, unsigned int i=0) const
Returns true if a variables has been coupled as name.
Definition: Coupleable.C:129
virtual const VectorVariableGradient & coupledVectorGradient(const std::string &var_name, unsigned int comp=0) const
Returns gradient of a coupled vector variable.
Definition: Coupleable.C:1610
const std::vector< ArrayMooseVariable * > & getCoupledArrayMooseVars() const
Get the list of array coupled variables.
Definition: Coupleable.h:97
bool _c_nodal
True if we provide coupling to nodal values.
Definition: Coupleable.h:1433
void checkFuncType(const std::string var_name, VarType t, FuncAge age) const
Definition: Coupleable.C:192
const std::vector< VectorMooseVariable * > & getCoupledVectorMooseVars() const
Get the list of vector coupled variables.
Definition: Coupleable.h:88
VectorVariableCurl _default_vector_curl
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1518
Moose::GenericType< VectorVariableValue, is_ad > GenericVectorVariableValue
Definition: MooseTypes.h:664
VectorMooseVariable * getVectorVar(const std::string &var_name, unsigned int comp)
Extract pointer to a coupled vector variable.
Definition: Coupleable.C:294
const VariableValue & _zero
Zero value of a variable.
Definition: Coupleable.h:1487
const VariablePhiGradient & _grad_phi_zero
Zero gradient of trial function.
Definition: Coupleable.h:1496
virtual unsigned int coupled(const std::string &var_name, unsigned int comp=0) const
Returns the index for a coupled variable by name.
Definition: Coupleable.C:442
virtual const VectorVariableValue & coupledVectorDotDot(const std::string &var_name, unsigned int comp=0) const
Second time derivative of a coupled vector variable.
Definition: Coupleable.C:1270
const VariablePhiSecond & _second_phi_zero
Zero second derivative of a test function.
Definition: Coupleable.h:1502
virtual const VariableSecond & coupledSecondPreviousNL(const std::string &var_name, unsigned int comp=0) const
Returns second derivative of a coupled variable for the previous Newton iterate.
Definition: Coupleable.C:1871
std::unordered_map< std::string, std::unique_ptr< MooseArray< ADRealVectorValue > > > _ad_default_vector_value
Will hold the default value for optional vector coupled variables for automatic differentiation.
Definition: Coupleable.h:1460
const ArrayVariableValue * getDefaultArrayValue(const std::string &var_name) const
Helper method to return (and insert if necessary) the default value for an uncoupled array variable...
Definition: Coupleable.C:397
const GenericVariableGradient< is_ad > & coupledGenericGradient(const std::string &var_name, unsigned int comp=0) const
Returns gradient of a coupled variable for use in templated automatic differentiation.
std::vector< const VariableValue * > coupledValuesOlder(const std::string &var_name) const
Returns the older values for all of a coupled variable&#39;s components.
Definition: Coupleable.C:2696
const ADVariableSecond & adZeroSecond() const
Retrieve a zero second for automatic differentiation.
Definition: Coupleable.C:2414
const ADVectorVariableValue * getADDefaultVectorValue(const std::string &var_name) const
Helper method to return (and insert if necessary) the default vector value for Automatic Differentiat...
Definition: Coupleable.C:2355
virtual const VariableSecond & coupledSecond(const std::string &var_name, unsigned int comp=0) const
Returns second spatial derivatives of a coupled variable.
Definition: Coupleable.C:1823
virtual bool isCoupledConstant(const std::string &var_name) const
Returns true if a variable passed as a coupled value is really a constant.
Definition: Coupleable.C:152
virtual const VariableValue & coupledDotOld(const std::string &var_name, unsigned int comp=0) const
Old time derivative of a coupled variable.
Definition: Coupleable.C:1204
virtual const VectorVariableValue & coupledVectorValueOld(const std::string &var_name, unsigned int comp=0) const
Returns an old value from previous time step of a coupled vector variable.
Definition: Coupleable.C:1068
std::vector< const ArrayVariableValue * > coupledArrayValues(const std::string &var_name) const
Returns the values for all of a coupled array variable&#39;s components.
Definition: Coupleable.C:871
std::vector< const VariableValue * > coupledDots(const std::string &var_name) const
Returns the time derivatives for all of a coupled variable&#39;s components.
Definition: Coupleable.C:2747
virtual const ArrayVariableValue & coupledArrayValueOld(const std::string &var_name, unsigned int comp=0) const
Returns an old value from previous time step of a coupled array variable.
Definition: Coupleable.C:1096
unsigned int TagID
Definition: MooseTypes.h:210
VariableName coupledName(const std::string &var_name, unsigned int comp=0) const
Names of the variable in the Coupleable interface.
Definition: Coupleable.C:2484
virtual const VectorVariableGradient & coupledVectorGradientOld(const std::string &var_name, unsigned int comp=0) const
Returns an old gradient from previous time step of a coupled vector variable.
Definition: Coupleable.C:1626
MooseVariableField< Real > MooseWritableVariable
Definition: Coupleable.h:38
Class for stuff related to variables.
const VectorVariableValue & _vector_zero
Zero value of a vector variable.
Definition: Coupleable.h:1504
const VariableGradient & _grad_zero
Zero gradient of a variable.
Definition: Coupleable.h:1492
std::unordered_map< std::string, std::vector< MooseVariableFieldBase * > > _coupled_vars
Coupled vars whose values we provide.
Definition: Coupleable.h:1409
std::set< TagID > _fe_coupleable_matrix_tags
Definition: Coupleable.h:1801
std::vector< MooseVariableFV< Real > * > _coupled_standard_fv_moose_vars
Vector of standard finite volume coupled variables.
Definition: Coupleable.h:1424
const MooseArray< ADRealVectorValue > & _ad_grad_zero
Definition: Coupleable.h:1493
virtual const VectorVariableValue & coupledVectorDot(const std::string &var_name, unsigned int comp=0) const
Time derivative of a coupled vector variable.
Definition: Coupleable.C:1254
virtual const VariableValue & coupledDotDotDu(const std::string &var_name, unsigned int comp=0) const
Second time derivative of a coupled variable with respect to the coefficients.
Definition: Coupleable.C:1463
void checkWritableVar(MooseWritableVariable *var)
Checks that the passed in variable is only accessed writable by one object in a given subdomain...
Definition: Coupleable.C:952
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
const bool _is_fv
Whether the MooseObject is a finite volume object.
Definition: Coupleable.h:1804
virtual const VariableValue & coupledDofValuesOld(const std::string &var_name, unsigned int comp=0) const
Returns DoFs in the old solution vector of a coupled variable for the local element.
Definition: Coupleable.C:2047
const TagName OLDER_SOLUTION_TAG
Definition: MooseTypes.C:27
std::vector< const GenericVariableValue< is_ad > * > coupledGenericValues(const std::string &var_name) const
Returns the values for all of a coupled variable&#39;s components for use in templated automatic differen...
std::vector< ArrayMooseVariable * > _coupled_array_moose_vars
Vector of array coupled variables.
Definition: Coupleable.h:1421
const ArrayVariableValue & coupledVectorTagArrayDofValue(const std::string &var_name, const std::string &tag_name, unsigned int comp=0) const
Returns evaluations of a tagged vector at the requested variable&#39;s degree of freedom indices...
Definition: Coupleable.C:783
const VariableSecond & _second_zero
Zero second derivative of a variable.
Definition: Coupleable.h:1499
std::vector< const VectorVariableValue * > coupledVectorValuesOld(const std::string &var_name) const
Returns the old values for all of a coupled vector variable&#39;s components.
Definition: Coupleable.C:2703
const T & coupledNodalValue(const std::string &var_name, unsigned int comp=0) const
Returns nodal values of a coupled variable.
Definition: Coupleable.C:1889
std::vector< T > coupledVectorHelper(const std::string &var_name, const Func &func) const
Definition: Coupleable.h:1695
virtual const VariableValue & coupledVectorTagDofValue(const std::string &var_name, TagID tag, unsigned int index=0) const
Returns dof value of a coupled variable for a given tag.
Definition: Coupleable.C:767
OutputTools< RealVectorValue >::VariableValue VectorVariableValue
Definition: MooseTypes.h:331
const ADVariableGradient & adCoupledGradient(const std::string &var_name, unsigned int comp=0) const
Returns gradient of a coupled variable for use in Automatic Differentiation.
Definition: Coupleable.C:2192
VectorVariableDivergence _default_div
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1521
const bool _c_allow_element_to_nodal_coupling
Definition: Coupleable.h:1439
std::vector< const ArrayVariableValue * > coupledVectorTagArrayValues(const std::string &var_names, TagID tag) const
Returns the values for all the coupled variables desired for a given tag.
Definition: Coupleable.C:2574
virtual const ArrayVariableValue & coupledArrayDofValues(const std::string &var_name, unsigned int comp=0) const
Returns DoFs in the current solution vector of a coupled array variable for the local element...
Definition: Coupleable.C:2088
std::vector< const VariableGradient * > coupledVectorTagGradients(const std::string &var_names, TagID tag) const
Returns gradients for all the coupled variables desired for a given tag.
Definition: Coupleable.C:2597
std::set< TagID > _fe_coupleable_vector_tags
Definition: Coupleable.h:1799
This is a wrapper that forwards calls to the implementation, which can be switched out at any time wi...
MooseArray< ADRealVectorValue > _ad_default_curl
This will always be zero because the default values for optionally coupled vector variables is always...
Definition: Coupleable.h:1484
virtual const VariableValue & coupledDot(const std::string &var_name, unsigned int comp=0) const
Time derivative of a coupled variable.
Definition: Coupleable.C:1140
THREAD_ID _c_tid
Thread ID of the thread using this object.
Definition: Coupleable.h:1442
const ADVariableValue & adCoupledValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a coupled variable for use in Automatic Differentiation.
Definition: Coupleable.C:2154
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual const VariableValue & coupledNodalDotDot(const std::string &var_name, unsigned int comp=0) const
Nodal values of second time derivative of a coupled variable.
Definition: Coupleable.C:1979
const ADVariableGradient & getADDefaultGradient() const
Helper method to return (and insert if necessary) the default gradient for Automatic Differentiation ...
Definition: Coupleable.C:2372
const VectorVariableValue * getDefaultVectorValue(const std::string &var_name) const
Helper method to return (and insert if necessary) the default value for an uncoupled vector variable...
Definition: Coupleable.C:362
std::vector< std::set< MooseWritableVariable * > > _writable_coupled_variables
keep a set of allocated writable variable references to make sure only one object can obtain them per...
Definition: Coupleable.h:1813
virtual const VariableGradient & coupledGradientDotDot(const std::string &var_name, unsigned int comp=0) const
Second time derivative of the gradient of a coupled variable.
Definition: Coupleable.C:1594
OutputTools< Real >::VariablePhiValue VariablePhiValue
Definition: MooseTypes.h:319
std::unordered_map< std::string, std::vector< MooseVariableScalar * > > _c_coupled_scalar_vars
Scalar variables coupled into this object (for error checking)
Definition: Coupleable.h:1797
VariableValue _default_value_zero
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1466
MooseVariable * getVar(const std::string &var_name, unsigned int comp)
Extract pointer to a coupled variable.
Definition: Coupleable.C:288
const ADVectorVariableCurl & getADDefaultCurl() const
Helper method to return (and insert if necessary) the default curl value for Automatic Differentiatio...
Definition: Coupleable.C:2393
const GenericVariableGradient< is_ad > & genericZeroGradient()
Returns zero gradient templated with automatic differentiation boolean.
OutputTools< RealVectorValue >::VariableCurl VectorVariableCurl
Definition: MooseTypes.h:334
virtual const ArrayVariableValue & coupledArrayDotOld(const std::string &var_name, unsigned int comp=0) const
Old time derivative of a coupled array variable.
Definition: Coupleable.C:1394
virtual const VariableValue & coupledValueOld(const std::string &var_name, unsigned int comp=0) const
Returns an old value from previous time step of a coupled variable.
Definition: Coupleable.C:1001
This class provides an interface for common operations on field variables of both FE and FV types wit...
virtual const ArrayVariableValue & coupledArrayDot(const std::string &var_name, unsigned int comp=0) const
Time derivative of a coupled array variable.
Definition: Coupleable.C:1350
const GenericVariableValue< is_ad > & coupledGenericDotDot(const std::string &var_name, unsigned int comp=0) const
Returns the second time derivative of a coupled variable for use in templated automatic differentiati...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
virtual const VariableValue & coupledMatrixTagValue(const std::string &var_names, TagID tag, unsigned int index=0) const
Returns value of a coupled variable for a given tag.
Definition: Coupleable.C:791
virtual void coupledCallback(const std::string &, bool) const
A call-back function provided by the derived object for actions before coupling a variable with funct...
Definition: Coupleable.h:135
const ADVariableGradient & adZeroGradient() const
method that returns _grad_zero to RESIDUAL computing objects and _ad_grad_zero to JACOBIAN computing ...
Definition: Coupleable.C:2407
MooseWritableVariable & writableVariable(const std::string &var_name, unsigned int comp=0)
Returns a writable MooseVariable object for a nodal or elemental variable.
Definition: Coupleable.C:878
Base class for a system (of equations)
Definition: SystemBase.h:84
virtual const VectorVariableDivergence & coupledDivOlder(const std::string &var_name, unsigned int comp=0) const
Returns an old divergence from two time steps previous of a coupled variable.
Definition: Coupleable.C:1807
std::unordered_map< std::string, std::unique_ptr< VectorVariableValue > > _default_vector_value
Will hold the default value for optional vector coupled variables.
Definition: Coupleable.h:1453
virtual VariableValue & writableCoupledValue(const std::string &var_name, unsigned int comp=0)
Returns a writable reference to a coupled variable for writing to multiple AuxVariables from a single...
Definition: Coupleable.C:914
std::vector< VariableName > coupledNames(const std::string &var_name) const
Names of the variables in the Coupleable interface.
Definition: Coupleable.C:2501
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual const VariableGradient & coupledGradient(const std::string &var_name, unsigned int comp=0) const
Returns gradient of a coupled variable.
Definition: Coupleable.C:1513
const T * getVarHelper(const std::string &var_name, unsigned int comp) const
Helper that that be used to retrieve a variable of arbitrary type T.
Definition: Coupleable.h:1872
OutputTools< Real >::VariablePhiSecond VariablePhiSecond
Definition: MooseTypes.h:321
const T & coupledNodalValuePreviousNL(const std::string &var_name, unsigned int comp=0) const
Returns nodal values of a coupled variable for previous Newton iterate.
Definition: Coupleable.C:1949
std::vector< const ADVariableValue * > adCoupledValues(const std::string &var_name) const
Returns the values for all of a coupled variable&#39;s components for use in Automatic Differentiation...
Definition: Coupleable.C:2536
virtual const VariableValue & coupledValueOlder(const std::string &var_name, unsigned int comp=0) const
Returns an old value from two time steps previous of a coupled variable.
Definition: Coupleable.C:1023
std::vector< MooseVariable * > _coupled_standard_moose_vars
Vector of standard coupled variables.
Definition: Coupleable.h:1415
const std::vector< MooseVariable * > & getCoupledStandardMooseVars() const
Get the list of standard coupled variables.
Definition: Coupleable.h:79
const ADVariableValue & adCoupledDotDot(const std::string &var_name, unsigned int comp=0) const
Second time derivative of a coupled variable for ad simulations.
Definition: Coupleable.C:2274
const SystemBase *const _c_sys
Pointer to the system object if the moose object this is an interface for has one.
Definition: Coupleable.h:1406
FEProblemBase & _c_fe_problem
Definition: Coupleable.h:1403
virtual const ArrayVariableValue & coupledVectorTagArrayValue(const std::string &var_names, TagID tag, unsigned int index=0) const
Returns value of a coupled array variable for a given tag.
Definition: Coupleable.C:635
const GenericVectorVariableValue< is_ad > & coupledGenericVectorValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a coupled vector variable for use in templated automatic differentiation classes...
virtual const VariableSecond & coupledSecondOlder(const std::string &var_name, unsigned int comp=0) const
Returns an old second derivative from two time steps previous of a coupled variable.
Definition: Coupleable.C:1855
const OutputTools< T >::VariableValue & vectorTagDofValueHelper(const std::string &var_name, TagID tag, unsigned int comp=0) const
Generic helper method to get vector tag degree of freedom values based on tag ID. ...
Definition: Coupleable.C:728
bool _c_is_implicit
True if implicit value is required.
Definition: Coupleable.h:1436
virtual const VariableValue & coupledValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a coupled variable.
Definition: Coupleable.C:497
const ADVariableValue & adCoupledLowerValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a coupled lower-dimensional variable for use in Automatic Differentiation.
Definition: Coupleable.C:2174
virtual const VectorVariableValue & coupledVectorValueOlder(const std::string &var_name, unsigned int comp=0) const
Returns an old value from two time steps previous of a coupled vector variable.
Definition: Coupleable.C:1083
const ADVectorVariableSecond & adCoupledVectorSecond(const std::string &var_name, unsigned int comp=0) const
Returns second derivatives of a coupled vector variable for use in Automatic Differentiation.
std::vector< VectorMooseVariable * > _coupled_vector_moose_vars
Vector of vector coupled variables.
Definition: Coupleable.h:1418
void requestStates(const std::string &var_name, const TagName &tag_name, const unsigned int comp)
Method that may request additional solution states from the variable&#39;s system depending on the value ...
Definition: Coupleable.C:548
virtual const VariableValue & coupledValueLower(const std::string &var_name, unsigned int comp=0) const
Returns value of a coupled lower-dimensional variable.
Definition: Coupleable.C:602
Coupleable(const MooseObject *moose_object, bool nodal, bool is_fv=false)
Constructing the object.
Definition: Coupleable.C:27
virtual const VariableGradient & coupledGradientOld(const std::string &var_name, unsigned int comp=0) const
Returns an old gradient from previous time step of a coupled variable.
Definition: Coupleable.C:1529
std::vector< const VariableValue * > coupledVectorTagDofValues(const std::string &var_names, TagID tag) const
Returns the dof values for all the coupled variables desired for a given tag.
Definition: Coupleable.C:2643
OutputTools< RealEigenVector >::VariableValue ArrayVariableValue
Definition: MooseTypes.h:348
virtual const VariableValue & coupledVectorDotDu(const std::string &var_name, unsigned int comp=0) const
Time derivative of a coupled vector variable with respect to the coefficients.
Definition: Coupleable.C:1318
void addFEVariableCoupleableVectorTag(TagID tag)
Definition: Coupleable.h:102
virtual const VariableSecond & coupledSecondOld(const std::string &var_name, unsigned int comp=0) const
Returns an old second spatial derivatives from previous time step of a coupled variable.
Definition: Coupleable.C:1839
Moose::GenericType< VariableValue, is_ad > GenericVariableValue
Definition: MooseTypes.h:662
auto & getWritableCoupledVariables() const
returns a reference to the set of writable coupled variables
Definition: Coupleable.h:123
const TagName OLD_SOLUTION_TAG
Definition: MooseTypes.C:26
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:28
Moose::GenericType< VariableGradient, is_ad > GenericVariableGradient
Definition: MooseTypes.h:666
virtual const ArrayVariableValue & coupledArrayValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a coupled array variable.
Definition: Coupleable.C:849
const OutputTools< T >::VariableValue & vectorTagValueHelper(const std::string &var_names, TagID tag, unsigned int index=0) const
Generic helper method to get vector tag values based on tag ID.
Definition: Coupleable.C:522
std::vector< const VariableGradient * > coupledGradientsOld(const std::string &var_name) const
Returns the old gradients for all of a coupled variable&#39;s components.
Definition: Coupleable.C:2740
virtual const ArrayVariableGradient & coupledVectorTagArrayGradient(const std::string &var_names, TagID tag, unsigned int index=0) const
Returns gradient of a coupled array variable for a given tag.
Definition: Coupleable.C:689
VariableGradient _default_gradient
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1469
VariableSecond _default_second
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1478
std::unordered_map< std::string, std::unique_ptr< MooseArray< ADReal > > > _ad_default_value
Will hold the default value for optional coupled variables for automatic differentiation.
Definition: Coupleable.h:1449
const VariableValue * getDefaultValue(const std::string &var_name, unsigned int comp) const
Helper method to return (and insert if necessary) the default value for an uncoupled variable...
Definition: Coupleable.C:335
std::vector< const ADVariableValue * > adCoupledDots(const std::string &var_name) const
Returns the time derivatives for all of a coupled variable&#39;s components for ad simulations.
Definition: Coupleable.C:2754
const GenericVariableValue< is_ad > & coupledGenericValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a coupled variable for use in templated automatic differentiation classes...
virtual const VariableGradient & coupledGradientDot(const std::string &var_name, unsigned int comp=0) const
Time derivative of the gradient of a coupled variable.
Definition: Coupleable.C:1578
const ADVariableValue * getADDefaultValue(const std::string &var_name) const
Helper method to return (and insert if necessary) the default value for Automatic Differentiation for...
Definition: Coupleable.C:2341
const ADVariableValue & adCoupledDot(const std::string &var_name, unsigned int comp=0) const
Time derivative of a coupled variable for ad simulations.
Definition: Coupleable.C:2251
const std::string & _c_name
The name of the object this interface is part of.
Definition: Coupleable.h:1398
const GenericVariableValue< is_ad > & coupledGenericDofValue(const std::string &var_name, unsigned int comp=0) const
Returns DOF value of a coupled variable for use in templated automatic differentiation classes...
virtual const VectorVariableCurl & coupledCurlOld(const std::string &var_name, unsigned int comp=0) const
Returns an old curl from previous time step of a coupled variable.
Definition: Coupleable.C:1726
virtual const ADVariableValue & adCoupledDofValues(const std::string &var_name, unsigned int comp=0) const
Returns DOF value of a coupled variable for use in Automatic Differentiation.
Definition: Coupleable.C:2101
virtual const VariableValue & coupledNodalDotDotOld(const std::string &var_name, unsigned int comp=0) const
Nodal values of old second time derivative of a coupled variable.
Definition: Coupleable.C:2011
std::vector< const VariableValue * > coupledAllDofValuesOld(const std::string &var_name) const
Returns DoFs in the old solution vector of all of a coupled variable&#39;s components for the local eleme...
Definition: Coupleable.C:2060
std::vector< const VariableGradient * > coupledGradients(const std::string &var_name) const
Returns the gradients for all of a coupled variable&#39;s components.
Definition: Coupleable.C:2711
std::vector< const VariableValue * > coupledAllDofValuesOlder(const std::string &var_name) const
Returns DoFs in the older solution vector of all of a coupled variable&#39;s components for the local ele...
Definition: Coupleable.C:2080
const std::set< TagID > & getFEVariableCoupleableMatrixTags() const
Definition: Coupleable.h:115
const ADVectorVariableValue & adCoupledVectorDot(const std::string &var_name, unsigned int comp=0) const
Time derivative of a vector coupled variable for ad simulations.
Definition: Coupleable.C:2291
const Moose::Functor< T > & getDefaultFunctor(const std::string &var_name) const
virtual const VariableValue & coupledDofValuesOlder(const std::string &var_name, unsigned int comp=0) const
Returns DoFs in the older solution vector of a coupled variable for the local element.
Definition: Coupleable.C:2067
const VectorVariableCurl & _vector_curl_zero
Zero value of the curl of a vector variable.
Definition: Coupleable.h:1506
const ADVectorVariableGradient & getADDefaultVectorGradient() const
Helper method to return (and insert if necessary) the default gradient for Automatic Differentiation ...
Definition: Coupleable.C:2379
const ADVariableValue & adZeroValue() const
method that returns _zero to RESIDUAL computing objects and _ad_zero to JACOBIAN computing objects ...
Definition: Coupleable.C:2400
std::vector< unsigned int > coupledIndices(const std::string &var_name) const
Returns the indices for a coupled variable&#39;s components.
Definition: Coupleable.C:2477
const T & coupledNodalValueOlder(const std::string &var_name, unsigned int comp=0) const
Returns an old nodal value from two time steps previous of a coupled variable.
Definition: Coupleable.C:1929
const std::vector< MooseVariableFieldBase * > & getCoupledMooseVars() const
Get the list of all coupled variables.
Definition: Coupleable.h:70
const GenericVariableValue< is_ad > & coupledGenericDot(const std::string &var_name, unsigned int comp=0) const
Returns time derivative of a coupled variable for use in templated automatic differentiation classes...
const MooseObject *const _obj
Definition: Coupleable.h:1806
VectorVariableGradient _default_vector_gradient
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1515
std::vector< MooseVariableFieldBase * > _coupled_moose_vars
Vector of all coupled variables.
Definition: Coupleable.h:1412
virtual const VectorVariableCurl & coupledCurl(const std::string &var_name, unsigned int comp=0) const
Returns curl of a coupled variable.
Definition: Coupleable.C:1710
OutputTools< Real >::VariableValue VariableValue
Definition: MooseTypes.h:314
std::set< TagID > & getFEVariableCoupleableMatrixTags()
Definition: Coupleable.h:108
virtual const ArrayVariableGradient & coupledArrayGradient(const std::string &var_name, unsigned int comp=0) const
Returns gradient of a coupled array variable.
Definition: Coupleable.C:1658
virtual const VariableValue & coupledDotDu(const std::string &var_name, unsigned int comp=0) const
Time derivative of a coupled variable with respect to the coefficients.
Definition: Coupleable.C:1438
OutputTools< Real >::VariablePhiGradient VariablePhiGradient
Definition: MooseTypes.h:320
unsigned int coupledComponents(const std::string &var_name) const
Number of coupled components.
Definition: Coupleable.C:158
bool _coupleable_neighbor
Whether or not this object is a "neighbor" object: ie all of it&#39;s coupled values should be neighbor v...
Definition: Coupleable.h:1705
virtual const ArrayVariableGradient & coupledArrayGradientOlder(const std::string &var_name, unsigned int comp=0) const
Returns an old gradient from two time steps previous of a coupled array variable. ...
Definition: Coupleable.C:1684
virtual const VariableValue & coupledVectorDotDotDu(const std::string &var_name, unsigned int comp=0) const
Second time derivative of a coupled vector variable with respect to the coefficients.
Definition: Coupleable.C:1334
std::vector< const ADVariableGradient * > adCoupledGradients(const std::string &var_name) const
Returns the gradients for all of a coupled variable&#39;s components for use in Automatic Differentiation...
Definition: Coupleable.C:2733
Interface for objects that needs coupling capabilities.
Definition: Coupleable.h:45
const GenericVariableSecond< is_ad > & genericZeroSecond()
Returns zero second derivative templated with automatic differentiation boolean.
std::vector< const VariableValue * > coupledValues(const std::string &var_name) const
Returns the values for all of a coupled variable components.
Definition: Coupleable.C:2508
std::vector< const ArrayVariableGradient * > coupledVectorTagArrayGradients(const std::string &var_names, TagID tag) const
Returns gradients for all the coupled variables desired for a given tag.
Definition: Coupleable.C:2620
const T & getDefaultNodalValue(const std::string &var_name, unsigned int comp=0) const
Get nodal default value.
Definition: Coupleable.C:419
const std::string & _c_type
The type of the object this interface is part of.
Definition: Coupleable.h:1400
virtual const VectorVariableGradient & coupledVectorGradientOlder(const std::string &var_name, unsigned int comp=0) const
Returns an old gradient from two time steps previous of a coupled vector variable.
Definition: Coupleable.C:1642
const MooseArray< ADRealTensorValue > & _ad_second_zero
Definition: Coupleable.h:1500
VectorVariableValue _default_vector_value_zero
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1512
bool checkVar(const std::string &var_name, unsigned int comp=0, unsigned int comp_bound=0) const
Check that the right kind of variable is being coupled in.
Definition: Coupleable.C:209
virtual const VariableValue & coupledValuePreviousNL(const std::string &var_name, unsigned int comp=0) const
Returns value of previous Newton iterate of a coupled variable.
Definition: Coupleable.C:1045
MooseArray< ADRealTensorValue > _ad_default_vector_gradient
This will always be zero because the default values for optionally coupled vector variables is always...
Definition: Coupleable.h:1475
virtual const VectorVariableValue & coupledVectorValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a coupled vector variable.
Definition: Coupleable.C:824
const std::set< TagID > & getFEVariableCoupleableVectorTags() const
Definition: Coupleable.h:110
std::string checkForRename(const std::string &name) const
Checks whether the provided name is a renamed parameter name.
virtual const VariableValue & coupledDotDotOld(const std::string &var_name, unsigned int comp=0) const
Old second time derivative of a coupled variable.
Definition: Coupleable.C:1229
MooseArray< ADRealTensorValue > _ad_default_second
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1481
const VariableValue & coupledArrayDotDu(const std::string &var_name, unsigned int comp=0) const
Time derivative of a coupled array variable with respect to the coefficients.
Definition: Coupleable.C:1488
std::vector< const VariableValue * > coupledVectorTagValues(const std::string &var_names, TagID tag) const
Returns the values for all the coupled variables desired for a given tag.
Definition: Coupleable.C:2551
const VariablePhiValue & _phi_zero
Definition: Coupleable.h:1488
ArrayMooseVariable * getArrayVar(const std::string &var_name, unsigned int comp)
Extract pointer to a coupled array variable.
Definition: Coupleable.C:306
virtual const ArrayVariableValue & coupledArrayDotDot(const std::string &var_name, unsigned int comp=0) const
Second time derivative of a coupled array variable.
Definition: Coupleable.C:1372
std::vector< MooseLinearVariableFV< Real > * > _coupled_standard_linear_fv_moose_vars
Vector of standard linear finite volume coupled variables.
Definition: Coupleable.h:1427
Class for scalar variables (they are different).
const ADVectorVariableGradient & adCoupledVectorGradient(const std::string &var_name, unsigned int comp=0) const
Returns gradient of a coupled vector variable for use in Automatic Differentiation.
Definition: Coupleable.C:2325
std::unordered_map< std::string, std::vector< unsigned int > > _optional_var_index
Unique indices for optionally coupled vars that weren&#39;t provided.
Definition: Coupleable.h:1794
const MooseVariableFieldBase * getFEVar(const std::string &var_name, unsigned int comp) const
Deprecated method.
Definition: Coupleable.C:268
std::unordered_map< std::string, std::vector< std::unique_ptr< VariableValue > > > _default_value
Will hold the default value for optional coupled variables.
Definition: Coupleable.h:1446
std::vector< const VariableValue * > coupledMatrixTagValues(const std::string &var_names, TagID tag) const
Returns the diagonal matrix values for all the coupled variables desired for a given tag...
Definition: Coupleable.C:2666
Moose::GenericType< VariableSecond, is_ad > GenericVariableSecond
Definition: MooseTypes.h:668
const InputParameters & _c_parameters
Definition: Coupleable.h:1395
OutputTools< Real >::VariableSecond VariableSecond
Definition: MooseTypes.h:316
const MooseArray< ADReal > & _ad_zero
Definition: Coupleable.h:1489
virtual const ArrayVariableGradient & coupledArrayGradientOld(const std::string &var_name, unsigned int comp=0) const
Returns an old gradient from previous time step of a coupled array variable.
Definition: Coupleable.C:1671
const Moose::ADType< T >::type & adCoupledNodalValue(const std::string &var_name, unsigned int comp=0) const
Returns AD nodal values of a coupled variable.
Definition: Coupleable.C:2132
virtual const VariableValue & coupledNodalDotOld(const std::string &var_name, unsigned int comp=0) const
Nodal values of old time derivative of a coupled variable.
Definition: Coupleable.C:1995
const GenericVariableValue< is_ad > & genericZeroValue()
Returns zero value templated with automatic differentiation boolean.
std::unordered_map< std::string, std::unique_ptr< ArrayVariableValue > > _default_array_value
Will hold the default value for optional array coupled variables.
Definition: Coupleable.h:1456
OutputTools< RealVectorValue >::VariableGradient VectorVariableGradient
Definition: MooseTypes.h:332
ArrayVariableGradient _default_array_gradient
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1530
const ADVariableSecond & getADDefaultSecond() const
Helper method to return (and insert if necessary) the default second derivatives for Automatic Differ...
Definition: Coupleable.C:2386
const std::set< std::string > _older_state_tags
vector tag names for which we need to request older solution states from the system ...
Definition: Coupleable.h:1809
virtual const VectorVariableCurl & coupledCurlOlder(const std::string &var_name, unsigned int comp=0) const
Returns an old curl from two time steps previous of a coupled variable.
Definition: Coupleable.C:1742
virtual const VectorVariableDivergence & coupledDiv(const std::string &var_name, unsigned int comp=0) const
Returns divergence of a coupled variable.
Definition: Coupleable.C:1775
virtual const VariableGradient & coupledGradientPreviousNL(const std::string &var_name, unsigned int comp=0) const
Returns gradient of a coupled variable for previous Newton iterate.
Definition: Coupleable.C:1561
ArrayVariableValue _default_array_value_zero
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1527
unsigned int _coupleable_max_qps
Maximum qps for any element in this system.
Definition: Coupleable.h:1791
OutputTools< RealEigenVector >::VariableGradient ArrayVariableGradient
Definition: MooseTypes.h:349
void addFEVariableCoupleableMatrixTag(TagID tag)
Definition: Coupleable.h:104
std::vector< const ADVectorVariableValue * > adCoupledVectorValues(const std::string &var_name) const
Returns the values for all of a coupled vector variable&#39;s components for use in Automatic Differentia...
Definition: Coupleable.C:2543
std::vector< const VectorVariableValue * > coupledVectorValues(const std::string &var_name) const
Returns the values for all of a coupled vector variable&#39;s components.
Definition: Coupleable.C:2515
virtual const VariableValue & coupledDotDot(const std::string &var_name, unsigned int comp=0) const
Second time derivative of a coupled variable.
Definition: Coupleable.C:1165
virtual const ArrayVariableGradient & coupledArrayGradientDot(const std::string &var_name, unsigned int comp=0) const
Retun a gradient of a coupled array variable&#39;s time derivative.
Definition: Coupleable.C:1697
std::vector< const GenericVariableGradient< is_ad > * > coupledGenericGradients(const std::string &var_name) const
Returns the gradients for all of a coupled variable&#39;s components for use in templated automatic diffe...
const std::unordered_map< std::string, std::vector< MooseVariableFieldBase * > > & getCoupledVars() const
Get the list of coupled variables.
Definition: Coupleable.h:61
std::set< TagID > & getFEVariableCoupleableVectorTags()
Definition: Coupleable.h:106
virtual const VectorVariableValue & coupledVectorDotOld(const std::string &var_name, unsigned int comp=0) const
Old time derivative of a coupled vector variable.
Definition: Coupleable.C:1286
const ADVariableGradient & adCoupledGradientDot(const std::string &var_name, unsigned int comp=0) const
Returns gradient of a coupled variable&#39;s time derivative for use in Automatic Differentiation.
Definition: Coupleable.C:2209
const ADVariableSecond & adCoupledSecond(const std::string &var_name, unsigned int comp=0) const
Returns second derivatives of a coupled variable for use in Automatic Differentiation.
Definition: Coupleable.C:2226
bool hasWritableCoupledVariables() const
Checks whether the object has any writable coupled variables.
Definition: Coupleable.h:128
virtual const VectorVariableValue & coupledVectorDotDotOld(const std::string &var_name, unsigned int comp=0) const
Old second time derivative of a coupled vector variable.
Definition: Coupleable.C:1302
const ADVectorVariableCurl & adCoupledCurl(const std::string &var_name, unsigned int comp=0) const
Returns curl of a coupled variable for use in objects utilizing Automatic Differentiation.
Definition: Coupleable.C:1758
const ADVectorVariableValue & adCoupledVectorValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a coupled vector variable for use in Automatic Differentiation.
Definition: Coupleable.C:2307
const T & coupledNodalValueOld(const std::string &var_name, unsigned int comp=0) const
Returns an old nodal value from previous time step of a coupled variable.
Definition: Coupleable.C:1909
MooseArray< ADRealVectorValue > _ad_default_gradient
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1472
std::vector< const VariableValue * > coupledValuesOld(const std::string &var_name) const
Returns the old values for all of a coupled variable&#39;s components.
Definition: Coupleable.C:2689
virtual const VariableGradient & coupledGradientOlder(const std::string &var_name, unsigned int comp=0) const
Returns an old gradient from two time steps previous of a coupled variable.
Definition: Coupleable.C:1545
unsigned int THREAD_ID
Definition: MooseTypes.h:209
const std::unordered_map< std::string, std::string > & _new_to_deprecated_coupled_vars
map from new to deprecated variable names
Definition: Coupleable.h:1430
std::vector< const VariableValue * > coupledAllDofValues(const std::string &var_name) const
Returns DoFs in the current solution vector of all of a coupled variable&#39;s components for the local e...
Definition: Coupleable.C:2040
const MooseVariableFieldBase * getFieldVar(const std::string &var_name, unsigned int comp) const
Definition: Coupleable.C:282
virtual const VectorVariableDivergence & coupledDivOld(const std::string &var_name, unsigned int comp=0) const
Returns an old divergence from previous time step of a coupled variable.
Definition: Coupleable.C:1791