16 #include "metaphysicl/dualsemidynamicsparsenumberarray.h" 17 #include "metaphysicl/parallel_dualnumber.h" 18 #include "metaphysicl/parallel_dynamic_std_array_wrapper.h" 19 #include "metaphysicl/parallel_semidynamicsparsenumberarray.h" 30 params.
addClassDescription(
"Computes the tangential frictional forces for dynamic simulations");
33 "The frictional Lagrange's multiplier for an addtional direction.");
36 "Coupled function to evaluate friction with values from contact pressure and relative " 37 "tangential velocities (from the previous step).");
38 params.
addParam<
Real>(
"c_t", 1e0,
"Numerical parameter for tangential constraints");
42 "Minimum value of contact pressure that will trigger frictional enforcement");
43 params.
addParam<
Real>(
"mu",
"The friction coefficient for the Coulomb friction law");
50 _c_t(getParam<
Real>(
"c_t")),
51 _secondary_x_dot(_secondary_var.adUDot()),
52 _primary_x_dot(_primary_var.adUDotNeighbor()),
53 _secondary_y_dot(adCoupledDot(
"disp_y")),
54 _primary_y_dot(adCoupledNeighborValueDot(
"disp_y")),
55 _secondary_z_dot(_has_disp_z ? &adCoupledDot(
"disp_z") : nullptr),
56 _primary_z_dot(_has_disp_z ? &adCoupledNeighborValueDot(
"disp_z") : nullptr),
57 _epsilon(getParam<
Real>(
"epsilon")),
58 _mu(isParamValid(
"mu") ? getParam<
Real>(
"mu") :
std::numeric_limits<double>::quiet_NaN()),
59 _function_friction(isParamValid(
"function_friction") ? &getFunction(
"function_friction")
61 _has_friction_function(isParamValid(
"function_friction")),
66 "A coefficient of friction needs to be provided as a constant value of via a function.");
70 "Either provide a constant coefficient of friction or a function defining the " 71 "coefficient of friction. Both inputs cannot be provided simultaneously.");
73 if (!getParam<bool>(
"use_displaced_mesh"))
75 "'use_displaced_mesh' must be true for the " 76 "ComputeFrictionalForceLMMechanicalContact object");
80 "Three-dimensional mortar frictional contact simulations require an additional " 81 "frictional Lagrange's multiplier to enforce a second tangential pressure");
92 "Frictional contact constraints only support elemental variables of CONSTANT order");
119 const DofObject *
const dof =
129 nodal_tangents[0][
_i];
139 nodal_tangents[1][
_i];
179 const DofObject *
const dof = pr.first;
204 const std::unordered_set<const Node *> & inactive_lm_nodes)
218 const DofObject *
const dof = pr.first;
221 if ((inactive_lm_nodes.find(static_cast<const Node *>(dof)) != inactive_lm_nodes.end()) ||
242 const DofObject *
const dof)
252 std::array<dof_id_type, 2> friction_dof_indices;
253 std::array<ADReal, 2> friction_lm_values;
255 const unsigned int num_tangents = 2;
280 dof_residual = friction_lm_values[0];
281 dof_residual_dir = friction_lm_values[1];
285 const Real epsilon_sqrt = 1.0e-48;
287 const auto lamdba_plus_cg = contact_pressure +
c * weighted_gap;
288 std::array<ADReal, 2> lambda_t_plus_ctu;
289 lambda_t_plus_ctu[0] = friction_lm_values[0] + c_t * *tangential_vel[0] *
_dt;
290 lambda_t_plus_ctu[1] = friction_lm_values[1] + c_t * *tangential_vel[1] *
_dt;
292 const auto term_1_x =
293 std::max(mu_ad * lamdba_plus_cg,
294 std::sqrt(lambda_t_plus_ctu[0] * lambda_t_plus_ctu[0] +
295 lambda_t_plus_ctu[1] * lambda_t_plus_ctu[1] + epsilon_sqrt)) *
296 friction_lm_values[0];
298 const auto term_1_y =
299 std::max(mu_ad * lamdba_plus_cg,
300 std::sqrt(lambda_t_plus_ctu[0] * lambda_t_plus_ctu[0] +
301 lambda_t_plus_ctu[1] * lambda_t_plus_ctu[1] + epsilon_sqrt)) *
302 friction_lm_values[1];
304 const auto term_2_x = mu_ad * std::max(0.0, lamdba_plus_cg) * lambda_t_plus_ctu[0];
306 const auto term_2_y = mu_ad * std::max(0.0, lamdba_plus_cg) * lambda_t_plus_ctu[1];
308 dof_residual = term_1_x - term_2_x;
309 dof_residual_dir = term_1_y - term_2_y;
313 std::array<ADReal, 1>{{dof_residual}},
314 std::array<dof_id_type, 1>{{friction_dof_indices[0]}},
317 std::array<ADReal, 1>{{dof_residual_dir}},
318 std::array<dof_id_type, 1>{{friction_dof_indices[1]}},
324 const DofObject *
const dof)
351 dof_residual = friction_lm_value;
354 const auto term_1 = std::max(mu_ad * (contact_pressure +
c * weighted_gap),
355 std::abs(friction_lm_value + c_t * tangential_vel *
_dt)) *
357 const auto term_2 = mu_ad * std::max(0.0, contact_pressure +
c * weighted_gap) *
358 (friction_lm_value + c_t * tangential_vel *
_dt);
360 dof_residual = term_1 - term_2;
364 std::array<ADReal, 1>{{dof_residual}},
365 std::array<dof_id_type, 1>{{friction_dof_index}},
371 const ADReal & contact_pressure,
const Real & tangential_vel,
const Real & tangential_vel_dir)
380 ADReal tangential_vel_magnitude = std::sqrt(tangential_vel * tangential_vel +
381 tangential_vel_dir * tangential_vel_dir + 1.0e-24);
virtual const NumericVector< Number > *const & currentSolution() const=0
void addResidualsAndJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
unsigned int number() const
MooseVariable * getVar(const std::string &var_name, unsigned int comp)
const std::vector< Real > & _JxW_msm
const Parallel::Communicator & _communicator
DualNumber< Real, DNDerivativeType, true > ADReal
const VariableTestValue & _test
bool isParamValid(const std::string &name) const
Elem const *const & _lower_secondary_elem
const AutomaticMortarGeneration & amg() const
std::array< MooseUtils::SemidynamicVector< Point, 9 >, 2 > getNodalTangents(const Elem &secondary_elem) const
void paramError(const std::string ¶m, Args... args) const
unsigned int number() const
MooseVariable *const _var
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
void derivInsert(SemiDynamicSparseNumberArray< Real, libMesh::dof_id_type, NWrapper< N >> &derivs, libMesh::dof_id_type index, Real value)
virtual Real value(Real t, const Point &p) const
const MooseArray< Real > & _coord
NumericVector< Number > & solutionOld()
processor_id_type processor_id() const