https://mooseframework.inl.gov
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"
13 
18 {
19 public:
21 
23 
24  virtual void initialize() override;
25  virtual void execute() override;
26  virtual void finalize() override;
27  virtual void initialSetup() override;
28 
32  const std::unordered_map<const DofObject *, std::pair<ADReal, Real>> & dofToWeightedGap() const;
33 
37  virtual const ADVariableValue & contactPressure() const = 0;
38 
43  virtual Real getNormalContactPressure(const Node * const /*node*/) const
44  {
45  mooseError("Not available in base class.");
46  }
47 
52  virtual Real getNormalGap(const Node * const /*node*/) const;
53 
57  Real physicalGap(const std::pair<ADReal, Real> & gap) const
58  {
59  return MetaPhysicL::raw_value(gap.first) / gap.second;
60  }
61 
62  ADReal adPhysicalGap(const std::pair<ADReal, Real> & gap) const { return gap.first / gap.second; }
63 
69  virtual Real getFrictionalContactPressure(const Node * const /*node*/,
70  const unsigned int /*component*/) const
71  {
72  mooseError("Not available in base class.");
73  }
74 
80  virtual Real getAccumulatedSlip(const Node * const /*node*/,
81  const unsigned int /*component*/) const
82  {
83  mooseError("Not available in base class.");
84  }
85 
91  virtual Real getTangentialVelocity(const Node * const /*node*/,
92  const unsigned int /*component*/) const
93  {
94  mooseError("Not available in base class.");
95  }
96 
97 protected:
102  virtual void computeQpProperties();
103 
107  virtual void computeQpIProperties();
108 
112  virtual const VariableTestValue & test() const = 0;
113 
118  virtual bool constrainedByOwner() const = 0;
119 
123  template <typename K, typename V>
124  V
125  findValue(const std::unordered_map<K, V> & map, const K & key, const V & default_value = 0) const
126  {
127  const auto it = map.find(key);
128  if (it == map.end())
129  return default_value;
130  return it->second;
131  }
132 
135 
138 
141 
143  const bool _nodal;
144 
146  const MooseVariable * const _disp_x_var;
148  const MooseVariable * const _disp_y_var;
150  const bool _has_disp_z;
152  const MooseVariable * const _disp_z_var;
153 
166 
169 
172 
175 
177  std::unordered_map<const DofObject *, std::pair<ADReal, Real>> _dof_to_weighted_gap;
178 
180  std::unordered_map<const DofObject *, ADRealVectorValue> _dof_to_weighted_displacements;
181 
183  const ADReal * _weighted_gap_ptr = nullptr;
184  const Real * _normalization_ptr = nullptr;
185 
188  const VariableTestValue * _test = nullptr;
189 
194 
196  unsigned int _qp = 0;
197 
199  unsigned int _i = 0;
200 };
201 
202 inline const std::unordered_map<const DofObject *, std::pair<ADReal, Real>> &
204 {
205  return _dof_to_weighted_gap;
206 }
ADReal adPhysicalGap(const std::pair< ADReal, Real > &gap) const
const ADVariableValue *const _primary_disp_z
z-displacement on the primary face
unsigned int _qp
Quadrature point index for the mortar segments.
virtual const ADVariableValue & contactPressure() const =0
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&#39;t exist.
const ADVariableValue & _secondary_disp_y
y-displacement on the secondary face
Real _qp_factor
The value of the LM at the current quadrature point.
virtual const VariableTestValue & test() const =0
static const std::string K
Definition: NS.h:170
virtual void initialSetup() override
WeightedGapUserObject(const InputParameters &parameters)
virtual Real getNormalContactPressure(const Node *const) const
virtual void initialize() override
const MooseVariable *const _disp_z_var
The z displacement variable.
auto raw_value(const Eigen::Map< T > &in)
static InputParameters validParams()
virtual Real getTangentialVelocity(const Node *const, const unsigned int) const
ADRealVectorValue _qp_displacement_nodal
Vector for computation of relative displacement (determines mixity ratio in interface problems) ...
std::unordered_map< const DofObject *, ADRealVectorValue > _dof_to_weighted_displacements
A map from node to weighted displacements.
const ADVariableValue & _secondary_disp_x
x-displacement on the secondary face
const bool _nodal
Whether the dof objects are nodal; if they&#39;re not, then they&#39;re elemental.
const bool _has_disp_z
For 2D mortar contact no displacement will be specified, so const pointers used.
const ADVariableValue & _primary_disp_x
x-displacement on the primary face
ADRealVectorValue _qp_gap_nodal
Vector for computation of weighted gap with nodal normals.
DualNumber< Real, DNDerivativeType, true > ADReal
const ADReal * _weighted_gap_ptr
A pointer members that can be used to help avoid copying ADReals.
virtual Real getNormalGap(const Node *const) const
ADReal _qp_gap
The value of the gap at the current quadrature point.
const ADVariableValue & _primary_disp_y
y-displacement on the primary face
OutputTools< Real >::VariableTestValue VariableTestValue
const VariableTestValue * _test
A pointer to the test function associated with the weighted gap.
const ADVariableValue *const _secondary_disp_z
z-displacement on the secondary face
virtual void computeQpProperties()
Computes properties that are functions only of the current quadrature point (_qp), e.g.
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 void execute() override
const MooseArray< Real > & _coord
Member for handling change of coordinate systems (xyz, rz, spherical)
virtual Real getFrictionalContactPressure(const Node *const, const unsigned int) const
Creates dof object to weighted gap map.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool _is_weighted_gap_nodal
Whether the weighted gap is associated with nodes or elements (like for a CONSTANT MONOMIAL Lagrange ...
const MooseVariable *const _disp_y_var
The y displacement variable.
virtual bool constrainedByOwner() const =0
void mooseError(Args &&... args) const
unsigned int _i
Test function index.
const InputParameters & parameters() const
Real physicalGap(const std::pair< ADReal, Real > &gap) const
Compute physical gap from integration gap quantity.
const MooseVariable *const _disp_x_var
The x displacement variable.
virtual void computeQpIProperties()
Computes properties that are functions both of _qp and _i, for example the weighted gap...
std::unordered_map< const DofObject *, std::pair< ADReal, Real > > _dof_to_weighted_gap
A map from node to weighted gap and normalization (if requested)
FEProblemBase & _fe_problem
The base finite element problem.
virtual void finalize() override