11 #include "PenetrationLocator.h"
12 #include "PenetrationInfo.h"
13 #include "SystemBase.h"
15 #include "NearestNodeLocator.h"
17 #include "libmesh/numeric_vector.h"
18 #include "libmesh/sparse_matrix.h"
26 InputParameters params = validParams<NodeFaceConstraint>();
27 params.set<
bool>(
"use_displaced_mesh") =
true;
30 params.addRequiredParam<MooseEnum>(
31 "component",
component,
"The force component constraint that this object is supplying");
32 params.addRequiredCoupledVar(
34 "The displacements appropriate for the simulation geometry and coordinate system");
39 : NodeFaceConstraint(parameters),
40 _component(getParam<MooseEnum>(
"component")),
41 _mesh_dimension(_mesh.dimension()),
42 _residual_copy(_sys.residualGhosted())
45 for (
unsigned int i = 0; i < coupledComponents(
"displacements"); ++i)
47 _vars.push_back(coupled(
"displacements", i));
52 mooseError(
"The number of displacement variables does not match the mesh dimension!");
70 auto & nearest_node_loc = _penetration_locator._nearest_node;
71 _nearest_node = nearest_node_loc.nearestNode(_current_node->id());
74 auto slave_dof_number = _current_node->dof_number(0,
_vars[
_component], 0);
77 if (!_subproblem.currentlyComputingJacobian())
78 _node_to_lm.insert(std::make_pair(_current_node->id(),
83 std::vector<dof_id_type> master_cols;
84 std::vector<Number> master_values;
86 _jacobian->get_row(slave_dof_number, master_cols, master_values);
87 mooseAssert(master_cols.size() == master_values.size(),
88 "The size of the dof container and value container are different");
92 for (MooseIndex(master_cols) i = 0; i < master_cols.size(); ++i)
94 std::make_pair(master_cols[i], master_values[i] / _var.scalingFactor()));
98 "The node " << _current_node->id() <<
" should map to a lagrange multiplier");
103 "nearest node not a node on the current master element");
116 case Moose::ConstraintType::Slave:
119 case Moose::ConstraintType::Master:
138 case Moose::ConstraintJacobianType::SlaveSlave:
139 return _phi_slave[_j][_qp];
141 case Moose::ConstraintJacobianType::SlaveMaster:
147 case Moose::ConstraintJacobianType::MasterSlave:
152 "The connected dof index is not found in the _dof_number_to_value container. "
153 "This must mean that insufficient sparsity was allocated");
172 mooseError(
"We overrode commputeSlaveValue so computeQpSlaveValue should never get called");