21 "Constraint for enforcing that variables on each side of a boundary are equivalent.");
24 "The ID of the primary node. If no ID is provided, first node of secondary set is chosen.");
25 params.
addParam<Point>(
"primary_node_coord",
"Coordinates of the primary node to locate.");
26 params.
addParam<std::vector<unsigned int>>(
"secondary_node_ids",
"The IDs of the secondary node");
27 params.
addParam<BoundaryName>(
"secondary",
"The boundary ID associated with the secondary side");
28 params.
addRequiredParam<Real>(
"penalty",
"The penalty used for the boundary term");
50 paramError(
"secondary",
"Either secondary or secondary_node_ids must be provided.");
55 "Both 'secondary' and 'secondary_node_ids' parameters are set. They are mutually "
66 const auto & secondary_bnd = getParam<BoundaryName>(
"secondary");
72 const auto & secondary_node_ids = getParam<std::vector<unsigned int>>(
"secondary_node_ids");
83 "Both 'primary' and 'primary_node_coord' parameters are set. They are mutually exclusive.");
85 dof_id_type primary_node_id = Node::invalid_id;
92 primary_node_id = getParam<unsigned int>(
"primary");
111 mooseAssert(primary_node_id != Node::invalid_id,
"We should have found a primary node");
127 std::unordered_set<dof_id_type> local_primary_node_ids;
128 const auto & primary_node_coord = getParam<Point>(
"primary_node_coord");
133 if ((*(bnd_node->_node) - primary_node_coord).norm() < eps)
143 local_primary_node_ids.insert(bnd_node->_node->id());
148 const std::vector<dof_id_type> local_node_vec(local_primary_node_ids.begin(),
149 local_primary_node_ids.end());
150 std::vector<std::vector<dof_id_type>> gathered_node_vecs;
154 std::unordered_set<dof_id_type> global_primary_node_ids;
155 for (
const auto & vec : gathered_node_vecs)
156 global_primary_node_ids.insert(vec.begin(), vec.end());
159 if (global_primary_node_ids.size() == 0)
160 mooseError(
"Couldn't find a node ID for the specified primary_node_coord.");
161 else if (global_primary_node_ids.size() > 1)
162 mooseError(
"Multiple nodes found for the specified primary_node_coord.");
164 return *global_primary_node_ids.begin();
registerMooseObject("MooseApp", EqualValueBoundaryConstraint)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
dof_id_type getPrimaryNodeIDByCoord() const
Get the primary node ID by searching for the node with coordinates matching _primary_node_coord on th...
virtual Real computeQpJacobian(Moose::ConstraintJacobianType type) override
Computes the jacobian for the constraint.
void pickPrimaryNode()
Pick the primary node from user input or from the secondary node set.
void populateSecondaryNodes()
Populate the set of secondary nodes from user input.
EqualValueBoundaryConstraint(const InputParameters ¶meters)
static InputParameters validParams()
Real _penalty
Penalty if constraint is not satisfied.
virtual void updateConnectivity() override
Update the sets of nodes with constrained DOFs.
virtual Real computeQpResidual(Moose::ConstraintType type) override
Computes the residual for the current secondary node.
const std::string & type() const
Get the type of this class.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
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.
libMesh::StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
std::vector< dof_id_type > localSecondaryNodes(const std::vector< dof_id_type > &node_ids) const
Select the nodes of 'node_ids' that this process owns, which are the secondary nodes it is responsibl...
unsigned int _i
Counter for primary and secondary nodes.
std::vector< dof_id_type > _primary_node_vector
node IDs of the primary node
std::vector< dof_id_type > _connected_nodes
node IDs connected to the primary node (secondary nodes)
void updateConstrainedNodes()
Rebuild the constrained node lists and the ghosting they require.
static InputParameters validParams()
const VariableValue & _u_secondary
Value of the unknown variable this BC is action on.
const VariableValue & _u_primary
Holds the current solution at the current quadrature point.
MooseMesh & _mesh
Reference to this Kernel's mesh object.
void min(const T &r, T &o, Request &req) const
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
const Parallel::Communicator & comm() const
static constexpr Real TOLERANCE