www.mooseframework.org
Assembly.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 "DenseMatrix.h"
13 #include "MooseArray.h"
14 #include "MooseTypes.h"
15 #include "MooseVariableFE.h"
16 #include "ArbitraryQuadrature.h"
17 
18 #include "libmesh/dense_vector.h"
19 #include "libmesh/enum_quadrature_type.h"
20 #include "libmesh/fe_type.h"
21 #include "libmesh/point.h"
22 #include "libmesh/fe_base.h"
23 #include "libmesh/numeric_vector.h"
24 #include "libmesh/elem_side_builder.h"
25 
26 #include "DualRealOps.h"
27 
28 #include <unordered_map>
29 
30 // libMesh forward declarations
31 namespace libMesh
32 {
33 class DofMap;
34 class CouplingMatrix;
35 class Elem;
36 template <typename>
39 template <typename T>
43 class Node;
44 template <typename T>
45 class NumericVector;
46 template <typename T>
47 class SparseMatrix;
48 }
49 
50 // MOOSE Forward Declares
51 class FaceInfo;
52 class MooseMesh;
54 class SystemBase;
56 class MooseVariableBase;
57 template <typename>
58 class MooseVariableFE;
63 class XFEMInterface;
64 class SubProblem;
65 class NodeFaceConstraint;
66 
75 template <typename P, typename C>
76 void coordTransformFactor(const SubProblem & s,
77  SubdomainID sub_id,
78  const P & point,
79  C & factor,
81 
82 template <typename P, typename C>
83 void coordTransformFactor(const MooseMesh & mesh,
84  SubdomainID sub_id,
85  const P & point,
86  C & factor,
88 
93 class Assembly
94 {
95 public:
96  Assembly(SystemBase & sys, THREAD_ID tid);
97  virtual ~Assembly();
98 
103  template <typename T>
104  static const T * const & constify_ref(T * const & inref)
105  {
106  const T * const * ptr = &inref;
107  return *ptr;
108  }
109 
116  const FEBase * const & getFE(FEType type, unsigned int dim) const
117  {
118  buildFE(type);
119  return constify_ref(_fe[dim][type]);
120  }
121 
128  const FEBase * const & getFENeighbor(FEType type, unsigned int dim) const
129  {
130  buildNeighborFE(type);
131  return constify_ref(_fe_neighbor[dim][type]);
132  }
133 
140  const FEBase * const & getFEFace(FEType type, unsigned int dim) const
141  {
142  buildFaceFE(type);
143  return constify_ref(_fe_face[dim][type]);
144  }
145 
152  const FEBase * const & getFEFaceNeighbor(FEType type, unsigned int dim) const
153  {
154  buildFaceNeighborFE(type);
155  return constify_ref(_fe_face_neighbor[dim][type]);
156  }
157 
164  const FEVectorBase * const & getVectorFE(FEType type, unsigned int dim) const
165  {
166  buildVectorFE(type);
167  return constify_ref(_vector_fe[dim][type]);
168  }
169 
176  const FEVectorBase * const & getVectorFENeighbor(FEType type, unsigned int dim) const
177  {
178  buildVectorNeighborFE(type);
179  return constify_ref(_vector_fe_neighbor[dim][type]);
180  }
181 
188  const FEVectorBase * const & getVectorFEFace(FEType type, unsigned int dim) const
189  {
190  buildVectorFaceFE(type);
191  return constify_ref(_vector_fe_face[dim][type]);
192  }
193 
200  const FEVectorBase * const & getVectorFEFaceNeighbor(FEType type, unsigned int dim) const
201  {
204  }
205 
210  const QBase * const & qRule() const { return constify_ref(_current_qrule); }
211 
216  QBase * const & writeableQRule() { return _current_qrule; }
217 
222  const MooseArray<Point> & qPoints() const { return _current_q_points; }
223 
228  const std::vector<Point> & qPointsMortar() const { return _fe_msm->get_xyz(); }
229 
235 
240  const MooseArray<Real> & JxW() const { return _current_JxW; }
241 
242  const MooseArray<ADReal> & adJxW() const { return _ad_JxW; }
243 
244  const MooseArray<ADReal> & adJxWFace() const { return _ad_JxW_face; }
245 
246  const MooseArray<ADReal> & adCurvatures() const;
247 
252  const MooseArray<Real> & coordTransformation() const { return _coord; }
253 
259 
265  {
266  // Coord values for non-cartesian coordinate systems are functions of the locations of the
267  // quadrature points in physical space. We also have no way of knowing whether this was called
268  // from a volumetric or face object so we should set both volumetric and face xyz to true
269  _calculate_xyz = true;
270  _calculate_face_xyz = true;
271 
272  _calculate_ad_coord = true;
273  return _ad_coord;
274  }
275 
281 
286  const QBase * const & qRuleFace() const { return constify_ref(_current_qrule_face); }
287 
292  QBase * const & writeableQRuleFace() { return _current_qrule_face; }
293 
299 
304  const MooseArray<Real> & JxWFace() const { return _current_JxW_face; }
305 
310  const MooseArray<Point> & normals() const { return _current_normals; }
311 
312  /***
313  * Returns the array of normals for quadrature points on a current side
314  */
315  const std::vector<Eigen::Map<RealDIMValue>> & mappedNormals() const { return _mapped_normals; }
316 
322 
326  unsigned int numExtraElemIntegers() const { return _extra_elem_ids.size() - 1; }
327 
331  const dof_id_type & extraElemID(unsigned int id) const
332  {
333  mooseAssert(id < _extra_elem_ids.size(), "An invalid extra element integer id");
334  return _extra_elem_ids[id];
335  }
336 
340  const dof_id_type & extraElemIDNeighbor(unsigned int id) const
341  {
342  mooseAssert(id < _neighbor_extra_elem_ids.size(), "An invalid extra element integer id");
343  return _neighbor_extra_elem_ids[id];
344  }
345 
346  const MooseArray<ADPoint> & adNormals() const { return _ad_normals; }
347 
349  {
350  _calculate_xyz = true;
351  return _ad_q_points;
352  }
353 
355  {
356  _calculate_face_xyz = true;
357  return _ad_q_points_face;
358  }
359 
360  template <bool is_ad>
362 
367  const Elem * const & elem() const { return _current_elem; }
368 
373 
378 
383 
388 
393  const Real & elemVolume() { return _current_elem_volume; }
394 
399  const unsigned int & side() const { return _current_side; }
400 
405  const unsigned int & neighborSide() const { return _current_neighbor_side; }
406 
411  const Elem *& sideElem() { return _current_side_elem; }
412 
418 
423  const Elem * const & neighbor() const { return _current_neighbor_elem; }
424 
429  const Elem * const & lowerDElem() const { return _current_lower_d_elem; }
430 
435  const Elem * const & neighborLowerDElem() const { return _current_neighbor_lower_d_elem; }
436 
437  /*
438  * @return The current lower-dimensional element volume
439  */
440  const Real & lowerDElemVolume() const;
441 
442  /*
443  * @return The current neighbor lower-dimensional element volume
444  */
445  const Real & neighborLowerDElemVolume() const;
446 
451 
456 
462  {
465  }
466 
471  const QBase * const & qRuleNeighbor() const { return constify_ref(_current_qrule_neighbor); }
472 
477  QBase * const & writeableQRuleNeighbor() { return _current_qrule_neighbor; }
478 
483  const MooseArray<Real> & JxWNeighbor() const;
484 
490 
495  const Node * const & node() const { return _current_node; }
496 
501  const Node * const & nodeNeighbor() const { return _current_neighbor_node; }
502 
511  void createQRules(QuadratureType type,
512  Order order,
513  Order volume_order,
514  Order face_order,
515  SubdomainID block,
516  bool allow_negative_qweights = true);
517 
524  void bumpVolumeQRuleOrder(Order volume_order, SubdomainID block);
525 
533  void bumpAllQRuleOrder(Order order, SubdomainID block);
534 
543  void setVolumeQRule(QBase * qrule, unsigned int dim);
544 
553  void setFaceQRule(QBase * qrule, unsigned int dim);
554 
562  void setMortarQRule(Order order);
563 
567  void activateDual() { _need_dual = true; }
568 
573  bool needDual() const { return _need_dual; }
574 
578  void clearCachedQRules();
579 
580 private:
587  void setLowerQRule(QBase * qrule, unsigned int dim);
588 
589 public:
598  void setNeighborQRule(QBase * qrule, unsigned int dim);
599 
605  void reinit(const Elem * elem);
606 
610  void setVolumeQRule(const Elem * elem);
611 
616  void reinitElemFaceRef(const Elem * elem,
617  unsigned int elem_side,
618  Real tolerance,
619  const std::vector<Point> * const pts = nullptr,
620  const std::vector<Real> * const weights = nullptr);
621 
626  void reinitNeighborFaceRef(const Elem * neighbor_elem,
627  unsigned int neighbor_side,
628  Real tolerance,
629  const std::vector<Point> * const pts,
630  const std::vector<Real> * const weights = nullptr);
631 
635  void reinitDual(const Elem * elem, const std::vector<Point> & pts, const std::vector<Real> & JxW);
636 
640  void reinitLowerDElem(const Elem * elem,
641  const std::vector<Point> * const pts = nullptr,
642  const std::vector<Real> * const weights = nullptr);
643 
647  void reinitNeighborLowerDElem(const Elem * elem);
648 
652  void reinitMortarElem(const Elem * elem);
653 
657  const std::vector<Real> & jxWMortar() const { return *_JxW_msm; }
658 
662  const QBase * const & qRuleMortar() const { return constify_ref(_qrule_msm); }
663 
664 private:
668  void computeADFace(const Elem & elem, const unsigned int side);
669 
670 public:
674  void reinitAtPhysical(const Elem * elem, const std::vector<Point> & physical_points);
675 
679  void reinit(const Elem * elem, const std::vector<Point> & reference_points);
680 
684  void setFaceQRule(const Elem * const elem, const unsigned int side);
685 
689  void reinit(const Elem * elem, unsigned int side);
690 
694  void reinit(const Elem * elem, unsigned int side, const std::vector<Point> & reference_points);
695 
696  void reinitFVFace(const FaceInfo & fi);
697 
709  void reinitElemAndNeighbor(const Elem * elem,
710  unsigned int side,
711  const Elem * neighbor,
712  unsigned int neighbor_side,
713  const std::vector<Point> * neighbor_reference_points = nullptr);
714 
718  void reinitNeighborAtPhysical(const Elem * neighbor,
719  unsigned int neighbor_side,
720  const std::vector<Point> & physical_points);
721 
725  void reinitNeighborAtPhysical(const Elem * neighbor, const std::vector<Point> & physical_points);
726 
730  void reinitNeighbor(const Elem * neighbor, const std::vector<Point> & reference_points);
731 
735  void reinit(const Node * node);
736 
740  void init(const CouplingMatrix * cm);
741 
743  void initNonlocalCoupling();
744 
746  void prepareJacobianBlock();
747 
749  void prepareResidual();
750 
751  void prepare();
752  void prepareNonlocal();
753 
761  void prepareNeighbor();
762 
767  void prepareLowerD();
768 
769  void prepareBlock(unsigned int ivar, unsigned jvar, const std::vector<dof_id_type> & dof_indices);
770  void prepareBlockNonlocal(unsigned int ivar,
771  unsigned jvar,
772  const std::vector<dof_id_type> & idof_indices,
773  const std::vector<dof_id_type> & jdof_indices);
774  void prepareScalar();
775  void prepareOffDiagScalar();
776 
777  template <typename T>
779  void copyShapes(unsigned int var);
780 
781  template <typename T>
783  void copyFaceShapes(unsigned int var);
784 
785  template <typename T>
787  void copyNeighborShapes(unsigned int var);
788 
795  {
796  // Blessed classes
797  friend class Assembly;
798  friend class SubProblem;
799  friend class FEProblemBase;
800  friend class DisplacedProblem;
801  friend class ComputeMortarFunctor;
802  friend class NonlinearSystemBase;
805  };
806 
813  {
814  // Blessed classes
815  friend class Assembly;
816  friend class TaggingInterface;
819  };
820 
825  void addResidual(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
830  void addResidualNeighbor(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
835  void addResidualLower(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
836 
841  void addResidualScalar(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
842 
847  void cacheResidual(GlobalDataKey, const std::vector<VectorTag> & tags);
848 
853  void cacheResidualNeighbor(GlobalDataKey, const std::vector<VectorTag> & tags);
854 
858  void cacheResidualLower(GlobalDataKey, const std::vector<VectorTag> & tags);
859 
865  void addCachedResiduals(GlobalDataKey, const std::vector<VectorTag> & tags);
866 
875  void clearCachedResiduals(GlobalDataKey);
876 
885  GlobalDataKey,
886  const VectorTag & vector_tag);
887 
891  void setResidual(NumericVector<Number> & residual, GlobalDataKey, const VectorTag & vector_tag);
892 
897  GlobalDataKey,
898  const VectorTag & vector_tag);
899 
903  void addJacobian(GlobalDataKey);
904 
908  void addJacobianNonlocal(GlobalDataKey);
909 
914  void addJacobianNeighbor(GlobalDataKey);
915 
919  void addJacobianScalar(GlobalDataKey);
920 
925  void addJacobianOffDiagScalar(unsigned int ivar, GlobalDataKey);
926 
930  void addJacobianBlock(SparseMatrix<Number> & jacobian,
931  unsigned int ivar,
932  unsigned int jvar,
933  const DofMap & dof_map,
934  std::vector<dof_id_type> & dof_indices,
935  GlobalDataKey,
936  TagID tag);
937 
943  unsigned int ivar,
944  unsigned int jvar,
945  const DofMap & dof_map,
946  std::vector<dof_id_type> & dof_indices,
947  GlobalDataKey,
948  const std::set<TagID> & tags);
949 
954  unsigned int ivar,
955  unsigned int jvar,
956  const DofMap & dof_map,
957  const std::vector<dof_id_type> & idof_indices,
958  const std::vector<dof_id_type> & jdof_indices,
959  GlobalDataKey,
960  TagID tag);
961 
966  unsigned int ivar,
967  unsigned int jvar,
968  const DofMap & dof_map,
969  const std::vector<dof_id_type> & idof_indices,
970  const std::vector<dof_id_type> & jdof_indices,
971  GlobalDataKey,
972  const std::set<TagID> & tags);
973 
982  void addJacobianNeighborLowerD(GlobalDataKey);
983 
989  void addJacobianLowerD(GlobalDataKey);
990 
999  void cacheJacobianMortar(GlobalDataKey);
1000 
1005  void addJacobianNeighbor(SparseMatrix<Number> & jacobian,
1006  unsigned int ivar,
1007  unsigned int jvar,
1008  const DofMap & dof_map,
1009  std::vector<dof_id_type> & dof_indices,
1010  std::vector<dof_id_type> & neighbor_dof_indices,
1011  GlobalDataKey,
1012  TagID tag);
1013 
1019  unsigned int ivar,
1020  unsigned int jvar,
1021  const DofMap & dof_map,
1022  std::vector<dof_id_type> & dof_indices,
1023  std::vector<dof_id_type> & neighbor_dof_indices,
1024  GlobalDataKey,
1025  const std::set<TagID> & tags);
1026 
1030  void cacheJacobian(GlobalDataKey);
1031 
1035  void cacheJacobianNonlocal(GlobalDataKey);
1036 
1041  void cacheJacobianNeighbor(GlobalDataKey);
1042 
1049  void addCachedJacobian(GlobalDataKey);
1050 
1054  void setCachedJacobian(GlobalDataKey);
1055 
1059  void zeroCachedJacobian(GlobalDataKey);
1060 
1065  DenseVector<Number> & residualBlock(unsigned int var_num, LocalDataKey, TagID tag_id)
1066  {
1067  return _sub_Re[tag_id][var_num];
1068  }
1069 
1075  {
1076  return _sub_Rn[tag_id][var_num];
1077  }
1078 
1084  {
1085  return _sub_Rl[tag_id][var_num];
1086  }
1087 
1092  DenseMatrix<Number> & jacobianBlock(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
1093  {
1094  jacobianBlockUsed(tag, ivar, jvar, true);
1095  return _sub_Kee[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
1096  }
1097 
1103  jacobianBlockNonlocal(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
1104  {
1105  jacobianBlockNonlocalUsed(tag, ivar, jvar, true);
1106  return _sub_Keg[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
1107  }
1108 
1114  Moose::DGJacobianType type, unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag);
1115 
1124  unsigned int ivar,
1125  unsigned int jvar,
1126  LocalDataKey,
1127  TagID tag);
1128 
1133  void cacheResidualNodes(const DenseVector<Number> & res,
1134  const std::vector<dof_id_type> & dof_index,
1135  LocalDataKey,
1136  TagID tag);
1137 
1149  void
1150  cacheJacobian(numeric_index_type i, numeric_index_type j, Real value, LocalDataKey, TagID tag);
1151 
1165  Real value,
1166  LocalDataKey,
1167  const std::set<TagID> & tags);
1168 
1175  void cacheJacobianBlock(DenseMatrix<Number> & jac_block,
1176  const std::vector<dof_id_type> & idof_indices,
1177  const std::vector<dof_id_type> & jdof_indices,
1178  Real scaling_factor,
1179  LocalDataKey,
1180  TagID tag);
1181 
1191  template <typename Residuals, typename Indices>
1192  void cacheResiduals(const Residuals & residuals,
1193  const Indices & row_indices,
1194  Real scaling_factor,
1195  LocalDataKey,
1196  const std::set<TagID> & vector_tags);
1197 
1205  template <typename Residuals, typename Indices>
1206  void cacheJacobian(const Residuals & residuals,
1207  const Indices & row_indices,
1208  Real scaling_factor,
1209  LocalDataKey,
1210  const std::set<TagID> & matrix_tags);
1211 
1222  template <typename Residuals, typename Indices>
1223  void cacheResidualsWithoutConstraints(const Residuals & residuals,
1224  const Indices & row_indices,
1225  Real scaling_factor,
1226  LocalDataKey,
1227  const std::set<TagID> & vector_tags);
1228 
1236  template <typename Residuals, typename Indices>
1237  void cacheJacobianWithoutConstraints(const Residuals & residuals,
1238  const Indices & row_indices,
1239  Real scaling_factor,
1240  LocalDataKey,
1241  const std::set<TagID> & matrix_tags);
1242 
1243  std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> & couplingEntries()
1244  {
1245  return _cm_ff_entry;
1246  }
1247  const std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
1249  {
1250  return _cm_ff_entry;
1251  }
1252  std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
1254  {
1255  return _cm_nonlocal_entry;
1256  }
1257  const std::vector<std::pair<MooseVariableFieldBase *, MooseVariableScalar *>> &
1259  {
1260  return _cm_fs_entry;
1261  }
1262  const std::vector<std::pair<MooseVariableScalar *, MooseVariableFieldBase *>> &
1264  {
1265  return _cm_sf_entry;
1266  }
1267 
1268  // Read-only references
1269  const VariablePhiValue & phi() const { return _phi; }
1270  template <typename T>
1272  {
1273  return _ad_grad_phi_data.at(v.feType());
1274  }
1275  const VariablePhiValue & phi(const MooseVariableField<Real> &) const { return _phi; }
1276  const VariablePhiGradient & gradPhi() const { return _grad_phi; }
1278  const VariablePhiSecond & secondPhi() const { return _second_phi; }
1280  {
1281  return _second_phi;
1282  }
1283 
1284  const VariablePhiValue & phiFace() const { return _phi_face; }
1285  const VariablePhiValue & phiFace(const MooseVariableField<Real> &) const { return _phi_face; }
1286  const VariablePhiGradient & gradPhiFace() const { return _grad_phi_face; }
1288  {
1289  return _grad_phi_face;
1290  }
1292  {
1293  return _second_phi_face;
1294  }
1295 
1297  {
1298  return _phi_neighbor;
1299  }
1301  {
1302  return _grad_phi_neighbor;
1303  }
1305  {
1306  return _second_phi_neighbor;
1307  }
1308 
1310  {
1311  return _phi_face_neighbor;
1312  }
1314  {
1315  return _grad_phi_face_neighbor;
1316  }
1318  {
1320  }
1321 
1323  {
1324  return _vector_phi;
1325  }
1327  {
1328  return _vector_grad_phi;
1329  }
1331  {
1332  return _vector_second_phi;
1333  }
1335  {
1336  return _vector_curl_phi;
1337  }
1339  {
1340  return _vector_div_phi;
1341  }
1342 
1344  {
1345  return _vector_phi_face;
1346  }
1348  {
1349  return _vector_grad_phi_face;
1350  }
1352  {
1353  return _vector_second_phi_face;
1354  }
1356  {
1357  return _vector_curl_phi_face;
1358  }
1360  {
1361  return _vector_div_phi_face;
1362  }
1363 
1365  {
1366  return _vector_phi_neighbor;
1367  }
1370  {
1372  }
1373  const VectorVariablePhiSecond &
1375  {
1377  }
1379  {
1381  }
1384  {
1385  return _vector_div_phi_neighbor;
1386  }
1387 
1389  {
1391  }
1394  {
1396  }
1397  const VectorVariablePhiSecond &
1399  {
1401  }
1402  const VectorVariablePhiCurl &
1404  {
1406  }
1409  {
1411  }
1412 
1413  // Writeable references
1417 
1421 
1424  {
1425  return _grad_phi_neighbor;
1426  }
1428  {
1429  return _second_phi_neighbor;
1430  }
1431 
1433  {
1434  return _phi_face_neighbor;
1435  }
1437  {
1438  return _grad_phi_face_neighbor;
1439  }
1441  {
1443  }
1444 
1445  // Writeable references with vector variable
1448  {
1449  return _vector_grad_phi;
1450  }
1452  {
1453  return _vector_second_phi;
1454  }
1456  {
1457  return _vector_curl_phi;
1458  }
1460  {
1461  return _vector_div_phi;
1462  }
1463 
1465  {
1466  return _vector_phi_face;
1467  }
1469  {
1470  return _vector_grad_phi_face;
1471  }
1473  {
1474  return _vector_second_phi_face;
1475  }
1477  {
1478  return _vector_curl_phi_face;
1479  }
1481  {
1482  return _vector_div_phi_face;
1483  }
1484 
1486  {
1487  return _vector_phi_neighbor;
1488  }
1490  {
1492  }
1494  {
1496  }
1498  {
1500  }
1502  {
1503  return _vector_div_phi_neighbor;
1504  }
1506  {
1508  }
1510  {
1512  }
1514  {
1516  }
1518  {
1520  }
1522  {
1524  }
1525 
1526  // Writeable references with array variable
1530 
1533  {
1534  return _grad_phi_face;
1535  }
1537  {
1538  return _second_phi_face;
1539  }
1540 
1542  {
1543  return _phi_neighbor;
1544  }
1546  {
1547  return _grad_phi_neighbor;
1548  }
1550  {
1551  return _second_phi_neighbor;
1552  }
1553 
1555  {
1556  return _phi_face_neighbor;
1557  }
1559  {
1560  return _grad_phi_face_neighbor;
1561  }
1563  {
1565  }
1566 
1567  template <typename OutputType>
1568  const typename OutputTools<OutputType>::VariablePhiValue & fePhi(FEType type) const
1569  {
1570  buildFE(type);
1571  return _fe_shape_data[type]->_phi;
1572  }
1573 
1574  template <typename OutputType>
1575  const typename OutputTools<OutputType>::VariablePhiGradient & feGradPhi(FEType type) const
1576  {
1577  buildFE(type);
1578  return _fe_shape_data[type]->_grad_phi;
1579  }
1580 
1581  template <typename OutputType>
1583  {
1584  return _ad_grad_phi_data[type];
1585  }
1586 
1587  template <typename OutputType>
1588  const typename OutputTools<OutputType>::VariablePhiSecond & feSecondPhi(FEType type) const
1589  {
1590  _need_second_derivative[type] = true;
1591  buildFE(type);
1592  return _fe_shape_data[type]->_second_phi;
1593  }
1594 
1595  template <typename OutputType>
1596  const typename OutputTools<OutputType>::VariablePhiValue & fePhiLower(FEType type) const;
1597 
1598  template <typename OutputType>
1599  const typename OutputTools<OutputType>::VariablePhiValue & feDualPhiLower(FEType type) const;
1600 
1601  template <typename OutputType>
1602  const typename OutputTools<OutputType>::VariablePhiGradient & feGradPhiLower(FEType type) const;
1603 
1604  template <typename OutputType>
1606  feGradDualPhiLower(FEType type) const;
1607 
1608  template <typename OutputType>
1609  const typename OutputTools<OutputType>::VariablePhiValue & fePhiFace(FEType type) const
1610  {
1611  buildFaceFE(type);
1612  return _fe_shape_data_face[type]->_phi;
1613  }
1614 
1615  template <typename OutputType>
1617  {
1618  buildFaceFE(type);
1619  return _fe_shape_data_face[type]->_grad_phi;
1620  }
1621 
1622  template <typename OutputType>
1624  {
1625  return _ad_grad_phi_data_face[type];
1626  }
1627 
1628  template <typename OutputType>
1630  {
1631  _need_second_derivative[type] = true;
1632  buildFaceFE(type);
1633  return _fe_shape_data_face[type]->_second_phi;
1634  }
1635 
1636  template <typename OutputType>
1637  const typename OutputTools<OutputType>::VariablePhiValue & fePhiNeighbor(FEType type) const
1638  {
1639  buildNeighborFE(type);
1640  return _fe_shape_data_neighbor[type]->_phi;
1641  }
1642 
1643  template <typename OutputType>
1645  {
1646  buildNeighborFE(type);
1647  return _fe_shape_data_neighbor[type]->_grad_phi;
1648  }
1649 
1650  template <typename OutputType>
1652  {
1653  _need_second_derivative_neighbor[type] = true;
1654  buildNeighborFE(type);
1655  return _fe_shape_data_neighbor[type]->_second_phi;
1656  }
1657 
1658  template <typename OutputType>
1660  {
1661  buildFaceNeighborFE(type);
1662  return _fe_shape_data_face_neighbor[type]->_phi;
1663  }
1664 
1665  template <typename OutputType>
1667  feGradPhiFaceNeighbor(FEType type) const
1668  {
1669  buildFaceNeighborFE(type);
1670  return _fe_shape_data_face_neighbor[type]->_grad_phi;
1671  }
1672 
1673  template <typename OutputType>
1675  feSecondPhiFaceNeighbor(FEType type) const
1676  {
1677  _need_second_derivative_neighbor[type] = true;
1678  buildFaceNeighborFE(type);
1679  return _fe_shape_data_face_neighbor[type]->_second_phi;
1680  }
1681 
1682  template <typename OutputType>
1683  const typename OutputTools<OutputType>::VariablePhiCurl & feCurlPhi(FEType type) const
1684  {
1685  _need_curl[type] = true;
1686  buildFE(type);
1687  return _fe_shape_data[type]->_curl_phi;
1688  }
1689 
1690  template <typename OutputType>
1691  const typename OutputTools<OutputType>::VariablePhiCurl & feCurlPhiFace(FEType type) const
1692  {
1693  _need_curl[type] = true;
1694  buildFaceFE(type);
1695  return _fe_shape_data_face[type]->_curl_phi;
1696  }
1697 
1698  template <typename OutputType>
1700  {
1701  _need_curl[type] = true;
1702  buildNeighborFE(type);
1703  return _fe_shape_data_neighbor[type]->_curl_phi;
1704  }
1705 
1706  template <typename OutputType>
1708  {
1709  _need_curl[type] = true;
1710  buildFaceNeighborFE(type);
1711  return _fe_shape_data_face_neighbor[type]->_curl_phi;
1712  }
1713 
1714  template <typename OutputType>
1715  const typename OutputTools<OutputType>::VariablePhiDivergence & feDivPhi(FEType type) const
1716  {
1717  _need_div[type] = true;
1718  buildFE(type);
1719  return _fe_shape_data[type]->_div_phi;
1720  }
1721 
1722  template <typename OutputType>
1724  {
1725  _need_div[type] = true;
1726  buildFaceFE(type);
1727  return _fe_shape_data_face[type]->_div_phi;
1728  }
1729 
1730  template <typename OutputType>
1732  feDivPhiNeighbor(FEType type) const
1733  {
1734  _need_div[type] = true;
1735  buildNeighborFE(type);
1736  return _fe_shape_data_neighbor[type]->_div_phi;
1737  }
1738 
1739  template <typename OutputType>
1741  feDivPhiFaceNeighbor(FEType type) const
1742  {
1743  _need_div[type] = true;
1744  buildFaceNeighborFE(type);
1745  return _fe_shape_data_face_neighbor[type]->_div_phi;
1746  }
1747 
1749  Real elementVolume(const Elem * elem) const;
1750 
1754  void setXFEM(std::shared_ptr<XFEMInterface> xfem) { _xfem = xfem; }
1755 
1759  void assignDisplacements(
1760  std::vector<std::pair<unsigned int, unsigned short>> && disp_numbers_and_directions);
1761 
1771  unsigned int i,
1772  unsigned int ntest,
1773  const RealEigenVector & v) const
1774  {
1775  for (unsigned int j = 0; j < v.size(); ++j, i += ntest)
1776  re(i) += v(j);
1777  }
1778 
1790  unsigned int i,
1791  unsigned int ntest,
1792  unsigned int j,
1793  unsigned int nphi,
1794  unsigned int ivar,
1795  const RealEigenVector & v) const
1796  {
1797  unsigned int pace = (_component_block_diagonal[ivar] ? 0 : nphi);
1798  for (unsigned int k = 0; k < v.size(); ++k, i += ntest, j += pace)
1799  ke(i, j) += v(k);
1800  }
1801 
1815  unsigned int i,
1816  unsigned int ntest,
1817  unsigned int j,
1818  unsigned int nphi,
1819  unsigned int ivar,
1820  unsigned int jvar,
1821  const RealEigenMatrix & v) const
1822  {
1823  if (ivar == jvar && _component_block_diagonal[ivar])
1824  {
1825  for (unsigned int k = 0; k < v.rows(); ++k, i += ntest)
1826  ke(i, j) += v(k, k);
1827  }
1828  else
1829  {
1830  const unsigned int saved_j = j;
1831  for (unsigned int k = 0; k < v.rows(); ++k, i += ntest)
1832  {
1833  j = saved_j;
1834  for (unsigned int l = 0; l < v.cols(); ++l, j += nphi)
1835  ke(i, j) += v(k, l);
1836  }
1837  }
1838  }
1839 
1841  {
1842  unsigned int rows = ke.m();
1843  unsigned int cols = ke.n();
1844  DenseVector<Real> diag(rows);
1845  for (unsigned int i = 0; i < rows; i++)
1846  // % operation is needed to account for cases of no component coupling of array variables
1847  diag(i) = ke(i, i % cols);
1848  return diag;
1849  }
1850 
1856  inline const QBase * attachQRuleElem(unsigned int dim, FEBase & fe)
1857  {
1858  auto qrule = qrules(dim).vol.get();
1859  fe.attach_quadrature_rule(qrule);
1860  return qrule;
1861  }
1862 
1868  inline const QBase * attachQRuleFace(unsigned int dim, FEBase & fe)
1869  {
1870  auto qrule = qrules(dim).face.get();
1871  fe.attach_quadrature_rule(qrule);
1872  return qrule;
1873  }
1874 
1879  void hasScalingVector();
1880 
1889  void modifyArbitraryWeights(const std::vector<Real> & weights);
1890 
1894  bool computingResidual() const { return _computing_residual; }
1895 
1899  bool computingJacobian() const { return _computing_jacobian; }
1900 
1905 
1909  const Elem * const & msmElem() const { return _msm_elem; }
1910 
1920  void havePRefinement(const std::vector<FEFamily> & disable_p_refinement_for_families);
1921 
1925  void setCurrentLowerDElem(const Elem * const lower_d_elem);
1926 
1927 private:
1933  void reinitFE(const Elem * elem);
1934 
1941  void reinitFEFace(const Elem * elem, unsigned int side);
1942 
1943  void computeFaceMap(const Elem & elem, const unsigned int side, const std::vector<Real> & qw);
1944 
1945  void reinitFEFaceNeighbor(const Elem * neighbor, const std::vector<Point> & reference_points);
1946 
1947  void reinitFENeighbor(const Elem * neighbor, const std::vector<Point> & reference_points);
1948 
1949  template <typename Points, typename Coords>
1950  void setCoordinateTransformation(const QBase * qrule,
1951  const Points & q_points,
1952  Coords & coord,
1953  SubdomainID sub_id);
1954 
1955  void computeCurrentElemVolume();
1956 
1957  void computeCurrentFaceVolume();
1958 
1960 
1966  void modifyWeightsDueToXFEM(const Elem * elem);
1967 
1974  void modifyFaceWeightsDueToXFEM(const Elem * elem, unsigned int side = 0);
1975 
1980  template <typename OutputType>
1981  void computeGradPhiAD(const Elem * elem,
1982  unsigned int n_qp,
1984  FEGenericBase<OutputType> * fe);
1985 
1989  void resizeADMappingObjects(unsigned int n_qp, unsigned int dim);
1990 
1995  void
1996  computeSinglePointMapAD(const Elem * elem, const std::vector<Real> & qw, unsigned p, FEBase * fe);
1997 
2001  void addResidual(const VectorTag & vector_tag);
2005  void addResidualNeighbor(const VectorTag & vector_tag);
2010  void addResidualLower(const VectorTag & vector_tag);
2014  void addResidualScalar(const VectorTag & vector_tag);
2015 
2019  void clearCachedResiduals(const VectorTag & vector_tag);
2020 
2029  void cacheResidual(dof_id_type dof, Real value, TagID tag_id);
2030 
2039  void cacheResidual(dof_id_type dof, Real value, const std::set<TagID> & tags);
2040 
2045  void processLocalResidual(DenseVector<Number> & res_block,
2046  std::vector<dof_id_type> & dof_indices,
2047  const std::vector<Real> & scaling_factor,
2048  bool is_nodal);
2049 
2053  void addResidualBlock(NumericVector<Number> & residual,
2054  DenseVector<Number> & res_block,
2055  const std::vector<dof_id_type> & dof_indices,
2056  const std::vector<Real> & scaling_factor,
2057  bool is_nodal);
2058 
2062  void cacheResidualBlock(std::vector<Real> & cached_residual_values,
2063  std::vector<dof_id_type> & cached_residual_rows,
2064  DenseVector<Number> & res_block,
2065  const std::vector<dof_id_type> & dof_indices,
2066  const std::vector<Real> & scaling_factor,
2067  bool is_nodal);
2068 
2072  void setResidualBlock(NumericVector<Number> & residual,
2073  DenseVector<Number> & res_block,
2074  const std::vector<dof_id_type> & dof_indices,
2075  const std::vector<Real> & scaling_factor,
2076  bool is_nodal);
2077 
2081  void addJacobianBlock(SparseMatrix<Number> & jacobian,
2082  DenseMatrix<Number> & jac_block,
2083  const MooseVariableBase & ivar,
2084  const MooseVariableBase & jvar,
2085  const std::vector<dof_id_type> & idof_indices,
2086  const std::vector<dof_id_type> & jdof_indices);
2087 
2091  void cacheJacobianBlock(DenseMatrix<Number> & jac_block,
2092  const MooseVariableBase & ivar,
2093  const MooseVariableBase & jvar,
2094  const std::vector<dof_id_type> & idof_indices,
2095  const std::vector<dof_id_type> & jdof_indices,
2096  TagID tag);
2097 
2102  const MooseVariableBase & ivar,
2103  const MooseVariableBase & jvar,
2104  const std::vector<dof_id_type> & idof_indices,
2105  const std::vector<dof_id_type> & jdof_indices,
2106  TagID tag);
2107 
2111  void addJacobianCoupledVarPair(const MooseVariableBase & ivar, const MooseVariableBase & jvar);
2112 
2116  void cacheJacobianCoupledVarPair(const MooseVariableBase & ivar, const MooseVariableBase & jvar);
2117 
2123  void clearCachedJacobian();
2124 
2129  void buildFE(FEType type) const;
2130 
2135  void buildFaceFE(FEType type) const;
2136 
2141  void buildNeighborFE(FEType type) const;
2142 
2147  void buildFaceNeighborFE(FEType type) const;
2148 
2153  void buildLowerDFE(FEType type) const;
2154 
2155  void buildLowerDDualFE(FEType type) const;
2156 
2161  void buildVectorFE(FEType type) const;
2162 
2167  void buildVectorFaceFE(FEType type) const;
2168 
2173  void buildVectorNeighborFE(FEType type) const;
2174 
2179  void buildVectorFaceNeighborFE(FEType type) const;
2180 
2185  void buildVectorLowerDFE(FEType type) const;
2186  void buildVectorDualLowerDFE(FEType type) const;
2187 
2192  void jacobianBlockUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2193  {
2194  _jacobian_block_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2195  }
2196 
2201  char jacobianBlockUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2202  {
2203  return _jacobian_block_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2204  }
2205 
2210  void jacobianBlockNeighborUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2211  {
2212  _jacobian_block_neighbor_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2213  }
2214 
2219  char jacobianBlockNeighborUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2220  {
2221  return _jacobian_block_neighbor_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2222  }
2223 
2228  void jacobianBlockLowerUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2229  {
2230  _jacobian_block_lower_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2231  }
2232 
2237  char jacobianBlockLowerUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2238  {
2239  return _jacobian_block_lower_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2240  }
2241 
2246  void jacobianBlockNonlocalUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2247  {
2248  _jacobian_block_nonlocal_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2249  }
2250 
2255  char jacobianBlockNonlocalUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2256  {
2257  return _jacobian_block_nonlocal_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2258  }
2259 
2263  void helpersRequestData();
2264 
2267 
2268  const bool _displaced;
2269 
2271  const CouplingMatrix * _cm;
2272  const CouplingMatrix & _nonlocal_cm;
2273 
2275  const bool & _computing_residual;
2276 
2278  const bool & _computing_jacobian;
2279 
2282 
2284  std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> _cm_ff_entry;
2286  std::vector<std::pair<MooseVariableFieldBase *, MooseVariableScalar *>> _cm_fs_entry;
2288  std::vector<std::pair<MooseVariableScalar *, MooseVariableFieldBase *>> _cm_sf_entry;
2290  std::vector<std::pair<MooseVariableScalar *, MooseVariableScalar *>> _cm_ss_entry;
2292  std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> _cm_nonlocal_entry;
2294  std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_used;
2295  std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_nonlocal_used;
2297  std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_neighbor_used;
2299  std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_lower_used;
2301  const DofMap & _dof_map;
2304 
2306 
2307  unsigned int _mesh_dimension;
2308 
2311  const FEType _helper_type;
2312 
2319 
2322  std::vector<std::unique_ptr<FEBase>> _unique_fe_helper;
2323  std::vector<std::unique_ptr<FEBase>> _unique_fe_face_helper;
2324  std::vector<std::unique_ptr<FEBase>> _unique_fe_face_neighbor_helper;
2325  std::vector<std::unique_ptr<FEBase>> _unique_fe_neighbor_helper;
2326  std::vector<std::unique_ptr<FEBase>> _unique_fe_lower_helper;
2327 
2330 
2332  std::shared_ptr<XFEMInterface> _xfem;
2333 
2335  std::map<FEType, FEBase *> _current_fe;
2337  std::map<FEType, FEBase *> _current_fe_face;
2339  std::map<FEType, FEBase *> _current_fe_neighbor;
2341  std::map<FEType, FEBase *> _current_fe_face_neighbor;
2342 
2344  std::map<FEType, FEVectorBase *> _current_vector_fe;
2346  std::map<FEType, FEVectorBase *> _current_vector_fe_face;
2348  std::map<FEType, FEVectorBase *> _current_vector_fe_neighbor;
2350  std::map<FEType, FEVectorBase *> _current_vector_fe_face_neighbor;
2351 
2352  /**** Volume Stuff ****/
2353 
2355  mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe;
2357  mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe;
2359  std::map<unsigned int, FEBase *> _holder_fe_helper;
2380 
2383  struct QRules
2384  {
2386  : vol(nullptr),
2387  face(nullptr),
2388  arbitrary_vol(nullptr),
2389  arbitrary_face(nullptr),
2390  neighbor(nullptr)
2391  {
2392  }
2393 
2395  std::unique_ptr<QBase> vol;
2397  std::unique_ptr<QBase> face;
2399  std::unique_ptr<QBase> fv_face;
2401  std::unique_ptr<ArbitraryQuadrature> arbitrary_vol;
2403  std::unique_ptr<ArbitraryQuadrature> arbitrary_face;
2405  std::unique_ptr<ArbitraryQuadrature> neighbor;
2406  };
2407 
2412  std::unordered_map<SubdomainID, std::vector<QRules>> _qrules;
2413 
2420  QBase * qruleFace(const Elem * elem, unsigned int side);
2421  ArbitraryQuadrature * qruleArbitraryFace(const Elem * elem, unsigned int side);
2422 
2423  template <typename T>
2424  T * qruleFaceHelper(const Elem * elem, unsigned int side, std::function<T *(QRules &)> rule_fn)
2425  {
2426  auto dim = elem->dim();
2427  auto neighbor = elem->neighbor_ptr(side);
2428  auto q = rule_fn(qrules(dim, elem->subdomain_id()));
2429  if (!neighbor)
2430  return q;
2431 
2432  // find the maximum face quadrature order for all blocks the face is in
2433  auto neighbor_block = neighbor->subdomain_id();
2434  if (neighbor_block == elem->subdomain_id())
2435  return q;
2436 
2437  auto q_neighbor = rule_fn(qrules(dim, neighbor_block));
2438  if (q->get_order() > q_neighbor->get_order())
2439  return q;
2440  return q_neighbor;
2441  }
2442 
2443  inline QRules & qrules(unsigned int dim) { return qrules(dim, _current_subdomain_id); }
2444 
2448  inline QRules & qrules(unsigned int dim, SubdomainID block)
2449  {
2450  if (_qrules.find(block) == _qrules.end())
2451  {
2452  mooseAssert(_qrules.find(Moose::ANY_BLOCK_ID) != _qrules.end(),
2453  "missing quadrature rules for specified block");
2454  mooseAssert(_qrules[Moose::ANY_BLOCK_ID].size() > dim,
2455  "quadrature rules not sized property for dimension");
2456  return _qrules[Moose::ANY_BLOCK_ID][dim];
2457  }
2458  mooseAssert(_qrules.find(block) != _qrules.end(),
2459  "missing quadrature rules for specified block");
2460  mooseAssert(_qrules[block].size() > dim, "quadrature rules not sized property for dimension");
2461  return _qrules[block][dim];
2462  }
2463 
2464  /**** Face Stuff ****/
2465 
2467  mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_face;
2469  mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_face;
2471  std::map<unsigned int, FEBase *> _holder_fe_face_helper;
2485  std::vector<Eigen::Map<RealDIMValue>> _mapped_normals;
2488 
2490  std::vector<dof_id_type> _extra_elem_ids;
2492  std::vector<dof_id_type> _neighbor_extra_elem_ids;
2494  std::map<unsigned int, const std::vector<Point> *> _holder_normals;
2495 
2496  /**** Neighbor Stuff ****/
2497 
2499  mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_neighbor;
2500  mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_face_neighbor;
2501  mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_neighbor;
2502  mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_face_neighbor;
2503 
2505  std::map<unsigned int, FEBase *> _holder_fe_neighbor_helper;
2506  std::map<unsigned int, FEBase *> _holder_fe_face_neighbor_helper;
2507 
2509  mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_lower;
2511  mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_lower;
2513  std::map<unsigned int, FEBase *> _holder_fe_lower_helper;
2514 
2520  mutable bool _need_JxW_neighbor;
2528 
2529  /********** mortar stuff *************/
2530 
2532  const std::vector<Real> * _JxW_msm;
2534  std::unique_ptr<FEBase> _fe_msm;
2539  QBase * _qrule_msm;
2542 
2546 
2547 protected:
2549  const Elem * _current_elem;
2557  unsigned int _current_side;
2559  const Elem * _current_side_elem;
2575  const Node * _current_node;
2582 
2597 
2600 
2601  /*
2602  * Residual contributions <tag_index, ivar>
2603  *
2604  * tag_index is the index into _residual_vector_tags, that is, _sub_Re[0] corresponds to the tag
2605  * with TagID _residual_vector_tags[0]._id
2606  *
2607  * When ivar corresponds to an array variable, the dense vector is in size of ndof * count,
2608  * where count is the number of components of the array variable. The local residual is ordered
2609  * as (r_i,j, i = 1,...,ndof; j = 1,...,count).
2610  *
2611  * Dense vectors for variables (ivar+i, i = 1,...,count) are empty.
2612  */
2613  std::vector<std::vector<DenseVector<Number>>> _sub_Re;
2614  std::vector<std::vector<DenseVector<Number>>> _sub_Rn;
2616  std::vector<std::vector<DenseVector<Number>>> _sub_Rl;
2617 
2620 
2621  /*
2622  * Jacobian contributions <Tag, ivar, jvar>
2623  * When ivar corresponds to an array variable, the number of rows of the dense matrix is in size
2624  * of indof * icount, where icount is the number of components of ivar. When jvar corresponds to
2625  * an array variable, the number of columns of the dense matrix is in size of jndof * jcount,
2626  * where jcount is the number of components of jvar. The local residual is ordered as
2627  * (K_(i,j,k,l), k=1,...,jndof; l = 1,...,jcout; i = 1,...,indof; j = 1,...,icount).
2628  *
2629  * Dense matrices for variables (ivar+i, i = 1,...,icount) or (jvar+j, j = 1,...,jcount) are
2630  * empty.
2631  */
2632  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kee;
2633  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Keg;
2634 
2636  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Ken;
2638  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kne;
2640  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Knn;
2642  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kll;
2644  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kle;
2646  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kln;
2648  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kel;
2650  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Knl;
2651 
2654 
2655  // Shape function values, gradients. second derivatives
2659 
2663 
2667 
2671 
2672  // Shape function values, gradients, second derivatives
2678 
2684 
2690 
2696 
2698  {
2699  public:
2705  };
2706 
2708  {
2709  public:
2715  };
2716 
2718  mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data;
2719  mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_face;
2720  mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_neighbor;
2721  mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_face_neighbor;
2722  mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_lower;
2723  mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_dual_lower;
2724 
2726  mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data;
2727  mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_face;
2728  mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_neighbor;
2729  mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_face_neighbor;
2730  mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_lower;
2731  mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_dual_lower;
2732 
2733  mutable std::map<FEType, ADTemplateVariablePhiGradient<Real>> _ad_grad_phi_data;
2734  mutable std::map<FEType, ADTemplateVariablePhiGradient<RealVectorValue>> _ad_vector_grad_phi_data;
2735  mutable std::map<FEType, ADTemplateVariablePhiGradient<Real>> _ad_grad_phi_data_face;
2736  mutable std::map<FEType, ADTemplateVariablePhiGradient<RealVectorValue>>
2738 
2748  const std::vector<VectorTag> & _residual_vector_tags;
2749 
2751  std::vector<std::vector<Real>> _cached_residual_values;
2752 
2754  std::vector<std::vector<dof_id_type>> _cached_residual_rows;
2755 
2757 
2759  std::vector<std::vector<Real>> _cached_jacobian_values;
2761  std::vector<std::vector<dof_id_type>> _cached_jacobian_rows;
2763  std::vector<std::vector<dof_id_type>> _cached_jacobian_cols;
2764 
2766 
2771  std::vector<bool> _component_block_diagonal;
2772 
2774  std::vector<dof_id_type> _temp_dof_indices;
2775 
2777  std::vector<Point> _temp_reference_points;
2778 
2780  std::vector<VectorValue<DualReal>> _ad_dxyzdxi_map;
2781  std::vector<VectorValue<DualReal>> _ad_dxyzdeta_map;
2782  std::vector<VectorValue<DualReal>> _ad_dxyzdzeta_map;
2783  std::vector<VectorValue<DualReal>> _ad_d2xyzdxi2_map;
2784  std::vector<VectorValue<DualReal>> _ad_d2xyzdxideta_map;
2785  std::vector<VectorValue<DualReal>> _ad_d2xyzdeta2_map;
2786  std::vector<DualReal> _ad_jac;
2789  std::vector<DualReal> _ad_dxidx_map;
2790  std::vector<DualReal> _ad_dxidy_map;
2791  std::vector<DualReal> _ad_dxidz_map;
2792  std::vector<DualReal> _ad_detadx_map;
2793  std::vector<DualReal> _ad_detady_map;
2794  std::vector<DualReal> _ad_detadz_map;
2795  std::vector<DualReal> _ad_dzetadx_map;
2796  std::vector<DualReal> _ad_dzetady_map;
2797  std::vector<DualReal> _ad_dzetadz_map;
2798 
2804 
2808  std::vector<std::pair<unsigned int, unsigned short>> _disp_numbers_and_directions;
2809 
2810  mutable bool _calculate_xyz;
2811  mutable bool _calculate_face_xyz;
2813 
2816  mutable bool _calculate_ad_coord;
2817 
2818  mutable std::map<FEType, bool> _need_second_derivative;
2819  mutable std::map<FEType, bool> _need_second_derivative_neighbor;
2820  mutable std::map<FEType, bool> _need_curl;
2821  mutable std::map<FEType, bool> _need_div;
2822 
2824  const NumericVector<Real> * _scaling_vector = nullptr;
2825 
2832 
2833  const Elem * _msm_elem = nullptr;
2834 
2839 
2844 
2848  std::vector<dof_id_type> _row_indices, _column_indices;
2849 
2852 
2854  std::vector<Point> _current_neighbor_ref_points;
2855 };
2856 
2857 template <typename OutputType>
2859 Assembly::fePhiLower(FEType type) const
2860 {
2861  buildLowerDFE(type);
2862  return _fe_shape_data_lower[type]->_phi;
2863 }
2864 
2865 template <typename OutputType>
2867 Assembly::feDualPhiLower(FEType type) const
2868 {
2869  buildLowerDDualFE(type);
2870  return _fe_shape_data_dual_lower[type]->_phi;
2871 }
2872 
2873 template <typename OutputType>
2875 Assembly::feGradPhiLower(FEType type) const
2876 {
2877  buildLowerDFE(type);
2878  return _fe_shape_data_lower[type]->_grad_phi;
2879 }
2880 
2881 template <typename OutputType>
2884 {
2885  buildLowerDDualFE(type);
2886  return _fe_shape_data_dual_lower[type]->_grad_phi;
2887 }
2888 
2889 template <>
2891 Assembly::feADGradPhi<RealVectorValue>(FEType type) const
2892 {
2893  return _ad_vector_grad_phi_data[type];
2894 }
2895 
2896 template <>
2898 Assembly::feADGradPhiFace<RealVectorValue>(FEType type) const
2899 {
2900  return _ad_vector_grad_phi_data_face[type];
2901 }
2902 
2903 template <>
2905 Assembly::fePhi<VectorValue<Real>>(FEType type) const;
2906 
2907 template <>
2909 Assembly::feGradPhi<VectorValue<Real>>(FEType type) const;
2910 
2911 template <>
2913 Assembly::feSecondPhi<VectorValue<Real>>(FEType type) const;
2914 
2915 template <>
2917 Assembly::fePhiLower<VectorValue<Real>>(FEType type) const;
2918 
2919 template <>
2921 Assembly::feDualPhiLower<VectorValue<Real>>(FEType type) const;
2922 
2923 template <>
2925 Assembly::feGradPhiLower<VectorValue<Real>>(FEType type) const;
2926 
2927 template <>
2929 Assembly::feGradDualPhiLower<VectorValue<Real>>(FEType type) const;
2930 
2931 template <>
2933 Assembly::fePhiFace<VectorValue<Real>>(FEType type) const;
2934 
2935 template <>
2937 Assembly::feGradPhiFace<VectorValue<Real>>(FEType type) const;
2938 
2939 template <>
2941 Assembly::feSecondPhiFace<VectorValue<Real>>(FEType type) const;
2942 
2943 template <>
2945 Assembly::fePhiNeighbor<VectorValue<Real>>(FEType type) const;
2946 
2947 template <>
2949 Assembly::feGradPhiNeighbor<VectorValue<Real>>(FEType type) const;
2950 
2951 template <>
2953 Assembly::feSecondPhiNeighbor<VectorValue<Real>>(FEType type) const;
2954 
2955 template <>
2957 Assembly::fePhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
2958 
2959 template <>
2961 Assembly::feGradPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
2962 
2963 template <>
2965 Assembly::feSecondPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
2966 
2967 template <>
2969 Assembly::feCurlPhi<VectorValue<Real>>(FEType type) const;
2970 
2971 template <>
2973 Assembly::feCurlPhiFace<VectorValue<Real>>(FEType type) const;
2974 
2975 template <>
2977 Assembly::feCurlPhiNeighbor<VectorValue<Real>>(FEType type) const;
2978 
2979 template <>
2981 Assembly::feCurlPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
2982 
2983 template <>
2985 Assembly::feDivPhi<VectorValue<Real>>(FEType type) const;
2986 
2987 template <>
2989 Assembly::feDivPhiFace<VectorValue<Real>>(FEType type) const;
2990 
2991 template <>
2993 Assembly::feDivPhiNeighbor<VectorValue<Real>>(FEType type) const;
2994 
2995 template <>
2997 Assembly::feDivPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
2998 
2999 template <>
3001 Assembly::adGradPhi<RealVectorValue>(const MooseVariableFE<RealVectorValue> & v) const
3002 {
3003  return _ad_vector_grad_phi_data.at(v.feType());
3004 }
3005 
3006 template <typename Residuals, typename Indices>
3007 void
3008 Assembly::cacheResiduals(const Residuals & residuals,
3009  const Indices & input_row_indices,
3010  const Real scaling_factor,
3011  LocalDataKey,
3012  const std::set<TagID> & vector_tags)
3013 {
3014  mooseAssert(residuals.size() == input_row_indices.size(),
3015  "The number of residuals should match the number of dof indices");
3016  mooseAssert(residuals.size() >= 1, "Why you calling me with no residuals?");
3017 
3018  if (!computingResidual() || vector_tags.empty())
3019  return;
3020 
3021  if (residuals.size() == 1)
3022  {
3023  // No constraining is required. (This is likely a finite volume computation if we only have a
3024  // single dof)
3026  residuals, input_row_indices, scaling_factor, LocalDataKey{}, vector_tags);
3027  return;
3028  }
3029 
3030  // Need to make a copy because we might modify this in constrain_element_vector
3031  _row_indices.assign(input_row_indices.begin(), input_row_indices.end());
3032 
3034  for (const auto i : index_range(_row_indices))
3035  _element_vector(i) = MetaPhysicL::raw_value(residuals[i]) * scaling_factor;
3036 
3037  // At time of writing, this method doesn't do anything with the asymmetric_constraint_rows
3038  // argument, but we set it to false to be consistent with processLocalResidual
3039  _dof_map.constrain_element_vector(
3040  _element_vector, _row_indices, /*asymmetric_constraint_rows=*/false);
3041 
3042  for (const auto i : index_range(_row_indices))
3043  cacheResidual(_row_indices[i], _element_vector(i), vector_tags);
3044 }
3045 
3046 template <typename Residuals, typename Indices>
3047 void
3049  const Indices & row_indices,
3050  const Real scaling_factor,
3051  LocalDataKey,
3052  const std::set<TagID> & vector_tags)
3053 {
3054  mooseAssert(residuals.size() == row_indices.size(),
3055  "The number of residuals should match the number of dof indices");
3056  mooseAssert(residuals.size() >= 1, "Why you calling me with no residuals?");
3057 
3058  if (computingResidual() && !vector_tags.empty())
3059  for (const auto i : index_range(row_indices))
3060  cacheResidual(
3061  row_indices[i], MetaPhysicL::raw_value(residuals[i]) * scaling_factor, vector_tags);
3062 }
3063 
3064 template <typename Residuals, typename Indices>
3065 void
3066 Assembly::cacheJacobian(const Residuals & residuals,
3067  const Indices & input_row_indices,
3068  const Real scaling_factor,
3069  LocalDataKey,
3070  const std::set<TagID> & matrix_tags)
3071 {
3072  if (!computingJacobian() || matrix_tags.empty())
3073  return;
3074 
3075  if (residuals.size() == 1)
3076  {
3077  // No constraining is required. (This is likely a finite volume computation if we only have a
3078  // single dof)
3080  residuals, input_row_indices, scaling_factor, LocalDataKey{}, matrix_tags);
3081  return;
3082  }
3083 
3084  const auto & compare_dofs = residuals[0].derivatives().nude_indices();
3085 #ifndef NDEBUG
3086  auto compare_dofs_set = std::set<dof_id_type>(compare_dofs.begin(), compare_dofs.end());
3087 
3088  for (auto resid_it = residuals.begin() + 1; resid_it != residuals.end(); ++resid_it)
3089  {
3090  auto current_dofs_set = std::set<dof_id_type>(resid_it->derivatives().nude_indices().begin(),
3091  resid_it->derivatives().nude_indices().end());
3092  mooseAssert(compare_dofs_set == current_dofs_set,
3093  "We're going to see whether the dof sets are the same. IIRC the degree of freedom "
3094  "dependence (as indicated by the dof index set held by the ADReal) has to be the "
3095  "same for every residual passed to this method otherwise constrain_element_matrix "
3096  "will not work.");
3097  }
3098 #endif
3099  _column_indices.assign(compare_dofs.begin(), compare_dofs.end());
3100 
3101  // If there's no derivatives then there is nothing to do. Moreover, if we pass zero size column
3102  // indices to constrain_element_matrix then we will potentially get errors out of BLAS
3103  if (!_column_indices.size())
3104  return;
3105 
3106  // Need to make a copy because we might modify this in constrain_element_matrix
3107  _row_indices.assign(input_row_indices.begin(), input_row_indices.end());
3108 
3110  for (const auto i : index_range(_row_indices))
3111  {
3112  const auto & sparse_derivatives = residuals[i].derivatives();
3113 
3114  for (const auto j : index_range(_column_indices))
3115  _element_matrix(i, j) = sparse_derivatives[_column_indices[j]] * scaling_factor;
3116  }
3117 
3118  _dof_map.constrain_element_matrix(_element_matrix, _row_indices, _column_indices);
3119 
3120  for (const auto i : index_range(_row_indices))
3121  for (const auto j : index_range(_column_indices))
3122  cacheJacobian(_row_indices[i], _column_indices[j], _element_matrix(i, j), {}, matrix_tags);
3123 }
3124 
3125 template <typename Residuals, typename Indices>
3126 void
3127 Assembly::cacheJacobianWithoutConstraints(const Residuals & residuals,
3128  const Indices & row_indices,
3129  const Real scaling_factor,
3130  LocalDataKey,
3131  const std::set<TagID> & matrix_tags)
3132 {
3133  mooseAssert(residuals.size() == row_indices.size(),
3134  "The number of residuals should match the number of dof indices");
3135  mooseAssert(residuals.size() >= 1, "Why you calling me with no residuals?");
3136 
3137  if (!computingJacobian() || matrix_tags.empty())
3138  return;
3139 
3140  for (const auto i : index_range(row_indices))
3141  {
3142  const auto row_index = row_indices[i];
3143 
3144  const auto & sparse_derivatives = residuals[i].derivatives();
3145  const auto & column_indices = sparse_derivatives.nude_indices();
3146  const auto & raw_derivatives = sparse_derivatives.nude_data();
3147 
3148  for (std::size_t j = 0; j < column_indices.size(); ++j)
3149  cacheJacobian(
3150  row_index, column_indices[j], raw_derivatives[j] * scaling_factor, {}, matrix_tags);
3151  }
3152 }
3153 
3154 inline const Real &
3156 {
3159 }
3160 
3161 inline const Real &
3163 {
3166 }
3167 
3168 inline void
3170  std::vector<std::pair<unsigned int, unsigned short>> && disp_numbers_and_directions)
3171 {
3172  _disp_numbers_and_directions = std::move(disp_numbers_and_directions);
3173 }
3174 
3175 inline void
3176 Assembly::setCurrentLowerDElem(const Elem * const lower_d_elem)
3177 {
3178  _current_lower_d_elem = lower_d_elem;
3179 }
const Real & neighborVolume()
Returns the reference to the current neighbor volume.
Definition: Assembly.h:461
VariablePhiSecond _second_phi_face
Definition: Assembly.h:2662
const Elem *const & elem() const
Return the current element.
Definition: Assembly.h:367
VariablePhiSecond _second_phi_face_neighbor
Definition: Assembly.h:2670
const VectorVariablePhiValue & phi(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1322
const FEVectorBase *const & getVectorFEFace(FEType type, unsigned int dim) const
GetVector a reference to a pointer that will contain the current "face" FE.
Definition: Assembly.h:188
MooseArray< DualReal > _ad_JxW
Definition: Assembly.h:2787
void copyShapes(MooseVariableField< T > &v)
Definition: Assembly.C:2991
const FEVectorBase *const & getVectorFE(FEType type, unsigned int dim) const
Get a reference to a pointer that will contain the current volume FEVector.
Definition: Assembly.h:164
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_face
types of finite elements
Definition: Assembly.h:2467
bool _need_neighbor_elem_volume
true is apps need to compute neighbor element volume
Definition: Assembly.h:2571
void cacheResidualNeighbor(GlobalDataKey, const std::vector< VectorTag > &tags)
Takes the values that are currently in _sub_Rn of all field variables and appends them to the cached ...
Definition: Assembly.C:3451
const unsigned int & neighborSide() const
Returns the current neighboring side.
Definition: Assembly.h:405
VectorVariablePhiSecond & secondPhi(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1451
ArbitraryQuadrature * _current_qrule_arbitrary
The current arbitrary quadrature rule used within the element interior.
Definition: Assembly.h:2367
std::map< FEType, FEBase * > _current_fe
The "volume" fe object that matches the current elem.
Definition: Assembly.h:2335
MooseArray< Real > _curvatures
Definition: Assembly.h:2802
VectorVariablePhiValue _phi
Definition: Assembly.h:2710
SystemBase & _sys
Definition: Assembly.h:2265
std::vector< std::vector< dof_id_type > > _cached_residual_rows
Where the cached values should go (the first vector is for TIME vs NONTIME)
Definition: Assembly.h:2754
std::vector< std::vector< dof_id_type > > _cached_jacobian_rows
Row where the corresponding cached value should go.
Definition: Assembly.h:2761
void computeGradPhiAD(const Elem *elem, unsigned int n_qp, ADTemplateVariablePhiGradient< OutputType > &grad_phi, FEGenericBase< OutputType > *fe)
compute gradient of phi possibly with derivative information with respect to nonlinear displacement v...
Definition: Assembly.C:887
unsigned int _max_cached_residuals
Definition: Assembly.h:2756
std::map< FEType, ADTemplateVariablePhiGradient< Real > > _ad_grad_phi_data_face
Definition: Assembly.h:2735
MooseArray< VectorValue< DualReal > > _ad_q_points_face
Definition: Assembly.h:2801
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhi(FEType type) const
Definition: Assembly.h:1683
std::vector< DualReal > _ad_detadz_map
Definition: Assembly.h:2794
QBase * _current_qrule_lower
quadrature rule used on lower dimensional elements.
Definition: Assembly.h:2545
bool _user_added_fe_lower_of_helper_type
Definition: Assembly.h:2318
MooseArray< Point > _current_physical_points
This will be filled up with the physical points passed into reinitAtPhysical() if it is called...
Definition: Assembly.h:2599
std::vector< DualReal > _ad_dxidy_map
Definition: Assembly.h:2790
VariablePhiSecond & secondPhiNeighbor(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1549
const VariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< Real > &) const
Definition: Assembly.h:1313
std::vector< std::unique_ptr< FEBase > > _unique_fe_lower_helper
Definition: Assembly.h:2326
Order
MooseArray< VectorValue< DualReal > > _ad_normals
Definition: Assembly.h:2800
const MooseArray< ADPoint > & adQPointsFace() const
Definition: Assembly.h:354
void setResidualBlock(NumericVector< Number > &residual, DenseVector< Number > &res_block, const std::vector< dof_id_type > &dof_indices, const std::vector< Real > &scaling_factor, bool is_nodal)
Set a local residual block to a global residual vector with proper scaling.
Definition: Assembly.C:3285
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & couplingEntries()
Definition: Assembly.h:1243
void buildNeighborFE(FEType type) const
Build FEs for a neighbor with a type.
Definition: Assembly.C:312
const VariablePhiSecond & secondPhi() const
Definition: Assembly.h:1278
void setMortarQRule(Order order)
Specifies a custom qrule for integration on mortar segment mesh.
Definition: Assembly.C:732
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe
Each dimension&#39;s actual vector fe objects indexed on type.
Definition: Assembly.h:2357
typename OutputTools< typename Moose::ADType< T >::type >::VariablePhiGradient ADTemplateVariablePhiGradient
Definition: MooseTypes.h:548
void buildVectorLowerDFE(FEType type) const
Build Vector FEs for a lower dimensional element with a type.
Definition: Assembly.C:401
std::vector< VectorValue< DualReal > > _ad_d2xyzdxi2_map
Definition: Assembly.h:2783
MooseArray< Real > _coord_neighbor
The current coordinate transformation coefficients.
Definition: Assembly.h:2524
const FEBase *const & getFENeighbor(FEType type, unsigned int dim) const
Get a reference to a pointer that will contain the current &#39;neighbor&#39; FE.
Definition: Assembly.h:128
void buildFE(FEType type) const
Build FEs with a type.
Definition: Assembly.C:264
T * qruleFaceHelper(const Elem *elem, unsigned int side, std::function< T *(QRules &)> rule_fn)
Definition: Assembly.h:2424
const bool & _computing_residual
Whether we are currently computing the residual.
Definition: Assembly.h:2275
QBase * _qrule_msm
A qrule object for working on mortar segement elements.
Definition: Assembly.h:2539
QBase * _current_qrule
The current current quadrature rule being used (could be either volumetric or arbitrary - for dirac k...
Definition: Assembly.h:2363
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kle
dlower/dsecondary (or dlower/delement)
Definition: Assembly.h:2644
VectorVariablePhiGradient & gradPhiFace(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1468
void setCurrentBoundaryID(BoundaryID i)
set the current boundary ID
Definition: Assembly.h:387
void cacheResidualLower(GlobalDataKey, const std::vector< VectorTag > &tags)
Takes the values that are currently in _sub_Rl and appends them to the cached values.
Definition: Assembly.C:3466
const std::vector< std::pair< MooseVariableFieldBase *, MooseVariableScalar * > > & fieldScalarCouplingEntries() const
Definition: Assembly.h:1258
const OutputTools< OutputType >::VariablePhiValue & fePhi(FEType type) const
Definition: Assembly.h:1568
MooseArray< DualReal > _ad_JxW_face
Definition: Assembly.h:2799
Keeps track of stuff related to assembling.
Definition: Assembly.h:93
Assembly(SystemBase &sys, THREAD_ID tid)
Definition: Assembly.C:77
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data
Shape function values, gradients, second derivatives for each FE type.
Definition: Assembly.h:2718
Class for stuff related to variables.
Definition: Adaptivity.h:31
const MooseArray< ADReal > & adJxW() const
Definition: Assembly.h:242
const ADTemplateVariablePhiGradient< OutputType > & feADGradPhiFace(FEType type) const
Definition: Assembly.h:1623
void buildLowerDDualFE(FEType type) const
Definition: Assembly.C:380
VariablePhiGradient & gradPhiFace(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1532
unsigned int TagID
Definition: MooseTypes.h:199
void addJacobianBlockNonlocal(SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const DofMap &dof_map, const std::vector< dof_id_type > &idof_indices, const std::vector< dof_id_type > &jdof_indices, GlobalDataKey, TagID tag)
Adds non-local element matrix for ivar rows and jvar columns to the global Jacobian matrix...
Definition: Assembly.C:4292
VectorVariablePhiValue _vector_phi
Definition: Assembly.h:2673
MooseArray< Real > _current_JxW_neighbor
The current transformed jacobian weights on a neighbor&#39;s face.
Definition: Assembly.h:2522
std::shared_ptr< XFEMInterface > _xfem
The XFEM controller.
Definition: Assembly.h:2332
void reinitNeighborLowerDElem(const Elem *elem)
reinitialize a neighboring lower dimensional element
Definition: Assembly.C:2375
virtual ~Assembly()
Definition: Assembly.C:184
void setCurrentLowerDElem(const Elem *const lower_d_elem)
Set the current lower dimensional element.
Definition: Assembly.h:3176
const VectorVariablePhiDivergence & divPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1383
void prepareJacobianBlock()
Sizes and zeroes the Jacobian blocks used for the current element.
Definition: Assembly.C:2678
DenseMatrix< Number > & jacobianBlockNonlocal(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Get local Jacobian block from non-local contribution for a pair of variables and a tag...
Definition: Assembly.h:1103
VariablePhiSecond & secondPhiFace(const MooseVariableField< Real > &)
Definition: Assembly.h:1420
VectorValue< Real > RealVectorValue
Definition: SubProblem.h:33
VariablePhiSecond & secondPhi(const MooseVariableField< Real > &)
Definition: Assembly.h:1416
std::vector< DualReal > _ad_dzetady_map
Definition: Assembly.h:2796
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kel
dsecondary/dlower (or delement/dlower)
Definition: Assembly.h:2648
MooseArray< Real > _coord
The current coordinate transformation coefficients.
Definition: Assembly.h:2377
const OutputTools< OutputType >::VariablePhiValue & fePhiLower(FEType type) const
Definition: Assembly.h:2859
VariablePhiDivergence _div_phi
Definition: Assembly.h:2704
MooseArray< VectorValue< DualReal > > _ad_q_points
Definition: Assembly.h:2788
std::unique_ptr< QBase > vol
volume/elem (meshdim) quadrature rule
Definition: Assembly.h:2395
DenseMatrix< Number > & jacobianBlockNeighbor(Moose::DGJacobianType type, unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Get local Jacobian block of a DG Jacobian type for a pair of variables and a tag. ...
Definition: Assembly.C:3108
void reinitFE(const Elem *elem)
Just an internal helper function to reinit the volume FE objects.
Definition: Assembly.C:757
const Real & neighborLowerDElemVolume() const
Definition: Assembly.h:3162
void saveDiagLocalArrayJacobian(DenseMatrix< Number > &ke, unsigned int i, unsigned int ntest, unsigned int j, unsigned int nphi, unsigned int ivar, const RealEigenVector &v) const
Helper function for assembling diagonal Jacobian contriubutions on local quadrature points for an arr...
Definition: Assembly.h:1789
VariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1558
void jacobianBlockUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
Sets whether or not Jacobian coupling between ivar and jvar is used to the value used.
Definition: Assembly.h:2192
const MooseArray< Point > & physicalPoints() const
The current points in physical space where we have reinited through reinitAtPhysical() ...
Definition: Assembly.h:234
VectorVariablePhiGradient & gradPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1489
void init(const CouplingMatrix *cm)
Initialize the Assembly object and set the CouplingMatrix for use throughout.
Definition: Assembly.C:2461
void prepareNonlocal()
Definition: Assembly.C:2716
VariablePhiGradient _grad_phi
Definition: Assembly.h:2657
std::map< unsigned int, FEBase * > _holder_fe_neighbor_helper
Each dimension&#39;s helper objects.
Definition: Assembly.h:2505
const VectorVariablePhiSecond & secondPhi(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1330
std::unique_ptr< FEBase > _fe_msm
A FE object for working on mortar segement elements.
Definition: Assembly.h:2534
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_face_neighbor
Definition: Assembly.h:2721
const VectorVariablePhiValue & phiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1364
VectorVariablePhiValue & phiFace(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1464
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & nonlocalCouplingEntries()
Definition: Assembly.h:1253
void createQRules(QuadratureType type, Order order, Order volume_order, Order face_order, SubdomainID block, bool allow_negative_qweights=true)
Creates block-specific volume, face and arbitrary qrules based on the orders and the flag of whether ...
Definition: Assembly.C:614
VariablePhiSecond _second_phi_neighbor
Definition: Assembly.h:2666
void setXFEM(std::shared_ptr< XFEMInterface > xfem)
Set the pointer to the XFEM controller object.
Definition: Assembly.h:1754
std::vector< DualReal > _ad_dzetadz_map
Definition: Assembly.h:2797
const MooseArray< ADPoint > & adQPoints() const
Definition: Assembly.h:348
void reinitAtPhysical(const Elem *elem, const std::vector< Point > &physical_points)
Reinitialize the assembly data at specific physical point in the given element.
Definition: Assembly.C:1780
void addCachedResidualDirectly(NumericVector< Number > &residual, GlobalDataKey, const VectorTag &vector_tag)
Adds the values that have been cached by calling cacheResidual(), cacheResidualNeighbor(), and/or cacheResidualLower() to a user-defined residual (that is, not necessarily the vector that vector_tag points to)
Definition: Assembly.C:3526
bool _current_elem_volume_computed
Boolean to indicate whether current element volumes has been computed.
Definition: Assembly.h:2579
void jacobianBlockLowerUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
Sets whether or not lower Jacobian coupling between ivar and jvar is used to the value used...
Definition: Assembly.h:2228
MooseVariableFE< Real > MooseVariable
Definition: Assembly.h:59
const VectorVariablePhiDivergence & divPhi(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1338
VectorVariablePhiGradient _vector_grad_phi_neighbor
Definition: Assembly.h:2686
std::map< FEType, bool > _need_div
Definition: Assembly.h:2821
const MooseArray< Point > & qPointsFaceNeighbor() const
Returns the reference to the current quadrature points being used on the neighbor face...
Definition: Assembly.h:489
std::vector< std::unique_ptr< FEBase > > _unique_fe_neighbor_helper
Definition: Assembly.h:2325
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kll
dlower/dlower
Definition: Assembly.h:2642
VectorVariablePhiValue & phiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1505
VectorVariablePhiCurl & curlPhi(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1455
bool _user_added_fe_face_neighbor_of_helper_type
Definition: Assembly.h:2316
void setResidualNeighbor(NumericVector< Number > &residual, GlobalDataKey, const VectorTag &vector_tag)
Sets local neighbor residuals of all field variables to the global residual vector for a tag...
Definition: Assembly.C:3557
bool _have_p_refinement
Whether we have ever conducted p-refinement.
Definition: Assembly.h:2851
VariablePhiValue _phi
Definition: Assembly.h:2700
Real _current_neighbor_volume
Volume of the current neighbor.
Definition: Assembly.h:2573
void resize(const unsigned int n)
void jacobianBlockNonlocalUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
Sets whether or not nonlocal Jacobian coupling between ivar and jvar is used to the value used...
Definition: Assembly.h:2246
ArbitraryQuadrature * qruleArbitraryFace(const Elem *elem, unsigned int side)
Definition: Assembly.C:1916
std::map< FEType, FEBase * > _current_fe_face
The "face" fe object that matches the current elem.
Definition: Assembly.h:2337
VectorVariablePhiGradient & gradPhi(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1447
const VectorVariablePhiCurl & curlPhi(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1334
std::vector< Point > _current_neighbor_ref_points
The current reference points on the neighbor element.
Definition: Assembly.h:2854
void coordTransformFactor(const SubProblem &s, SubdomainID sub_id, const P &point, C &factor, SubdomainID neighbor_sub_id=libMesh::Elem::invalid_subdomain_id)
Computes a conversion multiplier for use when computing integraals for the current coordinate system ...
Definition: Assembly.C:39
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kln
dlower/dprimary (or dlower/dneighbor)
Definition: Assembly.h:2646
MooseVariableFE< RealVectorValue > VectorMooseVariable
Definition: Assembly.h:61
const Elem * _current_neighbor_elem
The current neighbor "element".
Definition: Assembly.h:2563
void addJacobianNonlocal(GlobalDataKey)
Adds non-local Jacobian to the global Jacobian matrices.
Definition: Assembly.C:3879
VectorVariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1509
VariablePhiValue & phiFace(const MooseVariableField< Real > &)
Definition: Assembly.h:1418
std::vector< std::vector< DenseVector< Number > > > _sub_Rn
Definition: Assembly.h:2614
const OutputTools< OutputType >::VariablePhiValue & feDualPhiLower(FEType type) const
Definition: Assembly.h:2867
MooseMesh & _mesh
Definition: Assembly.h:2305
const VariablePhiValue & phi() const
Definition: Assembly.h:1269
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_neighbor
Definition: Assembly.h:2720
std::map< unsigned int, FEBase * > _holder_fe_face_neighbor_helper
Definition: Assembly.h:2506
std::unique_ptr< QBase > fv_face
finite volume face/flux quadrature rule (meshdim-1)
Definition: Assembly.h:2399
auto raw_value(const Eigen::Map< T > &in)
Definition: ADReal.h:73
const VariablePhiGradient & gradPhi() const
Definition: Assembly.h:1276
MooseArray< Real > _current_JxW_face
The current transformed jacobian weights on a face.
Definition: Assembly.h:2481
void modifyWeightsDueToXFEM(const Elem *elem)
Update the integration weights for XFEM partial elements.
Definition: Assembly.C:4527
DenseMatrix< Number > _tmp_Ke
auxiliary matrix for scaling jacobians (optimization to avoid expensive construction/destruction) ...
Definition: Assembly.h:2653
const Elem * _current_elem
The current "element" we are currently on.
Definition: Assembly.h:2549
VectorVariablePhiCurl _vector_curl_phi_neighbor
Definition: Assembly.h:2688
VectorVariablePhiCurl & curlPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1497
const VariablePhiSecond & secondPhiNeighbor(const MooseVariableField< Real > &) const
Definition: Assembly.h:1304
const FEBase *const & getFEFace(FEType type, unsigned int dim) const
Get a reference to a pointer that will contain the current "face" FE.
Definition: Assembly.h:140
THREAD_ID _tid
Thread number (id)
Definition: Assembly.h:2303
void reinitFEFaceNeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
Definition: Assembly.C:1561
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:148
VectorVariablePhiGradient _vector_grad_phi
Definition: Assembly.h:2674
void reinitNeighborAtPhysical(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points)
Reinitializes the neighbor at the physical coordinates on neighbor side given.
Definition: Assembly.C:2410
std::vector< std::unique_ptr< FEBase > > _unique_fe_face_helper
Definition: Assembly.h:2323
QuadratureType
std::vector< std::vector< std::vector< unsigned char > > > _jacobian_block_nonlocal_used
Definition: Assembly.h:2295
std::vector< std::pair< MooseVariableScalar *, MooseVariableFieldBase * > > _cm_sf_entry
Entries in the coupling matrix for scalar variables vs field variables.
Definition: Assembly.h:2288
VectorVariablePhiValue _vector_phi_neighbor
Definition: Assembly.h:2685
void prepareNeighbor()
Definition: Assembly.C:2795
void resizeADMappingObjects(unsigned int n_qp, unsigned int dim)
resize any objects that contribute to automatic differentiation-related mapping calculations ...
Definition: Assembly.C:967
OutputTools< Real >::VariablePhiValue VariablePhiValue
Definition: MooseTypes.h:307
char jacobianBlockLowerUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
Return a flag to indicate if a particular coupling lower Jacobian block between ivar and jvar is used...
Definition: Assembly.h:2237
unsigned int m() const
ElemSideBuilder _current_neighbor_side_elem_builder
In place side element builder for _current_neighbor_side_elem.
Definition: Assembly.h:2829
VariablePhiValue & phi(const MooseVariableField< Real > &)
Definition: Assembly.h:1414
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_face_neighbor
Definition: Assembly.h:2502
std::map< FEType, bool > _need_second_derivative
Definition: Assembly.h:2818
const VariablePhiValue & phiFaceNeighbor(const MooseVariableField< Real > &) const
Definition: Assembly.h:1309
std::vector< bool > _component_block_diagonal
An flag array Indiced by variable index to show if there is no component-wise coupling for the variab...
Definition: Assembly.h:2771
Real _current_elem_volume
Volume of the current element.
Definition: Assembly.h:2555
OutputTools< RealVectorValue >::VariablePhiGradient VectorVariablePhiGradient
Definition: MooseTypes.h:325
std::map< FEType, FEBase * > _current_fe_face_neighbor
The "neighbor face" fe object that matches the current elem.
Definition: Assembly.h:2341
const MooseArray< ADReal > & adCurvatures() const
Definition: Assembly.C:4788
This class provides an interface for common operations on field variables of both FE and FV types wit...
const MooseArray< Point > & qPoints() const
Returns the reference to the quadrature points.
Definition: Assembly.h:222
std::map< FEType, FEVectorBase * > _current_vector_fe_face
The "face" vector fe object that matches the current elem.
Definition: Assembly.h:2346
QBase *const & writeableQRuleNeighbor()
Returns the reference to the current quadrature being used on a current neighbor. ...
Definition: Assembly.h:477
std::vector< std::unique_ptr< FEBase > > _unique_fe_helper
Containers for holding unique FE helper types if we are doing p-refinement.
Definition: Assembly.h:2322
std::vector< DualReal > _ad_dzetadx_map
Definition: Assembly.h:2795
void processLocalResidual(DenseVector< Number > &res_block, std::vector< dof_id_type > &dof_indices, const std::vector< Real > &scaling_factor, bool is_nodal)
Appling scaling, constraints to the local residual block and populate the full DoF indices for array ...
Definition: Assembly.C:3209
const FEType _helper_type
The finite element type of the FE helper classes.
Definition: Assembly.h:2311
const Elem *const & msmElem() const
Definition: Assembly.h:1909
void addResidualLower(GlobalDataKey, const std::vector< VectorTag > &vector_tags)
Add local neighbor residuals of all field variables for a set of tags onto the global residual vector...
Definition: Assembly.C:3368
DenseMatrix< Number > & jacobianBlock(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Get local Jacobian block for a pair of variables and a tag.
Definition: Assembly.h:1092
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
void addJacobianScalar(GlobalDataKey)
Add Jacobians for pairs of scalar variables into the global Jacobian matrices.
Definition: Assembly.C:4449
const bool & _computing_residual_and_jacobian
Whether we are currently computing the residual and Jacobian.
Definition: Assembly.h:2281
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Knn
jacobian contributions from the neighbor <Tag, ivar, jvar>
Definition: Assembly.h:2640
void saveLocalArrayResidual(DenseVector< Number > &re, unsigned int i, unsigned int ntest, const RealEigenVector &v) const
Helper function for assembling residual contriubutions on local quadrature points for an array kernel...
Definition: Assembly.h:1770
const ADTemplateVariablePhiGradient< T > & adGradPhi(const MooseVariableFE< T > &v) const
Definition: Assembly.h:1271
Base class for a system (of equations)
Definition: SystemBase.h:84
const std::vector< Eigen::Map< RealDIMValue > > & mappedNormals() const
Definition: Assembly.h:315
const QBase * attachQRuleElem(unsigned int dim, FEBase &fe)
Attaches the current elem/volume quadrature rule to the given fe.
Definition: Assembly.h:1856
const VariablePhiValue & phiNeighbor(const MooseVariableField< Real > &) const
Definition: Assembly.h:1296
void setVolumeQRule(QBase *qrule, unsigned int dim)
Set the qrule to be used for volume integration.
Definition: Assembly.C:652
FEGenericBase< RealGradient > FEVectorBase
VectorVariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1513
unsigned int numExtraElemIntegers() const
Number of extra element integers Assembly tracked.
Definition: Assembly.h:326
static const T *const & constify_ref(T *const &inref)
Workaround for C++ compilers thinking they can&#39;t just cast a const-reference-to-pointer to const-refe...
Definition: Assembly.h:104
std::vector< std::vector< Real > > _cached_jacobian_values
Values cached by calling cacheJacobian()
Definition: Assembly.h:2759
char jacobianBlockUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
Return a flag to indicate if a particular coupling Jacobian block between ivar and jvar is used...
Definition: Assembly.h:2201
VariablePhiValue _phi
Definition: Assembly.h:2656
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhiFaceNeighbor(FEType type) const
Definition: Assembly.h:1675
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > _cm_ff_entry
Entries in the coupling matrix for field variables.
Definition: Assembly.h:2284
void addJacobianNeighborLowerD(GlobalDataKey)
Add all portions of the Jacobian except PrimaryPrimary, e.g.
Definition: Assembly.C:3939
const MooseArray< Real > & mortarCoordTransformation() const
Returns the reference to the coordinate transformation coefficients on the mortar segment mesh...
Definition: Assembly.h:258
std::map< FEType, FEVectorBase * > _current_vector_fe
The "volume" vector fe object that matches the current elem.
Definition: Assembly.h:2344
VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1545
VariablePhiGradient _grad_phi
Definition: Assembly.h:2701
VariablePhiSecond & secondPhiNeighbor(const MooseVariableField< Real > &)
Definition: Assembly.h:1427
void prepareScalar()
Definition: Assembly.C:2941
DenseVector< Real > getJacobianDiagonal(DenseMatrix< Number > &ke)
Definition: Assembly.h:1840
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
ElemSideBuilder _compute_face_map_side_elem_builder
In place side element builder for computeFaceMap()
Definition: Assembly.h:2831
const dof_id_type & extraElemID(unsigned int id) const
Returns an integer ID of the current element given the index associated with the integer.
Definition: Assembly.h:331
void modifyFaceWeightsDueToXFEM(const Elem *elem, unsigned int side=0)
Update the face integration weights for XFEM partial elements.
Definition: Assembly.C:4547
const CouplingMatrix * _cm
Coupling matrices.
Definition: Assembly.h:2271
std::map< FEType, bool > _need_second_derivative_neighbor
Definition: Assembly.h:2819
void reinitElemAndNeighbor(const Elem *elem, unsigned int side, const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > *neighbor_reference_points=nullptr)
Reinitialize an element and its neighbor along a particular side.
Definition: Assembly.C:1987
const VectorVariablePhiSecond & secondPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1374
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiFace(FEType type) const
Definition: Assembly.h:1616
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhiFaceNeighbor(FEType type) const
Definition: Assembly.h:1741
OutputTools< Real >::VariablePhiSecond VariablePhiSecond
Definition: MooseTypes.h:309
const FEType & feType() const
Get the type of finite element object.
DenseVector< Number > _tmp_Re
auxiliary vector for scaling residuals (optimization to avoid expensive construction/destruction) ...
Definition: Assembly.h:2619
unsigned int _mesh_dimension
Definition: Assembly.h:2307
std::vector< Eigen::Map< RealDIMValue > > _mapped_normals
Mapped normals.
Definition: Assembly.h:2485
VectorVariablePhiDivergence _vector_div_phi_face
Definition: Assembly.h:2683
VectorVariablePhiCurl & curlPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1517
void cacheJacobian(GlobalDataKey)
Takes the values that are currently in _sub_Kee and appends them to the cached values.
Definition: Assembly.C:4054
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhiNeighbor(FEType type) const
Definition: Assembly.h:1732
void reinit(const Elem *elem)
Reinitialize objects (JxW, q_points, ...) for an elements.
Definition: Assembly.C:1811
const NumericVector< Real > * _scaling_vector
The map from global index to variable scaling factor.
Definition: Assembly.h:2824
void assignDisplacements(std::vector< std::pair< unsigned int, unsigned short >> &&disp_numbers_and_directions)
Assign the displacement numbers and directions.
Definition: Assembly.h:3169
QBase * _current_qrule_volume
The current volumetric quadrature for the element.
Definition: Assembly.h:2365
void addCachedResiduals(GlobalDataKey, const std::vector< VectorTag > &tags)
Pushes all cached residuals to the global residual vectors associated with each tag.
Definition: Assembly.C:3481
const DofMap & _dof_map
DOF map.
Definition: Assembly.h:2301
Data structure for tracking/grouping a set of quadrature rules for a particular dimensionality of mes...
Definition: Assembly.h:2383
std::vector< DualReal > _ad_dxidx_map
Definition: Assembly.h:2789
unsigned int _max_cached_jacobians
Definition: Assembly.h:2765
DenseMatrix< Number > & jacobianBlockMortar(Moose::ConstraintJacobianType type, unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Returns the jacobian block for the given mortar Jacobian type.
Definition: Assembly.C:3149
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Ken
jacobian contributions from the element and neighbor <Tag, ivar, jvar>
Definition: Assembly.h:2636
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_dual_lower
Definition: Assembly.h:2731
const CouplingMatrix & _nonlocal_cm
Definition: Assembly.h:2272
Nonlinear system to be solved.
VectorVariablePhiValue _vector_phi_face
Definition: Assembly.h:2679
const VectorVariablePhiSecond & secondPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1351
std::vector< Point > _temp_reference_points
Temporary work data for reinitAtPhysical()
Definition: Assembly.h:2777
std::vector< std::pair< MooseVariableScalar *, MooseVariableScalar * > > _cm_ss_entry
Entries in the coupling matrix for scalar variables.
Definition: Assembly.h:2290
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kne
jacobian contributions from the neighbor and element <Tag, ivar, jvar>
Definition: Assembly.h:2638
const Elem * _current_neighbor_lower_d_elem
The current neighboring lower dimensional element.
Definition: Assembly.h:2586
OutputTools< RealVectorValue >::VariablePhiDivergence VectorVariablePhiDivergence
Definition: MooseTypes.h:328
unsigned int _current_neighbor_side
The current side of the selected neighboring element (valid only when working with sides) ...
Definition: Assembly.h:2567
void cacheResidualNodes(const DenseVector< Number > &res, const std::vector< dof_id_type > &dof_index, LocalDataKey, TagID tag)
Lets an external class cache residual at a set of nodes.
Definition: Assembly.C:3433
VectorVariablePhiSecond & secondPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1493
void prepareLowerD()
Prepare the Jacobians and residuals for a lower dimensional element.
Definition: Assembly.C:2834
bool _user_added_fe_neighbor_of_helper_type
Definition: Assembly.h:2317
QBase *const & writeableQRuleFace()
Returns the reference to the current quadrature being used on a current face.
Definition: Assembly.h:292
void buildFaceNeighborFE(FEType type) const
Build FEs for a neighbor face with a type.
Definition: Assembly.C:334
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_face
Definition: Assembly.h:2727
void reinitLowerDElem(const Elem *elem, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr)
Reinitialize FE data for a lower dimenesional element with a given set of reference points...
Definition: Assembly.C:2282
void computeCurrentFaceVolume()
Definition: Assembly.C:1761
const VectorVariablePhiCurl & curlPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1378
std::vector< std::vector< DenseVector< Number > > > _sub_Rl
residual contributions for each variable from the lower dimensional element
Definition: Assembly.h:2616
VariablePhiCurl _curl_phi
Definition: Assembly.h:2703
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:35
QRules & qrules(unsigned int dim)
Definition: Assembly.h:2443
static const subdomain_id_type invalid_subdomain_id
VectorVariablePhiGradient _vector_grad_phi_face_neighbor
Definition: Assembly.h:2692
void prepareOffDiagScalar()
Definition: Assembly.C:2965
VectorVariablePhiSecond _second_phi
Definition: Assembly.h:2712
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhiFace(FEType type) const
Definition: Assembly.h:1723
bool needDual() const
Indicates whether dual shape functions are used (computation is now repeated on each element so expen...
Definition: Assembly.h:573
Implements a fake quadrature rule where you can specify the locations (in the reference domain) of th...
void addJacobianCoupledVarPair(const MooseVariableBase &ivar, const MooseVariableBase &jvar)
Adds element matrices for ivar rows and jvar columns to the global Jacobian matrices.
Definition: Assembly.C:3851
void addJacobianLowerD(GlobalDataKey)
Add portions of the Jacobian of LowerLower, LowerSecondary, and SecondaryLower for boundary condition...
Definition: Assembly.C:4017
QBase * _current_qrule_neighbor
quadrature rule used on neighbors
Definition: Assembly.h:2516
std::vector< DualReal > _ad_dxidz_map
Definition: Assembly.h:2791
char jacobianBlockNonlocalUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
Return a flag to indicate if a particular coupling nonlocal Jacobian block between ivar and jvar is u...
Definition: Assembly.h:2255
VectorVariablePhiGradient _grad_phi
Definition: Assembly.h:2711
ArbitraryQuadrature * _current_qrule_arbitrary_face
The current arbitrary quadrature rule used on the element face.
Definition: Assembly.h:2369
const MooseArray< ADReal > & adCoordTransformation() const
Returns the reference to the AD version of the coordinate transformation coefficients.
Definition: Assembly.h:264
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhiFaceNeighbor(FEType type) const
Definition: Assembly.h:1707
void modifyArbitraryWeights(const std::vector< Real > &weights)
Modify the weights when using the arbitrary quadrature rule.
Definition: Assembly.C:4574
FEBase * _current_fe_face_helper
helper object for transforming coordinates
Definition: Assembly.h:2473
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableScalar * > > _cm_fs_entry
Entries in the coupling matrix for field variables vs scalar variables.
Definition: Assembly.h:2286
const std::vector< Real > * _JxW_msm
A JxW for working on mortar segement elements.
Definition: Assembly.h:2532
std::unique_ptr< QBase > face
area/face (meshdim-1) quadrature rule
Definition: Assembly.h:2397
dof_id_type numeric_index_type
std::map< FEType, ADTemplateVariablePhiGradient< Real > > _ad_grad_phi_data
Definition: Assembly.h:2733
std::unordered_map< SubdomainID, std::vector< QRules > > _qrules
Holds quadrature rules for each dimension.
Definition: Assembly.h:2412
const MooseArray< Point > & normals() const
Returns the array of normals for quadrature points on a current side.
Definition: Assembly.h:310
MooseVariableFE< RealEigenVector > ArrayMooseVariable
Definition: Assembly.h:62
const VectorVariablePhiGradient & gradPhi(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1326
const QBase *const & qRuleNeighbor() const
Returns the reference to the current quadrature being used on a current neighbor. ...
Definition: Assembly.h:471
void prepareResidual()
Sizes and zeroes the residual for the current element.
Definition: Assembly.C:2700
VectorVariablePhiCurl _curl_phi
Definition: Assembly.h:2713
std::map< FEType, FEBase * > _current_fe_neighbor
The "neighbor" fe object that matches the current elem.
Definition: Assembly.h:2339
const ADTemplateVariablePhiGradient< OutputType > & feADGradPhi(FEType type) const
Definition: Assembly.h:1582
Real elementVolume(const Elem *elem) const
On-demand computation of volume element accounting for RZ/RSpherical.
Definition: Assembly.C:3778
VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< Real > &)
Definition: Assembly.h:1440
void cacheJacobianNeighbor(GlobalDataKey)
Takes the values that are currently in the neighbor Dense Matrices and appends them to the cached val...
Definition: Assembly.C:4106
SubdomainID _current_neighbor_subdomain_id
The current neighbor subdomain ID.
Definition: Assembly.h:2565
QBase *const & writeableQRule()
Returns the reference to the current quadrature being used.
Definition: Assembly.h:216
VectorVariablePhiValue _vector_phi_face_neighbor
Definition: Assembly.h:2691
VariablePhiSecond & secondPhi(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1529
VariablePhiValue & phiFaceNeighbor(const MooseVariableField< Real > &)
Definition: Assembly.h:1432
const VectorVariablePhiCurl & curlPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1355
std::vector< std::vector< DenseVector< Number > > > _sub_Re
Definition: Assembly.h:2613
VectorVariablePhiSecond & secondPhiFace(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1472
OutputTools< RealVectorValue >::VariablePhiSecond VectorVariablePhiSecond
Definition: MooseTypes.h:326
boundary_id_type BoundaryID
void reinitNeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
Reinitializes the neighbor side using reference coordinates.
Definition: Assembly.C:1675
A NodeFaceConstraint is used when you need to create constraints between two surfaces in a mesh...
const MooseArray< Real > & coordTransformation() const
Returns the reference to the coordinate transformation coefficients.
Definition: Assembly.h:252
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhiNeighbor(FEType type) const
Definition: Assembly.h:1699
const Real & lowerDElemVolume() const
Definition: Assembly.h:3155
VectorVariablePhiDivergence _vector_div_phi_neighbor
Definition: Assembly.h:2689
QRules & qrules(unsigned int dim, SubdomainID block)
This is a helper function for accessing quadrature rules for a particular dimensionality of element...
Definition: Assembly.h:2448
std::vector< std::vector< std::vector< unsigned char > > > _jacobian_block_used
Flag that indicates if the jacobian block was used.
Definition: Assembly.h:2294
void prepare()
Definition: Assembly.C:2709
void setFaceQRule(QBase *qrule, unsigned int dim)
Set the qrule to be used for face integration.
Definition: Assembly.C:671
void cacheJacobianWithoutConstraints(const Residuals &residuals, const Indices &row_indices, Real scaling_factor, LocalDataKey, const std::set< TagID > &matrix_tags)
Process the derivatives() data of a vector of ADReals.
Definition: Assembly.h:3127
VariablePhiGradient & gradPhiFace(const MooseVariableField< Real > &)
Definition: Assembly.h:1419
std::vector< DualReal > _ad_jac
Definition: Assembly.h:2786
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
SubProblem & _subproblem
Definition: Assembly.h:2266
const VariablePhiGradient & gradPhi(const MooseVariableField< Real > &) const
Definition: Assembly.h:1277
void buildFaceFE(FEType type) const
Build FEs for a face with a type.
Definition: Assembly.C:290
const QBase * attachQRuleFace(unsigned int dim, FEBase &fe)
Attaches the current face/area quadrature rule to the given fe.
Definition: Assembly.h:1868
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_neighbor
types of finite elements
Definition: Assembly.h:2499
DenseVector< Number > & residualBlockLower(unsigned int var_num, LocalDataKey, TagID tag_id)
Get residual block for lower.
Definition: Assembly.h:1083
void cacheResidual(GlobalDataKey, const std::vector< VectorTag > &tags)
Takes the values that are currently in _sub_Re of all field variables and appends them to the cached ...
Definition: Assembly.C:3400
bool _calculate_xyz
Definition: Assembly.h:2810
MooseArray< std::vector< Point > > _current_tangents
The current tangent vectors at the quadrature points.
Definition: Assembly.h:2487
bool _calculate_curvatures
Definition: Assembly.h:2812
VariablePhiGradient _grad_phi_face_neighbor
Definition: Assembly.h:2669
const std::vector< VectorTag > & _residual_vector_tags
The residual vector tags that Assembly could possibly contribute to.
Definition: Assembly.h:2748
std::map< FEType, FEVectorBase * > _current_vector_fe_face_neighbor
The "neighbor face" vector fe object that matches the current elem.
Definition: Assembly.h:2350
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhiFace(FEType type) const
Definition: Assembly.h:1691
std::vector< dof_id_type > _neighbor_extra_elem_ids
Extra element IDs of neighbor.
Definition: Assembly.h:2492
MooseArray< Real > _current_JxW
The current list of transformed jacobian weights.
Definition: Assembly.h:2373
void havePRefinement(const std::vector< FEFamily > &disable_p_refinement_for_families)
Indicate that we have p-refinement.
Definition: Assembly.C:4834
std::vector< std::pair< unsigned int, unsigned short > > _disp_numbers_and_directions
Container of displacement numbers and directions.
Definition: Assembly.h:2808
VectorVariablePhiDivergence & divPhi(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1459
std::vector< dof_id_type > _temp_dof_indices
Temporary work vector to keep from reallocating it.
Definition: Assembly.h:2774
OutputTools< Real >::VariablePhiCurl VariablePhiCurl
Definition: MooseTypes.h:310
const QBase *const & qRule() const
Returns the reference to the current quadrature being used.
Definition: Assembly.h:210
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kee
Definition: Assembly.h:2632
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_lower
Definition: Assembly.h:2730
VectorVariablePhiValue & phiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1485
const VariablePhiSecond & secondPhiFace(const MooseVariableField< Real > &) const
Definition: Assembly.h:1291
std::map< FEType, ADTemplateVariablePhiGradient< RealVectorValue > > _ad_vector_grad_phi_data
Definition: Assembly.h:2734
VariablePhiGradient _grad_phi_neighbor
Definition: Assembly.h:2665
const Real & elemVolume()
Returns the reference to the current element volume.
Definition: Assembly.h:393
ArbitraryQuadrature * _current_qface_arbitrary
The current arbitrary quadrature rule used on element faces.
Definition: Assembly.h:2477
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_face
types of vector finite elements
Definition: Assembly.h:2469
VariablePhiValue _phi_face
Definition: Assembly.h:2660
VectorVariablePhiSecond _vector_second_phi
Definition: Assembly.h:2675
subdomain_id_type SubdomainID
const std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & couplingEntries() const
Definition: Assembly.h:1248
const OutputTools< OutputType >::VariablePhiGradient & feGradPhi(FEType type) const
Definition: Assembly.h:1575
const Elem * _msm_elem
Definition: Assembly.h:2833
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic > RealEigenMatrix
Definition: MooseTypes.h:141
QBase * qruleFace(const Elem *elem, unsigned int side)
This is an abstraction over the internal qrules function.
Definition: Assembly.C:1910
bool _calculate_ad_coord
Whether to calculate coord with AD.
Definition: Assembly.h:2816
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_lower
Definition: Assembly.h:2722
const Elem * _current_lower_d_elem
The current lower dimensional element.
Definition: Assembly.h:2584
GlobalDataKey(const GlobalDataKey &)
Definition: Assembly.h:804
void addResidualBlock(NumericVector< Number > &residual, DenseVector< Number > &res_block, const std::vector< dof_id_type > &dof_indices, const std::vector< Real > &scaling_factor, bool is_nodal)
Add a local residual block to a global residual vector with proper scaling.
Definition: Assembly.C:3245
void addResidual(GlobalDataKey, const std::vector< VectorTag > &vector_tags)
Add local residuals of all field variables for a set of tags onto the global residual vectors associa...
Definition: Assembly.C:3318
void addJacobianNeighborTags(SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const DofMap &dof_map, std::vector< dof_id_type > &dof_indices, std::vector< dof_id_type > &neighbor_dof_indices, GlobalDataKey, const std::set< TagID > &tags)
Adds three neighboring element matrices for ivar rows and jvar columns to the global Jacobian matrix...
Definition: Assembly.C:4434
std::vector< VectorValue< DualReal > > _ad_dxyzdeta_map
Definition: Assembly.h:2781
const VariablePhiValue & phiFace() const
Definition: Assembly.h:1284
bool computingResidualAndJacobian() const
Definition: Assembly.h:1904
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_lower
FE objects for lower dimensional elements.
Definition: Assembly.h:2509
const VectorVariablePhiCurl & curlPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1403
FEGenericBase< Real > FEBase
void cacheResiduals(const Residuals &residuals, const Indices &row_indices, Real scaling_factor, LocalDataKey, const std::set< TagID > &vector_tags)
Process the supplied residual values.
Definition: Assembly.h:3008
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiLower(FEType type) const
Definition: Assembly.h:2875
void addJacobianBlockNonlocalTags(SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const DofMap &dof_map, const std::vector< dof_id_type > &idof_indices, const std::vector< dof_id_type > &jdof_indices, GlobalDataKey, const std::set< TagID > &tags)
Adds non-local element matrix for ivar rows and jvar columns to the global Jacobian matrix...
Definition: Assembly.C:4350
VariablePhiValue _phi_face_neighbor
Definition: Assembly.h:2668
OutputTools< Real >::VariablePhiDivergence VariablePhiDivergence
Definition: MooseTypes.h:311
Real _current_lower_d_elem_volume
The current lower dimensional element volume.
Definition: Assembly.h:2590
const OutputTools< OutputType >::VariablePhiValue & fePhiNeighbor(FEType type) const
Definition: Assembly.h:1637
std::map< unsigned int, std::map< FEType, FEBase * > > _fe
Each dimension&#39;s actual fe objects indexed on type.
Definition: Assembly.h:2355
const VariablePhiSecond & secondPhi(const MooseVariableField< Real > &) const
Definition: Assembly.h:1279
VariablePhiValue _phi_neighbor
Definition: Assembly.h:2664
const Node *const & nodeNeighbor() const
Returns the reference to the neighboring node.
Definition: Assembly.h:501
const MooseArray< Real > & JxW() const
Returns the reference to the transformed jacobian weights.
Definition: Assembly.h:240
void reinitMortarElem(const Elem *elem)
reinitialize a mortar segment mesh element in order to get a proper JxW
Definition: Assembly.C:2396
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiFaceNeighbor(FEType type) const
Definition: Assembly.h:1667
Real _current_side_volume
Volume of the current side element.
Definition: Assembly.h:2561
VectorVariablePhiCurl _vector_curl_phi
Definition: Assembly.h:2676
std::vector< std::vector< Real > > _cached_residual_values
Values cached by calling cacheResidual() (the first vector is for TIME vs NONTIME) ...
Definition: Assembly.h:2751
const bool _displaced
Definition: Assembly.h:2268
void buildVectorFE(FEType type) const
Build Vector FEs with a type.
Definition: Assembly.C:451
VectorVariablePhiCurl _vector_curl_phi_face_neighbor
Definition: Assembly.h:2694
MooseArray< DualReal > _ad_curvatures
Definition: Assembly.h:2803
void reinitFVFace(const FaceInfo &fi)
Definition: Assembly.C:1850
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_lower
Vector FE objects for lower dimensional elements.
Definition: Assembly.h:2511
const MooseArray< Real > & JxWFace() const
Returns the reference to the transformed jacobian weights on a current face.
Definition: Assembly.h:304
const MooseArray< Real > & JxWNeighbor() const
Returns the reference to the transformed jacobian weights on a current face.
Definition: Assembly.C:257
std::vector< VectorValue< DualReal > > _ad_d2xyzdxideta_map
Definition: Assembly.h:2784
const Node * _current_node
The current node we are working with.
Definition: Assembly.h:2575
bool _building_helpers
Whether we are currently building the FE classes for the helpers.
Definition: Assembly.h:2329
bool _calculate_face_xyz
Definition: Assembly.h:2811
This is the XFEMInterface class.
Definition: XFEMInterface.h:37
DGJacobianType
Definition: MooseTypes.h:662
const MooseArray< MooseADWrapper< Point, is_ad > > & genericQPoints() const
OutputTools< Real >::VariablePhiGradient VariablePhiGradient
Definition: MooseTypes.h:308
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_face_neighbor
Definition: Assembly.h:2729
void addJacobian(GlobalDataKey)
Adds all local Jacobian to the global Jacobian matrices.
Definition: Assembly.C:3866
MooseArray< Point > _current_normals
The current Normal vectors at the quadrature points.
Definition: Assembly.h:2483
void buildVectorFaceFE(FEType type) const
Build Vector FEs for a face with a type.
Definition: Assembly.C:484
const QBase *const & qRuleFace() const
Returns the reference to the current quadrature being used on a current face.
Definition: Assembly.h:286
const SubdomainID ANY_BLOCK_ID
Definition: MooseTypes.C:19
void setCurrentSubdomainID(SubdomainID i)
set the current subdomain ID
Definition: Assembly.h:377
const std::vector< std::pair< MooseVariableScalar *, MooseVariableFieldBase * > > & scalarFieldCouplingEntries() const
Definition: Assembly.h:1263
const MooseArray< ADReal > & adJxWFace() const
Definition: Assembly.h:244
const VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< Real > &) const
Definition: Assembly.h:1300
VectorVariablePhiGradient _vector_grad_phi_face
Definition: Assembly.h:2680
VariablePhiValue & phiNeighbor(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1541
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VectorVariablePhiDivergence & divPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1359
void hasScalingVector()
signals this object that a vector containing variable scaling factors should be used when doing resid...
Definition: Assembly.C:4568
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:75
const VectorVariablePhiDivergence & divPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1408
VariablePhiGradient & gradPhi(const MooseVariableField< Real > &)
Definition: Assembly.h:1415
OutputTools< RealVectorValue >::VariablePhiValue VectorVariablePhiValue
Definition: MooseTypes.h:324
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhi(FEType type) const
Definition: Assembly.h:1715
void setNeighborQRule(QBase *qrule, unsigned int dim)
Set the qrule to be used for neighbor integration.
Definition: Assembly.C:706
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_dual_lower
Definition: Assembly.h:2723
void zeroCachedJacobian(GlobalDataKey)
Zero out previously-cached Jacobian rows.
Definition: Assembly.C:4506
std::vector< VectorValue< DualReal > > _ad_dxyzdzeta_map
Definition: Assembly.h:2782
CoordinateSystemType
Definition: MooseTypes.h:722
void setCoordinateTransformation(const QBase *qrule, const Points &q_points, Coords &coord, SubdomainID sub_id)
Definition: Assembly.C:1719
const VectorVariablePhiGradient & gradPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1369
void reinitNeighborFaceRef(const Elem *neighbor_elem, unsigned int neighbor_side, Real tolerance, const std::vector< Point > *const pts, const std::vector< Real > *const weights=nullptr)
Reinitialize FE data for the given neighbor_element on the given side with a given set of reference p...
Definition: Assembly.C:2186
bool computingResidual() const
Definition: Assembly.h:1894
void activateDual()
Indicates that dual shape functions are used for mortar constraint.
Definition: Assembly.h:567
void prepareVariableNonlocal(MooseVariableFieldBase *var)
Definition: Assembly.C:2768
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_face
Definition: Assembly.h:2719
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data
Shape function values, gradients, second derivatives for each vector FE type.
Definition: Assembly.h:2726
const VariablePhiGradient & gradPhiFace(const MooseVariableField< Real > &) const
Definition: Assembly.h:1287
void addResidualScalar(GlobalDataKey, const std::vector< VectorTag > &vector_tags)
Add residuals of all scalar variables for a set of tags onto the global residual vectors associated w...
Definition: Assembly.C:3392
MooseArray< Real > _coord_msm
The coordinate transformation coefficients evaluated on the quadrature points of the mortar segment m...
Definition: Assembly.h:2527
DenseVector< Number > & residualBlockNeighbor(unsigned int var_num, LocalDataKey, TagID tag_id)
Get local neighbor residual block for a variable and a tag.
Definition: Assembly.h:1074
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Keg
Definition: Assembly.h:2633
VariablePhiValue & phiFaceNeighbor(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1554
bool _need_lower_d_elem_volume
Whether we need to compute the lower dimensional element volume.
Definition: Assembly.h:2588
LocalDataKey(const LocalDataKey &)
Definition: Assembly.h:818
bool _user_added_fe_face_of_helper_type
Definition: Assembly.h:2315
const MooseArray< Point > & qPointsFace() const
Returns the reference to the current quadrature being used.
Definition: Assembly.h:298
DenseVector< Number > & residualBlock(unsigned int var_num, LocalDataKey, TagID tag_id)
Get local residual block for a variable and a tag.
Definition: Assembly.h:1065
VectorVariablePhiValue & phi(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1446
void buildVectorNeighborFE(FEType type) const
Build Vector FEs for a neighbor with a type.
Definition: Assembly.C:513
std::unique_ptr< ArbitraryQuadrature > arbitrary_vol
volume/elem (meshdim) custom points quadrature rule
Definition: Assembly.h:2401
void reinitFENeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
Definition: Assembly.C:1620
const VectorVariablePhiValue & phiFace(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1343
void initNonlocalCoupling()
Create pair of variables requiring nonlocal jacobian contributions.
Definition: Assembly.C:2643
ConstraintJacobianType
Definition: MooseTypes.h:709
const VectorVariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1393
const QBase *const & qRuleMortar() const
Returns a reference to the quadrature rule for the mortar segments.
Definition: Assembly.h:662
std::map< unsigned int, FEBase * > _holder_fe_face_helper
Each dimension&#39;s helper objects.
Definition: Assembly.h:2471
const bool & _computing_jacobian
Whether we are currently computing the Jacobian.
Definition: Assembly.h:2278
void computeCurrentNeighborVolume()
void setLowerQRule(QBase *qrule, unsigned int dim)
Set the qrule to be used for lower dimensional integration.
Definition: Assembly.C:687
VariablePhiSecond & secondPhiFace(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1536
const Elem *const & neighbor() const
Return the neighbor element.
Definition: Assembly.h:423
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_neighbor
Definition: Assembly.h:2501
char jacobianBlockNeighborUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
Return a flag to indicate if a particular coupling neighbor Jacobian block between ivar and jvar is u...
Definition: Assembly.h:2219
void resize(const unsigned int new_m, const unsigned int new_n)
const OutputTools< OutputType >::VariablePhiValue & fePhiFaceNeighbor(FEType type) const
Definition: Assembly.h:1659
VariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< Real > &)
Definition: Assembly.h:1436
void cacheJacobianNonlocal(GlobalDataKey)
Takes the values that are currently in _sub_Keg and appends them to the cached values.
Definition: Assembly.C:4084
Class for scalar variables (they are different).
const VariablePhiValue & phiFace(const MooseVariableField< Real > &) const
Definition: Assembly.h:1285
VariablePhiValue & phiNeighbor(const MooseVariableField< Real > &)
Definition: Assembly.h:1422
VectorVariablePhiDivergence & divPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1501
std::vector< std::unique_ptr< FEBase > > _unique_fe_face_neighbor_helper
Definition: Assembly.h:2324
void computeSinglePointMapAD(const Elem *elem, const std::vector< Real > &qw, unsigned p, FEBase *fe)
compute the finite element reference-physical mapping quantities (such as JxW) with possible dependen...
Definition: Assembly.C:997
void helpersRequestData()
request phi, dphi, xyz, JxW, etc.
Definition: Assembly.C:4801
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > _cm_nonlocal_entry
Entries in the coupling matrix for field variables for nonlocal calculations.
Definition: Assembly.h:2292
void addJacobianOffDiagScalar(unsigned int ivar, GlobalDataKey)
Add Jacobians for a scalar variables with all other field variables into the global Jacobian matrices...
Definition: Assembly.C:4456
std::vector< dof_id_type > _row_indices
Working vectors to avoid repeated heap allocations when caching residuals/Jacobians that must have li...
Definition: Assembly.h:2848
VectorVariablePhiSecond _vector_second_phi_face_neighbor
Definition: Assembly.h:2693
std::vector< DualReal > _ad_detadx_map
Definition: Assembly.h:2792
void buildLowerDFE(FEType type) const
Build FEs for a lower dimensional element with a type.
Definition: Assembly.C:356
unsigned int _current_side
The current side of the selected element (valid only when working with sides)
Definition: Assembly.h:2557
const VectorVariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1398
void setCachedJacobian(GlobalDataKey)
Sets previously-cached Jacobian values via SparseMatrix::set() calls.
Definition: Assembly.C:4486
VariablePhiSecond _second_phi
Definition: Assembly.h:2702
std::map< unsigned int, FEBase * > _holder_fe_helper
Each dimension&#39;s helper objects.
Definition: Assembly.h:2359
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhiNeighbor(FEType type) const
Definition: Assembly.h:1651
const FEVectorBase *const & getVectorFEFaceNeighbor(FEType type, unsigned int dim) const
GetVector a reference to a pointer that will contain the current "neighbor" FE.
Definition: Assembly.h:200
BoundaryID _current_boundary_id
The current boundary ID.
Definition: Assembly.h:2553
const OutputTools< OutputType >::VariablePhiGradient & feGradDualPhiLower(FEType type) const
Definition: Assembly.h:2883
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhiFace(FEType type) const
Definition: Assembly.h:1629
void prepareVariable(MooseVariableFieldBase *var)
Used for preparing the dense residual and jacobian blocks for one particular variable.
Definition: Assembly.C:2740
const Elem * _current_neighbor_side_elem
The current side element of the ncurrent neighbor element.
Definition: Assembly.h:2569
DenseMatrix< Number > _element_matrix
A working matrix to avoid repeated heap allocations when caching Jacobians that must have libMesh-lev...
Definition: Assembly.h:2843
void reinitElemFaceRef(const Elem *elem, unsigned int elem_side, Real tolerance, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr)
Reinitialize FE data for the given element on the given side, optionally with a given set of referenc...
Definition: Assembly.C:2015
void copyFaceShapes(MooseVariableField< T > &v)
Definition: Assembly.C:3028
std::vector< dof_id_type > _extra_elem_ids
Extra element IDs.
Definition: Assembly.h:2490
void clearCachedQRules()
Set the cached quadrature rules to nullptr.
Definition: Assembly.C:723
void addResidualNeighbor(GlobalDataKey, const std::vector< VectorTag > &vector_tags)
Add local neighbor residuals of all field variables for a set of tags onto the global residual vector...
Definition: Assembly.C:3343
bool _current_side_volume_computed
Boolean to indicate whether current element side volumes has been computed.
Definition: Assembly.h:2581
std::map< FEType, ADTemplateVariablePhiGradient< RealVectorValue > > _ad_vector_grad_phi_data_face
Definition: Assembly.h:2737
std::vector< VectorValue< DualReal > > _ad_d2xyzdeta2_map
Definition: Assembly.h:2785
std::vector< dof_id_type > _column_indices
Definition: Assembly.h:2848
void jacobianBlockNeighborUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
Sets whether or not neighbor Jacobian coupling between ivar and jvar is used to the value used...
Definition: Assembly.h:2210
std::unique_ptr< ArbitraryQuadrature > arbitrary_face
area/face (meshdim-1) custom points quadrature rule
Definition: Assembly.h:2403
const Real & sideElemVolume()
Returns the reference to the volume of current side element.
Definition: Assembly.h:417
Eigen::Matrix< Real, Eigen::Dynamic, 1 > RealEigenVector
Definition: MooseTypes.h:138
const VariablePhiValue & phi(const MooseVariableField< Real > &) const
Definition: Assembly.h:1275
const std::vector< Point > & qPointsMortar() const
Returns the reference to the mortar segment element quadrature points.
Definition: Assembly.h:228
const SubdomainID & currentSubdomainID() const
Return the current subdomain ID.
Definition: Assembly.h:372
void prepareBlock(unsigned int ivar, unsigned jvar, const std::vector< dof_id_type > &dof_indices)
Definition: Assembly.C:2890
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_face_neighbor
Definition: Assembly.h:2500
void addJacobianNeighbor(GlobalDataKey)
Add ElementNeighbor, NeighborElement, and NeighborNeighbor portions of the Jacobian for compute objec...
Definition: Assembly.C:3901
std::vector< std::vector< std::vector< unsigned char > > > _jacobian_block_lower_used
Flag that indicates if the jacobian block for the lower dimensional element was used.
Definition: Assembly.h:2299
VectorVariablePhiDivergence _div_phi
Definition: Assembly.h:2714
VectorVariablePhiDivergence & divPhiFace(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1480
OutputTools< RealVectorValue >::VariablePhiCurl VectorVariablePhiCurl
Definition: MooseTypes.h:327
void cacheJacobianBlock(DenseMatrix< Number > &jac_block, const std::vector< dof_id_type > &idof_indices, const std::vector< dof_id_type > &jdof_indices, Real scaling_factor, LocalDataKey, TagID tag)
Cache a local Jacobian block with the provided rows (idof_indices) and columns (jdof_indices) for eve...
Definition: Assembly.C:3743
const Moose::CoordinateSystemType & coordSystem()
Get the coordinate system type.
Definition: Assembly.h:280
bool _custom_mortar_qrule
Flag specifying whether a custom quadrature rule has been specified for mortar segment mesh...
Definition: Assembly.h:2541
const unsigned int & side() const
Returns the current side.
Definition: Assembly.h:399
const FEBase *const & getFE(FEType type, unsigned int dim) const
Get a reference to a pointer that will contain the current volume FE.
Definition: Assembly.h:116
void computeCurrentElemVolume()
Definition: Assembly.C:1742
void cacheJacobianBlockNonzero(DenseMatrix< Number > &jac_block, const MooseVariableBase &ivar, const MooseVariableBase &jvar, const std::vector< dof_id_type > &idof_indices, const std::vector< dof_id_type > &jdof_indices, TagID tag)
Push non-zeros of a local Jacobian block with proper scaling into cache for a certain tag...
Definition: Assembly.C:3685
bool computingJacobian() const
Definition: Assembly.h:1899
Real _current_neighbor_lower_d_elem_volume
The current neighboring lower dimensional element volume.
Definition: Assembly.h:2594
bool _need_neighbor_lower_d_elem_volume
Whether we need to compute the neighboring lower dimensional element volume.
Definition: Assembly.h:2592
MooseArray< Point > _current_q_points
The current list of quadrature points.
Definition: Assembly.h:2371
bool _user_added_fe_of_helper_type
Whether user code requested a FEType the same as our _helper_type.
Definition: Assembly.h:2314
Moose::CoordinateSystemType _coord_type
The coordinate system.
Definition: Assembly.h:2375
void cacheJacobianMortar(GlobalDataKey)
Cache all portions of the Jacobian, e.g.
Definition: Assembly.C:4144
std::unique_ptr< ArbitraryQuadrature > neighbor
area/face (meshdim-1) custom points quadrature rule for DG
Definition: Assembly.h:2405
void addJacobianBlock(SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const DofMap &dof_map, std::vector< dof_id_type > &dof_indices, GlobalDataKey, TagID tag)
Adds element matrix for ivar rows and jvar columns to the global Jacobian matrix. ...
Definition: Assembly.C:4237
unsigned int n() const
void buildVectorFaceNeighborFE(FEType type) const
Build Vector FEs for a neighbor face with a type.
Definition: Assembly.C:542
void buildVectorDualLowerDFE(FEType type) const
Definition: Assembly.C:426
void bumpVolumeQRuleOrder(Order volume_order, SubdomainID block)
Increases the element/volume quadrature order for the specified mesh block if and only if the current...
Definition: Assembly.C:572
const SubdomainID & currentNeighborSubdomainID() const
Return the current subdomain ID.
Definition: Assembly.h:450
VectorVariablePhiSecond _vector_second_phi_neighbor
Definition: Assembly.h:2687
void saveFullLocalArrayJacobian(DenseMatrix< Number > &ke, unsigned int i, unsigned int ntest, unsigned int j, unsigned int nphi, unsigned int ivar, unsigned int jvar, const RealEigenMatrix &v) const
Helper function for assembling full Jacobian contriubutions on local quadrature points for an array k...
Definition: Assembly.h:1814
Storage for all of the information pretaining to a vector tag.
Definition: VectorTag.h:15
VectorVariablePhiDivergence & divPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1521
const Node *const & node() const
Returns the reference to the node.
Definition: Assembly.h:495
VariablePhiSecond _second_phi
Definition: Assembly.h:2658
std::vector< std::vector< std::vector< unsigned char > > > _jacobian_block_neighbor_used
Flag that indicates if the jacobian block for neighbor was used.
Definition: Assembly.h:2297
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiNeighbor(FEType type) const
Definition: Assembly.h:1644
std::map< unsigned int, FEBase * > _holder_fe_lower_helper
helper object for transforming coordinates for lower dimensional element quadrature points ...
Definition: Assembly.h:2513
VectorVariablePhiDivergence _vector_div_phi
Definition: Assembly.h:2677
void setCurrentNeighborSubdomainID(SubdomainID i)
set the current subdomain ID
Definition: Assembly.h:455
void computeADFace(const Elem &elem, const unsigned int side)
compute AD things on an element face
Definition: Assembly.C:2107
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_neighbor
Definition: Assembly.h:2728
std::vector< DualReal > _ad_detady_map
Definition: Assembly.h:2793
void setResidual(NumericVector< Number > &residual, GlobalDataKey, const VectorTag &vector_tag)
Sets local residuals of all field variables to the global residual vector for a tag.
Definition: Assembly.C:3544
std::vector< std::vector< dof_id_type > > _cached_jacobian_cols
Column where the corresponding cached value should go.
Definition: Assembly.h:2763
void addCachedJacobian(GlobalDataKey)
Adds the values that have been cached by calling cacheJacobian() and or cacheJacobianNeighbor() to th...
Definition: Assembly.C:3811
void addJacobianBlockTags(SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const DofMap &dof_map, std::vector< dof_id_type > &dof_indices, GlobalDataKey, const std::set< TagID > &tags)
Add element matrix for ivar rows and jvar columns to the global Jacobian matrix for given tags...
Definition: Assembly.C:4224
MooseArray< Point > _current_q_points_face
The current quadrature points on a face.
Definition: Assembly.h:2479
void cacheResidualBlock(std::vector< Real > &cached_residual_values, std::vector< dof_id_type > &cached_residual_rows, DenseVector< Number > &res_block, const std::vector< dof_id_type > &dof_indices, const std::vector< Real > &scaling_factor, bool is_nodal)
Push a local residual block with proper scaling into cache.
Definition: Assembly.C:3261
void prepareBlockNonlocal(unsigned int ivar, unsigned jvar, const std::vector< dof_id_type > &idof_indices, const std::vector< dof_id_type > &jdof_indices)
Definition: Assembly.C:2915
void bumpAllQRuleOrder(Order order, SubdomainID block)
Increases the element/volume and face/area quadrature orders for the specified mesh block if and only...
Definition: Assembly.C:595
const Elem *const & lowerDElem() const
Return the lower dimensional element.
Definition: Assembly.h:429
const VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< Real > &) const
Definition: Assembly.h:1317
const Elem * _current_side_elem
The current "element" making up the side we are currently on.
Definition: Assembly.h:2559
const MooseArray< std::vector< Point > > & tangents() const
Returns the array of tangents for quadrature points on a current side.
Definition: Assembly.h:321
bool _block_diagonal_matrix
Will be true if our preconditioning matrix is a block-diagonal matrix. Which means that we can take s...
Definition: Assembly.h:2768
MooseArray< DualReal > _ad_coord
The AD version of the current coordinate transformation coefficients.
Definition: Assembly.h:2379
const Elem *const & neighborLowerDElem() const
Return the neighboring lower dimensional element.
Definition: Assembly.h:435
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhi(FEType type) const
Definition: Assembly.h:1588
FEBase * _current_fe_helper
The current helper object for transforming coordinates.
Definition: Assembly.h:2361
bool _need_JxW_neighbor
Flag to indicate that JxW_neighbor is needed.
Definition: Assembly.h:2520
const VectorVariablePhiValue & phiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1388
std::map< FEType, bool > _need_curl
Definition: Assembly.h:2820
void copyNeighborShapes(MooseVariableField< T > &v)
Definition: Assembly.C:3065
void cacheJacobianCoupledVarPair(const MooseVariableBase &ivar, const MooseVariableBase &jvar)
Caches element matrix for ivar rows and jvar columns.
Definition: Assembly.C:4068
VectorVariablePhiSecond _vector_second_phi_face
Definition: Assembly.h:2681
const MooseArray< ADPoint > & adNormals() const
Definition: Assembly.h:346
VariablePhiGradient _grad_phi_face
Definition: Assembly.h:2661
MooseArray< Point > _current_q_points_face_neighbor
The current quadrature points on the neighbor face.
Definition: Assembly.h:2518
const VectorVariablePhiGradient & gradPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1347
VectorVariablePhiCurl _vector_curl_phi_face
Definition: Assembly.h:2682
bool _need_dual
Whether dual shape functions need to be computed for mortar constraints.
Definition: Assembly.h:2596
auto index_range(const T &sizable)
const std::vector< Real > & jxWMortar() const
Returns a reference to JxW for mortar segment elements.
Definition: Assembly.h:657
const FEVectorBase *const & getVectorFENeighbor(FEType type, unsigned int dim) const
GetVector a reference to a pointer that will contain the current &#39;neighbor&#39; FE.
Definition: Assembly.h:176
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:812
const dof_id_type & extraElemIDNeighbor(unsigned int id) const
Returns an integer ID of the current element given the index associated with the integer.
Definition: Assembly.h:340
DenseVector< Number > _element_vector
A working vector to avoid repeated heap allocations when caching residuals that must have libMesh-lev...
Definition: Assembly.h:2838
SubdomainID _current_subdomain_id
The current subdomain ID.
Definition: Assembly.h:2551
const Elem *& sideElem()
Returns the side element.
Definition: Assembly.h:411
VectorVariablePhiCurl & curlPhiFace(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1476
VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1562
ElemSideBuilder _current_side_elem_builder
In place side element builder for _current_side_elem.
Definition: Assembly.h:2827
const FEBase *const & getFEFaceNeighbor(FEType type, unsigned int dim) const
Get a reference to a pointer that will contain the current "neighbor" FE.
Definition: Assembly.h:152
std::map< unsigned int, const std::vector< Point > * > _holder_normals
Holds pointers to the dimension&#39;s normal vectors.
Definition: Assembly.h:2494
QBase * _current_qrule_face
quadrature rule used on faces
Definition: Assembly.h:2475
std::map< FEType, FEVectorBase * > _current_vector_fe_neighbor
The "neighbor" vector fe object that matches the current elem.
Definition: Assembly.h:2348
void clearCachedResiduals(GlobalDataKey)
Clears all of the residuals in _cached_residual_rows and _cached_residual_values. ...
Definition: Assembly.C:3496
unsigned int THREAD_ID
Definition: MooseTypes.h:198
const Node * _current_neighbor_node
The current neighboring node we are working with.
Definition: Assembly.h:2577
void cacheResidualsWithoutConstraints(const Residuals &residuals, const Indices &row_indices, Real scaling_factor, LocalDataKey, const std::set< TagID > &vector_tags)
Process the supplied residual values.
Definition: Assembly.h:3048
void clearCachedJacobian()
Clear any currently cached jacobians.
Definition: Assembly.C:4516
uint8_t dof_id_type
const BoundaryID & currentBoundaryID() const
Return the current boundary ID.
Definition: Assembly.h:382
VectorVariablePhiDivergence _vector_div_phi_face_neighbor
Definition: Assembly.h:2695
const VariablePhiGradient & gradPhiFace() const
Definition: Assembly.h:1286
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Knl
dprimary/dlower (or dneighbor/dlower)
Definition: Assembly.h:2650
const OutputTools< OutputType >::VariablePhiValue & fePhiFace(FEType type) const
Definition: Assembly.h:1609
VariablePhiValue & phi(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1527
VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< Real > &)
Definition: Assembly.h:1423
std::vector< VectorValue< DualReal > > _ad_dxyzdxi_map
AD quantities.
Definition: Assembly.h:2780
VariablePhiGradient & gradPhi(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1528
void reinitFEFace(const Elem *elem, unsigned int side)
Just an internal helper function to reinit the face FE objects.
Definition: Assembly.C:1261
void computeFaceMap(const Elem &elem, const unsigned int side, const std::vector< Real > &qw)
Definition: Assembly.C:1341
VariablePhiValue & phiFace(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1531
void reinitDual(const Elem *elem, const std::vector< Point > &pts, const std::vector< Real > &JxW)
Reintialize dual basis coefficients based on a customized quadrature rule.
Definition: Assembly.C:2264
Key structure for APIs manipulating global vectors/matrices.
Definition: Assembly.h:794