www.mooseframework.org
DomainIntegralTopologicalQFunction.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  params.addRequiredParam<unsigned int>("ring_index",
15  "The ring of elements that defines the integration domain");
16  params.addRequiredParam<UserObjectName>("crack_front_definition",
17  "The CrackFrontDefinition user object name");
18  params.addParam<unsigned int>(
19  "crack_front_point_index",
20  "The index of the point on the crack front corresponding to this q function");
21  params.set<bool>("use_displaced_mesh") = false;
22  return params;
23 }
24 
26  const InputParameters & parameters)
27  : AuxKernel(parameters),
28  _ring_number(getParam<unsigned int>("ring_index")),
29  _crack_front_definition(&getUserObject<CrackFrontDefinition>("crack_front_definition")),
30  _has_crack_front_point_index(isParamValid("crack_front_point_index")),
31  _crack_front_point_index(
32  _has_crack_front_point_index ? getParam<unsigned int>("crack_front_point_index") : 0),
33  _treat_as_2d(false)
34 {
35 }
36 
37 void
39 {
41 
42  if (_treat_as_2d)
43  {
45  {
46  mooseWarning(
47  "crack_front_point_index ignored because CrackFrontDefinition is set to treat as 2D");
48  }
49  }
50  else
51  {
53  {
54  mooseError("crack_front_point_index must be specified in DomainIntegralTopologicalQFunction");
55  }
56  }
57 }
58 
59 Real
61 {
62 
63  Real q = 0;
64  bool is_node_in_ring = _crack_front_definition->isNodeInRing(
65  _ring_number, _current_node->id(), _crack_front_point_index);
66  if (is_node_in_ring)
67  q = 1;
68 
69  return q;
70 }
const CrackFrontDefinition *const _crack_front_definition
InputParameters validParams< DomainIntegralTopologicalQFunction >()
bool isNodeInRing(const unsigned int ring_index, const dof_id_type connected_node_id, const unsigned int node_index) const
Works on top of NodalNormalsPreprocessor.
DomainIntegralTopologicalQFunction(const InputParameters &parameters)
Factory constructor, takes parameters so that all derived classes can be built using the same constru...