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");
37 "Friction coefficient for slippage in the normal direction");
39 "Normal force used together with friction_coefficient to compute " 40 "the normal frictional capacity.");
42 "Stiffness of the spring in the tangential direction.");
48 _primary_boundary_id(getParam<BoundaryName>(
"boundary")),
49 _secondary_boundary_id(getParam<BoundaryName>(
"secondary")),
50 _normal_force(getParam<
Real>(
"normal_force")),
51 _tangential_penalty(getParam<
Real>(
"tangential_penalty")),
52 _friction_coefficient(getParam<
Real>(
"friction_coefficient")),
53 _u_secondary_old(_var.dofValuesOldNeighbor()),
54 _u_primary_old(_var.dofValuesOld())
58 "Primary variable must be identical to secondary " 59 "variable. Different variables are currently not supported.");
63 MooseEnum temp_formulation = getParam<MooseEnum>(
"formulation");
64 if (temp_formulation ==
"penalty")
66 else if (temp_formulation ==
"kinematic")
67 mooseError(
"NodalFrictionalConstraint: Kinematic formulation is currently not supported for " 70 mooseError(
"Formulation must be set to Penalty.");
86 std::vector<dof_id_type> secondary_nodelist =
88 std::vector<dof_id_type> primary_nodelist =
92 for (
auto in : secondary_nodelist)
99 for (
auto in : primary_nodelist)
111 std::set<Elem *, CompareElemsByLevel> primary_elems_to_ghost;
112 std::set<Node *> nodes_to_ghost;
114 for (
unsigned int i = 0; i < primary_nodelist.size(); ++i)
118 bool found_elems = (node_to_elem_pair != node_to_elem_map.end());
121 bool someone_found_elems = found_elems;
123 mooseAssert(someone_found_elems,
"Missing entry in node to elem map");
128 for (
auto id : node_to_elem_pair->second)
133 primary_elems_to_ghost.insert(elem);
136 for (
unsigned int n = 0; n !=
n_nodes; ++n)
137 nodes_to_ghost.insert(elem->
node_ptr(n));
145 nodes_to_ghost.begin(),
146 nodes_to_ghost.end(),
150 primary_elems_to_ghost.begin(),
151 primary_elems_to_ghost.end(),
159 bool found_elems = (node_to_elem_pair != new_node_to_elem_map.end());
162 mooseError(
"Colundn't find any elements connected to primary node.");
165 elems[i] = node_to_elem_pair->second;
172 bool found_elems = (node_to_elem_pair != node_to_elem_map.end());
175 mooseError(
"Couldn't find any elements connected to primary node");
177 elems[i] = node_to_elem_pair->second;
183 if (elems[i].size() == 0)
184 mooseError(
"Couldn't find any elements connected to primary node");
186 for (
unsigned int j = 0;
j < elems[i].size(); ++
j)
193 for (
unsigned int j = 0;
j < secondary_nodelist.size(); ++
j)
201 Real d = (secondary_node - primary_node).
norm();
222 std::vector<Number> re(primarydof.size());
223 std::vector<Number> neighbor_re(secondarydof.size());
225 for (
_i = 0;
_i < secondarydof.size(); ++
_i)
256 return current_force;
258 return -current_force;
280 for (
_i = 0;
_i < secondarydof.size(); ++
_i)
const VariableValue & _u_secondary_old
Old value of the constrainted variable on the secondary nodes.
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
const VariableValue & _u_primary
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 Real & _tangential_penalty
Tangential stiffness of spring.
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...
virtual Real computeQpResidual(Moose::ConstraintType type) override
static InputParameters validParams()
virtual const Node & nodeRef(const dof_id_type i) const
virtual Elem * queryElemPtr(const dof_id_type i)
const VariableValue & _u_primary_old
Old value of the constrainted variable on the primary nodes.
std::vector< dof_id_type > _primary_node_vector
void addJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
virtual Real computeQpJacobian(Moose::ConstraintJacobianType type) override
virtual bool is_serial() const
const dof_id_type n_nodes
const std::vector< dof_id_type > & dofIndices() const final
std::vector< dof_id_type > _connected_nodes
virtual unsigned int n_nodes() const=0
Moose::ConstraintFormulationType _formulation
const std::vector< dof_id_type > & getNodeList(boundary_id_type nodeset_id) const
const Real & _normal_force
Normal stiffness of spring.
std::vector< dof_id_type > _primary_conn
primary node id connected to each secondary node in _connected_nodes
const std::string & type() const
void paramError(const std::string ¶m, Args... args) const
void updateConstrainedNodes()
Update the sets of nodes with constrained DOFs.
virtual void meshChanged() override
const Real & _friction_coefficient
Coefficient of friction.
virtual void computeJacobian() override final
static InputParameters validParams()
registerMooseObject("SolidMechanicsApp", NodalFrictionalConstraint)
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
BoundaryName _primary_boundary_id
Holds the secondary node set or side set.
const std::vector< dof_id_type > & dofIndicesNeighbor() const final
virtual void addGhostedElem(dof_id_type elem_id)=0
NodalFrictionalConstraint(const InputParameters ¶meters)
void mooseError(Args &&... args) const
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const ConsoleStream _console
processor_id_type processor_id() const
processor_id_type processor_id() const
MooseVariable & _var_secondary
bool absoluteFuzzyGreaterThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
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()
BoundaryName _secondary_boundary_id
Holds the secondary node set or side set.