https://mooseframework.inl.gov
CrackTipEnrichmentStressDivergenceTensors.C
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 
11 #include "ElasticityTensorTools.h"
12 
14 
17 {
19  params.addClassDescription("Enrich stress divergence kernel for small-strain simulations");
20  params.addRequiredParam<unsigned int>("component",
21  "An integer corresponding to the direction the variable "
22  "this kernel acts in. (0 for x, 1 for y, 2 for z)");
23  params.addRequiredParam<unsigned int>("enrichment_component",
24  "The component of the enrichement functions");
25  params.addRequiredCoupledVar("displacements",
26  "The string of displacements suitable for the problem statement");
27  params.addRequiredCoupledVar(
28  "enrichment_displacements",
29  "The string of enrichment displacements suitable for the problem statement");
30  params.addParam<std::string>("base_name", "Material property base name");
31  params.addRequiredParam<UserObjectName>("crack_front_definition",
32  "The CrackFrontDefinition user object name");
33  params.set<bool>("use_displaced_mesh") = false;
34  return params;
35 }
36 
38  const InputParameters & parameters)
39  : ALEKernel(parameters),
40  EnrichmentFunctionCalculation(&getUserObject<CrackFrontDefinition>("crack_front_definition")),
41  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
42  _stress(getMaterialPropertyByName<RankTwoTensor>(_base_name + "stress")),
43  _Jacobian_mult(getMaterialPropertyByName<RankFourTensor>(_base_name + "Jacobian_mult")),
44  _component(getParam<unsigned int>("component")),
45  _enrichment_component(getParam<unsigned int>("enrichment_component")),
46  _nenrich_disp(coupledComponents("enrichment_displacements")),
47  _ndisp(coupledComponents("displacements")),
48  _B(4),
49  _dBX(4),
50  _dBx(4),
51  _BI(4),
52  _BJ(4)
53 {
55  for (unsigned int i = 0; i < _nenrich_disp; ++i)
56  _enrich_disp_var[i] = coupled("enrichment_displacements", i);
57 
58  _disp_var.resize(_ndisp);
59  for (unsigned int i = 0; i < _ndisp; ++i)
60  _disp_var[i] = coupled("displacements", i);
61 }
62 
63 Real
65 {
66  crackTipEnrichementFunctionAtPoint(*_current_elem->node_ptr(_i), _BI);
67 
68  crackTipEnrichementFunctionAtPoint(_q_point[_qp], _B);
69  unsigned int crack_front_point_index =
71 
72  for (unsigned int i = 0; i < 4; ++i)
73  rotateFromCrackFrontCoordsToGlobal(_dBx[i], _dBX[i], crack_front_point_index);
74 
76 
77  return _stress[_qp].row(_component) *
78  (_grad_test[_i][_qp] * (_B[_enrichment_component] - _BI[_enrichment_component]) +
79  _test[_i][_qp] * grad_B);
80 }
81 
82 Real
84 {
85  crackTipEnrichementFunctionAtPoint(*_current_elem->node_ptr(_i), _BI);
86  crackTipEnrichementFunctionAtPoint(*_current_elem->node_ptr(_j), _BJ);
87 
88  crackTipEnrichementFunctionAtPoint(_q_point[_qp], _B);
89 
90  unsigned int crack_front_point_index =
92 
93  for (unsigned int i = 0; i < 4; ++i)
94  rotateFromCrackFrontCoordsToGlobal(_dBx[i], _dBX[i], crack_front_point_index);
95 
97 
98  RealVectorValue grad_test =
99  _grad_test[_i][_qp] * (_B[_enrichment_component] - _BI[_enrichment_component]) +
100  _test[_i][_qp] * grad_B;
101  RealVectorValue grad_phi =
102  _grad_phi[_j][_qp] * (_B[_enrichment_component] - _BJ[_enrichment_component]) +
103  _phi[_j][_qp] * grad_B;
104 
106  _Jacobian_mult[_qp], _component, _component, grad_test, grad_phi);
107 }
108 
109 Real
111 {
112  unsigned int coupled_component = 0;
113  unsigned int coupled_enrichment_component = 0;
114  bool active(false);
115  bool active_enrich(false);
116 
117  for (unsigned int i = 0; i < _enrich_disp_var.size(); ++i)
118  {
119  if (jvar == _enrich_disp_var[i])
120  {
121  coupled_component = i / 4;
122  coupled_enrichment_component = i % 4;
123  active_enrich = true;
124  }
125  }
126 
127  for (unsigned int i = 0; i < _disp_var.size(); ++i)
128  {
129  if (jvar == _disp_var[i])
130  {
131  coupled_component = i;
132  active = true;
133  }
134  }
135 
136  if (active_enrich)
137  {
138  crackTipEnrichementFunctionAtPoint(*_current_elem->node_ptr(_i), _BI);
139  crackTipEnrichementFunctionAtPoint(*_current_elem->node_ptr(_j), _BJ);
140 
141  crackTipEnrichementFunctionAtPoint(_q_point[_qp], _B);
142  unsigned int crack_front_point_index =
144 
145  for (unsigned int i = 0; i < 4; ++i)
146  rotateFromCrackFrontCoordsToGlobal(_dBx[i], _dBX[i], crack_front_point_index);
147 
149  RealVectorValue grad_B_phi(_dBX[coupled_enrichment_component]);
150 
151  RealVectorValue grad_test =
152  _grad_test[_i][_qp] * (_B[_enrichment_component] - _BI[_enrichment_component]) +
153  _test[_i][_qp] * grad_B_test;
154  RealVectorValue grad_phi = _grad_phi[_j][_qp] * (_B[coupled_enrichment_component] -
155  _BJ[coupled_enrichment_component]) +
156  _phi[_j][_qp] * grad_B_phi;
157 
159  _Jacobian_mult[_qp], _component, coupled_component, grad_test, grad_phi);
160  }
161  else if (active)
162  {
163  crackTipEnrichementFunctionAtPoint(*_current_elem->node_ptr(_i), _BI);
164 
165  crackTipEnrichementFunctionAtPoint(_q_point[_qp], _B);
166  unsigned int crack_front_point_index =
168 
169  for (unsigned int i = 0; i < 4; ++i)
170  rotateFromCrackFrontCoordsToGlobal(_dBx[i], _dBX[i], crack_front_point_index);
171 
173 
174  RealVectorValue grad_test =
175  _grad_test[_i][_qp] * (_B[_enrichment_component] - _BI[_enrichment_component]) +
176  _test[_i][_qp] * grad_B_test;
177 
179  _Jacobian_mult[_qp], _component, coupled_component, grad_test, _grad_phi[_j][_qp]);
180  }
181 
182  return 0;
183 }
std::vector< RealVectorValue > _dBx
derivatives of enrichment function respect to crack front cooridnate
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
virtual unsigned int crackTipEnrichementFunctionAtPoint(const Point &point, std::vector< Real > &B)
calculate the enrichment function values at point
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
void rotateFromCrackFrontCoordsToGlobal(const RealVectorValue &vector, RealVectorValue &rotated_vector, const unsigned int point_index)
rotate a vector from crack front coordinate to global cooridate
std::vector< Real > _BI
enrichment function at node I
void addRequiredParam(const std::string &name, const std::string &doc_string)
Real elasticJacobian(const RankFourTensor &r4t, unsigned int i, unsigned int k, const RealGradient &grad_test, const RealGradient &grad_phi)
This is used for the standard kernel stress_ij*d(test)/dx_j, when varied wrt u_k Jacobian entry: d(st...
Class used in fracture integrals to define geometric characteristics of the crack front...
unsigned int _nenrich_disp
Coupled enrichment displacement variables.
std::vector< Real > _BJ
enrichment function at node J
CrackTipEnrichmentStressDivergenceTensors(const InputParameters &parameters)
registerMooseObject("XFEMApp", CrackTipEnrichmentStressDivergenceTensors)
Perform calculation of enrichment function values and derivatives.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
CrackTipEnrichmentStressDivergenceTensors implements the residual and jacobian for enrichement displa...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const unsigned int _enrichment_component
enrichment function components
virtual unsigned int crackTipEnrichementFunctionDerivativeAtPoint(const Point &point, std::vector< RealVectorValue > &dB)
calculate the enrichment function derivatives at point
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
Definition: ALEKernel.C:16
const MaterialProperty< RankFourTensor > & _Jacobian_mult
std::vector< RealVectorValue > _dBX
derivatives of enrichment function respect to global cooridnate
void ErrorVector unsigned int