https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
30namespace libMesh
31{
32class DofMap;
33class CouplingMatrix;
34class Elem;
35template <typename>
36class VectorValue;
38template <typename T>
39class FEGenericBase;
42class Node;
43template <typename T>
44class NumericVector;
45template <typename T>
46class SparseMatrix;
48}
49
50// MOOSE Forward Declares
51class FaceInfo;
52class MooseMesh;
54class SystemBase;
57template <typename>
58class MooseVariableFE;
63class XFEMInterface;
64class SubProblem;
66
67#ifdef MOOSE_KOKKOS_ENABLED
69{
70class Assembly;
71}
72#endif
73
82template <typename P, typename C>
83void coordTransformFactor(const SubProblem & s,
84 SubdomainID sub_id,
85 const P & point,
86 C & factor,
87 SubdomainID neighbor_sub_id = libMesh::Elem::invalid_subdomain_id);
88
89template <typename P, typename C>
91 SubdomainID sub_id,
92 const P & point,
93 C & factor,
94 SubdomainID neighbor_sub_id = libMesh::Elem::invalid_subdomain_id);
95
101{
102public:
103 Assembly(SystemBase & sys, THREAD_ID tid);
104 virtual ~Assembly();
105
110 template <typename T>
111 static const T * const & constify_ref(T * const & inref)
112 {
113 const T * const * ptr = &inref;
114 return *ptr;
115 }
116
123 const FEBase * const & getFE(FEType type, unsigned int dim) const
124 {
125 buildFE(type);
126 return constify_ref(_fe[dim][type]);
127 }
128
135 const FEBase * const & getFENeighbor(FEType type, unsigned int dim) const
136 {
137 buildNeighborFE(type);
138 return constify_ref(_fe_neighbor[dim][type]);
139 }
140
147 const FEBase * const & getFEFace(FEType type, unsigned int dim) const
148 {
149 buildFaceFE(type);
150 return constify_ref(_fe_face[dim][type]);
151 }
152
159 const FEBase * const & getFEFaceNeighbor(FEType type, unsigned int dim) const
160 {
162 return constify_ref(_fe_face_neighbor[dim][type]);
163 }
164
171 const FEVectorBase * const & getVectorFE(FEType type, unsigned int dim) const
172 {
173 buildVectorFE(type);
174 return constify_ref(_vector_fe[dim][type]);
175 }
176
183 const FEVectorBase * const & getVectorFENeighbor(FEType type, unsigned int dim) const
184 {
186 return constify_ref(_vector_fe_neighbor[dim][type]);
187 }
188
195 const FEVectorBase * const & getVectorFEFace(FEType type, unsigned int dim) const
196 {
197 buildVectorFaceFE(type);
198 return constify_ref(_vector_fe_face[dim][type]);
199 }
200
207 const FEVectorBase * const & getVectorFEFaceNeighbor(FEType type, unsigned int dim) const
208 {
211 }
212
213#ifdef MOOSE_KOKKOS_ENABLED
220#endif
221
226 const libMesh::QBase * const & qRule() const { return constify_ref(_current_qrule); }
227
233
234#ifdef MOOSE_KOKKOS_ENABLED
240 {
241 return qrules(dim, block).vol.get();
242 }
243#endif
244
249 const MooseArray<Point> & qPoints() const { return _current_q_points; }
250
255 const std::vector<Point> & qPointsMortar() const { return _fe_msm->get_xyz(); }
256
262
267 const MooseArray<Real> & JxW() const { return _current_JxW; }
268
269 const MooseArray<ADReal> & adJxW() const { return _ad_JxW; }
270
271 const MooseArray<ADReal> & adJxWFace() const { return _ad_JxW_face; }
272
273 const MooseArray<ADReal> & adCurvatures() const;
274
279 const MooseArray<Real> & coordTransformation() const { return _coord; }
280
286
292 {
293 // Coord values for non-cartesian coordinate systems are functions of the locations of the
294 // quadrature points in physical space. We also have no way of knowing whether this was called
295 // from a volumetric or face object so we should set both volumetric and face xyz to true
296 _calculate_xyz = true;
297 _calculate_face_xyz = true;
298
299 _calculate_ad_coord = true;
300 return _ad_coord;
301 }
302
308
313 const libMesh::QBase * const & qRuleFace() const { return constify_ref(_current_qrule_face); }
314
320
321#ifdef MOOSE_KOKKOS_ENABLED
327 {
328 return qrules(dim, block).face.get();
329 }
330#endif
331
337
342 const MooseArray<Real> & JxWFace() const { return _current_JxW_face; }
343
348 const MooseArray<Point> & normals() const { return _current_normals; }
349
350 /***
351 * Returns the array of normals for quadrature points on a current side
352 */
353 const std::vector<Eigen::Map<RealDIMValue>> & mappedNormals() const { return _mapped_normals; }
354
360
364 unsigned int numExtraElemIntegers() const { return _extra_elem_ids.size() - 1; }
365
369 const dof_id_type & extraElemID(unsigned int id) const
370 {
371 mooseAssert(id < _extra_elem_ids.size(), "An invalid extra element integer id");
372 return _extra_elem_ids[id];
373 }
374
378 const dof_id_type & extraElemIDNeighbor(unsigned int id) const
379 {
380 mooseAssert(id < _neighbor_extra_elem_ids.size(), "An invalid extra element integer id");
381 return _neighbor_extra_elem_ids[id];
382 }
383
384 const MooseArray<ADPoint> & adNormals() const { return _ad_normals; }
385
387 {
388 _calculate_xyz = true;
389 return _ad_q_points;
390 }
391
393 {
394 _calculate_face_xyz = true;
395 return _ad_q_points_face;
396 }
397
398 template <bool is_ad>
400
405 const Elem * const & elem() const { return _current_elem; }
406
411
416
421
426
431 const Real & elemVolume() const { return _current_elem_volume; }
432
437 const unsigned int & side() const { return _current_side; }
438
443 const unsigned int & neighborSide() const { return _current_neighbor_side; }
444
449 const Elem * const & sideElem() const { return _current_side_elem; }
450
455 const Real & sideElemVolume() const { return _current_side_volume; }
456
461 const Elem * const & neighbor() const { return _current_neighbor_elem; }
462
467 const Elem * const & lowerDElem() const { return _current_lower_d_elem; }
468
473 const Elem * const & neighborLowerDElem() const { return _current_neighbor_lower_d_elem; }
474
475 /*
476 * @return The current lower-dimensional element volume
477 */
478 const Real & lowerDElemVolume() const;
479
480 /*
481 * @return The current neighbor lower-dimensional element volume
482 */
483 const Real & neighborLowerDElemVolume() const;
484
489
494
499 const Real & neighborVolume()
500 {
503 }
504
509 const libMesh::QBase * const & qRuleNeighbor() const
510 {
512 }
513
519
524 const MooseArray<Real> & JxWNeighbor() const;
525
531
536 const Node * const & node() const { return _current_node; }
537
542 const Node * const & nodeNeighbor() const { return _current_neighbor_node; }
543
552 void createQRules(QuadratureType type,
553 Order order,
554 Order volume_order,
555 Order face_order,
556 SubdomainID block,
557 bool allow_negative_qweights = true);
558
565 void bumpVolumeQRuleOrder(Order volume_order, SubdomainID block);
566
574 void bumpAllQRuleOrder(Order order, SubdomainID block);
575
584 void setVolumeQRule(libMesh::QBase * qrule, unsigned int dim);
585
594 void setFaceQRule(libMesh::QBase * qrule, unsigned int dim);
595
603 void setMortarQRule(Order order);
604
608 void activateDual() { _need_dual = true; }
609
614 bool needDual() const { return _need_dual; }
615
619 void clearCachedQRules();
620
621private:
628 void setLowerQRule(libMesh::QBase * qrule, unsigned int dim);
629
630public:
639 void setNeighborQRule(libMesh::QBase * qrule, unsigned int dim);
640
646 void reinit(const Elem * elem);
647
651 void setVolumeQRule(const Elem * elem);
652
657 void reinitElemFaceRef(const Elem * elem,
658 unsigned int elem_side,
659 Real tolerance,
660 const std::vector<Point> * const pts = nullptr,
661 const std::vector<Real> * const weights = nullptr);
662
667 void reinitNeighborFaceRef(const Elem * neighbor_elem,
668 unsigned int neighbor_side,
669 Real tolerance,
670 const std::vector<Point> * const pts,
671 const std::vector<Real> * const weights = nullptr);
672
676 void reinitDual(const Elem * elem, const std::vector<Point> & pts, const std::vector<Real> & JxW);
677
681 void reinitLowerDElem(const Elem * elem,
682 const std::vector<Point> * const pts = nullptr,
683 const std::vector<Real> * const weights = nullptr);
684
688 void reinitNeighborLowerDElem(const Elem * elem);
689
693 void reinitMortarElem(const Elem * elem);
694
698 const std::vector<Real> & jxWMortar() const { return *_JxW_msm; }
699
703 const libMesh::QBase * const & qRuleMortar() const { return constify_ref(_qrule_msm); }
704
705private:
709 void computeADFace(const Elem & elem, const unsigned int side);
710
711public:
715 void reinitAtPhysical(const Elem * elem, const std::vector<Point> & physical_points);
716
720 void reinit(const Elem * elem, const std::vector<Point> & reference_points);
721
725 void setFaceQRule(const Elem * const elem, const unsigned int side);
726
730 void reinit(const Elem * elem, unsigned int side);
731
735 void reinit(const Elem * elem, unsigned int side, const std::vector<Point> & reference_points);
736
737 void reinitFVFace(const FaceInfo & fi);
738
750 void reinitElemAndNeighbor(const Elem * elem,
751 unsigned int side,
752 const Elem * neighbor,
753 unsigned int neighbor_side,
754 const std::vector<Point> * neighbor_reference_points = nullptr);
755
759 void reinitNeighborAtPhysical(const Elem * neighbor,
760 unsigned int neighbor_side,
761 const std::vector<Point> & physical_points);
762
766 void reinitNeighborAtPhysical(const Elem * neighbor, const std::vector<Point> & physical_points);
767
771 void reinitNeighbor(const Elem * neighbor, const std::vector<Point> & reference_points);
772
776 void reinit(const Node * node);
777
782
785
788
790 void prepareResidual();
791
792 void prepare();
793 void prepareNonlocal();
794
802 void prepareNeighbor();
803
808 void prepareLowerD();
809
810 void prepareBlock(unsigned int ivar, unsigned jvar, const std::vector<dof_id_type> & dof_indices);
811 void prepareBlockNonlocal(unsigned int ivar,
812 unsigned jvar,
813 const std::vector<dof_id_type> & idof_indices,
814 const std::vector<dof_id_type> & jdof_indices);
815 void prepareScalar();
817
818 template <typename T>
820 void copyShapes(unsigned int var);
821
822 template <typename T>
824 void copyFaceShapes(unsigned int var);
825
826 template <typename T>
828 void copyNeighborShapes(unsigned int var);
829
836 {
837 // Blessed classes
838 friend class Assembly;
839 friend class SubProblem;
840 friend class FEProblemBase;
841 friend class DisplacedProblem;
846 };
847
854 {
855 // Blessed classes
856 friend class Assembly;
857 friend class TaggingInterface;
860 };
861
866 void addResidual(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
871 void addResidualNeighbor(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
876 void addResidualLower(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
877
882 void addResidualScalar(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
883
888 void cacheResidual(GlobalDataKey, const std::vector<VectorTag> & tags);
889
894 void cacheResidualNeighbor(GlobalDataKey, const std::vector<VectorTag> & tags);
895
899 void cacheResidualLower(GlobalDataKey, const std::vector<VectorTag> & tags);
900
906 void addCachedResiduals(GlobalDataKey, const std::vector<VectorTag> & tags);
907
916 void clearCachedResiduals(GlobalDataKey);
917
925 void addCachedResidualDirectly(NumericVector<Number> & residual,
926 GlobalDataKey,
927 const VectorTag & vector_tag);
928
932 void setResidual(NumericVector<Number> & residual, GlobalDataKey, const VectorTag & vector_tag);
933
937 void setResidualNeighbor(NumericVector<Number> & residual,
938 GlobalDataKey,
939 const VectorTag & vector_tag);
940
944 void addJacobian(GlobalDataKey);
945
949 void addJacobianNonlocal(GlobalDataKey);
950
955 void addJacobianNeighbor(GlobalDataKey);
956
960 void addJacobianScalar(GlobalDataKey);
961
966 void addJacobianOffDiagScalar(unsigned int ivar, GlobalDataKey);
967
972 unsigned int ivar,
973 unsigned int jvar,
974 const libMesh::DofMap & dof_map,
975 std::vector<dof_id_type> & dof_indices,
977 TagID tag);
978
984 unsigned int ivar,
985 unsigned int jvar,
986 const libMesh::DofMap & dof_map,
987 std::vector<dof_id_type> & dof_indices,
989 const std::set<TagID> & tags);
990
995 unsigned int ivar,
996 unsigned int jvar,
997 const libMesh::DofMap & dof_map,
998 const std::vector<dof_id_type> & idof_indices,
999 const std::vector<dof_id_type> & jdof_indices,
1001 TagID tag);
1002
1007 unsigned int ivar,
1008 unsigned int jvar,
1009 const libMesh::DofMap & dof_map,
1010 const std::vector<dof_id_type> & idof_indices,
1011 const std::vector<dof_id_type> & jdof_indices,
1013 const std::set<TagID> & tags);
1014
1024
1031
1041
1047 unsigned int ivar,
1048 unsigned int jvar,
1049 const libMesh::DofMap & dof_map,
1050 std::vector<dof_id_type> & dof_indices,
1051 std::vector<dof_id_type> & neighbor_dof_indices,
1053 TagID tag);
1054
1060 unsigned int ivar,
1061 unsigned int jvar,
1062 const libMesh::DofMap & dof_map,
1063 std::vector<dof_id_type> & dof_indices,
1064 std::vector<dof_id_type> & neighbor_dof_indices,
1066 const std::set<TagID> & tags);
1067
1072
1077
1083
1091
1096
1101
1106 DenseVector<Number> & residualBlock(unsigned int var_num, LocalDataKey, TagID tag_id)
1107 {
1108 return _sub_Re[tag_id][var_num];
1109 }
1110
1115 DenseVector<Number> & residualBlockNeighbor(unsigned int var_num, LocalDataKey, TagID tag_id)
1116 {
1117 return _sub_Rn[tag_id][var_num];
1118 }
1119
1124 DenseVector<Number> & residualBlockLower(unsigned int var_num, LocalDataKey, TagID tag_id)
1125 {
1126 return _sub_Rl[tag_id][var_num];
1127 }
1128
1133 DenseMatrix<Number> & jacobianBlock(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
1134 {
1135 jacobianBlockUsed(tag, ivar, jvar, true);
1136 return _sub_Kee[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
1137 }
1138
1143 DenseMatrix<Number> &
1144 jacobianBlockNonlocal(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
1145 {
1146 jacobianBlockNonlocalUsed(tag, ivar, jvar, true);
1147 return _sub_Keg[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
1148 }
1149
1154 DenseMatrix<Number> & jacobianBlockNeighbor(
1155 Moose::DGJacobianType type, unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag);
1156
1164 DenseMatrix<Number> & jacobianBlockMortar(Moose::ConstraintJacobianType type,
1165 unsigned int ivar,
1166 unsigned int jvar,
1167 LocalDataKey,
1168 TagID tag);
1169
1174 void cacheResidualNodes(const DenseVector<Number> & res,
1175 const std::vector<dof_id_type> & dof_index,
1176 LocalDataKey,
1177 TagID tag);
1178
1190 void
1191 cacheJacobian(numeric_index_type i, numeric_index_type j, Real value, LocalDataKey, TagID tag);
1192
1204 void cacheJacobian(numeric_index_type i,
1205 numeric_index_type j,
1206 Real value,
1207 LocalDataKey,
1208 const std::set<TagID> & tags);
1209
1217 void cacheJacobianBlock(const DenseMatrix<Number> & jac_block,
1218 const std::vector<dof_id_type> & idof_indices,
1219 const std::vector<dof_id_type> & jdof_indices,
1220 Real scaling_factor,
1221 LocalDataKey,
1222 const std::set<TagID> & tags);
1223
1233 template <typename Residuals, typename Indices>
1234 void cacheResiduals(const Residuals & residuals,
1235 const Indices & row_indices,
1236 Real scaling_factor,
1237 LocalDataKey,
1238 const std::set<TagID> & vector_tags);
1239
1247 template <typename Residuals, typename Indices>
1248 void cacheJacobian(const Residuals & residuals,
1249 const Indices & row_indices,
1250 Real scaling_factor,
1251 LocalDataKey,
1252 const std::set<TagID> & matrix_tags);
1253
1264 template <typename Residuals, typename Indices>
1265 void cacheResidualsWithoutConstraints(const Residuals & residuals,
1266 const Indices & row_indices,
1267 Real scaling_factor,
1268 LocalDataKey,
1269 const std::set<TagID> & vector_tags);
1270
1278 template <typename Residuals, typename Indices>
1279 void cacheJacobianWithoutConstraints(const Residuals & residuals,
1280 const Indices & row_indices,
1281 Real scaling_factor,
1282 LocalDataKey,
1283 const std::set<TagID> & matrix_tags);
1284
1285 std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> & couplingEntries()
1286 {
1287 return _cm_ff_entry;
1288 }
1289 const std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
1291 {
1292 return _cm_ff_entry;
1293 }
1294 std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
1296 {
1297 return _cm_nonlocal_entry;
1298 }
1299 const std::vector<std::pair<MooseVariableFieldBase *, MooseVariableScalar *>> &
1301 {
1302 return _cm_fs_entry;
1303 }
1304 const std::vector<std::pair<MooseVariableScalar *, MooseVariableFieldBase *>> &
1306 {
1307 return _cm_sf_entry;
1308 }
1309
1310 // Read-only references
1311 const VariablePhiValue & phi() const { return _phi; }
1312 template <typename T>
1314 {
1315 return _ad_grad_phi_data.at(v.feType());
1316 }
1317 const VariablePhiValue & phi(const MooseVariableField<Real> &) const { return _phi; }
1318 const VariablePhiGradient & gradPhi() const { return _grad_phi; }
1320 const VariablePhiSecond & secondPhi() const { return _second_phi; }
1322 {
1323 return _second_phi;
1324 }
1325
1326 const VariablePhiValue & phiFace() const { return _phi_face; }
1330 {
1331 return _grad_phi_face;
1332 }
1334 {
1335 return _second_phi_face;
1336 }
1337
1339 {
1340 return _phi_neighbor;
1341 }
1343 {
1344 return _grad_phi_neighbor;
1345 }
1350
1352 {
1353 return _phi_face_neighbor;
1354 }
1363
1365 {
1366 return _vector_phi;
1367 }
1384
1405
1429
1444 const VectorVariablePhiCurl &
1454
1455 // Writeable references
1459
1463
1473
1486
1487 // Writeable references with vector variable
1505
1526
1567
1568 // Writeable references with array variable
1572
1582
1595
1608
1609 template <typename OutputType>
1610 const typename OutputTools<OutputType>::VariablePhiValue & fePhi(FEType type) const
1611 {
1612 buildFE(type);
1613 return _fe_shape_data[type]->_phi;
1614 }
1615
1616 template <typename OutputType>
1618 {
1619 buildFE(type);
1620 return _fe_shape_data[type]->_grad_phi;
1621 }
1622
1623 template <typename OutputType>
1625 {
1626 return _ad_grad_phi_data[type];
1627 }
1628
1629 template <typename OutputType>
1631 {
1632 _need_second_derivative.insert(type);
1633 buildFE(type);
1634 return _fe_shape_data[type]->_second_phi;
1635 }
1636
1637 template <typename OutputType>
1638 const typename OutputTools<OutputType>::VariablePhiValue & fePhiLower(FEType type) const;
1639
1640 template <typename OutputType>
1641 const typename OutputTools<OutputType>::VariablePhiValue & feDualPhiLower(FEType type) const;
1642
1643 template <typename OutputType>
1644 const typename OutputTools<OutputType>::VariablePhiGradient & feGradPhiLower(FEType type) const;
1645
1646 template <typename OutputType>
1648 feGradDualPhiLower(FEType type) const;
1649
1650 template <typename OutputType>
1651 const typename OutputTools<OutputType>::VariablePhiValue & fePhiFace(FEType type) const
1652 {
1653 buildFaceFE(type);
1654 return _fe_shape_data_face[type]->_phi;
1655 }
1656
1657 template <typename OutputType>
1659 {
1660 buildFaceFE(type);
1661 return _fe_shape_data_face[type]->_grad_phi;
1662 }
1663
1664 template <typename OutputType>
1666 {
1667 return _ad_grad_phi_data_face[type];
1668 }
1669
1670 template <typename OutputType>
1672 {
1673 _need_second_derivative.insert(type);
1674 buildFaceFE(type);
1675 return _fe_shape_data_face[type]->_second_phi;
1676 }
1677
1678 template <typename OutputType>
1680 {
1681 buildNeighborFE(type);
1682 return _fe_shape_data_neighbor[type]->_phi;
1683 }
1684
1685 template <typename OutputType>
1687 {
1688 buildNeighborFE(type);
1689 return _fe_shape_data_neighbor[type]->_grad_phi;
1690 }
1691
1692 template <typename OutputType>
1694 {
1696 buildNeighborFE(type);
1697 return _fe_shape_data_neighbor[type]->_second_phi;
1698 }
1699
1700 template <typename OutputType>
1702 {
1703 buildFaceNeighborFE(type);
1704 return _fe_shape_data_face_neighbor[type]->_phi;
1705 }
1706
1707 template <typename OutputType>
1709 feGradPhiFaceNeighbor(FEType type) const
1710 {
1711 buildFaceNeighborFE(type);
1712 return _fe_shape_data_face_neighbor[type]->_grad_phi;
1713 }
1714
1715 template <typename OutputType>
1717 feSecondPhiFaceNeighbor(FEType type) const
1718 {
1720 buildFaceNeighborFE(type);
1721 return _fe_shape_data_face_neighbor[type]->_second_phi;
1722 }
1723
1724 template <typename OutputType>
1725 const typename OutputTools<OutputType>::VariablePhiCurl & feCurlPhi(FEType type) const
1726 {
1727 _need_curl.insert(type);
1728 buildFE(type);
1729 return _fe_shape_data[type]->_curl_phi;
1730 }
1731
1732 template <typename OutputType>
1734 {
1735 _need_curl.insert(type);
1736 buildFaceFE(type);
1737 return _fe_shape_data_face[type]->_curl_phi;
1738 }
1739
1740 template <typename OutputType>
1742 {
1743 _need_curl.insert(type);
1744 buildNeighborFE(type);
1745 return _fe_shape_data_neighbor[type]->_curl_phi;
1746 }
1747
1748 template <typename OutputType>
1750 {
1751 _need_curl.insert(type);
1752 buildFaceNeighborFE(type);
1753 return _fe_shape_data_face_neighbor[type]->_curl_phi;
1754 }
1755
1756 template <typename OutputType>
1758 {
1759 buildFE(type);
1760 return _fe_shape_data[type]->_div_phi;
1761 }
1762
1763 template <typename OutputType>
1765 {
1766 buildFaceFE(type);
1767 return _fe_shape_data_face[type]->_div_phi;
1768 }
1769
1770 template <typename OutputType>
1772 feDivPhiNeighbor(FEType type) const
1773 {
1774 buildNeighborFE(type);
1775 return _fe_shape_data_neighbor[type]->_div_phi;
1776 }
1777
1778 template <typename OutputType>
1780 feDivPhiFaceNeighbor(FEType type) const
1781 {
1782 buildFaceNeighborFE(type);
1783 return _fe_shape_data_face_neighbor[type]->_div_phi;
1784 }
1785
1787 Real elementVolume(const Elem * elem) const;
1788
1792 void setXFEM(std::shared_ptr<XFEMInterface> xfem) { _xfem = xfem; }
1793
1798 std::vector<std::pair<unsigned int, unsigned short>> && disp_numbers_and_directions);
1799
1808 void saveLocalArrayResidual(DenseVector<Number> & re,
1809 unsigned int i,
1810 unsigned int ntest,
1811 const RealEigenVector & v) const
1812 {
1813 for (unsigned int j = 0; j < v.size(); ++j, i += ntest)
1814 re(i) += v(j);
1815 }
1816
1817 void saveLocalADArray(std::vector<ADReal> & re,
1818 unsigned int i,
1819 unsigned int ntest,
1820 const ADRealEigenVector & v) const;
1821
1832 void saveDiagLocalArrayJacobian(DenseMatrix<Number> & ke,
1833 unsigned int i,
1834 unsigned int ntest,
1835 unsigned int j,
1836 unsigned int nphi,
1837 unsigned int ivar,
1838 const RealEigenVector & v) const
1839 {
1840 unsigned int pace = (_component_block_diagonal[ivar] ? 0 : nphi);
1841 for (unsigned int k = 0; k < v.size(); ++k, i += ntest, j += pace)
1842 ke(i, j) += v(k);
1843 }
1844
1857 void saveFullLocalArrayJacobian(DenseMatrix<Number> & ke,
1858 unsigned int i,
1859 unsigned int ntest,
1860 unsigned int j,
1861 unsigned int nphi,
1862 unsigned int ivar,
1863 unsigned int jvar,
1864 const RealEigenMatrix & v) const
1865 {
1866 if (ivar == jvar && _component_block_diagonal[ivar])
1867 {
1868 for (unsigned int k = 0; k < v.rows(); ++k, i += ntest)
1869 ke(i, j) += v(k, k);
1870 }
1871 else
1872 {
1873 const unsigned int saved_j = j;
1874 for (unsigned int k = 0; k < v.rows(); ++k, i += ntest)
1875 {
1876 j = saved_j;
1877 for (unsigned int l = 0; l < v.cols(); ++l, j += nphi)
1878 ke(i, j) += v(k, l);
1879 }
1880 }
1881 }
1882
1883 DenseVector<Real> getJacobianDiagonal(const DenseMatrix<Number> & ke)
1884 {
1885 unsigned int rows = ke.m();
1886 unsigned int cols = ke.n();
1887 DenseVector<Real> diag(rows);
1888 for (unsigned int i = 0; i < rows; i++)
1889 // % operation is needed to account for cases of no component coupling of array variables
1890 diag(i) = ke(i, i % cols);
1891 return diag;
1892 }
1893
1899 inline const libMesh::QBase * attachQRuleElem(unsigned int dim, FEBase & fe)
1900 {
1901 auto qrule = qrules(dim).vol.get();
1902 fe.attach_quadrature_rule(qrule);
1903 return qrule;
1904 }
1905
1911 inline const libMesh::QBase * attachQRuleFace(unsigned int dim, FEBase & fe)
1912 {
1913 auto qrule = qrules(dim).face.get();
1914 fe.attach_quadrature_rule(qrule);
1915 return qrule;
1916 }
1917
1922 void hasScalingVector();
1923
1932 void modifyArbitraryWeights(const std::vector<Real> & weights);
1933
1938
1943
1948
1952 const Elem * const & msmElem() const { return _msm_elem; }
1953
1963 void havePRefinement(const std::unordered_set<FEFamily> & disable_p_refinement_for_families);
1964
1968 void setCurrentLowerDElem(const Elem * const lower_d_elem);
1969
1970private:
1976 void reinitFE(const Elem * elem);
1977
1984 void reinitFEFace(const Elem * elem, unsigned int side);
1985
1986 void computeFaceMap(const Elem & elem, const unsigned int side, const std::vector<Real> & qw);
1987
1988 void reinitFEFaceNeighbor(const Elem * neighbor, const std::vector<Point> & reference_points);
1989
1990 void reinitFENeighbor(const Elem * neighbor, const std::vector<Point> & reference_points);
1991
1992 template <typename Points, typename Coords>
1994 const Points & q_points,
1995 Coords & coord,
1996 SubdomainID sub_id);
1997
1999
2001
2003
2009 void modifyWeightsDueToXFEM(const Elem * elem);
2010
2017 void modifyFaceWeightsDueToXFEM(const Elem * elem, unsigned int side = 0);
2018
2023 template <typename OutputType>
2024 void computeGradPhiAD(const Elem * elem,
2025 unsigned int n_qp,
2028
2032 void resizeADMappingObjects(unsigned int n_qp, unsigned int dim);
2033
2038 void
2039 computeSinglePointMapAD(const Elem * elem, const std::vector<Real> & qw, unsigned p, FEBase * fe);
2040
2044 void addResidual(const VectorTag & vector_tag);
2048 void addResidualNeighbor(const VectorTag & vector_tag);
2053 void addResidualLower(const VectorTag & vector_tag);
2057 void addResidualScalar(const VectorTag & vector_tag);
2058
2062 void clearCachedResiduals(const VectorTag & vector_tag);
2063
2072 void cacheResidual(dof_id_type dof, Real value, TagID tag_id);
2073
2082 void cacheResidual(dof_id_type dof, Real value, const std::set<TagID> & tags);
2083
2088 void processLocalResidual(DenseVector<Number> & res_block,
2089 std::vector<dof_id_type> & dof_indices,
2090 const std::vector<Real> & scaling_factor);
2091
2095 void addResidualBlock(NumericVector<Number> & residual,
2096 DenseVector<Number> & res_block,
2097 const std::vector<dof_id_type> & dof_indices,
2098 const std::vector<Real> & scaling_factor);
2099
2103 void cacheResidualBlock(std::vector<Real> & cached_residual_values,
2104 std::vector<dof_id_type> & cached_residual_rows,
2105 DenseVector<Number> & res_block,
2106 const std::vector<dof_id_type> & dof_indices,
2107 const std::vector<Real> & scaling_factor);
2108
2112 void setResidualBlock(NumericVector<Number> & residual,
2113 DenseVector<Number> & res_block,
2114 const std::vector<dof_id_type> & dof_indices,
2115 const std::vector<Real> & scaling_factor);
2116
2121 DenseMatrix<Number> & jac_block,
2122 const MooseVariableBase & ivar,
2123 const MooseVariableBase & jvar,
2124 const std::vector<dof_id_type> & idof_indices,
2125 const std::vector<dof_id_type> & jdof_indices);
2126
2130 void cacheJacobianBlock(const DenseMatrix<Number> & jac_block,
2131 const MooseVariableBase & ivar,
2132 const MooseVariableBase & jvar,
2133 const std::vector<dof_id_type> & idof_indices,
2134 const std::vector<dof_id_type> & jdof_indices,
2135 TagID tag);
2136
2140 void cacheJacobianBlockNonzero(const DenseMatrix<Number> & jac_block,
2141 const MooseVariableBase & ivar,
2142 const MooseVariableBase & jvar,
2143 const std::vector<dof_id_type> & idof_indices,
2144 const std::vector<dof_id_type> & jdof_indices,
2145 TagID tag);
2146
2150 void addJacobianCoupledVarPair(const MooseVariableBase & ivar, const MooseVariableBase & jvar);
2151
2155 void cacheJacobianCoupledVarPair(const MooseVariableBase & ivar, const MooseVariableBase & jvar);
2156
2162 void clearCachedJacobian();
2163
2168 void buildFE(FEType type) const;
2169
2174 void buildFaceFE(FEType type) const;
2175
2180 void buildNeighborFE(FEType type) const;
2181
2186 void buildFaceNeighborFE(FEType type) const;
2187
2192 void buildLowerDFE(FEType type) const;
2193
2194 void buildLowerDDualFE(FEType type) const;
2195
2200 void buildVectorFE(FEType type) const;
2201
2206 void buildVectorFaceFE(FEType type) const;
2207
2212 void buildVectorNeighborFE(FEType type) const;
2213
2218 void buildVectorFaceNeighborFE(FEType type) const;
2219
2224 void buildVectorLowerDFE(FEType type) const;
2225 void buildVectorDualLowerDFE(FEType type) const;
2226
2231 void jacobianBlockUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2232 {
2233 _jacobian_block_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2234 }
2235
2240 char jacobianBlockUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2241 {
2242 return _jacobian_block_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2243 }
2244
2249 void jacobianBlockNeighborUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2250 {
2251 _jacobian_block_neighbor_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2252 }
2253
2258 char jacobianBlockNeighborUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2259 {
2260 return _jacobian_block_neighbor_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2261 }
2262
2267 void jacobianBlockLowerUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2268 {
2269 _jacobian_block_lower_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2270 }
2271
2276 char jacobianBlockLowerUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2277 {
2278 return _jacobian_block_lower_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2279 }
2280
2285 void jacobianBlockNonlocalUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2286 {
2287 _jacobian_block_nonlocal_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2288 }
2289
2294 char jacobianBlockNonlocalUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2295 {
2296 return _jacobian_block_nonlocal_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2297 }
2298
2302 void helpersRequestData();
2303
2306
2307 const bool _displaced;
2308
2312
2315
2318
2321
2323 std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> _cm_ff_entry;
2325 std::vector<std::pair<MooseVariableFieldBase *, MooseVariableScalar *>> _cm_fs_entry;
2327 std::vector<std::pair<MooseVariableScalar *, MooseVariableFieldBase *>> _cm_sf_entry;
2329 std::vector<std::pair<MooseVariableScalar *, MooseVariableScalar *>> _cm_ss_entry;
2331 std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> _cm_nonlocal_entry;
2333 std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_used;
2334 std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_nonlocal_used;
2336 std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_neighbor_used;
2338 std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_lower_used;
2343
2345
2346 unsigned int _mesh_dimension;
2347
2350 const FEType _helper_type;
2351
2358
2361 std::vector<std::unique_ptr<FEBase>> _unique_fe_helper;
2362 std::vector<std::unique_ptr<FEBase>> _unique_fe_face_helper;
2363 std::vector<std::unique_ptr<FEBase>> _unique_fe_face_neighbor_helper;
2364 std::vector<std::unique_ptr<FEBase>> _unique_fe_neighbor_helper;
2365 std::vector<std::unique_ptr<FEBase>> _unique_fe_lower_helper;
2366
2369
2371 std::shared_ptr<XFEMInterface> _xfem;
2372
2374 std::map<FEType, FEBase *> _current_fe;
2376 std::map<FEType, FEBase *> _current_fe_face;
2378 std::map<FEType, FEBase *> _current_fe_neighbor;
2380 std::map<FEType, FEBase *> _current_fe_face_neighbor;
2381
2383 std::map<FEType, FEVectorBase *> _current_vector_fe;
2385 std::map<FEType, FEVectorBase *> _current_vector_fe_face;
2387 std::map<FEType, FEVectorBase *> _current_vector_fe_neighbor;
2389 std::map<FEType, FEVectorBase *> _current_vector_fe_face_neighbor;
2390
2391 /**** Volume Stuff ****/
2392
2394 mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe;
2396 mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe;
2398 std::map<unsigned int, FEBase *> _holder_fe_helper;
2419
2422 struct QRules
2423 {
2425 : vol(nullptr),
2426 face(nullptr),
2427 arbitrary_vol(nullptr),
2428 arbitrary_face(nullptr),
2429 neighbor(nullptr)
2430 {
2431 }
2432
2434 std::unique_ptr<libMesh::QBase> vol;
2436 std::unique_ptr<libMesh::QBase> face;
2438 std::unique_ptr<libMesh::QBase> fv_face;
2440 std::unique_ptr<ArbitraryQuadrature> arbitrary_vol;
2442 std::unique_ptr<ArbitraryQuadrature> arbitrary_face;
2444 std::unique_ptr<ArbitraryQuadrature> neighbor;
2445 };
2446
2451 std::unordered_map<SubdomainID, std::vector<QRules>> _qrules;
2452
2459 libMesh::QBase * qruleFace(const Elem * elem, unsigned int side);
2460 ArbitraryQuadrature * qruleArbitraryFace(const Elem * elem, unsigned int side);
2461
2462 template <typename T>
2463 T * qruleFaceHelper(const Elem * elem, unsigned int side, std::function<T *(QRules &)> rule_fn)
2464 {
2465 auto dim = elem->dim();
2466 auto neighbor = elem->neighbor_ptr(side);
2467 auto q = rule_fn(qrules(dim, elem->subdomain_id()));
2468 if (!neighbor)
2469 return q;
2470
2471 // find the maximum face quadrature order for all blocks the face is in
2472 auto neighbor_block = neighbor->subdomain_id();
2473 if (neighbor_block == elem->subdomain_id())
2474 return q;
2475
2476 auto q_neighbor = rule_fn(qrules(dim, neighbor_block));
2477 if (q->get_order() > q_neighbor->get_order())
2478 return q;
2479 return q_neighbor;
2480 }
2481
2482 inline QRules & qrules(unsigned int dim) { return qrules(dim, _current_subdomain_id); }
2483
2487 inline QRules & qrules(unsigned int dim, SubdomainID block)
2488 {
2489 if (_qrules.find(block) == _qrules.end())
2490 {
2491 mooseAssert(_qrules.find(Moose::ANY_BLOCK_ID) != _qrules.end(),
2492 "missing quadrature rules for specified block");
2493 mooseAssert(_qrules[Moose::ANY_BLOCK_ID].size() > dim,
2494 "quadrature rules not sized property for dimension");
2496 }
2497 mooseAssert(_qrules.find(block) != _qrules.end(),
2498 "missing quadrature rules for specified block");
2499 mooseAssert(_qrules[block].size() > dim, "quadrature rules not sized property for dimension");
2500 return _qrules[block][dim];
2501 }
2502
2503 /**** Face Stuff ****/
2504
2506 mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_face;
2508 mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_face;
2510 std::map<unsigned int, FEBase *> _holder_fe_face_helper;
2524 std::vector<Eigen::Map<RealDIMValue>> _mapped_normals;
2527
2529 std::vector<dof_id_type> _extra_elem_ids;
2531 std::vector<dof_id_type> _neighbor_extra_elem_ids;
2533 std::map<unsigned int, const std::vector<Point> *> _holder_normals;
2534
2535 /**** Neighbor Stuff ****/
2536
2538 mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_neighbor;
2539 mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_face_neighbor;
2540 mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_neighbor;
2541 mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_face_neighbor;
2542
2544 std::map<unsigned int, FEBase *> _holder_fe_neighbor_helper;
2545 std::map<unsigned int, FEBase *> _holder_fe_face_neighbor_helper;
2546
2548 mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_lower;
2550 mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_lower;
2552 std::map<unsigned int, FEBase *> _holder_fe_lower_helper;
2553
2567
2568 /********** mortar stuff *************/
2569
2571 const std::vector<Real> * _JxW_msm;
2573 std::unique_ptr<FEBase> _fe_msm;
2581
2585
2586protected:
2588 const Elem * _current_elem;
2596 unsigned int _current_side;
2614 const Node * _current_node;
2621
2636
2639
2640 /*
2641 * Residual contributions <tag_index, ivar>
2642 *
2643 * tag_index is the index into _residual_vector_tags, that is, _sub_Re[0] corresponds to the tag
2644 * with TagID _residual_vector_tags[0]._id
2645 *
2646 * When ivar corresponds to an array variable, the dense vector is in size of ndof * count,
2647 * where count is the number of components of the array variable. The local residual is ordered
2648 * as (r_i,j, i = 1,...,ndof; j = 1,...,count).
2649 *
2650 * Dense vectors for variables (ivar+i, i = 1,...,count) are empty.
2651 */
2652 std::vector<std::vector<DenseVector<Number>>> _sub_Re;
2653 std::vector<std::vector<DenseVector<Number>>> _sub_Rn;
2655 std::vector<std::vector<DenseVector<Number>>> _sub_Rl;
2656
2658 DenseVector<Number> _tmp_Re;
2659
2660 /*
2661 * Jacobian contributions <Tag, ivar, jvar>
2662 * When ivar corresponds to an array variable, the number of rows of the dense matrix is in size
2663 * of indof * icount, where icount is the number of components of ivar. When jvar corresponds to
2664 * an array variable, the number of columns of the dense matrix is in size of jndof * jcount,
2665 * where jcount is the number of components of jvar. The local residual is ordered as
2666 * (K_(i,j,k,l), k=1,...,jndof; l = 1,...,jcout; i = 1,...,indof; j = 1,...,icount).
2667 *
2668 * Dense matrices for variables (ivar+i, i = 1,...,icount) or (jvar+j, j = 1,...,jcount) are
2669 * empty.
2670 */
2671 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kee;
2672 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Keg;
2673
2675 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Ken;
2677 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kne;
2679 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Knn;
2681 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kll;
2683 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kle;
2685 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kln;
2687 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kel;
2689 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Knl;
2690
2692 DenseMatrix<Number> _tmp_Ke;
2693
2694 // Shape function values, gradients. second derivatives
2698
2702
2706
2710
2711 // Shape function values, gradients, second derivatives
2717
2723
2729
2735
2745
2755
2757 mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data;
2758 mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_face;
2759 mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_neighbor;
2760 mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_face_neighbor;
2761 mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_lower;
2762 mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_dual_lower;
2763
2765 mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data;
2766 mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_face;
2767 mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_neighbor;
2768 mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_face_neighbor;
2769 mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_lower;
2770 mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_dual_lower;
2771
2772 mutable std::map<FEType, ADTemplateVariablePhiGradient<Real>> _ad_grad_phi_data;
2773 mutable std::map<FEType, ADTemplateVariablePhiGradient<RealVectorValue>> _ad_vector_grad_phi_data;
2774 mutable std::map<FEType, ADTemplateVariablePhiGradient<Real>> _ad_grad_phi_data_face;
2775 mutable std::map<FEType, ADTemplateVariablePhiGradient<RealVectorValue>>
2777
2787 const std::vector<VectorTag> & _residual_vector_tags;
2788
2790 std::vector<std::vector<Real>> _cached_residual_values;
2791
2793 std::vector<std::vector<dof_id_type>> _cached_residual_rows;
2794
2796
2798 std::vector<std::vector<Real>> _cached_jacobian_values;
2800 std::vector<std::vector<dof_id_type>> _cached_jacobian_rows;
2802 std::vector<std::vector<dof_id_type>> _cached_jacobian_cols;
2803
2805
2810 std::vector<bool> _component_block_diagonal;
2811
2813 std::vector<dof_id_type> _temp_dof_indices;
2814
2816 std::vector<Point> _temp_reference_points;
2817
2819 std::vector<VectorValue<ADReal>> _ad_dxyzdxi_map;
2820 std::vector<VectorValue<ADReal>> _ad_dxyzdeta_map;
2821 std::vector<VectorValue<ADReal>> _ad_dxyzdzeta_map;
2822 std::vector<VectorValue<ADReal>> _ad_d2xyzdxi2_map;
2823 std::vector<VectorValue<ADReal>> _ad_d2xyzdxideta_map;
2824 std::vector<VectorValue<ADReal>> _ad_d2xyzdeta2_map;
2825 std::vector<ADReal> _ad_jac;
2828 std::vector<ADReal> _ad_dxidx_map;
2829 std::vector<ADReal> _ad_dxidy_map;
2830 std::vector<ADReal> _ad_dxidz_map;
2831 std::vector<ADReal> _ad_detadx_map;
2832 std::vector<ADReal> _ad_detady_map;
2833 std::vector<ADReal> _ad_detadz_map;
2834 std::vector<ADReal> _ad_dzetadx_map;
2835 std::vector<ADReal> _ad_dzetady_map;
2836 std::vector<ADReal> _ad_dzetadz_map;
2837
2843
2847 std::vector<std::pair<unsigned int, unsigned short>> _disp_numbers_and_directions;
2848
2849 mutable bool _calculate_xyz;
2852
2856
2857 mutable std::set<FEType> _need_second_derivative;
2858 mutable std::set<FEType> _need_second_derivative_neighbor;
2859 mutable std::set<FEType> _need_curl;
2860 mutable std::set<FEType> _need_div;
2861 mutable std::set<FEType> _need_face_div;
2862 mutable std::set<FEType> _need_neighbor_div;
2863 mutable std::set<FEType> _need_face_neighbor_div;
2864
2866 const NumericVector<Real> * _scaling_vector = nullptr;
2867
2874
2875 const Elem * _msm_elem = nullptr;
2876
2880 DenseVector<Number> _element_vector;
2881
2885 DenseMatrix<Number> _element_matrix;
2886
2890 std::vector<dof_id_type> _row_indices, _column_indices;
2891
2894
2897};
2898
2899template <typename OutputType>
2901Assembly::fePhiLower(FEType type) const
2902{
2903 buildLowerDFE(type);
2904 return _fe_shape_data_lower[type]->_phi;
2905}
2906
2907template <typename OutputType>
2910{
2911 buildLowerDDualFE(type);
2912 return _fe_shape_data_dual_lower[type]->_phi;
2913}
2914
2915template <typename OutputType>
2918{
2919 buildLowerDFE(type);
2920 return _fe_shape_data_lower[type]->_grad_phi;
2921}
2922
2923template <typename OutputType>
2926{
2927 buildLowerDDualFE(type);
2928 return _fe_shape_data_dual_lower[type]->_grad_phi;
2929}
2930
2931template <>
2933Assembly::feADGradPhi<RealVectorValue>(FEType type) const
2934{
2935 return _ad_vector_grad_phi_data[type];
2936}
2937
2938template <>
2940Assembly::feADGradPhiFace<RealVectorValue>(FEType type) const
2941{
2942 return _ad_vector_grad_phi_data_face[type];
2943}
2944
2945template <>
2947Assembly::fePhi<VectorValue<Real>>(FEType type) const;
2948
2949template <>
2951Assembly::feGradPhi<VectorValue<Real>>(FEType type) const;
2952
2953template <>
2955Assembly::feSecondPhi<VectorValue<Real>>(FEType type) const;
2956
2957template <>
2959Assembly::fePhiLower<VectorValue<Real>>(FEType type) const;
2960
2961template <>
2963Assembly::feDualPhiLower<VectorValue<Real>>(FEType type) const;
2964
2965template <>
2967Assembly::feGradPhiLower<VectorValue<Real>>(FEType type) const;
2968
2969template <>
2971Assembly::feGradDualPhiLower<VectorValue<Real>>(FEType type) const;
2972
2973template <>
2975Assembly::fePhiFace<VectorValue<Real>>(FEType type) const;
2976
2977template <>
2979Assembly::feGradPhiFace<VectorValue<Real>>(FEType type) const;
2980
2981template <>
2983Assembly::feSecondPhiFace<VectorValue<Real>>(FEType type) const;
2984
2985template <>
2987Assembly::fePhiNeighbor<VectorValue<Real>>(FEType type) const;
2988
2989template <>
2991Assembly::feGradPhiNeighbor<VectorValue<Real>>(FEType type) const;
2992
2993template <>
2995Assembly::feSecondPhiNeighbor<VectorValue<Real>>(FEType type) const;
2996
2997template <>
2999Assembly::fePhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3000
3001template <>
3003Assembly::feGradPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3004
3005template <>
3007Assembly::feSecondPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3008
3009template <>
3011Assembly::feCurlPhi<VectorValue<Real>>(FEType type) const;
3012
3013template <>
3015Assembly::feCurlPhiFace<VectorValue<Real>>(FEType type) const;
3016
3017template <>
3019Assembly::feCurlPhiNeighbor<VectorValue<Real>>(FEType type) const;
3020
3021template <>
3023Assembly::feCurlPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3024
3025template <>
3027Assembly::feDivPhi<VectorValue<Real>>(FEType type) const;
3028
3029template <>
3031Assembly::feDivPhiFace<VectorValue<Real>>(FEType type) const;
3032
3033template <>
3035Assembly::feDivPhiNeighbor<VectorValue<Real>>(FEType type) const;
3036
3037template <>
3039Assembly::feDivPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3040
3041template <>
3043Assembly::adGradPhi<RealVectorValue>(const MooseVariableFE<RealVectorValue> & v) const
3044{
3045 return _ad_vector_grad_phi_data.at(v.feType());
3046}
3047
3048template <typename Residuals, typename Indices>
3049void
3050Assembly::cacheResiduals(const Residuals & residuals,
3051 const Indices & input_row_indices,
3052 const Real scaling_factor,
3054 const std::set<TagID> & vector_tags)
3055{
3056 mooseAssert(residuals.size() == input_row_indices.size(),
3057 "The number of residuals should match the number of dof indices");
3058 mooseAssert(residuals.size() >= 1, "Why you calling me with no residuals?");
3059
3060 if (!computingResidual() || vector_tags.empty())
3061 return;
3062
3063 if (residuals.size() == 1)
3064 {
3065 // No constraining is required. (This is likely a finite volume computation if we only have a
3066 // single dof)
3068 residuals, input_row_indices, scaling_factor, LocalDataKey{}, vector_tags);
3069 return;
3070 }
3071
3072 // Need to make a copy because we might modify this in constrain_element_vector
3073 _row_indices.assign(input_row_indices.begin(), input_row_indices.end());
3074
3076 for (const auto i : index_range(_row_indices))
3077 _element_vector(i) = MetaPhysicL::raw_value(residuals[i]) * scaling_factor;
3078
3079 // At time of writing, this method doesn't do anything with the asymmetric_constraint_rows
3080 // argument, but we set it to false to be consistent with processLocalResidual
3082 _element_vector, _row_indices, /*asymmetric_constraint_rows=*/false);
3083
3084 for (const auto i : index_range(_row_indices))
3085 cacheResidual(_row_indices[i], _element_vector(i), vector_tags);
3086}
3087
3088template <typename Residuals, typename Indices>
3089void
3091 const Indices & row_indices,
3092 const Real scaling_factor,
3094 const std::set<TagID> & vector_tags)
3095{
3096 mooseAssert(residuals.size() == row_indices.size(),
3097 "The number of residuals should match the number of dof indices");
3098 mooseAssert(residuals.size() >= 1, "Why you calling me with no residuals?");
3099
3100 if (computingResidual() && !vector_tags.empty())
3101 for (const auto i : index_range(row_indices))
3103 row_indices[i], MetaPhysicL::raw_value(residuals[i]) * scaling_factor, vector_tags);
3104}
3105
3106template <typename Residuals, typename Indices>
3107void
3108Assembly::cacheJacobian(const Residuals & residuals,
3109 const Indices & input_row_indices,
3110 const Real scaling_factor,
3112 const std::set<TagID> & matrix_tags)
3113{
3114 if (!computingJacobian() || matrix_tags.empty())
3115 return;
3116
3117 if (residuals.size() == 1)
3118 {
3119 // No constraining is required. (This is likely a finite volume computation if we only have a
3120 // single dof)
3122 residuals, input_row_indices, scaling_factor, LocalDataKey{}, matrix_tags);
3123 return;
3124 }
3125
3126 const auto & compare_dofs = residuals[0].derivatives().nude_indices();
3127#ifndef NDEBUG
3128 auto compare_dofs_set = std::set<dof_id_type>(compare_dofs.begin(), compare_dofs.end());
3129
3130 for (const auto i : make_range(decltype(residuals.size())(1), residuals.size()))
3131 {
3132 const auto & residual = residuals[i];
3133 auto current_dofs_set = std::set<dof_id_type>(residual.derivatives().nude_indices().begin(),
3134 residual.derivatives().nude_indices().end());
3135 mooseAssert(compare_dofs_set == current_dofs_set,
3136 "We're going to see whether the dof sets are the same. IIRC the degree of freedom "
3137 "dependence (as indicated by the dof index set held by the ADReal) has to be the "
3138 "same for every residual passed to this method otherwise constrain_element_matrix "
3139 "will not work.");
3140 }
3141#endif
3142 _column_indices.assign(compare_dofs.begin(), compare_dofs.end());
3143
3144 // If there's no derivatives then there is nothing to do. Moreover, if we pass zero size column
3145 // indices to constrain_element_matrix then we will potentially get errors out of BLAS
3146 if (!_column_indices.size())
3147 return;
3148
3149 // Need to make a copy because we might modify this in constrain_element_matrix
3150 _row_indices.assign(input_row_indices.begin(), input_row_indices.end());
3151
3153 for (const auto i : index_range(_row_indices))
3154 {
3155 const auto & sparse_derivatives = residuals[i].derivatives();
3156
3157 for (const auto j : index_range(_column_indices))
3158 _element_matrix(i, j) = sparse_derivatives[_column_indices[j]] * scaling_factor;
3159 }
3160
3162
3163 for (const auto i : index_range(_row_indices))
3164 for (const auto j : index_range(_column_indices))
3165 cacheJacobian(_row_indices[i], _column_indices[j], _element_matrix(i, j), {}, matrix_tags);
3166}
3167
3168template <typename Residuals, typename Indices>
3169void
3171 const Indices & row_indices,
3172 const Real scaling_factor,
3174 const std::set<TagID> & matrix_tags)
3175{
3176 mooseAssert(residuals.size() == row_indices.size(),
3177 "The number of residuals should match the number of dof indices");
3178 mooseAssert(residuals.size() >= 1, "Why you calling me with no residuals?");
3179
3180 if (!computingJacobian() || matrix_tags.empty())
3181 return;
3182
3183 for (const auto i : index_range(row_indices))
3184 {
3185 const auto row_index = row_indices[i];
3186
3187 const auto & sparse_derivatives = residuals[i].derivatives();
3188 const auto & column_indices = sparse_derivatives.nude_indices();
3189 const auto & raw_derivatives = sparse_derivatives.nude_data();
3190
3191 for (std::size_t j = 0; j < column_indices.size(); ++j)
3193 row_index, column_indices[j], raw_derivatives[j] * scaling_factor, {}, matrix_tags);
3194 }
3195}
3196
3197inline const Real &
3203
3204inline const Real &
3210
3211inline void
3213 std::vector<std::pair<unsigned int, unsigned short>> && disp_numbers_and_directions)
3214{
3215 _disp_numbers_and_directions = std::move(disp_numbers_and_directions);
3216}
3217
3218inline void
3219Assembly::setCurrentLowerDElem(const Elem * const lower_d_elem)
3220{
3221 _current_lower_d_elem = lower_d_elem;
3222}
MooseVariableFE< Real > MooseVariable
Definition Assembly.h:60
MooseVariableFE< RealEigenVector > ArrayMooseVariable
Definition Assembly.h:62
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
MooseVariableFE< RealVectorValue > VectorMooseVariable
Definition Assembly.h:61
boundary_id_type BoundaryID
subdomain_id_type SubdomainID
OutputTools< RealVectorValue >::VariablePhiValue VectorVariablePhiValue
Definition MooseTypes.h:370
OutputTools< Real >::VariablePhiValue VariablePhiValue
Definition MooseTypes.h:353
OutputTools< RealVectorValue >::VariablePhiCurl VectorVariablePhiCurl
Definition MooseTypes.h:373
OutputTools< Real >::VariablePhiCurl VariablePhiCurl
Definition MooseTypes.h:356
unsigned int TagID
Definition MooseTypes.h:238
OutputTools< Real >::VariablePhiGradient VariablePhiGradient
Definition MooseTypes.h:354
typename OutputTools< typename Moose::ADType< T >::type >::VariablePhiGradient ADTemplateVariablePhiGradient
Definition MooseTypes.h:687
OutputTools< RealVectorValue >::VariablePhiSecond VectorVariablePhiSecond
Definition MooseTypes.h:372
unsigned int THREAD_ID
Definition MooseTypes.h:237
OutputTools< RealVectorValue >::VariablePhiDivergence VectorVariablePhiDivergence
Definition MooseTypes.h:374
OutputTools< Real >::VariablePhiSecond VariablePhiSecond
Definition MooseTypes.h:355
OutputTools< Real >::VariablePhiDivergence VariablePhiDivergence
Definition MooseTypes.h:357
OutputTools< RealVectorValue >::VariablePhiGradient VectorVariablePhiGradient
Definition MooseTypes.h:371
unsigned int dim
Implements a fake quadrature rule where you can specify the locations (in the reference domain) of th...
VariablePhiCurl _curl_phi
Definition Assembly.h:2742
VariablePhiValue _phi
Definition Assembly.h:2739
VariablePhiGradient _grad_phi
Definition Assembly.h:2740
VariablePhiSecond _second_phi
Definition Assembly.h:2741
VariablePhiDivergence _div_phi
Definition Assembly.h:2743
Key structure for APIs manipulating global vectors/matrices.
Definition Assembly.h:836
GlobalDataKey(const GlobalDataKey &)
Definition Assembly.h:845
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition Assembly.h:854
LocalDataKey(const LocalDataKey &)
Definition Assembly.h:859
VectorVariablePhiValue _phi
Definition Assembly.h:2749
VectorVariablePhiGradient _grad_phi
Definition Assembly.h:2750
VectorVariablePhiSecond _second_phi
Definition Assembly.h:2751
VectorVariablePhiCurl _curl_phi
Definition Assembly.h:2752
VectorVariablePhiDivergence _div_phi
Definition Assembly.h:2753
Keeps track of stuff related to assembling.
Definition Assembly.h:101
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:1144
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kll
dlower/dlower
Definition Assembly.h:2681
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:2810
void cacheJacobianNonlocal(GlobalDataKey)
Takes the values that are currently in _sub_Keg and appends them to the cached values.
Definition Assembly.C:4073
const VectorVariablePhiValue & phiFace(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1385
SystemBase & _sys
Definition Assembly.h:2304
std::map< unsigned int, FEBase * > _holder_fe_lower_helper
helper object for transforming coordinates for lower dimensional element quadrature points
Definition Assembly.h:2552
const VariablePhiSecond & secondPhiNeighbor(const MooseVariableField< Real > &) const
Definition Assembly.h:1346
std::vector< std::pair< MooseVariableScalar *, MooseVariableFieldBase * > > _cm_sf_entry
Entries in the coupling matrix for scalar variables vs field variables.
Definition Assembly.h:2327
void addJacobian(GlobalDataKey)
Adds all local Jacobian to the global Jacobian matrices.
Definition Assembly.C:3855
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:2267
const Real & neighborLowerDElemVolume() const
Definition Assembly.h:3205
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:1857
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:3382
void assignDisplacements(std::vector< std::pair< unsigned int, unsigned short > > &&disp_numbers_and_directions)
Assign the displacement numbers and directions.
Definition Assembly.h:3212
const FEBase *const & getFENeighbor(FEType type, unsigned int dim) const
Get a reference to a pointer that will contain the current 'neighbor' FE.
Definition Assembly.h:135
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:2765
const bool & _computing_jacobian
Whether we are currently computing the Jacobian.
Definition Assembly.h:2317
MooseArray< Point > _current_q_points
The current list of quadrature points.
Definition Assembly.h:2410
VariablePhiGradient & gradPhiFace(const MooseVariableField< Real > &)
Definition Assembly.h:1461
const std::vector< Real > * _JxW_msm
A JxW for working on mortar segement elements.
Definition Assembly.h:2571
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kee
Definition Assembly.h:2671
std::set< FEType > _need_face_neighbor_div
Definition Assembly.h:2863
VectorVariablePhiCurl & curlPhiFace(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1518
void prepareLowerD()
Prepare the Jacobians and residuals for a lower dimensional element.
Definition Assembly.C:2848
void modifyWeightsDueToXFEM(const Elem *elem)
Update the integration weights for XFEM partial elements.
Definition Assembly.C:4516
VectorVariablePhiDivergence & divPhi(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1501
void reinitFVFace(const FaceInfo &fi)
Definition Assembly.C:1857
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiFace(FEType type) const
Definition Assembly.h:1658
VectorVariablePhiValue & phiFace(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1506
std::vector< std::vector< DenseVector< Number > > > _sub_Re
Definition Assembly.h:2652
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:3440
void reinitFE(const Elem *elem)
Just an internal helper function to reinit the volume FE objects.
Definition Assembly.C:760
DenseMatrix< Number > _element_matrix
A working matrix to avoid repeated heap allocations when caching Jacobians that must have libMesh-lev...
Definition Assembly.h:2885
VectorVariablePhiValue _vector_phi_face_neighbor
Definition Assembly.h:2730
const VariablePhiValue & phiFace() const
Definition Assembly.h:1326
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & nonlocalCouplingEntries()
Definition Assembly.h:1295
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 & secondPhiNeighbor(const MooseVariableField< Real > &)
Definition Assembly.h:1469
MooseArray< Real > _curvatures
Definition Assembly.h:2841
std::vector< std::unique_ptr< FEBase > > _unique_fe_lower_helper
Definition Assembly.h:2365
MooseArray< Real > _coord_neighbor
The current coordinate transformation coefficients.
Definition Assembly.h:2563
const OutputTools< OutputType >::VariablePhiValue & fePhiFaceNeighbor(FEType type) const
Definition Assembly.h:1701
VariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< Real > &)
Definition Assembly.h:1478
const bool _displaced
Definition Assembly.h:2307
void reinitFEFaceNeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
Definition Assembly.C:1573
void reinitFENeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
Definition Assembly.C:1632
VectorVariablePhiDivergence & divPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1543
void prepareVariableNonlocal(MooseVariableFieldBase *var)
Definition Assembly.C:2780
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhi(FEType type) const
Definition Assembly.h:1757
void prepareBlock(unsigned int ivar, unsigned jvar, const std::vector< dof_id_type > &dof_indices)
Definition Assembly.C:2900
VectorVariablePhiValue & phiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1547
std::vector< ADReal > _ad_dzetady_map
Definition Assembly.h:2835
VariablePhiGradient _grad_phi
Definition Assembly.h:2696
libMesh::QBase * _current_qrule_face
quadrature rule used on faces
Definition Assembly.h:2514
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhiNeighbor(FEType type) const
Definition Assembly.h:1772
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:2807
virtual ~Assembly()
Definition Assembly.C:186
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:2336
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:3090
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:2231
void processLocalResidual(DenseVector< Number > &res_block, std::vector< dof_id_type > &dof_indices, const std::vector< Real > &scaling_factor)
Appling scaling, constraints to the local residual block and populate the full DoF indices for array ...
Definition Assembly.C:3219
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhiFaceNeighbor(FEType type) const
Definition Assembly.h:1749
VectorVariablePhiCurl _vector_curl_phi
Definition Assembly.h:2715
MooseArray< VectorValue< ADReal > > _ad_q_points
Definition Assembly.h:2827
bool _current_side_volume_computed
Boolean to indicate whether current element side volumes has been computed.
Definition Assembly.h:2620
MooseArray< Real > _current_JxW_face
The current transformed jacobian weights on a face.
Definition Assembly.h:2520
const FEType _helper_type
The finite element type of the FE helper classes.
Definition Assembly.h:2350
Real _current_elem_volume
Volume of the current element.
Definition Assembly.h:2594
const MooseArray< Point > & normals() const
Returns the array of normals for quadrature points on a current side.
Definition Assembly.h:348
VectorVariablePhiSecond _vector_second_phi_face_neighbor
Definition Assembly.h:2732
const VectorVariablePhiDivergence & divPhi(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1380
void cacheJacobianCoupledVarPair(const MooseVariableBase &ivar, const MooseVariableBase &jvar)
Caches element matrix for ivar rows and jvar columns.
Definition Assembly.C:4057
const VariablePhiValue & phi(const MooseVariableField< Real > &) const
Definition Assembly.h:1317
bool _building_helpers
Whether we are currently building the FE classes for the helpers.
Definition Assembly.h:2368
void addJacobianScalar(GlobalDataKey)
Add Jacobians for pairs of scalar variables into the global Jacobian matrices.
Definition Assembly.C:4438
void setVolumeQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for volume integration.
void computeCurrentNeighborVolume()
const VariablePhiGradient & gradPhi() const
Definition Assembly.h:1318
FEBase * _current_fe_face_helper
helper object for transforming coordinates
Definition Assembly.h:2512
void cacheJacobianBlockNonzero(const 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:3663
FEBase * _current_fe_helper
The current helper object for transforming coordinates.
Definition Assembly.h:2400
MooseArray< Point > _current_physical_points
This will be filled up with the physical points passed into reinitAtPhysical() if it is called....
Definition Assembly.h:2638
VectorVariablePhiGradient & gradPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1531
void addJacobianLowerD(GlobalDataKey)
Add portions of the Jacobian of LowerLower, LowerSecondary, and SecondaryLower for boundary condition...
Definition Assembly.C:4006
libMesh::QBase * _current_qrule
The current current quadrature rule being used (could be either volumetric or arbitrary - for dirac k...
Definition Assembly.h:2402
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:326
const MooseArray< Point > & qPoints() const
Returns the reference to the quadrature points.
Definition Assembly.h:249
const bool & _computing_residual
Whether we are currently computing the residual.
Definition Assembly.h:2314
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:1808
MooseArray< VectorValue< ADReal > > _ad_normals
Definition Assembly.h:2839
VectorVariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1555
libMesh::QBase * writeableQRule(unsigned int dim, SubdomainID block, InternalDataKey)
Returns the pointer to the quadrature of specified block and dimension.
Definition Assembly.h:239
const std::vector< std::pair< MooseVariableScalar *, MooseVariableFieldBase * > > & scalarFieldCouplingEntries() const
Definition Assembly.h:1305
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:4445
void addJacobianNeighbor(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, TagID tag)
Adds three neighboring element matrices for ivar rows and jvar columns to the global Jacobian matrix.
void modifyArbitraryWeights(const std::vector< Real > &weights)
Modify the weights when using the arbitrary quadrature rule.
Definition Assembly.C:4563
void computeCurrentFaceVolume()
Definition Assembly.C:1773
VectorVariablePhiCurl & curlPhi(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1497
const VariablePhiGradient & gradPhiFace() const
Definition Assembly.h:1328
bool _need_JxW_neighbor
Flag to indicate that JxW_neighbor is needed.
Definition Assembly.h:2559
VectorVariablePhiSecond & secondPhi(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1493
const BoundaryID & currentBoundaryID() const
Return the current boundary ID.
Definition Assembly.h:420
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhi(FEType type) const
Definition Assembly.h:1630
VectorVariablePhiSecond _vector_second_phi
Definition Assembly.h:2714
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiLower(FEType type) const
Definition Assembly.h:2917
bool _user_added_fe_of_helper_type
Whether user code requested a FEType the same as our _helper_type.
Definition Assembly.h:2353
VectorVariablePhiCurl & curlPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1539
const FEVectorBase *const & getVectorFENeighbor(FEType type, unsigned int dim) const
GetVector a reference to a pointer that will contain the current 'neighbor' FE.
Definition Assembly.h:183
VectorVariablePhiCurl _vector_curl_phi_neighbor
Definition Assembly.h:2727
void setCurrentNeighborSubdomainID(SubdomainID i)
set the current subdomain ID
Definition Assembly.h:493
std::map< FEType, ADTemplateVariablePhiGradient< RealVectorValue > > _ad_vector_grad_phi_data
Definition Assembly.h:2773
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe
Each dimension's actual vector fe objects indexed on type.
Definition Assembly.h:2396
const MooseArray< ADPoint > & adQPointsFace() const
Definition Assembly.h:392
MooseArray< ADReal > _ad_JxW_face
Definition Assembly.h:2838
bool _calculate_xyz
Definition Assembly.h:2849
const VariablePhiValue & phi() const
Definition Assembly.h:1311
void buildFaceNeighborFE(FEType type) const
Build FEs for a neighbor face with a type.
Definition Assembly.C:336
const VectorVariablePhiGradient & gradPhi(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1368
SubdomainID _current_subdomain_id
The current subdomain ID.
Definition Assembly.h:2590
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_face
Definition Assembly.h:2766
const libMesh::CouplingMatrix & _nonlocal_cm
Definition Assembly.h:2311
VectorVariablePhiDivergence _vector_div_phi_neighbor
Definition Assembly.h:2728
Real _current_neighbor_volume
Volume of the current neighbor.
Definition Assembly.h:2612
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:171
const MooseArray< Moose::GenericType< Point, is_ad > > & genericQPoints() const
bool _need_neighbor_lower_d_elem_volume
Whether we need to compute the neighboring lower dimensional element volume.
Definition Assembly.h:2631
DenseVector< Real > getJacobianDiagonal(const DenseMatrix< Number > &ke)
Definition Assembly.h:1883
Moose::CoordinateSystemType _coord_type
The coordinate system.
Definition Assembly.h:2414
VectorVariablePhiGradient _vector_grad_phi_face_neighbor
Definition Assembly.h:2731
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:2194
std::map< FEType, FEBase * > _current_fe_neighbor
The "neighbor" fe object that matches the current elem.
Definition Assembly.h:2378
const OutputTools< OutputType >::VariablePhiValue & fePhiLower(FEType type) const
Definition Assembly.h:2901
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_lower
FE objects for lower dimensional elements.
Definition Assembly.h:2548
std::vector< std::vector< DenseVector< Number > > > _sub_Rn
Definition Assembly.h:2653
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:2276
VariablePhiValue _phi_face_neighbor
Definition Assembly.h:2707
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:369
void buildVectorNeighborFE(FEType type) const
Build Vector FEs for a neighbor with a type.
Definition Assembly.C:514
std::vector< Eigen::Map< RealDIMValue > > _mapped_normals
Mapped normals.
Definition Assembly.h:2524
const libMesh::DofMap & _dof_map
DOF map.
Definition Assembly.h:2340
const VariablePhiSecond & secondPhiFace(const MooseVariableField< Real > &) const
Definition Assembly.h:1333
void setFaceQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for face integration.
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_face_neighbor
Definition Assembly.h:2539
VariablePhiValue & phiFaceNeighbor(const MooseVariableField< Real > &)
Definition Assembly.h:1474
void prepareScalar()
Definition Assembly.C:2951
const OutputTools< OutputType >::VariablePhiValue & feDualPhiLower(FEType type) const
Definition Assembly.h:2909
std::set< FEType > _need_second_derivative_neighbor
Definition Assembly.h:2858
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Ken
jacobian contributions from the element and neighbor <Tag, ivar, jvar>
Definition Assembly.h:2675
std::vector< VectorValue< ADReal > > _ad_dxyzdxi_map
AD quantities.
Definition Assembly.h:2819
VariablePhiSecond _second_phi_face
Definition Assembly.h:2701
const MooseArray< ADReal > & adCurvatures() const
Definition Assembly.C:4796
std::vector< std::unique_ptr< FEBase > > _unique_fe_face_neighbor_helper
Definition Assembly.h:2363
std::vector< Point > _temp_reference_points
Temporary work data for reinitAtPhysical()
Definition Assembly.h:2816
std::vector< std::pair< MooseVariableScalar *, MooseVariableScalar * > > _cm_ss_entry
Entries in the coupling matrix for scalar variables.
Definition Assembly.h:2329
const Elem * _current_lower_d_elem
The current lower dimensional element.
Definition Assembly.h:2623
unsigned int _current_side
The current side of the selected element (valid only when working with sides)
Definition Assembly.h:2596
const bool & _computing_residual_and_jacobian
Whether we are currently computing the residual and Jacobian.
Definition Assembly.h:2320
void buildNeighborFE(FEType type) const
Build FEs for a neighbor with a type.
Definition Assembly.C:314
ArbitraryQuadrature * qruleArbitraryFace(const Elem *elem, unsigned int side)
Definition Assembly.C:1923
const OutputTools< OutputType >::VariablePhiGradient & feGradDualPhiLower(FEType type) const
Definition Assembly.h:2925
std::unordered_map< SubdomainID, std::vector< QRules > > _qrules
Holds quadrature rules for each dimension.
Definition Assembly.h:2451
void setCoordinateTransformation(const libMesh::QBase *qrule, const Points &q_points, Coords &coord, SubdomainID sub_id)
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:1792
std::map< FEType, FEVectorBase * > _current_vector_fe
The "volume" vector fe object that matches the current elem.
Definition Assembly.h:2383
std::vector< VectorValue< ADReal > > _ad_dxyzdzeta_map
Definition Assembly.h:2821
VariablePhiValue & phiFace(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1573
VariablePhiSecond & secondPhi(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1571
VariablePhiGradient _grad_phi_neighbor
Definition Assembly.h:2704
bool computingResidualAndJacobian() const
Definition Assembly.h:1947
libMesh::QBase *const & writeableQRuleNeighbor()
Returns the reference to the current quadrature being used on a current neighbor.
Definition Assembly.h:518
std::unique_ptr< FEBase > _fe_msm
A FE object for working on mortar segement elements.
Definition Assembly.h:2573
std::vector< ADReal > _ad_detadx_map
Definition Assembly.h:2831
void addJacobianNonlocal(GlobalDataKey)
Adds non-local Jacobian to the global Jacobian matrices.
Definition Assembly.C:3868
const VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< Real > &) const
Definition Assembly.h:1342
const unsigned int & neighborSide() const
Returns the current neighboring side.
Definition Assembly.h:443
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:3337
bool computingResidual() const
Definition Assembly.h:1937
void prepareNeighbor()
Definition Assembly.C:2810
VectorVariablePhiGradient _vector_grad_phi_neighbor
Definition Assembly.h:2725
const MooseArray< Point > & physicalPoints() const
The current points in physical space where we have reinited through reinitAtPhysical()
Definition Assembly.h:261
const Elem *const & elem() const
Return the current element.
Definition Assembly.h:405
std::map< FEType, FEVectorBase * > _current_vector_fe_face_neighbor
The "neighbor face" vector fe object that matches the current elem.
Definition Assembly.h:2389
void reinitNeighborAtPhysical(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points)
Reinitializes the neighbor at the physical coordinates on neighbor side given.
Definition Assembly.C:2418
const Node * _current_neighbor_node
The current neighboring node we are working with.
Definition Assembly.h:2616
std::vector< ADReal > _ad_dxidx_map
Definition Assembly.h:2828
DenseMatrix< Number > _tmp_Ke
auxiliary matrix for scaling jacobians (optimization to avoid expensive construction/destruction)
Definition Assembly.h:2692
void buildFE(FEType type) const
Build FEs with a type.
Definition Assembly.C:266
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhiFaceNeighbor(FEType type) const
Definition Assembly.h:1717
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:3050
void setXFEM(std::shared_ptr< XFEMInterface > xfem)
Set the pointer to the XFEM controller object.
Definition Assembly.h:1792
VectorVariablePhiDivergence & divPhiFace(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1522
const Elem *const & neighborLowerDElem() const
Return the neighboring lower dimensional element.
Definition Assembly.h:473
const Elem * _current_neighbor_side_elem
The current side element of the ncurrent neighbor element.
Definition Assembly.h:2608
std::vector< ADReal > _ad_dxidz_map
Definition Assembly.h:2830
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:3454
VariablePhiGradient _grad_phi_face_neighbor
Definition Assembly.h:2708
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_neighbor
Definition Assembly.h:2540
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kle
dlower/dsecondary (or dlower/delement)
Definition Assembly.h:2683
MooseArray< ADReal > _ad_JxW
Definition Assembly.h:2826
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:3422
void copyFaceShapes(MooseVariableField< T > &v)
Definition Assembly.C:3038
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:3315
DenseVector< Number > _tmp_Re
auxiliary vector for scaling residuals (optimization to avoid expensive construction/destruction)
Definition Assembly.h:2658
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & couplingEntries()
Definition Assembly.h:1285
void setResidualBlock(NumericVector< Number > &residual, DenseVector< Number > &res_block, const std::vector< dof_id_type > &dof_indices, const std::vector< Real > &scaling_factor)
Set a local residual block to a global residual vector with proper scaling.
Definition Assembly.C:3287
const VariablePhiValue & phiFace(const MooseVariableField< Real > &) const
Definition Assembly.h:1327
bool _calculate_ad_coord
Whether to calculate coord with AD.
Definition Assembly.h:2855
const libMesh::CouplingMatrix * _cm
Coupling matrices.
Definition Assembly.h:2310
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:2240
VectorVariablePhiCurl _vector_curl_phi_face
Definition Assembly.h:2721
VariablePhiGradient & gradPhi(const MooseVariableField< Real > &)
Definition Assembly.h:1457
MooseArray< Point > _current_q_points_face
The current quadrature points on a face.
Definition Assembly.h:2518
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_neighbor
Definition Assembly.h:2767
void cacheJacobianNeighbor(GlobalDataKey)
Takes the values that are currently in the neighbor Dense Matrices and appends them to the cached val...
Definition Assembly.C:4095
const libMesh::QBase *const & qRuleMortar() const
Returns a reference to the quadrature rule for the mortar segments.
Definition Assembly.h:703
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:3159
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:2290
void setNeighborQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for neighbor integration.
Definition Assembly.C:709
void helpersRequestData()
request phi, dphi, xyz, JxW, etc.
Definition Assembly.C:4809
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Knn
jacobian contributions from the neighbor <Tag, ivar, jvar>
Definition Assembly.h:2679
const MooseArray< ADPoint > & adQPoints() const
Definition Assembly.h:386
libMesh::QBase *const & writeableQRule()
Returns the reference to the current quadrature being used.
Definition Assembly.h:232
void clearCachedQRules()
Set the cached quadrature rules to nullptr.
Definition Assembly.C:726
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kln
dlower/dprimary (or dlower/dneighbor)
Definition Assembly.h:2685
VariablePhiSecond & secondPhi(const MooseVariableField< Real > &)
Definition Assembly.h:1458
libMesh::QBase * _current_qrule_neighbor
quadrature rule used on neighbors
Definition Assembly.h:2555
void setLowerQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for lower dimensional integration.
Definition Assembly.C:690
void buildLowerDFE(FEType type) const
Build FEs for a lower dimensional element with a type.
Definition Assembly.C:358
const VectorVariablePhiCurl & curlPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1420
VariablePhiGradient _grad_phi_face
Definition Assembly.h:2700
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:2338
const std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & couplingEntries() const
Definition Assembly.h:1290
const std::vector< Point > & qPointsMortar() const
Returns the reference to the mortar segment element quadrature points.
Definition Assembly.h:255
std::map< unsigned int, const std::vector< Point > * > _holder_normals
Holds pointers to the dimension's normal vectors.
Definition Assembly.h:2533
const OutputTools< OutputType >::VariablePhiValue & fePhiNeighbor(FEType type) const
Definition Assembly.h:1679
libMesh::QBase *const & writeableQRuleFace()
Returns the reference to the current quadrature being used on a current face.
Definition Assembly.h:319
void setCurrentSubdomainID(SubdomainID i)
set the current subdomain ID
Definition Assembly.h:415
Real elementVolume(const Elem *elem) const
On-demand computation of volume element accounting for RZ/RSpherical.
Definition Assembly.C:3755
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_neighbor
types of finite elements
Definition Assembly.h:2538
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...
const VariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< Real > &) const
Definition Assembly.h:1355
const VariablePhiGradient & gradPhiFace(const MooseVariableField< Real > &) const
Definition Assembly.h:1329
const OutputTools< OutputType >::VariablePhiGradient & feGradPhi(FEType type) const
Definition Assembly.h:1617
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhiFace(FEType type) const
Definition Assembly.h:1733
const unsigned int & side() const
Returns the current side.
Definition Assembly.h:437
std::vector< VectorValue< ADReal > > _ad_d2xyzdeta2_map
Definition Assembly.h:2824
BoundaryID _current_boundary_id
The current boundary ID.
Definition Assembly.h:2592
MooseArray< std::vector< Point > > _current_tangents
The current tangent vectors at the quadrature points.
Definition Assembly.h:2526
std::vector< std::unique_ptr< FEBase > > _unique_fe_face_helper
Definition Assembly.h:2362
std::map< FEType, FEBase * > _current_fe
The "volume" fe object that matches the current elem.
Definition Assembly.h:2374
VectorVariablePhiGradient & gradPhiFace(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1510
const ADTemplateVariablePhiGradient< OutputType > & feADGradPhiFace(FEType type) const
Definition Assembly.h:1665
const std::vector< Eigen::Map< RealDIMValue > > & mappedNormals() const
Definition Assembly.h:353
const VectorVariablePhiCurl & curlPhi(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1376
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:2925
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_lower
Definition Assembly.h:2761
VectorVariablePhiGradient & gradPhi(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1489
const Real & lowerDElemVolume() const
Definition Assembly.h:3198
VariablePhiSecond _second_phi
Definition Assembly.h:2697
void cacheJacobianBlock(const DenseMatrix< Number > &jac_block, const std::vector< dof_id_type > &idof_indices, const std::vector< dof_id_type > &jdof_indices, Real scaling_factor, LocalDataKey, const std::set< TagID > &tags)
Cache a local Jacobian block with the provided rows (idof_indices) and columns (jdof_indices) for eve...
Definition Assembly.C:3719
std::vector< VectorValue< ADReal > > _ad_d2xyzdxideta_map
Definition Assembly.h:2823
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:2487
const MooseArray< ADPoint > & adNormals() const
Definition Assembly.h:384
std::vector< std::pair< unsigned int, unsigned short > > _disp_numbers_and_directions
Container of displacement numbers and directions.
Definition Assembly.h:2847
T * qruleFaceHelper(const Elem *elem, unsigned int side, std::function< T *(QRules &)> rule_fn)
Definition Assembly.h:2463
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_face
types of vector finite elements
Definition Assembly.h:2508
VectorVariablePhiValue _vector_phi
Definition Assembly.h:2712
void buildVectorLowerDFE(FEType type) const
Build Vector FEs for a lower dimensional element with a type.
Definition Assembly.C:403
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:4423
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhiNeighbor(FEType type) const
Definition Assembly.h:1693
std::map< unsigned int, std::map< FEType, FEBase * > > _fe
Each dimension's actual fe objects indexed on type.
Definition Assembly.h:2394
std::set< FEType > _need_curl
Definition Assembly.h:2859
const VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< Real > &) const
Definition Assembly.h:1359
const VectorVariablePhiSecond & secondPhi(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1372
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:2361
unsigned int numExtraElemIntegers() const
Number of extra element integers Assembly tracked.
Definition Assembly.h:364
const libMesh::QBase * attachQRuleElem(unsigned int dim, FEBase &fe)
Attaches the current elem/volume quadrature rule to the given fe.
Definition Assembly.h:1899
void activateDual()
Indicates that dual shape functions are used for mortar constraint.
Definition Assembly.h:608
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > _cm_ff_entry
Entries in the coupling matrix for field variables.
Definition Assembly.h:2323
const Moose::CoordinateSystemType & coordSystem() const
Get the coordinate system type.
Definition Assembly.h:307
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > _cm_nonlocal_entry
Entries in the coupling matrix for field variables for nonlocal calculations.
Definition Assembly.h:2331
bool _current_elem_volume_computed
Boolean to indicate whether current element volumes has been computed.
Definition Assembly.h:2618
VectorVariablePhiSecond _vector_second_phi_neighbor
Definition Assembly.h:2726
const std::vector< std::pair< MooseVariableFieldBase *, MooseVariableScalar * > > & fieldScalarCouplingEntries() const
Definition Assembly.h:1300
const VectorVariablePhiValue & phi(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1364
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:1115
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiFaceNeighbor(FEType type) const
Definition Assembly.h:1709
void buildLowerDDualFE(FEType type) const
Definition Assembly.C:382
VariablePhiValue _phi_neighbor
Definition Assembly.h:2703
VariablePhiValue & phiFace(const MooseVariableField< Real > &)
Definition Assembly.h:1460
void addCachedResidualDirectly(NumericVector< Number > &residual, GlobalDataKey, const VectorTag &vector_tag)
Adds the values that have been cached by calling cacheResidual(), cacheResidualNeighbor(),...
Definition Assembly.C:3513
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_face
types of finite elements
Definition Assembly.h:2506
std::vector< ADReal > _ad_jac
Definition Assembly.h:2825
void addJacobianNeighbor(GlobalDataKey)
Add ElementNeighbor, NeighborElement, and NeighborNeighbor portions of the Jacobian for compute objec...
Definition Assembly.C:3890
VectorVariablePhiCurl _vector_curl_phi_face_neighbor
Definition Assembly.h:2733
void setMortarQRule(Order order)
Specifies a custom qrule for integration on mortar segment mesh.
Definition Assembly.C:735
void saveLocalADArray(std::vector< ADReal > &re, unsigned int i, unsigned int ntest, const ADRealEigenVector &v) const
Definition Assembly.C:3788
VariablePhiGradient & gradPhi(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1570
const std::vector< VectorTag > & _residual_vector_tags
The residual vector tags that Assembly could possibly contribute to.
Definition Assembly.h:2787
const Elem * _current_neighbor_elem
The current neighbor "element".
Definition Assembly.h:2602
VectorVariablePhiDivergence _vector_div_phi_face
Definition Assembly.h:2722
bool _user_added_fe_face_neighbor_of_helper_type
Definition Assembly.h:2355
const MooseArray< ADReal > & adJxWFace() const
Definition Assembly.h:271
std::vector< ADReal > _ad_dzetadx_map
Definition Assembly.h:2834
std::vector< dof_id_type > _column_indices
Definition Assembly.h:2890
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:123
const VariablePhiValue & phiNeighbor(const MooseVariableField< Real > &) const
Definition Assembly.h:1338
MooseMesh & _mesh
Definition Assembly.h:2344
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:3118
std::vector< ADReal > _ad_detadz_map
Definition Assembly.h:2833
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:1133
std::vector< dof_id_type > _temp_dof_indices
Temporary work vector to keep from reallocating it.
Definition Assembly.h:2813
std::vector< std::vector< std::vector< unsigned char > > > _jacobian_block_used
Flag that indicates if the jacobian block was used.
Definition Assembly.h:2333
void buildVectorFaceNeighborFE(FEType type) const
Build Vector FEs for a neighbor face with a type.
Definition Assembly.C:544
ArbitraryQuadrature * _current_qface_arbitrary
The current arbitrary quadrature rule used on element faces.
Definition Assembly.h:2516
VectorVariablePhiGradient _vector_grad_phi
Definition Assembly.h:2713
const VectorVariablePhiGradient & gradPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1389
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:2294
void prepareJacobianBlock()
Sizes and zeroes the Jacobian blocks used for the current element.
Definition Assembly.C:2684
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:2285
void resizeADMappingObjects(unsigned int n_qp, unsigned int dim)
resize any objects that contribute to automatic differentiation-related mapping calculations
Definition Assembly.C:971
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)
Push a local residual block with proper scaling into cache.
Definition Assembly.C:3264
const libMesh::QBase *const & qRuleNeighbor() const
Returns the reference to the current quadrature being used on a current neighbor.
Definition Assembly.h:509
std::vector< VectorValue< ADReal > > _ad_dxyzdeta_map
Definition Assembly.h:2820
bool computingJacobian() const
Definition Assembly.h:1942
const Node * _current_node
The current node we are working with.
Definition Assembly.h:2614
VariablePhiValue & phiFaceNeighbor(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1596
DenseVector< Number > & residualBlockLower(unsigned int var_num, LocalDataKey, TagID tag_id)
Get residual block for lower.
Definition Assembly.h:1124
std::map< FEType, ADTemplateVariablePhiGradient< RealVectorValue > > _ad_vector_grad_phi_data_face
Definition Assembly.h:2776
void cacheJacobianMortar(GlobalDataKey)
Cache all portions of the Jacobian, e.g.
Definition Assembly.C:4133
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
THREAD_ID _tid
Thread number (id)
Definition Assembly.h:2342
bool _calculate_face_xyz
Definition Assembly.h:2850
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kel
dsecondary/dlower (or delement/dlower)
Definition Assembly.h:2687
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_dual_lower
Definition Assembly.h:2770
MooseArray< Point > _current_normals
The current Normal vectors at the quadrature points.
Definition Assembly.h:2522
void cacheJacobian(GlobalDataKey)
Takes the values that are currently in _sub_Kee and appends them to the cached values.
Definition Assembly.C:4043
bool _calculate_curvatures
Definition Assembly.h:2851
std::vector< std::vector< Real > > _cached_residual_values
Values cached by calling cacheResidual() (the first vector is for TIME vs NONTIME)
Definition Assembly.h:2790
const Node *const & node() const
Returns the reference to the node.
Definition Assembly.h:536
std::vector< std::vector< dof_id_type > > _cached_jacobian_cols
Column where the corresponding cached value should go.
Definition Assembly.h:2802
ArbitraryQuadrature * _current_qrule_arbitrary
The current arbitrary quadrature rule used within the element interior.
Definition Assembly.h:2406
void computeADFace(const Elem &elem, const unsigned int side)
compute AD things on an element face
Definition Assembly.C:2111
libMesh::ElemSideBuilder _current_side_elem_builder
In place side element builder for _current_side_elem.
Definition Assembly.h:2869
const VectorVariablePhiCurl & curlPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1397
void setCurrentBoundaryID(BoundaryID i)
set the current boundary ID
Definition Assembly.h:425
void computeFaceMap(const Elem &elem, const unsigned int side, const std::vector< Real > &qw)
Definition Assembly.C:1348
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_lower
Vector FE objects for lower dimensional elements.
Definition Assembly.h:2550
void setCachedJacobian(GlobalDataKey)
Sets previously-cached Jacobian values via SparseMatrix::set() calls.
Definition Assembly.C:4475
const VectorVariablePhiSecond & secondPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1416
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
libMesh::QBase * qruleFace(const Elem *elem, unsigned int side)
This is an abstraction over the internal qrules function.
Definition Assembly.C:1917
std::vector< std::vector< DenseVector< Number > > > _sub_Rl
residual contributions for each variable from the lower dimensional element
Definition Assembly.h:2655
std::map< FEType, FEBase * > _current_fe_face
The "face" fe object that matches the current elem.
Definition Assembly.h:2376
VectorVariablePhiValue & phi(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1488
void addCachedJacobian(GlobalDataKey)
Adds the values that have been cached by calling cacheJacobian() and or cacheJacobianNeighbor() to th...
Definition Assembly.C:3798
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:2258
VectorVariablePhiDivergence _vector_div_phi
Definition Assembly.h:2716
const OutputTools< OutputType >::VariablePhiValue & fePhi(FEType type) const
Definition Assembly.h:1610
const VectorVariablePhiDivergence & divPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1450
const VectorVariablePhiDivergence & divPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1401
void reinit(const Elem *elem)
Reinitialize objects (JxW, q_points, ...) for an elements.
Definition Assembly.C:1819
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:378
const VectorVariablePhiDivergence & divPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1425
std::vector< dof_id_type > _neighbor_extra_elem_ids
Extra element IDs of neighbor.
Definition Assembly.h:2531
libMesh::ElemSideBuilder _compute_face_map_side_elem_builder
In place side element builder for computeFaceMap()
Definition Assembly.h:2873
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:3390
VectorVariablePhiValue & phiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1527
void modifyFaceWeightsDueToXFEM(const Elem *elem, unsigned int side=0)
Update the face integration weights for XFEM partial elements.
Definition Assembly.C:4536
unsigned int _max_cached_residuals
Definition Assembly.h:2795
void buildFaceFE(FEType type) const
Build FEs for a face with a type.
Definition Assembly.C:292
const Real & sideElemVolume() const
Returns the reference to the volume of current side element.
Definition Assembly.h:455
std::shared_ptr< XFEMInterface > _xfem
The XFEM controller.
Definition Assembly.h:2371
std::map< unsigned int, FEBase * > _holder_fe_face_neighbor_helper
Definition Assembly.h:2545
std::set< FEType > _need_neighbor_div
Definition Assembly.h:2862
SubdomainID _current_neighbor_subdomain_id
The current neighbor subdomain ID.
Definition Assembly.h:2604
const ADTemplateVariablePhiGradient< OutputType > & feADGradPhi(FEType type) const
Definition Assembly.h:1624
std::map< FEType, FEVectorBase * > _current_vector_fe_face
The "face" vector fe object that matches the current elem.
Definition Assembly.h:2385
VariablePhiValue _phi
Definition Assembly.h:2695
bool _custom_mortar_qrule
Flag specifying whether a custom quadrature rule has been specified for mortar segment mesh.
Definition Assembly.h:2580
libMesh::ElemSideBuilder _current_neighbor_side_elem_builder
In place side element builder for _current_neighbor_side_elem.
Definition Assembly.h:2871
const SubdomainID & currentNeighborSubdomainID() const
Return the current subdomain ID.
Definition Assembly.h:488
std::vector< std::vector< dof_id_type > > _cached_jacobian_rows
Row where the corresponding cached value should go.
Definition Assembly.h:2800
std::map< FEType, ADTemplateVariablePhiGradient< Real > > _ad_grad_phi_data_face
Definition Assembly.h:2774
MooseArray< ADReal > _ad_coord
The AD version of the current coordinate transformation coefficients.
Definition Assembly.h:2418
const libMesh::QBase * attachQRuleFace(unsigned int dim, FEBase &fe)
Attaches the current face/area quadrature rule to the given fe.
Definition Assembly.h:1911
std::vector< std::unique_ptr< FEBase > > _unique_fe_neighbor_helper
Definition Assembly.h:2364
VariablePhiSecond & secondPhiFace(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1578
std::map< FEType, FEBase * > _current_fe_face_neighbor
The "neighbor face" fe object that matches the current elem.
Definition Assembly.h:2380
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
VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< Real > &)
Definition Assembly.h:1482
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_neighbor
Definition Assembly.h:2759
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:2249
VariablePhiValue & phi(const MooseVariableField< Real > &)
Definition Assembly.h:1456
VariablePhiValue & phiNeighbor(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1583
bool _need_lower_d_elem_volume
Whether we need to compute the lower dimensional element volume.
Definition Assembly.h:2627
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_face_neighbor
Definition Assembly.h:2768
QRules & qrules(unsigned int dim)
Definition Assembly.h:2482
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:2272
bool _need_neighbor_elem_volume
true is apps need to compute neighbor element volume
Definition Assembly.h:2610
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhiFace(FEType type) const
Definition Assembly.h:1764
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Keg
Definition Assembly.h:2672
SubProblem & _subproblem
Definition Assembly.h:2305
std::set< FEType > _need_face_div
Definition Assembly.h:2861
const std::vector< Real > & jxWMortar() const
Returns a reference to JxW for mortar segment elements.
Definition Assembly.h:698
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:1994
const MooseArray< std::vector< Point > > & tangents() const
Returns the array of tangents for quadrature points on a current side.
Definition Assembly.h:359
const ADTemplateVariablePhiGradient< T > & adGradPhi(const MooseVariableFE< T > &v) const
Definition Assembly.h:1313
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:3840
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:2019
void init(const libMesh::CouplingMatrix *cm)
Initialize the Assembly object and set the CouplingMatrix for use throughout.
const Real & elemVolume() const
Returns the reference to the current element volume.
Definition Assembly.h:431
VectorVariablePhiSecond & secondPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1535
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:4281
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiNeighbor(FEType type) const
Definition Assembly.h:1686
VectorVariablePhiGradient _vector_grad_phi_face
Definition Assembly.h:2719
VariablePhiValue & phiNeighbor(const MooseVariableField< Real > &)
Definition Assembly.h:1464
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableScalar * > > _cm_fs_entry
Entries in the coupling matrix for field variables vs scalar variables.
Definition Assembly.h:2325
Real _current_side_volume
Volume of the current side element.
Definition Assembly.h:2600
void copyShapes(MooseVariableField< T > &v)
Definition Assembly.C:3001
const MooseArray< Real > & coordTransformation() const
Returns the reference to the coordinate transformation coefficients.
Definition Assembly.h:279
void addResidualBlock(NumericVector< Number > &residual, DenseVector< Number > &res_block, const std::vector< dof_id_type > &dof_indices, const std::vector< Real > &scaling_factor)
Add a local residual block to a global residual vector with proper scaling.
Definition Assembly.C:3249
VariablePhiSecond _second_phi_neighbor
Definition Assembly.h:2705
Real _current_neighbor_lower_d_elem_volume
The current neighboring lower dimensional element volume.
Definition Assembly.h:2633
MooseArray< Real > _coord
The current coordinate transformation coefficients.
Definition Assembly.h:2416
void prepare()
Definition Assembly.C:2717
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_lower
Definition Assembly.h:2769
void buildVectorFE(FEType type) const
Build Vector FEs with a type.
Definition Assembly.C:453
VectorVariablePhiCurl & curlPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1559
const OutputTools< OutputType >::VariablePhiValue & fePhiFace(FEType type) const
Definition Assembly.h:1651
VariablePhiGradient & gradPhiFace(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1574
static const T *const & constify_ref(T *const &inref)
Workaround for C++ compilers thinking they can't just cast a const-reference-to-pointer to const-refe...
Definition Assembly.h:111
DenseVector< Number > & residualBlock(unsigned int var_num, LocalDataKey, TagID tag_id)
Get local residual block for a variable and a tag.
Definition Assembly.h:1106
ArbitraryQuadrature * _current_qrule_arbitrary_face
The current arbitrary quadrature rule used on the element face.
Definition Assembly.h:2408
const MooseArray< Real > & JxW() const
Returns the reference to the transformed jacobian weights.
Definition Assembly.h:267
void havePRefinement(const std::unordered_set< FEFamily > &disable_p_refinement_for_families)
Indicate that we have p-refinement.
Definition Assembly.C:4842
VariablePhiValue _phi_face
Definition Assembly.h:2699
std::vector< std::vector< std::vector< unsigned char > > > _jacobian_block_nonlocal_used
Definition Assembly.h:2334
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:159
VectorVariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1551
void prepareResidual()
Sizes and zeroes the residual for the current element.
Definition Assembly.C:2708
void setCurrentLowerDElem(const Elem *const lower_d_elem)
Set the current lower dimensional element.
Definition Assembly.h:3219
bool needDual() const
Indicates whether dual shape functions are used (computation is now repeated on each element so expen...
Definition Assembly.h:614
void buildVectorFaceFE(FEType type) const
Build Vector FEs for a face with a type.
Definition Assembly.C:484
VectorVariablePhiValue _vector_phi_neighbor
Definition Assembly.h:2724
const MooseArray< Real > & JxWNeighbor() const
Returns the reference to the transformed jacobian weights on a current face.
Definition Assembly.C:259
bool _user_added_fe_neighbor_of_helper_type
Definition Assembly.h:2356
const MooseArray< Point > & qPointsFace() const
Returns the reference to the current quadrature being used.
Definition Assembly.h:336
VectorVariablePhiValue _vector_phi_face
Definition Assembly.h:2718
void reinitFEFace(const Elem *elem, unsigned int side)
Just an internal helper function to reinit the face FE objects.
Definition Assembly.C:1268
const MooseArray< ADReal > & adJxW() const
Definition Assembly.h:269
const MooseArray< Point > & qPointsFaceNeighbor() const
Returns the reference to the current quadrature points being used on the neighbor face.
Definition Assembly.h:530
std::map< unsigned int, FEBase * > _holder_fe_neighbor_helper
Each dimension's helper objects.
Definition Assembly.h:2544
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:4213
VectorVariablePhiSecond _vector_second_phi_face
Definition Assembly.h:2720
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:1832
const Elem *const & msmElem() const
Definition Assembly.h:1952
const libMesh::QBase *const & qRuleFace() const
Returns the reference to the current quadrature being used on a current face.
Definition Assembly.h:313
void reinitNeighborLowerDElem(const Elem *elem)
reinitialize a neighboring lower dimensional element
Definition Assembly.C:2383
void initNonlocalCoupling()
Create pair of variables requiring nonlocal jacobian contributions.
Definition Assembly.C:2649
MooseArray< ADReal > _ad_curvatures
Definition Assembly.h:2842
VectorVariablePhiSecond & secondPhiFace(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1514
const VectorVariablePhiCurl & curlPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1445
const Real & neighborVolume()
Returns the reference to the current neighbor volume.
Definition Assembly.h:499
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhiFace(FEType type) const
Definition Assembly.h:1671
libMesh::QBase * _qrule_msm
A qrule object for working on mortar segement elements.
Definition Assembly.h:2578
unsigned int _max_cached_jacobians
Definition Assembly.h:2804
const Elem * _current_side_elem
The current "element" making up the side we are currently on.
Definition Assembly.h:2598
std::set< FEType > _need_div
Definition Assembly.h:2860
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:147
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:2793
const MooseArray< Real > & JxWFace() const
Returns the reference to the transformed jacobian weights on a current face.
Definition Assembly.h:342
std::map< FEType, ADTemplateVariablePhiGradient< Real > > _ad_grad_phi_data
Definition Assembly.h:2772
VariablePhiSecond & secondPhiNeighbor(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1591
const VariablePhiGradient & gradPhi(const MooseVariableField< Real > &) const
Definition Assembly.h:1319
std::map< unsigned int, FEBase * > _holder_fe_helper
Each dimension's helper objects.
Definition Assembly.h:2398
VariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1600
MooseArray< Point > _current_q_points_face_neighbor
The current quadrature points on the neighbor face.
Definition Assembly.h:2557
std::vector< ADReal > _ad_dzetadz_map
Definition Assembly.h:2836
std::vector< ADReal > _ad_detady_map
Definition Assembly.h:2832
const Elem *const & sideElem() const
Returns the side element.
Definition Assembly.h:449
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhi(FEType type) const
Definition Assembly.h:1725
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kne
jacobian contributions from the neighbor and element <Tag, ivar, jvar>
Definition Assembly.h:2677
const NumericVector< Real > * _scaling_vector
The map from global index to variable scaling factor.
Definition Assembly.h:2866
MooseArray< Real > _current_JxW
The current list of transformed jacobian weights.
Definition Assembly.h:2412
void zeroCachedJacobian(GlobalDataKey)
Zero out previously-cached Jacobian rows.
Definition Assembly.C:4495
void buildVectorDualLowerDFE(FEType type) const
Definition Assembly.C:428
const libMesh::QBase *const & qRule() const
Returns the reference to the current quadrature being used.
Definition Assembly.h:226
const Elem * _current_neighbor_lower_d_elem
The current neighboring lower dimensional element.
Definition Assembly.h:2625
VariablePhiValue & phi(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1569
libMesh::QBase * _current_qrule_lower
quadrature rule used on lower dimensional elements.
Definition Assembly.h:2584
const VariablePhiValue & phiFaceNeighbor(const MooseVariableField< Real > &) const
Definition Assembly.h:1351
void clearCachedResiduals(GlobalDataKey)
Clears all of the residuals in _cached_residual_rows and _cached_residual_values.
Definition Assembly.C:3483
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:4339
void computeCurrentElemVolume()
Definition Assembly.C:1754
const MooseArray< Real > & mortarCoordTransformation() const
Returns the reference to the coordinate transformation coefficients on the mortar segment mesh.
Definition Assembly.h:285
unsigned int _current_neighbor_side
The current side of the selected neighboring element (valid only when working with sides)
Definition Assembly.h:2606
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Knl
dprimary/dlower (or dneighbor/dlower)
Definition Assembly.h:2689
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:3359
MooseArray< VectorValue< ADReal > > _ad_q_points_face
Definition Assembly.h:2840
void reinitMortarElem(const Elem *elem)
reinitialize a mortar segment mesh element in order to get a proper JxW
Definition Assembly.C:2404
std::vector< VectorValue< ADReal > > _ad_d2xyzdxi2_map
Definition Assembly.h:2822
VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1604
const Elem * _current_elem
The current "element" we are currently on.
Definition Assembly.h:2588
std::map< unsigned int, FEBase * > _holder_fe_face_helper
Each dimension's helper objects.
Definition Assembly.h:2510
const VectorVariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1440
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_face_neighbor
Definition Assembly.h:2541
const VectorVariablePhiGradient & gradPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1411
VectorVariablePhiDivergence _vector_div_phi_face_neighbor
Definition Assembly.h:2734
bool _have_p_refinement
Whether we have ever conducted p-refinement.
Definition Assembly.h:2893
VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1587
void reinitNeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
Reinitializes the neighbor side using reference coordinates.
Definition Assembly.C:1687
const Elem * _msm_elem
Definition Assembly.h:2875
libMesh::QBase * _current_qrule_volume
The current volumetric quadrature for the element.
Definition Assembly.h:2404
void addJacobianNeighborLowerD(GlobalDataKey)
Add all portions of the Jacobian except PrimaryPrimary, e.g.
Definition Assembly.C:3928
std::map< FEType, FEVectorBase * > _current_vector_fe_neighbor
The "neighbor" vector fe object that matches the current elem.
Definition Assembly.h:2387
VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< Real > &)
Definition Assembly.h:1465
MooseArray< Real > _coord_msm
The coordinate transformation coefficients evaluated on the quadrature points of the mortar segment m...
Definition Assembly.h:2566
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:207
Real _current_lower_d_elem_volume
The current lower dimensional element volume.
Definition Assembly.h:2629
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:3540
const VectorVariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1435
std::vector< std::vector< Real > > _cached_jacobian_values
Values cached by calling cacheJacobian()
Definition Assembly.h:2798
bool _user_added_fe_face_of_helper_type
Definition Assembly.h:2354
void clearCachedJacobian()
Clear any currently cached jacobians.
Definition Assembly.C:4505
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.
const Node *const & nodeNeighbor() const
Returns the reference to the neighboring node.
Definition Assembly.h:542
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_dual_lower
Definition Assembly.h:2762
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data
Shape function values, gradients, second derivatives for each FE type.
Definition Assembly.h:2757
std::vector< Point > _current_neighbor_ref_points
The current reference points on the neighbor element.
Definition Assembly.h:2896
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:3170
void copyNeighborShapes(MooseVariableField< T > &v)
Definition Assembly.C:3075
std::set< FEType > _need_second_derivative
Definition Assembly.h:2857
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhiNeighbor(FEType type) const
Definition Assembly.h:1741
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:2890
std::vector< dof_id_type > _extra_elem_ids
Extra element IDs.
Definition Assembly.h:2529
void hasScalingVector()
signals this object that a vector containing variable scaling factors should be used when doing resid...
Definition Assembly.C:4557
void addCachedResiduals(GlobalDataKey, const std::vector< VectorTag > &tags)
Pushes all cached residuals to the global residual vectors associated with each tag.
Definition Assembly.C:3468
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_face_neighbor
Definition Assembly.h:2760
bool _user_added_fe_lower_of_helper_type
Definition Assembly.h:2357
MooseArray< Real > _current_JxW_neighbor
The current transformed jacobian weights on a neighbor's face.
Definition Assembly.h:2561
std::vector< ADReal > _ad_dxidy_map
Definition Assembly.h:2829
unsigned int _mesh_dimension
Definition Assembly.h:2346
DenseVector< Number > _element_vector
A working vector to avoid repeated heap allocations when caching residuals that must have libMesh-lev...
Definition Assembly.h:2880
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhiFaceNeighbor(FEType type) const
Definition Assembly.h:1780
const VectorVariablePhiValue & phiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1406
VariablePhiSecond _second_phi_face_neighbor
Definition Assembly.h:2709
VectorVariablePhiDivergence & divPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1563
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:3531
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_face
Definition Assembly.h:2758
const VariablePhiSecond & secondPhi() const
Definition Assembly.h:1320
const VariablePhiSecond & secondPhi(const MooseVariableField< Real > &) const
Definition Assembly.h:1321
const Elem *const & neighbor() const
Return the neighbor element.
Definition Assembly.h:461
void prepareOffDiagScalar()
Definition Assembly.C:2975
void prepareNonlocal()
Definition Assembly.C:2724
const SubdomainID & currentSubdomainID() const
Return the current subdomain ID.
Definition Assembly.h:410
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:195
void prepareVariable(MooseVariableFieldBase *var)
Used for preparing the dense residual and jacobian blocks for one particular variable.
Definition Assembly.C:2750
VariablePhiSecond & secondPhiFace(const MooseVariableField< Real > &)
Definition Assembly.h:1462
const Elem *const & lowerDElem() const
Return the lower dimensional element.
Definition Assembly.h:467
const VectorVariablePhiValue & phiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1430
const VectorVariablePhiSecond & secondPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1393
bool _need_dual
Whether dual shape functions need to be computed for mortar constraints.
Definition Assembly.h:2635
const MooseArray< ADReal > & adCoordTransformation() const
Returns the reference to the AD version of the coordinate transformation coefficients.
Definition Assembly.h:291
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
forward declarations
Definition MooseArray.h:18
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
Base variable class.
const libMesh::FEType & feType() const
Get the type of finite element object.
Class for stuff related to variables.
This class provides an interface for common operations on field variables of both FE and FV types wit...
Class for stuff related to variables.
Class for scalar variables (they are different).
The Kokkos assembly class.
A NodeFaceConstraint is used when you need to create constraints between two surfaces in a mesh.
Nonlinear system to be solved.
Generic class for solving transient nonlinear problems.
Definition SubProblem.h:79
Base class for a system (of equations)
Definition SystemBase.h:87
Storage for all of the information pretaining to a vector tag.
Definition VectorTag.h:18
This is the XFEMInterface class.
void resize(const unsigned int new_m, const unsigned int new_n)
void resize(const unsigned int n)
void constrain_element_matrix(DenseMatrix< Number > &matrix, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const
void constrain_element_vector(DenseVector< Number > &rhs, std::vector< dof_id_type > &dofs, bool asymmetric_constraint_rows=true) const
auto raw_value(const Eigen::Map< T > &in)
ConstraintJacobianType
Definition MooseTypes.h:851
const SubdomainID ANY_BLOCK_ID
Definition MooseTypes.C:19
CoordinateSystemType
Definition MooseTypes.h:864
DGJacobianType
Definition MooseTypes.h:804
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
FEGenericBase< RealGradient > FEVectorBase
VectorValue< Real > RealVectorValue
Definition SubProblem.h:34
FEGenericBase< Real > FEBase
Data structure for tracking/grouping a set of quadrature rules for a particular dimensionality of mes...
Definition Assembly.h:2423
std::unique_ptr< ArbitraryQuadrature > arbitrary_vol
volume/elem (meshdim) custom points quadrature rule
Definition Assembly.h:2440
std::unique_ptr< ArbitraryQuadrature > neighbor
area/face (meshdim-1) custom points quadrature rule for DG
Definition Assembly.h:2444
std::unique_ptr< libMesh::QBase > fv_face
finite volume face/flux quadrature rule (meshdim-1)
Definition Assembly.h:2438
std::unique_ptr< libMesh::QBase > vol
volume/elem (meshdim) quadrature rule
Definition Assembly.h:2434
std::unique_ptr< ArbitraryQuadrature > arbitrary_face
area/face (meshdim-1) custom points quadrature rule
Definition Assembly.h:2442
std::unique_ptr< libMesh::QBase > face
area/face (meshdim-1) quadrature rule
Definition Assembly.h:2436