https://mooseframework.inl.gov
Loading...
Searching...
No Matches
WeightedGapUserObject.h
Go to the documentation of this file.
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 "MortarUserObject.h"
14
19{
20public:
22
28 static void addNodalNormalCoupling(InputParameters & params);
29
31
32 virtual void initialize() override;
33 virtual void execute() override;
34 virtual void finalize() override;
35 virtual void initialSetup() override;
36
40 const std::unordered_map<const DofObject *, std::pair<ADReal, Real>> & dofToWeightedGap() const;
41
45 virtual const ADVariableValue & contactPressure() const = 0;
46
57 virtual ADReal nodalContactPressure(const Node & node) const override;
58
64 virtual const VariableTestValue & tractionBasis() const override;
65
70 virtual Real getNormalContactPressure(const Node * const /*node*/) const = 0;
71
76 virtual Real getNormalGap(const Node * const /*node*/) const;
77
79 virtual bool usesNodalNormalDerivatives() const = 0;
80
83
87 const MooseVariable * dispVar(unsigned int component) const;
88
94 const ADRealVectorValue & contactNormal(const Elem & lower_secondary_elem,
95 unsigned int nodal_index) const;
96
100 Real physicalGap(const std::pair<ADReal, Real> & gap) const
101 {
102 return MetaPhysicL::raw_value(gap.first) / gap.second;
103 }
104
109 virtual Real nodalScale(const DofObject * const /*dof*/) const { return 1; }
110
112 virtual bool usesNodalScaling() const { return false; }
113
123 virtual Real normalizeCDivisor(const DofObject * const /*dof*/,
124 const Real covered_normalization) const
125 {
126 return covered_normalization;
127 }
128
134 virtual Real getFrictionalContactPressure(const Node * const /*node*/,
135 const unsigned int /*component*/) const
136 {
137 mooseError("Not available in base class.");
138 }
139
145 virtual Real getAccumulatedSlip(const Node * const /*node*/,
146 const unsigned int /*component*/) const
147 {
148 mooseError("Not available in base class.");
149 }
150
156 virtual Real getTangentialVelocity(const Node * const /*node*/,
157 const unsigned int /*component*/) const
158 {
159 mooseError("Not available in base class.");
160 }
161
162protected:
167 virtual void computeQpProperties();
168
172 virtual void computeQpIProperties();
173
177 virtual const VariableTestValue & test() const = 0;
178
183 virtual bool constrainedByOwner() const = 0;
184
188 template <typename K, typename V>
189 V
190 findValue(const std::unordered_map<K, V> & map, const K & key, const V & default_value = 0) const
191 {
192 const auto it = map.find(key);
193 if (it == map.end())
194 return default_value;
195 return it->second;
196 }
197
201 ADPoint nodalCoordinate(const Node & node) const;
202
205
208
211
213 const bool _nodal;
214
220 const bool _has_disp_z;
223
236
239
242
245
247 std::unordered_map<const DofObject *, std::pair<ADReal, Real>> _dof_to_weighted_gap;
248
250 std::unordered_map<const DofObject *, ADRealVectorValue> _dof_to_weighted_displacements;
251
253 const ADReal * _weighted_gap_ptr = nullptr;
254 const Real * _normalization_ptr = nullptr;
255
258 const VariableTestValue * _test = nullptr;
259
261 mutable std::unordered_map<const Node *, ADRealVectorValue> _ad_nodal_normals;
262
267
269 unsigned int _qp = 0;
270
272 unsigned int _i = 0;
273};
274
275inline const std::unordered_map<const DofObject *, std::pair<ADReal, Real>> &
DualNumber< Real, DNDerivativeType, true > ADReal
const InputParameters & parameters() const
void mooseError(Args &&... args) const
Creates dof object to weighted gap map.
static InputParameters validParams()
virtual bool usesNodalScaling() const
const ADVariableValue *const _primary_disp_z
z-displacement on the primary face
virtual bool usesNodalNormalDerivatives() const =0
Whether this formulation includes displacement derivatives of the secondary nodal normals.
virtual Real getAccumulatedSlip(const Node *const, const unsigned int) const
const std::unordered_map< const DofObject *, std::pair< ADReal, Real > > & dofToWeightedGap() const
Get the degree of freedom to weighted gap information.
virtual Real getFrictionalContactPressure(const Node *const, const unsigned int) const
bool shouldRecordNodalNormalDerivatives() const
Whether the current assembly records nodal-normal derivatives for this object's system.
unsigned int _i
Test function index.
V findValue(const std::unordered_map< K, V > &map, const K &key, const V &default_value=0) const
Find a value in a map or return a default if the key doesn't exist.
virtual ADReal nodalContactPressure(const Node &node) const override
const ADVariableValue & _secondary_disp_x
x-displacement on the secondary face
const MooseVariable *const _disp_x_var
The x displacement variable.
virtual Real getTangentialVelocity(const Node *const, const unsigned int) const
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
virtual void execute() override
ADRealVectorValue _qp_gap_nodal
Vector for computation of weighted gap with nodal normals.
virtual void initialSetup() override
virtual const VariableTestValue & tractionBasis() const override
unsigned int _qp
Quadrature point index for the mortar segments.
Real _qp_factor
The value of the LM at the current quadrature point.
virtual Real getNormalGap(const Node *const) const
FEProblemBase & _fe_problem
The base finite element problem.
virtual const ADVariableValue & contactPressure() const =0
ADPoint nodalCoordinate(const Node &node) const
Add displacement derivatives to the node's current coordinate.
virtual Real getNormalContactPressure(const Node *const) const =0
static void addNodalNormalCoupling(InputParameters &params)
Request the secondary face point-neighbor matrix coupling that nodal-normal derivatives need.
virtual Real nodalScale(const DofObject *const) const
Node-based Lagrange-multiplier scaling factor kappa_j of Popp et al.
const ADVariableValue & _primary_disp_y
y-displacement on the primary face
const MooseArray< Real > & _coord
Member for handling change of coordinate systems (xyz, rz, spherical)
const ADVariableValue & _secondary_disp_y
y-displacement on the secondary face
const MooseVariable * dispVar(unsigned int component) const
const ADVariableValue & _primary_disp_x
x-displacement on the primary face
ADReal _qp_gap
The value of the gap at the current quadrature point.
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.
std::unordered_map< const DofObject *, std::pair< ADReal, Real > > _dof_to_weighted_gap
A map from node to weighted gap and normalization (if requested)
virtual const VariableTestValue & test() const =0
std::unordered_map< const Node *, ADRealVectorValue > _ad_nodal_normals
AD nodal normals, each averaged over the secondary faces containing that node.
const MooseVariable *const _disp_z_var
The z displacement variable.
ADRealVectorValue _qp_displacement_nodal
Vector for computation of relative displacement (determines mixity ratio in interface problems)
virtual Real normalizeCDivisor(const DofObject *const, const Real covered_normalization) const
const ADVariableValue *const _secondary_disp_z
z-displacement on the secondary face
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 ...
const ADReal * _weighted_gap_ptr
A pointer members that can be used to help avoid copying ADReals.
std::unordered_map< const DofObject *, ADRealVectorValue > _dof_to_weighted_displacements
A map from node to weighted displacements.
virtual bool constrainedByOwner() const =0
Real physicalGap(const std::pair< ADReal, Real > &gap) const
Compute physical gap from integration gap quantity.
const VariableTestValue * _test
A pointer to the test function associated with the weighted gap.
const bool _nodal
Whether the dof objects are nodal; if they're not, then they're elemental.
auto raw_value(const Eigen::Map< T > &in)
VariableShapeValue< true > VariableTestValue
VariableValueTempl< true > ADVariableValue