www.mooseframework.org
NormalNodalMechanicalContact.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
11 #include "PenetrationLocator.h"
12 #include "PenetrationInfo.h"
13 #include "SystemBase.h"
14 #include "Assembly.h"
15 
17 
18 template <>
19 InputParameters
21 {
22  InputParameters params = validParams<NodeFaceConstraint>();
23  params.set<bool>("use_displaced_mesh") = true;
24 
25  params.addRequiredCoupledVar("lambda", "The normal lagrange multiplier");
26  MooseEnum component("x=0 y=1 z=2");
27  params.addRequiredParam<MooseEnum>(
28  "component", component, "The force component constraint that this object is supplying");
29  return params;
30 }
31 
33  : NodeFaceConstraint(parameters),
34  _lambda(getVar("lambda", 0)->nodalValue()),
35  _lambda_id(coupled("lambda")),
36  _epsilon(std::numeric_limits<Real>::epsilon()),
37  _component(getParam<MooseEnum>("component"))
38 {
39  _overwrite_slave_residual = false;
40 }
41 
42 Real
44 {
45  return _u_slave[_qp];
46 }
47 
48 void
50 {
51 }
52 
53 void
55 {
56  // Our residual only strongly depends on the lagrange multiplier (the normal vector does indeed
57  // depend on displacements but it's complicated and shouldn't be too strong of a dependence)
58  if (jvar != _lambda_id)
59  return;
60 
61  MooseVariableFEBase & var = _sys.getVariable(0, jvar);
62  _connected_dof_indices.clear();
63  _connected_dof_indices.push_back(var.nodalDofIndex());
64 
65  _qp = 0;
66 
67  _Kee.resize(1, 1);
68  _Kee(0, 0) = computeQpOffDiagJacobian(Moose::SlaveSlave, jvar);
69 
70  _Kne.resize(_test_master.size(), 1);
71 
72  for (_i = 0; _i < _test_master.size(); ++_i)
73  _Kne(_i, 0) = computeQpOffDiagJacobian(Moose::MasterSlave, jvar);
74 }
75 
76 Real
78 {
79  std::map<dof_id_type, PenetrationInfo *>::iterator found =
80  _penetration_locator._penetration_info.find(_current_node->id());
81  if (found != _penetration_locator._penetration_info.end())
82  {
83  PenetrationInfo * pinfo = found->second;
84  if (pinfo)
85  {
86  switch (type)
87  {
88  case Moose::ConstraintType::Slave:
89  // This normal appears to point in the opposite direction of the slave surface so we need
90  // a negative sign
91  return _lambda * -pinfo->_normal(_component);
92 
93  case Moose::ConstraintType::Master:
94  return _test_master[_i][_qp] * _lambda * pinfo->_normal(_component);
95 
96  default:
97  return 0;
98  }
99  }
100  }
101  return 0;
102 }
103 
104 Real NormalNodalMechanicalContact::computeQpJacobian(Moose::ConstraintJacobianType /*type*/)
105 {
106  return 0;
107 }
108 
109 Real
111  unsigned jvar)
112 {
113  std::map<dof_id_type, PenetrationInfo *>::iterator found =
114  _penetration_locator._penetration_info.find(_current_node->id());
115  if (found != _penetration_locator._penetration_info.end())
116  {
117  PenetrationInfo * pinfo = found->second;
118 
119  // Latter check here is actually redundant because we don't call into this function unless jvar
120  // == _lambda_id
121  if (pinfo && jvar == _lambda_id)
122  {
123  switch (type)
124  {
125  case Moose::SlaveSlave:
126  return -pinfo->_normal(_component);
127  case Moose::MasterSlave:
128  return _test_master[_i][_qp] * pinfo->_normal(_component);
129  default:
130  return 0;
131  }
132  }
133  }
134 
135  return 0;
136 }
NormalNodalMechanicalContact
Definition: NormalNodalMechanicalContact.h:21
NormalNodalMechanicalContact::computeQpJacobian
virtual Real computeQpJacobian(Moose::ConstraintJacobianType type) override
Definition: NormalNodalMechanicalContact.C:104
NormalNodalMechanicalContact::_lambda_id
const unsigned _lambda_id
Definition: NormalNodalMechanicalContact.h:37
NormalNodalMechanicalContact::computeJacobian
void computeJacobian() override
Definition: NormalNodalMechanicalContact.C:49
registerMooseObject
registerMooseObject("ContactApp", NormalNodalMechanicalContact)
NormalNodalMechanicalContact::computeQpSlaveValue
virtual Real computeQpSlaveValue() override
Definition: NormalNodalMechanicalContact.C:43
NormalNodalMechanicalContact::NormalNodalMechanicalContact
NormalNodalMechanicalContact(const InputParameters &parameters)
Definition: NormalNodalMechanicalContact.C:32
NormalNodalMechanicalContact.h
NormalNodalMechanicalContact::computeOffDiagJacobian
void computeOffDiagJacobian(unsigned int jvar) override
Definition: NormalNodalMechanicalContact.C:54
NormalNodalMechanicalContact::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(Moose::ConstraintJacobianType type, unsigned jvar) override
Definition: NormalNodalMechanicalContact.C:110
MaterialTensorCalculatorTools::component
Real component(const SymmTensor &symm_tensor, unsigned int index)
Definition: MaterialTensorCalculatorTools.C:16
NormalNodalMechanicalContact::_component
const MooseEnum _component
Definition: NormalNodalMechanicalContact.h:39
validParams< NormalNodalMechanicalContact >
InputParameters validParams< NormalNodalMechanicalContact >()
Definition: NormalNodalMechanicalContact.C:20
NormalNodalMechanicalContact::computeQpResidual
virtual Real computeQpResidual(Moose::ConstraintType type) override
Definition: NormalNodalMechanicalContact.C:77
NormalNodalMechanicalContact::_lambda
const Real & _lambda
Definition: NormalNodalMechanicalContact.h:36