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()));
865 for (
unsigned int qp = 0; qp != n_qp; qp++)
870 for (
unsigned qp = 0; qp < n_qp; ++qp)
873 for (
unsigned qp = 0; qp < n_qp; ++qp)
877 for (
const auto & it :
_fe[
dim])
881 FEBase & fe = *it.second;
882 auto fe_type = it.first;
883 auto num_shapes = FEInterface::n_shape_functions(fe_type,
elem);
886 grad_phi.resize(num_shapes);
887 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
888 grad_phi[i].resize(n_qp);
894 const auto & regular_grad_phi =
_fe_shape_data[fe_type]->_grad_phi;
895 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
896 for (
unsigned qp = 0; qp < n_qp; ++qp)
897 grad_phi[i][qp] = regular_grad_phi[i][qp];
904 FEVectorBase & fe = *it.second;
905 auto fe_type = it.first;
906 auto num_shapes = FEInterface::n_shape_functions(fe_type,
elem);
909 grad_phi.resize(num_shapes);
910 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
911 grad_phi[i].resize(n_qp);
918 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
919 for (
unsigned qp = 0; qp < n_qp; ++qp)
920 grad_phi[i][qp] = regular_grad_phi[i][qp];
926 for (
auto i : make_range(n))
930 if (
_xfem !=
nullptr)
934template <
typename OutputType>
939 FEGenericBase<OutputType> * fe)
953 const auto & dphidxi = fe->get_dphidxi();
954 const auto & dphideta = fe->get_dphideta();
955 const auto & dphidzeta = fe->get_dphidzeta();
956 auto num_shapes = grad_phi.size();
962 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
963 for (
unsigned qp = 0; qp < n_qp; ++qp)
970 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
971 for (
unsigned qp = 0; qp < n_qp; ++qp)
973 grad_phi[i][qp].slice(0) = dphidxi[i][qp] *
_ad_dxidx_map[qp];
974 grad_phi[i][qp].slice(1) = dphidxi[i][qp] *
_ad_dxidy_map[qp];
975 grad_phi[i][qp].slice(2) = dphidxi[i][qp] *
_ad_dxidz_map[qp];
982 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
983 for (
unsigned qp = 0; qp < n_qp; ++qp)
985 grad_phi[i][qp].slice(0) =
987 grad_phi[i][qp].slice(1) =
989 grad_phi[i][qp].slice(2) =
997 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
998 for (
unsigned qp = 0; qp < n_qp; ++qp)
1000 grad_phi[i][qp].slice(0) = dphidxi[i][qp] *
_ad_dxidx_map[qp] +
1003 grad_phi[i][qp].slice(1) = dphidxi[i][qp] *
_ad_dxidy_map[qp] +
1006 grad_phi[i][qp].slice(2) = dphidxi[i][qp] *
_ad_dxidz_map[qp] +
1049 for (
const auto n :
elem.node_index_range())
1052 if (!do_derivatives)
1059 bool has_nodes_without_dofs =
false;
1060 for (
const auto n :
elem.node_index_range())
1062 const Node &
node =
elem.node_ref(n);
1063 if (
node.n_dofs(sys_num, disp_num))
1065 node.dof_number(sys_num, disp_num, 0),
1068 has_nodes_without_dofs =
true;
1071 const auto & var = dof_map.
variable(disp_num);
1072 if (!has_nodes_without_dofs || var.type().family != LAGRANGE ||
1073 !var.active_on_subdomain(
elem.subdomain_id()))
1084 FEInterface::nodal_soln(
1087 for (
const auto n :
elem.node_index_range())
1098 const std::vector<Real> & qw,
1140 const auto & elem_nodes =
elem->get_nodes();
1141 const auto & phi_map = fe->get_fe_map().get_phi_map();
1144 const auto num_shapes = phi_map.size();
1145 const auto & dphidxi_map = fe->get_fe_map().get_dphidxi_map();
1146 const auto & dphideta_map = fe->get_fe_map().get_dphideta_map();
1147 const auto & dphidzeta_map = fe->get_fe_map().get_dphidzeta_map();
1149 "computeADElemNodePoints must be called for this element first");
1169 for (std::size_t i = 0; i < num_shapes; i++)
1181 if (
_ad_jac[p].value() <= -TOLERANCE * TOLERANCE)
1183 static bool failing =
false;
1188 libmesh_error_msg(
"ERROR: negative Jacobian " <<
_ad_jac[p].value() <<
" at point index "
1189 << p <<
" in element " <<
elem->id());
1212 for (std::size_t i = 0; i < num_shapes; i++)
1227 const auto g11 = (dx_dxi * dx_dxi + dy_dxi * dy_dxi + dz_dxi * dz_dxi);
1229 const auto g12 = (dx_dxi * dx_deta + dy_dxi * dy_deta + dz_dxi * dz_deta);
1231 const auto & g21 = g12;
1233 const auto g22 = (dx_deta * dx_deta + dy_deta * dy_deta + dz_deta * dz_deta);
1235 auto det = (g11 * g22 - g12 * g21);
1237 if (det.value() <= -TOLERANCE * TOLERANCE)
1239 static bool failing =
false;
1244 libmesh_error_msg(
"ERROR: negative Jacobian " << det <<
" at point index " << p
1245 <<
" in element " <<
elem->id());
1250 else if (det.value() <= 0.)
1251 det.value() = TOLERANCE * TOLERANCE;
1253 const auto inv_det = 1. / det;
1259 const auto g11inv = g22 * inv_det;
1260 const auto g12inv = -g12 * inv_det;
1261 const auto g21inv = -g21 * inv_det;
1262 const auto g22inv = g11 * inv_det;
1283 for (std::size_t i = 0; i < num_shapes; i++)
1301 _ad_jac[p] = (dx_dxi * (dy_deta * dz_dzeta - dz_deta * dy_dzeta) +
1302 dy_dxi * (dz_deta * dx_dzeta - dx_deta * dz_dzeta) +
1303 dz_dxi * (dx_deta * dy_dzeta - dy_deta * dx_dzeta));
1305 if (
_ad_jac[p].value() <= -TOLERANCE * TOLERANCE)
1307 static bool failing =
false;
1312 libmesh_error_msg(
"ERROR: negative Jacobian " <<
_ad_jac[p].value() <<
" at point index "
1313 << p <<
" in element " <<
elem->id());
1321 const auto inv_jac = 1. /
_ad_jac[p];
1323 _ad_dxidx_map[p] = (dy_deta * dz_dzeta - dz_deta * dy_dzeta) * inv_jac;
1324 _ad_dxidy_map[p] = (dz_deta * dx_dzeta - dx_deta * dz_dzeta) * inv_jac;
1325 _ad_dxidz_map[p] = (dx_deta * dy_dzeta - dy_deta * dx_dzeta) * inv_jac;
1327 _ad_detadx_map[p] = (dz_dxi * dy_dzeta - dy_dxi * dz_dzeta) * inv_jac;
1328 _ad_detady_map[p] = (dx_dxi * dz_dzeta - dz_dxi * dx_dzeta) * inv_jac;
1329 _ad_detadz_map[p] = (dy_dxi * dx_dzeta - dx_dxi * dy_dzeta) * inv_jac;
1339 libmesh_error_msg(
"Invalid dim = " <<
dim);
1346 unsigned int dim =
elem->dim();
1350 FEBase & fe_face = *it.second;
1351 const FEType & fe_type = it.first;
1356 fesd.
_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_face.get_phi()));
1358 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face.get_dphi()));
1361 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face.get_d2phi()));
1365 FEVectorBase & fe_face = *it.second;
1366 const FEType & fe_type = it.first;
1374 fesd.
_phi.shallowCopy(
1375 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face.get_phi()));
1377 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face.get_dphi()));
1380 const_cast<std::vector<std::vector<TypeNTensor<3, Real>
>> &>(fe_face.get_d2phi()));
1383 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face.get_curl_phi()));
1386 const_cast<std::vector<std::vector<Real>
> &>(fe_face.get_div_phi()));
1414 if (
_xfem !=
nullptr)
1418 for (
auto i : make_range(n))
1434 const auto n_qp = qw.size();
1438 std::vector<std::vector<Real>>
const * d2psidxi2_map =
nullptr;
1439 std::vector<std::vector<Real>>
const * d2psidxideta_map =
nullptr;
1440 std::vector<std::vector<Real>>
const * d2psideta2_map =
nullptr;
1442 "computeADElemNodePoints must be called for this element first");
1458 if (side_elem.node_id(0) ==
elem.node_id(0))
1463 VectorValue<ADReal> side_point;
1467 for (
const auto p : make_range(n_qp))
1488 for (
const auto p : make_range(n_qp))
1491 for (
const auto p : make_range(n_qp))
1494 for (
const auto p : make_range(n_qp))
1497 const auto n_mapping_shape_functions =
1500 for (
unsigned int i = 0; i < n_mapping_shape_functions; i++)
1504 for (
const auto p : make_range(n_qp))
1507 for (
const auto p : make_range(n_qp))
1510 for (
const auto p : make_range(n_qp))
1514 for (
const auto p : make_range(n_qp))
1524 libmesh_assert_not_equal_to(denominator, 0);
1543 for (
const auto p : make_range(n_qp))
1549 for (
const auto p : make_range(n_qp))
1552 for (
const auto p : make_range(n_qp))
1559 const unsigned int n_mapping_shape_functions =
1562 for (
unsigned int i = 0; i < n_mapping_shape_functions; i++)
1566 for (
const auto p : make_range(n_qp))
1572 for (
const auto p : make_range(n_qp))
1575 for (
const auto p : make_range(n_qp))
1583 for (
const auto p : make_range(n_qp))
1591 const auto g11 = (dxdxi * dxdxi + dydxi * dydxi + dzdxi * dzdxi);
1593 const auto g12 = (dxdxi * dxdeta + dydxi * dydeta + dzdxi * dzdeta);
1595 const auto & g21 = g12;
1597 const auto g22 = (dxdeta * dxdeta + dydeta * dydeta + dzdeta * dzdeta);
1600 const auto the_jac = sqrt(g11 * g22 - g12 * g21);
1613 const auto numerator = E * N - 2. * F * M + G * L;
1614 const auto denominator = E * G - F * F;
1615 libmesh_assert_not_equal_to(denominator, 0.);
1631 unsigned int neighbor_dim =
neighbor->dim();
1636 FEBase & fe_face_neighbor = *it.second;
1637 FEType fe_type = it.first;
1640 fe_face_neighbor.reinit(
neighbor, &reference_points);
1644 fesd.
_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_face_neighbor.get_phi()));
1646 const_cast<std::vector<std::vector<RealGradient>
> &>(fe_face_neighbor.get_dphi()));
1649 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face_neighbor.get_d2phi()));
1653 FEVectorBase & fe_face_neighbor = *it.second;
1654 const FEType & fe_type = it.first;
1660 fe_face_neighbor.reinit(
neighbor, &reference_points);
1662 fesd.
_phi.shallowCopy(
1663 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face_neighbor.get_phi()));
1665 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face_neighbor.get_dphi()));
1667 fesd.
_second_phi.shallowCopy(
const_cast<std::vector<std::vector<TypeNTensor<3, Real>
>> &>(
1668 fe_face_neighbor.get_d2phi()));
1670 fesd.
_curl_phi.shallowCopy(
const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(
1671 fe_face_neighbor.get_curl_phi()));
1674 const_cast<std::vector<std::vector<Real>
> &>(fe_face_neighbor.get_div_phi()));
1679 "We should be in bounds here");
1690 unsigned int neighbor_dim =
neighbor->dim();
1695 FEBase & fe_neighbor = *it.second;
1696 FEType fe_type = it.first;
1699 fe_neighbor.reinit(
neighbor, &reference_points);
1703 fesd.
_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_neighbor.get_phi()));
1705 const_cast<std::vector<std::vector<RealGradient>
> &>(fe_neighbor.get_dphi()));
1708 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_neighbor.get_d2phi()));
1712 FEVectorBase & fe_neighbor = *it.second;
1713 const FEType & fe_type = it.first;
1719 fe_neighbor.reinit(
neighbor, &reference_points);
1721 fesd.
_phi.shallowCopy(
1722 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_neighbor.get_phi()));
1724 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_neighbor.get_dphi()));
1727 const_cast<std::vector<std::vector<TypeNTensor<3, Real>
>> &>(fe_neighbor.get_d2phi()));
1730 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_neighbor.get_curl_phi()));
1733 const_cast<std::vector<std::vector<Real>
> &>(fe_neighbor.get_div_phi()));
1745 unsigned int neighbor_dim =
neighbor->dim();
1747 "Neighbor subdomain ID has not been correctly set");
1751 neighbor_rule->
setPoints(reference_points);
1756 "current neighbor subdomain has been set incorrectly");
1765 fe.attach_quadrature_rule(qrule);
1768 const std::vector<Real> &
JxW = fe.get_JxW();
1770 q_points.
shallowCopy(
const_cast<std::vector<Point> &
>(fe.get_xyz()));
1775 for (
unsigned int qp = 0; qp < qrule->n_points(); qp++)
1780 for (
auto i : make_range(n))
1785template <
typename Po
ints,
typename Coords>
1788 const Points & q_points,
1793 mooseAssert(qrule,
"The quadrature rule is null in Assembly::setCoordinateTransformation");
1794 auto n_points = qrule->n_points();
1795 mooseAssert(n_points == q_points.size(),
1796 "The number of points in the quadrature rule doesn't match the number of passed-in "
1797 "points in Assembly::setCoordinateTransformation");
1804 coord.resize(n_points);
1805 for (
unsigned int qp = 0; qp < n_points; qp++)
1853 "current subdomain has been set incorrectly");
1867 unsigned int elem_dimension =
elem->dim();
1880 "current subdomain has been set incorrectly");
1894 "current subdomain has been set incorrectly");
1920 "current subdomain has been set incorrectly");
1944 "Our finite volume quadrature rule should always yield a single point");
1952 const auto & ref_point = ref_points[0];
1959 "current neighbor subdomain has been set incorrectly");
1981 return qruleFaceHelper<ArbitraryQuadrature>(
1988 const auto elem_dimension =
elem->dim();
2001 "current subdomain has been set incorrectly");
2015Assembly::reinit(
const Elem * elem,
unsigned int side,
const std::vector<Point> & reference_points)
2020 "current subdomain has been set incorrectly");
2052 const Elem * neighbor,
2053 unsigned int neighbor_side,
2054 const std::vector<Point> * neighbor_reference_points)
2060 unsigned int neighbor_dim =
neighbor->dim();
2062 if (neighbor_reference_points)
2076 unsigned int elem_side,
2078 const std::vector<Point> *
const pts,
2079 const std::vector<Real> *
const weights)
2083 unsigned int elem_dim =
elem->dim();
2089 face_rule->setPoints(*pts);
2100 for (
const auto & it :
_fe_face[elem_dim])
2102 FEBase & fe_face = *it.second;
2103 FEType fe_type = it.first;
2106 fe_face.reinit(
elem, elem_side, tolerance, pts, weights);
2110 fesd.
_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_face.get_phi()));
2112 const_cast<std::vector<std::vector<RealGradient>
> &>(fe_face.get_dphi()));
2115 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face.get_d2phi()));
2119 FEVectorBase & fe_face = *it.second;
2120 const FEType & fe_type = it.first;
2126 fe_face.reinit(
elem, elem_side, tolerance, pts, weights);
2128 fesd.
_phi.shallowCopy(
2129 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face.get_phi()));
2131 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face.get_dphi()));
2134 const_cast<std::vector<std::vector<TypeNTensor<3, Real>
>> &>(fe_face.get_d2phi()));
2137 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face.get_curl_phi()));
2140 const_cast<std::vector<std::vector<Real>
> &>(fe_face.get_div_phi()));
2204 static thread_local std::vector<Real> dummy_qw;
2205 dummy_qw.resize(n_qp, 1.);
2207 for (
unsigned int qp = 0; qp != n_qp; qp++)
2213 for (
unsigned qp = 0; qp < n_qp; ++qp)
2219 for (
unsigned qp = 0; qp < n_qp; ++qp)
2222 for (
unsigned qp = 0; qp < n_qp; ++qp)
2230 FEBase & fe = *it.second;
2231 auto fe_type = it.first;
2232 auto num_shapes = FEInterface::n_shape_functions(fe_type, &
elem);
2235 grad_phi.resize(num_shapes);
2236 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
2237 grad_phi[i].resize(n_qp);
2244 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
2245 for (
unsigned qp = 0; qp < n_qp; ++qp)
2246 grad_phi[i][qp] = regular_grad_phi[i][qp];
2250 FEVectorBase & fe = *it.second;
2251 auto fe_type = it.first;
2252 auto num_shapes = FEInterface::n_shape_functions(fe_type, &
elem);
2255 grad_phi.resize(num_shapes);
2256 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
2257 grad_phi[i].resize(n_qp);
2264 for (
decltype(num_shapes) i = 0; i < num_shapes; ++i)
2265 for (
unsigned qp = 0; qp < n_qp; ++qp)
2266 grad_phi[i][qp] = regular_grad_phi[i][qp];
2274 unsigned int neighbor_side,
2276 const std::vector<Point> *
const pts,
2277 const std::vector<Real> *
const weights)
2281 unsigned int neighbor_dim =
neighbor->dim();
2297 FEBase & fe_face_neighbor = *it.second;
2298 FEType fe_type = it.first;
2301 fe_face_neighbor.reinit(
neighbor, neighbor_side, tolerance, pts, weights);
2305 fesd.
_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_face_neighbor.get_phi()));
2307 const_cast<std::vector<std::vector<RealGradient>
> &>(fe_face_neighbor.get_dphi()));
2310 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face_neighbor.get_d2phi()));
2314 FEVectorBase & fe_face_neighbor = *it.second;
2315 const FEType & fe_type = it.first;
2321 fe_face_neighbor.reinit(
neighbor, neighbor_side, tolerance, pts, weights);
2323 fesd.
_phi.shallowCopy(
2324 const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(fe_face_neighbor.get_phi()));
2326 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_face_neighbor.get_dphi()));
2328 fesd.
_second_phi.shallowCopy(
const_cast<std::vector<std::vector<TypeNTensor<3, Real>
>> &>(
2329 fe_face_neighbor.get_d2phi()));
2331 fesd.
_curl_phi.shallowCopy(
const_cast<std::vector<std::vector<VectorValue<Real>
>> &>(
2332 fe_face_neighbor.get_curl_phi()));
2335 const_cast<std::vector<std::vector<Real>
> &>(fe_face_neighbor.get_div_phi()));
2340 "We should be in bounds here");
2342 neighbor, neighbor_side, tolerance, pts, weights);
2355 const unsigned int neighbor_dim =
neighbor->dim();
2369 const std::vector<Point> & pts,
2370 const std::vector<Real> & JxW)
2372 const unsigned int elem_dim =
elem->dim();
2374 "Dual shape functions should only be computed on lower dimensional face elements");
2376 for (
const auto & [fe_type, fe_lower] :
_fe_lower[elem_dim])
2383 fe_lower->set_calculate_default_dual_coeff(
false);
2384 fe_lower->reinit_dual_shape_coeffs(
elem, pts,
JxW);
2390 const std::vector<Point> *
const pts,
2391 const std::vector<Real> *
const weights)
2395 const unsigned int elem_dim =
elem->dim();
2397 "The lower dimensional element should truly be a lower dimensional element");
2415 for (
const auto & it :
_fe_lower[elem_dim])
2417 FEBase & fe_lower = *it.second;
2418 FEType fe_type = it.first;
2420 fe_lower.reinit(
elem);
2424 fesd->_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_lower.get_phi()));
2425 fesd->_grad_phi.shallowCopy(
2426 const_cast<std::vector<std::vector<RealGradient>
> &>(fe_lower.get_dphi()));
2428 fesd->_second_phi.shallowCopy(
2429 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_lower.get_d2phi()));
2435 fesd->_phi.shallowCopy(
const_cast<std::vector<std::vector<Real>
> &>(fe_lower.get_dual_phi()));
2436 fesd->_grad_phi.shallowCopy(
2437 const_cast<std::vector<std::vector<RealGradient>
> &>(fe_lower.get_dual_dphi()));
2439 fesd->_second_phi.shallowCopy(
2440 const_cast<std::vector<std::vector<TensorValue<Real>
>> &>(fe_lower.get_dual_d2phi()));
2452 if (pts && !weights)
2470 const auto & physical_q_points = helper_fe.get_xyz();
2471 const auto &
JxW = helper_fe.get_JxW();
2485 "You should be calling reinitNeighborLowerDElem on a lower dimensional element");
2506 "You should be calling reinitMortarElem on a lower dimensional element");
2518 unsigned int neighbor_side,
2519 const std::vector<Point> & physical_points)
2521 unsigned int neighbor_dim =
neighbor->dim();
2527 physical_points.size() == 1,
2528 "If reinitializing with more than one point, then I am dubious of your use case. Perhaps "
2529 "you are performing a DG type method and you are reinitializing using points from the "
2530 "element face. In such a case your neighbor JxW must have its index order 'match' the "
2531 "element JxW index order, e.g. imagining a vertical 1D face with two quadrature points, "
2533 "index 0 for elem JxW corresponds to the 'top' quadrature point, then index 0 for "
2535 "JxW must also correspond to the 'top' quadrature point. And libMesh/MOOSE has no way to "
2536 "guarantee that with multiple quadrature points.");
2558 const std::vector<Point> & physical_points)
2560 unsigned int neighbor_dim =
neighbor->dim();
2584 for (
auto & ivar :
vars)
2586 auto i = ivar->number();
2591 for (
unsigned int k = 0; k < ivar->count(); ++k)
2593 unsigned int iv = i + k;
2594 for (
const auto & j :
libMesh::ConstCouplingRow(iv, *
_cm))
2605 auto pair = std::make_pair(ivar, &jvar);
2606 auto c = ivar_start;
2608 bool has_pair =
false;
2621 if (i != jvar.number())
2632 for (
auto & ivar : scalar_vars)
2634 auto i = ivar->number();
2638 for (
const auto & j :
libMesh::ConstCouplingRow(i, *
_cm))
2639 if (
_sys.isScalarVariable(j))
2656 _sub_Re.resize(num_vector_tags);
2657 _sub_Rn.resize(num_vector_tags);
2658 _sub_Rl.resize(num_vector_tags);
2692 for (MooseIndex(num_matrix_tags) tag = 0; tag < num_matrix_tags; tag++)
2709 for (MooseIndex(n_vars) i = 0; i <
n_vars; ++i)
2758 for (
auto & ivar :
vars)
2760 auto i = ivar->number();
2762 for (
unsigned int k = 0; k < ivar->count(); ++k)
2764 unsigned int iv = i + k;
2769 auto pair = std::make_pair(ivar, &jvar);
2770 auto c = ivar_start;
2772 bool has_pair =
false;
2794 unsigned int vi = ivar.
number();
2795 unsigned int vj = jvar.
number();
2799 if (array_block_diagonal_purely_diagonal)
2800 num_cols /= jvar.
count();
2814 for (
const auto & var :
vars)
2816 tag_Re[var->number()].resize(var->dofIndices().size());
2834 unsigned int vi = ivar.
number();
2835 unsigned int vj = jvar.
number();
2839 if (array_block_diagonal_purely_diagonal)
2840 num_cols /= jvar.
count();
2860 unsigned int vi = ivar.
number();
2861 unsigned int vj = jvar.
number();
2865 if (array_block_diagonal_purely_diagonal)
2866 num_cols /= jvar.
count();
2890 unsigned int vi = ivar.
number();
2891 unsigned int vj = jvar.
number();
2895 if (array_block_diagonal_purely_diagonal)
2896 num_cols /= jvar.
count();
2920 unsigned int vi = ivar.
number();
2921 unsigned int vj = jvar.
number();
2924 const auto dofs_divisor = array_block_diagonal_purely_diagonal ? jvar.
count() : 1;
2945 for (
const auto & var :
vars)
2947 tag_Rn[var->number()].resize(var->dofIndicesNeighbor().size());
2958 unsigned int vi = ivar.
number();
2959 unsigned int vj = jvar.
number();
2962 const auto dofs_divisor = array_block_diagonal_purely_diagonal ? jvar.
count() : 1;
2997 for (
const auto & var :
vars)
2999 tag_Rl[var->number()].resize(var->dofIndicesLower().size());
3005 const std::vector<dof_id_type> & dof_indices)
3009 const unsigned int ivn = iv.
number();
3010 const unsigned int jvn = jv.number();
3011 const unsigned int icount = iv.count();
3012 unsigned int jcount = jv.count();
3019 .resize(dof_indices.size() * icount, dof_indices.size() * jcount);
3024 tag_Re[ivn].resize(dof_indices.size() * icount);
3030 const std::vector<dof_id_type> & idof_indices,
3031 const std::vector<dof_id_type> & jdof_indices)
3035 const unsigned int ivn = iv.
number();
3036 const unsigned int jvn = jv.number();
3037 const unsigned int icount = iv.count();
3038 unsigned int jcount = jv.count();
3047 .resize(idof_indices.size() * icount, jdof_indices.size() * jcount);
3057 for (
const auto & ivar :
vars)
3059 auto idofs = ivar->dofIndices().size();
3062 tag_Re[ivar->number()].resize(idofs);
3064 for (
const auto & jvar :
vars)
3066 auto jdofs = jvar->dofIndices().size();
3083 for (
const auto & ivar : scalar_vars)
3085 auto idofs = ivar->dofIndices().size();
3087 for (
const auto & jvar :
vars)
3089 auto jdofs = jvar->dofIndices().size() * jvar->count();
3102template <
typename T>
3106 phi(v).shallowCopy(v.
phi());
3130 if (v.computingCurl())
3131 curlPhi(v).shallowCopy(v.curlPhi());
3132 if (v.computingDiv())
3133 divPhi(v).shallowCopy(v.divPhi());
3136 mooseError(
"Unsupported variable field type!");
3139template <
typename T>
3167 if (v.computingCurl())
3169 if (v.computingDiv())
3173 mooseError(
"Unsupported variable field type!");
3176template <
typename T>
3217 mooseError(
"Unsupported variable field type!");
3220DenseMatrix<Number> &
3261DenseMatrix<Number> &
3323 std::vector<dof_id_type> & dof_indices,
3324 const std::vector<Real> & scaling_factor)
3326 mooseAssert(res_block.size() == dof_indices.size(),
3327 "The size of residual and degree of freedom container must be the same");
3332 const auto ntdof = res_block.size();
3333 const auto count = scaling_factor.size();
3334 const auto ndof = ntdof /
count;
3338 for (MooseIndex(
count) j = 0; j <
count; ++j)
3339 for (MooseIndex(ndof) i = 0; i < ndof; ++i)
3340 res_block(p++) *= scaling_factor[j];
3344 if (scaling_factor[0] != 1.0)
3345 res_block *= scaling_factor[0];
3353 DenseVector<Number> & res_block,
3354 const std::vector<dof_id_type> & dof_indices,
3355 const std::vector<Real> & scaling_factor)
3357 if (dof_indices.size() > 0 && res_block.size())
3368 std::vector<dof_id_type> & cached_residual_rows,
3369 DenseVector<Number> & res_block,
3370 const std::vector<dof_id_type> & dof_indices,
3371 const std::vector<Real> & scaling_factor)
3373 if (dof_indices.size() > 0 && res_block.size())
3381 cached_residual_values.push_back(
_tmp_Re(i));
3391 DenseVector<Number> & res_block,
3392 const std::vector<dof_id_type> & dof_indices,
3393 const std::vector<Real> & scaling_factor)
3395 if (dof_indices.size() > 0)
3397 std::vector<dof_id_type> di(dof_indices);
3408 "Non-residual tag in Assembly::addResidual");
3413 for (
const auto & var :
vars)
3414 addResidualBlock(residual, tag_Re[var->number()], var->dofIndices(), var->arrayScalingFactor());
3420 for (
const auto & vector_tag : vector_tags)
3429 "Non-residual tag in Assembly::addResidualNeighbor");
3434 for (
const auto & var :
vars)
3436 residual, tag_Rn[var->number()], var->dofIndicesNeighbor(), var->arrayScalingFactor());
3442 for (
const auto & vector_tag : vector_tags)
3451 "Non-residual tag in Assembly::addResidualLower");
3456 for (
const auto & var :
vars)
3458 residual, tag_Rl[var->number()], var->dofIndicesLower(), var->arrayScalingFactor());
3464 for (
const auto & vector_tag : vector_tags)
3474 "Non-residual tag in Assembly::addResidualScalar");
3480 for (
const auto & var :
vars)
3481 addResidualBlock(residual, tag_Re[var->number()], var->dofIndices(), var->arrayScalingFactor());
3487 for (
const auto & vector_tag : vector_tags)
3496 for (
const auto & var :
vars)
3497 for (
const auto & vector_tag : tags)
3501 _sub_Re[vector_tag._type_id][var->number()],
3503 var->arrayScalingFactor());
3520 for (
auto & tag : tags)
3526 const std::vector<dof_id_type> & dof_index,
3535 for (MooseIndex(dof_index) i = 0; i < dof_index.size(); ++i)
3546 for (
const auto & var :
vars)
3547 for (
const auto & vector_tag : tags)
3551 _sub_Rn[vector_tag._type_id][var->number()],
3552 var->dofIndicesNeighbor(),
3553 var->arrayScalingFactor());
3560 for (
const auto & var :
vars)
3561 for (
const auto & vector_tag : tags)
3565 _sub_Rl[vector_tag._type_id][var->number()],
3566 var->dofIndicesLower(),
3567 var->arrayScalingFactor());
3573 for (
const auto & vector_tag : tags)
3599 mooseAssert(
values.size() == rows.size(),
3600 "Number of cached residuals and number of rows must match!");
3623 mooseAssert(
values.size() == rows.size(),
3624 "Number of cached residuals and number of rows must match!");
3628 residual.add_vector(
values, rows);
3638 for (
const auto & var :
vars)
3639 setResidualBlock(residual, tag_Re[var->number()], var->dofIndices(), var->arrayScalingFactor());
3649 for (
const auto & var :
vars)
3651 residual, tag_Rn[var->number()], var->dofIndicesNeighbor(), var->arrayScalingFactor());
3657 DenseMatrix<Number> & jac_block,
3660 const std::vector<dof_id_type> & idof_indices,
3661 const std::vector<dof_id_type> & jdof_indices)
3663 if (idof_indices.size() == 0 || jdof_indices.size() == 0)
3665 if (jac_block.n() == 0 || jac_block.m() == 0)
3669 const unsigned int iv = ivar.
number();
3670 const unsigned int jv = jvar.
number();
3672 for (
unsigned int i = 0; i < ivar.
count(); ++i)
3676 if (jt < jv || jt >= jv + jvar.
count())
3678 unsigned int j = jt - jv;
3682 auto indof = di.size();
3683 auto jndof = dj.size();
3685 unsigned int jj = j;
3690 auto sub = jac_block.sub_matrix(i * indof, indof, jj * jndof, jndof);
3691 if (scaling_factors[i] != 1.0)
3692 sub *= scaling_factors[i];
3700 jacobian.add_matrix(sub, di, dj);
3710 const std::vector<dof_id_type> & idof_indices,
3711 const std::vector<dof_id_type> & jdof_indices,
3714 if (idof_indices.size() == 0 || jdof_indices.size() == 0)
3716 if (jac_block.n() == 0 || jac_block.m() == 0)
3722 const unsigned int iv = ivar.
number();
3723 const unsigned int jv = jvar.
number();
3725 for (
unsigned int i = 0; i < ivar.
count(); ++i)
3729 if (jt < jv || jt >= jv + jvar.
count())
3731 unsigned int j = jt - jv;
3735 auto indof = di.size();
3736 auto jndof = dj.size();
3738 unsigned int jj = j;
3743 auto sub = jac_block.sub_matrix(i * indof, indof, jj * jndof, jndof);
3744 if (scaling_factors[i] != 1.0)
3745 sub *= scaling_factors[i];
3753 for (MooseIndex(di) i = 0; i < di.size(); i++)
3754 for (MooseIndex(dj) j = 0; j < dj.size(); j++)
3769 const std::vector<dof_id_type> & idof_indices,
3770 const std::vector<dof_id_type> & jdof_indices,
3773 if (idof_indices.size() == 0 || jdof_indices.size() == 0)
3775 if (jac_block.n() == 0 || jac_block.m() == 0)
3782 for (
unsigned int i = 0; i < ivar.
count(); ++i)
3784 unsigned int iv = ivar.
number();
3787 unsigned int jv = jvar.
number();
3788 if (jt < jv || jt >= jv + jvar.
count())
3790 unsigned int j = jt - jv;
3794 auto indof = di.size();
3795 auto jndof = dj.size();
3797 unsigned int jj = j;
3802 auto sub = jac_block.sub_matrix(i * indof, indof, jj * jndof, jndof);
3803 if (scaling_factor[i] != 1.0)
3804 sub *= scaling_factor[i];
3808 for (MooseIndex(di) i = 0; i < di.size(); i++)
3809 for (MooseIndex(dj) j = 0; j < dj.size(); j++)
3810 if (sub(i, j) != 0.0)
3823 const std::vector<dof_id_type> & idof_indices,
3824 const std::vector<dof_id_type> & jdof_indices,
3825 Real scaling_factor,
3827 const std::set<TagID> & tags)
3829 const auto has_matrix =
3830 std::any_of(tags.begin(), tags.end(), [
this](
const auto tag) { return _sys.hasMatrix(tag); });
3834 if ((idof_indices.size() > 0) && (jdof_indices.size() > 0) && jac_block.n() && jac_block.m() &&
3837 _row_indices.assign(idof_indices.begin(), idof_indices.end());
3847 if (scaling_factor != 1.0)
3860 FEType fe_type(
elem->default_order(), LAGRANGE);
3861 std::unique_ptr<FEBase> fe(FEBase::build(
elem->dim(), fe_type));
3864 const std::vector<Real> &
JxW = fe->get_JxW();
3865 const std::vector<Point> & q_points = fe->get_xyz();
3869 QGauss qrule(
elem->dim(), fe_type.default_quadrature_order());
3870 fe->attach_quadrature_rule(&qrule);
3875 mooseAssert(qrule.n_points() == q_points.size(),
3876 "The number of points in the quadrature rule doesn't match the number of passed-in "
3877 "points in Assembly::setCoordinateTransformation");
3881 for (
unsigned int qp = 0; qp < qrule.n_points(); ++qp)
3885 vol +=
JxW[qp] * coord;
3894 const ADRealEigenVector & v)
const
3896 for (
unsigned int j = 0; j < v.size(); ++j, i += ntest)
3907 "Error: Cached data sizes MUST be the same!");
3910 "Error: Cached data sizes MUST be the same for a given tag!");
3975 auto ivar = it.first;
3976 auto jvar = it.second;
3977 auto i = ivar->number();
3978 auto j = jvar->number();
3988 jvar->allDofIndices());
3997 auto ivar = it.first;
3998 auto jvar = it.second;
3999 auto i = ivar->number();
4000 auto j = jvar->number();
4011 jvar->dofIndicesNeighbor());
4017 ivar->dofIndicesNeighbor(),
4018 jvar->dofIndices());
4024 ivar->dofIndicesNeighbor(),
4025 jvar->dofIndicesNeighbor());
4035 auto ivar = it.first;
4036 auto jvar = it.second;
4037 auto i = ivar->number();
4038 auto j = jvar->number();
4047 ivar->dofIndicesLower(),
4048 jvar->dofIndicesLower());
4054 ivar->dofIndicesLower(),
4055 jvar->dofIndicesNeighbor());
4061 ivar->dofIndicesLower(),
4062 jvar->dofIndices());
4068 ivar->dofIndicesNeighbor(),
4069 jvar->dofIndicesLower());
4076 jvar->dofIndicesLower());
4089 jvar->dofIndicesNeighbor());
4095 ivar->dofIndicesNeighbor(),
4096 jvar->dofIndices());
4102 ivar->dofIndicesNeighbor(),
4103 jvar->dofIndicesNeighbor());
4113 auto ivar = it.first;
4114 auto jvar = it.second;
4115 auto i = ivar->number();
4116 auto j = jvar->number();
4125 ivar->dofIndicesLower(),
4126 jvar->dofIndicesLower());
4132 ivar->dofIndicesLower(),
4133 jvar->dofIndices());
4140 jvar->dofIndicesLower());
4180 auto ivar = it.first;
4181 auto jvar = it.second;
4182 auto i = ivar->number();
4183 auto j = jvar->number();
4192 jvar->allDofIndices(),
4202 auto ivar = it.first;
4203 auto jvar = it.second;
4204 auto i = ivar->number();
4205 auto j = jvar->number();
4216 jvar->dofIndicesNeighbor(),
4221 ivar->dofIndicesNeighbor(),
4228 ivar->dofIndicesNeighbor(),
4229 jvar->dofIndicesNeighbor(),
4240 auto ivar = it.first;
4241 auto jvar = it.second;
4242 auto i = ivar->number();
4243 auto j = jvar->number();
4251 ivar->dofIndicesLower(),
4252 jvar->dofIndicesLower(),
4258 ivar->dofIndicesLower(),
4265 ivar->dofIndicesLower(),
4266 jvar->dofIndicesNeighbor(),
4273 jvar->dofIndicesLower(),
4288 jvar->dofIndicesNeighbor(),
4294 ivar->dofIndicesNeighbor(),
4295 jvar->dofIndicesLower(),
4301 ivar->dofIndicesNeighbor(),
4308 ivar->dofIndicesNeighbor(),
4309 jvar->dofIndicesNeighbor(),
4319 const DofMap & dof_map,
4320 std::vector<dof_id_type> & dof_indices,
4322 const std::set<TagID> & tags)
4324 for (
auto tag : tags)
4332 const DofMap & dof_map,
4333 std::vector<dof_id_type> & dof_indices,
4337 if (dof_indices.size() == 0)
4339 if (!(*
_cm)(ivar, jvar))
4346 const unsigned int ivn = iv.number();
4347 const unsigned int jvn = jv.number();
4356 const unsigned int i = ivar - ivn;
4357 const unsigned int j = jvar - jvn;
4360 auto di = dof_indices;
4361 auto dj = dof_indices;
4363 auto indof = di.size();
4364 auto jndof = dj.size();
4366 unsigned int jj = j;
4370 auto sub = ke.
sub_matrix(i * indof, indof, jj * jndof, jndof);
4375 dof_map.constrain_element_matrix(sub, di, dj,
false);
4377 if (scaling_factor[i] != 1.0)
4378 sub *= scaling_factor[i];
4380 jacobian.add_matrix(sub, di, dj);
4385 const unsigned int ivar,
4386 const unsigned int jvar,
4387 const DofMap & dof_map,
4388 const std::vector<dof_id_type> & idof_indices,
4389 const std::vector<dof_id_type> & jdof_indices,
4393 if (idof_indices.size() == 0 || jdof_indices.size() == 0)
4395 if (jacobian.n() == 0 || jacobian.m() == 0)
4397 if (!(*
_cm)(ivar, jvar))
4404 const unsigned int ivn = iv.number();
4405 const unsigned int jvn = jv.number();
4414 const unsigned int i = ivar - ivn;
4415 const unsigned int j = jvar - jvn;
4418 auto di = idof_indices;
4419 auto dj = jdof_indices;
4421 auto indof = di.size();
4422 auto jndof = dj.size();
4424 unsigned int jj = j;
4428 auto sub = keg.
sub_matrix(i * indof, indof, jj * jndof, jndof);
4433 dof_map.constrain_element_matrix(sub, di, dj,
false);
4435 if (scaling_factor[i] != 1.0)
4436 sub *= scaling_factor[i];
4438 jacobian.add_matrix(sub, di, dj);
4443 const unsigned int ivar,
4444 const unsigned int jvar,
4445 const DofMap & dof_map,
4446 const std::vector<dof_id_type> & idof_indices,
4447 const std::vector<dof_id_type> & jdof_indices,
4449 const std::set<TagID> & tags)
4451 for (
auto tag : tags)
4453 jacobian, ivar, jvar, dof_map, idof_indices, jdof_indices,
GlobalDataKey{}, tag);
4458 const unsigned int ivar,
4459 const unsigned int jvar,
4460 const DofMap & dof_map,
4461 std::vector<dof_id_type> & dof_indices,
4462 std::vector<dof_id_type> & neighbor_dof_indices,
4466 if (dof_indices.size() == 0 && neighbor_dof_indices.size() == 0)
4468 if (!(*
_cm)(ivar, jvar))
4475 const unsigned int ivn = iv.number();
4476 const unsigned int jvn = jv.number();
4487 const unsigned int i = ivar - ivn;
4488 const unsigned int j = jvar - jvn;
4490 auto dc = dof_indices;
4491 auto dn = neighbor_dof_indices;
4492 auto cndof = dc.size();
4493 auto nndof = dn.size();
4495 unsigned int jj = j;
4499 auto suben = ken.
sub_matrix(i * cndof, cndof, jj * nndof, nndof);
4500 auto subne = kne.
sub_matrix(i * nndof, nndof, jj * cndof, cndof);
4501 auto subnn = knn.
sub_matrix(i * nndof, nndof, jj * nndof, nndof);
4508 dof_map.constrain_element_matrix(suben, dc, dn,
false);
4509 dof_map.constrain_element_matrix(subne, dn, dc,
false);
4510 dof_map.constrain_element_matrix(subnn, dn, dn,
false);
4513 if (scaling_factor[i] != 1.0)
4515 suben *= scaling_factor[i];
4516 subne *= scaling_factor[i];
4517 subnn *= scaling_factor[i];
4520 jacobian.add_matrix(suben, dc, dn);
4521 jacobian.add_matrix(subne, dn, dc);
4522 jacobian.add_matrix(subnn, dn, dn);
4527 const unsigned int ivar,
4528 const unsigned int jvar,
4529 const DofMap & dof_map,
4530 std::vector<dof_id_type> & dof_indices,
4531 std::vector<dof_id_type> & neighbor_dof_indices,
4533 const std::set<TagID> & tags)
4535 for (
const auto tag : tags)
4537 jacobian, ivar, jvar, dof_map, dof_indices, neighbor_dof_indices,
GlobalDataKey{}, tag);
4551 if (it.first->number() == ivar)
4557 numeric_index_type i, numeric_index_type j, Real value,
LocalDataKey,
TagID tag)
4566 numeric_index_type j,
4569 const std::set<TagID> & tags)
4571 for (
auto tag : tags)
4620 mooseAssert(
_xfem !=
nullptr,
"This function should not be called if xfem is inactive");
4629 "Size of weight multipliers in xfem doesn't match number of quadrature points");
4630 for (
unsigned i = 0; i < xfem_weight_multipliers.
size(); i++)
4633 xfem_weight_multipliers.
release();
4640 mooseAssert(
_xfem !=
nullptr,
"This function should not be called if xfem is inactive");
4646 if (
_xfem->getXFEMFaceWeights(
4650 "Size of weight multipliers in xfem doesn't match number of quadrature points");
4651 for (
unsigned i = 0; i < xfem_face_weight_multipliers.
size(); i++)
4654 xfem_face_weight_multipliers.
release();
4664 for (MooseIndex(weights.size()) i = 0; i < weights.size(); ++i)
4670Assembly::fePhi<VectorValue<Real>>(FEType type)
const
4672 buildVectorFE(type);
4673 return _vector_fe_shape_data[type]->_phi;
4678Assembly::feGradPhi<VectorValue<Real>>(FEType type)
const
4680 buildVectorFE(type);
4681 return _vector_fe_shape_data[type]->_grad_phi;
4686Assembly::feSecondPhi<VectorValue<Real>>(FEType type)
const
4688 _need_second_derivative.insert(type);
4689 buildVectorFE(type);
4690 return _vector_fe_shape_data[type]->_second_phi;
4695Assembly::fePhiLower<VectorValue<Real>>(FEType type)
const
4697 buildVectorLowerDFE(type);
4698 return _vector_fe_shape_data_lower[type]->_phi;
4703Assembly::feDualPhiLower<VectorValue<Real>>(FEType type)
const
4705 buildVectorDualLowerDFE(type);
4706 return _vector_fe_shape_data_dual_lower[type]->_phi;
4711Assembly::feGradPhiLower<VectorValue<Real>>(FEType type)
const
4713 buildVectorLowerDFE(type);
4714 return _vector_fe_shape_data_lower[type]->_grad_phi;
4719Assembly::feGradDualPhiLower<VectorValue<Real>>(FEType type)
const
4721 buildVectorDualLowerDFE(type);
4722 return _vector_fe_shape_data_dual_lower[type]->_grad_phi;
4727Assembly::fePhiFace<VectorValue<Real>>(FEType type)
const
4729 buildVectorFaceFE(type);
4730 return _vector_fe_shape_data_face[type]->_phi;
4735Assembly::feGradPhiFace<VectorValue<Real>>(FEType type)
const
4737 buildVectorFaceFE(type);
4738 return _vector_fe_shape_data_face[type]->_grad_phi;
4743Assembly::feSecondPhiFace<VectorValue<Real>>(FEType type)
const
4745 _need_second_derivative.insert(type);
4746 buildVectorFaceFE(type);
4751 buildVectorFaceNeighborFE(type);
4753 return _vector_fe_shape_data_face[type]->_second_phi;
4758Assembly::fePhiNeighbor<VectorValue<Real>>(FEType type)
const
4760 buildVectorNeighborFE(type);
4761 return _vector_fe_shape_data_neighbor[type]->_phi;
4766Assembly::feGradPhiNeighbor<VectorValue<Real>>(FEType type)
const
4768 buildVectorNeighborFE(type);
4769 return _vector_fe_shape_data_neighbor[type]->_grad_phi;
4774Assembly::feSecondPhiNeighbor<VectorValue<Real>>(FEType type)
const
4776 _need_second_derivative_neighbor.insert(type);
4777 buildVectorNeighborFE(type);
4778 return _vector_fe_shape_data_neighbor[type]->_second_phi;
4783Assembly::fePhiFaceNeighbor<VectorValue<Real>>(FEType type)
const
4785 buildVectorFaceNeighborFE(type);
4786 return _vector_fe_shape_data_face_neighbor[type]->_phi;
4791Assembly::feGradPhiFaceNeighbor<VectorValue<Real>>(FEType type)
const
4793 buildVectorFaceNeighborFE(type);
4794 return _vector_fe_shape_data_face_neighbor[type]->_grad_phi;
4799Assembly::feSecondPhiFaceNeighbor<VectorValue<Real>>(FEType type)
const
4801 _need_second_derivative_neighbor.insert(type);
4802 buildVectorFaceNeighborFE(type);
4803 return _vector_fe_shape_data_face_neighbor[type]->_second_phi;
4808Assembly::feCurlPhi<VectorValue<Real>>(FEType type)
const
4810 _need_curl.insert(type);
4811 buildVectorFE(type);
4812 return _vector_fe_shape_data[type]->_curl_phi;
4817Assembly::feCurlPhiFace<VectorValue<Real>>(FEType type)
const
4819 _need_curl.insert(type);
4820 buildVectorFaceFE(type);
4825 buildVectorFaceNeighborFE(type);
4827 return _vector_fe_shape_data_face[type]->_curl_phi;
4832Assembly::feCurlPhiNeighbor<VectorValue<Real>>(FEType type)
const
4834 _need_curl.insert(type);
4835 buildVectorNeighborFE(type);
4836 return _vector_fe_shape_data_neighbor[type]->_curl_phi;
4841Assembly::feCurlPhiFaceNeighbor<VectorValue<Real>>(FEType type)
const
4843 _need_curl.insert(type);
4844 buildVectorFaceNeighborFE(type);
4846 return _vector_fe_shape_data_face_neighbor[type]->_curl_phi;
4851Assembly::feDivPhi<VectorValue<Real>>(FEType type)
const
4853 _need_div.insert(type);
4854 buildVectorFE(type);
4855 return _vector_fe_shape_data[type]->_div_phi;
4860Assembly::feDivPhiFace<VectorValue<Real>>(FEType type)
const
4862 _need_face_div.insert(type);
4863 buildVectorFaceFE(type);
4868 buildVectorFaceNeighborFE(type);
4870 return _vector_fe_shape_data_face[type]->_div_phi;
4875Assembly::feDivPhiNeighbor<VectorValue<Real>>(FEType type)
const
4877 _need_neighbor_div.insert(type);
4878 buildVectorNeighborFE(type);
4879 return _vector_fe_shape_data_neighbor[type]->_div_phi;
4884Assembly::feDivPhiFaceNeighbor<VectorValue<Real>>(FEType type)
const
4886 _need_face_neighbor_div.insert(type);
4887 buildVectorFaceNeighborFE(type);
4888 return _vector_fe_shape_data_face_neighbor[type]->_div_phi;
4944 auto process_fe_and_helpers = [&helper_type](
auto & unique_helper_container,
4945 auto & helper_container,
4946 const unsigned int num_dimensionalities,
4947 const bool user_added_helper_type,
4948 auto & fe_container)
4950 unique_helper_container.
resize(num_dimensionalities);
4951 for (
const auto dim : make_range(num_dimensionalities))
4953 auto & unique_helper = unique_helper_container[
dim];
4954 unique_helper = FEGenericBase<Real>::build(
dim, helper_type);
4956 unique_helper->add_p_level_in_reinit(
false);
4957 helper_container[
dim] = unique_helper.get();
4961 if (!user_added_helper_type)
4963 auto & fe_container_dim = libmesh_map_find(fe_container,
dim);
4964 auto fe_it = fe_container_dim.find(helper_type);
4965 mooseAssert(fe_it != fe_container_dim.end(),
"We should have the helper type");
4966 delete fe_it->second;
4967 fe_container_dim.erase(fe_it);
5006 const Point & point,
5016 const Point & point,
5027Assembly::genericQPoints<false>()
const
5034Assembly::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< VectorValue< ADReal > > _ad_elem_node_points
The positions of the nodes of the element passed to computeADElemNodePoints.
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.
bool _need_ad_grad_phi_face
Whether any object needs the AD face shape function gradients.
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.
std::vector< Number > _ad_elem_disp_nodal_soln
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
std::vector< Number > _ad_elem_disp_unit_soln
bool _current_side_volume_computed
Boolean to indicate whether current element side volumes has been computed.
bool _need_ad_volume_map
Whether any object needs the AD element JxW, quadrature points or coordinate transformation.
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.
bool _need_ad_face_map
Whether any object needs the AD face JxW, normals, quadrature points, curvatures or coordinate transf...
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 reinitNeighborSurfaceElemRef(const Elem *neighbor_elem, const std::vector< Point > &pts)
Reinitialize FE data for a neighbor element that is itself the face, i.e.
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::vector< dof_id_type > _ad_elem_disp_dof_indices
Working vectors for computeADElemNodePoints.
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
bool _need_ad_grad_phi
Whether any object needs the AD element shape function gradients.
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>
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 addCachedResiduals(GlobalDataKey, const std::vector< VectorTag > &tags)
Pushes all cached residuals to the global residual vectors associated with each tag.
void computeADElemNodePoints(const Elem &elem, bool do_derivatives)
Fill _ad_elem_node_points with the positions of the nodes of elem, with derivatives with respect to t...
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.
virtual libMesh::DofMap & dofMap()
Gets writeable reference to the dof map.
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
const Variable & variable(const unsigned int c) const override
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 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