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

#include <XFEMRankTwoTensorMarkerUserObject.h>

Inheritance diagram for XFEMRankTwoTensorMarkerUserObject:
[legend]

Public Member Functions

 XFEMRankTwoTensorMarkerUserObject (const InputParameters &parameters)
 
virtual ~XFEMRankTwoTensorMarkerUserObject ()
 
virtual void initialize ()
 
virtual void execute ()
 
virtual void threadJoin (const UserObject &y)
 
virtual void finalize ()
 

Protected Member Functions

virtual bool doesElementCrack (RealVectorValue &direction) override
 

Protected Attributes

const MaterialProperty< RankTwoTensor > & _tensor
 The tensor from which the scalar quantity used as a marking criterion is extracted. More...
 
MooseEnum _scalar_type
 The type of scalar to be extracted from the tensor. More...
 
const Point _point1
 Points used to define an axis of rotation for some scalar quantities. More...
 
const Point _point2
 
const VariableValue & _threshold
 Threshold value of the scalar. More...
 
bool _average
 Whether to average the value for all quadrature points in an element. More...
 
const MooseArray< Real > & _JxW
 Transformed Jacobian weights. More...
 
const MooseArray< Real > & _coord
 

Detailed Description

Definition at line 19 of file XFEMRankTwoTensorMarkerUserObject.h.

Constructor & Destructor Documentation

XFEMRankTwoTensorMarkerUserObject::XFEMRankTwoTensorMarkerUserObject ( const InputParameters &  parameters)

Definition at line 42 of file XFEMRankTwoTensorMarkerUserObject.C.

44  : XFEMMarkerUserObject(parameters),
45  _tensor(getMaterialProperty<RankTwoTensor>(getParam<std::string>("tensor"))),
46  _scalar_type(getParam<MooseEnum>("scalar_type")),
47  _point1(parameters.get<Point>("point1")),
48  _point2(parameters.get<Point>("point2")),
49  _threshold(coupledValue("threshold")),
50  _average(getParam<bool>("average")),
51  _JxW(_assembly.JxW()),
52  _coord(_assembly.coordTransformation())
53 {
54 }
const MaterialProperty< RankTwoTensor > & _tensor
The tensor from which the scalar quantity used as a marking criterion is extracted.
const Point _point1
Points used to define an axis of rotation for some scalar quantities.
const VariableValue & _threshold
Threshold value of the scalar.
MooseEnum _scalar_type
The type of scalar to be extracted from the tensor.
XFEMMarkerUserObject(const InputParameters &parameters)
Factory constructor, takes parameters so that all derived classes can be built using the same constru...
const MooseArray< Real > & _JxW
Transformed Jacobian weights.
bool _average
Whether to average the value for all quadrature points in an element.
virtual XFEMRankTwoTensorMarkerUserObject::~XFEMRankTwoTensorMarkerUserObject ( )
inlinevirtual

Definition at line 23 of file XFEMRankTwoTensorMarkerUserObject.h.

23 {}

Member Function Documentation

bool XFEMRankTwoTensorMarkerUserObject::doesElementCrack ( RealVectorValue &  direction)
overrideprotectedvirtual

Reimplemented from XFEMMarkerUserObject.

Definition at line 57 of file XFEMRankTwoTensorMarkerUserObject.C.

58 {
59  bool does_it_crack = false;
60  unsigned int numqp = _qrule->n_points();
61  Point zero; // Used for checking whether direction is zero
62 
63  if (_average)
64  {
65  Real average_threshold = 0.0;
66  RankTwoTensor average_tensor;
67  Point average_point;
68  for (unsigned int qp = 0; qp < numqp; ++qp)
69  {
70  if (_threshold[qp] <= 0.0)
71  mooseError("Threshold must be strictly positive in XFEMRankTwoTensorMarkerUserObject");
72  average_threshold += _JxW[qp] * _coord[qp] * _threshold[qp];
73  average_tensor += _JxW[qp] * _coord[qp] * _tensor[qp];
74  average_point += _JxW[qp] * _coord[qp] * _q_point[qp];
75  }
76  Point point_dir;
77  Real tensor_quantity = RankTwoScalarTools::getQuantity(
78  average_tensor, _scalar_type, _point1, _point2, average_point, point_dir);
79  if (point_dir.absolute_fuzzy_equals(zero))
80  mooseError("Direction has zero length in XFEMRankTwoTensorMarkerUserObject");
81  direction = point_dir;
82  if (tensor_quantity > average_threshold)
83  does_it_crack = true;
84  }
85  else
86  {
87  unsigned int max_index = std::numeric_limits<unsigned int>::max();
88  Real max_ratio = 0.0;
89  std::vector<Point> directions(numqp);
90  for (unsigned int qp = 0; qp < numqp; ++qp)
91  {
92  if (_threshold[qp] <= 0.0)
93  mooseError("Threshold must be strictly positive in XFEMRankTwoTensorMarkerUserObject");
94  const Real tensor_quantity = RankTwoScalarTools::getQuantity(
95  _tensor[qp], _scalar_type, _point1, _point2, _q_point[qp], directions[qp]);
96  if (directions[qp].absolute_fuzzy_equals(zero))
97  mooseError("Direction has zero length in XFEMRankTwoTensorMarkerUserObject");
98  Real ratio = tensor_quantity / _threshold[qp];
99  if (ratio > max_ratio)
100  {
101  max_ratio = ratio;
102  max_index = qp;
103  }
104  }
105  if (max_ratio > 1.0)
106  {
107  if (max_index == std::numeric_limits<unsigned int>::max())
108  mooseError("max_index out of bounds in XFEMRankTwoTensorMarkerUserObject");
109  does_it_crack = true;
110  direction = directions[max_index];
111  }
112  }
113 
114  return does_it_crack;
115 }
const MaterialProperty< RankTwoTensor > & _tensor
The tensor from which the scalar quantity used as a marking criterion is extracted.
const Point _point1
Points used to define an axis of rotation for some scalar quantities.
const VariableValue & _threshold
Threshold value of the scalar.
MooseEnum _scalar_type
The type of scalar to be extracted from the tensor.
Real getQuantity(const RankTwoTensor &tensor, const MooseEnum scalar_type, const Point &point1, const Point &point2, const Point &curr_point, Point &direction)
const MooseArray< Real > & _JxW
Transformed Jacobian weights.
bool _average
Whether to average the value for all quadrature points in an element.
void XFEMMarkerUserObject::execute ( )
virtualinherited

Definition at line 60 of file XFEMMarkerUserObject.C.

Referenced by XFEMMarkerUserObject::~XFEMMarkerUserObject().

61 {
62  RealVectorValue direction;
63  bool isCut = _xfem->isElemCut(_current_elem);
64  bool isCTE = _xfem->isElemAtCrackTip(_current_elem);
65  bool isOnBoundary = false;
66  unsigned int boundarySide = 99999;
67  unsigned int _current_eid = _current_elem->id();
68  std::map<unsigned int, RealVectorValue>::iterator mit;
69  mit = _marked_elems.find(_current_eid);
70 
71  for (unsigned int i = 0; i < _initiation_boundary_ids.size(); ++i)
72  {
73  if (_mesh.isBoundaryElem(_current_eid, _initiation_boundary_ids[i]))
74  {
75  isOnBoundary = true;
76  boundarySide = _mesh.sideWithBoundaryID(_current_elem, _initiation_boundary_ids[i]);
77  }
78  }
79 
80  if (isCTE && doesElementCrack(direction))
81  {
82  if (mit != _marked_elems.end())
83  {
84  mooseError("ERROR: element ", _current_eid, " already marked for crack growth.");
85  }
86  _marked_elems[_current_eid] = direction;
87  }
88  else if (isOnBoundary && doesElementCrack(direction))
89  {
90  if (mit != _marked_elems.end())
91  {
92  mooseError("ERROR: element ", _current_eid, " already marked for crack growth.");
93  }
94  _marked_elems[_current_eid] = direction;
95  _marked_elem_sides[_current_eid] = boundarySide;
96  }
97  else if (isCut && _secondary_cracks && doesElementCrack(direction))
98  {
99  if (mit != _marked_elems.end())
100  {
101  mooseError("ERROR: element ", _current_eid, " already marked for crack growth.");
102  }
103  _marked_elems[_current_eid] = direction;
104  _marked_frags.insert(_current_eid);
105  }
106 }
std::set< unsigned int > _marked_frags
virtual bool doesElementCrack(RealVectorValue &direction)
std::map< unsigned int, RealVectorValue > _marked_elems
std::vector< BoundaryID > _initiation_boundary_ids
MooseSharedPointer< XFEM > _xfem
std::map< unsigned int, unsigned int > _marked_elem_sides
void XFEMMarkerUserObject::finalize ( )
virtualinherited

Definition at line 136 of file XFEMMarkerUserObject.C.

Referenced by XFEMMarkerUserObject::~XFEMMarkerUserObject().

137 {
138  _communicator.set_union(_marked_elems);
139  _communicator.set_union(_marked_frags);
140  _communicator.set_union(_marked_elem_sides);
141 
142  _xfem->clearStateMarkedElems();
143  std::map<unsigned int, RealVectorValue>::iterator mit;
144  for (mit = _marked_elems.begin(); mit != _marked_elems.end(); ++mit)
145  {
146  if (_marked_elem_sides.find(mit->first) != _marked_elem_sides.end())
147  {
148  _xfem->addStateMarkedElem(mit->first, mit->second, _marked_elem_sides[mit->first]);
149  }
150  else if (_marked_frags.find(mit->first) != _marked_frags.end())
151  {
152  _xfem->addStateMarkedFrag(mit->first, mit->second);
153  }
154  else
155  {
156  _xfem->addStateMarkedElem(mit->first, mit->second);
157  }
158  }
159  _marked_elems.clear();
160  _marked_frags.clear();
161  _marked_elem_sides.clear();
162 }
std::set< unsigned int > _marked_frags
std::map< unsigned int, RealVectorValue > _marked_elems
MooseSharedPointer< XFEM > _xfem
std::map< unsigned int, unsigned int > _marked_elem_sides
void XFEMMarkerUserObject::initialize ( )
virtualinherited

Definition at line 51 of file XFEMMarkerUserObject.C.

Referenced by XFEMMarkerUserObject::~XFEMMarkerUserObject().

52 {
53  _marked_elems.clear();
55  .clear(); // mark the fragment which has secondary crack growing from the primary crack
56  _marked_elem_sides.clear();
57 }
std::set< unsigned int > _marked_frags
std::map< unsigned int, RealVectorValue > _marked_elems
std::map< unsigned int, unsigned int > _marked_elem_sides
void XFEMMarkerUserObject::threadJoin ( const UserObject &  y)
virtualinherited

Definition at line 109 of file XFEMMarkerUserObject.C.

Referenced by XFEMMarkerUserObject::~XFEMMarkerUserObject().

110 {
111  const XFEMMarkerUserObject & xmuo = dynamic_cast<const XFEMMarkerUserObject &>(y);
112 
113  for (std::map<unsigned int, RealVectorValue>::const_iterator mit = xmuo._marked_elems.begin();
114  mit != xmuo._marked_elems.end();
115  ++mit)
116  {
117  _marked_elems[mit->first] = mit->second; // TODO do error checking for duplicates here too
118  }
119 
120  for (std::set<unsigned int>::const_iterator mit = xmuo._marked_frags.begin();
121  mit != xmuo._marked_frags.end();
122  ++mit)
123  {
124  _marked_frags.insert(*mit); // TODO do error checking for duplicates here too
125  }
126 
127  for (std::map<unsigned int, unsigned int>::const_iterator mit = xmuo._marked_elem_sides.begin();
128  mit != xmuo._marked_elem_sides.end();
129  ++mit)
130  {
131  _marked_elem_sides[mit->first] = mit->second; // TODO do error checking for duplicates here too
132  }
133 }
std::set< unsigned int > _marked_frags
std::map< unsigned int, RealVectorValue > _marked_elems
Coupled auxiliary value.
std::map< unsigned int, unsigned int > _marked_elem_sides

Member Data Documentation

bool XFEMRankTwoTensorMarkerUserObject::_average
protected

Whether to average the value for all quadrature points in an element.

Definition at line 40 of file XFEMRankTwoTensorMarkerUserObject.h.

Referenced by doesElementCrack().

const MooseArray<Real>& XFEMRankTwoTensorMarkerUserObject::_coord
protected

Definition at line 44 of file XFEMRankTwoTensorMarkerUserObject.h.

Referenced by doesElementCrack().

const MooseArray<Real>& XFEMRankTwoTensorMarkerUserObject::_JxW
protected

Transformed Jacobian weights.

Definition at line 43 of file XFEMRankTwoTensorMarkerUserObject.h.

Referenced by doesElementCrack().

const Point XFEMRankTwoTensorMarkerUserObject::_point1
protected

Points used to define an axis of rotation for some scalar quantities.

Definition at line 33 of file XFEMRankTwoTensorMarkerUserObject.h.

Referenced by doesElementCrack().

const Point XFEMRankTwoTensorMarkerUserObject::_point2
protected

Definition at line 34 of file XFEMRankTwoTensorMarkerUserObject.h.

Referenced by doesElementCrack().

MooseEnum XFEMRankTwoTensorMarkerUserObject::_scalar_type
protected

The type of scalar to be extracted from the tensor.

Definition at line 30 of file XFEMRankTwoTensorMarkerUserObject.h.

Referenced by doesElementCrack().

const MaterialProperty<RankTwoTensor>& XFEMRankTwoTensorMarkerUserObject::_tensor
protected

The tensor from which the scalar quantity used as a marking criterion is extracted.

Definition at line 27 of file XFEMRankTwoTensorMarkerUserObject.h.

Referenced by doesElementCrack().

const VariableValue& XFEMRankTwoTensorMarkerUserObject::_threshold
protected

Threshold value of the scalar.

Definition at line 37 of file XFEMRankTwoTensorMarkerUserObject.h.

Referenced by doesElementCrack().


The documentation for this class was generated from the following files: