www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NormalNodalLMMechanicalContact Class Reference

#include <NormalNodalLMMechanicalContact.h>

Inheritance diagram for NormalNodalLMMechanicalContact:
[legend]

Public Member Functions

 NormalNodalLMMechanicalContact (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpSlaveValue () override
 
virtual void computeResidual () override
 
virtual void computeJacobian () override
 
virtual void computeOffDiagJacobian (unsigned jvar) override
 
virtual Real computeQpResidual (Moose::ConstraintType type) override
 
virtual Real computeQpJacobian (Moose::ConstraintJacobianType type) override
 
virtual Real computeQpOffDiagJacobian (Moose::ConstraintJacobianType type, unsigned jvar) override
 

Protected Attributes

const unsigned _disp_y_id
 
const unsigned _disp_z_id
 
const Real _c
 
const Real _epsilon
 
const MooseEnum _ncp_type
 

Detailed Description

Definition at line 21 of file NormalNodalLMMechanicalContact.h.

Constructor & Destructor Documentation

◆ NormalNodalLMMechanicalContact()

NormalNodalLMMechanicalContact::NormalNodalLMMechanicalContact ( const InputParameters &  parameters)

Definition at line 44 of file NormalNodalLMMechanicalContact.C.

45  : NodeFaceConstraint(parameters),
46  _disp_y_id(coupled("disp_y")),
47  _disp_z_id(coupled("disp_z")),
48  _c(getParam<Real>("c")),
49  _epsilon(std::numeric_limits<Real>::epsilon()),
50  _ncp_type(getParam<MooseEnum>("ncp_function_type"))
51 
52 {
53  _overwrite_slave_residual = false;
54 }

Member Function Documentation

◆ computeJacobian()

void NormalNodalLMMechanicalContact::computeJacobian ( )
overrideprotectedvirtual

Definition at line 73 of file NormalNodalLMMechanicalContact.C.

74 {
75  _Kee.resize(1, 1);
76  _connected_dof_indices.clear();
77  _connected_dof_indices.push_back(_var.nodalDofIndex());
78 
79  _qp = 0;
80 
81  _Kee(0, 0) += computeQpJacobian(Moose::SlaveSlave);
82 }

Referenced by computeOffDiagJacobian().

◆ computeOffDiagJacobian()

void NormalNodalLMMechanicalContact::computeOffDiagJacobian ( unsigned  jvar)
overrideprotectedvirtual

Definition at line 85 of file NormalNodalLMMechanicalContact.C.

86 {
87  if (jvar == _var.number())
88  {
90  return;
91  }
92 
93  MooseVariableFEBase & var = _sys.getVariable(0, jvar);
94  _connected_dof_indices.clear();
95  _connected_dof_indices.push_back(var.nodalDofIndex());
96 
97  _qp = 0;
98 
99  _Kee.resize(1, 1);
100  _Kee(0, 0) += computeQpOffDiagJacobian(Moose::SlaveSlave, jvar);
101 
102  DenseMatrix<Number> & Ken =
103  _assembly.jacobianBlockNeighbor(Moose::ElementNeighbor, _var.number(), jvar);
104 
105  for (_j = 0; _j < _phi_master.size(); ++_j)
106  Ken(0, _j) += computeQpOffDiagJacobian(Moose::SlaveMaster, jvar);
107 }

◆ computeQpJacobian()

Real NormalNodalLMMechanicalContact::computeQpJacobian ( Moose::ConstraintJacobianType  type)
overrideprotectedvirtual

Definition at line 137 of file NormalNodalLMMechanicalContact.C.

138 {
139  std::map<dof_id_type, PenetrationInfo *>::iterator found =
140  _penetration_locator._penetration_info.find(_current_node->id());
141  if (found != _penetration_locator._penetration_info.end())
142  {
143  PenetrationInfo * pinfo = found->second;
144  if (pinfo != NULL)
145  {
146  DualNumber<Real, Real> dual_u_slave(_u_slave[_qp]);
147  dual_u_slave.derivatives() = 1.;
148 
149  auto a = -pinfo->_distance * _c;
150  auto b = dual_u_slave;
151 
152  if (_ncp_type == "fb")
153  return (a + b - std::sqrt(a * a + b * b + _epsilon)).derivatives();
154  else
155  return std::min(a, b).derivatives();
156  }
157  }
158  return 0;
159 }

Referenced by computeJacobian().

◆ computeQpOffDiagJacobian()

Real NormalNodalLMMechanicalContact::computeQpOffDiagJacobian ( Moose::ConstraintJacobianType  type,
unsigned  jvar 
)
overrideprotectedvirtual

Definition at line 162 of file NormalNodalLMMechanicalContact.C.

164 {
165  std::map<dof_id_type, PenetrationInfo *>::iterator found =
166  _penetration_locator._penetration_info.find(_current_node->id());
167  if (found != _penetration_locator._penetration_info.end())
168  {
169  PenetrationInfo * pinfo = found->second;
170  if (pinfo != NULL)
171  {
172  DualNumber<Real, Real> gap(-pinfo->_distance);
173 
174  unsigned comp;
175  if (jvar == _master_var_num)
176  comp = 0;
177  else if (jvar == _disp_y_id)
178  comp = 1;
179  else if (jvar == _disp_z_id)
180  comp = 2;
181  else
182  return 0;
183 
184  gap.derivatives() = pinfo->_normal(comp);
185 
186  switch (type)
187  {
188  case Moose::SlaveSlave:
189  gap.derivatives() *= 1;
190  break;
191  case Moose::SlaveMaster:
192  gap.derivatives() *= -_phi_master[_j][_qp];
193  break;
194  default:
195  mooseError("LMs do not have a master contribution.");
196  }
197 
198  auto a = gap * _c;
199  auto b = _u_slave[_qp];
200 
201  if (_ncp_type == "fb")
202  return (a + b - std::sqrt(a * a + b * b + _epsilon)).derivatives();
203  else
204  return std::min(a, b).derivatives();
205  }
206  }
207  return 0.;
208 }

Referenced by computeOffDiagJacobian().

◆ computeQpResidual()

Real NormalNodalLMMechanicalContact::computeQpResidual ( Moose::ConstraintType  type)
overrideprotectedvirtual

Definition at line 109 of file NormalNodalLMMechanicalContact.C.

110 {
111  std::map<dof_id_type, PenetrationInfo *>::iterator found =
112  _penetration_locator._penetration_info.find(_current_node->id());
113  if (found != _penetration_locator._penetration_info.end())
114  {
115  PenetrationInfo * pinfo = found->second;
116  if (pinfo != NULL)
117  {
118  Real a = -pinfo->_distance * _c;
119  mooseAssert(
120  _qp < _u_slave.size(),
121  "qp is greater than the size of u_slave in NormalNodalLMMechanicalContact. Check and "
122  "make sure that your Lagrange multiplier variable has the same order as the mesh");
123  Real b = _u_slave[_qp];
124 
125  if (_ncp_type == "fb")
126  return a + b - std::sqrt(a * a + b * b + _epsilon);
127  else
128  return std::min(a, b);
129  }
130  }
131  return 0;
132 }

Referenced by computeResidual().

◆ computeQpSlaveValue()

Real NormalNodalLMMechanicalContact::computeQpSlaveValue ( )
overrideprotectedvirtual

Definition at line 57 of file NormalNodalLMMechanicalContact.C.

58 {
59  return _u_slave[_qp];
60 }

◆ computeResidual()

void NormalNodalLMMechanicalContact::computeResidual ( )
overrideprotectedvirtual

Definition at line 63 of file NormalNodalLMMechanicalContact.C.

64 {
65  DenseVector<Number> & re = _assembly.residualBlock(_var.number());
66 
67  _qp = 0;
68 
69  re(0) = computeQpResidual(Moose::Slave);
70 }

Member Data Documentation

◆ _c

const Real NormalNodalLMMechanicalContact::_c
protected

◆ _disp_y_id

const unsigned NormalNodalLMMechanicalContact::_disp_y_id
protected

Definition at line 37 of file NormalNodalLMMechanicalContact.h.

Referenced by computeQpOffDiagJacobian().

◆ _disp_z_id

const unsigned NormalNodalLMMechanicalContact::_disp_z_id
protected

Definition at line 38 of file NormalNodalLMMechanicalContact.h.

Referenced by computeQpOffDiagJacobian().

◆ _epsilon

const Real NormalNodalLMMechanicalContact::_epsilon
protected

◆ _ncp_type

const MooseEnum NormalNodalLMMechanicalContact::_ncp_type
protected

The documentation for this class was generated from the following files:
NormalNodalLMMechanicalContact::_disp_z_id
const unsigned _disp_z_id
Definition: NormalNodalLMMechanicalContact.h:38
NormalNodalLMMechanicalContact::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(Moose::ConstraintJacobianType type, unsigned jvar) override
Definition: NormalNodalLMMechanicalContact.C:162
NormalNodalLMMechanicalContact::_epsilon
const Real _epsilon
Definition: NormalNodalLMMechanicalContact.h:40
NormalNodalLMMechanicalContact::computeJacobian
virtual void computeJacobian() override
Definition: NormalNodalLMMechanicalContact.C:73
NormalNodalLMMechanicalContact::_disp_y_id
const unsigned _disp_y_id
Definition: NormalNodalLMMechanicalContact.h:37
NormalNodalLMMechanicalContact::computeQpJacobian
virtual Real computeQpJacobian(Moose::ConstraintJacobianType type) override
Definition: NormalNodalLMMechanicalContact.C:137
NormalNodalLMMechanicalContact::_ncp_type
const MooseEnum _ncp_type
Definition: NormalNodalLMMechanicalContact.h:42
NormalNodalLMMechanicalContact::computeQpResidual
virtual Real computeQpResidual(Moose::ConstraintType type) override
Definition: NormalNodalLMMechanicalContact.C:109
NormalNodalLMMechanicalContact::_c
const Real _c
Definition: NormalNodalLMMechanicalContact.h:39