25#include "libmesh/coupling_matrix.h"
26#include "libmesh/dof_map.h"
27#include "libmesh/elem.h"
28#include "libmesh/equation_systems.h"
29#include "libmesh/fe_interface.h"
30#include "libmesh/node.h"
31#include "libmesh/quadrature_gauss.h"
32#include "libmesh/sparse_matrix.h"
33#include "libmesh/tensor_value.h"
34#include "libmesh/vector_value.h"
35#include "libmesh/fe.h"
39template <
typename P,
typename C>
50template <
typename P,
typename C>
58 mooseAssert(neighbor_sub_id != libMesh::Elem::invalid_subdomain_id
59 ?
mesh.getCoordSystem(sub_id) ==
mesh.getCoordSystem(neighbor_sub_id)
61 "Coordinate systems must be the same between element and neighbor");
62 const auto coord_type =
mesh.getCoordSystem(sub_id);
66 if (
mesh.usingGeneralAxisymmetricCoordAxes())
68 const auto & axis =
mesh.getGeneralAxisymmetricCoordAxis(sub_id);
73 point, factor, coord_type,
mesh.getAxisymmetricRadialCoord());
81 _subproblem(_sys.subproblem()),
83 _nonlocal_cm(_subproblem.nonlocalCouplingMatrix(_sys.number())),
84 _computing_residual(_subproblem.currentlyComputingResidual()),
85 _computing_jacobian(_subproblem.currentlyComputingJacobian()),
86 _computing_residual_and_jacobian(_subproblem.currentlyComputingResidualAndJacobian()),
87 _dof_map(_sys.dofMap()),
90 _mesh_dimension(_mesh.dimension()),
92 FEType(_mesh.hasSecondOrderElements() ? SECOND : FIRST, LAGRANGE).set_p_refinement(false)),
93 _user_added_fe_of_helper_type(false),
94 _user_added_fe_face_of_helper_type(false),
95 _user_added_fe_face_neighbor_of_helper_type(false),
96 _user_added_fe_neighbor_of_helper_type(false),
97 _user_added_fe_lower_of_helper_type(false),
98 _building_helpers(false),
99 _current_qrule(nullptr),
100 _current_qrule_volume(nullptr),
101 _current_qrule_arbitrary(nullptr),
102 _coord_type(
Moose::COORD_XYZ),
103 _current_qrule_face(nullptr),
104 _current_qface_arbitrary(nullptr),
105 _current_qrule_neighbor(nullptr),
106 _need_JxW_neighbor(false),
108 _custom_mortar_qrule(false),
109 _current_qrule_lower(nullptr),
111 _current_elem(nullptr),
112 _current_elem_volume(0),
114 _current_side_elem(nullptr),
115 _current_side_volume(0),
116 _current_neighbor_elem(nullptr),
117 _current_neighbor_side(0),
118 _current_neighbor_side_elem(nullptr),
119 _need_neighbor_elem_volume(false),
120 _current_neighbor_volume(0),
121 _current_node(nullptr),
122 _current_neighbor_node(nullptr),
123 _current_elem_volume_computed(false),
124 _current_side_volume_computed(false),
126 _current_lower_d_elem(nullptr),
127 _current_neighbor_lower_d_elem(nullptr),
128 _need_lower_d_elem_volume(false),
129 _need_neighbor_lower_d_elem_volume(false),
132 _residual_vector_tags(_subproblem.getVectorTags(
Moose::VECTOR_TAG_RESIDUAL)),
133 _cached_residual_values(2),
134 _cached_residual_rows(2),
135 _max_cached_residuals(0),
136 _max_cached_jacobians(0),
138 _block_diagonal_matrix(false),
139 _calculate_xyz(false),
140 _calculate_face_xyz(false),
141 _calculate_curvatures(false),
142 _calculate_ad_coord(false),
143 _prepared_for_p_refinement(false)
173 const auto mortar_helper_type =
174 FEType(
_mesh_dimension == 2 ? helper_order : FIRST, LAGRANGE).set_p_refinement(
false);
177 _fe_msm->add_p_level_in_reinit(
false);
190 for (
auto & it :
_fe[
dim])
280 _fe[
dim][type] = FEGenericBase<Real>::build(
dim, type).release();
281 _fe[
dim][type]->add_p_level_in_reinit(type.p_refinement);
284 _fe[
dim][type]->get_phi();
285 _fe[
dim][type]->get_dphi();
289 _fe[
dim][type]->get_xyz();
291 _fe[
dim][type]->get_d2phi();
309 _fe_face[
dim][type] = FEGenericBase<Real>::build(
dim, type).release();
310 _fe_face[
dim][type]->add_p_level_in_reinit(type.p_refinement);
386 _fe_lower[
dim][type] = FEGenericBase<Real>::build(
dim, type).release();
387 _fe_lower[
dim][type]->add_p_level_in_reinit(type.p_refinement);
410 _fe_lower[
dim][type] = FEGenericBase<Real>::build(
dim, type).release();
411 _fe_lower[
dim][type]->add_p_level_in_reinit(type.p_refinement);
430 unsigned int dim = ((type.family == LAGRANGE_VEC) || (type.family == MONOMIAL_VEC)) ? 0 : 2;
432 if (ending_dim <
dim)
434 for (;
dim <= ending_dim;
dim++)
458 unsigned int dim = ((type.family == LAGRANGE_VEC) || (type.family == MONOMIAL_VEC)) ? 0 : 2;
460 if (ending_dim <
dim)
462 for (;
dim <= ending_dim;
dim++)
484 unsigned int min_dim;
485 if (type.family == NEDELEC_ONE || type.family == RAVIART_THOMAS ||
486 type.family == L2_RAVIART_THOMAS)
497 _vector_fe[
dim][type] = FEGenericBase<VectorValue<Real>>::build(
dim, type).release();
498 _vector_fe[
dim][type]->add_p_level_in_reinit(type.p_refinement);
518 unsigned int min_dim;
519 if (type.family == NEDELEC_ONE || type.family == RAVIART_THOMAS ||
520 type.family == L2_RAVIART_THOMAS)
551 unsigned int min_dim;
552 if (type.family == NEDELEC_ONE || type.family == RAVIART_THOMAS ||
553 type.family == L2_RAVIART_THOMAS)
584 unsigned int min_dim;
585 if (type.family == NEDELEC_ONE || type.family == RAVIART_THOMAS ||
586 type.family == L2_RAVIART_THOMAS)
598 FEGenericBase<VectorValue<Real>>::build(
dim, type).release();
615 mooseAssert(qdefault.size() > 0,
"default quadrature must be initialized before order bumps");
619 if (qvec.size() != ndims || !qvec[0].vol)
621 qdefault[0].arbitrary_vol->get_order(),
623 qdefault[0].face->get_order(),
625 else if (qvec[0].vol->get_order() < volume_order)
627 qvec[0].arbitrary_vol->get_order(),
629 qvec[0].face->get_order(),
638 mooseAssert(qdefault.size() > 0,
"default quadrature must be initialized before order bumps");
642 if (qvec.size() != ndims || !qvec[0].vol)
643 createQRules(qdefault[0].vol->type(), order, order, order, block);
644 else if (qvec[0].vol->get_order() < order || qvec[0].face->get_order() < order)
646 std::max(order, qvec[0].arbitrary_vol->get_order()),
647 std::max(order, qvec[0].vol->get_order()),
648 std::max(order, qvec[0].face->get_order()),
659 bool allow_negative_qweights)
663 if (qvec.size() != ndims)
666 for (
unsigned int i = 0; i < qvec.size(); i++)
669 auto & q = qvec[
dim];
670 q.vol = QBase::build(type,
dim, volume_order);
671 q.vol->allow_rules_with_negative_weights = allow_negative_qweights;
672 q.face = QBase::build(type,
dim - 1, face_order);
673 q.face->allow_rules_with_negative_weights = allow_negative_qweights;
675 q.fv_face->allow_rules_with_negative_weights = allow_negative_qweights;
676 q.neighbor = std::make_unique<ArbitraryQuadrature>(
dim - 1, face_order);
677 q.neighbor->allow_rules_with_negative_weights = allow_negative_qweights;
678 q.arbitrary_vol = std::make_unique<ArbitraryQuadrature>(
dim, order);
679 q.arbitrary_vol->allow_rules_with_negative_weights = allow_negative_qweights;
680 q.arbitrary_face = std::make_unique<ArbitraryQuadrature>(
dim - 1, face_order);
681 q.arbitrary_face->allow_rules_with_negative_weights = allow_negative_qweights;
698 for (
auto & it :
_fe[
dim])
699 it.second->attach_quadrature_rule(qrule);
701 it.second->attach_quadrature_rule(qrule);
704 mooseAssert(dim <
_unique_fe_helper.size(),
"We should not be indexing out of bounds");
716 it.second->attach_quadrature_rule(qrule);
718 it.second->attach_quadrature_rule(qrule);
735 it.second->attach_quadrature_rule(qrule);
737 it.second->attach_quadrature_rule(qrule);
751 it.second->attach_quadrature_rule(qrule);
753 it.second->attach_quadrature_rule(qrule);
757 "We should not be indexing out of bounds");
790 " does not match previously specified quadrature_order: ",
792 ". Quadrature_order (when specified) must match for all mortar constraints.");
799 unsigned int dim =
elem->dim();
801 for (
const auto & it :
_fe[
dim])
803 FEBase & fe = *it.second;
804 const FEType & fe_type = it.first;
812 fesd.
_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe.get_phi()));
814 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe.get_dphi()));
817 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe.get_d2phi()));
821 FEVectorBase & fe = *it.second;
822 const FEType & fe_type = it.first;
830 fesd.
_phi.shallowCopy(
const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe.get_phi()));
832 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe.get_dphi()));
835 const_cast<std::vector<std::vector<TypeNTensor<3, Real>
>> &>(fe.get_d2phi()));
838 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe.get_curl_phi()));
840 fesd.
_div_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe.get_div_phi()));
861 for (
unsigned int qp = 0; qp != n_qp; qp++)
866 for (
unsigned qp = 0; qp < n_qp; ++qp)
869 for (
unsigned qp = 0; qp < n_qp; ++qp)
873 for (
const auto & it :
_fe[
dim])
875 FEBase & fe = *it.second;
876 auto fe_type = it.first;
877 auto num_shapes = FEInterface::n_shape_functions(fe_type,
elem);
880 grad_phi.resize(num_shapes);
881 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
882 grad_phi[i].resize(n_qp);
888 const auto & regular_grad_phi =
_fe_shape_data[fe_type]->_grad_phi;
889 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
890 for (
unsigned qp = 0; qp < n_qp; ++qp)
891 grad_phi[i][qp] = regular_grad_phi[i][qp];
896 FEVectorBase & fe = *it.second;
897 auto fe_type = it.first;
898 auto num_shapes = FEInterface::n_shape_functions(fe_type,
elem);
901 grad_phi.resize(num_shapes);
902 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
903 grad_phi[i].resize(n_qp);
910 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
911 for (
unsigned qp = 0; qp < n_qp; ++qp)
912 grad_phi[i][qp] = regular_grad_phi[i][qp];
918 for (
auto i : make_range(n))
922 if (
_xfem !=
nullptr)
926template <
typename OutputType>
931 FEGenericBase<OutputType> * fe)
945 const auto & dphidxi = fe->get_dphidxi();
946 const auto & dphideta = fe->get_dphideta();
947 const auto & dphidzeta = fe->get_dphidzeta();
948 auto num_shapes = grad_phi.size();
954 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
955 for (
unsigned qp = 0; qp < n_qp; ++qp)
962 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
963 for (
unsigned qp = 0; qp < n_qp; ++qp)
965 grad_phi[i][qp].slice(0) = dphidxi[i][qp] *
_ad_dxidx_map[qp];
966 grad_phi[i][qp].slice(1) = dphidxi[i][qp] *
_ad_dxidy_map[qp];
967 grad_phi[i][qp].slice(2) = dphidxi[i][qp] *
_ad_dxidz_map[qp];
974 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
975 for (
unsigned qp = 0; qp < n_qp; ++qp)
977 grad_phi[i][qp].slice(0) =
979 grad_phi[i][qp].slice(1) =
981 grad_phi[i][qp].slice(2) =
989 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
990 for (
unsigned qp = 0; qp < n_qp; ++qp)
992 grad_phi[i][qp].slice(0) = dphidxi[i][qp] *
_ad_dxidx_map[qp] +
995 grad_phi[i][qp].slice(1) = dphidxi[i][qp] *
_ad_dxidy_map[qp] +
998 grad_phi[i][qp].slice(2) = dphidxi[i][qp] *
_ad_dxidz_map[qp] +
1039 const std::vector<Real> & qw,
1081 const auto & elem_nodes =
elem->get_nodes();
1082 auto num_shapes = FEInterface::n_shape_functions(fe->get_fe_type(),
elem);
1083 const auto & phi_map = fe->get_fe_map().get_phi_map();
1084 const auto & dphidxi_map = fe->get_fe_map().get_dphidxi_map();
1085 const auto & dphideta_map = fe->get_fe_map().get_dphideta_map();
1086 const auto & dphidzeta_map = fe->get_fe_map().get_dphidzeta_map();
1088 const bool do_derivatives =
1109 for (std::size_t i = 0; i < num_shapes; i++)
1111 libmesh_assert(elem_nodes[i]);
1112 const Node &
node = *elem_nodes[i];
1116 if (
node.n_dofs(sys_num, disp_num))
1118 elem_point(direction).derivatives(),
node.dof_number(sys_num, disp_num, 0), 1.);
1128 if (
_ad_jac[p].value() <= -TOLERANCE * TOLERANCE)
1130 static bool failing =
false;
1135 libmesh_error_msg(
"ERROR: negative Jacobian " <<
_ad_jac[p].value() <<
" at point index "
1136 << p <<
" in element " <<
elem->id());
1159 for (std::size_t i = 0; i < num_shapes; i++)
1161 libmesh_assert(elem_nodes[i]);
1162 const Node &
node = *elem_nodes[i];
1166 if (
node.n_dofs(sys_num, disp_num))
1168 elem_point(direction).derivatives(),
node.dof_number(sys_num, disp_num, 0), 1.);
1181 const auto g11 = (dx_dxi * dx_dxi + dy_dxi * dy_dxi + dz_dxi * dz_dxi);
1183 const auto g12 = (dx_dxi * dx_deta + dy_dxi * dy_deta + dz_dxi * dz_deta);
1185 const auto & g21 = g12;
1187 const auto g22 = (dx_deta * dx_deta + dy_deta * dy_deta + dz_deta * dz_deta);
1189 auto det = (g11 * g22 - g12 * g21);
1191 if (det.value() <= -TOLERANCE * TOLERANCE)
1193 static bool failing =
false;
1198 libmesh_error_msg(
"ERROR: negative Jacobian " << det <<
" at point index " << p
1199 <<
" in element " <<
elem->id());
1204 else if (det.value() <= 0.)
1205 det.value() = TOLERANCE * TOLERANCE;
1207 const auto inv_det = 1. / det;
1213 const auto g11inv = g22 * inv_det;
1214 const auto g12inv = -g12 * inv_det;
1215 const auto g21inv = -g21 * inv_det;
1216 const auto g22inv = g11 * inv_det;
1237 for (std::size_t i = 0; i < num_shapes; i++)
1239 libmesh_assert(elem_nodes[i]);
1240 const Node &
node = *elem_nodes[i];
1244 if (
node.n_dofs(sys_num, disp_num))
1246 elem_point(direction).derivatives(),
node.dof_number(sys_num, disp_num, 0), 1.);
1262 _ad_jac[p] = (dx_dxi * (dy_deta * dz_dzeta - dz_deta * dy_dzeta) +
1263 dy_dxi * (dz_deta * dx_dzeta - dx_deta * dz_dzeta) +
1264 dz_dxi * (dx_deta * dy_dzeta - dy_deta * dx_dzeta));
1266 if (
_ad_jac[p].value() <= -TOLERANCE * TOLERANCE)
1268 static bool failing =
false;
1273 libmesh_error_msg(
"ERROR: negative Jacobian " <<
_ad_jac[p].value() <<
" at point index "
1274 << p <<
" in element " <<
elem->id());
1282 const auto inv_jac = 1. /
_ad_jac[p];
1284 _ad_dxidx_map[p] = (dy_deta * dz_dzeta - dz_deta * dy_dzeta) * inv_jac;
1285 _ad_dxidy_map[p] = (dz_deta * dx_dzeta - dx_deta * dz_dzeta) * inv_jac;
1286 _ad_dxidz_map[p] = (dx_deta * dy_dzeta - dy_deta * dx_dzeta) * inv_jac;
1288 _ad_detadx_map[p] = (dz_dxi * dy_dzeta - dy_dxi * dz_dzeta) * inv_jac;
1289 _ad_detady_map[p] = (dx_dxi * dz_dzeta - dz_dxi * dx_dzeta) * inv_jac;
1290 _ad_detadz_map[p] = (dy_dxi * dx_dzeta - dx_dxi * dy_dzeta) * inv_jac;
1300 libmesh_error_msg(
"Invalid dim = " <<
dim);
1307 unsigned int dim =
elem->dim();
1311 FEBase & fe_face = *it.second;
1312 const FEType & fe_type = it.first;
1317 fesd.
_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_face.get_phi()));
1319 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face.get_dphi()));
1322 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face.get_d2phi()));
1326 FEVectorBase & fe_face = *it.second;
1327 const FEType & fe_type = it.first;
1335 fesd.
_phi.shallowCopy(
1336 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face.get_phi()));
1338 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face.get_dphi()));
1341 const_cast<std::vector<std::vector<TypeNTensor<3, Real>
>> &>(fe_face.get_d2phi()));
1344 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face.get_curl_phi()));
1347 const_cast<std::vector<std::vector<Real>
> &>(fe_face.get_div_phi()));
1375 if (
_xfem !=
nullptr)
1379 for (
auto i : make_range(n))
1395 const auto n_qp = qw.size();
1399 std::vector<std::vector<Real>>
const * d2psidxi2_map =
nullptr;
1400 std::vector<std::vector<Real>>
const * d2psidxideta_map =
nullptr;
1401 std::vector<std::vector<Real>>
const * d2psideta2_map =
nullptr;
1419 if (side_elem.node_id(0) ==
elem.node_id(0))
1424 VectorValue<ADReal> side_point;
1427 const Node &
node = side_elem.node_ref(0);
1433 side_point(direction).derivatives(),
node.dof_number(sys_num, disp_num, 0), 1.);
1436 for (
const auto p : make_range(n_qp))
1457 for (
const auto p : make_range(n_qp))
1460 for (
const auto p : make_range(n_qp))
1463 for (
const auto p : make_range(n_qp))
1466 const auto n_mapping_shape_functions =
1469 for (
unsigned int i = 0; i < n_mapping_shape_functions; i++)
1471 const Node &
node = side_elem.node_ref(i);
1472 VectorValue<ADReal> side_point =
node;
1477 side_point(direction).derivatives(),
node.dof_number(sys_num, disp_num, 0), 1.);
1479 for (
const auto p : make_range(n_qp))
1482 for (
const auto p : make_range(n_qp))
1485 for (
const auto p : make_range(n_qp))
1489 for (
const auto p : make_range(n_qp))
1499 libmesh_assert_not_equal_to(denominator, 0);
1518 for (
const auto p : make_range(n_qp))
1524 for (
const auto p : make_range(n_qp))
1527 for (
const auto p : make_range(n_qp))
1534 const unsigned int n_mapping_shape_functions =
1537 for (
unsigned int i = 0; i < n_mapping_shape_functions; i++)
1539 const Node &
node = side_elem.node_ref(i);
1540 VectorValue<ADReal> side_point =
node;
1545 side_point(direction).derivatives(),
node.dof_number(sys_num, disp_num, 0), 1.);
1547 for (
const auto p : make_range(n_qp))
1553 for (
const auto p : make_range(n_qp))
1556 for (
const auto p : make_range(n_qp))
1564 for (
const auto p : make_range(n_qp))
1572 const auto g11 = (dxdxi * dxdxi + dydxi * dydxi + dzdxi * dzdxi);
1574 const auto g12 = (dxdxi * dxdeta + dydxi * dydeta + dzdxi * dzdeta);
1576 const auto & g21 = g12;
1578 const auto g22 = (dxdeta * dxdeta + dydeta * dydeta + dzdeta * dzdeta);
1581 const auto the_jac = sqrt(g11 * g22 - g12 * g21);
1594 const auto numerator = E * N - 2. * F * M + G * L;
1595 const auto denominator = E * G - F * F;
1596 libmesh_assert_not_equal_to(denominator, 0.);
1612 unsigned int neighbor_dim =
neighbor->dim();
1617 FEBase & fe_face_neighbor = *it.second;
1618 FEType fe_type = it.first;
1621 fe_face_neighbor.reinit(
neighbor, &reference_points);
1625 fesd.
_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_face_neighbor.get_phi()));
1627 const_cast<std::vector<std::vector<RealGradient>
> &>(fe_face_neighbor.get_dphi()));
1630 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face_neighbor.get_d2phi()));
1634 FEVectorBase & fe_face_neighbor = *it.second;
1635 const FEType & fe_type = it.first;
1641 fe_face_neighbor.reinit(
neighbor, &reference_points);
1643 fesd.
_phi.shallowCopy(
1644 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face_neighbor.get_phi()));
1646 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face_neighbor.get_dphi()));
1648 fesd.
_second_phi.shallowCopy(
const_cast<std::vector<std::vector<TypeNTensor<3, Real>
>> &>(
1649 fe_face_neighbor.get_d2phi()));
1651 fesd.
_curl_phi.shallowCopy(
const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(
1652 fe_face_neighbor.get_curl_phi()));
1655 const_cast<std::vector<std::vector<Real>
> &>(fe_face_neighbor.get_div_phi()));
1660 "We should be in bounds here");
1671 unsigned int neighbor_dim =
neighbor->dim();
1676 FEBase & fe_neighbor = *it.second;
1677 FEType fe_type = it.first;
1680 fe_neighbor.reinit(
neighbor, &reference_points);
1684 fesd.
_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_neighbor.get_phi()));
1686 const_cast<std::vector<std::vector<RealGradient>
> &>(fe_neighbor.get_dphi()));
1689 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_neighbor.get_d2phi()));
1693 FEVectorBase & fe_neighbor = *it.second;
1694 const FEType & fe_type = it.first;
1700 fe_neighbor.reinit(
neighbor, &reference_points);
1702 fesd.
_phi.shallowCopy(
1703 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_neighbor.get_phi()));
1705 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_neighbor.get_dphi()));
1708 const_cast<std::vector<std::vector<TypeNTensor<3, Real>
>> &>(fe_neighbor.get_d2phi()));
1711 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_neighbor.get_curl_phi()));
1714 const_cast<std::vector<std::vector<Real>
> &>(fe_neighbor.get_div_phi()));
1726 unsigned int neighbor_dim =
neighbor->dim();
1728 "Neighbor subdomain ID has not been correctly set");
1732 neighbor_rule->
setPoints(reference_points);
1737 "current neighbor subdomain has been set incorrectly");
1746 fe.attach_quadrature_rule(qrule);
1749 const std::vector<Real> &
JxW = fe.get_JxW();
1751 q_points.
shallowCopy(
const_cast<std::vector<Point> &
>(fe.get_xyz()));
1756 for (
unsigned int qp = 0; qp < qrule->n_points(); qp++)
1761 for (
auto i : make_range(n))
1766template <
typename Po
ints,
typename Coords>
1769 const Points & q_points,
1774 mooseAssert(qrule,
"The quadrature rule is null in Assembly::setCoordinateTransformation");
1775 auto n_points = qrule->n_points();
1776 mooseAssert(n_points == q_points.size(),
1777 "The number of points in the quadrature rule doesn't match the number of passed-in "
1778 "points in Assembly::setCoordinateTransformation");
1785 coord.resize(n_points);
1786 for (
unsigned int qp = 0; qp < n_points; qp++)
1834 "current subdomain has been set incorrectly");
1848 unsigned int elem_dimension =
elem->dim();
1861 "current subdomain has been set incorrectly");
1875 "current subdomain has been set incorrectly");
1901 "current subdomain has been set incorrectly");
1925 "Our finite volume quadrature rule should always yield a single point");
1933 const auto & ref_point = ref_points[0];
1940 "current neighbor subdomain has been set incorrectly");
1962 return qruleFaceHelper<ArbitraryQuadrature>(
1969 const auto elem_dimension =
elem->dim();
1982 "current subdomain has been set incorrectly");
1996Assembly::reinit(
const Elem * elem,
unsigned int side,
const std::vector<Point> & reference_points)
2001 "current subdomain has been set incorrectly");
2033 const Elem * neighbor,
2034 unsigned int neighbor_side,
2035 const std::vector<Point> * neighbor_reference_points)
2041 unsigned int neighbor_dim =
neighbor->dim();
2043 if (neighbor_reference_points)
2057 unsigned int elem_side,
2059 const std::vector<Point> *
const pts,
2060 const std::vector<Real> *
const weights)
2064 unsigned int elem_dim =
elem->dim();
2070 face_rule->setPoints(*pts);
2081 for (
const auto & it :
_fe_face[elem_dim])
2083 FEBase & fe_face = *it.second;
2084 FEType fe_type = it.first;
2087 fe_face.reinit(
elem, elem_side, tolerance, pts, weights);
2091 fesd.
_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_face.get_phi()));
2093 const_cast<std::vector<std::vector<RealGradient>
> &>(fe_face.get_dphi()));
2096 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face.get_d2phi()));
2100 FEVectorBase & fe_face = *it.second;
2101 const FEType & fe_type = it.first;
2107 fe_face.reinit(
elem, elem_side, tolerance, pts, weights);
2109 fesd.
_phi.shallowCopy(
2110 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face.get_phi()));
2112 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face.get_dphi()));
2115 const_cast<std::vector<std::vector<TypeNTensor<3, Real>
>> &>(fe_face.get_d2phi()));
2118 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face.get_curl_phi()));
2121 const_cast<std::vector<std::vector<Real>
> &>(fe_face.get_div_phi()));
2167 const std::vector<Real> dummy_qw(n_qp, 1.);
2169 for (
unsigned int qp = 0; qp != n_qp; qp++)
2174 for (
unsigned qp = 0; qp < n_qp; ++qp)
2180 for (
unsigned qp = 0; qp < n_qp; ++qp)
2183 for (
unsigned qp = 0; qp < n_qp; ++qp)
2189 FEBase & fe = *it.second;
2190 auto fe_type = it.first;
2191 auto num_shapes = FEInterface::n_shape_functions(fe_type, &
elem);
2194 grad_phi.resize(num_shapes);
2195 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
2196 grad_phi[i].resize(n_qp);
2203 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
2204 for (
unsigned qp = 0; qp < n_qp; ++qp)
2205 grad_phi[i][qp] = regular_grad_phi[i][qp];
2209 FEVectorBase & fe = *it.second;
2210 auto fe_type = it.first;
2211 auto num_shapes = FEInterface::n_shape_functions(fe_type, &
elem);
2214 grad_phi.resize(num_shapes);
2215 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
2216 grad_phi[i].resize(n_qp);
2223 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
2224 for (
unsigned qp = 0; qp < n_qp; ++qp)
2225 grad_phi[i][qp] = regular_grad_phi[i][qp];
2232 unsigned int neighbor_side,
2234 const std::vector<Point> *
const pts,
2235 const std::vector<Real> *
const weights)
2239 unsigned int neighbor_dim =
neighbor->dim();
2255 FEBase & fe_face_neighbor = *it.second;
2256 FEType fe_type = it.first;
2259 fe_face_neighbor.reinit(
neighbor, neighbor_side, tolerance, pts, weights);
2263 fesd.
_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_face_neighbor.get_phi()));
2265 const_cast<std::vector<std::vector<RealGradient>
> &>(fe_face_neighbor.get_dphi()));
2268 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face_neighbor.get_d2phi()));
2272 FEVectorBase & fe_face_neighbor = *it.second;
2273 const FEType & fe_type = it.first;
2279 fe_face_neighbor.reinit(
neighbor, neighbor_side, tolerance, pts, weights);
2281 fesd.
_phi.shallowCopy(
2282 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face_neighbor.get_phi()));
2284 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face_neighbor.get_dphi()));
2286 fesd.
_second_phi.shallowCopy(
const_cast<std::vector<std::vector<TypeNTensor<3, Real>
>> &>(
2287 fe_face_neighbor.get_d2phi()));
2289 fesd.
_curl_phi.shallowCopy(
const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(
2290 fe_face_neighbor.get_curl_phi()));
2293 const_cast<std::vector<std::vector<Real>
> &>(fe_face_neighbor.get_div_phi()));
2298 "We should be in bounds here");
2300 neighbor, neighbor_side, tolerance, pts, weights);
2310 const std::vector<Point> & pts,
2311 const std::vector<Real> & JxW)
2313 const unsigned int elem_dim =
elem->dim();
2315 "Dual shape functions should only be computed on lower dimensional face elements");
2317 for (
const auto & it :
_fe_lower[elem_dim])
2319 FEBase & fe_lower = *it.second;
2321 fe_lower.set_calculate_default_dual_coeff(
false);
2322 fe_lower.reinit_dual_shape_coeffs(
elem, pts,
JxW);
2328 const std::vector<Point> *
const pts,
2329 const std::vector<Real> *
const weights)
2333 const unsigned int elem_dim =
elem->dim();
2335 "The lower dimensional element should truly be a lower dimensional element");
2353 for (
const auto & it :
_fe_lower[elem_dim])
2355 FEBase & fe_lower = *it.second;
2356 FEType fe_type = it.first;
2358 fe_lower.reinit(
elem);
2362 fesd->_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_lower.get_phi()));
2363 fesd->_grad_phi.shallowCopy(
2364 const_cast<std::vector<std::vector<RealGradient>
> &>(fe_lower.get_dphi()));
2366 fesd->_second_phi.shallowCopy(
2367 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_lower.get_d2phi()));
2373 fesd->_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_lower.get_dual_phi()));
2374 fesd->_grad_phi.shallowCopy(
2375 const_cast<std::vector<std::vector<RealGradient>
> &>(fe_lower.get_dual_dphi()));
2377 fesd->_second_phi.shallowCopy(
2378 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_lower.get_dual_d2phi()));
2390 if (pts && !weights)
2408 const auto & physical_q_points = helper_fe.get_xyz();
2409 const auto &
JxW = helper_fe.get_JxW();
2423 "You should be calling reinitNeighborLowerDElem on a lower dimensional element");
2444 "You should be calling reinitMortarElem on a lower dimensional element");
2456 unsigned int neighbor_side,
2457 const std::vector<Point> & physical_points)
2459 unsigned int neighbor_dim =
neighbor->dim();
2465 physical_points.size() == 1,
2466 "If reinitializing with more than one point, then I am dubious of your use case. Perhaps "
2467 "you are performing a DG type method and you are reinitializing using points from the "
2468 "element face. In such a case your neighbor JxW must have its index order 'match' the "
2469 "element JxW index order, e.g. imagining a vertical 1D face with two quadrature points, "
2471 "index 0 for elem JxW corresponds to the 'top' quadrature point, then index 0 for "
2473 "JxW must also correspond to the 'top' quadrature point. And libMesh/MOOSE has no way to "
2474 "guarantee that with multiple quadrature points.");
2492 const std::vector<Point> & physical_points)
2494 unsigned int neighbor_dim =
neighbor->dim();
2518 for (
auto & ivar :
vars)
2520 auto i = ivar->number();
2525 for (
unsigned int k = 0; k < ivar->count(); ++k)
2527 unsigned int iv = i + k;
2528 for (
const auto & j :
libMesh::ConstCouplingRow(iv, *
_cm))
2539 auto pair = std::make_pair(ivar, &jvar);
2540 auto c = ivar_start;
2542 bool has_pair =
false;
2555 if (i != jvar.number())
2566 for (
auto & ivar : scalar_vars)
2568 auto i = ivar->number();
2572 for (
const auto & j :
libMesh::ConstCouplingRow(i, *
_cm))
2573 if (
_sys.isScalarVariable(j))
2590 _sub_Re.resize(num_vector_tags);
2591 _sub_Rn.resize(num_vector_tags);
2592 _sub_Rl.resize(num_vector_tags);
2626 for (MooseIndex(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
2643 for (MooseIndex(n_vars) i = 0; i <
n_vars; ++i)
2692 for (
auto & ivar :
vars)
2694 auto i = ivar->number();
2696 for (
unsigned int k = 0; k < ivar->count(); ++k)
2698 unsigned int iv = i + k;
2703 auto pair = std::make_pair(ivar, &jvar);
2704 auto c = ivar_start;
2706 bool has_pair =
false;
2728 unsigned int vi = ivar.
number();
2729 unsigned int vj = jvar.
number();
2733 if (array_block_diagonal_purely_diagonal)
2734 num_cols /= jvar.
count();
2748 for (
const auto & var :
vars)
2750 tag_Re[var->number()].resize(var->dofIndices().size());
2768 unsigned int vi = ivar.
number();
2769 unsigned int vj = jvar.
number();
2773 if (array_block_diagonal_purely_diagonal)
2774 num_cols /= jvar.
count();
2794 unsigned int vi = ivar.
number();
2795 unsigned int vj = jvar.
number();
2799 if (array_block_diagonal_purely_diagonal)
2800 num_cols /= jvar.
count();
2824 unsigned int vi = ivar.
number();
2825 unsigned int vj = jvar.
number();
2829 if (array_block_diagonal_purely_diagonal)
2830 num_cols /= jvar.
count();
2854 unsigned int vi = ivar.
number();
2855 unsigned int vj = jvar.
number();
2858 const auto dofs_divisor = array_block_diagonal_purely_diagonal ? jvar.
count() : 1;
2879 for (
const auto & var :
vars)
2881 tag_Rn[var->number()].resize(var->dofIndicesNeighbor().size());
2892 unsigned int vi = ivar.
number();
2893 unsigned int vj = jvar.
number();
2896 const auto dofs_divisor = array_block_diagonal_purely_diagonal ? jvar.
count() : 1;
2931 for (
const auto & var :
vars)
2933 tag_Rl[var->number()].resize(var->dofIndicesLower().size());
2939 const std::vector<dof_id_type> & dof_indices)
2943 const unsigned int ivn = iv.
number();
2944 const unsigned int jvn = jv.number();
2945 const unsigned int icount = iv.count();
2946 unsigned int jcount = jv.count();
2953 .resize(dof_indices.size() * icount, dof_indices.size() * jcount);
2958 tag_Re[ivn].resize(dof_indices.size() * icount);
2964 const std::vector<dof_id_type> & idof_indices,
2965 const std::vector<dof_id_type> & jdof_indices)
2969 const unsigned int ivn = iv.
number();
2970 const unsigned int jvn = jv.number();
2971 const unsigned int icount = iv.count();
2972 unsigned int jcount = jv.count();
2981 .resize(idof_indices.size() * icount, jdof_indices.size() * jcount);
2991 for (
const auto & ivar :
vars)
2993 auto idofs = ivar->dofIndices().size();
2996 tag_Re[ivar->number()].resize(idofs);
2998 for (
const auto & jvar :
vars)
3000 auto jdofs = jvar->dofIndices().size();
3017 for (
const auto & ivar : scalar_vars)
3019 auto idofs = ivar->dofIndices().size();
3021 for (
const auto & jvar :
vars)
3023 auto jdofs = jvar->dofIndices().size() * jvar->count();
3036template <
typename T>
3040 phi(v).shallowCopy(v.
phi());
3064 if (v.computingCurl())
3065 curlPhi(v).shallowCopy(v.curlPhi());
3066 if (v.computingDiv())
3067 divPhi(v).shallowCopy(v.divPhi());
3070 mooseError(
"Unsupported variable field type!");
3073template <
typename T>
3101 if (v.computingCurl())
3103 if (v.computingDiv())
3107 mooseError(
"Unsupported variable field type!");
3110template <
typename T>
3151 mooseError(
"Unsupported variable field type!");
3154DenseMatrix<Number> &
3195DenseMatrix<Number> &
3257 std::vector<dof_id_type> & dof_indices,
3258 const std::vector<Real> & scaling_factor)
3260 mooseAssert(res_block.size() == dof_indices.size(),
3261 "The size of residual and degree of freedom container must be the same");
3266 const auto ntdof = res_block.size();
3267 const auto count = scaling_factor.size();
3268 const auto ndof = ntdof /
count;
3272 for (MooseIndex(
count) j = 0; j <
count; ++j)
3273 for (MooseIndex(ndof) i = 0; i < ndof; ++i)
3274 res_block(p++) *= scaling_factor[j];
3278 if (scaling_factor[0] != 1.0)
3279 res_block *= scaling_factor[0];
3287 DenseVector<Number> & res_block,
3288 const std::vector<dof_id_type> & dof_indices,
3289 const std::vector<Real> & scaling_factor)
3291 if (dof_indices.size() > 0 && res_block.size())
3302 std::vector<dof_id_type> & cached_residual_rows,
3303 DenseVector<Number> & res_block,
3304 const std::vector<dof_id_type> & dof_indices,
3305 const std::vector<Real> & scaling_factor)
3307 if (dof_indices.size() > 0 && res_block.size())
3315 cached_residual_values.push_back(
_tmp_Re(i));
3325 DenseVector<Number> & res_block,
3326 const std::vector<dof_id_type> & dof_indices,
3327 const std::vector<Real> & scaling_factor)
3329 if (dof_indices.size() > 0)
3331 std::vector<dof_id_type> di(dof_indices);
3342 "Non-residual tag in Assembly::addResidual");
3347 for (
const auto & var :
vars)
3348 addResidualBlock(residual, tag_Re[var->number()], var->dofIndices(), var->arrayScalingFactor());
3354 for (
const auto & vector_tag : vector_tags)
3363 "Non-residual tag in Assembly::addResidualNeighbor");
3368 for (
const auto & var :
vars)
3370 residual, tag_Rn[var->number()], var->dofIndicesNeighbor(), var->arrayScalingFactor());
3376 for (
const auto & vector_tag : vector_tags)
3385 "Non-residual tag in Assembly::addResidualLower");
3390 for (
const auto & var :
vars)
3392 residual, tag_Rl[var->number()], var->dofIndicesLower(), var->arrayScalingFactor());
3398 for (
const auto & vector_tag : vector_tags)
3408 "Non-residual tag in Assembly::addResidualScalar");
3414 for (
const auto & var :
vars)
3415 addResidualBlock(residual, tag_Re[var->number()], var->dofIndices(), var->arrayScalingFactor());
3421 for (
const auto & vector_tag : vector_tags)
3430 for (
const auto & var :
vars)
3431 for (
const auto & vector_tag : tags)
3435 _sub_Re[vector_tag._type_id][var->number()],
3437 var->arrayScalingFactor());
3454 for (
auto & tag : tags)
3460 const std::vector<dof_id_type> & dof_index,
3469 for (MooseIndex(dof_index) i = 0; i < dof_index.size(); ++i)
3480 for (
const auto & var :
vars)
3481 for (
const auto & vector_tag : tags)
3485 _sub_Rn[vector_tag._type_id][var->number()],
3486 var->dofIndicesNeighbor(),
3487 var->arrayScalingFactor());
3494 for (
const auto & var :
vars)
3495 for (
const auto & vector_tag : tags)
3499 _sub_Rl[vector_tag._type_id][var->number()],
3500 var->dofIndicesLower(),
3501 var->arrayScalingFactor());
3507 for (
const auto & vector_tag : tags)
3533 mooseAssert(
values.size() == rows.size(),
3534 "Number of cached residuals and number of rows must match!");
3557 mooseAssert(
values.size() == rows.size(),
3558 "Number of cached residuals and number of rows must match!");
3562 residual.add_vector(
values, rows);
3572 for (
const auto & var :
vars)
3573 setResidualBlock(residual, tag_Re[var->number()], var->dofIndices(), var->arrayScalingFactor());
3583 for (
const auto & var :
vars)
3585 residual, tag_Rn[var->number()], var->dofIndicesNeighbor(), var->arrayScalingFactor());
3591 DenseMatrix<Number> & jac_block,
3594 const std::vector<dof_id_type> & idof_indices,
3595 const std::vector<dof_id_type> & jdof_indices)
3597 if (idof_indices.size() == 0 || jdof_indices.size() == 0)
3599 if (jac_block.n() == 0 || jac_block.m() == 0)
3603 const unsigned int iv = ivar.
number();
3604 const unsigned int jv = jvar.
number();
3606 for (
unsigned int i = 0; i < ivar.
count(); ++i)
3610 if (jt < jv || jt >= jv + jvar.
count())
3612 unsigned int j = jt - jv;
3616 auto indof = di.size();
3617 auto jndof = dj.size();
3619 unsigned int jj = j;
3624 auto sub = jac_block.sub_matrix(i * indof, indof, jj * jndof, jndof);
3625 if (scaling_factors[i] != 1.0)
3626 sub *= scaling_factors[i];
3634 jacobian.add_matrix(sub, di, dj);
3644 const std::vector<dof_id_type> & idof_indices,
3645 const std::vector<dof_id_type> & jdof_indices,
3648 if (idof_indices.size() == 0 || jdof_indices.size() == 0)
3650 if (jac_block.n() == 0 || jac_block.m() == 0)
3656 const unsigned int iv = ivar.
number();
3657 const unsigned int jv = jvar.
number();
3659 for (
unsigned int i = 0; i < ivar.
count(); ++i)
3663 if (jt < jv || jt >= jv + jvar.
count())
3665 unsigned int j = jt - jv;
3669 auto indof = di.size();
3670 auto jndof = dj.size();
3672 unsigned int jj = j;
3677 auto sub = jac_block.sub_matrix(i * indof, indof, jj * jndof, jndof);
3678 if (scaling_factors[i] != 1.0)
3679 sub *= scaling_factors[i];
3687 for (MooseIndex(di) i = 0; i < di.size(); i++)
3688 for (MooseIndex(dj) j = 0; j < dj.size(); j++)
3703 const std::vector<dof_id_type> & idof_indices,
3704 const std::vector<dof_id_type> & jdof_indices,
3707 if (idof_indices.size() == 0 || jdof_indices.size() == 0)
3709 if (jac_block.n() == 0 || jac_block.m() == 0)
3716 for (
unsigned int i = 0; i < ivar.
count(); ++i)
3718 unsigned int iv = ivar.
number();
3721 unsigned int jv = jvar.
number();
3722 if (jt < jv || jt >= jv + jvar.
count())
3724 unsigned int j = jt - jv;
3728 auto indof = di.size();
3729 auto jndof = dj.size();
3731 unsigned int jj = j;
3736 auto sub = jac_block.sub_matrix(i * indof, indof, jj * jndof, jndof);
3737 if (scaling_factor[i] != 1.0)
3738 sub *= scaling_factor[i];
3742 for (MooseIndex(di) i = 0; i < di.size(); i++)
3743 for (MooseIndex(dj) j = 0; j < dj.size(); j++)
3744 if (sub(i, j) != 0.0)
3757 const std::vector<dof_id_type> & idof_indices,
3758 const std::vector<dof_id_type> & jdof_indices,
3759 Real scaling_factor,
3761 const std::set<TagID> & tags)
3763 const auto has_matrix =
3764 std::any_of(tags.begin(), tags.end(), [
this](
const auto tag) { return _sys.hasMatrix(tag); });
3768 if ((idof_indices.size() > 0) && (jdof_indices.size() > 0) && jac_block.n() && jac_block.m() &&
3771 _row_indices.assign(idof_indices.begin(), idof_indices.end());
3781 if (scaling_factor != 1.0)
3794 FEType fe_type(
elem->default_order(), LAGRANGE);
3795 std::unique_ptr<FEBase> fe(FEBase::build(
elem->dim(), fe_type));
3798 const std::vector<Real> &
JxW = fe->get_JxW();
3799 const std::vector<Point> & q_points = fe->get_xyz();
3803 QGauss qrule(
elem->dim(), fe_type.default_quadrature_order());
3804 fe->attach_quadrature_rule(&qrule);
3809 mooseAssert(qrule.n_points() == q_points.size(),
3810 "The number of points in the quadrature rule doesn't match the number of passed-in "
3811 "points in Assembly::setCoordinateTransformation");
3815 for (
unsigned int qp = 0; qp < qrule.n_points(); ++qp)
3819 vol +=
JxW[qp] * coord;
3828 const ADRealEigenVector & v)
const
3830 for (
unsigned int j = 0; j < v.size(); ++j, i += ntest)
3841 "Error: Cached data sizes MUST be the same!");
3844 "Error: Cached data sizes MUST be the same for a given tag!");
3909 auto ivar = it.first;
3910 auto jvar = it.second;
3911 auto i = ivar->number();
3912 auto j = jvar->number();
3922 jvar->allDofIndices());
3931 auto ivar = it.first;
3932 auto jvar = it.second;
3933 auto i = ivar->number();
3934 auto j = jvar->number();
3945 jvar->dofIndicesNeighbor());
3951 ivar->dofIndicesNeighbor(),
3952 jvar->dofIndices());
3958 ivar->dofIndicesNeighbor(),
3959 jvar->dofIndicesNeighbor());
3969 auto ivar = it.first;
3970 auto jvar = it.second;
3971 auto i = ivar->number();
3972 auto j = jvar->number();
3981 ivar->dofIndicesLower(),
3982 jvar->dofIndicesLower());
3988 ivar->dofIndicesLower(),
3989 jvar->dofIndicesNeighbor());
3995 ivar->dofIndicesLower(),
3996 jvar->dofIndices());
4002 ivar->dofIndicesNeighbor(),
4003 jvar->dofIndicesLower());
4010 jvar->dofIndicesLower());
4023 jvar->dofIndicesNeighbor());
4029 ivar->dofIndicesNeighbor(),
4030 jvar->dofIndices());
4036 ivar->dofIndicesNeighbor(),
4037 jvar->dofIndicesNeighbor());
4047 auto ivar = it.first;
4048 auto jvar = it.second;
4049 auto i = ivar->number();
4050 auto j = jvar->number();
4059 ivar->dofIndicesLower(),
4060 jvar->dofIndicesLower());
4066 ivar->dofIndicesLower(),
4067 jvar->dofIndices());
4074 jvar->dofIndicesLower());
4114 auto ivar = it.first;
4115 auto jvar = it.second;
4116 auto i = ivar->number();
4117 auto j = jvar->number();
4126 jvar->allDofIndices(),
4136 auto ivar = it.first;
4137 auto jvar = it.second;
4138 auto i = ivar->number();
4139 auto j = jvar->number();
4150 jvar->dofIndicesNeighbor(),
4155 ivar->dofIndicesNeighbor(),
4162 ivar->dofIndicesNeighbor(),
4163 jvar->dofIndicesNeighbor(),
4174 auto ivar = it.first;
4175 auto jvar = it.second;
4176 auto i = ivar->number();
4177 auto j = jvar->number();
4185 ivar->dofIndicesLower(),
4186 jvar->dofIndicesLower(),
4192 ivar->dofIndicesLower(),
4199 ivar->dofIndicesLower(),
4200 jvar->dofIndicesNeighbor(),
4207 jvar->dofIndicesLower(),
4222 jvar->dofIndicesNeighbor(),
4228 ivar->dofIndicesNeighbor(),
4229 jvar->dofIndicesLower(),
4235 ivar->dofIndicesNeighbor(),
4242 ivar->dofIndicesNeighbor(),
4243 jvar->dofIndicesNeighbor(),
4253 const DofMap & dof_map,
4254 std::vector<dof_id_type> & dof_indices,
4256 const std::set<TagID> & tags)
4258 for (
auto tag : tags)
4266 const DofMap & dof_map,
4267 std::vector<dof_id_type> & dof_indices,
4271 if (dof_indices.size() == 0)
4273 if (!(*
_cm)(ivar, jvar))
4280 const unsigned int ivn = iv.number();
4281 const unsigned int jvn = jv.number();
4290 const unsigned int i = ivar - ivn;
4291 const unsigned int j = jvar - jvn;
4294 auto di = dof_indices;
4295 auto dj = dof_indices;
4297 auto indof = di.size();
4298 auto jndof = dj.size();
4300 unsigned int jj = j;
4304 auto sub = ke.
sub_matrix(i * indof, indof, jj * jndof, jndof);
4309 dof_map.constrain_element_matrix(sub, di, dj,
false);
4311 if (scaling_factor[i] != 1.0)
4312 sub *= scaling_factor[i];
4314 jacobian.add_matrix(sub, di, dj);
4319 const unsigned int ivar,
4320 const unsigned int jvar,
4321 const DofMap & dof_map,
4322 const std::vector<dof_id_type> & idof_indices,
4323 const std::vector<dof_id_type> & jdof_indices,
4327 if (idof_indices.size() == 0 || jdof_indices.size() == 0)
4329 if (jacobian.n() == 0 || jacobian.m() == 0)
4331 if (!(*
_cm)(ivar, jvar))
4338 const unsigned int ivn = iv.number();
4339 const unsigned int jvn = jv.number();
4348 const unsigned int i = ivar - ivn;
4349 const unsigned int j = jvar - jvn;
4352 auto di = idof_indices;
4353 auto dj = jdof_indices;
4355 auto indof = di.size();
4356 auto jndof = dj.size();
4358 unsigned int jj = j;
4362 auto sub = keg.
sub_matrix(i * indof, indof, jj * jndof, jndof);
4367 dof_map.constrain_element_matrix(sub, di, dj,
false);
4369 if (scaling_factor[i] != 1.0)
4370 sub *= scaling_factor[i];
4372 jacobian.add_matrix(sub, di, dj);
4377 const unsigned int ivar,
4378 const unsigned int jvar,
4379 const DofMap & dof_map,
4380 const std::vector<dof_id_type> & idof_indices,
4381 const std::vector<dof_id_type> & jdof_indices,
4383 const std::set<TagID> & tags)
4385 for (
auto tag : tags)
4387 jacobian, ivar, jvar, dof_map, idof_indices, jdof_indices,
GlobalDataKey{}, tag);
4392 const unsigned int ivar,
4393 const unsigned int jvar,
4394 const DofMap & dof_map,
4395 std::vector<dof_id_type> & dof_indices,
4396 std::vector<dof_id_type> & neighbor_dof_indices,
4400 if (dof_indices.size() == 0 && neighbor_dof_indices.size() == 0)
4402 if (!(*
_cm)(ivar, jvar))
4409 const unsigned int ivn = iv.number();
4410 const unsigned int jvn = jv.number();
4421 const unsigned int i = ivar - ivn;
4422 const unsigned int j = jvar - jvn;
4424 auto dc = dof_indices;
4425 auto dn = neighbor_dof_indices;
4426 auto cndof = dc.size();
4427 auto nndof = dn.size();
4429 unsigned int jj = j;
4433 auto suben = ken.
sub_matrix(i * cndof, cndof, jj * nndof, nndof);
4434 auto subne = kne.
sub_matrix(i * nndof, nndof, jj * cndof, cndof);
4435 auto subnn = knn.
sub_matrix(i * nndof, nndof, jj * nndof, nndof);
4442 dof_map.constrain_element_matrix(suben, dc, dn,
false);
4443 dof_map.constrain_element_matrix(subne, dn, dc,
false);
4444 dof_map.constrain_element_matrix(subnn, dn, dn,
false);
4447 if (scaling_factor[i] != 1.0)
4449 suben *= scaling_factor[i];
4450 subne *= scaling_factor[i];
4451 subnn *= scaling_factor[i];
4454 jacobian.add_matrix(suben, dc, dn);
4455 jacobian.add_matrix(subne, dn, dc);
4456 jacobian.add_matrix(subnn, dn, dn);
4461 const unsigned int ivar,
4462 const unsigned int jvar,
4463 const DofMap & dof_map,
4464 std::vector<dof_id_type> & dof_indices,
4465 std::vector<dof_id_type> & neighbor_dof_indices,
4467 const std::set<TagID> & tags)
4469 for (
const auto tag : tags)
4471 jacobian, ivar, jvar, dof_map, dof_indices, neighbor_dof_indices,
GlobalDataKey{}, tag);
4485 if (it.first->number() == ivar)
4491 numeric_index_type i, numeric_index_type j, Real value,
LocalDataKey,
TagID tag)
4500 numeric_index_type j,
4503 const std::set<TagID> & tags)
4505 for (
auto tag : tags)
4554 mooseAssert(
_xfem !=
nullptr,
"This function should not be called if xfem is inactive");
4563 "Size of weight multipliers in xfem doesn't match number of quadrature points");
4564 for (
unsigned i = 0; i < xfem_weight_multipliers.
size(); i++)
4567 xfem_weight_multipliers.
release();
4574 mooseAssert(
_xfem !=
nullptr,
"This function should not be called if xfem is inactive");
4580 if (
_xfem->getXFEMFaceWeights(
4584 "Size of weight multipliers in xfem doesn't match number of quadrature points");
4585 for (
unsigned i = 0; i < xfem_face_weight_multipliers.
size(); i++)
4588 xfem_face_weight_multipliers.
release();
4604 for (MooseIndex(weights.size()) i = 0; i < weights.size(); ++i)
4610Assembly::fePhi<VectorValue<Real>>(FEType type)
const
4612 buildVectorFE(type);
4613 return _vector_fe_shape_data[type]->_phi;
4618Assembly::feGradPhi<VectorValue<Real>>(FEType type)
const
4620 buildVectorFE(type);
4621 return _vector_fe_shape_data[type]->_grad_phi;
4626Assembly::feSecondPhi<VectorValue<Real>>(FEType type)
const
4628 _need_second_derivative.insert(type);
4629 buildVectorFE(type);
4630 return _vector_fe_shape_data[type]->_second_phi;
4635Assembly::fePhiLower<VectorValue<Real>>(FEType type)
const
4637 buildVectorLowerDFE(type);
4638 return _vector_fe_shape_data_lower[type]->_phi;
4643Assembly::feDualPhiLower<VectorValue<Real>>(FEType type)
const
4645 buildVectorDualLowerDFE(type);
4646 return _vector_fe_shape_data_dual_lower[type]->_phi;
4651Assembly::feGradPhiLower<VectorValue<Real>>(FEType type)
const
4653 buildVectorLowerDFE(type);
4654 return _vector_fe_shape_data_lower[type]->_grad_phi;
4659Assembly::feGradDualPhiLower<VectorValue<Real>>(FEType type)
const
4661 buildVectorDualLowerDFE(type);
4662 return _vector_fe_shape_data_dual_lower[type]->_grad_phi;
4667Assembly::fePhiFace<VectorValue<Real>>(FEType type)
const
4669 buildVectorFaceFE(type);
4670 return _vector_fe_shape_data_face[type]->_phi;
4675Assembly::feGradPhiFace<VectorValue<Real>>(FEType type)
const
4677 buildVectorFaceFE(type);
4678 return _vector_fe_shape_data_face[type]->_grad_phi;
4683Assembly::feSecondPhiFace<VectorValue<Real>>(FEType type)
const
4685 _need_second_derivative.insert(type);
4686 buildVectorFaceFE(type);
4691 buildVectorFaceNeighborFE(type);
4693 return _vector_fe_shape_data_face[type]->_second_phi;
4698Assembly::fePhiNeighbor<VectorValue<Real>>(FEType type)
const
4700 buildVectorNeighborFE(type);
4701 return _vector_fe_shape_data_neighbor[type]->_phi;
4706Assembly::feGradPhiNeighbor<VectorValue<Real>>(FEType type)
const
4708 buildVectorNeighborFE(type);
4709 return _vector_fe_shape_data_neighbor[type]->_grad_phi;
4714Assembly::feSecondPhiNeighbor<VectorValue<Real>>(FEType type)
const
4716 _need_second_derivative_neighbor.insert(type);
4717 buildVectorNeighborFE(type);
4718 return _vector_fe_shape_data_neighbor[type]->_second_phi;
4723Assembly::fePhiFaceNeighbor<VectorValue<Real>>(FEType type)
const
4725 buildVectorFaceNeighborFE(type);
4726 return _vector_fe_shape_data_face_neighbor[type]->_phi;
4731Assembly::feGradPhiFaceNeighbor<VectorValue<Real>>(FEType type)
const
4733 buildVectorFaceNeighborFE(type);
4734 return _vector_fe_shape_data_face_neighbor[type]->_grad_phi;
4739Assembly::feSecondPhiFaceNeighbor<VectorValue<Real>>(FEType type)
const
4741 _need_second_derivative_neighbor.insert(type);
4742 buildVectorFaceNeighborFE(type);
4743 return _vector_fe_shape_data_face_neighbor[type]->_second_phi;
4748Assembly::feCurlPhi<VectorValue<Real>>(FEType type)
const
4750 _need_curl.insert(type);
4751 buildVectorFE(type);
4752 return _vector_fe_shape_data[type]->_curl_phi;
4757Assembly::feCurlPhiFace<VectorValue<Real>>(FEType type)
const
4759 _need_curl.insert(type);
4760 buildVectorFaceFE(type);
4765 buildVectorFaceNeighborFE(type);
4767 return _vector_fe_shape_data_face[type]->_curl_phi;
4772Assembly::feCurlPhiNeighbor<VectorValue<Real>>(FEType type)
const
4774 _need_curl.insert(type);
4775 buildVectorNeighborFE(type);
4776 return _vector_fe_shape_data_neighbor[type]->_curl_phi;
4781Assembly::feCurlPhiFaceNeighbor<VectorValue<Real>>(FEType type)
const
4783 _need_curl.insert(type);
4784 buildVectorFaceNeighborFE(type);
4786 return _vector_fe_shape_data_face_neighbor[type]->_curl_phi;
4791Assembly::feDivPhi<VectorValue<Real>>(FEType type)
const
4793 _need_div.insert(type);
4794 buildVectorFE(type);
4795 return _vector_fe_shape_data[type]->_div_phi;
4800Assembly::feDivPhiFace<VectorValue<Real>>(FEType type)
const
4802 _need_face_div.insert(type);
4803 buildVectorFaceFE(type);
4808 buildVectorFaceNeighborFE(type);
4810 return _vector_fe_shape_data_face[type]->_div_phi;
4815Assembly::feDivPhiNeighbor<VectorValue<Real>>(FEType type)
const
4817 _need_neighbor_div.insert(type);
4818 buildVectorNeighborFE(type);
4819 return _vector_fe_shape_data_neighbor[type]->_div_phi;
4824Assembly::feDivPhiFaceNeighbor<VectorValue<Real>>(FEType type)
const
4826 _need_face_neighbor_div.insert(type);
4827 buildVectorFaceNeighborFE(type);
4828 return _vector_fe_shape_data_face_neighbor[type]->_div_phi;
4883 auto process_fe_and_helpers = [&helper_type](
auto & unique_helper_container,
4884 auto & helper_container,
4885 const unsigned int num_dimensionalities,
4886 const bool user_added_helper_type,
4887 auto & fe_container)
4889 unique_helper_container.
resize(num_dimensionalities);
4890 for (
const auto dim : make_range(num_dimensionalities))
4892 auto & unique_helper = unique_helper_container[
dim];
4893 unique_helper = FEGenericBase<Real>::build(
dim, helper_type);
4895 unique_helper->add_p_level_in_reinit(
false);
4896 helper_container[
dim] = unique_helper.get();
4900 if (!user_added_helper_type)
4902 auto & fe_container_dim = libmesh_map_find(fe_container,
dim);
4903 auto fe_it = fe_container_dim.find(helper_type);
4904 mooseAssert(fe_it != fe_container_dim.end(),
"We should have the helper type");
4905 delete fe_it->second;
4906 fe_container_dim.erase(fe_it);
4945 const Point & point,
4955 const Point & point,
4966Assembly::genericQPoints<false>()
const
4973Assembly::genericQPoints<true>()
const
DualNumber< Real, DNDerivativeType, true > ADReal
template void coordTransformFactor< ADPoint, ADReal >(const SubProblem &s, SubdomainID sub_id, const ADPoint &point, ADReal &factor, SubdomainID neighbor_sub_id)
void coordTransformFactor(const SubProblem &s, const SubdomainID sub_id, const P &point, C &factor, const SubdomainID neighbor_sub_id)
Computes a conversion multiplier for use when computing integraals for the current coordinate system ...
template void coordTransformFactor< Point, Real >(const SubProblem &s, SubdomainID sub_id, const Point &point, Real &factor, SubdomainID neighbor_sub_id)
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 ...
subdomain_id_type SubdomainID
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
OutputTools< Real >::VariablePhiValue VariablePhiValue
OutputTools< Real >::VariablePhiCurl VariablePhiCurl
OutputTools< Real >::VariablePhiGradient VariablePhiGradient
typename OutputTools< typename Moose::ADType< T >::type >::VariablePhiGradient ADTemplateVariablePhiGradient
OutputTools< Real >::VariablePhiSecond VariablePhiSecond
OutputTools< Real >::VariablePhiDivergence VariablePhiDivergence
std::array< Real, 2 > values
if(!dmm->_nl) SETERRQ(PETSC_COMM_WORLD
Implements a fake quadrature rule where you can specify the locations (in the reference domain) of th...
void setWeights(const std::vector< libMesh::Real > &weights)
Set the quadrature weights.
void setPoints(const std::vector< libMesh::Point > &points)
Set the quadrature points.
VariablePhiGradient _grad_phi
VariablePhiSecond _second_phi
Key structure for APIs manipulating global vectors/matrices.
Key structure for APIs adding/caching local element residuals/Jacobians.
VectorVariablePhiValue _phi
VectorVariablePhiGradient _grad_phi
VectorVariablePhiSecond _second_phi
VectorVariablePhiCurl _curl_phi
VectorVariablePhiDivergence _div_phi
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.
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kll
dlower/dlower
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...
void cacheJacobianNonlocal(GlobalDataKey)
Takes the values that are currently in _sub_Keg and appends them to the cached values.
std::map< unsigned int, FEBase * > _holder_fe_lower_helper
helper object for transforming coordinates for lower dimensional element quadrature points
const VariablePhiSecond & secondPhiNeighbor(const MooseVariableField< Real > &) const
std::vector< std::pair< MooseVariableScalar *, MooseVariableFieldBase * > > _cm_sf_entry
Entries in the coupling matrix for scalar variables vs field variables.
void addJacobian(GlobalDataKey)
Adds all local Jacobian to the global Jacobian matrices.
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.
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...
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data
Shape function values, gradients, second derivatives for each vector FE type.
MooseArray< Point > _current_q_points
The current list of quadrature points.
const std::vector< Real > * _JxW_msm
A JxW for working on mortar segement elements.
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kee
std::set< FEType > _need_face_neighbor_div
void prepareLowerD()
Prepare the Jacobians and residuals for a lower dimensional element.
void modifyWeightsDueToXFEM(const Elem *elem)
Update the integration weights for XFEM partial elements.
void reinitFVFace(const FaceInfo &fi)
std::vector< std::vector< DenseVector< Number > > > _sub_Re
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 ...
void reinitFE(const Elem *elem)
Just an internal helper function to reinit the volume FE objects.
DenseMatrix< Number > _element_matrix
A working matrix to avoid repeated heap allocations when caching Jacobians that must have libMesh-lev...
const VariablePhiValue & phiFace() const
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 ...
MooseArray< Real > _curvatures
std::vector< std::unique_ptr< FEBase > > _unique_fe_lower_helper
MooseArray< Real > _coord_neighbor
The current coordinate transformation coefficients.
void reinitFEFaceNeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
void reinitFENeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
void prepareVariableNonlocal(MooseVariableFieldBase *var)
void prepareBlock(unsigned int ivar, unsigned jvar, const std::vector< dof_id_type > &dof_indices)
std::vector< ADReal > _ad_dzetady_map
libMesh::QBase * _current_qrule_face
quadrature rule used on faces
bool _block_diagonal_matrix
Will be true if our preconditioning matrix is a block-diagonal matrix. Which means that we can take s...
std::vector< std::vector< std::vector< unsigned char > > > _jacobian_block_neighbor_used
Flag that indicates if the jacobian block for neighbor was used.
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.
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 ...
MooseArray< VectorValue< ADReal > > _ad_q_points
bool _current_side_volume_computed
Boolean to indicate whether current element side volumes has been computed.
MooseArray< Real > _current_JxW_face
The current transformed jacobian weights on a face.
const FEType _helper_type
The finite element type of the FE helper classes.
Real _current_elem_volume
Volume of the current element.
const VectorVariablePhiDivergence & divPhi(const MooseVariableField< RealVectorValue > &) const
void cacheJacobianCoupledVarPair(const MooseVariableBase &ivar, const MooseVariableBase &jvar)
Caches element matrix for ivar rows and jvar columns.
bool _building_helpers
Whether we are currently building the FE classes for the helpers.
void addJacobianScalar(GlobalDataKey)
Add Jacobians for pairs of scalar variables into the global Jacobian matrices.
void setVolumeQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for volume integration.
const VariablePhiGradient & gradPhi() const
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.
MooseArray< Point > _current_physical_points
This will be filled up with the physical points passed into reinitAtPhysical() if it is called....
void addJacobianLowerD(GlobalDataKey)
Add portions of the Jacobian of LowerLower, LowerSecondary, and SecondaryLower for boundary condition...
libMesh::QBase * _current_qrule
The current current quadrature rule being used (could be either volumetric or arbitrary - for dirac k...
const MooseArray< Point > & qPoints() const
Returns the reference to the quadrature points.
MooseArray< VectorValue< ADReal > > _ad_normals
void addJacobianOffDiagScalar(unsigned int ivar, GlobalDataKey)
Add Jacobians for a scalar variables with all other field variables into the global Jacobian matrices...
void modifyArbitraryWeights(const std::vector< Real > &weights)
Modify the weights when using the arbitrary quadrature rule.
void computeCurrentFaceVolume()
const VariablePhiGradient & gradPhiFace() const
bool _need_JxW_neighbor
Flag to indicate that JxW_neighbor is needed.
bool _user_added_fe_of_helper_type
Whether user code requested a FEType the same as our _helper_type.
std::map< FEType, ADTemplateVariablePhiGradient< RealVectorValue > > _ad_vector_grad_phi_data
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe
Each dimension's actual vector fe objects indexed on type.
MooseArray< ADReal > _ad_JxW_face
const VariablePhiValue & phi() const
void buildFaceNeighborFE(FEType type) const
Build FEs for a neighbor face with a type.
SubdomainID _current_subdomain_id
The current subdomain ID.
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_face
const libMesh::CouplingMatrix & _nonlocal_cm
Real _current_neighbor_volume
Volume of the current neighbor.
bool _need_neighbor_lower_d_elem_volume
Whether we need to compute the neighboring lower dimensional element volume.
Moose::CoordinateSystemType _coord_type
The coordinate system.
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...
std::map< FEType, FEBase * > _current_fe_neighbor
The "neighbor" fe object that matches the current elem.
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_lower
FE objects for lower dimensional elements.
std::vector< std::vector< DenseVector< Number > > > _sub_Rn
void buildVectorNeighborFE(FEType type) const
Build Vector FEs for a neighbor with a type.
std::vector< Eigen::Map< RealDIMValue > > _mapped_normals
Mapped normals.
const libMesh::DofMap & _dof_map
DOF map.
const VariablePhiSecond & secondPhiFace(const MooseVariableField< Real > &) const
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
std::set< FEType > _need_second_derivative_neighbor
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Ken
jacobian contributions from the element and neighbor <Tag, ivar, jvar>
std::vector< VectorValue< ADReal > > _ad_dxyzdxi_map
AD quantities.
const MooseArray< ADReal > & adCurvatures() const
bool _prepared_for_p_refinement
Whether helper FEs have been prepared for p-refinement.
std::vector< std::unique_ptr< FEBase > > _unique_fe_face_neighbor_helper
std::vector< Point > _temp_reference_points
Temporary work data for reinitAtPhysical()
std::vector< std::pair< MooseVariableScalar *, MooseVariableScalar * > > _cm_ss_entry
Entries in the coupling matrix for scalar variables.
const Elem * _current_lower_d_elem
The current lower dimensional element.
unsigned int _current_side
The current side of the selected element (valid only when working with sides)
void buildNeighborFE(FEType type) const
Build FEs for a neighbor with a type.
ArbitraryQuadrature * qruleArbitraryFace(const Elem *elem, unsigned int side)
std::unordered_map< SubdomainID, std::vector< QRules > > _qrules
Holds quadrature rules for each dimension.
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.
std::map< FEType, FEVectorBase * > _current_vector_fe
The "volume" vector fe object that matches the current elem.
std::vector< VectorValue< ADReal > > _ad_dxyzdzeta_map
std::unique_ptr< FEBase > _fe_msm
A FE object for working on mortar segement elements.
std::vector< ADReal > _ad_detadx_map
void addJacobianNonlocal(GlobalDataKey)
Adds non-local Jacobian to the global Jacobian matrices.
const VariablePhiGradient & gradPhiNeighbor(const MooseVariableField< Real > &) const
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...
const Elem *const & elem() const
Return the current element.
std::map< FEType, FEVectorBase * > _current_vector_fe_face_neighbor
The "neighbor face" vector fe object that matches the current elem.
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.
const Node * _current_neighbor_node
The current neighboring node we are working with.
std::vector< ADReal > _ad_dxidx_map
void buildFE(FEType type) const
Build FEs with a type.
const Elem * _current_neighbor_side_elem
The current side element of the ncurrent neighbor element.
std::vector< ADReal > _ad_dxidz_map
void cacheResidualLower(GlobalDataKey, const std::vector< VectorTag > &tags)
Takes the values that are currently in _sub_Rl and appends them to the cached values.
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_neighbor
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kle
dlower/dsecondary (or dlower/delement)
MooseArray< ADReal > _ad_JxW
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.
void copyFaceShapes(MooseVariableField< T > &v)
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...
DenseVector< Number > _tmp_Re
auxiliary vector for scaling residuals (optimization to avoid expensive construction/destruction)
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.
bool _calculate_ad_coord
Whether to calculate coord with AD.
const libMesh::CouplingMatrix * _cm
Coupling matrices.
VectorVariablePhiCurl _vector_curl_phi_face
MooseArray< Point > _current_q_points_face
The current quadrature points on a face.
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_neighbor
void cacheJacobianNeighbor(GlobalDataKey)
Takes the values that are currently in the neighbor Dense Matrices and appends them to the cached val...
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.
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.
void setNeighborQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for neighbor integration.
void helpersRequestData()
request phi, dphi, xyz, JxW, etc.
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Knn
jacobian contributions from the neighbor <Tag, ivar, jvar>
const MooseArray< ADPoint > & adQPoints() const
void clearCachedQRules()
Set the cached quadrature rules to nullptr.
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kln
dlower/dprimary (or dlower/dneighbor)
libMesh::QBase * _current_qrule_neighbor
quadrature rule used on neighbors
void setLowerQRule(libMesh::QBase *qrule, unsigned int dim)
Set the qrule to be used for lower dimensional integration.
void buildLowerDFE(FEType type) const
Build FEs for a lower dimensional element with a type.
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.
Real elementVolume(const Elem *elem) const
On-demand computation of volume element accounting for RZ/RSpherical.
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_neighbor
types of finite elements
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
const unsigned int & side() const
Returns the current side.
std::vector< VectorValue< ADReal > > _ad_d2xyzdeta2_map
MooseArray< std::vector< Point > > _current_tangents
The current tangent vectors at the quadrature points.
std::vector< std::unique_ptr< FEBase > > _unique_fe_face_helper
std::map< FEType, FEBase * > _current_fe
The "volume" fe object that matches the current elem.
const VectorVariablePhiCurl & curlPhi(const MooseVariableField< RealVectorValue > &) const
void prepareBlockNonlocal(unsigned int ivar, unsigned jvar, const std::vector< dof_id_type > &idof_indices, const std::vector< dof_id_type > &jdof_indices)
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_lower
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...
std::vector< VectorValue< ADReal > > _ad_d2xyzdxideta_map
std::vector< std::pair< unsigned int, unsigned short > > _disp_numbers_and_directions
Container of displacement numbers and directions.
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_face
types of vector finite elements
void buildVectorLowerDFE(FEType type) const
Build Vector FEs for a lower dimensional element with a type.
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.
std::map< unsigned int, std::map< FEType, FEBase * > > _fe
Each dimension's actual fe objects indexed on type.
std::set< FEType > _need_curl
const VariablePhiSecond & secondPhiFaceNeighbor(const MooseVariableField< Real > &) const
std::vector< std::unique_ptr< FEBase > > _unique_fe_helper
Containers for holding unique FE helper types if we are doing p-refinement.
unsigned int numExtraElemIntegers() const
Number of extra element integers Assembly tracked.
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > _cm_ff_entry
Entries in the coupling matrix for field variables.
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableFieldBase * > > _cm_nonlocal_entry
Entries in the coupling matrix for field variables for nonlocal calculations.
bool _current_elem_volume_computed
Boolean to indicate whether current element volumes has been computed.
void buildLowerDDualFE(FEType type) const
void addCachedResidualDirectly(NumericVector< Number > &residual, GlobalDataKey, const VectorTag &vector_tag)
Adds the values that have been cached by calling cacheResidual(), cacheResidualNeighbor(),...
std::map< unsigned int, std::map< FEType, FEBase * > > _fe_face
types of finite elements
std::vector< ADReal > _ad_jac
void addJacobianNeighbor(GlobalDataKey)
Add ElementNeighbor, NeighborElement, and NeighborNeighbor portions of the Jacobian for compute objec...
void setMortarQRule(Order order)
Specifies a custom qrule for integration on mortar segment mesh.
void saveLocalADArray(std::vector< ADReal > &re, unsigned int i, unsigned int ntest, const ADRealEigenVector &v) const
const std::vector< VectorTag > & _residual_vector_tags
The residual vector tags that Assembly could possibly contribute to.
const Elem * _current_neighbor_elem
The current neighbor "element".
VectorVariablePhiDivergence _vector_div_phi_face
bool _user_added_fe_face_neighbor_of_helper_type
std::vector< ADReal > _ad_dzetadx_map
std::vector< dof_id_type > _column_indices
const VariablePhiValue & phiNeighbor(const MooseVariableField< Real > &) const
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.
std::vector< ADReal > _ad_detadz_map
DenseMatrix< Number > & jacobianBlock(unsigned int ivar, unsigned int jvar, LocalDataKey, TagID tag)
Get local Jacobian block for a pair of variables and a tag.
std::vector< dof_id_type > _temp_dof_indices
Temporary work vector to keep from reallocating it.
std::vector< std::vector< std::vector< unsigned char > > > _jacobian_block_used
Flag that indicates if the jacobian block was used.
void buildVectorFaceNeighborFE(FEType type) const
Build Vector FEs for a neighbor face with a type.
void prepareJacobianBlock()
Sizes and zeroes the Jacobian blocks used for the current element.
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.
void resizeADMappingObjects(unsigned int n_qp, unsigned int dim)
resize any objects that contribute to automatic differentiation-related mapping calculations
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.
std::vector< VectorValue< ADReal > > _ad_dxyzdeta_map
const Node * _current_node
The current node we are working with.
std::map< FEType, ADTemplateVariablePhiGradient< RealVectorValue > > _ad_vector_grad_phi_data_face
void cacheJacobianMortar(GlobalDataKey)
Cache all portions of the Jacobian, e.g.
void bumpVolumeQRuleOrder(Order volume_order, SubdomainID block)
Increases the element/volume quadrature order for the specified mesh block if and only if the current...
THREAD_ID _tid
Thread number (id)
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kel
dsecondary/dlower (or delement/dlower)
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_dual_lower
MooseArray< Point > _current_normals
The current Normal vectors at the quadrature points.
void cacheJacobian(GlobalDataKey)
Takes the values that are currently in _sub_Kee and appends them to the cached values.
bool _calculate_curvatures
std::vector< std::vector< Real > > _cached_residual_values
Values cached by calling cacheResidual() (the first vector is for TIME vs NONTIME)
const Node *const & node() const
Returns the reference to the node.
std::vector< std::vector< dof_id_type > > _cached_jacobian_cols
Column where the corresponding cached value should go.
ArbitraryQuadrature * _current_qrule_arbitrary
The current arbitrary quadrature rule used within the element interior.
void computeADFace(const Elem &elem, const unsigned int side)
compute AD things on an element face
libMesh::ElemSideBuilder _current_side_elem_builder
In place side element builder for _current_side_elem.
void computeFaceMap(const Elem &elem, const unsigned int side, const std::vector< Real > &qw)
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_lower
Vector FE objects for lower dimensional elements.
void setCachedJacobian(GlobalDataKey)
Sets previously-cached Jacobian values via SparseMatrix::set() calls.
void bumpAllQRuleOrder(Order order, SubdomainID block)
Increases the element/volume and face/area quadrature orders for the specified mesh block if and only...
libMesh::QBase * qruleFace(const Elem *elem, unsigned int side)
This is an abstraction over the internal qrules function.
void preparePRefinement()
Prepare helper FEs for p-refinement.
std::vector< std::vector< DenseVector< Number > > > _sub_Rl
residual contributions for each variable from the lower dimensional element
std::map< FEType, FEBase * > _current_fe_face
The "face" fe object that matches the current elem.
void addCachedJacobian(GlobalDataKey)
Adds the values that have been cached by calling cacheJacobian() and or cacheJacobianNeighbor() to th...
void reinit(const Elem *elem)
Reinitialize objects (JxW, q_points, ...) for an elements.
std::vector< dof_id_type > _neighbor_extra_elem_ids
Extra element IDs of neighbor.
libMesh::ElemSideBuilder _compute_face_map_side_elem_builder
In place side element builder for computeFaceMap()
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 ...
void modifyFaceWeightsDueToXFEM(const Elem *elem, unsigned int side=0)
Update the face integration weights for XFEM partial elements.
unsigned int _max_cached_residuals
void buildFaceFE(FEType type) const
Build FEs for a face with a type.
std::shared_ptr< XFEMInterface > _xfem
The XFEM controller.
std::map< unsigned int, FEBase * > _holder_fe_face_neighbor_helper
std::set< FEType > _need_neighbor_div
SubdomainID _current_neighbor_subdomain_id
The current neighbor subdomain ID.
std::map< FEType, FEVectorBase * > _current_vector_fe_face
The "face" vector fe object that matches the current elem.
bool _custom_mortar_qrule
Flag specifying whether a custom quadrature rule has been specified for mortar segment mesh.
libMesh::ElemSideBuilder _current_neighbor_side_elem_builder
In place side element builder for _current_neighbor_side_elem.
std::vector< std::vector< dof_id_type > > _cached_jacobian_rows
Row where the corresponding cached value should go.
std::map< FEType, ADTemplateVariablePhiGradient< Real > > _ad_grad_phi_data_face
MooseArray< ADReal > _ad_coord
The AD version of the current coordinate transformation coefficients.
std::vector< std::unique_ptr< FEBase > > _unique_fe_neighbor_helper
std::map< FEType, FEBase * > _current_fe_face_neighbor
The "neighbor face" fe object that matches the current elem.
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...
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_neighbor
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.
bool _need_lower_d_elem_volume
Whether we need to compute the lower dimensional element volume.
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_face_neighbor
QRules & qrules(unsigned int dim)
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.
bool _need_neighbor_elem_volume
true is apps need to compute neighbor element volume
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Keg
std::set< FEType > _need_face_div
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.
void addJacobianCoupledVarPair(const MooseVariableBase &ivar, const MooseVariableBase &jvar)
Adds element matrices for ivar rows and jvar columns to the global Jacobian matrices.
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...
void init(const libMesh::CouplingMatrix *cm)
Initialize the Assembly object and set the CouplingMatrix for use throughout.
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.
std::vector< std::pair< MooseVariableFieldBase *, MooseVariableScalar * > > _cm_fs_entry
Entries in the coupling matrix for field variables vs scalar variables.
Real _current_side_volume
Volume of the current side element.
void copyShapes(MooseVariableField< T > &v)
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.
Real _current_neighbor_lower_d_elem_volume
The current neighboring lower dimensional element volume.
MooseArray< Real > _coord
The current coordinate transformation coefficients.
std::map< FEType, std::unique_ptr< VectorFEShapeData > > _vector_fe_shape_data_lower
void buildVectorFE(FEType type) const
Build Vector FEs with a type.
ArbitraryQuadrature * _current_qrule_arbitrary_face
The current arbitrary quadrature rule used on the element face.
const MooseArray< Real > & JxW() const
Returns the reference to the transformed jacobian weights.
std::vector< std::vector< std::vector< unsigned char > > > _jacobian_block_nonlocal_used
void prepareResidual()
Sizes and zeroes the residual for the current element.
void buildVectorFaceFE(FEType type) const
Build Vector FEs for a face with a type.
const MooseArray< Real > & JxWNeighbor() const
Returns the reference to the transformed jacobian weights on a current face.
bool _user_added_fe_neighbor_of_helper_type
void reinitFEFace(const Elem *elem, unsigned int side)
Just an internal helper function to reinit the face FE objects.
std::map< unsigned int, FEBase * > _holder_fe_neighbor_helper
Each dimension's helper objects.
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.
void reinitNeighborLowerDElem(const Elem *elem)
reinitialize a neighboring lower dimensional element
void initNonlocalCoupling()
Create pair of variables requiring nonlocal jacobian contributions.
MooseArray< ADReal > _ad_curvatures
libMesh::QBase * _qrule_msm
A qrule object for working on mortar segement elements.
unsigned int _max_cached_jacobians
const Elem * _current_side_elem
The current "element" making up the side we are currently on.
std::set< FEType > _need_div
std::vector< std::vector< dof_id_type > > _cached_residual_rows
Where the cached values should go (the first vector is for TIME vs NONTIME)
std::map< FEType, ADTemplateVariablePhiGradient< Real > > _ad_grad_phi_data
std::map< unsigned int, FEBase * > _holder_fe_helper
Each dimension's helper objects.
MooseArray< Point > _current_q_points_face_neighbor
The current quadrature points on the neighbor face.
std::vector< ADReal > _ad_dzetadz_map
std::vector< ADReal > _ad_detady_map
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Kne
jacobian contributions from the neighbor and element <Tag, ivar, jvar>
const NumericVector< Real > * _scaling_vector
The map from global index to variable scaling factor.
MooseArray< Real > _current_JxW
The current list of transformed jacobian weights.
void zeroCachedJacobian(GlobalDataKey)
Zero out previously-cached Jacobian rows.
void buildVectorDualLowerDFE(FEType type) const
const Elem * _current_neighbor_lower_d_elem
The current neighboring lower dimensional element.
libMesh::QBase * _current_qrule_lower
quadrature rule used on lower dimensional elements.
const VariablePhiValue & phiFaceNeighbor(const MooseVariableField< Real > &) const
void clearCachedResiduals(GlobalDataKey)
Clears all of the residuals in _cached_residual_rows and _cached_residual_values.
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.
void computeCurrentElemVolume()
unsigned int _current_neighbor_side
The current side of the selected neighboring element (valid only when working with sides)
std::vector< std::vector< std::vector< DenseMatrix< Number > > > > _sub_Knl
dprimary/dlower (or dneighbor/dlower)
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...
MooseArray< VectorValue< ADReal > > _ad_q_points_face
void reinitMortarElem(const Elem *elem)
reinitialize a mortar segment mesh element in order to get a proper JxW
std::vector< VectorValue< ADReal > > _ad_d2xyzdxi2_map
const Elem * _current_elem
The current "element" we are currently on.
std::map< unsigned int, FEBase * > _holder_fe_face_helper
Each dimension's helper objects.
std::map< unsigned int, std::map< FEType, FEVectorBase * > > _vector_fe_face_neighbor
void reinitNeighbor(const Elem *neighbor, const std::vector< Point > &reference_points)
Reinitializes the neighbor side using reference coordinates.
libMesh::QBase * _current_qrule_volume
The current volumetric quadrature for the element.
void addJacobianNeighborLowerD(GlobalDataKey)
Add all portions of the Jacobian except PrimaryPrimary, e.g.
std::map< FEType, FEVectorBase * > _current_vector_fe_neighbor
The "neighbor" vector fe object that matches the current elem.
MooseArray< Real > _coord_msm
The coordinate transformation coefficients evaluated on the quadrature points of the mortar segment m...
Real _current_lower_d_elem_volume
The current lower dimensional element volume.
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.
std::vector< std::vector< Real > > _cached_jacobian_values
Values cached by calling cacheJacobian()
bool _user_added_fe_face_of_helper_type
void clearCachedJacobian()
Clear any currently cached jacobians.
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.
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_dual_lower
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data
Shape function values, gradients, second derivatives for each FE type.
std::vector< Point > _current_neighbor_ref_points
The current reference points on the neighbor element.
void copyNeighborShapes(MooseVariableField< T > &v)
std::set< FEType > _need_second_derivative
std::vector< dof_id_type > _row_indices
Working vectors to avoid repeated heap allocations when caching residuals/Jacobians that must have li...
std::vector< dof_id_type > _extra_elem_ids
Extra element IDs.
void hasScalingVector()
signals this object that a vector containing variable scaling factors should be used when doing resid...
void addCachedResiduals(GlobalDataKey, const std::vector< VectorTag > &tags)
Pushes all cached residuals to the global residual vectors associated with each tag.
Assembly(SystemBase &sys, THREAD_ID tid)
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_face_neighbor
bool _user_added_fe_lower_of_helper_type
MooseArray< Real > _current_JxW_neighbor
The current transformed jacobian weights on a neighbor's face.
std::vector< ADReal > _ad_dxidy_map
unsigned int _mesh_dimension
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.
std::map< FEType, std::unique_ptr< FEShapeData > > _fe_shape_data_face
const VariablePhiSecond & secondPhi() const
const Elem *const & neighbor() const
Return the neighbor element.
void prepareOffDiagScalar()
void prepareVariable(MooseVariableFieldBase *var)
Used for preparing the dense residual and jacobian blocks for one particular variable.
This data structure is used to store geometric and variable related metadata about each cell face in ...
unsigned int neighborSideID() const
const Elem & elem() const
const Elem * neighborPtr() const
unsigned int elemSideID() const
void resize(unsigned int size)
Change the number of elements the array can store.
std::vector< T > stdVector() const
Extremely inefficient way to produce a std::vector from a MooseArray!
unsigned int size() const
The number of elements that can currently be stored in the array.
void shallowCopy(const MooseArray &rhs)
Doesn't actually make a copy of the data.
void release()
Manually deallocates the data pointer.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
bool hasSecondOrderElements()
check if the mesh has SECOND order elements
std::vector< dof_id_type > componentDofIndices(const std::vector< dof_id_type > &dof_indices, unsigned int component) const
Obtain DoF indices of a component with the indices of the 0th component.
virtual const std::vector< dof_id_type > & dofIndices() const
Get local DoF indices.
const std::vector< Real > & arrayScalingFactor() const
const std::vector< dof_id_type > & allDofIndices() const
Get all global dofindices for the variable.
unsigned int number() const
Get variable number coming from libMesh.
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one.
This class provides an interface for common operations on field variables of both FE and FV types wit...
virtual const std::vector< dof_id_type > & dofIndicesLower() const =0
Get dof indices for the current lower dimensional element (this is meaningful when performing mortar ...
virtual const std::vector< dof_id_type > & dofIndicesNeighbor() const =0
Get neighbor DOF indices for currently selected element.
Class for stuff related to variables.
virtual const FieldVariablePhiGradient & gradPhiFaceNeighbor() const =0
Return the gradients of the variable's shape functions on a neighboring element face.
virtual const FieldVariablePhiGradient & gradPhiNeighbor() const =0
Return the gradients of the variable's shape functions on a neighboring element.
virtual const FieldVariablePhiValue & phiFaceNeighbor() const =0
Return the variable's shape functions on a neighboring element face.
virtual const FieldVariablePhiGradient & gradPhiFace() const =0
Return the gradients of the variable's shape functions on an element face.
virtual const FieldVariablePhiSecond & secondPhi() const =0
Return the rank-2 tensor of second derivatives of the variable's elemental shape functions.
bool usesPhiNeighbor() const
Whether or not this variable is actually using the shape function value.
virtual const FieldVariablePhiValue & phi() const =0
Return the variable's elemental shape functions.
virtual const FieldVariablePhiSecond & secondPhiFace() const =0
Return the rank-2 tensor of second derivatives of the variable's shape functions on an element face.
virtual const FieldVariablePhiSecond & secondPhiFaceNeighbor() const =0
Return the rank-2 tensor of second derivatives of the variable's shape functions on a neighboring ele...
virtual bool computingSecond() const =0
Whether or not this variable is computing any second derivatives.
virtual const FieldVariablePhiValue & phiFace() const =0
Return the variable's shape functions on an element face.
virtual const FieldVariablePhiSecond & secondPhiNeighbor() const =0
Return the rank-2 tensor of second derivatives of the variable's shape functions on a neighboring ele...
virtual bool usesSecondPhiNeighbor() const =0
Whether or not this variable is actually using the shape function second derivatives.
virtual const FieldVariablePhiGradient & gradPhi() const =0
Return the gradients of the variable's elemental shape functions.
virtual const FieldVariablePhiValue & phiNeighbor() const =0
Return the variable's shape functions on a neighboring element.
bool usesGradPhiNeighbor() const
Whether or not this variable is actually using the shape function gradient.
Generic class for solving transient nonlinear problems.
virtual MooseMesh & mesh()=0
virtual unsigned int currentNlSysNum() const =0
virtual const VectorTag & getVectorTag(const TagID tag_id) const
Get a VectorTag from a TagID.
virtual unsigned int numMatrixTags() const
The total number of tags.
virtual void haveADObjects(bool have_ad_objects)
Method for setting whether we have any ad objects.
virtual bool checkNonlocalCouplingRequirement() const =0
Moose::CoordinateSystemType getCoordSystem(SubdomainID sid) const
Base class for a system (of equations)
virtual libMesh::SparseMatrix< Number > & getMatrix(TagID tag)
Get a raw SparseMatrix.
bool hasVector(const std::string &tag_name) const
Check if the named vector exists in the system.
virtual unsigned int nVariables() const
Get the number of variables in this system.
MooseVariableFieldBase & getVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a variable of with specified name.
unsigned int number() const
Gets the number of this system.
virtual bool isScalarVariable(unsigned int var_name) const
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
const std::vector< MooseVariableFieldBase * > & getVariables(THREAD_ID tid)
MooseVariableField< T > & getActualFieldVariable(THREAD_ID tid, const std::string &var_name)
Returns a field variable pointer - this includes finite volume variables.
bool computingScalingJacobian() const
Whether we are computing an initial Jacobian for automatic variable scaling.
virtual MooseVariableScalar & getScalarVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a scalar variable with specified number.
virtual bool hasMatrix(TagID tag) const
Check if the tagged matrix exists in the system.
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
Storage for all of the information pretaining to a vector tag.
TagID _id
The id associated with the vector tag.
Moose::VectorTagType _type
The type of the vector tag.
TagTypeID _type_id
The index for this tag into a vector that contains tags of only its type ordered by ID.
DenseMatrix sub_matrix(unsigned int row_id, unsigned int row_size, unsigned int col_id, unsigned int col_size) const
void resize(const unsigned int new_m, const unsigned int new_n)
virtual unsigned int size() const override final
void constrain_element_matrix(DenseMatrix< Number > &matrix, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const
void constrain_element_vector(DenseVector< Number > &rhs, std::vector< dof_id_type > &dofs, bool asymmetric_constraint_rows=true) const
unsigned int n_dofs(const ElemType t, const Order o)
const std::vector< Point > & get_points() const
unsigned int n_points() const
virtual QuadratureType type() const=0
bool allow_rules_with_negative_weights
unsigned int get_dim() const
const std::vector< Real > & get_weights() const
virtual void init(const Elem &e, unsigned int p_level=invalid_uint)
virtual void zero_rows(std::vector< numeric_index_type > &rows, T diag_value=0.0)
virtual void add(const numeric_index_type i, const numeric_index_type j, const T value)=0
virtual void set(const numeric_index_type i, const numeric_index_type j, const T value)=0
void add_scaled(const TypeVector< T2 > &, const T &)
void coordTransformFactorRZGeneral(const P &point, const std::pair< Point, RealVectorValue > &axis, C &factor)
Computes a coordinate transformation factor for a general axisymmetric axis.
void coordTransformFactor(const P &point, C &factor, const Moose::CoordinateSystemType coord_type, const unsigned int rz_radial_coord=libMesh::invalid_uint)
Compute a coordinate transformation volume integration factor.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
const SubdomainID ANY_BLOCK_ID
void derivInsert(SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< N > > &derivs, libMesh::dof_id_type index, Real value)
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const unsigned int invalid_uint
OStreamProxy err(std::cerr)
Data structure for tracking/grouping a set of quadrature rules for a particular dimensionality of mes...
std::unique_ptr< ArbitraryQuadrature > arbitrary_vol
volume/elem (meshdim) custom points quadrature rule
std::unique_ptr< ArbitraryQuadrature > neighbor
area/face (meshdim-1) custom points quadrature rule for DG
std::unique_ptr< libMesh::QBase > vol
volume/elem (meshdim) quadrature rule
std::unique_ptr< ArbitraryQuadrature > arbitrary_face
area/face (meshdim-1) custom points quadrature rule
std::unique_ptr< libMesh::QBase > face
area/face (meshdim-1) quadrature rule