www.mooseframework.org
DomainIntegralQFunction.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<AuxKernel>();
14 
15  params.addRequiredParam<Real>("j_integral_radius_inner", "Radius for J-Integral calculation");
16  params.addRequiredParam<Real>("j_integral_radius_outer", "Radius for J-Integral calculation");
17  params.addRequiredParam<UserObjectName>("crack_front_definition",
18  "The CrackFrontDefinition user object name");
19  params.addParam<unsigned int>(
20  "crack_front_point_index",
21  "The index of the point on the crack front corresponding to this q function");
22  params.set<bool>("use_displaced_mesh") = false;
23  return params;
24 }
25 
26 DomainIntegralQFunction::DomainIntegralQFunction(const InputParameters & parameters)
27  : AuxKernel(parameters),
28  _j_integral_radius_inner(getParam<Real>("j_integral_radius_inner")),
29  _j_integral_radius_outer(getParam<Real>("j_integral_radius_outer")),
30  _crack_front_definition(&getUserObject<CrackFrontDefinition>("crack_front_definition")),
31  _has_crack_front_point_index(isParamValid("crack_front_point_index")),
32  _crack_front_point_index(
33  _has_crack_front_point_index ? getParam<unsigned int>("crack_front_point_index") : 0),
34  _treat_as_2d(false),
35  _is_point_on_intersecting_boundary(false)
36 {
37 }
38 
39 void
41 {
43 
44  if (_treat_as_2d)
45  {
47  {
48  mooseWarning(
49  "crack_front_point_index ignored because CrackFrontDefinition is set to treat as 2D");
50  }
51  }
52  else
53  {
55  {
56  mooseError("crack_front_point_index must be specified in DomainIntegralQFunction");
57  }
58  }
61 }
62 
63 Real
65 {
66  Real dist_to_crack_front;
67  Real dist_along_tangent;
68  projectToFrontAtPoint(dist_to_crack_front, dist_along_tangent);
69 
70  Real q = 1.0;
71  if (dist_to_crack_front > _j_integral_radius_inner &&
72  dist_to_crack_front < _j_integral_radius_outer)
73  q = (_j_integral_radius_outer - dist_to_crack_front) /
75  else if (dist_to_crack_front >= _j_integral_radius_outer)
76  q = 0.0;
77 
78  if (q > 0.0)
79  {
80  Real tangent_multiplier = 1.0;
81  if (!_treat_as_2d)
82  {
83  const Real forward_segment_length =
85  const Real backward_segment_length =
87 
88  if (dist_along_tangent >= 0.0)
89  {
90  if (forward_segment_length > 0.0)
91  tangent_multiplier = 1.0 - dist_along_tangent / forward_segment_length;
92  }
93  else
94  {
95  if (backward_segment_length > 0.0)
96  tangent_multiplier = 1.0 + dist_along_tangent / backward_segment_length;
97  }
98  }
99 
100  tangent_multiplier = std::max(tangent_multiplier, 0.0);
101  tangent_multiplier = std::min(tangent_multiplier, 1.0);
102 
103  // Set to zero if a node is on a designated free surface and its crack front node is not.
106  tangent_multiplier = 0.0;
107 
108  q *= tangent_multiplier;
109  }
110 
111  return q;
112 }
113 
114 void
115 DomainIntegralQFunction::projectToFrontAtPoint(Real & dist_to_front, Real & dist_along_tangent)
116 {
117  const Point * crack_front_point =
119 
120  Point p = *_current_node;
121  const RealVectorValue & crack_front_tangent =
123 
124  RealVectorValue crack_node_to_current_node = p - *crack_front_point;
125  dist_along_tangent = crack_node_to_current_node * crack_front_tangent;
126  RealVectorValue projection_point = *crack_front_point + dist_along_tangent * crack_front_tangent;
127  RealVectorValue axis_to_current_node = p - projection_point;
128  dist_to_front = axis_to_current_node.norm();
129 }
const RealVectorValue & getCrackFrontTangent(const unsigned int point_index) const
const Point * getCrackFrontPoint(const unsigned int point_index) const
Works on top of NodalNormalsPreprocessor.
Real getCrackFrontBackwardSegmentLength(const unsigned int point_index) const
void projectToFrontAtPoint(Real &dist_to_front, Real &dist_along_tangent)
bool isPointWithIndexOnIntersectingBoundary(const unsigned int point_index) const
const CrackFrontDefinition *const _crack_front_definition
bool isNodeOnIntersectingBoundary(const Node *const node) const
DomainIntegralQFunction(const InputParameters &parameters)
Factory constructor, takes parameters so that all derived classes can be built using the same constru...
const unsigned int _crack_front_point_index
Real getCrackFrontForwardSegmentLength(const unsigned int point_index) const
InputParameters validParams< DomainIntegralQFunction >()