18#include "libmesh/quadrature.h"
25 "Primal variable on secondary surface.");
28 "Primal variable on primary surface. If this parameter is not provided then the primary "
29 "variable will be initialized to the secondary variable");
37 _sys(*parameters.getCheckedPointerParam<
SystemBase *>(
"_sys")),
39 isParamValid(
"secondary_variable")
40 ? _sys.getActualFieldVariable<Real>(_tid, parameters.getMooseType(
"secondary_variable"))
41 : _sys.getActualFieldVariable<Real>(_tid, parameters.getMooseType(
"primary_variable"))),
43 isParamValid(
"primary_variable")
44 ? _sys.getActualFieldVariable<Real>(_tid, parameters.getMooseType(
"primary_variable"))
46 _secondary_x_dot(_secondary_var.adUDot()),
47 _primary_x_dot(_primary_var.adUDotNeighbor()),
48 _secondary_y_dot(adCoupledDot(
"disp_y")),
49 _primary_y_dot(adCoupledNeighborValueDot(
"disp_y")),
50 _secondary_z_dot(_has_disp_z ? &adCoupledDot(
"disp_z") : nullptr),
51 _primary_z_dot(_has_disp_z ? &adCoupledNeighborValueDot(
"disp_z") : nullptr),
54 if (!getParam<bool>(
"use_displaced_mesh"))
56 "'use_displaced_mesh' must be true for the WeightedVelocitiesUserObject object");
63 mooseError(
"Nodal tangential pressure is not available for user object '",
name(),
"'.");
66const std::array<ADRealVectorValue, 2> &
68 const unsigned int nodal_index)
const
70 mooseAssert(nodal_index < lower_secondary_elem.n_nodes(),
71 "Nodal tangent index must refer to a node on the secondary element.");
73 "AD contact tangents should only be requested while recording nodal-normal "
75 const Node *
const node = lower_secondary_elem.node_ptr(nodal_index);
88 for (
const auto direction : make_range(2))
92 "The stored and AD secondary nodal tangents must use the same geometry state.");
107 const auto & secondary_ip_lowerd_map =
111 std::array<ADReal, 3> primary_disp_dot{
113 std::array<ADReal, 3> secondary_disp_dot{
119 const ADReal & prim_x_dot = primary_disp_dot[0];
120 const ADReal & prim_y_dot = primary_disp_dot[1];
121 const ADReal * prim_z_dot =
nullptr;
123 prim_z_dot = &primary_disp_dot[2];
125 const ADReal & sec_x_dot = secondary_disp_dot[0];
126 const ADReal & sec_y_dot = secondary_disp_dot[1];
127 const ADReal * sec_z_dot =
nullptr;
129 sec_z_dot = &secondary_disp_dot[2];
135 relative_velocity = {sec_x_dot - prim_x_dot, sec_y_dot - prim_y_dot, *sec_z_dot - *prim_z_dot};
137 relative_velocity = {sec_x_dot - prim_x_dot, sec_y_dot - prim_y_dot, 0.0};
150 const DofObject *
const dof =
157 for (
const auto direction : make_range(
_3d ? 2 : 1))
DualNumber< Real, DNDerivativeType, true > ADReal
std::map< unsigned int, unsigned int > getSecondaryIpToLowerElementMap(const Elem &lower_secondary_elem) const
std::map< unsigned int, unsigned int > getPrimaryIpToLowerElementMap(const Elem &primary_elem, const Elem &primary_elem_ip, const Elem &lower_secondary_elem) const
std::array< MooseUtils::SemidynamicVector< Point, 9 >, 2 > getNodalTangents(const Elem &secondary_elem) const
const std::string & name() const
void paramError(const std::string ¶m, Args... args) const
void mooseError(Args &&... args) const
Elem const *const & _lower_secondary_elem
const AutomaticMortarGeneration & amg() const
Elem const *const & _lower_primary_elem
static void trimInteriorNodeDerivatives(const std::map< unsigned int, unsigned int > &primary_ip_lowerd_map, const Variables &moose_var, DualNumbers &ad_vars, const bool is_secondary)
const std::vector< Real > & _JxW_msm
virtual MooseMesh & mesh()=0
Creates dof object to weighted gap map.
static InputParameters validParams()
bool shouldRecordNodalNormalDerivatives() const
Whether the current assembly records nodal-normal derivatives for this object's system.
unsigned int _i
Test function index.
const MooseVariable *const _disp_x_var
The x displacement variable.
virtual void computeQpProperties()
Computes properties that are functions only of the current quadrature point (_qp),...
const bool _has_disp_z
For 2D mortar contact no displacement will be specified, so const pointers used.
virtual void finalize() override
unsigned int _qp
Quadrature point index for the mortar segments.
const MooseArray< Real > & _coord
Member for handling change of coordinate systems (xyz, rz, spherical)
const MooseVariable *const _disp_y_var
The y displacement variable.
const ADRealVectorValue & contactNormal(const Elem &lower_secondary_elem, unsigned int nodal_index) const
Return the cached contact normal for the supplied lower-dimensional secondary element node.
const MooseVariable *const _disp_z_var
The z displacement variable.
virtual void computeQpIProperties()
Computes properties that are functions both of _qp and _i, for example the weighted gap.
virtual void initialize() override
bool _is_weighted_gap_nodal
Whether the weighted gap is associated with nodes or elements (like for a CONSTANT MONOMIAL Lagrange ...
virtual bool constrainedByOwner() const =0
const bool _nodal
Whether the dof objects are nodal; if they're not, then they're elemental.
WeightedVelocitiesUserObject(const InputParameters ¶meters)
static InputParameters validParams()
const std::array< ADRealVectorValue, 2 > & contactTangents(const Elem &lower_secondary_elem, unsigned int nodal_index) const
Return contact tangents for the supplied lower-dimensional secondary element node.
virtual void finalize() override
virtual void computeQpProperties() override
Computes properties that are functions only of the current quadrature point (_qp),...
std::unordered_map< const DofObject *, std::array< ADReal, 2 > > _dof_to_weighted_tangential_velocity
A map from node to two weighted tangential velocities.
const ADVariableValue & _primary_y_dot
y-velocity on the primary face
const ADVariableValue & _primary_x_dot
x-velocity on the primary face
virtual void computeQpIProperties() override
Computes properties that are functions both of _qp and _i, for example the weighted gap.
const ADVariableValue & _secondary_x_dot
x-velocity on the secondary face
ADRealVectorValue _qp_real_tangential_velocity_nodal
The value of the real tangential velocity vectors at the current node.
ADRealVectorValue _qp_tangential_velocity_nodal
The value of the tangential velocity vectors at the current node.
virtual void initialize() override
bool _3d
Automatic flag to determine whether we are doing three-dimensional work.
const ADVariableValue & _secondary_y_dot
y-velocity on the secondary face
std::unordered_map< const DofObject *, std::array< ADReal, 2 > > _dof_to_real_tangential_velocity
A map from node to two interpolated, physical tangential velocities.
virtual ADReal nodalTangentialPressure(const Node &node, unsigned int direction) const
std::unordered_map< const Node *, std::array< ADRealVectorValue, 2 > > _ad_nodal_tangents
AD contact tangent frames, keyed on the secondary node and reused by every test function and quadratu...
const Parallel::Communicator & _communicator
std::array< Vector, 2 > householderTangents(const Vector &normal)