www.mooseframework.org
Coupleable.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include <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 
230  template <bool is_ad>
231  std::vector<const GenericVariableValue<is_ad> *>
232  coupledGenericValues(const std::string & var_name) const;
233 
240  template <bool is_ad>
241  const GenericVariableValue<is_ad> & coupledGenericDofValue(const std::string & var_name,
242  unsigned int comp = 0) const;
243 
250  virtual const VariableValue & coupledValueLower(const std::string & var_name,
251  unsigned int comp = 0) const;
252 
259  const ADVariableValue & adCoupledValue(const std::string & var_name, unsigned int comp = 0) const;
260 
267  std::vector<const ADVariableValue *> adCoupledValues(const std::string & var_name) const;
268 
275  const ADVariableValue & adCoupledLowerValue(const std::string & var_name,
276  unsigned int comp = 0) const;
277 
285  const ADVectorVariableValue & adCoupledVectorValue(const std::string & var_name,
286  unsigned int comp = 0) const;
287 
294  std::vector<const ADVectorVariableValue *>
295  adCoupledVectorValues(const std::string & var_name) const;
296 
305  virtual const VariableValue &
306  coupledVectorTagValue(const std::string & var_names, TagID tag, unsigned int index = 0) const;
307 
308  virtual const VariableValue & coupledVectorTagValue(const std::string & var_names,
309  const std::string & tag_name,
310  unsigned int index = 0) const;
311 
318  std::vector<const VariableValue *> coupledVectorTagValues(const std::string & var_names,
319  TagID tag) const;
320 
321  std::vector<const VariableValue *> coupledVectorTagValues(const std::string & var_names,
322  const std::string & tag_name) const;
323 
332  virtual const ArrayVariableValue & coupledVectorTagArrayValue(const std::string & var_names,
333  TagID tag,
334  unsigned int index = 0) const;
335 
336  virtual const ArrayVariableValue & coupledVectorTagArrayValue(const std::string & var_names,
337  const std::string & tag_name,
338  unsigned int index = 0) const;
339 
346  std::vector<const ArrayVariableValue *> coupledVectorTagArrayValues(const std::string & var_names,
347  TagID tag) const;
348 
349  std::vector<const ArrayVariableValue *>
350  coupledVectorTagArrayValues(const std::string & var_names, const std::string & tag_name) const;
351 
360  virtual const VariableGradient &
361  coupledVectorTagGradient(const std::string & var_names, TagID tag, unsigned int index = 0) const;
362 
363  virtual const VariableGradient & coupledVectorTagGradient(const std::string & var_names,
364  const std::string & tag_name,
365  unsigned int index = 0) const;
366 
373  std::vector<const VariableGradient *> coupledVectorTagGradients(const std::string & var_names,
374  TagID tag) const;
375 
376  std::vector<const VariableGradient *>
377  coupledVectorTagGradients(const std::string & var_names, const std::string & tag_name) const;
378 
388  virtual const ArrayVariableGradient & coupledVectorTagArrayGradient(const std::string & var_names,
389  TagID tag,
390  unsigned int index = 0) const;
391 
392  virtual const ArrayVariableGradient & coupledVectorTagArrayGradient(const std::string & var_names,
393  const std::string & tag_name,
394  unsigned int index = 0) const;
395 
402  std::vector<const ArrayVariableGradient *>
403  coupledVectorTagArrayGradients(const std::string & var_names, TagID tag) const;
404 
405  std::vector<const ArrayVariableGradient *>
406  coupledVectorTagArrayGradients(const std::string & var_names, const std::string & tag_name) const;
407 
415  virtual const VariableValue &
416  coupledVectorTagDofValue(const std::string & var_name, TagID tag, unsigned int index = 0) const;
417 
418  virtual const VariableValue & coupledVectorTagDofValue(const std::string & var_names,
419  const std::string & tag_name,
420  unsigned int index = 0) const;
421 
428  const ArrayVariableValue & coupledVectorTagArrayDofValue(const std::string & var_name,
429  const std::string & tag_name,
430  unsigned int comp = 0) const;
431 
438  std::vector<const VariableValue *> coupledVectorTagDofValues(const std::string & var_names,
439  TagID tag) const;
440 
441  std::vector<const VariableValue *> coupledVectorTagDofValues(const std::string & var_names,
442  const std::string & tag_name) const;
443 
452  virtual const VariableValue &
453  coupledMatrixTagValue(const std::string & var_names, TagID tag, unsigned int index = 0) const;
454 
455  virtual const VariableValue & coupledMatrixTagValue(const std::string & var_names,
456  const std::string & tag_name,
457  unsigned int index = 0) const;
458 
465  std::vector<const VariableValue *> coupledMatrixTagValues(const std::string & var_names,
466  TagID tag) const;
467 
468  std::vector<const VariableValue *> coupledMatrixTagValues(const std::string & var_names,
469  const std::string & tag_name) const;
470 
478  virtual const VectorVariableValue & coupledVectorValue(const std::string & var_name,
479  unsigned int comp = 0) const;
480 
488  virtual const ArrayVariableValue & coupledArrayValue(const std::string & var_name,
489  unsigned int comp = 0) const;
490 
496  std::vector<const ArrayVariableValue *> coupledArrayValues(const std::string & var_name) const;
497 
510  MooseWritableVariable & writableVariable(const std::string & var_name, unsigned int comp = 0);
511 
521  virtual VariableValue & writableCoupledValue(const std::string & var_name, unsigned int comp = 0);
522 
527 
535  virtual const VariableValue & coupledValueOld(const std::string & var_name,
536  unsigned int comp = 0) const;
537 
543  std::vector<const VariableValue *> coupledValuesOld(const std::string & var_name) const;
544 
552  virtual const VariableValue & coupledValueOlder(const std::string & var_name,
553  unsigned int comp = 0) const;
554 
560  std::vector<const VariableValue *> coupledValuesOlder(const std::string & var_name) const;
561 
568  virtual const VariableValue & coupledValuePreviousNL(const std::string & var_name,
569  unsigned int comp = 0) const;
570 
578  virtual const VectorVariableValue & coupledVectorValueOld(const std::string & var_name,
579  unsigned int comp = 0) const;
580 
588  virtual const VectorVariableValue & coupledVectorValueOlder(const std::string & var_name,
589  unsigned int comp = 0) const;
590 
598  virtual const ArrayVariableValue & coupledArrayValueOld(const std::string & var_name,
599  unsigned int comp = 0) const;
600 
608  virtual const ArrayVariableValue & coupledArrayValueOlder(const std::string & var_name,
609  unsigned int comp = 0) const;
610 
618  virtual const VariableGradient & coupledGradient(const std::string & var_name,
619  unsigned int comp = 0) const;
620 
626  std::vector<const VariableGradient *> coupledGradients(const std::string & var_name) const;
627 
635  const ADVariableGradient & adCoupledGradient(const std::string & var_name,
636  unsigned int comp = 0) const;
637 
645  const ADVariableGradient & adCoupledGradientDot(const std::string & var_name,
646  unsigned int comp = 0) const;
647 
654  std::vector<const ADVariableGradient *> adCoupledGradients(const std::string & var_name) const;
655 
663  template <bool is_ad>
664  const GenericVariableGradient<is_ad> & coupledGenericGradient(const std::string & var_name,
665  unsigned int comp = 0) const;
666 
673  template <bool is_ad>
674  std::vector<const GenericVariableGradient<is_ad> *>
675  coupledGenericGradients(const std::string & var_name) const;
676 
684  const ADVectorVariableGradient & adCoupledVectorGradient(const std::string & var_name,
685  unsigned int comp = 0) const;
686 
693  const ADVariableSecond & adCoupledSecond(const std::string & var_name,
694  unsigned int comp = 0) const;
695 
703  const ADVectorVariableSecond & adCoupledVectorSecond(const std::string & var_name,
704  unsigned int comp = 0) const;
705 
713  virtual const VariableGradient & coupledGradientOld(const std::string & var_name,
714  unsigned int comp = 0) const;
715 
721  std::vector<const VariableGradient *> coupledGradientsOld(const std::string & var_name) const;
722 
730  virtual const VariableGradient & coupledGradientOlder(const std::string & var_name,
731  unsigned int comp = 0) const;
732 
739  virtual const VariableGradient & coupledGradientPreviousNL(const std::string & var_name,
740  unsigned int comp = 0) const;
741 
749  virtual const VariableGradient & coupledGradientDot(const std::string & var_name,
750  unsigned int comp = 0) const;
751 
759  virtual const VariableGradient & coupledGradientDotDot(const std::string & var_name,
760  unsigned int comp = 0) const;
761 
769  virtual const VectorVariableGradient & coupledVectorGradient(const std::string & var_name,
770  unsigned int comp = 0) const;
771 
779  virtual const VectorVariableGradient & coupledVectorGradientOld(const std::string & var_name,
780  unsigned int comp = 0) const;
781 
789  virtual const VectorVariableGradient & coupledVectorGradientOlder(const std::string & var_name,
790  unsigned int comp = 0) const;
791 
799  virtual const ArrayVariableGradient & coupledArrayGradient(const std::string & var_name,
800  unsigned int comp = 0) const;
801 
809  virtual const ArrayVariableGradient & coupledArrayGradientOld(const std::string & var_name,
810  unsigned int comp = 0) const;
811 
819  virtual const ArrayVariableGradient & coupledArrayGradientOlder(const std::string & var_name,
820  unsigned int comp = 0) const;
821 
829  virtual const ArrayVariableGradient & coupledArrayGradientDot(const std::string & var_name,
830  unsigned int comp = 0) const;
831 
839  virtual const VectorVariableCurl & coupledCurl(const std::string & var_name,
840  unsigned int comp = 0) const;
841 
849  virtual const VectorVariableCurl & coupledCurlOld(const std::string & var_name,
850  unsigned int comp = 0) const;
851 
859  virtual const VectorVariableCurl & coupledCurlOlder(const std::string & var_name,
860  unsigned int comp = 0) const;
861 
870  virtual const VectorVariableDivergence & coupledDiv(const std::string & var_name,
871  unsigned int comp = 0) const;
872 
881  virtual const VectorVariableDivergence & coupledDivOld(const std::string & var_name,
882  unsigned int comp = 0) const;
883 
892  virtual const VectorVariableDivergence & coupledDivOlder(const std::string & var_name,
893  unsigned int comp = 0) const;
894 
902  virtual const VariableSecond & coupledSecond(const std::string & var_name,
903  unsigned int comp = 0) const;
904 
913  virtual const VariableSecond & coupledSecondOld(const std::string & var_name,
914  unsigned int comp = 0) const;
915 
924  virtual const VariableSecond & coupledSecondOlder(const std::string & var_name,
925  unsigned int comp = 0) const;
926 
933  virtual const VariableSecond & coupledSecondPreviousNL(const std::string & var_name,
934  unsigned int comp = 0) const;
935 
942  virtual const VariableValue & coupledDot(const std::string & var_name,
943  unsigned int comp = 0) const;
944 
950  std::vector<const VariableValue *> coupledDots(const std::string & var_name) const;
951 
959  virtual const VariableValue & coupledDotDot(const std::string & var_name,
960  unsigned int comp = 0) const;
961 
968  virtual const VariableValue & coupledDotOld(const std::string & var_name,
969  unsigned int comp = 0) const;
970 
978  virtual const VariableValue & coupledDotDotOld(const std::string & var_name,
979  unsigned int comp = 0) const;
980 
988  const ADVariableValue & adCoupledDot(const std::string & var_name, unsigned int comp = 0) const;
989 
995  std::vector<const ADVariableValue *> adCoupledDots(const std::string & var_name) const;
996 
1004  const ADVariableValue & adCoupledDotDot(const std::string & var_name,
1005  unsigned int comp = 0) const;
1006 
1015  const ADVectorVariableValue & adCoupledVectorDot(const std::string & var_name,
1016  unsigned int comp = 0) const;
1017 
1025  virtual const VectorVariableValue & coupledVectorDot(const std::string & var_name,
1026  unsigned int comp = 0) const;
1027 
1035  virtual const VectorVariableValue & coupledVectorDotDot(const std::string & var_name,
1036  unsigned int comp = 0) const;
1037 
1045  virtual const VectorVariableValue & coupledVectorDotOld(const std::string & var_name,
1046  unsigned int comp = 0) const;
1047 
1055  virtual const VectorVariableValue & coupledVectorDotDotOld(const std::string & var_name,
1056  unsigned int comp = 0) const;
1057 
1065  virtual const VariableValue & coupledVectorDotDu(const std::string & var_name,
1066  unsigned int comp = 0) const;
1067 
1075  virtual const VariableValue & coupledVectorDotDotDu(const std::string & var_name,
1076  unsigned int comp = 0) const;
1077 
1085  virtual const ArrayVariableValue & coupledArrayDot(const std::string & var_name,
1086  unsigned int comp = 0) const;
1087 
1095  virtual const ArrayVariableValue & coupledArrayDotDot(const std::string & var_name,
1096  unsigned int comp = 0) const;
1097 
1105  virtual const ArrayVariableValue & coupledArrayDotOld(const std::string & var_name,
1106  unsigned int comp = 0) const;
1107 
1115  virtual const ArrayVariableValue & coupledArrayDotDotOld(const std::string & var_name,
1116  unsigned int comp = 0) const;
1117 
1125  virtual const VariableValue & coupledDotDu(const std::string & var_name,
1126  unsigned int comp = 0) const;
1127 
1135  virtual const VariableValue & coupledDotDotDu(const std::string & var_name,
1136  unsigned int comp = 0) const;
1137 
1145  const VariableValue & coupledArrayDotDu(const std::string & var_name,
1146  unsigned int comp = 0) const;
1147 
1154  template <typename T>
1155  const T & coupledNodalValue(const std::string & var_name, unsigned int comp = 0) const;
1156 
1163  template <typename T>
1164  const typename Moose::ADType<T>::type & adCoupledNodalValue(const std::string & var_name,
1165  unsigned int comp = 0) const;
1166 
1173  template <typename T>
1174  const T & coupledNodalValueOld(const std::string & var_name, unsigned int comp = 0) const;
1175 
1182  template <typename T>
1183  const T & coupledNodalValueOlder(const std::string & var_name, unsigned int comp = 0) const;
1184 
1191  template <typename T>
1192  const T & coupledNodalValuePreviousNL(const std::string & var_name, unsigned int comp = 0) const;
1193 
1201  template <typename T>
1202  const T & coupledNodalDot(const std::string & var_name, unsigned int comp = 0) const;
1203 
1211  virtual const VariableValue & coupledNodalDotDot(const std::string & var_name,
1212  unsigned int comp = 0) const;
1213 
1221  virtual const VariableValue & coupledNodalDotOld(const std::string & var_name,
1222  unsigned int comp = 0) const;
1223 
1231  virtual const VariableValue & coupledNodalDotDotOld(const std::string & var_name,
1232  unsigned int comp = 0) const;
1233  // coupled-dof-values-begin
1240  virtual const VariableValue & coupledDofValues(const std::string & var_name,
1241  unsigned int comp = 0) const;
1242 
1249  std::vector<const VariableValue *> coupledAllDofValues(const std::string & var_name) const;
1250 
1257  virtual const VariableValue & coupledDofValuesOld(const std::string & var_name,
1258  unsigned int comp = 0) const;
1259 
1266  std::vector<const VariableValue *> coupledAllDofValuesOld(const std::string & var_name) const;
1267 
1274  virtual const VariableValue & coupledDofValuesOlder(const std::string & var_name,
1275  unsigned int comp = 0) const;
1276 
1283  std::vector<const VariableValue *> coupledAllDofValuesOlder(const std::string & var_name) const;
1284 
1291  virtual const ArrayVariableValue & coupledArrayDofValues(const std::string & var_name,
1292  unsigned int comp = 0) const;
1293  // coupled-dof-values-end
1294 
1301  virtual const ADVariableValue & adCoupledDofValues(const std::string & var_name,
1302  unsigned int comp = 0) const;
1303 
1308  const ADVariableValue & adZeroValue() const;
1309 
1314  const ADVariableGradient & adZeroGradient() const;
1315 
1319  const ADVariableSecond & adZeroSecond() const;
1320 
1325  template <bool is_ad>
1327 
1332  template <bool is_ad>
1334 
1339  template <bool is_ad>
1341 
1342 protected:
1343  // Reference to the interface's input parameters
1345 
1347  const std::string & _c_name;
1349  const std::string & _c_type;
1350 
1351  // Reference to FEProblemBase
1353 
1355  const SystemBase * const _c_sys;
1356 
1358  std::unordered_map<std::string, std::vector<MooseVariableFieldBase *>> _coupled_vars;
1359 
1361  std::vector<MooseVariableFieldBase *> _coupled_moose_vars;
1362 
1364  std::vector<MooseVariable *> _coupled_standard_moose_vars;
1365 
1367  std::vector<VectorMooseVariable *> _coupled_vector_moose_vars;
1368 
1370  std::vector<ArrayMooseVariable *> _coupled_array_moose_vars;
1371 
1373  std::vector<MooseVariableFV<Real> *> _coupled_standard_fv_moose_vars;
1374 
1376  std::vector<MooseLinearVariableFV<Real> *> _coupled_standard_linear_fv_moose_vars;
1377 
1379  const std::unordered_map<std::string, std::string> & _new_to_deprecated_coupled_vars;
1380 
1382  bool _c_nodal;
1383 
1386 
1387  // Argument to allow element-to-nodal coupling
1389 
1392 
1394  mutable std::unordered_map<std::string, std::vector<std::unique_ptr<VariableValue>>>
1396 
1398  mutable std::unordered_map<std::string, std::unique_ptr<MooseArray<DualReal>>> _ad_default_value;
1399 
1401  mutable std::unordered_map<std::string, std::unique_ptr<VectorVariableValue>>
1403 
1405  mutable std::unordered_map<std::string, std::unique_ptr<ArrayVariableValue>> _default_array_value;
1406 
1408  mutable std::unordered_map<std::string, std::unique_ptr<MooseArray<ADRealVectorValue>>>
1410 
1416 
1419 
1422 
1425 
1428 
1431 
1436 
1440 
1443 
1453 
1459 
1462 
1465 
1468 
1474 
1477 
1483  bool
1484  checkVar(const std::string & var_name, unsigned int comp = 0, unsigned int comp_bound = 0) const;
1485 
1486 private:
1490  template <typename T>
1491  const typename OutputTools<T>::VariableValue &
1492  vectorTagValueHelper(const std::string & var_names, TagID tag, unsigned int index = 0) const;
1493 
1497  template <typename T>
1498  const typename OutputTools<T>::VariableValue & vectorTagValueHelper(const std::string & var_names,
1499  const std::string & tag_name,
1500  unsigned int index = 0) const;
1501 
1505  template <typename T>
1506  const typename OutputTools<T>::VariableValue &
1507  vectorTagDofValueHelper(const std::string & var_name, TagID tag, unsigned int comp = 0) const;
1508 
1512  template <typename T>
1514  const std::string & var_name, const std::string & tag_name, unsigned int comp = 0) const;
1515 
1521  template <typename T>
1522  void
1523  requestStates(const std::string & var_name, const TagName & tag_name, const unsigned int comp);
1524 
1525  enum class FuncAge
1526  {
1527  Curr,
1528  Old,
1529  Older,
1530  };
1531 
1532  enum class VarType
1533  {
1534  Ignore,
1535  Gradient,
1536  Second,
1537  GradientDot,
1538  Dot,
1539  };
1540 
1541  void checkFuncType(const std::string var_name, VarType t, FuncAge age) const;
1542 
1543 protected:
1552  const MooseVariableFieldBase * getFEVar(const std::string & var_name, unsigned int comp) const;
1553 
1554  /*
1555  * Extract pointer to a base coupled field variable. Could be either a finite volume or finite
1556  * element variable
1557  * @param var_name Name of parameter desired
1558  * @param comp Component number of multiple coupled variables
1559  * @return Pointer to the desired variable
1560  */
1561  const MooseVariableFieldBase * getFieldVar(const std::string & var_name, unsigned int comp) const;
1562 
1563  /*
1564  * Extract pointer to a base coupled field variable. Could be either a finite volume or finite
1565  * element variable
1566  * @param var_name Name of variable desired
1567  * @param comp Component number of multiple coupled variables
1568  * @return Pointer to the desired variable
1569  */
1570  MooseVariableFieldBase * getFieldVar(const std::string & var_name, unsigned int comp);
1571 
1575  template <typename T>
1576  const T * getVarHelper(const std::string & var_name, unsigned int comp) const;
1577 
1581  template <typename T>
1582  T * getVarHelper(const std::string & var_name, unsigned int comp);
1583 
1590  MooseVariable * getVar(const std::string & var_name, unsigned int comp);
1591 
1598  VectorMooseVariable * getVectorVar(const std::string & var_name, unsigned int comp);
1599 
1606  ArrayMooseVariable * getArrayVar(const std::string & var_name, unsigned int comp);
1607 
1614  const MooseVariable * getVar(const std::string & var_name, unsigned int comp) const;
1615 
1622  const VectorMooseVariable * getVectorVar(const std::string & var_name, unsigned int comp) const;
1623 
1630  const ArrayMooseVariable * getArrayVar(const std::string & var_name, unsigned int comp) const;
1631 
1638  void validateExecutionerType(const std::string & name, const std::string & fn_name) const;
1639 
1640  template <typename T, typename Func>
1641  std::vector<T> coupledVectorHelper(const std::string & var_name, const Func & func) const
1642  {
1643  const auto components = coupledComponents(var_name);
1644  std::vector<T> vals(components);
1645  for (MooseIndex(components) comp = 0; comp < components; ++comp)
1646  vals[comp] = func(comp);
1647  return vals;
1648  }
1649 
1652 
1653 public:
1660  const ADVariableValue * getADDefaultValue(const std::string & var_name) const;
1661 
1668  const ADVectorVariableValue * getADDefaultVectorValue(const std::string & var_name) const;
1669 
1676  const ADVariableGradient & getADDefaultGradient() const;
1677 
1685 
1692  const ADVariableSecond & getADDefaultSecond() const;
1693 
1694 private:
1701  const VariableValue * getDefaultValue(const std::string & var_name, unsigned int comp) const;
1702 
1709  const VectorVariableValue * getDefaultVectorValue(const std::string & var_name) const;
1710 
1717  const ArrayVariableValue * getDefaultArrayValue(const std::string & var_name) const;
1718 
1722  template <typename T>
1723  const T & getDefaultNodalValue(const std::string & var_name, unsigned int comp = 0) const;
1724 
1725  template <typename T>
1726  const Moose::Functor<T> & getDefaultFunctor(const std::string & var_name) const;
1727 
1729  unsigned int _coupleable_max_qps;
1730 
1732  std::unordered_map<std::string, std::vector<unsigned int>> _optional_var_index;
1733 
1735  std::unordered_map<std::string, std::vector<MooseVariableScalar *>> _c_coupled_scalar_vars;
1736 
1738 
1740 
1742  const bool _is_fv;
1743 
1744  const MooseObject * const _obj;
1745 
1747  const std::set<std::string> _older_state_tags = {Moose::OLD_SOLUTION_TAG,
1749 
1751  std::vector<std::set<MooseWritableVariable *>> _writable_coupled_variables;
1752 };
1753 
1754 template <typename T>
1755 T *
1756 Coupleable::getVarHelper(const std::string & var_name_in, unsigned int comp)
1757 {
1758  const auto var_name = _c_parameters.checkForRename(var_name_in);
1759  auto name_to_use = var_name;
1760 
1761  // First check for supplied name
1762  if (!checkVar(var_name, comp, 0))
1763  {
1764  // See if there is an associated deprecated name that the user may have used instead
1765  auto it = _new_to_deprecated_coupled_vars.find(var_name);
1766  if (it == _new_to_deprecated_coupled_vars.end())
1767  return nullptr;
1768  else
1769  {
1770  auto deprecated_name = it->second;
1771  if (checkVar(deprecated_name, comp, 0))
1772  name_to_use = deprecated_name;
1773  else
1774  return nullptr;
1775  }
1776  }
1777 
1778  auto coupled_vars_it = _coupled_vars.find(name_to_use);
1779 
1780  mooseAssert(coupled_vars_it != _coupled_vars.end(),
1781  "Trying to get a coupled var " << name_to_use << " that doesn't exist");
1782 
1783  if (auto coupled_var = dynamic_cast<T *>(coupled_vars_it->second[comp]))
1784  return coupled_var;
1785  else
1786  {
1787  for (auto & var : _coupled_standard_moose_vars)
1788  if (var->name() == name_to_use)
1789  mooseError("The named variable is a standard variable, try a "
1790  "'coupled[Value/Gradient/Dot/etc]...' function instead");
1791  for (auto & var : _coupled_vector_moose_vars)
1792  if (var->name() == name_to_use)
1793  mooseError("The named variable is a vector variable, try a "
1794  "'coupledVector[Value/Gradient/Dot/etc]...' function instead");
1795  for (auto & var : _coupled_array_moose_vars)
1796  if (var->name() == name_to_use)
1797  mooseError("The named variable is an array variable, try a "
1798  "'coupledArray[Value/Gradient/Dot/etc]...' function instead");
1799  for (auto & var : _coupled_standard_fv_moose_vars)
1800  if (var->name() == name_to_use)
1801  mooseError("The named variable is a finite volume variable, which the coupled[...] routine "
1802  "used does not support. Try using the functor system routines instead.");
1803  mooseError(
1804  "Variable '", name_to_use, "' is of a different C++ type than you tried to fetch it as.");
1805  }
1806 }
1807 
1808 template <typename T>
1809 const T *
1810 Coupleable::getVarHelper(const std::string & var_name, unsigned int comp) const
1811 {
1812  return const_cast<Coupleable *>(this)->getVarHelper<T>(var_name, comp);
1813 }
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:1384
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:1978
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:604
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:636
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:1100
OutputTools< Real >::VariableGradient VariableGradient
Definition: MooseTypes.h:303
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:1916
OutputTools< RealVectorValue >::VariableDivergence VectorVariableDivergence
Definition: MooseTypes.h:323
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:2069
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:128
virtual const VectorVariableGradient & coupledVectorGradient(const std::string &var_name, unsigned int comp=0) const
Returns gradient of a coupled vector variable.
Definition: Coupleable.C:1578
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:1382
void checkFuncType(const std::string var_name, VarType t, FuncAge age) const
Definition: Coupleable.C:191
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:1464
VectorMooseVariable * getVectorVar(const std::string &var_name, unsigned int comp)
Extract pointer to a coupled vector variable.
Definition: Coupleable.C:293
const VariableValue & _zero
Zero value of a variable.
Definition: Coupleable.h:1433
const VariablePhiGradient & _grad_phi_zero
Zero gradient of trial function.
Definition: Coupleable.h:1442
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:441
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:1238
const VariablePhiSecond & _second_phi_zero
Zero second derivative of a test function.
Definition: Coupleable.h:1448
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:1822
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:1409
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:396
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:2634
const ADVariableSecond & adZeroSecond() const
Retrieve a zero second for automatic differentiation.
Definition: Coupleable.C:2352
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:2300
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:1774
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:151
virtual const VariableValue & coupledDotOld(const std::string &var_name, unsigned int comp=0) const
Old time derivative of a coupled variable.
Definition: Coupleable.C:1172
typename Moose::GenericType< VariableValue, is_ad > GenericVariableValue
Definition: MooseTypes.h:573
typename Moose::GenericType< VariableSecond, is_ad > GenericVariableSecond
Definition: MooseTypes.h:577
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:1052
Class for stuff related to variables.
Definition: Adaptivity.h:31
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:856
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:2677
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:1078
unsigned int TagID
Definition: MooseTypes.h:199
VariableName coupledName(const std::string &var_name, unsigned int comp=0) const
Names of the variable in the Coupleable interface.
Definition: Coupleable.C:2422
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:1594
MooseVariableField< Real > MooseWritableVariable
Definition: Coupleable.h:38
Class for stuff related to variables.
Definition: Coupleable.h:38
const VectorVariableValue & _vector_zero
Zero value of a vector variable.
Definition: Coupleable.h:1450
const VariableGradient & _grad_zero
Zero gradient of a variable.
Definition: Coupleable.h:1438
std::unordered_map< std::string, std::vector< MooseVariableFieldBase * > > _coupled_vars
Coupled vars whose values we provide.
Definition: Coupleable.h:1358
std::set< TagID > _fe_coupleable_matrix_tags
Definition: Coupleable.h:1739
std::vector< MooseVariableFV< Real > * > _coupled_standard_fv_moose_vars
Vector of standard finite volume coupled variables.
Definition: Coupleable.h:1373
const MooseArray< ADRealVectorValue > & _ad_grad_zero
Definition: Coupleable.h:1439
virtual const VectorVariableValue & coupledVectorDot(const std::string &var_name, unsigned int comp=0) const
Time derivative of a coupled vector variable.
Definition: Coupleable.C:1222
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:1431
void checkWritableVar(MooseWritableVariable *var)
Checks that the passed in variable is only accessed writable by one object in a given subdomain...
Definition: Coupleable.C:936
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
const bool _is_fv
Whether the MooseObject is a finite volume object.
Definition: Coupleable.h:1742
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:1998
const TagName OLDER_SOLUTION_TAG
Definition: MooseTypes.C:29
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:1370
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:768
const VariableSecond & _second_zero
Zero second derivative of a variable.
Definition: Coupleable.h:1445
const T & coupledNodalValue(const std::string &var_name, unsigned int comp=0) const
Returns nodal values of a coupled variable.
Definition: Coupleable.C:1840
std::vector< T > coupledVectorHelper(const std::string &var_name, const Func &func) const
Definition: Coupleable.h:1641
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:752
OutputTools< RealVectorValue >::VariableValue VectorVariableValue
Definition: MooseTypes.h:319
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:2143
VectorVariableDivergence _default_div
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1467
const bool _c_allow_element_to_nodal_coupling
Definition: Coupleable.h:1388
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:2512
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:2039
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:2535
std::set< TagID > _fe_coupleable_vector_tags
Definition: Coupleable.h:1737
This is a wrapper that forwards calls to the implementation, which can be switched out at any time wi...
virtual const VariableValue & coupledDot(const std::string &var_name, unsigned int comp=0) const
Time derivative of a coupled variable.
Definition: Coupleable.C:1122
THREAD_ID _c_tid
Thread ID of the thread using this object.
Definition: Coupleable.h:1391
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:2105
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:1930
const ADVariableGradient & getADDefaultGradient() const
Helper method to return (and insert if necessary) the default gradient for Automatic Differentiation ...
Definition: Coupleable.C:2317
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:361
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:1751
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:1562
OutputTools< Real >::VariablePhiValue VariablePhiValue
Definition: MooseTypes.h:307
std::unordered_map< std::string, std::vector< MooseVariableScalar * > > _c_coupled_scalar_vars
Scalar variables coupled into this object (for error checking)
Definition: Coupleable.h:1735
VariableValue _default_value_zero
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1415
MooseVariable * getVar(const std::string &var_name, unsigned int comp)
Extract pointer to a coupled variable.
Definition: Coupleable.C:287
const GenericVariableGradient< is_ad > & genericZeroGradient()
Returns zero gradient templated with automatic differentiation boolean.
OutputTools< RealVectorValue >::VariableCurl VectorVariableCurl
Definition: MooseTypes.h:322
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:1362
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:985
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:1318
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:776
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:2345
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:863
Base class for a system (of equations)
Definition: SystemBase.h:85
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:1758
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:1402
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:898
std::vector< VariableName > coupledNames(const std::string &var_name) const
Names of the variables in the Coupleable interface.
Definition: Coupleable.C:2439
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:1481
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:1810
OutputTools< Real >::VariablePhiSecond VariablePhiSecond
Definition: MooseTypes.h:309
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:1900
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:2474
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:1007
std::vector< MooseVariable * > _coupled_standard_moose_vars
Vector of standard coupled variables.
Definition: Coupleable.h:1364
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:2219
const SystemBase *const _c_sys
Pointer to the system object if the moose object this is an interface for has one.
Definition: Coupleable.h:1355
FEProblemBase & _c_fe_problem
Definition: Coupleable.h:1352
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:620
const MooseArray< DualReal > & _ad_zero
Definition: Coupleable.h:1435
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:1806
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:713
bool _c_is_implicit
True if implicit value is required.
Definition: Coupleable.h:1385
virtual const VariableValue & coupledValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a coupled variable.
Definition: Coupleable.C:482
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:2125
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:1065
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:1367
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:533
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:587
Coupleable(const MooseObject *moose_object, bool nodal, bool is_fv=false)
Constructing the object.
Definition: Coupleable.C:26
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:1497
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:2581
OutputTools< RealEigenVector >::VariableValue ArrayVariableValue
Definition: MooseTypes.h:336
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:1286
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:1790
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:28
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:33
virtual const ArrayVariableValue & coupledArrayValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a coupled array variable.
Definition: Coupleable.C:834
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:507
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:2670
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:674
VariableGradient _default_gradient
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1418
VariableSecond _default_second
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1427
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:334
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:2684
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:1546
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:2286
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:2202
const std::string & _c_name
The name of the object this interface is part of.
Definition: Coupleable.h:1347
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:1694
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:2052
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:1962
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:2011
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:2641
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:2031
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:2236
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:2018
const VectorVariableCurl & _vector_curl_zero
Zero value of the curl of a vector variable.
Definition: Coupleable.h:1452
const ADVectorVariableGradient & getADDefaultVectorGradient() const
Helper method to return (and insert if necessary) the default gradient for Automatic Differentiation ...
Definition: Coupleable.C:2324
const ADVariableValue & adZeroValue() const
method that returns _zero to RESIDUAL computing objects and _ad_zero to JACOBIAN computing objects ...
Definition: Coupleable.C:2338
std::vector< unsigned int > coupledIndices(const std::string &var_name) const
Returns the indices for a coupled variable&#39;s components.
Definition: Coupleable.C:2415
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:1880
const std::vector< MooseVariableFieldBase * > & getCoupledMooseVars() const
Get the list of all coupled variables.
Definition: Coupleable.h:70
const MooseObject *const _obj
Definition: Coupleable.h:1744
VectorVariableGradient _default_vector_gradient
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1461
std::vector< MooseVariableFieldBase * > _coupled_moose_vars
Vector of all coupled variables.
Definition: Coupleable.h:1361
virtual const VectorVariableCurl & coupledCurl(const std::string &var_name, unsigned int comp=0) const
Returns curl of a coupled variable.
Definition: Coupleable.C:1678
OutputTools< Real >::VariableValue VariableValue
Definition: MooseTypes.h:302
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:1626
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:1406
OutputTools< Real >::VariablePhiGradient VariablePhiGradient
Definition: MooseTypes.h:308
unsigned int coupledComponents(const std::string &var_name) const
Number of coupled components.
Definition: Coupleable.C:157
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:1651
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:1652
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:1302
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:2663
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:2446
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:2558
const T & getDefaultNodalValue(const std::string &var_name, unsigned int comp=0) const
Get nodal default value.
Definition: Coupleable.C:418
const std::string & _c_type
The type of the object this interface is part of.
Definition: Coupleable.h:1349
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:1610
const MooseArray< ADRealTensorValue > & _ad_second_zero
Definition: Coupleable.h:1446
VectorVariableValue _default_vector_value_zero
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1458
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:208
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:1029
std::unordered_map< std::string, std::unique_ptr< MooseArray< DualReal > > > _ad_default_value
Will hold the default value for optional coupled variables for automatic differentiation.
Definition: Coupleable.h:1398
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:1424
virtual const VectorVariableValue & coupledVectorValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a coupled vector variable.
Definition: Coupleable.C:809
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:1197
MooseArray< ADRealTensorValue > _ad_default_second
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1430
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:1456
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:2489
const VariablePhiValue & _phi_zero
Definition: Coupleable.h:1434
ArrayMooseVariable * getArrayVar(const std::string &var_name, unsigned int comp)
Extract pointer to a coupled array variable.
Definition: Coupleable.C:305
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:1340
std::vector< MooseLinearVariableFV< Real > * > _coupled_standard_linear_fv_moose_vars
Vector of standard linear finite volume coupled variables.
Definition: Coupleable.h:1376
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:2270
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:1732
const MooseVariableFieldBase * getFEVar(const std::string &var_name, unsigned int comp) const
Deprecated method.
Definition: Coupleable.C:267
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:1395
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:2604
const InputParameters & _c_parameters
Definition: Coupleable.h:1344
OutputTools< Real >::VariableSecond VariableSecond
Definition: MooseTypes.h:304
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:1639
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:2083
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:1946
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:1405
OutputTools< RealVectorValue >::VariableGradient VectorVariableGradient
Definition: MooseTypes.h:320
ArrayVariableGradient _default_array_gradient
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1476
const ADVariableSecond & getADDefaultSecond() const
Helper method to return (and insert if necessary) the default second derivatives for Automatic Differ...
Definition: Coupleable.C:2331
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:1747
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:1710
virtual const VectorVariableDivergence & coupledDiv(const std::string &var_name, unsigned int comp=0) const
Returns divergence of a coupled variable.
Definition: Coupleable.C:1726
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:1529
ArrayVariableValue _default_array_value_zero
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1473
unsigned int _coupleable_max_qps
Maximum qps for any element in this system.
Definition: Coupleable.h:1729
OutputTools< RealEigenVector >::VariableGradient ArrayVariableGradient
Definition: MooseTypes.h:337
void addFEVariableCoupleableMatrixTag(TagID tag)
Definition: Coupleable.h:104
typename Moose::GenericType< VariableGradient, is_ad > GenericVariableGradient
Definition: MooseTypes.h:575
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:2481
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:2453
virtual const VariableValue & coupledDotDot(const std::string &var_name, unsigned int comp=0) const
Second time derivative of a coupled variable.
Definition: Coupleable.C:1147
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:1665
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:1254
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:2160
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:2177
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:1270
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:2252
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:1860
MooseArray< ADRealVectorValue > _ad_default_gradient
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:1421
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:2627
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:1513
unsigned int THREAD_ID
Definition: MooseTypes.h:198
const std::unordered_map< std::string, std::string > & _new_to_deprecated_coupled_vars
map from new to deprecated variable names
Definition: Coupleable.h:1379
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:1991
const MooseVariableFieldBase * getFieldVar(const std::string &var_name, unsigned int comp) const
Definition: Coupleable.C:281
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:1742