28 params.
addRequiredParam<BoundaryName>(
"secondary",
"The secondary boundary");
35 _primary_boundary_id(getParam<BoundaryName>(
"boundary")),
36 _secondary_boundary_id(getParam<BoundaryName>(
"secondary")),
37 _penalty(getParam<Real>(
"penalty"))
41 "Primary variable must be identical to secondary variable. "
42 "Different variables are currently not supported.");
60 std::vector<dof_id_type> secondary_nodelist =
62 std::vector<dof_id_type> primary_nodelist =
66 for (
auto in : secondary_nodelist)
73 for (
auto in : primary_nodelist)
77 for (
const auto elem_id : elem_ids)
82 const auto displaced_elem_ids =
84 if (displaced_elem_ids != elem_ids)
85 mooseError(
"Reference and displaced meshes selected different primary elements");
91 for (
unsigned int j = 0; j < secondary_nodelist.size(); ++j)
95 Node & secondary_node =
_mesh.
nodeRef(secondary_nodelist[j]);
99 Real
d = (secondary_node - primary_node).norm();
100 if (MooseUtils::absoluteFuzzyEqual(
d, 0.0))
118 DenseMatrix<Number> Kee(primarydof.size(), primarydof.size());
119 DenseMatrix<Number> Ken(primarydof.size(), secondarydof.size());
120 DenseMatrix<Number> Kne(secondarydof.size(), primarydof.size());
121 DenseMatrix<Number> Knn(secondarydof.size(), secondarydof.size());
128 for (
_i = 0;
_i < secondarydof.size(); ++
_i)
141 Ken(
_j,
_i) += jacobian(secondarydof[
_i], primarydof[
_j]);
142 Kne(
_i,
_j) += -jacobian(secondarydof[
_i], primarydof[
_j]) +
144 Knn(
_i,
_i) += -jacobian(secondarydof[
_i], secondarydof[
_i]) +
160 DenseVector<Number> re(primarydof.size());
161 DenseVector<Number> neighbor_re(secondarydof.size());
165 for (
_i = 0;
_i < secondarydof.size(); ++
_i)
176 Real res = residual(secondarydof[
_i]);
registerMooseObject("SolidMechanicsApp", NodalStickConstraint)
std::shared_ptr< DisplacedProblem > displaced_problem
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
virtual MooseMesh & mesh() override
const std::string & type() const
void paramError(const std::string ¶m, Args... args) const
void mooseError(Args &&... args) const
virtual const Node & nodeRef(const dof_id_type i) const
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
const std::vector< dof_id_type > & getNodeList(boundary_id_type nodeset_id) const
void scalingFactor(const std::vector< Real > &factor)
unsigned int number() const
const std::vector< dof_id_type > & dofIndicesNeighbor() const final
const std::vector< dof_id_type > & dofIndices() const final
Moose::ConstraintFormulationType _formulation
std::vector< dof_id_type > _primary_node_vector
std::vector< dof_id_type > _connected_nodes
std::vector< dof_id_type > gatherAndRetainConnectedElems(MooseMesh &mesh, const std::vector< dof_id_type > &node_ids)
static InputParameters validParams()
MooseVariable & _var_secondary
const VariableValue & _u_secondary
const VariableValue & _u_primary
const Real & _penalty
Tangential stiffness of spring in all directions.
virtual void meshChanged() override
virtual void computeResidual() override final
std::vector< dof_id_type > _primary_conn
primary node id connected to each secondary node in _connected_nodes
NodalStickConstraint(const InputParameters ¶meters)
virtual Real computeQpResidual(Moose::ConstraintType type) override
void updateConstrainedNodes()
Update the sets of nodes with constrained DOFs.
static InputParameters validParams()
BoundaryName _secondary_boundary_id
Holds the secondary node set or side set.
BoundaryName _primary_boundary_id
Holds the secondary node set or side set.
virtual Real computeQpJacobian(Moose::ConstraintJacobianType type) override
virtual void computeJacobian() override final
FEProblemBase & _fe_problem
virtual void addGhostedElem(dof_id_type elem_id)=0
void addJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
void addResiduals(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
processor_id_type processor_id() const