Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : #include "WeightedGapUserObject.h" 13 : 14 : /** 15 : * Creates dof object to weighted tangential velocities map 16 : */ 17 : class WeightedVelocitiesUserObject : virtual public WeightedGapUserObject 18 : { 19 : public: 20 : static InputParameters validParams(); 21 : 22 : WeightedVelocitiesUserObject(const InputParameters & parameters); 23 : 24 : virtual void initialize() override; 25 : virtual void finalize() override; 26 : 27 : /** 28 : * Get the degree of freedom to weighted velocities information 29 : */ 30 : const std::unordered_map<const DofObject *, std::array<ADReal, 2>> & 31 : dofToWeightedVelocities() const; 32 : 33 : /** 34 : * Get the degree of freedom to physical tangential velocities information 35 : */ 36 : const std::unordered_map<const DofObject *, std::array<ADReal, 2>> & dofToRealVelocities() const; 37 : 38 : /** 39 : * @return The contact force at quadrature points on the mortar segment 40 : */ 41 : virtual const ADVariableValue & contactTangentialPressureDirOne() const = 0; 42 : virtual const ADVariableValue & contactTangentialPressureDirTwo() const = 0; 43 : 44 : protected: 45 : /** 46 : * Computes properties that are functions only of the current quadrature point (\p _qp), e.g. 47 : * indepedent of shape functions 48 : */ 49 : virtual void computeQpProperties() override; 50 : 51 : /** 52 : * Computes properties that are functions both of \p _qp and \p _i, for example the weighted gap 53 : */ 54 : virtual void computeQpIProperties() override; 55 : 56 : void selfInitialize(); 57 : void selfTimestepSetup() {} 58 : 59 : /// A map from node to two weighted tangential velocities 60 : std::unordered_map<const DofObject *, std::array<ADReal, 2>> _dof_to_weighted_tangential_velocity; 61 : 62 : /// A map from node to two interpolated, physical tangential velocities 63 : std::unordered_map<const DofObject *, std::array<ADReal, 2>> _dof_to_real_tangential_velocity; 64 : 65 : /// An array of two pointers to avoid copies 66 : std::array<const ADReal *, 2> _tangential_vel_ptr = {{nullptr, nullptr}}; 67 : 68 : /// The value of the tangential velocity values at the current quadrature point 69 : std::array<ADReal, 2> _qp_tangential_velocity; 70 : 71 : /// The value of the "real" tangential velocity values at the current quadrature point 72 : std::array<ADReal, 2> _qp_real_tangential_velocity; 73 : 74 : /// The value of the tangential velocity vectors at the current node 75 : ADRealVectorValue _qp_tangential_velocity_nodal; 76 : 77 : /// The value of the real tangential velocity vectors at the current node 78 : ADRealVectorValue _qp_real_tangential_velocity_nodal; 79 : 80 : /// Reference to the EquationSystem object 81 : SystemBase & _sys; 82 : 83 : /// Reference to the secondary variable 84 : MooseVariableField<Real> & _secondary_var; 85 : 86 : /// Reference to the primary variable 87 : MooseVariableField<Real> & _primary_var; 88 : 89 : /// x-velocity on the secondary face 90 : const ADVariableValue & _secondary_x_dot; 91 : 92 : /// x-velocity on the primary face 93 : const ADVariableValue & _primary_x_dot; 94 : 95 : /// y-velocity on the secondary face 96 : const ADVariableValue & _secondary_y_dot; 97 : 98 : /// y-velocity on the primary face 99 : const ADVariableValue & _primary_y_dot; 100 : 101 : /// z-velocity on the secondary face 102 : const ADVariableValue * const _secondary_z_dot; 103 : 104 : /// z-velocity on the primary face 105 : const ADVariableValue * const _primary_z_dot; 106 : 107 : /// Automatic flag to determine whether we are doing three-dimensional work 108 : bool _3d; 109 : }; 110 : 111 : inline const std::unordered_map<const DofObject *, std::array<ADReal, 2>> & 112 : WeightedVelocitiesUserObject::dofToWeightedVelocities() const 113 : { 114 : return _dof_to_weighted_tangential_velocity; 115 : } 116 : 117 : inline const std::unordered_map<const DofObject *, std::array<ADReal, 2>> & 118 : WeightedVelocitiesUserObject::dofToRealVelocities() const 119 : { 120 190186 : return _dof_to_real_tangential_velocity; 121 : }