www.mooseframework.org
CZMInterfaceKernel.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 
10 #include "CZMInterfaceKernel.h"
11 
12 registerMooseObject("TensorMechanicsApp", CZMInterfaceKernel);
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<InterfaceKernel>();
19  params.addRequiredParam<unsigned int>("component",
20  "the component of the "
21  "displacement vector this kernel is working on:"
22  " component == 0, ==> X"
23  " component == 1, ==> Y"
24  " component == 2, ==> Z");
25 
26  params.addRequiredCoupledVar("displacements", "the string containing displacement variables");
27 
28  params.addClassDescription("Interface kernel for use with cohesive zone models (CZMs) that "
29  "compute traction as a function of the displacement jump");
30 
31  return params;
32 }
33 
34 CZMInterfaceKernel::CZMInterfaceKernel(const InputParameters & parameters)
35  : InterfaceKernel(parameters),
36  _component(getParam<unsigned int>("component")),
37  _ndisp(coupledComponents("displacements")),
38  _disp_var(_ndisp),
39  _disp_neighbor_var(_ndisp),
40  _traction_global(getMaterialPropertyByName<RealVectorValue>("traction_global")),
41  _traction_derivatives_global(
42  getMaterialPropertyByName<RankTwoTensor>("traction_derivatives_global"))
43 {
44  if (getParam<bool>("use_displaced_mesh") == true)
45  mooseError("CZMInterfaceKernel cannot be used with use_displaced_mesh = true");
46 
47  for (unsigned int i = 0; i < _ndisp; ++i)
48  {
49  _disp_var[i] = coupled("displacements", i);
50  _disp_neighbor_var[i] = coupled("displacements", i);
51  }
52 }
53 
54 Real
55 CZMInterfaceKernel::computeQpResidual(Moose::DGResidualType type)
56 {
57 
58  Real r = _traction_global[_qp](_component);
59 
60  switch (type)
61  {
62  // [test_slave-test_master]*T where T represents the traction.
63  case Moose::Element:
64  r *= -_test[_i][_qp];
65  break;
66  case Moose::Neighbor:
67  r *= _test_neighbor[_i][_qp];
68  break;
69  }
70  return r;
71 }
72 
73 Real
74 CZMInterfaceKernel::computeQpJacobian(Moose::DGJacobianType type)
75 {
76  // retrieve the diagonal Jacobian coefficient dependning on the displacement
77  // component (_component) this kernel is working on
79 
80  switch (type)
81  {
82  case Moose::ElementElement: // Residual_sign -1 ddeltaU_ddisp sign -1;
83  jac *= _test[_i][_qp] * _phi[_j][_qp];
84  break;
85  case Moose::ElementNeighbor: // Residual_sign -1 ddeltaU_ddisp sign 1;
86  jac *= -_test[_i][_qp] * _phi_neighbor[_j][_qp];
87  break;
88  case Moose::NeighborElement: // Residual_sign 1 ddeltaU_ddisp sign -1;
89  jac *= -_test_neighbor[_i][_qp] * _phi[_j][_qp];
90  break;
91  case Moose::NeighborNeighbor: // Residual_sign 1 ddeltaU_ddisp sign 1;
92  jac *= _test_neighbor[_i][_qp] * _phi_neighbor[_j][_qp];
93  break;
94  }
95  return jac;
96 }
97 
98 Real
99 CZMInterfaceKernel::computeQpOffDiagJacobian(Moose::DGJacobianType type, unsigned int jvar)
100 {
101 
102  // find the displacement component associated to jvar
103  unsigned int off_diag_component;
104  for (off_diag_component = 0; off_diag_component < _ndisp; off_diag_component++)
105  if (_disp_var[off_diag_component] == jvar)
106  break;
107 
108  mooseAssert(off_diag_component < _ndisp,
109  "CZMInterfaceKernel::computeQpOffDiagJacobian wrong offdiagonal variable");
110 
111  Real jac = _traction_derivatives_global[_qp](_component, off_diag_component);
112 
113  switch (type)
114  {
115  case Moose::ElementElement: // Residual_sign -1 ddeltaU_ddisp sign -1;
116  jac *= _test[_i][_qp] * _phi[_j][_qp];
117  break;
118  case Moose::ElementNeighbor: // Residual_sign -1 ddeltaU_ddisp sign 1;
119  jac *= -_test[_i][_qp] * _phi_neighbor[_j][_qp];
120  break;
121  case Moose::NeighborElement: // Residual_sign 1 ddeltaU_ddisp sign -1;
122  jac *= -_test_neighbor[_i][_qp] * _phi[_j][_qp];
123  break;
124  case Moose::NeighborNeighbor: // Residual_sign 1 ddeltaU_ddisp sign 1;
125  jac *= _test_neighbor[_i][_qp] * _phi_neighbor[_j][_qp];
126  break;
127  }
128  return jac;
129 }
CZMInterfaceKernel::CZMInterfaceKernel
CZMInterfaceKernel(const InputParameters &parameters)
Definition: CZMInterfaceKernel.C:34
CZMInterfaceKernel::_ndisp
const unsigned int _ndisp
number of displacement components
Definition: CZMInterfaceKernel.h:38
CZMInterfaceKernel::_disp_neighbor_var
std::vector< unsigned int > _disp_neighbor_var
Definition: CZMInterfaceKernel.h:43
CZMInterfaceKernel::computeQpJacobian
virtual Real computeQpJacobian(Moose::DGJacobianType type)
Definition: CZMInterfaceKernel.C:74
CZMInterfaceKernel::_traction_global
const MaterialProperty< RealVectorValue > & _traction_global
Definition: CZMInterfaceKernel.h:48
CZMInterfaceKernel::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(Moose::DGJacobianType type, unsigned int jvar)
Definition: CZMInterfaceKernel.C:99
CZMInterfaceKernel::_traction_derivatives_global
const MaterialProperty< RankTwoTensor > & _traction_derivatives_global
Definition: CZMInterfaceKernel.h:49
CZMInterfaceKernel.h
validParams< CZMInterfaceKernel >
InputParameters validParams< CZMInterfaceKernel >()
Definition: CZMInterfaceKernel.C:16
registerMooseObject
registerMooseObject("TensorMechanicsApp", CZMInterfaceKernel)
CZMInterfaceKernel::computeQpResidual
virtual Real computeQpResidual(Moose::DGResidualType type)
Definition: CZMInterfaceKernel.C:55
CZMInterfaceKernel::_component
const unsigned int _component
the displacement component this kernel is operating on (0=x, 1=y, 2 =z)
Definition: CZMInterfaceKernel.h:35
CZMInterfaceKernel
DG kernel implementing cohesive zone models (CZM) for a 1D/2D/3D traction separation laws based on th...
Definition: CZMInterfaceKernel.h:24
CZMInterfaceKernel::_disp_var
std::vector< unsigned int > _disp_var
Coupled displacement component variable IDs.
Definition: CZMInterfaceKernel.h:42
RankTwoTensorTempl< Real >