17 #include "libmesh/null_output_iterator.h" 18 #include "libmesh/parallel.h" 19 #include "libmesh/parallel_elem.h" 20 #include "libmesh/parallel_node.h" 35 params.
addRequiredParam<BoundaryName>(
"secondary",
"The secondary boundary");
42 _primary_boundary_id(getParam<BoundaryName>(
"boundary")),
43 _secondary_boundary_id(getParam<BoundaryName>(
"secondary")),
44 _penalty(getParam<
Real>(
"penalty"))
48 "Primary variable must be identical to secondary variable. " 49 "Different variables are currently not supported.");
67 std::vector<dof_id_type> secondary_nodelist =
69 std::vector<dof_id_type> primary_nodelist =
73 for (
auto in : secondary_nodelist)
80 for (
auto in : primary_nodelist)
92 std::set<Elem *, CompareElemsByLevel> primary_elems_to_ghost;
93 std::set<Node *> nodes_to_ghost;
95 for (
unsigned int i = 0; i < primary_nodelist.size(); ++i)
99 bool found_elems = (node_to_elem_pair != node_to_elem_map.end());
102 bool someone_found_elems = found_elems;
104 mooseAssert(someone_found_elems,
"Missing entry in node to elem map");
109 for (
auto id : node_to_elem_pair->second)
114 primary_elems_to_ghost.insert(elem);
117 for (
unsigned int n = 0; n !=
n_nodes; ++n)
118 nodes_to_ghost.insert(elem->
node_ptr(n));
126 nodes_to_ghost.begin(),
127 nodes_to_ghost.end(),
131 primary_elems_to_ghost.begin(),
132 primary_elems_to_ghost.end(),
140 bool found_elems = (node_to_elem_pair != new_node_to_elem_map.end());
143 mooseError(
"Colundn't find any elements connected to primary node.");
146 elems[i] = node_to_elem_pair->second;
153 bool found_elems = (node_to_elem_pair != node_to_elem_map.end());
156 mooseError(
"Couldn't find any elements connected to primary node");
158 elems[i] = node_to_elem_pair->second;
164 if (elems[i].size() == 0)
165 mooseError(
"Couldn't find any elements connected to primary node");
167 for (
unsigned int j = 0;
j < elems[i].size(); ++
j)
174 for (
unsigned int j = 0;
j < secondary_nodelist.size(); ++
j)
182 Real d = (secondary_node - primary_node).
norm();
211 for (
_i = 0;
_i < secondarydof.size(); ++
_i)
224 Ken(
_j,
_i) += jacobian(secondarydof[
_i], primarydof[
_j]);
225 Kne(
_i,
_j) += -jacobian(secondarydof[
_i], primarydof[
_j]) +
227 Knn(
_i,
_i) += -jacobian(secondarydof[
_i], secondarydof[
_i]) +
248 for (
_i = 0;
_i < secondarydof.size(); ++
_i)
259 Real res = residual(secondarydof[
_i]);
NodalStickConstraint(const InputParameters ¶meters)
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
virtual void zero() override final
const VariableValue & _u_primary
const Real & _penalty
Tangential stiffness of spring in all directions.
virtual void zero() override final
unsigned int number() const
void addResiduals(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
const VariableValue & _u_secondary
const Parallel::Communicator & comm() const
void allgather_packed_range(Context *context, Iter range_begin, const Iter range_end, OutputIter out, std::size_t approx_buffer_size=1000000) const
virtual void computeResidual() override final
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
static InputParameters validParams()
virtual const Node & nodeRef(const dof_id_type i) const
virtual Elem * queryElemPtr(const dof_id_type i)
std::vector< dof_id_type > _primary_node_vector
void addJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
static InputParameters validParams()
virtual bool is_serial() const
const dof_id_type n_nodes
const std::vector< dof_id_type > & dofIndices() const final
virtual void meshChanged() override
std::vector< dof_id_type > _connected_nodes
virtual unsigned int n_nodes() const=0
Moose::ConstraintFormulationType _formulation
virtual Real computeQpResidual(Moose::ConstraintType type) override
const std::vector< dof_id_type > & getNodeList(boundary_id_type nodeset_id) const
const std::string & type() const
void paramError(const std::string ¶m, Args... args) const
BoundaryName _primary_boundary_id
Holds the secondary node set or side set.
virtual void computeJacobian() override final
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void max(const T &r, T &o, Request &req) const
const Node * node_ptr(const unsigned int i) const
const std::vector< dof_id_type > & dofIndicesNeighbor() const final
virtual void addGhostedElem(dof_id_type elem_id)=0
void mooseError(Args &&... args) const
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
void updateConstrainedNodes()
Update the sets of nodes with constrained DOFs.
virtual Real computeQpJacobian(Moose::ConstraintJacobianType type) override
processor_id_type processor_id() const
std::vector< dof_id_type > _primary_conn
primary node id connected to each secondary node in _connected_nodes
processor_id_type processor_id() const
BoundaryName _secondary_boundary_id
Holds the secondary node set or side set.
MooseVariable & _var_secondary
void scalingFactor(const std::vector< Real > &factor)
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
const std::map< dof_id_type, std::vector< dof_id_type > > & nodeToElemMap()
registerMooseObject("SolidMechanicsApp", NodalStickConstraint)