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#include <algorithm>
29
30// libMesh forward declarations
31namespace libMesh
32{
33class DofMap;
34class CouplingMatrix;
35class Elem;
36template <typename>
37class VectorValue;
39template <typename T>
40class FEGenericBase;
43class Node;
44template <typename T>
45class NumericVector;
46template <typename T>
47class SparseMatrix;
49}
50
51// MOOSE Forward Declares
52class FaceInfo;
53class MooseMesh;
55class SystemBase;
58template <typename>
59class MooseVariableFE;
64class XFEMInterface;
65class SubProblem;
67
68#ifdef MOOSE_KOKKOS_ENABLED
70{
71class Assembly;
72}
73#endif
74
83template <typename P, typename C>
84void coordTransformFactor(const SubProblem & s,
85 SubdomainID sub_id,
86 const P & point,
87 C & factor,
88 SubdomainID neighbor_sub_id = libMesh::Elem::invalid_subdomain_id);
89
90template <typename P, typename C>
92 SubdomainID sub_id,
93 const P & point,
94 C & factor,
95 SubdomainID neighbor_sub_id = libMesh::Elem::invalid_subdomain_id);
96
102{
103public:
104 Assembly(SystemBase & sys, THREAD_ID tid);
105 virtual ~Assembly();
106
111 template <typename T>
112 static const T * const & constify_ref(T * const & inref)
113 {
114 const T * const * ptr = &inref;
115 return *ptr;
116 }
117
124 const FEBase * const & getFE(FEType type, unsigned int dim) const
125 {
126 buildFE(type);
127 return constify_ref(_fe[dim][type]);
128 }
129
136 const FEBase * const & getFENeighbor(FEType type, unsigned int dim) const
137 {
138 buildNeighborFE(type);
139 return constify_ref(_fe_neighbor[dim][type]);
140 }
141
148 const FEBase * const & getFEFace(FEType type, unsigned int dim) const
149 {
150 buildFaceFE(type);
151 return constify_ref(_fe_face[dim][type]);
152 }
153
160 const FEBase * const & getFEFaceNeighbor(FEType type, unsigned int dim) const
161 {
163 return constify_ref(_fe_face_neighbor[dim][type]);
164 }
165
172 const FEVectorBase * const & getVectorFE(FEType type, unsigned int dim) const
173 {
174 buildVectorFE(type);
175 return constify_ref(_vector_fe[dim][type]);
176 }
177
184 const FEVectorBase * const & getVectorFENeighbor(FEType type, unsigned int dim) const
185 {
187 return constify_ref(_vector_fe_neighbor[dim][type]);
188 }
189
196 const FEVectorBase * const & getVectorFEFace(FEType type, unsigned int dim) const
197 {
198 buildVectorFaceFE(type);
199 return constify_ref(_vector_fe_face[dim][type]);
200 }
201
208 const FEVectorBase * const & getVectorFEFaceNeighbor(FEType type, unsigned int dim) const
209 {
212 }
213
214#ifdef MOOSE_KOKKOS_ENABLED
221#endif
222
227 const libMesh::QBase * const & qRule() const { return constify_ref(_current_qrule); }
228
234
235#ifdef MOOSE_KOKKOS_ENABLED
241 {
242 return qrules(dim, block).vol.get();
243 }
244#endif
245
250 const MooseArray<Point> & qPoints() const { return _current_q_points; }
251
256 const std::vector<Point> & qPointsMortar() const { return _fe_msm->get_xyz(); }
257
263
268 const MooseArray<Real> & JxW() const { return _current_JxW; }
269
270 const MooseArray<ADReal> & adJxW() const { return _ad_JxW; }
271
272 const MooseArray<ADReal> & adJxWFace() const { return _ad_JxW_face; }
273
274 const MooseArray<ADReal> & adCurvatures() const;
275
280 const MooseArray<Real> & coordTransformation() const { return _coord; }
281
287
293 {
294 // Coord values for non-cartesian coordinate systems are functions of the locations of the
295 // quadrature points in physical space. We also have no way of knowing whether this was called
296 // from a volumetric or face object so we should set both volumetric and face xyz to true
297 _calculate_xyz = true;
298 _calculate_face_xyz = true;
299
300 _calculate_ad_coord = true;
301 return _ad_coord;
302 }
303
309
314 const libMesh::QBase * const & qRuleFace() const { return constify_ref(_current_qrule_face); }
315
321
322#ifdef MOOSE_KOKKOS_ENABLED
328 {
329 return qrules(dim, block).face.get();
330 }
331#endif
332
338
343 const MooseArray<Real> & JxWFace() const { return _current_JxW_face; }
344
349 const MooseArray<Point> & normals() const { return _current_normals; }
350
351 /***
352 * Returns the array of normals for quadrature points on a current side
353 */
354 const std::vector<Eigen::Map<RealDIMValue>> & mappedNormals() const { return _mapped_normals; }
355
361
365 unsigned int numExtraElemIntegers() const { return _extra_elem_ids.size() - 1; }
366
370 const dof_id_type & extraElemID(unsigned int id) const
371 {
372 mooseAssert(id < _extra_elem_ids.size(), "An invalid extra element integer id");
373 return _extra_elem_ids[id];
374 }
375
379 const dof_id_type & extraElemIDNeighbor(unsigned int id) const
380 {
381 mooseAssert(id < _neighbor_extra_elem_ids.size(), "An invalid extra element integer id");
382 return _neighbor_extra_elem_ids[id];
383 }
384
385 const MooseArray<ADPoint> & adNormals() const { return _ad_normals; }
386
388 {
389 _calculate_xyz = true;
390 return _ad_q_points;
391 }
392
394 {
395 _calculate_face_xyz = true;
396 return _ad_q_points_face;
397 }
398
399 template <bool is_ad>
401
406 const Elem * const & elem() const { return _current_elem; }
407
412
417
422
427
432 const Real & elemVolume() const { return _current_elem_volume; }
433
438 const unsigned int & side() const { return _current_side; }
439
444 const unsigned int & neighborSide() const { return _current_neighbor_side; }
445
450 const Elem * const & sideElem() const { return _current_side_elem; }
451
456 const Real & sideElemVolume() const { return _current_side_volume; }
457
462 const Elem * const & neighbor() const { return _current_neighbor_elem; }
463
468 const Elem * const & lowerDElem() const { return _current_lower_d_elem; }
469
474 const Elem * const & neighborLowerDElem() const { return _current_neighbor_lower_d_elem; }
475
476 /*
477 * @return The current lower-dimensional element volume
478 */
479 const Real & lowerDElemVolume() const;
480
481 /*
482 * @return The current neighbor lower-dimensional element volume
483 */
484 const Real & neighborLowerDElemVolume() const;
485
490
495
500 const Real & neighborVolume()
501 {
504 }
505
510 const libMesh::QBase * const & qRuleNeighbor() const
511 {
513 }
514
520
525 const MooseArray<Real> & JxWNeighbor() const;
526
532
537 const Node * const & node() const { return _current_node; }
538
543 const Node * const & nodeNeighbor() const { return _current_neighbor_node; }
544
553 void createQRules(QuadratureType type,
554 Order order,
555 Order volume_order,
556 Order face_order,
557 SubdomainID block,
558 bool allow_negative_qweights = true);
559
566 void bumpVolumeQRuleOrder(Order volume_order, SubdomainID block);
567
575 void bumpAllQRuleOrder(Order order, SubdomainID block);
576
585 void setVolumeQRule(libMesh::QBase * qrule, unsigned int dim);
586
595 void setFaceQRule(libMesh::QBase * qrule, unsigned int dim);
596
604 void setMortarQRule(Order order);
605
609 void activateDual() { _need_dual = true; }
610
615 bool needDual() const { return _need_dual; }
616
620 void clearCachedQRules();
621
622private:
629 void setLowerQRule(libMesh::QBase * qrule, unsigned int dim);
630
631public:
640 void setNeighborQRule(libMesh::QBase * qrule, unsigned int dim);
641
647 void reinit(const Elem * elem);
648
652 void setVolumeQRule(const Elem * elem);
653
658 void reinitElemFaceRef(const Elem * elem,
659 unsigned int elem_side,
660 Real tolerance,
661 const std::vector<Point> * const pts = nullptr,
662 const std::vector<Real> * const weights = nullptr);
663
668 void reinitNeighborFaceRef(const Elem * neighbor_elem,
669 unsigned int neighbor_side,
670 Real tolerance,
671 const std::vector<Point> * const pts,
672 const std::vector<Real> * const weights = nullptr);
673
677 void reinitDual(const Elem * elem, const std::vector<Point> & pts, const std::vector<Real> & JxW);
678
682 void reinitLowerDElem(const Elem * elem,
683 const std::vector<Point> * const pts = nullptr,
684 const std::vector<Real> * const weights = nullptr);
685
689 void reinitNeighborLowerDElem(const Elem * elem);
690
694 void reinitMortarElem(const Elem * elem);
695
699 const std::vector<Real> & jxWMortar() const { return *_JxW_msm; }
700
704 const libMesh::QBase * const & qRuleMortar() const { return constify_ref(_qrule_msm); }
705
706private:
710 void computeADFace(const Elem & elem, const unsigned int side);
711
712public:
716 void reinitAtPhysical(const Elem * elem, const std::vector<Point> & physical_points);
717
721 void reinit(const Elem * elem, const std::vector<Point> & reference_points);
722
726 void setFaceQRule(const Elem * const elem, const unsigned int side);
727
731 void reinit(const Elem * elem, unsigned int side);
732
736 void reinit(const Elem * elem, unsigned int side, const std::vector<Point> & reference_points);
737
738 void reinitFVFace(const FaceInfo & fi);
739
751 void reinitElemAndNeighbor(const Elem * elem,
752 unsigned int side,
753 const Elem * neighbor,
754 unsigned int neighbor_side,
755 const std::vector<Point> * neighbor_reference_points = nullptr);
756
760 void reinitNeighborAtPhysical(const Elem * neighbor,
761 unsigned int neighbor_side,
762 const std::vector<Point> & physical_points);
763
767 void reinitNeighborAtPhysical(const Elem * neighbor, const std::vector<Point> & physical_points);
768
772 void reinitNeighbor(const Elem * neighbor, const std::vector<Point> & reference_points);
773
777 void reinit(const Node * node);
778
783
786
789
791 void prepareResidual();
792
793 void prepare();
794 void prepareNonlocal();
795
803 void prepareNeighbor();
804
809 void prepareLowerD();
810
811 void prepareBlock(unsigned int ivar, unsigned jvar, const std::vector<dof_id_type> & dof_indices);
812 void prepareBlockNonlocal(unsigned int ivar,
813 unsigned jvar,
814 const std::vector<dof_id_type> & idof_indices,
815 const std::vector<dof_id_type> & jdof_indices);
816 void prepareScalar();
818
819 template <typename T>
821 void copyShapes(unsigned int var);
822
823 template <typename T>
825 void copyFaceShapes(unsigned int var);
826
827 template <typename T>
829 void copyNeighborShapes(unsigned int var);
830
837 {
838 // Blessed classes
839 friend class Assembly;
840 friend class SubProblem;
841 friend class FEProblemBase;
842 friend class DisplacedProblem;
847 };
848
855 {
856 // Blessed classes
857 friend class Assembly;
858 friend class TaggingInterface;
861 };
862
867 void addResidual(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
872 void addResidualNeighbor(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
877 void addResidualLower(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
878
883 void addResidualScalar(GlobalDataKey, const std::vector<VectorTag> & vector_tags);
884
889 void cacheResidual(GlobalDataKey, const std::vector<VectorTag> & tags);
890
895 void cacheResidualNeighbor(GlobalDataKey, const std::vector<VectorTag> & tags);
896
900 void cacheResidualLower(GlobalDataKey, const std::vector<VectorTag> & tags);
901
907 void addCachedResiduals(GlobalDataKey, const std::vector<VectorTag> & tags);
908
917 void clearCachedResiduals(GlobalDataKey);
918
926 void addCachedResidualDirectly(NumericVector<Number> & residual,
927 GlobalDataKey,
928 const VectorTag & vector_tag);
929
933 void setResidual(NumericVector<Number> & residual, GlobalDataKey, const VectorTag & vector_tag);
934
938 void setResidualNeighbor(NumericVector<Number> & residual,
939 GlobalDataKey,
940 const VectorTag & vector_tag);
941
945 void addJacobian(GlobalDataKey);
946
950 void addJacobianNonlocal(GlobalDataKey);
951
956 void addJacobianNeighbor(GlobalDataKey);
957
961 void addJacobianScalar(GlobalDataKey);
962
967 void addJacobianOffDiagScalar(unsigned int ivar, GlobalDataKey);
968
973 unsigned int ivar,
974 unsigned int jvar,
975 const libMesh::DofMap & dof_map,
976 std::vector<dof_id_type> & dof_indices,
978 TagID tag);
979
985 unsigned int ivar,
986 unsigned int jvar,
987 const libMesh::DofMap & dof_map,
988 std::vector<dof_id_type> & dof_indices,
990 const std::set<TagID> & tags);
991
996 unsigned int ivar,
997 unsigned int jvar,
998 const libMesh::DofMap & dof_map,
999 const std::vector<dof_id_type> & idof_indices,
1000 const std::vector<dof_id_type> & jdof_indices,
1002 TagID tag);
1003
1008 unsigned int ivar,
1009 unsigned int jvar,
1010 const libMesh::DofMap & dof_map,
1011 const std::vector<dof_id_type> & idof_indices,
1012 const std::vector<dof_id_type> & jdof_indices,
1014 const std::set<TagID> & tags);
1015
1025
1032
1042
1048 unsigned int ivar,
1049 unsigned int jvar,
1050 const libMesh::DofMap & dof_map,
1051 std::vector<dof_id_type> & dof_indices,
1052 std::vector<dof_id_type> & neighbor_dof_indices,
1054 TagID tag);
1055
1061 unsigned int ivar,
1062 unsigned int jvar,
1063 const libMesh::DofMap & dof_map,
1064 std::vector<dof_id_type> & dof_indices,
1065 std::vector<dof_id_type> & neighbor_dof_indices,
1067 const std::set<TagID> & tags);
1068
1073
1078
1084
1092
1097
1102
1107 DenseVector<Number> & residualBlock(unsigned int var_num, LocalDataKey, TagID tag_id)
1108 {
1109 return _sub_Re[tag_id][var_num];
1110 }
1111
1116 DenseVector<Number> & residualBlockNeighbor(unsigned int var_num, LocalDataKey, TagID tag_id)
1117 {
1118 return _sub_Rn[tag_id][var_num];
1119 }
1120
1125 DenseVector<Number> & residualBlockLower(unsigned int var_num, LocalDataKey, TagID tag_id)
1126 {
1127 return _sub_Rl[tag_id][var_num];
1128 }
1129
1134 DenseMatrix<Number> & jacobianBlock(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
1135 {
1136 jacobianBlockUsed(tag, ivar, jvar, true);
1137 return _sub_Kee[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
1138 }
1139
1144 DenseMatrix<Number> &
1145 jacobianBlockNonlocal(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
1146 {
1147 jacobianBlockNonlocalUsed(tag, ivar, jvar, true);
1148 return _sub_Keg[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
1149 }
1150
1155 DenseMatrix<Number> & jacobianBlockNeighbor(
1156 Moose::DGJacobianType type, unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag);
1157
1165 DenseMatrix<Number> & jacobianBlockMortar(Moose::ConstraintJacobianType type,
1166 unsigned int ivar,
1167 unsigned int jvar,
1168 LocalDataKey,
1169 TagID tag);
1170
1175 void cacheResidualNodes(const DenseVector<Number> & res,
1176 const std::vector<dof_id_type> & dof_index,
1177 LocalDataKey,
1178 TagID tag);
1179
1191 void
1192 cacheJacobian(numeric_index_type i, numeric_index_type j, Real value, LocalDataKey, TagID tag);
1193
1205 void cacheJacobian(numeric_index_type i,
1206 numeric_index_type j,
1207 Real value,
1208 LocalDataKey,
1209 const std::set<TagID> & tags);
1210
1218 void cacheJacobianBlock(const DenseMatrix<Number> & jac_block,
1219 const std::vector<dof_id_type> & idof_indices,
1220 const std::vector<dof_id_type> & jdof_indices,
1221 Real scaling_factor,
1222 LocalDataKey,
1223 const std::set<TagID> & tags);
1224
1234 template <typename Residuals, typename Indices>
1235 void cacheResiduals(const Residuals & residuals,
1236 const Indices & row_indices,
1237 Real scaling_factor,
1238 LocalDataKey,
1239 const std::set<TagID> & vector_tags);
1240
1248 template <typename Residuals, typename Indices>
1249 void cacheJacobian(const Residuals & residuals,
1250 const Indices & row_indices,
1251 Real scaling_factor,
1252 LocalDataKey,
1253 const std::set<TagID> & matrix_tags);
1254
1265 template <typename Residuals, typename Indices>
1266 void cacheResidualsWithoutConstraints(const Residuals & residuals,
1267 const Indices & row_indices,
1268 Real scaling_factor,
1269 LocalDataKey,
1270 const std::set<TagID> & vector_tags);
1271
1279 template <typename Residuals, typename Indices>
1280 void cacheJacobianWithoutConstraints(const Residuals & residuals,
1281 const Indices & row_indices,
1282 Real scaling_factor,
1283 LocalDataKey,
1284 const std::set<TagID> & matrix_tags);
1285
1286 std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> & couplingEntries()
1287 {
1288 return _cm_ff_entry;
1289 }
1290 const std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
1292 {
1293 return _cm_ff_entry;
1294 }
1295 std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> &
1297 {
1298 return _cm_nonlocal_entry;
1299 }
1300 const std::vector<std::pair<MooseVariableFieldBase *, MooseVariableScalar *>> &
1302 {
1303 return _cm_fs_entry;
1304 }
1305 const std::vector<std::pair<MooseVariableScalar *, MooseVariableFieldBase *>> &
1307 {
1308 return _cm_sf_entry;
1309 }
1310
1311 // Read-only references
1312 const VariablePhiValue & phi() const { return _phi; }
1313 template <typename T>
1315 {
1316 return _ad_grad_phi_data.at(v.feType());
1317 }
1318 const VariablePhiValue & phi(const MooseVariableField<Real> &) const { return _phi; }
1319 const VariablePhiGradient & gradPhi() const { return _grad_phi; }
1321 const VariablePhiSecond & secondPhi() const { return _second_phi; }
1323 {
1324 return _second_phi;
1325 }
1326
1327 const VariablePhiValue & phiFace() const { return _phi_face; }
1331 {
1332 return _grad_phi_face;
1333 }
1335 {
1336 return _second_phi_face;
1337 }
1338
1340 {
1341 return _phi_neighbor;
1342 }
1344 {
1345 return _grad_phi_neighbor;
1346 }
1351
1353 {
1354 return _phi_face_neighbor;
1355 }
1364
1366 {
1367 return _vector_phi;
1368 }
1385
1406
1430
1445 const VectorVariablePhiCurl &
1455
1456 // Writeable references
1460
1464
1474
1487
1488 // Writeable references with vector variable
1506
1527
1568
1569 // Writeable references with array variable
1573
1583
1596
1609
1610 template <typename OutputType>
1611 const typename OutputTools<OutputType>::VariablePhiValue & fePhi(FEType type) const
1612 {
1613 buildFE(type);
1614 return _fe_shape_data[type]->_phi;
1615 }
1616
1617 template <typename OutputType>
1619 {
1620 buildFE(type);
1621 return _fe_shape_data[type]->_grad_phi;
1622 }
1623
1624 template <typename OutputType>
1626 {
1627 return _ad_grad_phi_data[type];
1628 }
1629
1630 template <typename OutputType>
1632 {
1633 _need_second_derivative.insert(type);
1634 buildFE(type);
1635 return _fe_shape_data[type]->_second_phi;
1636 }
1637
1638 template <typename OutputType>
1639 const typename OutputTools<OutputType>::VariablePhiValue & fePhiLower(FEType type) const;
1640
1641 template <typename OutputType>
1642 const typename OutputTools<OutputType>::VariablePhiValue & feDualPhiLower(FEType type) const;
1643
1644 template <typename OutputType>
1645 const typename OutputTools<OutputType>::VariablePhiGradient & feGradPhiLower(FEType type) const;
1646
1647 template <typename OutputType>
1649 feGradDualPhiLower(FEType type) const;
1650
1651 template <typename OutputType>
1652 const typename OutputTools<OutputType>::VariablePhiValue & fePhiFace(FEType type) const
1653 {
1654 buildFaceFE(type);
1655 return _fe_shape_data_face[type]->_phi;
1656 }
1657
1658 template <typename OutputType>
1660 {
1661 buildFaceFE(type);
1662 return _fe_shape_data_face[type]->_grad_phi;
1663 }
1664
1665 template <typename OutputType>
1667 {
1668 return _ad_grad_phi_data_face[type];
1669 }
1670
1676
1677 template <typename OutputType>
1679 {
1680 _need_second_derivative.insert(type);
1681 buildFaceFE(type);
1682 return _fe_shape_data_face[type]->_second_phi;
1683 }
1684
1685 template <typename OutputType>
1687 {
1688 buildNeighborFE(type);
1689 return _fe_shape_data_neighbor[type]->_phi;
1690 }
1691
1692 template <typename OutputType>
1694 {
1695 buildNeighborFE(type);
1696 return _fe_shape_data_neighbor[type]->_grad_phi;
1697 }
1698
1699 template <typename OutputType>
1701 {
1703 buildNeighborFE(type);
1704 return _fe_shape_data_neighbor[type]->_second_phi;
1705 }
1706
1707 template <typename OutputType>
1709 {
1710 buildFaceNeighborFE(type);
1711 return _fe_shape_data_face_neighbor[type]->_phi;
1712 }
1713
1714 template <typename OutputType>
1716 feGradPhiFaceNeighbor(FEType type) const
1717 {
1718 buildFaceNeighborFE(type);
1719 return _fe_shape_data_face_neighbor[type]->_grad_phi;
1720 }
1721
1722 template <typename OutputType>
1724 feSecondPhiFaceNeighbor(FEType type) const
1725 {
1727 buildFaceNeighborFE(type);
1728 return _fe_shape_data_face_neighbor[type]->_second_phi;
1729 }
1730
1731 template <typename OutputType>
1732 const typename OutputTools<OutputType>::VariablePhiCurl & feCurlPhi(FEType type) const
1733 {
1734 _need_curl.insert(type);
1735 buildFE(type);
1736 return _fe_shape_data[type]->_curl_phi;
1737 }
1738
1739 template <typename OutputType>
1741 {
1742 _need_curl.insert(type);
1743 buildFaceFE(type);
1744 return _fe_shape_data_face[type]->_curl_phi;
1745 }
1746
1747 template <typename OutputType>
1749 {
1750 _need_curl.insert(type);
1751 buildNeighborFE(type);
1752 return _fe_shape_data_neighbor[type]->_curl_phi;
1753 }
1754
1755 template <typename OutputType>
1757 {
1758 _need_curl.insert(type);
1759 buildFaceNeighborFE(type);
1760 return _fe_shape_data_face_neighbor[type]->_curl_phi;
1761 }
1762
1763 template <typename OutputType>
1765 {
1766 buildFE(type);
1767 return _fe_shape_data[type]->_div_phi;
1768 }
1769
1770 template <typename OutputType>
1772 {
1773 buildFaceFE(type);
1774 return _fe_shape_data_face[type]->_div_phi;
1775 }
1776
1777 template <typename OutputType>
1779 feDivPhiNeighbor(FEType type) const
1780 {
1781 buildNeighborFE(type);
1782 return _fe_shape_data_neighbor[type]->_div_phi;
1783 }
1784
1785 template <typename OutputType>
1787 feDivPhiFaceNeighbor(FEType type) const
1788 {
1789 buildFaceNeighborFE(type);
1790 return _fe_shape_data_face_neighbor[type]->_div_phi;
1791 }
1792
1794 Real elementVolume(const Elem * elem) const;
1795
1799 void setXFEM(std::shared_ptr<XFEMInterface> xfem) { _xfem = xfem; }
1800
1805 std::vector<std::pair<unsigned int, unsigned short>> && disp_numbers_and_directions);
1806
1815 void saveLocalArrayResidual(DenseVector<Number> & re,
1816 unsigned int i,
1817 unsigned int ntest,
1818 const RealEigenVector & v) const
1819 {
1820 for (unsigned int j = 0; j < v.size(); ++j, i += ntest)
1821 re(i) += v(j);
1822 }
1823
1824 void saveLocalADArray(std::vector<ADReal> & re,
1825 unsigned int i,
1826 unsigned int ntest,
1827 const ADRealEigenVector & v) const;
1828
1839 void saveDiagLocalArrayJacobian(DenseMatrix<Number> & ke,
1840 unsigned int i,
1841 unsigned int ntest,
1842 unsigned int j,
1843 unsigned int nphi,
1844 unsigned int ivar,
1845 const RealEigenVector & v) const
1846 {
1847 unsigned int pace = (_component_block_diagonal[ivar] ? 0 : nphi);
1848 for (unsigned int k = 0; k < v.size(); ++k, i += ntest, j += pace)
1849 ke(i, j) += v(k);
1850 }
1851
1864 void saveFullLocalArrayJacobian(DenseMatrix<Number> & ke,
1865 unsigned int i,
1866 unsigned int ntest,
1867 unsigned int j,
1868 unsigned int nphi,
1869 unsigned int ivar,
1870 unsigned int jvar,
1871 const RealEigenMatrix & v) const
1872 {
1873 if (ivar == jvar && _component_block_diagonal[ivar])
1874 {
1875 for (unsigned int k = 0; k < v.rows(); ++k, i += ntest)
1876 ke(i, j) += v(k, k);
1877 }
1878 else
1879 {
1880 const unsigned int saved_j = j;
1881 for (unsigned int k = 0; k < v.rows(); ++k, i += ntest)
1882 {
1883 j = saved_j;
1884 for (unsigned int l = 0; l < v.cols(); ++l, j += nphi)
1885 ke(i, j) += v(k, l);
1886 }
1887 }
1888 }
1889
1890 DenseVector<Real> getJacobianDiagonal(const DenseMatrix<Number> & ke)
1891 {
1892 unsigned int rows = ke.m();
1893 unsigned int cols = ke.n();
1894 DenseVector<Real> diag(rows);
1895 for (unsigned int i = 0; i < rows; i++)
1896 // % operation is needed to account for cases of no component coupling of array variables
1897 diag(i) = ke(i, i % cols);
1898 return diag;
1899 }
1900
1906 inline const libMesh::QBase * attachQRuleElem(unsigned int dim, FEBase & fe)
1907 {
1908 auto qrule = qrules(dim).vol.get();
1909 fe.attach_quadrature_rule(qrule);
1910 return qrule;
1911 }
1912
1918 inline const libMesh::QBase * attachQRuleFace(unsigned int dim, FEBase & fe)
1919 {
1920 auto qrule = qrules(dim).face.get();
1921 fe.attach_quadrature_rule(qrule);
1922 return qrule;
1923 }
1924
1933 void modifyArbitraryWeights(const std::vector<Real> & weights);
1934
1939
1944
1949
1953 const Elem * const & msmElem() const { return _msm_elem; }
1954
1959 void preparePRefinement();
1960
1964 void setCurrentLowerDElem(const Elem * const lower_d_elem);
1965
1966private:
1972 void reinitFE(const Elem * elem);
1973
1980 void reinitFEFace(const Elem * elem, unsigned int side);
1981
1982 void computeFaceMap(const Elem & elem, const unsigned int side, const std::vector<Real> & qw);
1983
1984 void reinitFEFaceNeighbor(const Elem * neighbor, const std::vector<Point> & reference_points);
1985
1986 void reinitFENeighbor(const Elem * neighbor, const std::vector<Point> & reference_points);
1987
1988 template <typename Points, typename Coords>
1990 const Points & q_points,
1991 Coords & coord,
1992 SubdomainID sub_id);
1993
1995
1997
1999
2005 void modifyWeightsDueToXFEM(const Elem * elem);
2006
2013 void modifyFaceWeightsDueToXFEM(const Elem * elem, unsigned int side = 0);
2014
2019 template <typename OutputType>
2020 void computeGradPhiAD(const Elem * elem,
2021 unsigned int n_qp,
2024
2028 void resizeADMappingObjects(unsigned int n_qp, unsigned int dim);
2029
2034 void
2035 computeSinglePointMapAD(const Elem * elem, const std::vector<Real> & qw, unsigned p, FEBase * fe);
2036
2040 void addResidual(const VectorTag & vector_tag);
2044 void addResidualNeighbor(const VectorTag & vector_tag);
2049 void addResidualLower(const VectorTag & vector_tag);
2053 void addResidualScalar(const VectorTag & vector_tag);
2054
2058 void clearCachedResiduals(const VectorTag & vector_tag);
2059
2068 void cacheResidual(dof_id_type dof, Real value, TagID tag_id);
2069
2078 void cacheResidual(dof_id_type dof, Real value, const std::set<TagID> & tags);
2079
2084 void processLocalResidual(DenseVector<Number> & res_block,
2085 std::vector<dof_id_type> & dof_indices,
2086 const std::vector<Real> & scaling_factor);
2087
2091 void addResidualBlock(NumericVector<Number> & residual,
2092 DenseVector<Number> & res_block,
2093 const std::vector<dof_id_type> & dof_indices,
2094 const std::vector<Real> & scaling_factor);
2095
2099 void cacheResidualBlock(std::vector<Real> & cached_residual_values,
2100 std::vector<dof_id_type> & cached_residual_rows,
2101 DenseVector<Number> & res_block,
2102 const std::vector<dof_id_type> & dof_indices,
2103 const std::vector<Real> & scaling_factor);
2104
2108 void setResidualBlock(NumericVector<Number> & residual,
2109 DenseVector<Number> & res_block,
2110 const std::vector<dof_id_type> & dof_indices,
2111 const std::vector<Real> & scaling_factor);
2112
2117 DenseMatrix<Number> & jac_block,
2118 const MooseVariableBase & ivar,
2119 const MooseVariableBase & jvar,
2120 const std::vector<dof_id_type> & idof_indices,
2121 const std::vector<dof_id_type> & jdof_indices);
2122
2126 void cacheJacobianBlock(const DenseMatrix<Number> & jac_block,
2127 const MooseVariableBase & ivar,
2128 const MooseVariableBase & jvar,
2129 const std::vector<dof_id_type> & idof_indices,
2130 const std::vector<dof_id_type> & jdof_indices,
2131 TagID tag);
2132
2136 void cacheJacobianBlockNonzero(const DenseMatrix<Number> & jac_block,
2137 const MooseVariableBase & ivar,
2138 const MooseVariableBase & jvar,
2139 const std::vector<dof_id_type> & idof_indices,
2140 const std::vector<dof_id_type> & jdof_indices,
2141 TagID tag);
2142
2146 void addJacobianCoupledVarPair(const MooseVariableBase & ivar, const MooseVariableBase & jvar);
2147
2151 void cacheJacobianCoupledVarPair(const MooseVariableBase & ivar, const MooseVariableBase & jvar);
2152
2158 void clearCachedJacobian();
2159
2164 void buildFE(FEType type) const;
2165
2170 void buildFaceFE(FEType type) const;
2171
2176 void buildNeighborFE(FEType type) const;
2177
2182 void buildFaceNeighborFE(FEType type) const;
2183
2188 void buildLowerDFE(FEType type) const;
2189
2190 void buildLowerDDualFE(FEType type) const;
2191
2196 void buildVectorFE(FEType type) const;
2197
2202 void buildVectorFaceFE(FEType type) const;
2203
2208 void buildVectorNeighborFE(FEType type) const;
2209
2214 void buildVectorFaceNeighborFE(FEType type) const;
2215
2220 void buildVectorLowerDFE(FEType type) const;
2221 void buildVectorDualLowerDFE(FEType type) const;
2222
2227 void jacobianBlockUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2228 {
2229 _jacobian_block_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2230 }
2231
2236 char jacobianBlockUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2237 {
2238 return _jacobian_block_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2239 }
2240
2245 void jacobianBlockNeighborUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2246 {
2247 _jacobian_block_neighbor_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2248 }
2249
2254 char jacobianBlockNeighborUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2255 {
2256 return _jacobian_block_neighbor_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2257 }
2258
2263 void jacobianBlockLowerUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2264 {
2265 _jacobian_block_lower_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2266 }
2267
2272 char jacobianBlockLowerUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2273 {
2274 return _jacobian_block_lower_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2275 }
2276
2281 void jacobianBlockNonlocalUsed(TagID tag, unsigned int ivar, unsigned int jvar, bool used)
2282 {
2283 _jacobian_block_nonlocal_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar] = used;
2284 }
2285
2290 char jacobianBlockNonlocalUsed(TagID tag, unsigned int ivar, unsigned int jvar) const
2291 {
2292 return _jacobian_block_nonlocal_used[tag][ivar][_block_diagonal_matrix ? 0 : jvar];
2293 }
2294
2298 void helpersRequestData();
2299
2302
2303 const bool _displaced;
2304
2308
2311
2314
2317
2319 std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> _cm_ff_entry;
2321 std::vector<std::pair<MooseVariableFieldBase *, MooseVariableScalar *>> _cm_fs_entry;
2323 std::vector<std::pair<MooseVariableScalar *, MooseVariableFieldBase *>> _cm_sf_entry;
2325 std::vector<std::pair<MooseVariableScalar *, MooseVariableScalar *>> _cm_ss_entry;
2327 std::vector<std::pair<MooseVariableFieldBase *, MooseVariableFieldBase *>> _cm_nonlocal_entry;
2329 std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_used;
2330 std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_nonlocal_used;
2332 std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_neighbor_used;
2334 std::vector<std::vector<std::vector<unsigned char>>> _jacobian_block_lower_used;
2339
2341
2342 unsigned int _mesh_dimension;
2343
2346 const FEType _helper_type;
2347
2354
2357 std::vector<std::unique_ptr<FEBase>> _unique_fe_helper;
2358 std::vector<std::unique_ptr<FEBase>> _unique_fe_face_helper;
2359 std::vector<std::unique_ptr<FEBase>> _unique_fe_face_neighbor_helper;
2360 std::vector<std::unique_ptr<FEBase>> _unique_fe_neighbor_helper;
2361 std::vector<std::unique_ptr<FEBase>> _unique_fe_lower_helper;
2362
2365
2367 std::shared_ptr<XFEMInterface> _xfem;
2368
2370 std::map<FEType, FEBase *> _current_fe;
2372 std::map<FEType, FEBase *> _current_fe_face;
2374 std::map<FEType, FEBase *> _current_fe_neighbor;
2376 std::map<FEType, FEBase *> _current_fe_face_neighbor;
2377
2379 std::map<FEType, FEVectorBase *> _current_vector_fe;
2381 std::map<FEType, FEVectorBase *> _current_vector_fe_face;
2383 std::map<FEType, FEVectorBase *> _current_vector_fe_neighbor;
2385 std::map<FEType, FEVectorBase *> _current_vector_fe_face_neighbor;
2386
2387 /**** Volume Stuff ****/
2388
2390 mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe;
2392 mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe;
2394 std::map<unsigned int, FEBase *> _holder_fe_helper;
2415
2418 struct QRules
2419 {
2421 : vol(nullptr),
2422 face(nullptr),
2423 arbitrary_vol(nullptr),
2424 arbitrary_face(nullptr),
2425 neighbor(nullptr)
2426 {
2427 }
2428
2430 std::unique_ptr<libMesh::QBase> vol;
2432 std::unique_ptr<libMesh::QBase> face;
2434 std::unique_ptr<libMesh::QBase> fv_face;
2436 std::unique_ptr<ArbitraryQuadrature> arbitrary_vol;
2438 std::unique_ptr<ArbitraryQuadrature> arbitrary_face;
2440 std::unique_ptr<ArbitraryQuadrature> neighbor;
2441 };
2442
2447 std::unordered_map<SubdomainID, std::vector<QRules>> _qrules;
2448
2455 libMesh::QBase * qruleFace(const Elem * elem, unsigned int side);
2456 ArbitraryQuadrature * qruleArbitraryFace(const Elem * elem, unsigned int side);
2457
2458 template <typename T>
2459 T * qruleFaceHelper(const Elem * elem, unsigned int side, std::function<T *(QRules &)> rule_fn)
2460 {
2461 auto dim = elem->dim();
2462 auto neighbor = elem->neighbor_ptr(side);
2463 auto q = rule_fn(qrules(dim, elem->subdomain_id()));
2464 if (!neighbor)
2465 return q;
2466
2467 // find the maximum face quadrature order for all blocks the face is in
2468 auto neighbor_block = neighbor->subdomain_id();
2469 if (neighbor_block == elem->subdomain_id())
2470 return q;
2471
2472 auto q_neighbor = rule_fn(qrules(dim, neighbor_block));
2473 if (q->get_order() > q_neighbor->get_order())
2474 return q;
2475 return q_neighbor;
2476 }
2477
2478 inline QRules & qrules(unsigned int dim) { return qrules(dim, _current_subdomain_id); }
2479
2483 inline QRules & qrules(unsigned int dim, SubdomainID block)
2484 {
2485 if (_qrules.find(block) == _qrules.end())
2486 {
2487 mooseAssert(_qrules.find(Moose::ANY_BLOCK_ID) != _qrules.end(),
2488 "missing quadrature rules for specified block");
2489 mooseAssert(_qrules[Moose::ANY_BLOCK_ID].size() > dim,
2490 "quadrature rules not sized property for dimension");
2492 }
2493 mooseAssert(_qrules.find(block) != _qrules.end(),
2494 "missing quadrature rules for specified block");
2495 mooseAssert(_qrules[block].size() > dim, "quadrature rules not sized property for dimension");
2496 return _qrules[block][dim];
2497 }
2498
2499 /**** Face Stuff ****/
2500
2502 mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_face;
2504 mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_face;
2506 std::map<unsigned int, FEBase *> _holder_fe_face_helper;
2520 std::vector<Eigen::Map<RealDIMValue>> _mapped_normals;
2523
2525 std::vector<dof_id_type> _extra_elem_ids;
2527 std::vector<dof_id_type> _neighbor_extra_elem_ids;
2529 std::map<unsigned int, const std::vector<Point> *> _holder_normals;
2530
2531 /**** Neighbor Stuff ****/
2532
2534 mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_neighbor;
2535 mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_face_neighbor;
2536 mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_neighbor;
2537 mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_face_neighbor;
2538
2540 std::map<unsigned int, FEBase *> _holder_fe_neighbor_helper;
2541 std::map<unsigned int, FEBase *> _holder_fe_face_neighbor_helper;
2542
2544 mutable std::map<unsigned int, std::map<FEType, FEBase *>> _fe_lower;
2546 mutable std::map<unsigned int, std::map<FEType, FEVectorBase *>> _vector_fe_lower;
2548 std::map<unsigned int, FEBase *> _holder_fe_lower_helper;
2549
2563
2564 /********** mortar stuff *************/
2565
2567 const std::vector<Real> * _JxW_msm;
2569 std::unique_ptr<FEBase> _fe_msm;
2577
2581
2582protected:
2584 const Elem * _current_elem;
2592 unsigned int _current_side;
2610 const Node * _current_node;
2617
2632
2635
2636 /*
2637 * Residual contributions <tag_index, ivar>
2638 *
2639 * tag_index is the index into _residual_vector_tags, that is, _sub_Re[0] corresponds to the tag
2640 * with TagID _residual_vector_tags[0]._id
2641 *
2642 * When ivar corresponds to an array variable, the dense vector is in size of ndof * count,
2643 * where count is the number of components of the array variable. The local residual is ordered
2644 * as (r_i,j, i = 1,...,ndof; j = 1,...,count).
2645 *
2646 * Dense vectors for variables (ivar+i, i = 1,...,count) are empty.
2647 */
2648 std::vector<std::vector<DenseVector<Number>>> _sub_Re;
2649 std::vector<std::vector<DenseVector<Number>>> _sub_Rn;
2651 std::vector<std::vector<DenseVector<Number>>> _sub_Rl;
2652
2654 DenseVector<Number> _tmp_Re;
2655
2656 /*
2657 * Jacobian contributions <Tag, ivar, jvar>
2658 * When ivar corresponds to an array variable, the number of rows of the dense matrix is in size
2659 * of indof * icount, where icount is the number of components of ivar. When jvar corresponds to
2660 * an array variable, the number of columns of the dense matrix is in size of jndof * jcount,
2661 * where jcount is the number of components of jvar. The local residual is ordered as
2662 * (K_(i,j,k,l), k=1,...,jndof; l = 1,...,jcout; i = 1,...,indof; j = 1,...,icount).
2663 *
2664 * Dense matrices for variables (ivar+i, i = 1,...,icount) or (jvar+j, j = 1,...,jcount) are
2665 * empty.
2666 */
2667 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kee;
2668 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Keg;
2669
2671 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Ken;
2673 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kne;
2675 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Knn;
2677 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kll;
2679 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kle;
2681 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kln;
2683 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Kel;
2685 std::vector<std::vector<std::vector<DenseMatrix<Number>>>> _sub_Knl;
2686
2688 DenseMatrix<Number> _tmp_Ke;
2689
2690 // Shape function values, gradients. second derivatives
2694
2698
2702
2706
2707 // Shape function values, gradients, second derivatives
2713
2719
2725
2731
2741
2751
2753 mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data;
2754 mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_face;
2755 mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_neighbor;
2756 mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_face_neighbor;
2757 mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_lower;
2758 mutable std::map<FEType, std::unique_ptr<FEShapeData>> _fe_shape_data_dual_lower;
2759
2761 mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data;
2762 mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_face;
2763 mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_neighbor;
2764 mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_face_neighbor;
2765 mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_lower;
2766 mutable std::map<FEType, std::unique_ptr<VectorFEShapeData>> _vector_fe_shape_data_dual_lower;
2767
2768 mutable std::map<FEType, ADTemplateVariablePhiGradient<Real>> _ad_grad_phi_data;
2769 mutable std::map<FEType, ADTemplateVariablePhiGradient<RealVectorValue>> _ad_vector_grad_phi_data;
2770 mutable std::map<FEType, ADTemplateVariablePhiGradient<Real>> _ad_grad_phi_data_face;
2771 mutable std::map<FEType, ADTemplateVariablePhiGradient<RealVectorValue>>
2776 mutable bool _need_ad_grad_phi_face = false;
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
2871
2872 const Elem * _msm_elem = nullptr;
2873
2877 DenseVector<Number> _element_vector;
2878
2882 DenseMatrix<Number> _element_matrix;
2883
2887 std::vector<dof_id_type> _row_indices, _column_indices;
2888
2891
2894};
2895
2896template <typename OutputType>
2898Assembly::fePhiLower(FEType type) const
2899{
2900 buildLowerDFE(type);
2901 return _fe_shape_data_lower[type]->_phi;
2902}
2903
2904template <typename OutputType>
2907{
2908 buildLowerDDualFE(type);
2909 return _fe_shape_data_dual_lower[type]->_phi;
2910}
2911
2912template <typename OutputType>
2915{
2916 buildLowerDFE(type);
2917 return _fe_shape_data_lower[type]->_grad_phi;
2918}
2919
2920template <typename OutputType>
2923{
2924 buildLowerDDualFE(type);
2925 return _fe_shape_data_dual_lower[type]->_grad_phi;
2926}
2927
2928template <>
2930Assembly::feADGradPhi<RealVectorValue>(FEType type) const
2931{
2932 return _ad_vector_grad_phi_data[type];
2933}
2934
2935template <>
2937Assembly::feADGradPhiFace<RealVectorValue>(FEType type) const
2938{
2939 return _ad_vector_grad_phi_data_face[type];
2940}
2941
2942template <>
2944Assembly::fePhi<VectorValue<Real>>(FEType type) const;
2945
2946template <>
2948Assembly::feGradPhi<VectorValue<Real>>(FEType type) const;
2949
2950template <>
2952Assembly::feSecondPhi<VectorValue<Real>>(FEType type) const;
2953
2954template <>
2956Assembly::fePhiLower<VectorValue<Real>>(FEType type) const;
2957
2958template <>
2960Assembly::feDualPhiLower<VectorValue<Real>>(FEType type) const;
2961
2962template <>
2964Assembly::feGradPhiLower<VectorValue<Real>>(FEType type) const;
2965
2966template <>
2968Assembly::feGradDualPhiLower<VectorValue<Real>>(FEType type) const;
2969
2970template <>
2972Assembly::fePhiFace<VectorValue<Real>>(FEType type) const;
2973
2974template <>
2976Assembly::feGradPhiFace<VectorValue<Real>>(FEType type) const;
2977
2978template <>
2980Assembly::feSecondPhiFace<VectorValue<Real>>(FEType type) const;
2981
2982template <>
2984Assembly::fePhiNeighbor<VectorValue<Real>>(FEType type) const;
2985
2986template <>
2988Assembly::feGradPhiNeighbor<VectorValue<Real>>(FEType type) const;
2989
2990template <>
2992Assembly::feSecondPhiNeighbor<VectorValue<Real>>(FEType type) const;
2993
2994template <>
2996Assembly::fePhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
2997
2998template <>
3000Assembly::feGradPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3001
3002template <>
3004Assembly::feSecondPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3005
3006template <>
3008Assembly::feCurlPhi<VectorValue<Real>>(FEType type) const;
3009
3010template <>
3012Assembly::feCurlPhiFace<VectorValue<Real>>(FEType type) const;
3013
3014template <>
3016Assembly::feCurlPhiNeighbor<VectorValue<Real>>(FEType type) const;
3017
3018template <>
3020Assembly::feCurlPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3021
3022template <>
3024Assembly::feDivPhi<VectorValue<Real>>(FEType type) const;
3025
3026template <>
3028Assembly::feDivPhiFace<VectorValue<Real>>(FEType type) const;
3029
3030template <>
3032Assembly::feDivPhiNeighbor<VectorValue<Real>>(FEType type) const;
3033
3034template <>
3036Assembly::feDivPhiFaceNeighbor<VectorValue<Real>>(FEType type) const;
3037
3038template <>
3040Assembly::adGradPhi<RealVectorValue>(const MooseVariableFE<RealVectorValue> & v) const
3041{
3042 return _ad_vector_grad_phi_data.at(v.feType());
3043}
3044
3045template <typename Residuals, typename Indices>
3046void
3047Assembly::cacheResiduals(const Residuals & residuals,
3048 const Indices & input_row_indices,
3049 const Real scaling_factor,
3051 const std::set<TagID> & vector_tags)
3052{
3053 mooseAssert(residuals.size() == input_row_indices.size(),
3054 "The number of residuals should match the number of dof indices");
3055 mooseAssert(residuals.size() >= 1, "Why you calling me with no residuals?");
3056
3057 if (!computingResidual() || vector_tags.empty())
3058 return;
3059
3060 // A single row needs no constraining unless its dof is constrained (e.g. by a periodic boundary,
3061 // a hanging node, or a user constraint), in which case its residual must be distributed to the
3062 // constraining dofs
3063 if (residuals.size() == 1 && !_dof_map.is_constrained_dof(input_row_indices[0]))
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 // A single row needs no constraining unless its dof or one of its column dofs is constrained, in
3118 // which case its entries must be distributed to the constraining rows and columns
3119 const auto & single_row_dofs = residuals[0].derivatives().nude_indices();
3120 if (residuals.size() == 1 && !_dof_map.is_constrained_dof(input_row_indices[0]) &&
3121 std::none_of(single_row_dofs.begin(),
3122 single_row_dofs.end(),
3123 [this](const auto dof) { return _dof_map.is_constrained_dof(dof); }))
3124 {
3125 // No constraining is required. (This is likely a finite volume computation if we only have a
3126 // single dof)
3128 residuals, input_row_indices, scaling_factor, LocalDataKey{}, matrix_tags);
3129 return;
3130 }
3131
3132 const auto & compare_dofs = residuals[0].derivatives().nude_indices();
3133#ifndef NDEBUG
3134 auto compare_dofs_set = std::set<dof_id_type>(compare_dofs.begin(), compare_dofs.end());
3135
3136 for (const auto i : make_range(decltype(residuals.size())(1), residuals.size()))
3137 {
3138 const auto & residual = residuals[i];
3139 auto current_dofs_set = std::set<dof_id_type>(residual.derivatives().nude_indices().begin(),
3140 residual.derivatives().nude_indices().end());
3141 mooseAssert(compare_dofs_set == current_dofs_set,
3142 "We're going to see whether the dof sets are the same. IIRC the degree of freedom "
3143 "dependence (as indicated by the dof index set held by the ADReal) has to be the "
3144 "same for every residual passed to this method otherwise constrain_element_matrix "
3145 "will not work.");
3146 }
3147#endif
3148 _column_indices.assign(compare_dofs.begin(), compare_dofs.end());
3149
3150 // If there's no derivatives then there is nothing to do. Moreover, if we pass zero size column
3151 // indices to constrain_element_matrix then we will potentially get errors out of BLAS
3152 if (!_column_indices.size())
3153 return;
3154
3155 // Need to make a copy because we might modify this in constrain_element_matrix
3156 _row_indices.assign(input_row_indices.begin(), input_row_indices.end());
3157
3159 for (const auto i : index_range(_row_indices))
3160 {
3161 const auto & sparse_derivatives = residuals[i].derivatives();
3162
3163 for (const auto j : index_range(_column_indices))
3164 _element_matrix(i, j) = sparse_derivatives[_column_indices[j]] * scaling_factor;
3165 }
3166
3168
3169 for (const auto i : index_range(_row_indices))
3170 for (const auto j : index_range(_column_indices))
3171 cacheJacobian(_row_indices[i], _column_indices[j], _element_matrix(i, j), {}, matrix_tags);
3172}
3173
3174template <typename Residuals, typename Indices>
3175void
3177 const Indices & row_indices,
3178 const Real scaling_factor,
3180 const std::set<TagID> & matrix_tags)
3181{
3182 mooseAssert(residuals.size() == row_indices.size(),
3183 "The number of residuals should match the number of dof indices");
3184 mooseAssert(residuals.size() >= 1, "Why you calling me with no residuals?");
3185
3186 if (!computingJacobian() || matrix_tags.empty())
3187 return;
3188
3189 for (const auto i : index_range(row_indices))
3190 {
3191 const auto row_index = row_indices[i];
3192
3193 const auto & sparse_derivatives = residuals[i].derivatives();
3194 const auto & column_indices = sparse_derivatives.nude_indices();
3195 const auto & raw_derivatives = sparse_derivatives.nude_data();
3196
3197 for (std::size_t j = 0; j < column_indices.size(); ++j)
3199 row_index, column_indices[j], raw_derivatives[j] * scaling_factor, {}, matrix_tags);
3200 }
3201}
3202
3203inline const Real &
3209
3210inline const Real &
3216
3217inline void
3219 std::vector<std::pair<unsigned int, unsigned short>> && disp_numbers_and_directions)
3220{
3221 _disp_numbers_and_directions = std::move(disp_numbers_and_directions);
3222}
3223
3224inline void
3225Assembly::setCurrentLowerDElem(const Elem * const lower_d_elem)
3226{
3227 _current_lower_d_elem = lower_d_elem;
3228}
MooseVariableFE< Real > MooseVariable
Definition Assembly.h:61
MooseVariableFE< RealEigenVector > ArrayMooseVariable
Definition Assembly.h:63
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:62
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:2738
VariablePhiValue _phi
Definition Assembly.h:2735
VariablePhiGradient _grad_phi
Definition Assembly.h:2736
VariablePhiSecond _second_phi
Definition Assembly.h:2737
VariablePhiDivergence _div_phi
Definition Assembly.h:2739
Key structure for APIs manipulating global vectors/matrices.
Definition Assembly.h:837
GlobalDataKey(const GlobalDataKey &)
Definition Assembly.h:846
Key structure for APIs adding/caching local element residuals/Jacobians.
Definition Assembly.h:855
LocalDataKey(const LocalDataKey &)
Definition Assembly.h:860
VectorVariablePhiValue _phi
Definition Assembly.h:2745
VectorVariablePhiGradient _grad_phi
Definition Assembly.h:2746
VectorVariablePhiSecond _second_phi
Definition Assembly.h:2747
VectorVariablePhiCurl _curl_phi
Definition Assembly.h:2748
VectorVariablePhiDivergence _div_phi
Definition Assembly.h:2749
Keeps track of stuff related to assembling.
Definition Assembly.h:102
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:1145
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kll
dlower/dlower
Definition Assembly.h:2677
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:4127
const VectorVariablePhiValue & phiFace(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1386
SystemBase & _sys
Definition Assembly.h:2300
std::map< unsigned int, FEBase * > _holder_fe_lower_helper
helper object for transforming coordinates for lower dimensional element quadrature points
Definition Assembly.h:2548
const VariablePhiSecond & secondPhiNeighbor(const MooseVariableField< Real > &) const
Definition Assembly.h:1347
std::vector< std::pair< MooseVariableScalar *, MooseVariableFieldBase * > > _cm_sf_entry
Entries in the coupling matrix for scalar variables vs field variables.
Definition Assembly.h:2323
void addJacobian(GlobalDataKey)
Adds all local Jacobian to the global Jacobian matrices.
Definition Assembly.C:3909
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:2263
const Real & neighborLowerDElemVolume() const
Definition Assembly.h:3211
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:1864
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:3436
void assignDisplacements(std::vector< std::pair< unsigned int, unsigned short > > &&disp_numbers_and_directions)
Assign the displacement numbers and directions.
Definition Assembly.h:3218
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:136
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:2761
const bool & _computing_jacobian
Whether we are currently computing the Jacobian.
Definition Assembly.h:2313
MooseArray< Point > _current_q_points
The current list of quadrature points.
Definition Assembly.h:2406
VariablePhiGradient & gradPhiFace(const MooseVariableField< Real > &)
Definition Assembly.h:1462
const std::vector< Real > * _JxW_msm
A JxW for working on mortar segement elements.
Definition Assembly.h:2567
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kee
Definition Assembly.h:2667
std::set< FEType > _need_face_neighbor_div
Definition Assembly.h:2863
VectorVariablePhiCurl & curlPhiFace(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1519
void prepareLowerD()
Prepare the Jacobians and residuals for a lower dimensional element.
Definition Assembly.C:2902
void modifyWeightsDueToXFEM(const Elem *elem)
Update the integration weights for XFEM partial elements.
Definition Assembly.C:4569
VectorVariablePhiDivergence & divPhi(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1502
void reinitFVFace(const FaceInfo &fi)
Definition Assembly.C:1896
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiFace(FEType type) const
Definition Assembly.h:1659
VectorVariablePhiValue & phiFace(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1507
std::vector< std::vector< DenseVector< Number > > > _sub_Re
Definition Assembly.h:2648
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:3494
void reinitFE(const Elem *elem)
Just an internal helper function to reinit the volume FE objects.
Definition Assembly.C:797
DenseMatrix< Number > _element_matrix
A working matrix to avoid repeated heap allocations when caching Jacobians that must have libMesh-lev...
Definition Assembly.h:2882
VectorVariablePhiValue _vector_phi_face_neighbor
Definition Assembly.h:2726
const VariablePhiValue & phiFace() const
Definition Assembly.h:1327
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & nonlocalCouplingEntries()
Definition Assembly.h:1296
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:654
VariablePhiSecond & secondPhiNeighbor(const MooseVariableField< Real > &)
Definition Assembly.h:1470
MooseArray< Real > _curvatures
Definition Assembly.h:2841
std::vector< std::unique_ptr< FEBase > > _unique_fe_lower_helper
Definition Assembly.h:2361
MooseArray< Real > _coord_neighbor
The current coordinate transformation coefficients.
Definition Assembly.h:2559
const OutputTools< OutputType >::VariablePhiValue & fePhiFaceNeighbor(FEType type) const
Definition Assembly.h:1708
VariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< Real > &)
Definition Assembly.h:1479
const bool _displaced
Definition Assembly.h:2303
void reinitFEFaceNeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
Definition Assembly.C:1612
void reinitFENeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
Definition Assembly.C:1671
VectorVariablePhiDivergence & divPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1544
void prepareVariableNonlocal(MooseVariableFieldBase *var)
Definition Assembly.C:2834
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhi(FEType type) const
Definition Assembly.h:1764
void prepareBlock(unsigned int ivar, unsigned jvar, const std::vector< dof_id_type > &dof_indices)
Definition Assembly.C:2954
VectorVariablePhiValue & phiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1548
std::vector< ADReal > _ad_dzetady_map
Definition Assembly.h:2835
VariablePhiGradient _grad_phi
Definition Assembly.h:2692
libMesh::QBase * _current_qrule_face
quadrature rule used on faces
Definition Assembly.h:2510
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhiNeighbor(FEType type) const
Definition Assembly.h:1779
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:187
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:2332
bool _need_ad_grad_phi_face
Whether any object needs the AD face shape function gradients.
Definition Assembly.h:2776
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:2227
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:3273
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhiFaceNeighbor(FEType type) const
Definition Assembly.h:1756
VectorVariablePhiCurl _vector_curl_phi
Definition Assembly.h:2711
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:2616
MooseArray< Real > _current_JxW_face
The current transformed jacobian weights on a face.
Definition Assembly.h:2516
const FEType _helper_type
The finite element type of the FE helper classes.
Definition Assembly.h:2346
Real _current_elem_volume
Volume of the current element.
Definition Assembly.h:2590
const MooseArray< Point > & normals() const
Returns the array of normals for quadrature points on a current side.
Definition Assembly.h:349
VectorVariablePhiSecond _vector_second_phi_face_neighbor
Definition Assembly.h:2728
const VectorVariablePhiDivergence & divPhi(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1381
void cacheJacobianCoupledVarPair(const MooseVariableBase &ivar, const MooseVariableBase &jvar)
Caches element matrix for ivar rows and jvar columns.
Definition Assembly.C:4111
const VariablePhiValue & phi(const MooseVariableField< Real > &) const
Definition Assembly.h:1318
bool _building_helpers
Whether we are currently building the FE classes for the helpers.
Definition Assembly.h:2364
void addJacobianScalar(GlobalDataKey)
Add Jacobians for pairs of scalar variables into the global Jacobian matrices.
Definition Assembly.C:4492
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:1319
FEBase * _current_fe_face_helper
helper object for transforming coordinates
Definition Assembly.h:2508
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:3717
FEBase * _current_fe_helper
The current helper object for transforming coordinates.
Definition Assembly.h:2396
MooseArray< Point > _current_physical_points
This will be filled up with the physical points passed into reinitAtPhysical() if it is called....
Definition Assembly.h:2634
VectorVariablePhiGradient & gradPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1532
void addJacobianLowerD(GlobalDataKey)
Add portions of the Jacobian of LowerLower, LowerSecondary, and SecondaryLower for boundary condition...
Definition Assembly.C:4060
libMesh::QBase * _current_qrule
The current current quadrature rule being used (could be either volumetric or arbitrary - for dirac k...
Definition Assembly.h:2398
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:327
const MooseArray< Point > & qPoints() const
Returns the reference to the quadrature points.
Definition Assembly.h:250
const bool & _computing_residual
Whether we are currently computing the residual.
Definition Assembly.h:2310
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:1815
MooseArray< VectorValue< ADReal > > _ad_normals
Definition Assembly.h:2839
VectorVariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1556
libMesh::QBase * writeableQRule(unsigned int dim, SubdomainID block, InternalDataKey)
Returns the pointer to the quadrature of specified block and dimension.
Definition Assembly.h:240
const std::vector< std::pair< MooseVariableScalar *, MooseVariableFieldBase * > > & scalarFieldCouplingEntries() const
Definition Assembly.h:1306
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:4499
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:4610
void computeCurrentFaceVolume()
Definition Assembly.C:1812
VectorVariablePhiCurl & curlPhi(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1498
const VariablePhiGradient & gradPhiFace() const
Definition Assembly.h:1329
bool _need_JxW_neighbor
Flag to indicate that JxW_neighbor is needed.
Definition Assembly.h:2555
VectorVariablePhiSecond & secondPhi(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1494
const BoundaryID & currentBoundaryID() const
Return the current boundary ID.
Definition Assembly.h:421
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhi(FEType type) const
Definition Assembly.h:1631
VectorVariablePhiSecond _vector_second_phi
Definition Assembly.h:2710
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiLower(FEType type) const
Definition Assembly.h:2914
bool _user_added_fe_of_helper_type
Whether user code requested a FEType the same as our _helper_type.
Definition Assembly.h:2349
VectorVariablePhiCurl & curlPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1540
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:184
VectorVariablePhiCurl _vector_curl_phi_neighbor
Definition Assembly.h:2723
void setCurrentNeighborSubdomainID(SubdomainID i)
set the current subdomain ID
Definition Assembly.h:494
std::map< FEType, ADTemplateVariablePhiGradient< RealVectorValue > > _ad_vector_grad_phi_data
Definition Assembly.h:2769
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe
Each dimension's actual vector fe objects indexed on type.
Definition Assembly.h:2392
const MooseArray< ADPoint > & adQPointsFace() const
Definition Assembly.h:393
MooseArray< ADReal > _ad_JxW_face
Definition Assembly.h:2838
bool _calculate_xyz
Definition Assembly.h:2849
const VariablePhiValue & phi() const
Definition Assembly.h:1312
void buildFaceNeighborFE(FEType type) const
Build FEs for a neighbor face with a type.
Definition Assembly.C:346
const VectorVariablePhiGradient & gradPhi(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1369
SubdomainID _current_subdomain_id
The current subdomain ID.
Definition Assembly.h:2586
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_face
Definition Assembly.h:2762
const libMesh::CouplingMatrix & _nonlocal_cm
Definition Assembly.h:2307
VectorVariablePhiDivergence _vector_div_phi_neighbor
Definition Assembly.h:2724
Real _current_neighbor_volume
Volume of the current neighbor.
Definition Assembly.h:2608
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:172
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:2627
DenseVector< Real > getJacobianDiagonal(const DenseMatrix< Number > &ke)
Definition Assembly.h:1890
Moose::CoordinateSystemType _coord_type
The coordinate system.
Definition Assembly.h:2410
VectorVariablePhiGradient _vector_grad_phi_face_neighbor
Definition Assembly.h:2727
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:2245
std::map< FEType, FEBase * > _current_fe_neighbor
The "neighbor" fe object that matches the current elem.
Definition Assembly.h:2374
const OutputTools< OutputType >::VariablePhiValue & fePhiLower(FEType type) const
Definition Assembly.h:2898
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_lower
FE objects for lower dimensional elements.
Definition Assembly.h:2544
std::vector< std::vector< DenseVector< Number > > > _sub_Rn
Definition Assembly.h:2649
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:2272
VariablePhiValue _phi_face_neighbor
Definition Assembly.h:2703
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:370
void buildVectorNeighborFE(FEType type) const
Build Vector FEs for a neighbor with a type.
Definition Assembly.C:545
std::vector< Eigen::Map< RealDIMValue > > _mapped_normals
Mapped normals.
Definition Assembly.h:2520
const libMesh::DofMap & _dof_map
DOF map.
Definition Assembly.h:2336
const VariablePhiSecond & secondPhiFace(const MooseVariableField< Real > &) const
Definition Assembly.h:1334
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:2535
VariablePhiValue & phiFaceNeighbor(const MooseVariableField< Real > &)
Definition Assembly.h:1475
void prepareScalar()
Definition Assembly.C:3005
const OutputTools< OutputType >::VariablePhiValue & feDualPhiLower(FEType type) const
Definition Assembly.h:2906
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:2671
std::vector< VectorValue< ADReal > > _ad_dxyzdxi_map
AD quantities.
Definition Assembly.h:2819
VariablePhiSecond _second_phi_face
Definition Assembly.h:2697
const MooseArray< ADReal > & adCurvatures() const
Definition Assembly.C:4843
bool _prepared_for_p_refinement
Whether helper FEs have been prepared for p-refinement.
Definition Assembly.h:2890
std::vector< std::unique_ptr< FEBase > > _unique_fe_face_neighbor_helper
Definition Assembly.h:2359
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:2325
const Elem * _current_lower_d_elem
The current lower dimensional element.
Definition Assembly.h:2619
unsigned int _current_side
The current side of the selected element (valid only when working with sides)
Definition Assembly.h:2592
const bool & _computing_residual_and_jacobian
Whether we are currently computing the residual and Jacobian.
Definition Assembly.h:2316
void buildNeighborFE(FEType type) const
Build FEs for a neighbor with a type.
Definition Assembly.C:321
ArbitraryQuadrature * qruleArbitraryFace(const Elem *elem, unsigned int side)
Definition Assembly.C:1962
const OutputTools< OutputType >::VariablePhiGradient & feGradDualPhiLower(FEType type) const
Definition Assembly.h:2922
std::unordered_map< SubdomainID, std::vector< QRules > > _qrules
Holds quadrature rules for each dimension.
Definition Assembly.h:2447
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:1831
std::map< FEType, FEVectorBase * > _current_vector_fe
The "volume" vector fe object that matches the current elem.
Definition Assembly.h:2379
std::vector< VectorValue< ADReal > > _ad_dxyzdzeta_map
Definition Assembly.h:2821
VariablePhiValue & phiFace(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1574
VariablePhiSecond & secondPhi(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1572
VariablePhiGradient _grad_phi_neighbor
Definition Assembly.h:2700
bool computingResidualAndJacobian() const
Definition Assembly.h:1948
libMesh::QBase *const & writeableQRuleNeighbor()
Returns the reference to the current quadrature being used on a current neighbor.
Definition Assembly.h:519
std::unique_ptr< FEBase > _fe_msm
A FE object for working on mortar segement elements.
Definition Assembly.h:2569
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:3922
const VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< Real > &) const
Definition Assembly.h:1343
const unsigned int & neighborSide() const
Returns the current neighboring side.
Definition Assembly.h:444
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:3391
bool computingResidual() const
Definition Assembly.h:1938
void prepareNeighbor()
Definition Assembly.C:2864
VectorVariablePhiGradient _vector_grad_phi_neighbor
Definition Assembly.h:2721
const MooseArray< Point > & physicalPoints() const
The current points in physical space where we have reinited through reinitAtPhysical()
Definition Assembly.h:262
const Elem *const & elem() const
Return the current element.
Definition Assembly.h:406
std::map< FEType, FEVectorBase * > _current_vector_fe_face_neighbor
The "neighbor face" vector fe object that matches the current elem.
Definition Assembly.h:2385
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:2472
const Node * _current_neighbor_node
The current neighboring node we are working with.
Definition Assembly.h:2612
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:2688
void buildFE(FEType type) const
Build FEs with a type.
Definition Assembly.C:267
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhiFaceNeighbor(FEType type) const
Definition Assembly.h:1724
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:3047
void setXFEM(std::shared_ptr< XFEMInterface > xfem)
Set the pointer to the XFEM controller object.
Definition Assembly.h:1799
VectorVariablePhiDivergence & divPhiFace(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1523
const Elem *const & neighborLowerDElem() const
Return the neighboring lower dimensional element.
Definition Assembly.h:474
const Elem * _current_neighbor_side_elem
The current side element of the ncurrent neighbor element.
Definition Assembly.h:2604
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:3508
VariablePhiGradient _grad_phi_face_neighbor
Definition Assembly.h:2704
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_neighbor
Definition Assembly.h:2536
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kle
dlower/dsecondary (or dlower/delement)
Definition Assembly.h:2679
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:3476
void copyFaceShapes(MooseVariableField< T > &v)
Definition Assembly.C:3092
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:3369
DenseVector< Number > _tmp_Re
auxiliary vector for scaling residuals (optimization to avoid expensive construction/destruction)
Definition Assembly.h:2654
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & couplingEntries()
Definition Assembly.h:1286
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:3341
const VariablePhiValue & phiFace(const MooseVariableField< Real > &) const
Definition Assembly.h:1328
bool _calculate_ad_coord
Whether to calculate coord with AD.
Definition Assembly.h:2855
const libMesh::CouplingMatrix * _cm
Coupling matrices.
Definition Assembly.h:2306
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:2236
VectorVariablePhiCurl _vector_curl_phi_face
Definition Assembly.h:2717
VariablePhiGradient & gradPhi(const MooseVariableField< Real > &)
Definition Assembly.h:1458
MooseArray< Point > _current_q_points_face
The current quadrature points on a face.
Definition Assembly.h:2514
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_neighbor
Definition Assembly.h:2763
void cacheJacobianNeighbor(GlobalDataKey)
Takes the values that are currently in the neighbor Dense Matrices and appends them to the cached val...
Definition Assembly.C:4149
const libMesh::QBase *const & qRuleMortar() const
Returns a reference to the quadrature rule for the mortar segments.
Definition Assembly.h:704
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:3213
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:2344
void setNeighborQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for neighbor integration.
Definition Assembly.C:746
void helpersRequestData()
request phi, dphi, xyz, JxW, etc.
Definition Assembly.C:4854
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Knn
jacobian contributions from the neighbor <Tag, ivar, jvar>
Definition Assembly.h:2675
const MooseArray< ADPoint > & adQPoints() const
Definition Assembly.h:387
libMesh::QBase *const & writeableQRule()
Returns the reference to the current quadrature being used.
Definition Assembly.h:233
void clearCachedQRules()
Set the cached quadrature rules to nullptr.
Definition Assembly.C:763
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kln
dlower/dprimary (or dlower/dneighbor)
Definition Assembly.h:2681
VariablePhiSecond & secondPhi(const MooseVariableField< Real > &)
Definition Assembly.h:1459
libMesh::QBase * _current_qrule_neighbor
quadrature rule used on neighbors
Definition Assembly.h:2551
void setLowerQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for lower dimensional integration.
Definition Assembly.C:727
void buildLowerDFE(FEType type) const
Build FEs for a lower dimensional element with a type.
Definition Assembly.C:371
const VectorVariablePhiCurl & curlPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1421
VariablePhiGradient _grad_phi_face
Definition Assembly.h:2696
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:2334
const std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > & couplingEntries() const
Definition Assembly.h:1291
const std::vector< Point > & qPointsMortar() const
Returns the reference to the mortar segment element quadrature points.
Definition Assembly.h:256
std::map< unsigned int, const std::vector< Point > * > _holder_normals
Holds pointers to the dimension's normal vectors.
Definition Assembly.h:2529
const OutputTools< OutputType >::VariablePhiValue & fePhiNeighbor(FEType type) const
Definition Assembly.h:1686
libMesh::QBase *const & writeableQRuleFace()
Returns the reference to the current quadrature being used on a current face.
Definition Assembly.h:320
void setCurrentSubdomainID(SubdomainID i)
set the current subdomain ID
Definition Assembly.h:416
Real elementVolume(const Elem *elem) const
On-demand computation of volume element accounting for RZ/RSpherical.
Definition Assembly.C:3809
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_neighbor
types of finite elements
Definition Assembly.h:2534
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:1356
const VariablePhiGradient & gradPhiFace(const MooseVariableField< Real > &) const
Definition Assembly.h:1330
const OutputTools< OutputType >::VariablePhiGradient & feGradPhi(FEType type) const
Definition Assembly.h:1618
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhiFace(FEType type) const
Definition Assembly.h:1740
const unsigned int & side() const
Returns the current side.
Definition Assembly.h:438
std::vector< VectorValue< ADReal > > _ad_d2xyzdeta2_map
Definition Assembly.h:2824
BoundaryID _current_boundary_id
The current boundary ID.
Definition Assembly.h:2588
MooseArray< std::vector< Point > > _current_tangents
The current tangent vectors at the quadrature points.
Definition Assembly.h:2522
std::vector< std::unique_ptr< FEBase > > _unique_fe_face_helper
Definition Assembly.h:2358
std::map< FEType, FEBase * > _current_fe
The "volume" fe object that matches the current elem.
Definition Assembly.h:2370
VectorVariablePhiGradient & gradPhiFace(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1511
const ADTemplateVariablePhiGradient< OutputType > & feADGradPhiFace(FEType type) const
Definition Assembly.h:1666
const std::vector< Eigen::Map< RealDIMValue > > & mappedNormals() const
Definition Assembly.h:354
const VectorVariablePhiCurl & curlPhi(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1377
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:2979
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_lower
Definition Assembly.h:2757
VectorVariablePhiGradient & gradPhi(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1490
const Real & lowerDElemVolume() const
Definition Assembly.h:3204
VariablePhiSecond _second_phi
Definition Assembly.h:2693
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:3773
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:2483
const MooseArray< ADPoint > & adNormals() const
Definition Assembly.h:385
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:2459
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_face
types of vector finite elements
Definition Assembly.h:2504
VectorVariablePhiValue _vector_phi
Definition Assembly.h:2708
void buildVectorLowerDFE(FEType type) const
Build Vector FEs for a lower dimensional element with a type.
Definition Assembly.C:422
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:4477
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhiNeighbor(FEType type) const
Definition Assembly.h:1700
std::map< unsigned int, std::map< FEType, FEBase * > > _fe
Each dimension's actual fe objects indexed on type.
Definition Assembly.h:2390
std::set< FEType > _need_curl
Definition Assembly.h:2859
const VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< Real > &) const
Definition Assembly.h:1360
const VectorVariablePhiSecond & secondPhi(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1373
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:2357
unsigned int numExtraElemIntegers() const
Number of extra element integers Assembly tracked.
Definition Assembly.h:365
const libMesh::QBase * attachQRuleElem(unsigned int dim, FEBase &fe)
Attaches the current elem/volume quadrature rule to the given fe.
Definition Assembly.h:1906
void activateDual()
Indicates that dual shape functions are used for mortar constraint.
Definition Assembly.h:609
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > _cm_ff_entry
Entries in the coupling matrix for field variables.
Definition Assembly.h:2319
const Moose::CoordinateSystemType & coordSystem() const
Get the coordinate system type.
Definition Assembly.h:308
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > _cm_nonlocal_entry
Entries in the coupling matrix for field variables for nonlocal calculations.
Definition Assembly.h:2327
bool _current_elem_volume_computed
Boolean to indicate whether current element volumes has been computed.
Definition Assembly.h:2614
VectorVariablePhiSecond _vector_second_phi_neighbor
Definition Assembly.h:2722
const std::vector< std::pair< MooseVariableFieldBase *, MooseVariableScalar * > > & fieldScalarCouplingEntries() const
Definition Assembly.h:1301
const VectorVariablePhiValue & phi(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1365
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:1116
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiFaceNeighbor(FEType type) const
Definition Assembly.h:1716
void buildLowerDDualFE(FEType type) const
Definition Assembly.C:398
VariablePhiValue _phi_neighbor
Definition Assembly.h:2699
VariablePhiValue & phiFace(const MooseVariableField< Real > &)
Definition Assembly.h:1461
void addCachedResidualDirectly(NumericVector< Number > &residual, GlobalDataKey, const VectorTag &vector_tag)
Adds the values that have been cached by calling cacheResidual(), cacheResidualNeighbor(),...
Definition Assembly.C:3567
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_face
types of finite elements
Definition Assembly.h:2502
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:3944
VectorVariablePhiCurl _vector_curl_phi_face_neighbor
Definition Assembly.h:2729
void setMortarQRule(Order order)
Specifies a custom qrule for integration on mortar segment mesh.
Definition Assembly.C:772
void saveLocalADArray(std::vector< ADReal > &re, unsigned int i, unsigned int ntest, const ADRealEigenVector &v) const
Definition Assembly.C:3842
VariablePhiGradient & gradPhi(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1571
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:2598
VectorVariablePhiDivergence _vector_div_phi_face
Definition Assembly.h:2718
bool _user_added_fe_face_neighbor_of_helper_type
Definition Assembly.h:2351
const MooseArray< ADReal > & adJxWFace() const
Definition Assembly.h:272
std::vector< ADReal > _ad_dzetadx_map
Definition Assembly.h:2834
std::vector< dof_id_type > _column_indices
Definition Assembly.h:2887
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:124
const VariablePhiValue & phiNeighbor(const MooseVariableField< Real > &) const
Definition Assembly.h:1339
MooseMesh & _mesh
Definition Assembly.h:2340
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:3172
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:1134
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:2329
void buildVectorFaceNeighborFE(FEType type) const
Build Vector FEs for a neighbor face with a type.
Definition Assembly.C:578
ArbitraryQuadrature * _current_qface_arbitrary
The current arbitrary quadrature rule used on element faces.
Definition Assembly.h:2512
VectorVariablePhiGradient _vector_grad_phi
Definition Assembly.h:2709
const VectorVariablePhiGradient & gradPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1390
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:2290
void prepareJacobianBlock()
Sizes and zeroes the Jacobian blocks used for the current element.
Definition Assembly.C:2738
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:2281
void resizeADMappingObjects(unsigned int n_qp, unsigned int dim)
resize any objects that contribute to automatic differentiation-related mapping calculations
Definition Assembly.C:1008
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:3318
const libMesh::QBase *const & qRuleNeighbor() const
Returns the reference to the current quadrature being used on a current neighbor.
Definition Assembly.h:510
std::vector< VectorValue< ADReal > > _ad_dxyzdeta_map
Definition Assembly.h:2820
bool computingJacobian() const
Definition Assembly.h:1943
const Node * _current_node
The current node we are working with.
Definition Assembly.h:2610
VariablePhiValue & phiFaceNeighbor(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1597
DenseVector< Number > & residualBlockLower(unsigned int var_num, LocalDataKey, TagID tag_id)
Get residual block for lower.
Definition Assembly.h:1125
std::map< FEType, ADTemplateVariablePhiGradient< RealVectorValue > > _ad_vector_grad_phi_data_face
Definition Assembly.h:2772
void cacheJacobianMortar(GlobalDataKey)
Cache all portions of the Jacobian, e.g.
Definition Assembly.C:4187
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:612
THREAD_ID _tid
Thread number (id)
Definition Assembly.h:2338
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:2683
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_dual_lower
Definition Assembly.h:2766
MooseArray< Point > _current_normals
The current Normal vectors at the quadrature points.
Definition Assembly.h:2518
void cacheJacobian(GlobalDataKey)
Takes the values that are currently in _sub_Kee and appends them to the cached values.
Definition Assembly.C:4097
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:537
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:2402
void computeADFace(const Elem &elem, const unsigned int side)
compute AD things on an element face
Definition Assembly.C:2159
libMesh::ElemSideBuilder _current_side_elem_builder
In place side element builder for _current_side_elem.
Definition Assembly.h:2866
const VectorVariablePhiCurl & curlPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1398
void setCurrentBoundaryID(BoundaryID i)
set the current boundary ID
Definition Assembly.h:426
void computeFaceMap(const Elem &elem, const unsigned int side, const std::vector< Real > &qw)
Definition Assembly.C:1387
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_lower
Vector FE objects for lower dimensional elements.
Definition Assembly.h:2546
void setCachedJacobian(GlobalDataKey)
Sets previously-cached Jacobian values via SparseMatrix::set() calls.
Definition Assembly.C:4528
const VectorVariablePhiSecond & secondPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1417
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:635
libMesh::QBase * qruleFace(const Elem *elem, unsigned int side)
This is an abstraction over the internal qrules function.
Definition Assembly.C:1956
void preparePRefinement()
Prepare helper FEs for p-refinement.
Definition Assembly.C:4887
std::vector< std::vector< DenseVector< Number > > > _sub_Rl
residual contributions for each variable from the lower dimensional element
Definition Assembly.h:2651
std::map< FEType, FEBase * > _current_fe_face
The "face" fe object that matches the current elem.
Definition Assembly.h:2372
VectorVariablePhiValue & phi(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1489
void addCachedJacobian(GlobalDataKey)
Adds the values that have been cached by calling cacheJacobian() and or cacheJacobianNeighbor() to th...
Definition Assembly.C:3852
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:2254
VectorVariablePhiDivergence _vector_div_phi
Definition Assembly.h:2712
const OutputTools< OutputType >::VariablePhiValue & fePhi(FEType type) const
Definition Assembly.h:1611
const VectorVariablePhiDivergence & divPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1451
const VectorVariablePhiDivergence & divPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1402
void reinit(const Elem *elem)
Reinitialize objects (JxW, q_points, ...) for an elements.
Definition Assembly.C:1858
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:379
const VectorVariablePhiDivergence & divPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1426
std::vector< dof_id_type > _neighbor_extra_elem_ids
Extra element IDs of neighbor.
Definition Assembly.h:2527
libMesh::ElemSideBuilder _compute_face_map_side_elem_builder
In place side element builder for computeFaceMap()
Definition Assembly.h:2870
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:3444
VectorVariablePhiValue & phiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1528
void modifyFaceWeightsDueToXFEM(const Elem *elem, unsigned int side=0)
Update the face integration weights for XFEM partial elements.
Definition Assembly.C:4589
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:296
const Real & sideElemVolume() const
Returns the reference to the volume of current side element.
Definition Assembly.h:456
std::shared_ptr< XFEMInterface > _xfem
The XFEM controller.
Definition Assembly.h:2367
std::map< unsigned int, FEBase * > _holder_fe_face_neighbor_helper
Definition Assembly.h:2541
std::set< FEType > _need_neighbor_div
Definition Assembly.h:2862
SubdomainID _current_neighbor_subdomain_id
The current neighbor subdomain ID.
Definition Assembly.h:2600
const ADTemplateVariablePhiGradient< OutputType > & feADGradPhi(FEType type) const
Definition Assembly.h:1625
std::map< FEType, FEVectorBase * > _current_vector_fe_face
The "face" vector fe object that matches the current elem.
Definition Assembly.h:2381
VariablePhiValue _phi
Definition Assembly.h:2691
bool _custom_mortar_qrule
Flag specifying whether a custom quadrature rule has been specified for mortar segment mesh.
Definition Assembly.h:2576
libMesh::ElemSideBuilder _current_neighbor_side_elem_builder
In place side element builder for _current_neighbor_side_elem.
Definition Assembly.h:2868
const SubdomainID & currentNeighborSubdomainID() const
Return the current subdomain ID.
Definition Assembly.h:489
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:2770
MooseArray< ADReal > _ad_coord
The AD version of the current coordinate transformation coefficients.
Definition Assembly.h:2414
const libMesh::QBase * attachQRuleFace(unsigned int dim, FEBase &fe)
Attaches the current face/area quadrature rule to the given fe.
Definition Assembly.h:1918
std::vector< std::unique_ptr< FEBase > > _unique_fe_neighbor_helper
Definition Assembly.h:2360
VariablePhiSecond & secondPhiFace(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1579
std::map< FEType, FEBase * > _current_fe_face_neighbor
The "neighbor face" fe object that matches the current elem.
Definition Assembly.h:2376
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:1038
void needADGradPhiFace() const
Request that face reinitialization compute the AD shape function gradients.
Definition Assembly.h:1675
VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< Real > &)
Definition Assembly.h:1483
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_neighbor
Definition Assembly.h:2755
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:2245
VariablePhiValue & phi(const MooseVariableField< Real > &)
Definition Assembly.h:1457
VariablePhiValue & phiNeighbor(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1584
bool _need_lower_d_elem_volume
Whether we need to compute the lower dimensional element volume.
Definition Assembly.h:2623
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_face_neighbor
Definition Assembly.h:2764
QRules & qrules(unsigned int dim)
Definition Assembly.h:2478
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:2323
bool _need_neighbor_elem_volume
true is apps need to compute neighbor element volume
Definition Assembly.h:2606
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhiFace(FEType type) const
Definition Assembly.h:1771
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Keg
Definition Assembly.h:2668
SubProblem & _subproblem
Definition Assembly.h:2301
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:699
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:2033
const MooseArray< std::vector< Point > > & tangents() const
Returns the array of tangents for quadrature points on a current side.
Definition Assembly.h:360
const ADTemplateVariablePhiGradient< T > & adGradPhi(const MooseVariableFE< T > &v) const
Definition Assembly.h:1314
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:3894
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:2058
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:432
VectorVariablePhiSecond & secondPhiNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1536
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:4335
const OutputTools< OutputType >::VariablePhiGradient & feGradPhiNeighbor(FEType type) const
Definition Assembly.h:1693
VectorVariablePhiGradient _vector_grad_phi_face
Definition Assembly.h:2715
VariablePhiValue & phiNeighbor(const MooseVariableField< Real > &)
Definition Assembly.h:1465
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableScalar * > > _cm_fs_entry
Entries in the coupling matrix for field variables vs scalar variables.
Definition Assembly.h:2321
Real _current_side_volume
Volume of the current side element.
Definition Assembly.h:2596
void copyShapes(MooseVariableField< T > &v)
Definition Assembly.C:3055
const MooseArray< Real > & coordTransformation() const
Returns the reference to the coordinate transformation coefficients.
Definition Assembly.h:280
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:3303
VariablePhiSecond _second_phi_neighbor
Definition Assembly.h:2701
Real _current_neighbor_lower_d_elem_volume
The current neighboring lower dimensional element volume.
Definition Assembly.h:2629
MooseArray< Real > _coord
The current coordinate transformation coefficients.
Definition Assembly.h:2412
void prepare()
Definition Assembly.C:2771
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_lower
Definition Assembly.h:2765
void buildVectorFE(FEType type) const
Build Vector FEs with a type.
Definition Assembly.C:478
VectorVariablePhiCurl & curlPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1560
const OutputTools< OutputType >::VariablePhiValue & fePhiFace(FEType type) const
Definition Assembly.h:1652
VariablePhiGradient & gradPhiFace(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1575
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:112
DenseVector< Number > & residualBlock(unsigned int var_num, LocalDataKey, TagID tag_id)
Get local residual block for a variable and a tag.
Definition Assembly.h:1107
ArbitraryQuadrature * _current_qrule_arbitrary_face
The current arbitrary quadrature rule used on the element face.
Definition Assembly.h:2404
const MooseArray< Real > & JxW() const
Returns the reference to the transformed jacobian weights.
Definition Assembly.h:268
VariablePhiValue _phi_face
Definition Assembly.h:2695
std::vector< std::vector< std::vector< unsigned char > > > _jacobian_block_nonlocal_used
Definition Assembly.h:2330
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:160
VectorVariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1552
void prepareResidual()
Sizes and zeroes the residual for the current element.
Definition Assembly.C:2762
void setCurrentLowerDElem(const Elem *const lower_d_elem)
Set the current lower dimensional element.
Definition Assembly.h:3225
bool needDual() const
Indicates whether dual shape functions are used (computation is now repeated on each element so expen...
Definition Assembly.h:615
void buildVectorFaceFE(FEType type) const
Build Vector FEs for a face with a type.
Definition Assembly.C:512
VectorVariablePhiValue _vector_phi_neighbor
Definition Assembly.h:2720
const MooseArray< Real > & JxWNeighbor() const
Returns the reference to the transformed jacobian weights on a current face.
Definition Assembly.C:260
bool _user_added_fe_neighbor_of_helper_type
Definition Assembly.h:2352
const MooseArray< Point > & qPointsFace() const
Returns the reference to the current quadrature being used.
Definition Assembly.h:337
VectorVariablePhiValue _vector_phi_face
Definition Assembly.h:2714
void reinitFEFace(const Elem *elem, unsigned int side)
Just an internal helper function to reinit the face FE objects.
Definition Assembly.C:1307
const MooseArray< ADReal > & adJxW() const
Definition Assembly.h:270
const MooseArray< Point > & qPointsFaceNeighbor() const
Returns the reference to the current quadrature points being used on the neighbor face.
Definition Assembly.h:531
std::map< unsigned int, FEBase * > _holder_fe_neighbor_helper
Each dimension's helper objects.
Definition Assembly.h:2540
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:4267
VectorVariablePhiSecond _vector_second_phi_face
Definition Assembly.h:2716
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:1839
const Elem *const & msmElem() const
Definition Assembly.h:1953
const libMesh::QBase *const & qRuleFace() const
Returns the reference to the current quadrature being used on a current face.
Definition Assembly.h:314
void reinitNeighborLowerDElem(const Elem *elem)
reinitialize a neighboring lower dimensional element
Definition Assembly.C:2437
void initNonlocalCoupling()
Create pair of variables requiring nonlocal jacobian contributions.
Definition Assembly.C:2703
MooseArray< ADReal > _ad_curvatures
Definition Assembly.h:2842
VectorVariablePhiSecond & secondPhiFace(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1515
const VectorVariablePhiCurl & curlPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1446
const Real & neighborVolume()
Returns the reference to the current neighbor volume.
Definition Assembly.h:500
const OutputTools< OutputType >::VariablePhiSecond & feSecondPhiFace(FEType type) const
Definition Assembly.h:1678
libMesh::QBase * _qrule_msm
A qrule object for working on mortar segement elements.
Definition Assembly.h:2574
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:2594
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:148
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:343
std::map< FEType, ADTemplateVariablePhiGradient< Real > > _ad_grad_phi_data
Definition Assembly.h:2768
VariablePhiSecond & secondPhiNeighbor(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1592
const VariablePhiGradient & gradPhi(const MooseVariableField< Real > &) const
Definition Assembly.h:1320
std::map< unsigned int, FEBase * > _holder_fe_helper
Each dimension's helper objects.
Definition Assembly.h:2394
VariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1601
MooseArray< Point > _current_q_points_face_neighbor
The current quadrature points on the neighbor face.
Definition Assembly.h:2553
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:450
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhi(FEType type) const
Definition Assembly.h:1732
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kne
jacobian contributions from the neighbor and element <Tag, ivar, jvar>
Definition Assembly.h:2673
MooseArray< Real > _current_JxW
The current list of transformed jacobian weights.
Definition Assembly.h:2408
void zeroCachedJacobian(GlobalDataKey)
Zero out previously-cached Jacobian rows.
Definition Assembly.C:4548
void buildVectorDualLowerDFE(FEType type) const
Definition Assembly.C:450
const libMesh::QBase *const & qRule() const
Returns the reference to the current quadrature being used.
Definition Assembly.h:227
const Elem * _current_neighbor_lower_d_elem
The current neighboring lower dimensional element.
Definition Assembly.h:2621
VariablePhiValue & phi(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1570
libMesh::QBase * _current_qrule_lower
quadrature rule used on lower dimensional elements.
Definition Assembly.h:2580
const VariablePhiValue & phiFaceNeighbor(const MooseVariableField< Real > &) const
Definition Assembly.h:1352
void clearCachedResiduals(GlobalDataKey)
Clears all of the residuals in _cached_residual_rows and _cached_residual_values.
Definition Assembly.C:3537
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:4393
void computeCurrentElemVolume()
Definition Assembly.C:1793
const MooseArray< Real > & mortarCoordTransformation() const
Returns the reference to the coordinate transformation coefficients on the mortar segment mesh.
Definition Assembly.h:286
unsigned int _current_neighbor_side
The current side of the selected neighboring element (valid only when working with sides)
Definition Assembly.h:2602
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Knl
dprimary/dlower (or dneighbor/dlower)
Definition Assembly.h:2685
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:3413
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:2458
std::vector< VectorValue< ADReal > > _ad_d2xyzdxi2_map
Definition Assembly.h:2822
VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1605
const Elem * _current_elem
The current "element" we are currently on.
Definition Assembly.h:2584
std::map< unsigned int, FEBase * > _holder_fe_face_helper
Each dimension's helper objects.
Definition Assembly.h:2506
const VectorVariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1441
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_face_neighbor
Definition Assembly.h:2537
const VectorVariablePhiGradient & gradPhiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1412
VectorVariablePhiDivergence _vector_div_phi_face_neighbor
Definition Assembly.h:2730
VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< RealEigenVector > &)
Definition Assembly.h:1588
void reinitNeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
Reinitializes the neighbor side using reference coordinates.
Definition Assembly.C:1726
const Elem * _msm_elem
Definition Assembly.h:2872
libMesh::QBase * _current_qrule_volume
The current volumetric quadrature for the element.
Definition Assembly.h:2400
void addJacobianNeighborLowerD(GlobalDataKey)
Add all portions of the Jacobian except PrimaryPrimary, e.g.
Definition Assembly.C:3982
std::map< FEType, FEVectorBase * > _current_vector_fe_neighbor
The "neighbor" vector fe object that matches the current elem.
Definition Assembly.h:2383
VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< Real > &)
Definition Assembly.h:1466
MooseArray< Real > _coord_msm
The coordinate transformation coefficients evaluated on the quadrature points of the mortar segment m...
Definition Assembly.h:2562
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:208
Real _current_lower_d_elem_volume
The current lower dimensional element volume.
Definition Assembly.h:2625
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:3594
const VectorVariablePhiGradient & gradPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1436
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:2350
void clearCachedJacobian()
Clear any currently cached jacobians.
Definition Assembly.C:4558
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:543
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_dual_lower
Definition Assembly.h:2758
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data
Shape function values, gradients, second derivatives for each FE type.
Definition Assembly.h:2753
std::vector< Point > _current_neighbor_ref_points
The current reference points on the neighbor element.
Definition Assembly.h:2893
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:3176
void copyNeighborShapes(MooseVariableField< T > &v)
Definition Assembly.C:3129
std::set< FEType > _need_second_derivative
Definition Assembly.h:2857
const OutputTools< OutputType >::VariablePhiCurl & feCurlPhiNeighbor(FEType type) const
Definition Assembly.h:1748
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:2887
std::vector< dof_id_type > _extra_elem_ids
Extra element IDs.
Definition Assembly.h:2525
void addCachedResiduals(GlobalDataKey, const std::vector< VectorTag > &tags)
Pushes all cached residuals to the global residual vectors associated with each tag.
Definition Assembly.C:3522
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_face_neighbor
Definition Assembly.h:2756
bool _user_added_fe_lower_of_helper_type
Definition Assembly.h:2353
MooseArray< Real > _current_JxW_neighbor
The current transformed jacobian weights on a neighbor's face.
Definition Assembly.h:2557
std::vector< ADReal > _ad_dxidy_map
Definition Assembly.h:2829
unsigned int _mesh_dimension
Definition Assembly.h:2342
DenseVector< Number > _element_vector
A working vector to avoid repeated heap allocations when caching residuals that must have libMesh-lev...
Definition Assembly.h:2877
const OutputTools< OutputType >::VariablePhiDivergence & feDivPhiFaceNeighbor(FEType type) const
Definition Assembly.h:1787
const VectorVariablePhiValue & phiNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1407
VariablePhiSecond _second_phi_face_neighbor
Definition Assembly.h:2705
VectorVariablePhiDivergence & divPhiFaceNeighbor(const MooseVariableField< RealVectorValue > &)
Definition Assembly.h:1564
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:3585
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_face
Definition Assembly.h:2754
const VariablePhiSecond & secondPhi() const
Definition Assembly.h:1321
const VariablePhiSecond & secondPhi(const MooseVariableField< Real > &) const
Definition Assembly.h:1322
const Elem *const & neighbor() const
Return the neighbor element.
Definition Assembly.h:462
void prepareOffDiagScalar()
Definition Assembly.C:3029
void prepareNonlocal()
Definition Assembly.C:2778
const SubdomainID & currentSubdomainID() const
Return the current subdomain ID.
Definition Assembly.h:411
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:196
void prepareVariable(MooseVariableFieldBase *var)
Used for preparing the dense residual and jacobian blocks for one particular variable.
Definition Assembly.C:2804
VariablePhiSecond & secondPhiFace(const MooseVariableField< Real > &)
Definition Assembly.h:1463
const Elem *const & lowerDElem() const
Return the lower dimensional element.
Definition Assembly.h:468
const VectorVariablePhiValue & phiFaceNeighbor(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1431
const VectorVariablePhiSecond & secondPhiFace(const MooseVariableField< RealVectorValue > &) const
Definition Assembly.h:1394
bool _need_dual
Whether dual shape functions need to be computed for mortar constraints.
Definition Assembly.h:2631
const MooseArray< ADReal > & adCoordTransformation() const
Returns the reference to the AD version of the coordinate transformation coefficients.
Definition Assembly.h:292
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
bool is_constrained_dof(const dof_id_type dof) 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:2419
std::unique_ptr< ArbitraryQuadrature > arbitrary_vol
volume/elem (meshdim) custom points quadrature rule
Definition Assembly.h:2436
std::unique_ptr< ArbitraryQuadrature > neighbor
area/face (meshdim-1) custom points quadrature rule for DG
Definition Assembly.h:2440
std::unique_ptr< libMesh::QBase > fv_face
finite volume face/flux quadrature rule (meshdim-1)
Definition Assembly.h:2434
std::unique_ptr< libMesh::QBase > vol
volume/elem (meshdim) quadrature rule
Definition Assembly.h:2430
std::unique_ptr< ArbitraryQuadrature > arbitrary_face
area/face (meshdim-1) custom points quadrature rule
Definition Assembly.h:2438
std::unique_ptr< libMesh::QBase > face
area/face (meshdim-1) quadrature rule
Definition Assembly.h:2432