21 "Constrains secondary node to move as a linear combination of primary nodes.");
22 params.
addRequiredParam<std::vector<unsigned int>>(
"primary",
"The primary node IDs.");
23 params.
addParam<std::vector<unsigned int>>(
24 "secondary_node_ids", {},
"The list of secondary node ids");
26 "secondary_node_set",
"NaN",
"The boundary ID associated with the secondary side");
29 "The weights associated with the primary node ids. " 30 "Must be of the same size as primary nodes");
36 _primary_node_ids(getParam<
std::vector<unsigned
int>>(
"primary")),
37 _secondary_node_ids(getParam<
std::vector<unsigned
int>>(
"secondary_node_ids")),
38 _secondary_node_set_id(getParam<BoundaryName>(
"secondary_node_set")),
39 _penalty(getParam<
Real>(
"penalty"))
41 _weights = getParam<std::vector<Real>>(
"weights");
44 mooseError(
"primary and weights should be of equal size.");
49 mooseError(
"Please specify secondary_node_ids or secondary_node_set.");
52 std::vector<dof_id_type> nodelist =
54 std::vector<dof_id_type>::iterator in;
56 for (in = nodelist.begin(); in != nodelist.end(); ++in)
58 const Node *
const node = lm_mesh.query_node_ptr(*in);
67 const Node *
const node = lm_mesh.query_node_ptr(dof);
78 auto node_to_elem_pair = node_to_elem_map.find(dof);
81 if (node_to_elem_pair == node_to_elem_map.end())
87 const std::vector<dof_id_type> & elems = node_to_elem_pair->second;
89 for (
const auto & elem_id : elems)
MooseMesh & _mesh
Reference to this Kernel's mesh object.
std::string _secondary_node_set_id
virtual Real computeQpResidual(Moose::ConstraintType type) override
Computes the residual for the current secondary node.
const VariableValue & _u_primary
Holds the current solution at the current quadrature point.
const VariableValue & _u_secondary
Value of the unknown variable this BC is action on.
static InputParameters validParams()
unsigned int _i
Counter for primary and secondary nodes.
std::vector< dof_id_type > _primary_node_vector
node IDs of the primary node
registerMooseObject("MooseApp", LinearNodalConstraint)
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
virtual Real computeQpJacobian(Moose::ConstraintJacobianType type) override
Computes the jacobian for the constraint.
std::vector< dof_id_type > _connected_nodes
node IDs connected to the primary node (secondary nodes)
std::vector< Real > _weights
When the secondary node is constrained to move as a linear combination of the primary nodes...
SubProblem & _subproblem
Reference to this kernel's SubProblem.
std::vector< unsigned int > _primary_node_ids
const std::vector< dof_id_type > & getNodeList(boundary_id_type nodeset_id) const
Return a writable reference to a vector of node IDs that belong to nodeset_id.
const std::string & type() const
Get the type of this class.
The secondary node variable is programmed as a linear combination of the primary node variables (i...
LinearNodalConstraint(const InputParameters ¶meters)
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void addGhostedElem(dof_id_type elem_id)=0
Will make sure that all dofs connected to elem_id are ghosted to this processor.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
processor_id_type processor_id() const
std::vector< unsigned int > _secondary_node_ids
void ErrorVector unsigned int
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
const std::map< dof_id_type, std::vector< dof_id_type > > & nodeToElemMap()
If not already created, creates a map from every node to all elements to which they are connected...