https://mooseframework.inl.gov
Assembly.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "DenseMatrix.h"
13 #include "MooseArray.h"
14 #include "MooseTypes.h"
15 #include "MooseVariableFE.h"
16 #include "MoosePassKey.h"
17 #include "ArbitraryQuadrature.h"
18 
19 #include "libmesh/dense_vector.h"
20 #include "libmesh/enum_quadrature_type.h"
21 #include "libmesh/fe_type.h"
22 #include "libmesh/point.h"
23 #include "libmesh/fe_base.h"
24 #include "libmesh/numeric_vector.h"
25 #include "libmesh/elem_side_builder.h"
26 
27 #include <unordered_map>
28 
29 // libMesh forward declarations
30 namespace libMesh
31 {
32 class DofMap;
33 class CouplingMatrix;
34 class Elem;
35 template <typename>
38 template <typename T>
42 class Node;
43 template <typename T>
44 class NumericVector;
45 template <typename T>
46 class SparseMatrix;
47 class StaticCondensation;
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 
67 #ifdef MOOSE_KOKKOS_ENABLED
68 namespace Moose::Kokkos
69 {
70 class Assembly;
71 }
72 #endif
73 
74 // Assembly.h does not import Moose.h nor libMeshReducedNamespace.h
75 using libMesh::FEBase;
76 using libMesh::FEFamily;
77 using libMesh::FEType;
80 using libMesh::Order;
82 
91 template <typename P, typename C>
92 void coordTransformFactor(const SubProblem & s,
93  SubdomainID sub_id,
94  const P & point,
95  C & factor,
97 
98 template <typename P, typename C>
99 void coordTransformFactor(const MooseMesh & mesh,
100  SubdomainID sub_id,
101  const P & point,
102  C & factor,
104 
109 class Assembly
110 {
111 public:
112  Assembly(SystemBase & sys, THREAD_ID tid);
113  virtual ~Assembly();
114 
119  template <typename T>
120  static const T * const & constify_ref(T * const & inref)
121  {
122  const T * const * ptr = &inref;
123  return *ptr;
124  }
125 
132  const FEBase * const & getFE(FEType type, unsigned int dim) const
133  {
134  buildFE(type);
135  return constify_ref(_fe[dim][type]);
136  }
137 
144  const FEBase * const & getFENeighbor(FEType type, unsigned int dim) const
145  {
146  buildNeighborFE(type);
147  return constify_ref(_fe_neighbor[dim][type]);
148  }
149 
156  const FEBase * const & getFEFace(FEType type, unsigned int dim) const
157  {
158  buildFaceFE(type);
159  return constify_ref(_fe_face[dim][type]);
160  }
161 
168  const FEBase * const & getFEFaceNeighbor(FEType type, unsigned int dim) const
169  {
170  buildFaceNeighborFE(type);
171  return constify_ref(_fe_face_neighbor[dim][type]);
172  }
173 
180  const FEVectorBase * const & getVectorFE(FEType type, unsigned int dim) const
181  {
182  buildVectorFE(type);
183  return constify_ref(_vector_fe[dim][type]);
184  }
185 
192  const FEVectorBase * const & getVectorFENeighbor(FEType type, unsigned int dim) const
193  {
194  buildVectorNeighborFE(type);
195  return constify_ref(_vector_fe_neighbor[dim][type]);
196  }
197 
204  const FEVectorBase * const & getVectorFEFace(FEType type, unsigned int dim) const
205  {
206  buildVectorFaceFE(type);
207  return constify_ref(_vector_fe_face[dim][type]);
208  }
209 
216  const FEVectorBase * const & getVectorFEFaceNeighbor(FEType type, unsigned int dim) const
217  {
220  }
221 
222 #ifdef MOOSE_KOKKOS_ENABLED
223 
229 #endif
230 
235  const libMesh::QBase * const & qRule() const { return constify_ref(_current_qrule); }
236 
242 
243 #ifdef MOOSE_KOKKOS_ENABLED
244 
249  {
250  return qrules(dim, block).vol.get();
251  }
252 #endif
253 
258  const MooseArray<Point> & qPoints() const { return _current_q_points; }
259 
264  const std::vector<Point> & qPointsMortar() const { return _fe_msm->get_xyz(); }
265 
271 
276  const MooseArray<Real> & JxW() const { return _current_JxW; }
277 
278  const MooseArray<ADReal> & adJxW() const { return _ad_JxW; }
279 
280  const MooseArray<ADReal> & adJxWFace() const { return _ad_JxW_face; }
281 
282  const MooseArray<ADReal> & adCurvatures() const;
283 
288  const MooseArray<Real> & coordTransformation() const { return _coord; }
289 
295 
301  {
302  // Coord values for non-cartesian coordinate systems are functions of the locations of the
303  // quadrature points in physical space. We also have no way of knowing whether this was called
304  // from a volumetric or face object so we should set both volumetric and face xyz to true
305  _calculate_xyz = true;
306  _calculate_face_xyz = true;
307 
308  _calculate_ad_coord = true;
309  return _ad_coord;
310  }
311 
317 
322  const libMesh::QBase * const & qRuleFace() const { return constify_ref(_current_qrule_face); }
323 
329 
330 #ifdef MOOSE_KOKKOS_ENABLED
331 
336  {
337  return qrules(dim, block).face.get();
338  }
339 #endif
340 
346 
351  const MooseArray<Real> & JxWFace() const { return _current_JxW_face; }
352 
357  const MooseArray<Point> & normals() const { return _current_normals; }
358 
359  /***
360  * Returns the array of normals for quadrature points on a current side
361  */
362  const std::vector<Eigen::Map<RealDIMValue>> & mappedNormals() const { return _mapped_normals; }
363 
369 
373  unsigned int numExtraElemIntegers() const { return _extra_elem_ids.size() - 1; }
374 
378  const dof_id_type & extraElemID(unsigned int id) const
379  {
380  mooseAssert(id < _extra_elem_ids.size(), "An invalid extra element integer id");
381  return _extra_elem_ids[id];
382  }
383 
387  const dof_id_type & extraElemIDNeighbor(unsigned int id) const
388  {
389  mooseAssert(id < _neighbor_extra_elem_ids.size(), "An invalid extra element integer id");
390  return _neighbor_extra_elem_ids[id];
391  }
392 
393  const MooseArray<ADPoint> & adNormals() const { return _ad_normals; }
394 
396  {
397  _calculate_xyz = true;
398  return _ad_q_points;
399  }
400 
402  {
403  _calculate_face_xyz = true;
404  return _ad_q_points_face;
405  }
406 
407  template <bool is_ad>
409 
414  const Elem * const & elem() const { return _current_elem; }
415 
420 
425 
430 
435 
440  const Real & elemVolume() const { return _current_elem_volume; }
441 
446  const unsigned int & side() const { return _current_side; }
447 
452  const unsigned int & neighborSide() const { return _current_neighbor_side; }
453 
458  const Elem *& sideElem() { return _current_side_elem; }
459 
464  const Real & sideElemVolume() const { return _current_side_volume; }
465 
470  const Elem * const & neighbor() const { return _current_neighbor_elem; }
471 
476  const Elem * const & lowerDElem() const { return _current_lower_d_elem; }
477 
482  const Elem * const & neighborLowerDElem() const { return _current_neighbor_lower_d_elem; }
483 
484  /*
485  * @return The current lower-dimensional element volume
486  */
487  const Real & lowerDElemVolume() const;
488 
489  /*
490  * @return The current neighbor lower-dimensional element volume
491  */
492  const Real & neighborLowerDElemVolume() const;
493 
498 
503 
509  {
512  }
513 
518  const libMesh::QBase * const & qRuleNeighbor() const
519  {
521  }
522 
528 
533  const MooseArray<Real> & JxWNeighbor() const;
534 
540 
545  const Node * const & node() const { return _current_node; }
546 
551  const Node * const & nodeNeighbor() const { return _current_neighbor_node; }
552 
561  void createQRules(QuadratureType type,
562  Order order,
563  Order volume_order,
564  Order face_order,
565  SubdomainID block,
566  bool allow_negative_qweights = true);
567 
574  void bumpVolumeQRuleOrder(Order volume_order, SubdomainID block);
575 
583  void bumpAllQRuleOrder(Order order, SubdomainID block);
584 
593  void setVolumeQRule(libMesh::QBase * qrule, unsigned int dim);
594 
603  void setFaceQRule(libMesh::QBase * qrule, unsigned int dim);
604 
612  void setMortarQRule(Order order);
613 
617  void activateDual() { _need_dual = true; }
618 
623  bool needDual() const { return _need_dual; }
624 
628  void clearCachedQRules();
629 
630 private:
637  void setLowerQRule(libMesh::QBase * qrule, unsigned int dim);
638 
639 public:
648  void setNeighborQRule(libMesh::QBase * qrule, unsigned int dim);
649 
655  void reinit(const Elem * elem);
656 
660  void setVolumeQRule(const Elem * elem);
661 
666  void reinitElemFaceRef(const Elem * elem,
667  unsigned int elem_side,
668  Real tolerance,
669  const std::vector<Point> * const pts = nullptr,
670  const std::vector<Real> * const weights = nullptr);
671 
676  void reinitNeighborFaceRef(const Elem * neighbor_elem,
677  unsigned int neighbor_side,
678  Real tolerance,
679  const std::vector<Point> * const pts,
680  const std::vector<Real> * const weights = nullptr);
681 
685  void reinitDual(const Elem * elem, const std::vector<Point> & pts, const std::vector<Real> & JxW);
686 
690  void reinitLowerDElem(const Elem * elem,
691  const std::vector<Point> * const pts = nullptr,
692  const std::vector<Real> * const weights = nullptr);
693 
697  void reinitNeighborLowerDElem(const Elem * elem);
698 
702  void reinitMortarElem(const Elem * elem);
703 
707  const std::vector<Real> & jxWMortar() const { return *_JxW_msm; }
708 
712  const libMesh::QBase * const & qRuleMortar() const { return constify_ref(_qrule_msm); }
713 
714 private:
718  void computeADFace(const Elem & elem, const unsigned int side);
719 
720 public:
724  void reinitAtPhysical(const Elem * elem, const std::vector<Point> & physical_points);
725 
729  void reinit(const Elem * elem, const std::vector<Point> & reference_points);
730 
734  void setFaceQRule(const Elem * const elem, const unsigned int side);
735 
739  void reinit(const Elem * elem, unsigned int side);
740 
744  void reinit(const Elem * elem, unsigned int side, const std::vector<Point> & reference_points);
745 
746  void reinitFVFace(const FaceInfo & fi);
747 
759  void reinitElemAndNeighbor(const Elem * elem,
760  unsigned int side,
761  const Elem * neighbor,
762  unsigned int neighbor_side,
763  const std::vector<Point> * neighbor_reference_points = nullptr);
764 
768  void reinitNeighborAtPhysical(const Elem * neighbor,
769  unsigned int neighbor_side,
770  const std::vector<Point> & physical_points);
771 
775  void reinitNeighborAtPhysical(const Elem * neighbor, const std::vector<Point> & physical_points);
776 
780  void reinitNeighbor(const Elem * neighbor, const std::vector<Point> & reference_points);
781 
785  void reinit(const Node * node);
786 
790  void init(const libMesh::CouplingMatrix * cm);
791 
793  void initNonlocalCoupling();
794 
796  void prepareJacobianBlock();
797 
799  void prepareResidual();
800 
801  void prepare();
802  void prepareNonlocal();
803 
811  void prepareNeighbor();
812 
817  void prepareLowerD();
818 
819  void prepareBlock(unsigned int ivar, unsigned jvar, const std::vector<dof_id_type> & dof_indices);
820  void prepareBlockNonlocal(unsigned int ivar,
821  unsigned jvar,
822  const std::vector<dof_id_type> & idof_indices,
823  const std::vector<dof_id_type> & jdof_indices);
824  void prepareScalar();
825  void prepareOffDiagScalar();
826 
827  template <typename T>
829  void copyShapes(unsigned int var);
830 
831  template <typename T>
833  void copyFaceShapes(unsigned int var);
834 
835  template <typename T>
837  void copyNeighborShapes(unsigned int var);
838 
845  {
846  // Blessed classes
847  friend class Assembly;
848  friend class SubProblem;
849  friend class FEProblemBase;
850  friend class DisplacedProblem;
851  friend class ComputeMortarFunctor;
852  friend class NonlinearSystemBase;
855  };
856 
863  {
864  // Blessed classes
865  friend class Assembly;
866  friend class TaggingInterface;
869  };
870 
875  void addResidual(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
880  void addResidualNeighbor(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
885  void addResidualLower(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
886 
891  void addResidualScalar(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
892 
897  void cacheResidual(GlobalDataKey, const std::vector<VectorTag> & tags);
898 
903  void cacheResidualNeighbor(GlobalDataKey, const std::vector<VectorTag> & tags);
904 
908  void cacheResidualLower(GlobalDataKey, const std::vector<VectorTag> & tags);
909 
915  void addCachedResiduals(GlobalDataKey, const std::vector<VectorTag> & tags);
916 
925  void clearCachedResiduals(GlobalDataKey);
926 
935  GlobalDataKey,
936  const VectorTag & vector_tag);
937 
941  void setResidual(NumericVector<Number> & residual, GlobalDataKey, const VectorTag & vector_tag);
942 
947  GlobalDataKey,
948  const VectorTag & vector_tag);
949 
953  void addJacobian(GlobalDataKey);
954 
958  void addJacobianNonlocal(GlobalDataKey);
959 
964  void addJacobianNeighbor(GlobalDataKey);
965 
969  void addJacobianScalar(GlobalDataKey);
970 
975  void addJacobianOffDiagScalar(unsigned int ivar, GlobalDataKey);
976 
981  unsigned int ivar,
982  unsigned int jvar,
983  const libMesh::DofMap & dof_map,
984  std::vector<dof_id_type> & dof_indices,
985  GlobalDataKey,
986  TagID tag);
987 
993  unsigned int ivar,
994  unsigned int jvar,
995  const libMesh::DofMap & dof_map,
996  std::vector<dof_id_type> & dof_indices,
997  GlobalDataKey,
998  const std::set<TagID> & tags);
999 
1004  unsigned int ivar,
1005  unsigned int jvar,
1006  const libMesh::DofMap & dof_map,
1007  const std::vector<dof_id_type> & idof_indices,
1008  const std::vector<dof_id_type> & jdof_indices,
1009  GlobalDataKey,
1010  TagID tag);
1011 
1016  unsigned int ivar,
1017  unsigned int jvar,
1018  const libMesh::DofMap & dof_map,
1019  const std::vector<dof_id_type> & idof_indices,
1020  const std::vector<dof_id_type> & jdof_indices,
1021  GlobalDataKey,
1022  const std::set<TagID> & tags);
1023 
1032  void addJacobianNeighborLowerD(GlobalDataKey);
1033 
1039  void addJacobianLowerD(GlobalDataKey);
1040 
1049  void cacheJacobianMortar(GlobalDataKey);
1050 
1056  unsigned int ivar,
1057  unsigned int jvar,
1058  const libMesh::DofMap & dof_map,
1059  std::vector<dof_id_type> & dof_indices,
1060  std::vector<dof_id_type> & neighbor_dof_indices,
1061  GlobalDataKey,
1062  TagID tag);
1063 
1069  unsigned int ivar,
1070  unsigned int jvar,
1071  const libMesh::DofMap & dof_map,
1072  std::vector<dof_id_type> & dof_indices,
1073  std::vector<dof_id_type> & neighbor_dof_indices,
1074  GlobalDataKey,
1075  const std::set<TagID> & tags);
1076 
1080  void cacheJacobian(GlobalDataKey);
1081 
1085  void cacheJacobianNonlocal(GlobalDataKey);
1086 
1091  void cacheJacobianNeighbor(GlobalDataKey);
1092 
1099  void addCachedJacobian(GlobalDataKey);
1100 
1104  void setCachedJacobian(GlobalDataKey);
1105 
1109  void zeroCachedJacobian(GlobalDataKey);
1110 
1115  DenseVector<Number> & residualBlock(unsigned int var_num, LocalDataKey, TagID tag_id)
1116  {
1117  return _sub_Re[tag_id][var_num];
1118  }
1119 
1125  {
1126  return _sub_Rn[tag_id][var_num];
1127  }
1128 
1134  {
1135  return _sub_Rl[tag_id][var_num];
1136  }
1137 
1142  DenseMatrix<Number> & jacobianBlock(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
1143  {
1144  jacobianBlockUsed(tag, ivar, jvar, true);
1145  return _sub_Kee[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
1146  }
1147 
1153  jacobianBlockNonlocal(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
1154  {
1155  jacobianBlockNonlocalUsed(tag, ivar, jvar, true);
1156  return _sub_Keg[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
1157  }
1158 
1164  Moose::DGJacobianType type, unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag);
1165 
1174  unsigned int ivar,
1175  unsigned int jvar,
1176  LocalDataKey,
1177  TagID tag);
1178 
1183  void cacheResidualNodes(const DenseVector<Number> & res,
1184  const std::vector<dof_id_type> & dof_index,
1185  LocalDataKey,
1186  TagID tag);
1187 
1199  void
1200  cacheJacobian(numeric_index_type i, numeric_index_type j, Real value, LocalDataKey, TagID tag);
1201 
1215  Real value,
1216  LocalDataKey,
1217  const std::set<TagID> & tags);
1218 
1225  void cacheJacobianBlock(DenseMatrix<Number> & jac_block,
1226  const std::vector<dof_id_type> & idof_indices,
1227  const std::vector<dof_id_type> & jdof_indices,
1228  Real scaling_factor,
1229  LocalDataKey,
1230  TagID tag);
1231 
1241  template <typename Residuals, typename Indices>
1242  void cacheResiduals(const Residuals & residuals,
1243  const Indices & row_indices,
1244  Real scaling_factor,
1245  LocalDataKey,
1246  const std::set<TagID> & vector_tags);
1247 
1255  template <typename Residuals, typename Indices>
1256  void cacheJacobian(const Residuals & residuals,
1257  const Indices & row_indices,
1258  Real scaling_factor,
1259  LocalDataKey,
1260  const std::set<TagID> & matrix_tags);
1261 
1272  template <typename Residuals, typename Indices>
1273  void cacheResidualsWithoutConstraints(const Residuals & residuals,
1274  const Indices & row_indices,
1275  Real scaling_factor,
1276  LocalDataKey,
1277  const std::set<TagID> & vector_tags);
1278 
1286  template <typename Residuals, typename Indices>
1287  void cacheJacobianWithoutConstraints(const Residuals & residuals,
1288  const Indices & row_indices,
1289  Real scaling_factor,
1290  LocalDataKey,
1291  const std::set<TagID> & matrix_tags);
1292 
1293  std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> & couplingEntries()
1294  {
1295  return _cm_ff_entry;
1296  }
1297  const std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
1299  {
1300  return _cm_ff_entry;
1301  }
1302  std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
1304  {
1305  return _cm_nonlocal_entry;
1306  }
1307  const std::vector<std::pair<MooseVariableFieldBase *, MooseVariableScalar *>> &
1309  {
1310  return _cm_fs_entry;
1311  }
1312  const std::vector<std::pair<MooseVariableScalar *, MooseVariableFieldBase *>> &
1314  {
1315  return _cm_sf_entry;
1316  }
1317 
1318  // Read-only references
1319  const VariablePhiValue & phi() const { return _phi; }
1320  template <typename T>
1322  {
1323  return _ad_grad_phi_data.at(v.feType());
1324  }
1325  const VariablePhiValue & phi(const MooseVariableField<Real> &) const { return _phi; }
1326  const VariablePhiGradient & gradPhi() const { return _grad_phi; }
1328  const VariablePhiSecond & secondPhi() const { return _second_phi; }
1330  {
1331  return _second_phi;
1332  }
1333 
1334  const VariablePhiValue & phiFace() const { return _phi_face; }
1335  const VariablePhiValue & phiFace(const MooseVariableField<Real> &) const { return _phi_face; }
1336  const VariablePhiGradient & gradPhiFace() const { return _grad_phi_face; }
1338  {
1339  return _grad_phi_face;
1340  }
1342  {
1343  return _second_phi_face;
1344  }
1345 
1347  {
1348  return _phi_neighbor;
1349  }
1351  {
1352  return _grad_phi_neighbor;
1353  }
1355  {
1356  return _second_phi_neighbor;
1357  }
1358 
1360  {
1361  return _phi_face_neighbor;
1362  }
1364  {
1365  return _grad_phi_face_neighbor;
1366  }
1368  {
1370  }
1371 
1373  {
1374  return _vector_phi;
1375  }
1377  {
1378  return _vector_grad_phi;
1379  }
1381  {
1382  return _vector_second_phi;
1383  }
1385  {
1386  return _vector_curl_phi;
1387  }
1389  {
1390  return _vector_div_phi;
1391  }
1392 
1394  {
1395  return _vector_phi_face;
1396  }
1398  {
1399  return _vector_grad_phi_face;
1400  }
1402  {
1403  return _vector_second_phi_face;
1404  }
1406  {
1407  return _vector_curl_phi_face;
1408  }
1410  {
1411  return _vector_div_phi_face;
1412  }
1413 
1415  {
1416  return _vector_phi_neighbor;
1417  }
1420  {
1422  }
1423  const VectorVariablePhiSecond &
1425  {
1427  }
1429  {
1431  }
1434  {
1435  return _vector_div_phi_neighbor;
1436  }
1437 
1439  {
1441  }
1444  {
1446  }
1447  const VectorVariablePhiSecond &
1449  {
1451  }
1452  const VectorVariablePhiCurl &
1454  {
1456  }
1459  {
1461  }
1462 
1463  // Writeable references
1467 
1471 
1474  {
1475  return _grad_phi_neighbor;
1476  }
1478  {
1479  return _second_phi_neighbor;
1480  }
1481 
1483  {
1484  return _phi_face_neighbor;
1485  }
1487  {
1488  return _grad_phi_face_neighbor;
1489  }
1491  {
1493  }
1494 
1495  // Writeable references with vector variable
1498  {
1499  return _vector_grad_phi;
1500  }
1502  {
1503  return _vector_second_phi;
1504  }
1506  {
1507  return _vector_curl_phi;
1508  }
1510  {
1511  return _vector_div_phi;
1512  }
1513 
1515  {
1516  return _vector_phi_face;
1517  }
1519  {
1520  return _vector_grad_phi_face;
1521  }
1523  {
1524  return _vector_second_phi_face;
1525  }
1527  {
1528  return _vector_curl_phi_face;
1529  }
1531  {
1532  return _vector_div_phi_face;
1533  }
1534 
1536  {
1537  return _vector_phi_neighbor;
1538  }
1540  {
1542  }
1544  {
1546  }
1548  {
1550  }
1552  {
1553  return _vector_div_phi_neighbor;
1554  }
1556  {
1558  }
1560  {
1562  }
1564  {
1566  }
1568  {
1570  }
1572  {
1574  }
1575 
1576  // Writeable references with array variable
1580 
1583  {
1584  return _grad_phi_face;
1585  }
1587  {
1588  return _second_phi_face;
1589  }
1590 
1592  {
1593  return _phi_neighbor;
1594  }
1596  {
1597  return _grad_phi_neighbor;
1598  }
1600  {
1601  return _second_phi_neighbor;
1602  }
1603 
1605  {
1606  return _phi_face_neighbor;
1607  }
1609  {
1610  return _grad_phi_face_neighbor;
1611  }
1613  {
1615  }
1616 
1617  template <typename OutputType>
1619  {
1620  buildFE(type);
1621  return _fe_shape_data[type]->_phi;
1622  }
1623 
1624  template <typename OutputType>
1626  {
1627  buildFE(type);
1628  return _fe_shape_data[type]->_grad_phi;
1629  }
1630 
1631  template <typename OutputType>
1633  {
1634  return _ad_grad_phi_data[type];
1635  }
1636 
1637  template <typename OutputType>
1639  {
1640  _need_second_derivative.insert(type);
1641  buildFE(type);
1642  return _fe_shape_data[type]->_second_phi;
1643  }
1644 
1645  template <typename OutputType>
1646  const typename OutputTools<OutputType>::VariablePhiValue & fePhiLower(FEType type) const;
1647 
1648  template <typename OutputType>
1650 
1651  template <typename OutputType>
1653 
1654  template <typename OutputType>
1656  feGradDualPhiLower(FEType type) const;
1657 
1658  template <typename OutputType>
1660  {
1661  buildFaceFE(type);
1662  return _fe_shape_data_face[type]->_phi;
1663  }
1664 
1665  template <typename OutputType>
1667  {
1668  buildFaceFE(type);
1669  return _fe_shape_data_face[type]->_grad_phi;
1670  }
1671 
1672  template <typename OutputType>
1674  {
1675  return _ad_grad_phi_data_face[type];
1676  }
1677 
1678  template <typename OutputType>
1680  {
1681  _need_second_derivative.insert(type);
1682  buildFaceFE(type);
1683  return _fe_shape_data_face[type]->_second_phi;
1684  }
1685 
1686  template <typename OutputType>
1688  {
1689  buildNeighborFE(type);
1690  return _fe_shape_data_neighbor[type]->_phi;
1691  }
1692 
1693  template <typename OutputType>
1695  {
1696  buildNeighborFE(type);
1697  return _fe_shape_data_neighbor[type]->_grad_phi;
1698  }
1699 
1700  template <typename OutputType>
1702  {
1703  _need_second_derivative_neighbor.insert(type);
1704  buildNeighborFE(type);
1705  return _fe_shape_data_neighbor[type]->_second_phi;
1706  }
1707 
1708  template <typename OutputType>
1710  {
1711  buildFaceNeighborFE(type);
1712  return _fe_shape_data_face_neighbor[type]->_phi;
1713  }
1714 
1715  template <typename OutputType>
1718  {
1719  buildFaceNeighborFE(type);
1720  return _fe_shape_data_face_neighbor[type]->_grad_phi;
1721  }
1722 
1723  template <typename OutputType>
1726  {
1727  _need_second_derivative_neighbor.insert(type);
1728  buildFaceNeighborFE(type);
1729  return _fe_shape_data_face_neighbor[type]->_second_phi;
1730  }
1731 
1732  template <typename OutputType>
1734  {
1735  _need_curl.insert(type);
1736  buildFE(type);
1737  return _fe_shape_data[type]->_curl_phi;
1738  }
1739 
1740  template <typename OutputType>
1742  {
1743  _need_curl.insert(type);
1744  buildFaceFE(type);
1745  return _fe_shape_data_face[type]->_curl_phi;
1746  }
1747 
1748  template <typename OutputType>
1750  {
1751  _need_curl.insert(type);
1752  buildNeighborFE(type);
1753  return _fe_shape_data_neighbor[type]->_curl_phi;
1754  }
1755 
1756  template <typename OutputType>
1758  {
1759  _need_curl.insert(type);
1760  buildFaceNeighborFE(type);
1761  return _fe_shape_data_face_neighbor[type]->_curl_phi;
1762  }
1763 
1764  template <typename OutputType>
1766  {
1767  buildFE(type);
1768  return _fe_shape_data[type]->_div_phi;
1769  }
1770 
1771  template <typename OutputType>
1773  {
1774  buildFaceFE(type);
1775  return _fe_shape_data_face[type]->_div_phi;
1776  }
1777 
1778  template <typename OutputType>
1781  {
1782  buildNeighborFE(type);
1783  return _fe_shape_data_neighbor[type]->_div_phi;
1784  }
1785 
1786  template <typename OutputType>
1789  {
1790  buildFaceNeighborFE(type);
1791  return _fe_shape_data_face_neighbor[type]->_div_phi;
1792  }
1793 
1795  Real elementVolume(const Elem * elem) const;
1796 
1800  void setXFEM(std::shared_ptr<XFEMInterface> xfem) { _xfem = xfem; }
1801 
1805  void assignDisplacements(
1806  std::vector<std::pair<unsigned int, unsigned short>> && disp_numbers_and_directions);
1807 
1817  unsigned int i,
1818  unsigned int ntest,
1819  const RealEigenVector & v) const
1820  {
1821  for (unsigned int j = 0; j < v.size(); ++j, i += ntest)
1822  re(i) += v(j);
1823  }
1824 
1836  unsigned int i,
1837  unsigned int ntest,
1838  unsigned int j,
1839  unsigned int nphi,
1840  unsigned int ivar,
1841  const RealEigenVector & v) const
1842  {
1843  unsigned int pace = (_component_block_diagonal[ivar] ? 0 : nphi);
1844  for (unsigned int k = 0; k < v.size(); ++k, i += ntest, j += pace)
1845  ke(i, j) += v(k);
1846  }
1847 
1861  unsigned int i,
1862  unsigned int ntest,
1863  unsigned int j,
1864  unsigned int nphi,
1865  unsigned int ivar,
1866  unsigned int jvar,
1867  const RealEigenMatrix & v) const
1868  {
1869  if (ivar == jvar && _component_block_diagonal[ivar])
1870  {
1871  for (unsigned int k = 0; k < v.rows(); ++k, i += ntest)
1872  ke(i, j) += v(k, k);
1873  }
1874  else
1875  {
1876  const unsigned int saved_j = j;
1877  for (unsigned int k = 0; k < v.rows(); ++k, i += ntest)
1878  {
1879  j = saved_j;
1880  for (unsigned int l = 0; l < v.cols(); ++l, j += nphi)
1881  ke(i, j) += v(k, l);
1882  }
1883  }
1884  }
1885 
1887  {
1888  unsigned int rows = ke.m();
1889  unsigned int cols = ke.n();
1890  DenseVector<Real> diag(rows);
1891  for (unsigned int i = 0; i < rows; i++)
1892  // % operation is needed to account for cases of no component coupling of array variables
1893  diag(i) = ke(i, i % cols);
1894  return diag;
1895  }
1896 
1902  inline const libMesh::QBase * attachQRuleElem(unsigned int dim, FEBase & fe)
1903  {
1904  auto qrule = qrules(dim).vol.get();
1905  fe.attach_quadrature_rule(qrule);
1906  return qrule;
1907  }
1908 
1914  inline const libMesh::QBase * attachQRuleFace(unsigned int dim, FEBase & fe)
1915  {
1916  auto qrule = qrules(dim).face.get();
1917  fe.attach_quadrature_rule(qrule);
1918  return qrule;
1919  }
1920 
1925  void hasScalingVector();
1926 
1935  void modifyArbitraryWeights(const std::vector<Real> & weights);
1936 
1940  bool computingResidual() const { return _computing_residual; }
1941 
1945  bool computingJacobian() const { return _computing_jacobian; }
1946 
1951 
1955  const Elem * const & msmElem() const { return _msm_elem; }
1956 
1966  void havePRefinement(const std::unordered_set<FEFamily> & disable_p_refinement_for_families);
1967 
1971  void setCurrentLowerDElem(const Elem * const lower_d_elem);
1972 
1973 private:
1979  void reinitFE(const Elem * elem);
1980 
1987  void reinitFEFace(const Elem * elem, unsigned int side);
1988 
1989  void computeFaceMap(const Elem & elem, const unsigned int side, const std::vector<Real> & qw);
1990 
1991  void reinitFEFaceNeighbor(const Elem * neighbor, const std::vector<Point> & reference_points);
1992 
1993  void reinitFENeighbor(const Elem * neighbor, const std::vector<Point> & reference_points);
1994 
1995  template <typename Points, typename Coords>
1996  void setCoordinateTransformation(const libMesh::QBase * qrule,
1997  const Points & q_points,
1998  Coords & coord,
1999  SubdomainID sub_id);
2000 
2001  void computeCurrentElemVolume();
2002 
2003  void computeCurrentFaceVolume();
2004 
2006 
2012  void modifyWeightsDueToXFEM(const Elem * elem);
2013 
2020  void modifyFaceWeightsDueToXFEM(const Elem * elem, unsigned int side = 0);
2021 
2026  template <typename OutputType>
2027  void computeGradPhiAD(const Elem * elem,
2028  unsigned int n_qp,
2031 
2035  void resizeADMappingObjects(unsigned int n_qp, unsigned int dim);
2036 
2041  void
2042  computeSinglePointMapAD(const Elem * elem, const std::vector<Real> & qw, unsigned p, FEBase * fe);
2043 
2047  void addResidual(const VectorTag & vector_tag);
2051  void addResidualNeighbor(const VectorTag & vector_tag);
2056  void addResidualLower(const VectorTag & vector_tag);
2060  void addResidualScalar(const VectorTag & vector_tag);
2061 
2065  void clearCachedResiduals(const VectorTag & vector_tag);
2066 
2075  void cacheResidual(dof_id_type dof, Real value, TagID tag_id);
2076 
2085  void cacheResidual(dof_id_type dof, Real value, const std::set<TagID> & tags);
2086 
2091  void processLocalResidual(DenseVector<Number> & res_block,
2092  std::vector<dof_id_type> & dof_indices,
2093  const std::vector<Real> & scaling_factor,
2094  bool is_nodal);
2095 
2099  void addResidualBlock(NumericVector<Number> & residual,
2100  DenseVector<Number> & res_block,
2101  const std::vector<dof_id_type> & dof_indices,
2102  const std::vector<Real> & scaling_factor,
2103  bool is_nodal);
2104 
2108  void cacheResidualBlock(std::vector<Real> & cached_residual_values,
2109  std::vector<dof_id_type> & cached_residual_rows,
2110  DenseVector<Number> & res_block,
2111  const std::vector<dof_id_type> & dof_indices,
2112  const std::vector<Real> & scaling_factor,
2113  bool is_nodal);
2114 
2118  void setResidualBlock(NumericVector<Number> & residual,
2119  DenseVector<Number> & res_block,
2120  const std::vector<dof_id_type> & dof_indices,
2121  const std::vector<Real> & scaling_factor,
2122  bool is_nodal);
2123 
2128  DenseMatrix<Number> & jac_block,
2129  const MooseVariableBase & ivar,
2130  const MooseVariableBase & jvar,
2131  const std::vector<dof_id_type> & idof_indices,
2132  const std::vector<dof_id_type> & jdof_indices);
2133 
2137  void cacheJacobianBlock(DenseMatrix<Number> & jac_block,
2138  const MooseVariableBase & ivar,
2139  const MooseVariableBase & jvar,
2140  const std::vector<dof_id_type> & idof_indices,
2141  const std::vector<dof_id_type> & jdof_indices,
2142  TagID tag);
2143 
2148  const MooseVariableBase & ivar,
2149  const MooseVariableBase & jvar,
2150  const std::vector<dof_id_type> & idof_indices,
2151  const std::vector<dof_id_type> & jdof_indices,
2152  TagID tag);
2153 
2157  void addJacobianCoupledVarPair(const MooseVariableBase & ivar, const MooseVariableBase & jvar);
2158 
2162  void cacheJacobianCoupledVarPair(const MooseVariableBase & ivar, const MooseVariableBase & jvar);
2163 
2169  void clearCachedJacobian();
2170 
2175  void buildFE(FEType type) const;
2176 
2181  void buildFaceFE(FEType type) const;
2182 
2187  void buildNeighborFE(FEType type) const;
2188 
2193  void buildFaceNeighborFE(FEType type) const;
2194 
2199  void buildLowerDFE(FEType type) const;
2200 
2201  void buildLowerDDualFE(FEType type) const;
2202 
2207  void buildVectorFE(FEType type) const;
2208 
2213  void buildVectorFaceFE(FEType type) const;
2214 
2219  void buildVectorNeighborFE(FEType type) const;
2220 
2225  void buildVectorFaceNeighborFE(FEType type) const;
2226 
2231  void buildVectorLowerDFE(FEType type) const;
2232  void buildVectorDualLowerDFE(FEType type) const;
2233 
2238  void jacobianBlockUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2239  {
2240  _jacobian_block_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2241  }
2242 
2247  char jacobianBlockUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2248  {
2249  return _jacobian_block_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2250  }
2251 
2256  void jacobianBlockNeighborUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2257  {
2258  _jacobian_block_neighbor_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2259  }
2260 
2265  char jacobianBlockNeighborUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2266  {
2267  return _jacobian_block_neighbor_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2268  }
2269 
2274  void jacobianBlockLowerUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2275  {
2276  _jacobian_block_lower_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2277  }
2278 
2283  char jacobianBlockLowerUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2284  {
2285  return _jacobian_block_lower_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2286  }
2287 
2292  void jacobianBlockNonlocalUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2293  {
2294  _jacobian_block_nonlocal_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2295  }
2296 
2301  char jacobianBlockNonlocalUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2302  {
2303  return _jacobian_block_nonlocal_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2304  }
2305 
2309  void helpersRequestData();
2310 
2313 
2314  const bool _displaced;
2315 
2319 
2321  const bool & _computing_residual;
2322 
2324  const bool & _computing_jacobian;
2325 
2328 
2330  std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> _cm_ff_entry;
2332  std::vector<std::pair<MooseVariableFieldBase *, MooseVariableScalar *>> _cm_fs_entry;
2334  std::vector<std::pair<MooseVariableScalar *, MooseVariableFieldBase *>> _cm_sf_entry;
2336  std::vector<std::pair<MooseVariableScalar *, MooseVariableScalar *>> _cm_ss_entry;
2338  std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> _cm_nonlocal_entry;
2340  std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_used;
2341  std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_nonlocal_used;
2343  std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_neighbor_used;
2345  std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_lower_used;
2350 
2352 
2353  unsigned int _mesh_dimension;
2354 
2358 
2365 
2368  std::vector<std::unique_ptr<FEBase>> _unique_fe_helper;
2369  std::vector<std::unique_ptr<FEBase>> _unique_fe_face_helper;
2370  std::vector<std::unique_ptr<FEBase>> _unique_fe_face_neighbor_helper;
2371  std::vector<std::unique_ptr<FEBase>> _unique_fe_neighbor_helper;
2372  std::vector<std::unique_ptr<FEBase>> _unique_fe_lower_helper;
2373 
2376 
2378  std::shared_ptr<XFEMInterface> _xfem;
2379 
2381  std::map<FEType, FEBase *> _current_fe;
2383  std::map<FEType, FEBase *> _current_fe_face;
2385  std::map<FEType, FEBase *> _current_fe_neighbor;
2387  std::map<FEType, FEBase *> _current_fe_face_neighbor;
2388 
2390  std::map<FEType, FEVectorBase *> _current_vector_fe;
2392  std::map<FEType, FEVectorBase *> _current_vector_fe_face;
2394  std::map<FEType, FEVectorBase *> _current_vector_fe_neighbor;
2396  std::map<FEType, FEVectorBase *> _current_vector_fe_face_neighbor;
2397 
2398  /**** Volume Stuff ****/
2399 
2401  mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe;
2403  mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe;
2405  std::map<unsigned int, FEBase *> _holder_fe_helper;
2426 
2429  struct QRules
2430  {
2432  : vol(nullptr),
2433  face(nullptr),
2434  arbitrary_vol(nullptr),
2435  arbitrary_face(nullptr),
2436  neighbor(nullptr)
2437  {
2438  }
2439 
2441  std::unique_ptr<libMesh::QBase> vol;
2443  std::unique_ptr<libMesh::QBase> face;
2445  std::unique_ptr<libMesh::QBase> fv_face;
2447  std::unique_ptr<ArbitraryQuadrature> arbitrary_vol;
2449  std::unique_ptr<ArbitraryQuadrature> arbitrary_face;
2451  std::unique_ptr<ArbitraryQuadrature> neighbor;
2452  };
2453 
2458  std::unordered_map<SubdomainID, std::vector<QRules>> _qrules;
2459 
2466  libMesh::QBase * qruleFace(const Elem * elem, unsigned int side);
2467  ArbitraryQuadrature * qruleArbitraryFace(const Elem * elem, unsigned int side);
2468 
2469  template <typename T>
2470  T * qruleFaceHelper(const Elem * elem, unsigned int side, std::function<T *(QRules &)> rule_fn)
2471  {
2472  auto dim = elem->dim();
2473  auto neighbor = elem->neighbor_ptr(side);
2474  auto q = rule_fn(qrules(dim, elem->subdomain_id()));
2475  if (!neighbor)
2476  return q;
2477 
2478  // find the maximum face quadrature order for all blocks the face is in
2479  auto neighbor_block = neighbor->subdomain_id();
2480  if (neighbor_block == elem->subdomain_id())
2481  return q;
2482 
2483  auto q_neighbor = rule_fn(qrules(dim, neighbor_block));
2484  if (q->get_order() > q_neighbor->get_order())
2485  return q;
2486  return q_neighbor;
2487  }
2488 
2489  inline QRules & qrules(unsigned int dim) { return qrules(dim, _current_subdomain_id); }
2490 
2494  inline QRules & qrules(unsigned int dim, SubdomainID block)
2495  {
2496  if (_qrules.find(block) == _qrules.end())
2497  {
2498  mooseAssert(_qrules.find(Moose::ANY_BLOCK_ID) != _qrules.end(),
2499  "missing quadrature rules for specified block");
2500  mooseAssert(_qrules[Moose::ANY_BLOCK_ID].size() > dim,
2501  "quadrature rules not sized property for dimension");
2502  return _qrules[Moose::ANY_BLOCK_ID][dim];
2503  }
2504  mooseAssert(_qrules.find(block) != _qrules.end(),
2505  "missing quadrature rules for specified block");
2506  mooseAssert(_qrules[block].size() > dim, "quadrature rules not sized property for dimension");
2507  return _qrules[block][dim];
2508  }
2509 
2510  /**** Face Stuff ****/
2511 
2513  mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_face;
2515  mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_face;
2517  std::map<unsigned int, FEBase *> _holder_fe_face_helper;
2531  std::vector<Eigen::Map<RealDIMValue>> _mapped_normals;
2534 
2536  std::vector<dof_id_type> _extra_elem_ids;
2538  std::vector<dof_id_type> _neighbor_extra_elem_ids;
2540  std::map<unsigned int, const std::vector<Point> *> _holder_normals;
2541 
2542  /**** Neighbor Stuff ****/
2543 
2545  mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_neighbor;
2546  mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_face_neighbor;
2547  mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_neighbor;
2548  mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_face_neighbor;
2549 
2551  std::map<unsigned int, FEBase *> _holder_fe_neighbor_helper;
2552  std::map<unsigned int, FEBase *> _holder_fe_face_neighbor_helper;
2553 
2555  mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_lower;
2557  mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_lower;
2559  std::map<unsigned int, FEBase *> _holder_fe_lower_helper;
2560 
2566  mutable bool _need_JxW_neighbor;
2574 
2575  /********** mortar stuff *************/
2576 
2578  const std::vector<Real> * _JxW_msm;
2580  std::unique_ptr<FEBase> _fe_msm;
2588 
2592 
2593 protected:
2595  const Elem * _current_elem;
2603  unsigned int _current_side;
2605  const Elem * _current_side_elem;
2621  const Node * _current_node;
2628 
2643 
2646 
2647  /*
2648  * Residual contributions <tag_index, ivar>
2649  *
2650  * tag_index is the index into _residual_vector_tags, that is, _sub_Re[0] corresponds to the tag
2651  * with TagID _residual_vector_tags[0]._id
2652  *
2653  * When ivar corresponds to an array variable, the dense vector is in size of ndof * count,
2654  * where count is the number of components of the array variable. The local residual is ordered
2655  * as (r_i,j, i = 1,...,ndof; j = 1,...,count).
2656  *
2657  * Dense vectors for variables (ivar+i, i = 1,...,count) are empty.
2658  */
2659  std::vector<std::vector<DenseVector<Number>>> _sub_Re;
2660  std::vector<std::vector<DenseVector<Number>>> _sub_Rn;
2662  std::vector<std::vector<DenseVector<Number>>> _sub_Rl;
2663 
2666 
2667  /*
2668  * Jacobian contributions <Tag, ivar, jvar>
2669  * When ivar corresponds to an array variable, the number of rows of the dense matrix is in size
2670  * of indof * icount, where icount is the number of components of ivar. When jvar corresponds to
2671  * an array variable, the number of columns of the dense matrix is in size of jndof * jcount,
2672  * where jcount is the number of components of jvar. The local residual is ordered as
2673  * (K_(i,j,k,l), k=1,...,jndof; l = 1,...,jcout; i = 1,...,indof; j = 1,...,icount).
2674  *
2675  * Dense matrices for variables (ivar+i, i = 1,...,icount) or (jvar+j, j = 1,...,jcount) are
2676  * empty.
2677  */
2678  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kee;
2679  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Keg;
2680 
2682  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Ken;
2684  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kne;
2686  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Knn;
2688  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kll;
2690  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kle;
2692  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kln;
2694  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kel;
2696  std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Knl;
2697 
2700 
2701  // Shape function values, gradients. second derivatives
2705 
2709 
2713 
2717 
2718  // Shape function values, gradients, second derivatives
2724 
2730 
2736 
2742 
2744  {
2745  public:
2751  };
2752 
2754  {
2755  public:
2761  };
2762 
2764  mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data;
2765  mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_face;
2766  mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_neighbor;
2767  mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_face_neighbor;
2768  mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_lower;
2769  mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_dual_lower;
2770 
2772  mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data;
2773  mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_face;
2774  mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_neighbor;
2775  mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_face_neighbor;
2776  mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_lower;
2777  mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_dual_lower;
2778 
2779  mutable std::map<FEType, ADTemplateVariablePhiGradient<Real>> _ad_grad_phi_data;
2780  mutable std::map<FEType, ADTemplateVariablePhiGradient<RealVectorValue>> _ad_vector_grad_phi_data;
2781  mutable std::map<FEType, ADTemplateVariablePhiGradient<Real>> _ad_grad_phi_data_face;
2782  mutable std::map<FEType, ADTemplateVariablePhiGradient<RealVectorValue>>
2784 
2794  const std::vector<VectorTag> & _residual_vector_tags;
2795 
2797  std::vector<std::vector<Real>> _cached_residual_values;
2798 
2800  std::vector<std::vector<dof_id_type>> _cached_residual_rows;
2801 
2803 
2805  std::vector<std::vector<Real>> _cached_jacobian_values;
2807  std::vector<std::vector<dof_id_type>> _cached_jacobian_rows;
2809  std::vector<std::vector<dof_id_type>> _cached_jacobian_cols;
2810 
2812 
2817  std::vector<bool> _component_block_diagonal;
2818 
2820  std::vector<dof_id_type> _temp_dof_indices;
2821 
2823  std::vector<Point> _temp_reference_points;
2824 
2826  std::vector<VectorValue<ADReal>> _ad_dxyzdxi_map;
2827  std::vector<VectorValue<ADReal>> _ad_dxyzdeta_map;
2828  std::vector<VectorValue<ADReal>> _ad_dxyzdzeta_map;
2829  std::vector<VectorValue<ADReal>> _ad_d2xyzdxi2_map;
2830  std::vector<VectorValue<ADReal>> _ad_d2xyzdxideta_map;
2831  std::vector<VectorValue<ADReal>> _ad_d2xyzdeta2_map;
2832  std::vector<ADReal> _ad_jac;
2835  std::vector<ADReal> _ad_dxidx_map;
2836  std::vector<ADReal> _ad_dxidy_map;
2837  std::vector<ADReal> _ad_dxidz_map;
2838  std::vector<ADReal> _ad_detadx_map;
2839  std::vector<ADReal> _ad_detady_map;
2840  std::vector<ADReal> _ad_detadz_map;
2841  std::vector<ADReal> _ad_dzetadx_map;
2842  std::vector<ADReal> _ad_dzetady_map;
2843  std::vector<ADReal> _ad_dzetadz_map;
2844 
2850 
2854  std::vector<std::pair<unsigned int, unsigned short>> _disp_numbers_and_directions;
2855 
2856  mutable bool _calculate_xyz;
2857  mutable bool _calculate_face_xyz;
2859 
2862  mutable bool _calculate_ad_coord;
2863 
2864  mutable std::set<FEType> _need_second_derivative;
2865  mutable std::set<FEType> _need_second_derivative_neighbor;
2866  mutable std::set<FEType> _need_curl;
2867  mutable std::set<FEType> _need_div;
2868  mutable std::set<FEType> _need_face_div;
2869  mutable std::set<FEType> _need_neighbor_div;
2870  mutable std::set<FEType> _need_face_neighbor_div;
2871 
2873  const NumericVector<Real> * _scaling_vector = nullptr;
2874 
2881 
2882  const Elem * _msm_elem = nullptr;
2883 
2888 
2893 
2897  std::vector<dof_id_type> _row_indices, _column_indices;
2898 
2901 
2903  std::vector<Point> _current_neighbor_ref_points;
2904 };
2905 
2906 template <typename OutputType>
2909 {
2910  buildLowerDFE(type);
2911  return _fe_shape_data_lower[type]->_phi;
2912 }
2913 
2914 template <typename OutputType>
2917 {
2918  buildLowerDDualFE(type);
2919  return _fe_shape_data_dual_lower[type]->_phi;
2920 }
2921 
2922 template <typename OutputType>
2925 {
2926  buildLowerDFE(type);
2927  return _fe_shape_data_lower[type]->_grad_phi;
2928 }
2929 
2930 template <typename OutputType>
2933 {
2934  buildLowerDDualFE(type);
2935  return _fe_shape_data_dual_lower[type]->_grad_phi;
2936 }
2937 
2938 template <>
2940 Assembly::feADGradPhi<RealVectorValue>(FEType type) const
2941 {
2942  return _ad_vector_grad_phi_data[type];
2943 }
2944 
2945 template <>
2947 Assembly::feADGradPhiFace<RealVectorValue>(FEType type) const
2948 {
2949  return _ad_vector_grad_phi_data_face[type];
2950 }
2951 
2952 template <>
2954 Assembly::fePhi<VectorValue<Real>>(FEType type) const;
2955 
2956 template <>
2958 Assembly::feGradPhi<VectorValue<Real>>(FEType type) const;
2959 
2960 template <>
2962 Assembly::feSecondPhi<VectorValue<Real>>(FEType type) const;
2963 
2964 template <>
2966 Assembly::fePhiLower<VectorValue<Real>>(FEType type) const;
2967 
2968 template <>
2970 Assembly::feDualPhiLower<VectorValue<Real>>(FEType type) const;
2971 
2972 template <>
2974 Assembly::feGradPhiLower<VectorValue<Real>>(FEType type) const;
2975 
2976 template <>
2978 Assembly::feGradDualPhiLower<VectorValue<Real>>(FEType type) const;
2979 
2980 template <>
2982 Assembly::fePhiFace<VectorValue<Real>>(FEType type) const;
2983 
2984 template <>
2986 Assembly::feGradPhiFace<VectorValue<Real>>(FEType type) const;
2987 
2988 template <>
2990 Assembly::feSecondPhiFace<VectorValue<Real>>(FEType type) const;
2991 
2992 template <>
2994 Assembly::fePhiNeighbor<VectorValue<Real>>(FEType type) const;
2995 
2996 template <>
2998 Assembly::feGradPhiNeighbor<VectorValue<Real>>(FEType type) const;
2999 
3000 template <>
3002 Assembly::feSecondPhiNeighbor<VectorValue<Real>>(FEType type) const;
3003 
3004 template <>
3006 Assembly::fePhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3007 
3008 template <>
3010 Assembly::feGradPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3011 
3012 template <>
3014 Assembly::feSecondPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3015 
3016 template <>
3018 Assembly::feCurlPhi<VectorValue<Real>>(FEType type) const;
3019 
3020 template <>
3022 Assembly::feCurlPhiFace<VectorValue<Real>>(FEType type) const;
3023 
3024 template <>
3026 Assembly::feCurlPhiNeighbor<VectorValue<Real>>(FEType type) const;
3027 
3028 template <>
3030 Assembly::feCurlPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3031 
3032 template <>
3034 Assembly::feDivPhi<VectorValue<Real>>(FEType type) const;
3035 
3036 template <>
3038 Assembly::feDivPhiFace<VectorValue<Real>>(FEType type) const;
3039 
3040 template <>
3042 Assembly::feDivPhiNeighbor<VectorValue<Real>>(FEType type) const;
3043 
3044 template <>
3046 Assembly::feDivPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3047 
3048 template <>
3050 Assembly::adGradPhi<RealVectorValue>(const MooseVariableFE<RealVectorValue> & v) const
3051 {
3052  return _ad_vector_grad_phi_data.at(v.feType());
3053 }
3054 
3055 template <typename Residuals, typename Indices>
3056 void
3057 Assembly::cacheResiduals(const Residuals & residuals,
3058  const Indices & input_row_indices,
3059  const Real scaling_factor,
3060  LocalDataKey,
3061  const std::set<TagID> & vector_tags)
3062 {
3063  mooseAssert(residuals.size() == input_row_indices.size(),
3064  "The number of residuals should match the number of dof indices");
3065  mooseAssert(residuals.size() >= 1, "Why you calling me with no residuals?");
3066 
3067  if (!computingResidual() || vector_tags.empty())
3068  return;
3069 
3070  if (residuals.size() == 1)
3071  {
3072  // No constraining is required. (This is likely a finite volume computation if we only have a
3073  // single dof)
3075  residuals, input_row_indices, scaling_factor, LocalDataKey{}, vector_tags);
3076  return;
3077  }
3078 
3079  // Need to make a copy because we might modify this in constrain_element_vector
3080  _row_indices.assign(input_row_indices.begin(), input_row_indices.end());
3081 
3083  for (const auto i : index_range(_row_indices))
3084  _element_vector(i) = MetaPhysicL::raw_value(residuals[i]) * scaling_factor;
3085 
3086  // At time of writing, this method doesn't do anything with the asymmetric_constraint_rows
3087  // argument, but we set it to false to be consistent with processLocalResidual
3089  _element_vector, _row_indices, /*asymmetric_constraint_rows=*/false);
3090 
3091  for (const auto i : index_range(_row_indices))
3092  cacheResidual(_row_indices[i], _element_vector(i), vector_tags);
3093 }
3094 
3095 template <typename Residuals, typename Indices>
3096 void
3098  const Indices & row_indices,
3099  const Real scaling_factor,
3100  LocalDataKey,
3101  const std::set<TagID> & vector_tags)
3102 {
3103  mooseAssert(residuals.size() == row_indices.size(),
3104  "The number of residuals should match the number of dof indices");
3105  mooseAssert(residuals.size() >= 1, "Why you calling me with no residuals?");
3106 
3107  if (computingResidual() && !vector_tags.empty())
3108  for (const auto i : index_range(row_indices))
3109  cacheResidual(
3110  row_indices[i], MetaPhysicL::raw_value(residuals[i]) * scaling_factor, vector_tags);
3111 }
3112 
3113 template <typename Residuals, typename Indices>
3114 void
3115 Assembly::cacheJacobian(const Residuals & residuals,
3116  const Indices & input_row_indices,
3117  const Real scaling_factor,
3118  LocalDataKey,
3119  const std::set<TagID> & matrix_tags)
3120 {
3121  if (!computingJacobian() || matrix_tags.empty())
3122  return;
3123 
3124  if (residuals.size() == 1)
3125  {
3126  // No constraining is required. (This is likely a finite volume computation if we only have a
3127  // single dof)
3129  residuals, input_row_indices, scaling_factor, LocalDataKey{}, matrix_tags);
3130  return;
3131  }
3132 
3133  const auto & compare_dofs = residuals[0].derivatives().nude_indices();
3134 #ifndef NDEBUG
3135  auto compare_dofs_set = std::set<dof_id_type>(compare_dofs.begin(), compare_dofs.end());
3136 
3137  for (const auto i : make_range(decltype(residuals.size())(1), residuals.size()))
3138  {
3139  const auto & residual = residuals[i];
3140  auto current_dofs_set = std::set<dof_id_type>(residual.derivatives().nude_indices().begin(),
3141  residual.derivatives().nude_indices().end());
3142  mooseAssert(compare_dofs_set == current_dofs_set,
3143  "We're going to see whether the dof sets are the same. IIRC the degree of freedom "
3144  "dependence (as indicated by the dof index set held by the ADReal) has to be the "
3145  "same for every residual passed to this method otherwise constrain_element_matrix "
3146  "will not work.");
3147  }
3148 #endif
3149  _column_indices.assign(compare_dofs.begin(), compare_dofs.end());
3150 
3151  // If there's no derivatives then there is nothing to do. Moreover, if we pass zero size column
3152  // indices to constrain_element_matrix then we will potentially get errors out of BLAS
3153  if (!_column_indices.size())
3154  return;
3155 
3156  // Need to make a copy because we might modify this in constrain_element_matrix
3157  _row_indices.assign(input_row_indices.begin(), input_row_indices.end());
3158 
3160  for (const auto i : index_range(_row_indices))
3161  {
3162  const auto & sparse_derivatives = residuals[i].derivatives();
3163 
3164  for (const auto j : index_range(_column_indices))
3165  _element_matrix(i, j) = sparse_derivatives[_column_indices[j]] * scaling_factor;
3166  }
3167 
3169 
3170  for (const auto i : index_range(_row_indices))
3171  for (const auto j : index_range(_column_indices))
3172  cacheJacobian(_row_indices[i], _column_indices[j], _element_matrix(i, j), {}, matrix_tags);
3173 }
3174 
3175 template <typename Residuals, typename Indices>
3176 void
3177 Assembly::cacheJacobianWithoutConstraints(const Residuals & residuals,
3178  const Indices & row_indices,
3179  const Real scaling_factor,
3180  LocalDataKey,
3181  const std::set<TagID> & matrix_tags)
3182 {
3183  mooseAssert(residuals.size() == row_indices.size(),
3184  "The number of residuals should match the number of dof indices");
3185  mooseAssert(residuals.size() >= 1, "Why you calling me with no residuals?");
3186 
3187  if (!computingJacobian() || matrix_tags.empty())
3188  return;
3189 
3190  for (const auto i : index_range(row_indices))
3191  {
3192  const auto row_index = row_indices[i];
3193 
3194  const auto & sparse_derivatives = residuals[i].derivatives();
3195  const auto & column_indices = sparse_derivatives.nude_indices();
3196  const auto & raw_derivatives = sparse_derivatives.nude_data();
3197 
3198  for (std::size_t j = 0; j < column_indices.size(); ++j)
3199  cacheJacobian(
3200  row_index, column_indices[j], raw_derivatives[j] * scaling_factor, {}, matrix_tags);
3201  }
3202 }
3203 
3204 inline const Real &
3206 {
3209 }
3210 
3211 inline const Real &
3213 {
3216 }
3217 
3218 inline void
3220  std::vector<std::pair<unsigned int, unsigned short>> && disp_numbers_and_directions)
3221 {
3222  _disp_numbers_and_directions = std::move(disp_numbers_and_directions);
3223 }
3224 
3225 inline void
3226 Assembly::setCurrentLowerDElem(const Elem * const lower_d_elem)
3227 {
3228  _current_lower_d_elem = lower_d_elem;
3229 }
const Real & neighborVolume()
Returns the reference to the current neighbor volume.
Definition: Assembly.h:508
VariablePhiSecond _second_phi_face
Definition: Assembly.h:2708
const Elem *const & elem() const
Return the current element.
Definition: Assembly.h:414
VariablePhiSecond _second_phi_face_neighbor
Definition: Assembly.h:2716
MooseArray< VectorValue< ADReal > > _ad_normals
Definition: Assembly.h:2846
const VectorVariablePhiValue & phi(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1372
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:204
void copyShapes(MooseVariableField< T > &v)
Definition: Assembly.C:2995
libMesh::ElemSideBuilder _compute_face_map_side_elem_builder
In place side element builder for computeFaceMap()
Definition: Assembly.h:2880
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:180
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_face
types of finite elements
Definition: Assembly.h:2513
bool _need_neighbor_elem_volume
true is apps need to compute neighbor element volume
Definition: Assembly.h:2617
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:3455
const unsigned int & neighborSide() const
Returns the current neighboring side.
Definition: Assembly.h:452
VectorVariablePhiSecond & secondPhi(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1501
ArbitraryQuadrature * _current_qrule_arbitrary
The current arbitrary quadrature rule used within the element interior.
Definition: Assembly.h:2413
std::map< FEType, FEBase * > _current_fe
The "volume" fe object that matches the current elem.
Definition: Assembly.h:2381
MooseArray< Real > _curvatures
Definition: Assembly.h:2848
std::vector< ADReal > _ad_detadz_map
Definition: Assembly.h:2840
VectorVariablePhiValue _phi
Definition: Assembly.h:2756
SystemBase & _sys
Definition: Assembly.h:2311
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:2800
The Kokkos assembly class.
std::vector< std::vector< dof_id_type > > _cached_jacobian_rows
Row where the corresponding cached value should go.
Definition: Assembly.h:2807
unsigned int _max_cached_residuals
Definition: Assembly.h:2802
std::map< FEType, ADTemplateVariablePhiGradient< Real > > _ad_grad_phi_data_face
Definition: Assembly.h:2781
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhi(FEType type) const
Definition: Assembly.h:1733
bool _user_added_fe_lower_of_helper_type
Definition: Assembly.h:2364
MooseArray< Point > _current_physical_points
This will be filled up with the physical points passed into reinitAtPhysical() if it is called...
Definition: Assembly.h:2645
VariablePhiSecond & secondPhiNeighbor(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1599
const VariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< Real > &) const
Definition: Assembly.h:1363
const libMesh::FEType & feType() const
Get the type of finite element object.
std::vector< std::unique_ptr< FEBase > > _unique_fe_lower_helper
Definition: Assembly.h:2372
MooseArray< ADReal > _ad_coord
The AD version of the current coordinate transformation coefficients.
Definition: Assembly.h:2425
const MooseArray< ADPoint > & adQPointsFace() const
Definition: Assembly.h:401
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:3289
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & couplingEntries()
Definition: Assembly.h:1293
void buildNeighborFE(FEType type) const
Build FEs for a neighbor with a type.
Definition: Assembly.C:314
const VariablePhiSecond & secondPhi() const
Definition: Assembly.h:1328
void setMortarQRule(Order order)
Specifies a custom qrule for integration on mortar segment mesh.
Definition: Assembly.C:735
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe
Each dimension&#39;s actual vector fe objects indexed on type.
Definition: Assembly.h:2403
typename OutputTools< typename Moose::ADType< T >::type >::VariablePhiGradient ADTemplateVariablePhiGradient
Definition: MooseTypes.h:638
void buildVectorLowerDFE(FEType type) const
Build Vector FEs for a lower dimensional element with a type.
Definition: Assembly.C:403
MooseArray< Real > _coord_neighbor
The current coordinate transformation coefficients.
Definition: Assembly.h:2570
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:144
void buildFE(FEType type) const
Build FEs with a type.
Definition: Assembly.C:266
T * qruleFaceHelper(const Elem *elem, unsigned int side, std::function< T *(QRules &)> rule_fn)
Definition: Assembly.h:2470
libMesh::QBase *const & writeableQRule()
Returns the reference to the current quadrature being used.
Definition: Assembly.h:241
const bool & _computing_residual
Whether we are currently computing the residual.
Definition: Assembly.h:2321
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kle
dlower/dsecondary (or dlower/delement)
Definition: Assembly.h:2690
VectorVariablePhiGradient & gradPhiFace(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1518
void setCurrentBoundaryID(BoundaryID i)
set the current boundary ID
Definition: Assembly.h:434
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:3470
const std::vector< std::pair< MooseVariableFieldBase *, MooseVariableScalar * > > & fieldScalarCouplingEntries() const
Definition: Assembly.h:1308
const OutputTools< OutputType >::VariablePhiValue & fePhi(FEType type) const
Definition: Assembly.h:1618
void setFaceQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for face integration.
Definition: Assembly.C:674
libMesh::QBase *const & writeableQRuleNeighbor()
Returns the reference to the current quadrature being used on a current neighbor. ...
Definition: Assembly.h:527
Keeps track of stuff related to assembling.
Definition: Assembly.h:109
Assembly(SystemBase &sys, THREAD_ID tid)
Definition: Assembly.C:79
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data
Shape function values, gradients, second derivatives for each FE type.
Definition: Assembly.h:2764
Class for stuff related to variables.
Definition: Adaptivity.h:31
const MooseArray< ADReal > & adJxW() const
Definition: Assembly.h:278
const ADTemplateVariablePhiGradient< OutputType > & feADGradPhiFace(FEType type) const
Definition: Assembly.h:1673
void buildLowerDDualFE(FEType type) const
Definition: Assembly.C:382
VariablePhiGradient & gradPhiFace(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1582
unsigned int TagID
Definition: MooseTypes.h:210
VectorVariablePhiValue _vector_phi
Definition: Assembly.h:2719
MooseArray< Real > _current_JxW_neighbor
The current transformed jacobian weights on a neighbor&#39;s face.
Definition: Assembly.h:2568
std::shared_ptr< XFEMInterface > _xfem
The XFEM controller.
Definition: Assembly.h:2378
void reinitNeighborLowerDElem(const Elem *elem)
reinitialize a neighboring lower dimensional element
Definition: Assembly.C:2381
virtual ~Assembly()
Definition: Assembly.C:186
void setCurrentLowerDElem(const Elem *const lower_d_elem)
Set the current lower dimensional element.
Definition: Assembly.h:3226
const VectorVariablePhiDivergence & divPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1433
void prepareJacobianBlock()
Sizes and zeroes the Jacobian blocks used for the current element.
Definition: Assembly.C:2682
const libMesh::QBase *const & qRuleFace() const
Returns the reference to the current quadrature being used on a current face.
Definition: Assembly.h:322
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:1153
VariablePhiSecond & secondPhiFace(const MooseVariableField< Real > &)
Definition: Assembly.h:1470
VectorValue< Real > RealVectorValue
Definition: SubProblem.h:33
VariablePhiSecond & secondPhi(const MooseVariableField< Real > &)
Definition: Assembly.h:1466
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kel
dsecondary/dlower (or delement/dlower)
Definition: Assembly.h:2694
MooseArray< Real > _coord
The current coordinate transformation coefficients.
Definition: Assembly.h:2423
const OutputTools< OutputType >::VariablePhiValue & fePhiLower(FEType type) const
Definition: Assembly.h:2908
VariablePhiDivergence _div_phi
Definition: Assembly.h:2750
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:3112
void reinitFE(const Elem *elem)
Just an internal helper function to reinit the volume FE objects.
Definition: Assembly.C:760
libMesh::QBase * _current_qrule_neighbor
quadrature rule used on neighbors
Definition: Assembly.h:2562
const Real & neighborLowerDElemVolume() const
Definition: Assembly.h:3212
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:1835
VariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1608
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:2238
const MooseArray< Point > & physicalPoints() const
The current points in physical space where we have reinited through reinitAtPhysical() ...
Definition: Assembly.h:270
VectorVariablePhiGradient & gradPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1539
void prepareNonlocal()
Definition: Assembly.C:2720
VariablePhiGradient _grad_phi
Definition: Assembly.h:2703
std::map< unsigned int, FEBase * > _holder_fe_neighbor_helper
Each dimension&#39;s helper objects.
Definition: Assembly.h:2551
const VectorVariablePhiSecond & secondPhi(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1380
std::unique_ptr< FEBase > _fe_msm
A FE object for working on mortar segement elements.
Definition: Assembly.h:2580
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_face_neighbor
Definition: Assembly.h:2767
const VectorVariablePhiValue & phiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1414
VectorVariablePhiValue & phiFace(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1514
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & nonlocalCouplingEntries()
Definition: Assembly.h:1303
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:617
VariablePhiSecond _second_phi_neighbor
Definition: Assembly.h:2712
void setXFEM(std::shared_ptr< XFEMInterface > xfem)
Set the pointer to the XFEM controller object.
Definition: Assembly.h:1800
const MooseArray< ADPoint > & adQPoints() const
Definition: Assembly.h:395
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:1790
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:3530
bool _current_elem_volume_computed
Boolean to indicate whether current element volumes has been computed.
Definition: Assembly.h:2625
std::vector< ADReal > _ad_detady_map
Definition: Assembly.h:2839
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:2274
MooseVariableFE< Real > MooseVariable
Definition: Assembly.h:59
const VectorVariablePhiDivergence & divPhi(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1388
VectorVariablePhiGradient _vector_grad_phi_neighbor
Definition: Assembly.h:2732
const MooseArray< Point > & qPointsFaceNeighbor() const
Returns the reference to the current quadrature points being used on the neighbor face...
Definition: Assembly.h:539
std::vector< ADReal > _ad_dzetadz_map
Definition: Assembly.h:2843
std::vector< std::unique_ptr< FEBase > > _unique_fe_neighbor_helper
Definition: Assembly.h:2371
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kll
dlower/dlower
Definition: Assembly.h:2688
VectorVariablePhiValue & phiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1555
VectorVariablePhiCurl & curlPhi(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1505
bool _user_added_fe_face_neighbor_of_helper_type
Definition: Assembly.h:2362
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:3561
bool _have_p_refinement
Whether we have ever conducted p-refinement.
Definition: Assembly.h:2900
VariablePhiValue _phi
Definition: Assembly.h:2746
Real _current_neighbor_volume
Volume of the current neighbor.
Definition: Assembly.h:2619
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:2292
ArbitraryQuadrature * qruleArbitraryFace(const Elem *elem, unsigned int side)
Definition: Assembly.C:1921
std::map< FEType, FEBase * > _current_fe_face
The "face" fe object that matches the current elem.
Definition: Assembly.h:2383
VectorVariablePhiGradient & gradPhi(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1497
const VectorVariablePhiCurl & curlPhi(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1384
std::vector< Point > _current_neighbor_ref_points
The current reference points on the neighbor element.
Definition: Assembly.h:2903
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:41
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kln
dlower/dprimary (or dlower/dneighbor)
Definition: Assembly.h:2692
MooseVariableFE< RealVectorValue > VectorMooseVariable
Definition: Assembly.h:61
void setVolumeQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for volume integration.
Definition: Assembly.C:655
const Elem * _current_neighbor_elem
The current neighbor "element".
Definition: Assembly.h:2609
void addJacobianNonlocal(GlobalDataKey)
Adds non-local Jacobian to the global Jacobian matrices.
Definition: Assembly.C:3885
VectorVariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1559
VariablePhiValue & phiFace(const MooseVariableField< Real > &)
Definition: Assembly.h:1468
std::vector< std::vector< DenseVector< Number > > > _sub_Rn
Definition: Assembly.h:2660
const OutputTools< OutputType >::VariablePhiValue & feDualPhiLower(FEType type) const
Definition: Assembly.h:2916
MooseMesh & _mesh
Definition: Assembly.h:2351
const VariablePhiValue & phi() const
Definition: Assembly.h:1319
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_neighbor
Definition: Assembly.h:2766
std::map< unsigned int, FEBase * > _holder_fe_face_neighbor_helper
Definition: Assembly.h:2552
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:73
const VariablePhiGradient & gradPhi() const
Definition: Assembly.h:1326
MooseArray< Real > _current_JxW_face
The current transformed jacobian weights on a face.
Definition: Assembly.h:2527
void modifyWeightsDueToXFEM(const Elem *elem)
Update the integration weights for XFEM partial elements.
Definition: Assembly.C:4533
DenseMatrix< Number > _tmp_Ke
auxiliary matrix for scaling jacobians (optimization to avoid expensive construction/destruction) ...
Definition: Assembly.h:2699
libMesh::QBase * writeableQRuleFace(unsigned int dim, SubdomainID block, InternalDataKey)
Returns the pointer to the quadrature used on a face of specified block and dimension.
Definition: Assembly.h:335
const Elem * _current_elem
The current "element" we are currently on.
Definition: Assembly.h:2595
VectorVariablePhiCurl _vector_curl_phi_neighbor
Definition: Assembly.h:2734
VectorVariablePhiCurl & curlPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1547
const VariablePhiSecond & secondPhiNeighbor(const MooseVariableField< Real > &) const
Definition: Assembly.h:1354
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:156
const MooseArray< Moose::GenericType< Point, is_ad > > & genericQPoints() const
const libMesh::QBase *const & qRuleMortar() const
Returns a reference to the quadrature rule for the mortar segments.
Definition: Assembly.h:712
THREAD_ID _tid
Thread number (id)
Definition: Assembly.h:2349
void reinitFEFaceNeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
Definition: Assembly.C:1571
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:159
VectorVariablePhiGradient _vector_grad_phi
Definition: Assembly.h:2720
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.
std::vector< std::unique_ptr< FEBase > > _unique_fe_face_helper
Definition: Assembly.h:2369
std::vector< std::vector< std::vector< unsigned char > > > _jacobian_block_nonlocal_used
Definition: Assembly.h:2341
std::vector< std::pair< MooseVariableScalar *, MooseVariableFieldBase * > > _cm_sf_entry
Entries in the coupling matrix for scalar variables vs field variables.
Definition: Assembly.h:2334
VectorVariablePhiValue _vector_phi_neighbor
Definition: Assembly.h:2731
void prepareNeighbor()
Definition: Assembly.C:2799
void resizeADMappingObjects(unsigned int n_qp, unsigned int dim)
resize any objects that contribute to automatic differentiation-related mapping calculations ...
Definition: Assembly.C:971
OutputTools< Real >::VariablePhiValue VariablePhiValue
Definition: MooseTypes.h:320
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:2283
unsigned int m() const
VariablePhiValue & phi(const MooseVariableField< Real > &)
Definition: Assembly.h:1464
void setCoordinateTransformation(const libMesh::QBase *qrule, const Points &q_points, Coords &coord, SubdomainID sub_id)
Definition: Assembly.C:1729
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_face_neighbor
Definition: Assembly.h:2548
const VariablePhiValue & phiFaceNeighbor(const MooseVariableField< Real > &) const
Definition: Assembly.h:1359
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:2817
Real _current_elem_volume
Volume of the current element.
Definition: Assembly.h:2601
OutputTools< RealVectorValue >::VariablePhiGradient VectorVariablePhiGradient
Definition: MooseTypes.h:338
std::map< FEType, FEBase * > _current_fe_face_neighbor
The "neighbor face" fe object that matches the current elem.
Definition: Assembly.h:2387
const MooseArray< ADReal > & adCurvatures() const
Definition: Assembly.C:4813
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:258
std::map< FEType, FEVectorBase * > _current_vector_fe_face
The "face" vector fe object that matches the current elem.
Definition: Assembly.h:2392
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:2368
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:3213
const FEType _helper_type
The finite element type of the FE helper classes.
Definition: Assembly.h:2357
const Elem *const & msmElem() const
Definition: Assembly.h:1955
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:3372
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:1142
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:4455
const bool & _computing_residual_and_jacobian
Whether we are currently computing the residual and Jacobian.
Definition: Assembly.h:2327
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Knn
jacobian contributions from the neighbor <Tag, ivar, jvar>
Definition: Assembly.h:2686
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:1816
const ADTemplateVariablePhiGradient< T > & adGradPhi(const MooseVariableFE< T > &v) const
Definition: Assembly.h:1321
Base class for a system (of equations)
Definition: SystemBase.h:84
const std::vector< Eigen::Map< RealDIMValue > > & mappedNormals() const
Definition: Assembly.h:362
libMesh::QBase * _current_qrule_face
quadrature rule used on faces
Definition: Assembly.h:2521
const VariablePhiValue & phiNeighbor(const MooseVariableField< Real > &) const
Definition: Assembly.h:1346
FEGenericBase< RealGradient > FEVectorBase
VectorVariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1563
unsigned int numExtraElemIntegers() const
Number of extra element integers Assembly tracked.
Definition: Assembly.h:373
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:120
std::set< FEType > _need_second_derivative_neighbor
Definition: Assembly.h:2865
std::vector< std::vector< Real > > _cached_jacobian_values
Values cached by calling cacheJacobian()
Definition: Assembly.h:2805
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:2247
VariablePhiValue _phi
Definition: Assembly.h:2702
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhiFaceNeighbor(FEType type) const
Definition: Assembly.h:1725
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > _cm_ff_entry
Entries in the coupling matrix for field variables.
Definition: Assembly.h:2330
void addJacobianNeighborLowerD(GlobalDataKey)
Add all portions of the Jacobian except PrimaryPrimary, e.g.
Definition: Assembly.C:3945
const MooseArray< Real > & mortarCoordTransformation() const
Returns the reference to the coordinate transformation coefficients on the mortar segment mesh...
Definition: Assembly.h:294
std::map< FEType, FEVectorBase * > _current_vector_fe
The "volume" vector fe object that matches the current elem.
Definition: Assembly.h:2390
VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1595
VariablePhiGradient _grad_phi
Definition: Assembly.h:2747
std::vector< VectorValue< ADReal > > _ad_dxyzdeta_map
Definition: Assembly.h:2827
VariablePhiSecond & secondPhiNeighbor(const MooseVariableField< Real > &)
Definition: Assembly.h:1477
void prepareScalar()
Definition: Assembly.C:2945
DenseVector< Real > getJacobianDiagonal(DenseMatrix< Number > &ke)
Definition: Assembly.h:1886
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
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:378
void modifyFaceWeightsDueToXFEM(const Elem *elem, unsigned int side=0)
Update the face integration weights for XFEM partial elements.
Definition: Assembly.C:4553
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:1992
const VectorVariablePhiSecond & secondPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1424
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiFace(FEType type) const
Definition: Assembly.h:1666
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhiFaceNeighbor(FEType type) const
Definition: Assembly.h:1788
OutputTools< Real >::VariablePhiSecond VariablePhiSecond
Definition: MooseTypes.h:322
std::unique_ptr< libMesh::QBase > face
area/face (meshdim-1) quadrature rule
Definition: Assembly.h:2443
DenseVector< Number > _tmp_Re
auxiliary vector for scaling residuals (optimization to avoid expensive construction/destruction) ...
Definition: Assembly.h:2665
unsigned int _mesh_dimension
Definition: Assembly.h:2353
std::vector< Eigen::Map< RealDIMValue > > _mapped_normals
Mapped normals.
Definition: Assembly.h:2531
VectorVariablePhiDivergence _vector_div_phi_face
Definition: Assembly.h:2729
VectorVariablePhiCurl & curlPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1567
void cacheJacobian(GlobalDataKey)
Takes the values that are currently in _sub_Kee and appends them to the cached values.
Definition: Assembly.C:4060
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhiNeighbor(FEType type) const
Definition: Assembly.h:1780
void reinit(const Elem *elem)
Reinitialize objects (JxW, q_points, ...) for an elements.
const NumericVector< Real > * _scaling_vector
The map from global index to variable scaling factor.
Definition: Assembly.h:2873
void assignDisplacements(std::vector< std::pair< unsigned int, unsigned short >> &&disp_numbers_and_directions)
Assign the displacement numbers and directions.
Definition: Assembly.h:3219
void addCachedResiduals(GlobalDataKey, const std::vector< VectorTag > &tags)
Pushes all cached residuals to the global residual vectors associated with each tag.
Definition: Assembly.C:3485
Data structure for tracking/grouping a set of quadrature rules for a particular dimensionality of mes...
Definition: Assembly.h:2429
unsigned int _max_cached_jacobians
Definition: Assembly.h:2811
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:3153
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Ken
jacobian contributions from the element and neighbor <Tag, ivar, jvar>
Definition: Assembly.h:2682
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_dual_lower
Definition: Assembly.h:2777
Nonlinear system to be solved.
VectorVariablePhiValue _vector_phi_face
Definition: Assembly.h:2725
std::vector< VectorValue< ADReal > > _ad_dxyzdzeta_map
Definition: Assembly.h:2828
const VectorVariablePhiSecond & secondPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1401
std::vector< Point > _temp_reference_points
Temporary work data for reinitAtPhysical()
Definition: Assembly.h:2823
std::vector< std::pair< MooseVariableScalar *, MooseVariableScalar * > > _cm_ss_entry
Entries in the coupling matrix for scalar variables.
Definition: Assembly.h:2336
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kne
jacobian contributions from the neighbor and element <Tag, ivar, jvar>
Definition: Assembly.h:2684
const Elem * _current_neighbor_lower_d_elem
The current neighboring lower dimensional element.
Definition: Assembly.h:2632
OutputTools< RealVectorValue >::VariablePhiDivergence VectorVariablePhiDivergence
Definition: MooseTypes.h:341
unsigned int _current_neighbor_side
The current side of the selected neighboring element (valid only when working with sides) ...
Definition: Assembly.h:2613
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:3437
void init(const libMesh::CouplingMatrix *cm)
Initialize the Assembly object and set the CouplingMatrix for use throughout.
Definition: Assembly.C:2465
VectorVariablePhiSecond & secondPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1543
void prepareLowerD()
Prepare the Jacobians and residuals for a lower dimensional element.
Definition: Assembly.C:2838
bool _user_added_fe_neighbor_of_helper_type
Definition: Assembly.h:2363
void buildFaceNeighborFE(FEType type) const
Build FEs for a neighbor face with a type.
Definition: Assembly.C:336
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_face
Definition: Assembly.h:2773
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:2288
void computeCurrentFaceVolume()
Definition: Assembly.C:1771
const VectorVariablePhiCurl & curlPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1428
std::vector< std::vector< DenseVector< Number > > > _sub_Rl
residual contributions for each variable from the lower dimensional element
Definition: Assembly.h:2662
VariablePhiCurl _curl_phi
Definition: Assembly.h:2749
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:36
QRules & qrules(unsigned int dim)
Definition: Assembly.h:2489
static const subdomain_id_type invalid_subdomain_id
VectorVariablePhiGradient _vector_grad_phi_face_neighbor
Definition: Assembly.h:2738
std::unique_ptr< libMesh::QBase > vol
volume/elem (meshdim) quadrature rule
Definition: Assembly.h:2441
void prepareOffDiagScalar()
Definition: Assembly.C:2969
VectorVariablePhiSecond _second_phi
Definition: Assembly.h:2758
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhiFace(FEType type) const
Definition: Assembly.h:1772
bool needDual() const
Indicates whether dual shape functions are used (computation is now repeated on each element so expen...
Definition: Assembly.h:623
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:3857
std::vector< ADReal > _ad_dzetadx_map
Definition: Assembly.h:2841
void addJacobianLowerD(GlobalDataKey)
Add portions of the Jacobian of LowerLower, LowerSecondary, and SecondaryLower for boundary condition...
Definition: Assembly.C:4023
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:2301
VectorVariablePhiGradient _grad_phi
Definition: Assembly.h:2757
MooseArray< ADReal > _ad_curvatures
Definition: Assembly.h:2849
void computeGradPhiAD(const Elem *elem, unsigned int n_qp, ADTemplateVariablePhiGradient< OutputType > &grad_phi, libMesh::FEGenericBase< OutputType > *fe)
compute gradient of phi possibly with derivative information with respect to nonlinear displacement v...
ArbitraryQuadrature * _current_qrule_arbitrary_face
The current arbitrary quadrature rule used on the element face.
Definition: Assembly.h:2415
const MooseArray< ADReal > & adCoordTransformation() const
Returns the reference to the AD version of the coordinate transformation coefficients.
Definition: Assembly.h:300
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhiFaceNeighbor(FEType type) const
Definition: Assembly.h:1757
void modifyArbitraryWeights(const std::vector< Real > &weights)
Modify the weights when using the arbitrary quadrature rule.
Definition: Assembly.C:4580
FEBase * _current_fe_face_helper
helper object for transforming coordinates
Definition: Assembly.h:2519
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableScalar * > > _cm_fs_entry
Entries in the coupling matrix for field variables vs scalar variables.
Definition: Assembly.h:2332
const std::vector< Real > * _JxW_msm
A JxW for working on mortar segement elements.
Definition: Assembly.h:2578
std::vector< ADReal > _ad_dzetady_map
Definition: Assembly.h:2842
dof_id_type numeric_index_type
std::map< FEType, ADTemplateVariablePhiGradient< Real > > _ad_grad_phi_data
Definition: Assembly.h:2779
std::unordered_map< SubdomainID, std::vector< QRules > > _qrules
Holds quadrature rules for each dimension.
Definition: Assembly.h:2458
const MooseArray< Point > & normals() const
Returns the array of normals for quadrature points on a current side.
Definition: Assembly.h:357
MooseVariableFE< RealEigenVector > ArrayMooseVariable
Definition: Assembly.h:62
const VectorVariablePhiGradient & gradPhi(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1376
void prepareResidual()
Sizes and zeroes the residual for the current element.
Definition: Assembly.C:2704
VectorVariablePhiCurl _curl_phi
Definition: Assembly.h:2759
std::map< FEType, FEBase * > _current_fe_neighbor
The "neighbor" fe object that matches the current elem.
Definition: Assembly.h:2385
const ADTemplateVariablePhiGradient< OutputType > & feADGradPhi(FEType type) const
Definition: Assembly.h:1632
Real elementVolume(const Elem *elem) const
On-demand computation of volume element accounting for RZ/RSpherical.
Definition: Assembly.C:3782
VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< Real > &)
Definition: Assembly.h:1490
void cacheJacobianNeighbor(GlobalDataKey)
Takes the values that are currently in the neighbor Dense Matrices and appends them to the cached val...
Definition: Assembly.C:4112
SubdomainID _current_neighbor_subdomain_id
The current neighbor subdomain ID.
Definition: Assembly.h:2611
VectorVariablePhiValue _vector_phi_face_neighbor
Definition: Assembly.h:2737
VariablePhiSecond & secondPhi(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1579
VariablePhiValue & phiFaceNeighbor(const MooseVariableField< Real > &)
Definition: Assembly.h:1482
const VectorVariablePhiCurl & curlPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1405
std::vector< std::vector< DenseVector< Number > > > _sub_Re
Definition: Assembly.h:2659
VectorVariablePhiSecond & secondPhiFace(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1522
OutputTools< RealVectorValue >::VariablePhiSecond VectorVariablePhiSecond
Definition: MooseTypes.h:339
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:1685
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:288
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhiNeighbor(FEType type) const
Definition: Assembly.h:1749
std::vector< ADReal > _ad_dxidz_map
Definition: Assembly.h:2837
const Real & lowerDElemVolume() const
Definition: Assembly.h:3205
VectorVariablePhiDivergence _vector_div_phi_neighbor
Definition: Assembly.h:2735
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:2494
std::vector< std::vector< std::vector< unsigned char > > > _jacobian_block_used
Flag that indicates if the jacobian block was used.
Definition: Assembly.h:2340
void prepare()
Definition: Assembly.C:2713
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:3177
VariablePhiGradient & gradPhiFace(const MooseVariableField< Real > &)
Definition: Assembly.h:1469
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:92
libMesh::QBase * _current_qrule_lower
quadrature rule used on lower dimensional elements.
Definition: Assembly.h:2591
SubProblem & _subproblem
Definition: Assembly.h:2312
libMesh::QBase * writeableQRule(unsigned int dim, SubdomainID block, InternalDataKey)
Returns the pointer to the quadrature of specified block and dimension.
Definition: Assembly.h:248
const VariablePhiGradient & gradPhi(const MooseVariableField< Real > &) const
Definition: Assembly.h:1327
std::vector< ADReal > _ad_detadx_map
Definition: Assembly.h:2838
void buildFaceFE(FEType type) const
Build FEs for a face with a type.
Definition: Assembly.C:292
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_neighbor
types of finite elements
Definition: Assembly.h:2545
DenseVector< Number > & residualBlockLower(unsigned int var_num, LocalDataKey, TagID tag_id)
Get residual block for lower.
Definition: Assembly.h:1133
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:3404
bool _calculate_xyz
Definition: Assembly.h:2856
void addJacobianBlockNonlocalTags(libMesh::SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const libMesh::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:4356
MooseArray< std::vector< Point > > _current_tangents
The current tangent vectors at the quadrature points.
Definition: Assembly.h:2533
bool _calculate_curvatures
Definition: Assembly.h:2858
VariablePhiGradient _grad_phi_face_neighbor
Definition: Assembly.h:2715
const std::vector< VectorTag > & _residual_vector_tags
The residual vector tags that Assembly could possibly contribute to.
Definition: Assembly.h:2794
std::map< FEType, FEVectorBase * > _current_vector_fe_face_neighbor
The "neighbor face" vector fe object that matches the current elem.
Definition: Assembly.h:2396
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhiFace(FEType type) const
Definition: Assembly.h:1741
std::vector< dof_id_type > _neighbor_extra_elem_ids
Extra element IDs of neighbor.
Definition: Assembly.h:2538
MooseArray< Real > _current_JxW
The current list of transformed jacobian weights.
Definition: Assembly.h:2419
std::vector< VectorValue< ADReal > > _ad_dxyzdxi_map
AD quantities.
Definition: Assembly.h:2826
std::vector< std::pair< unsigned int, unsigned short > > _disp_numbers_and_directions
Container of displacement numbers and directions.
Definition: Assembly.h:2854
VectorVariablePhiDivergence & divPhi(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1509
std::vector< dof_id_type > _temp_dof_indices
Temporary work vector to keep from reallocating it.
Definition: Assembly.h:2820
std::set< FEType > _need_neighbor_div
Definition: Assembly.h:2869
OutputTools< Real >::VariablePhiCurl VariablePhiCurl
Definition: MooseTypes.h:323
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kee
Definition: Assembly.h:2678
std::vector< VectorValue< ADReal > > _ad_d2xyzdxi2_map
Definition: Assembly.h:2829
std::vector< ADReal > _ad_jac
Definition: Assembly.h:2832
std::set< FEType > _need_curl
Definition: Assembly.h:2866
void addJacobianBlockNonlocal(libMesh::SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const libMesh::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:4298
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_lower
Definition: Assembly.h:2776
VectorVariablePhiValue & phiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1535
const VariablePhiSecond & secondPhiFace(const MooseVariableField< Real > &) const
Definition: Assembly.h:1341
std::map< FEType, ADTemplateVariablePhiGradient< RealVectorValue > > _ad_vector_grad_phi_data
Definition: Assembly.h:2780
VariablePhiGradient _grad_phi_neighbor
Definition: Assembly.h:2711
ArbitraryQuadrature * _current_qface_arbitrary
The current arbitrary quadrature rule used on element faces.
Definition: Assembly.h:2523
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_face
types of vector finite elements
Definition: Assembly.h:2515
VariablePhiValue _phi_face
Definition: Assembly.h:2706
VectorVariablePhiSecond _vector_second_phi
Definition: Assembly.h:2721
libMesh::QBase * _current_qrule_volume
The current volumetric quadrature for the element.
Definition: Assembly.h:2411
const std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & couplingEntries() const
Definition: Assembly.h:1298
const OutputTools< OutputType >::VariablePhiGradient & feGradPhi(FEType type) const
Definition: Assembly.h:1625
const Elem * _msm_elem
Definition: Assembly.h:2882
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic > RealEigenMatrix
Definition: MooseTypes.h:149
libMesh::QBase * qruleFace(const Elem *elem, unsigned int side)
This is an abstraction over the internal qrules function.
Definition: Assembly.C:1915
bool _calculate_ad_coord
Whether to calculate coord with AD.
Definition: Assembly.h:2862
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_lower
Definition: Assembly.h:2768
const Elem * _current_lower_d_elem
The current lower dimensional element.
Definition: Assembly.h:2630
GlobalDataKey(const GlobalDataKey &)
Definition: Assembly.h:854
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:3249
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:3322
const VariablePhiValue & phiFace() const
Definition: Assembly.h:1334
std::set< FEType > _need_second_derivative
Definition: Assembly.h:2864
bool computingResidualAndJacobian() const
Definition: Assembly.h:1950
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_lower
FE objects for lower dimensional elements.
Definition: Assembly.h:2555
const VectorVariablePhiCurl & curlPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1453
std::set< FEType > _need_face_neighbor_div
Definition: Assembly.h:2870
FEGenericBase< Real > FEBase
libMesh::QBase * _qrule_msm
A qrule object for working on mortar segement elements.
Definition: Assembly.h:2585
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:3057
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiLower(FEType type) const
Definition: Assembly.h:2924
VariablePhiValue _phi_face_neighbor
Definition: Assembly.h:2714
libMesh::ElemSideBuilder _current_neighbor_side_elem_builder
In place side element builder for _current_neighbor_side_elem.
Definition: Assembly.h:2878
OutputTools< Real >::VariablePhiDivergence VariablePhiDivergence
Definition: MooseTypes.h:324
const Moose::CoordinateSystemType & coordSystem() const
Get the coordinate system type.
Definition: Assembly.h:316
Real _current_lower_d_elem_volume
The current lower dimensional element volume.
Definition: Assembly.h:2636
const OutputTools< OutputType >::VariablePhiValue & fePhiNeighbor(FEType type) const
Definition: Assembly.h:1687
libMesh::QBase * _current_qrule
The current current quadrature rule being used (could be either volumetric or arbitrary - for dirac k...
Definition: Assembly.h:2409
std::map< unsigned int, std::map< FEType, FEBase * > > _fe
Each dimension&#39;s actual fe objects indexed on type.
Definition: Assembly.h:2401
const VariablePhiSecond & secondPhi(const MooseVariableField< Real > &) const
Definition: Assembly.h:1329
VariablePhiValue _phi_neighbor
Definition: Assembly.h:2710
const Node *const & nodeNeighbor() const
Returns the reference to the neighboring node.
Definition: Assembly.h:551
const MooseArray< Real > & JxW() const
Returns the reference to the transformed jacobian weights.
Definition: Assembly.h:276
void reinitMortarElem(const Elem *elem)
reinitialize a mortar segment mesh element in order to get a proper JxW
Definition: Assembly.C:2402
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiFaceNeighbor(FEType type) const
Definition: Assembly.h:1717
Real _current_side_volume
Volume of the current side element.
Definition: Assembly.h:2607
std::set< FEType > _need_div
Definition: Assembly.h:2867
VectorVariablePhiCurl _vector_curl_phi
Definition: Assembly.h:2722
std::vector< std::vector< Real > > _cached_residual_values
Values cached by calling cacheResidual() (the first vector is for TIME vs NONTIME) ...
Definition: Assembly.h:2797
const bool _displaced
Definition: Assembly.h:2314
void buildVectorFE(FEType type) const
Build Vector FEs with a type.
Definition: Assembly.C:453
VectorVariablePhiCurl _vector_curl_phi_face_neighbor
Definition: Assembly.h:2740
void addJacobianNeighborTags(libMesh::SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const libMesh::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:4440
void reinitFVFace(const FaceInfo &fi)
Definition: Assembly.C:1855
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_lower
Vector FE objects for lower dimensional elements.
Definition: Assembly.h:2557
const MooseArray< Real > & JxWFace() const
Returns the reference to the transformed jacobian weights on a current face.
Definition: Assembly.h:351
const MooseArray< Real > & JxWNeighbor() const
Returns the reference to the transformed jacobian weights on a current face.
Definition: Assembly.C:259
const Node * _current_node
The current node we are working with.
Definition: Assembly.h:2621
bool _building_helpers
Whether we are currently building the FE classes for the helpers.
Definition: Assembly.h:2375
bool _calculate_face_xyz
Definition: Assembly.h:2857
This is the XFEMInterface class.
Definition: XFEMInterface.h:37
DGJacobianType
Definition: MooseTypes.h:750
OutputTools< Real >::VariablePhiGradient VariablePhiGradient
Definition: MooseTypes.h:321
std::vector< ADReal > _ad_dxidx_map
Definition: Assembly.h:2835
std::vector< ADReal > _ad_dxidy_map
Definition: Assembly.h:2836
std::vector< VectorValue< ADReal > > _ad_d2xyzdxideta_map
Definition: Assembly.h:2830
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_face_neighbor
Definition: Assembly.h:2775
void addJacobian(GlobalDataKey)
Adds all local Jacobian to the global Jacobian matrices.
Definition: Assembly.C:3872
MooseArray< Point > _current_normals
The current Normal vectors at the quadrature points.
Definition: Assembly.h:2529
void buildVectorFaceFE(FEType type) const
Build Vector FEs for a face with a type.
Definition: Assembly.C:484
const SubdomainID ANY_BLOCK_ID
Definition: MooseTypes.C:19
void havePRefinement(const std::unordered_set< FEFamily > &disable_p_refinement_for_families)
Indicate that we have p-refinement.
Definition: Assembly.C:4859
void setCurrentSubdomainID(SubdomainID i)
set the current subdomain ID
Definition: Assembly.h:424
const std::vector< std::pair< MooseVariableScalar *, MooseVariableFieldBase * > > & scalarFieldCouplingEntries() const
Definition: Assembly.h:1313
const MooseArray< ADReal > & adJxWFace() const
Definition: Assembly.h:280
MooseArray< VectorValue< ADReal > > _ad_q_points
Definition: Assembly.h:2834
const VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< Real > &) const
Definition: Assembly.h:1350
VectorVariablePhiGradient _vector_grad_phi_face
Definition: Assembly.h:2726
MooseArray< VectorValue< ADReal > > _ad_q_points_face
Definition: Assembly.h:2847
VariablePhiValue & phiNeighbor(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1591
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const libMesh::CouplingMatrix * _cm
Coupling matrices.
Definition: Assembly.h:2317
const VectorVariablePhiDivergence & divPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1409
const libMesh::QBase * attachQRuleElem(unsigned int dim, FEBase &fe)
Attaches the current elem/volume quadrature rule to the given fe.
Definition: Assembly.h:1902
void hasScalingVector()
signals this object that a vector containing variable scaling factors should be used when doing resid...
Definition: Assembly.C:4574
void addJacobianBlock(libMesh::SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const libMesh::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. ...
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
const VectorVariablePhiDivergence & divPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1458
VariablePhiGradient & gradPhi(const MooseVariableField< Real > &)
Definition: Assembly.h:1465
OutputTools< RealVectorValue >::VariablePhiValue VectorVariablePhiValue
Definition: MooseTypes.h:337
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhi(FEType type) const
Definition: Assembly.h:1765
std::unique_ptr< libMesh::QBase > fv_face
finite volume face/flux quadrature rule (meshdim-1)
Definition: Assembly.h:2445
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_dual_lower
Definition: Assembly.h:2769
void zeroCachedJacobian(GlobalDataKey)
Zero out previously-cached Jacobian rows.
Definition: Assembly.C:4512
CoordinateSystemType
Definition: MooseTypes.h:810
const VectorVariablePhiGradient & gradPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1419
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:2192
void constrain_element_vector(DenseVector< Number > &rhs, std::vector< dof_id_type > &dofs, bool asymmetric_constraint_rows=true) const
void setNeighborQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for neighbor integration.
Definition: Assembly.C:709
bool computingResidual() const
Definition: Assembly.h:1940
void activateDual()
Indicates that dual shape functions are used for mortar constraint.
Definition: Assembly.h:617
void prepareVariableNonlocal(MooseVariableFieldBase *var)
Definition: Assembly.C:2772
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_face
Definition: Assembly.h:2765
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:2772
const VariablePhiGradient & gradPhiFace(const MooseVariableField< Real > &) const
Definition: Assembly.h:1337
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:3396
MooseArray< Real > _coord_msm
The coordinate transformation coefficients evaluated on the quadrature points of the mortar segment m...
Definition: Assembly.h:2573
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:1124
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Keg
Definition: Assembly.h:2679
VariablePhiValue & phiFaceNeighbor(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1604
bool _need_lower_d_elem_volume
Whether we need to compute the lower dimensional element volume.
Definition: Assembly.h:2634
LocalDataKey(const LocalDataKey &)
Definition: Assembly.h:868
bool _user_added_fe_face_of_helper_type
Definition: Assembly.h:2361
const MooseArray< Point > & qPointsFace() const
Returns the reference to the current quadrature being used.
Definition: Assembly.h:345
DenseVector< Number > & residualBlock(unsigned int var_num, LocalDataKey, TagID tag_id)
Get local residual block for a variable and a tag.
Definition: Assembly.h:1115
VectorVariablePhiValue & phi(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1496
void buildVectorNeighborFE(FEType type) const
Build Vector FEs for a neighbor with a type.
Definition: Assembly.C:514
std::unique_ptr< ArbitraryQuadrature > arbitrary_vol
volume/elem (meshdim) custom points quadrature rule
Definition: Assembly.h:2447
void reinitFENeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
Definition: Assembly.C:1630
const VectorVariablePhiValue & phiFace(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1393
void initNonlocalCoupling()
Create pair of variables requiring nonlocal jacobian contributions.
Definition: Assembly.C:2647
ConstraintJacobianType
Definition: MooseTypes.h:797
const VectorVariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1443
std::map< unsigned int, FEBase * > _holder_fe_face_helper
Each dimension&#39;s helper objects.
Definition: Assembly.h:2517
const bool & _computing_jacobian
Whether we are currently computing the Jacobian.
Definition: Assembly.h:2324
void computeCurrentNeighborVolume()
VariablePhiSecond & secondPhiFace(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1586
const Elem *const & neighbor() const
Return the neighbor element.
Definition: Assembly.h:470
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_neighbor
Definition: Assembly.h:2547
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:2265
void resize(const unsigned int new_m, const unsigned int new_n)
const OutputTools< OutputType >::VariablePhiValue & fePhiFaceNeighbor(FEType type) const
Definition: Assembly.h:1709
VariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< Real > &)
Definition: Assembly.h:1486
void cacheJacobianNonlocal(GlobalDataKey)
Takes the values that are currently in _sub_Keg and appends them to the cached values.
Definition: Assembly.C:4090
Class for scalar variables (they are different).
IntRange< T > make_range(T beg, T end)
const VariablePhiValue & phiFace(const MooseVariableField< Real > &) const
Definition: Assembly.h:1335
VariablePhiValue & phiNeighbor(const MooseVariableField< Real > &)
Definition: Assembly.h:1472
VectorVariablePhiDivergence & divPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1551
std::vector< std::unique_ptr< FEBase > > _unique_fe_face_neighbor_helper
Definition: Assembly.h:2370
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:1001
void helpersRequestData()
request phi, dphi, xyz, JxW, etc.
Definition: Assembly.C:4826
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > _cm_nonlocal_entry
Entries in the coupling matrix for field variables for nonlocal calculations.
Definition: Assembly.h:2338
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:4462
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:2897
VectorVariablePhiSecond _vector_second_phi_face_neighbor
Definition: Assembly.h:2739
void buildLowerDFE(FEType type) const
Build FEs for a lower dimensional element with a type.
Definition: Assembly.C:358
unsigned int _current_side
The current side of the selected element (valid only when working with sides)
Definition: Assembly.h:2603
const libMesh::QBase *const & qRule() const
Returns the reference to the current quadrature being used.
Definition: Assembly.h:235
const VectorVariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1448
void setCachedJacobian(GlobalDataKey)
Sets previously-cached Jacobian values via SparseMatrix::set() calls.
Definition: Assembly.C:4492
VariablePhiSecond _second_phi
Definition: Assembly.h:2748
std::map< unsigned int, FEBase * > _holder_fe_helper
Each dimension&#39;s helper objects.
Definition: Assembly.h:2405
const libMesh::CouplingMatrix & _nonlocal_cm
Definition: Assembly.h:2318
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhiNeighbor(FEType type) const
Definition: Assembly.h:1701
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:216
BoundaryID _current_boundary_id
The current boundary ID.
Definition: Assembly.h:2599
const OutputTools< OutputType >::VariablePhiGradient & feGradDualPhiLower(FEType type) const
Definition: Assembly.h:2932
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhiFace(FEType type) const
Definition: Assembly.h:1679
void prepareVariable(MooseVariableFieldBase *var)
Used for preparing the dense residual and jacobian blocks for one particular variable.
Definition: Assembly.C:2744
const Elem * _current_neighbor_side_elem
The current side element of the ncurrent neighbor element.
Definition: Assembly.h:2615
DenseMatrix< Number > _element_matrix
A working matrix to avoid repeated heap allocations when caching Jacobians that must have libMesh-lev...
Definition: Assembly.h:2892
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:2017
void copyFaceShapes(MooseVariableField< T > &v)
Definition: Assembly.C:3032
std::vector< dof_id_type > _extra_elem_ids
Extra element IDs.
Definition: Assembly.h:2536
const libMesh::QBase *const & qRuleNeighbor() const
Returns the reference to the current quadrature being used on a current neighbor. ...
Definition: Assembly.h:518
void clearCachedQRules()
Set the cached quadrature rules to nullptr.
Definition: Assembly.C:726
void addJacobianBlockTags(libMesh::SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const libMesh::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:4230
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:3347
bool _current_side_volume_computed
Boolean to indicate whether current element side volumes has been computed.
Definition: Assembly.h:2627
std::map< FEType, ADTemplateVariablePhiGradient< RealVectorValue > > _ad_vector_grad_phi_data_face
Definition: Assembly.h:2783
std::vector< dof_id_type > _column_indices
Definition: Assembly.h:2897
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:2256
std::unique_ptr< ArbitraryQuadrature > arbitrary_face
area/face (meshdim-1) custom points quadrature rule
Definition: Assembly.h:2449
Eigen::Matrix< Real, Eigen::Dynamic, 1 > RealEigenVector
Definition: MooseTypes.h:146
const VariablePhiValue & phi(const MooseVariableField< Real > &) const
Definition: Assembly.h:1325
const std::vector< Point > & qPointsMortar() const
Returns the reference to the mortar segment element quadrature points.
Definition: Assembly.h:264
const SubdomainID & currentSubdomainID() const
Return the current subdomain ID.
Definition: Assembly.h:419
const Real & elemVolume() const
Returns the reference to the current element volume.
Definition: Assembly.h:440
void prepareBlock(unsigned int ivar, unsigned jvar, const std::vector< dof_id_type > &dof_indices)
Definition: Assembly.C:2894
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_face_neighbor
Definition: Assembly.h:2546
void addJacobianNeighbor(GlobalDataKey)
Add ElementNeighbor, NeighborElement, and NeighborNeighbor portions of the Jacobian for compute objec...
Definition: Assembly.C:3907
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:2345
VectorVariablePhiDivergence _div_phi
Definition: Assembly.h:2760
VectorVariablePhiDivergence & divPhiFace(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1530
OutputTools< RealVectorValue >::VariablePhiCurl VectorVariablePhiCurl
Definition: MooseTypes.h:340
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...
bool _custom_mortar_qrule
Flag specifying whether a custom quadrature rule has been specified for mortar segment mesh...
Definition: Assembly.h:2587
const unsigned int & side() const
Returns the current side.
Definition: Assembly.h:446
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:132
void computeCurrentElemVolume()
Definition: Assembly.C:1752
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:3689
bool computingJacobian() const
Definition: Assembly.h:1945
Real _current_neighbor_lower_d_elem_volume
The current neighboring lower dimensional element volume.
Definition: Assembly.h:2640
bool _need_neighbor_lower_d_elem_volume
Whether we need to compute the neighboring lower dimensional element volume.
Definition: Assembly.h:2638
MooseArray< Point > _current_q_points
The current list of quadrature points.
Definition: Assembly.h:2417
bool _user_added_fe_of_helper_type
Whether user code requested a FEType the same as our _helper_type.
Definition: Assembly.h:2360
void setLowerQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for lower dimensional integration.
Definition: Assembly.C:690
Moose::CoordinateSystemType _coord_type
The coordinate system.
Definition: Assembly.h:2421
void cacheJacobianMortar(GlobalDataKey)
Cache all portions of the Jacobian, e.g.
Definition: Assembly.C:4150
std::unique_ptr< ArbitraryQuadrature > neighbor
area/face (meshdim-1) custom points quadrature rule for DG
Definition: Assembly.h:2451
unsigned int n() const
void buildVectorFaceNeighborFE(FEType type) const
Build Vector FEs for a neighbor face with a type.
Definition: Assembly.C:544
void buildVectorDualLowerDFE(FEType type) const
Definition: Assembly.C:428
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:575
const SubdomainID & currentNeighborSubdomainID() const
Return the current subdomain ID.
Definition: Assembly.h:497
VectorVariablePhiSecond _vector_second_phi_neighbor
Definition: Assembly.h:2733
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:1860
Storage for all of the information pretaining to a vector tag.
Definition: VectorTag.h:17
VectorVariablePhiDivergence & divPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1571
const Node *const & node() const
Returns the reference to the node.
Definition: Assembly.h:545
VariablePhiSecond _second_phi
Definition: Assembly.h:2704
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:2343
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiNeighbor(FEType type) const
Definition: Assembly.h:1694
std::map< unsigned int, FEBase * > _holder_fe_lower_helper
helper object for transforming coordinates for lower dimensional element quadrature points ...
Definition: Assembly.h:2559
const libMesh::DofMap & _dof_map
DOF map.
Definition: Assembly.h:2347
VectorVariablePhiDivergence _vector_div_phi
Definition: Assembly.h:2723
void setCurrentNeighborSubdomainID(SubdomainID i)
set the current subdomain ID
Definition: Assembly.h:502
void computeADFace(const Elem &elem, const unsigned int side)
compute AD things on an element face
Definition: Assembly.C:2109
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_neighbor
Definition: Assembly.h:2774
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:3548
std::vector< std::vector< dof_id_type > > _cached_jacobian_cols
Column where the corresponding cached value should go.
Definition: Assembly.h:2809
void addCachedJacobian(GlobalDataKey)
Adds the values that have been cached by calling cacheJacobian() and or cacheJacobianNeighbor() to th...
Definition: Assembly.C:3815
MooseArray< Point > _current_q_points_face
The current quadrature points on a face.
Definition: Assembly.h:2525
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:3265
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:2919
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:598
const Elem *const & lowerDElem() const
Return the lower dimensional element.
Definition: Assembly.h:476
const VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< Real > &) const
Definition: Assembly.h:1367
const libMesh::QBase * attachQRuleFace(unsigned int dim, FEBase &fe)
Attaches the current face/area quadrature rule to the given fe.
Definition: Assembly.h:1914
const Elem * _current_side_elem
The current "element" making up the side we are currently on.
Definition: Assembly.h:2605
const MooseArray< std::vector< Point > > & tangents() const
Returns the array of tangents for quadrature points on a current side.
Definition: Assembly.h:368
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:2814
const Elem *const & neighborLowerDElem() const
Return the neighboring lower dimensional element.
Definition: Assembly.h:482
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhi(FEType type) const
Definition: Assembly.h:1638
FEBase * _current_fe_helper
The current helper object for transforming coordinates.
Definition: Assembly.h:2407
bool _need_JxW_neighbor
Flag to indicate that JxW_neighbor is needed.
Definition: Assembly.h:2566
const VectorVariablePhiValue & phiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1438
void copyNeighborShapes(MooseVariableField< T > &v)
Definition: Assembly.C:3069
void cacheJacobianCoupledVarPair(const MooseVariableBase &ivar, const MooseVariableBase &jvar)
Caches element matrix for ivar rows and jvar columns.
Definition: Assembly.C:4074
VectorVariablePhiSecond _vector_second_phi_face
Definition: Assembly.h:2727
const MooseArray< ADPoint > & adNormals() const
Definition: Assembly.h:393
VariablePhiGradient _grad_phi_face
Definition: Assembly.h:2707
MooseArray< Point > _current_q_points_face_neighbor
The current quadrature points on the neighbor face.
Definition: Assembly.h:2564
virtual void attach_quadrature_rule(QBase *q)=0
libMesh::ElemSideBuilder _current_side_elem_builder
In place side element builder for _current_side_elem.
Definition: Assembly.h:2876
const VectorVariablePhiGradient & gradPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition: Assembly.h:1397
VectorVariablePhiCurl _vector_curl_phi_face
Definition: Assembly.h:2728
bool _need_dual
Whether dual shape functions need to be computed for mortar constraints.
Definition: Assembly.h:2642
auto index_range(const T &sizable)
const std::vector< Real > & jxWMortar() const
Returns a reference to JxW for mortar segment elements.
Definition: Assembly.h:707
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:192
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition: Assembly.h:862
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:387
DenseVector< Number > _element_vector
A working vector to avoid repeated heap allocations when caching residuals that must have libMesh-lev...
Definition: Assembly.h:2887
std::set< FEType > _need_face_div
Definition: Assembly.h:2868
const Real & sideElemVolume() const
Returns the reference to the volume of current side element.
Definition: Assembly.h:464
SubdomainID _current_subdomain_id
The current subdomain ID.
Definition: Assembly.h:2597
const Elem *& sideElem()
Returns the side element.
Definition: Assembly.h:458
VectorVariablePhiCurl & curlPhiFace(const MooseVariableField< RealVectorValue > &)
Definition: Assembly.h:1526
VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1612
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:168
std::map< unsigned int, const std::vector< Point > * > _holder_normals
Holds pointers to the dimension&#39;s normal vectors.
Definition: Assembly.h:2540
Base variable class.
std::map< FEType, FEVectorBase * > _current_vector_fe_neighbor
The "neighbor" vector fe object that matches the current elem.
Definition: Assembly.h:2394
void clearCachedResiduals(GlobalDataKey)
Clears all of the residuals in _cached_residual_rows and _cached_residual_values. ...
Definition: Assembly.C:3500
unsigned int THREAD_ID
Definition: MooseTypes.h:209
const Node * _current_neighbor_node
The current neighboring node we are working with.
Definition: Assembly.h:2623
std::vector< VectorValue< ADReal > > _ad_d2xyzdeta2_map
Definition: Assembly.h:2831
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:3097
void clearCachedJacobian()
Clear any currently cached jacobians.
Definition: Assembly.C:4522
uint8_t dof_id_type
const BoundaryID & currentBoundaryID() const
Return the current boundary ID.
Definition: Assembly.h:429
VectorVariablePhiDivergence _vector_div_phi_face_neighbor
Definition: Assembly.h:2741
libMesh::QBase *const & writeableQRuleFace()
Returns the reference to the current quadrature being used on a current face.
Definition: Assembly.h:328
const VariablePhiGradient & gradPhiFace() const
Definition: Assembly.h:1336
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Knl
dprimary/dlower (or dneighbor/dlower)
Definition: Assembly.h:2696
const OutputTools< OutputType >::VariablePhiValue & fePhiFace(FEType type) const
Definition: Assembly.h:1659
VariablePhiValue & phi(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1577
VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< Real > &)
Definition: Assembly.h:1473
VariablePhiGradient & gradPhi(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1578
void reinitFEFace(const Elem *elem, unsigned int side)
Just an internal helper function to reinit the face FE objects.
Definition: Assembly.C:1267
MooseArray< ADReal > _ad_JxW
Definition: Assembly.h:2833
MooseArray< ADReal > _ad_JxW_face
Definition: Assembly.h:2845
void computeFaceMap(const Elem &elem, const unsigned int side, const std::vector< Real > &qw)
Definition: Assembly.C:1347
VariablePhiValue & phiFace(const MooseVariableField< RealEigenVector > &)
Definition: Assembly.h:1581
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:2270
void constrain_element_matrix(DenseMatrix< Number > &matrix, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const
Key structure for APIs manipulating global vectors/matrices.
Definition: Assembly.h:844