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

#include <XFEMMaterialTensorMarkerUserObject.h>

Inheritance diagram for XFEMMaterialTensorMarkerUserObject:
[legend]

Public Member Functions

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

Protected Member Functions

virtual bool doesElementCrack (RealVectorValue &direction)
 

Protected Attributes

MaterialTensorCalculator _material_tensor_calculator
 
const MaterialProperty< SymmTensor > & _tensor
 
Real _threshold
 
bool _average
 
Real _random_range
 

Detailed Description

Definition at line 19 of file XFEMMaterialTensorMarkerUserObject.h.

Constructor & Destructor Documentation

XFEMMaterialTensorMarkerUserObject::XFEMMaterialTensorMarkerUserObject ( const InputParameters &  parameters)

Definition at line 27 of file XFEMMaterialTensorMarkerUserObject.C.

29  : XFEMMarkerUserObject(parameters),
30  _material_tensor_calculator(parameters),
31  _tensor(getMaterialProperty<SymmTensor>(getParam<std::string>("tensor"))),
32  _threshold(getParam<Real>("threshold")),
33  _average(getParam<bool>("average")),
34  _random_range(getParam<Real>("random_range"))
35 {
36  setRandomResetFrequency(EXEC_INITIAL);
37 }
XFEMMarkerUserObject(const InputParameters &parameters)
Factory constructor, takes parameters so that all derived classes can be built using the same constru...
const MaterialProperty< SymmTensor > & _tensor
virtual XFEMMaterialTensorMarkerUserObject::~XFEMMaterialTensorMarkerUserObject ( )
inlinevirtual

Definition at line 23 of file XFEMMaterialTensorMarkerUserObject.h.

23 {}

Member Function Documentation

bool XFEMMaterialTensorMarkerUserObject::doesElementCrack ( RealVectorValue &  direction)
protectedvirtual

Reimplemented from XFEMMarkerUserObject.

Definition at line 40 of file XFEMMaterialTensorMarkerUserObject.C.

41 {
42  bool does_it_crack = false;
43  unsigned int numqp = _qrule->n_points();
44 
45  Real rnd_mult = (1.0 - _random_range / 2.0) + _random_range * getRandomReal();
46 
47  if (_average)
48  {
49  SymmTensor average_tensor;
50  for (unsigned int qp = 0; qp < numqp; ++qp)
51  {
52  average_tensor += _tensor[qp];
53  }
54  average_tensor *= 1.0 / (Real)numqp;
55  Real tensor_quantity =
56  _material_tensor_calculator.getTensorQuantity(average_tensor, _q_point[0], direction);
57  if (tensor_quantity > _threshold * rnd_mult)
58  does_it_crack = true;
59  }
60  else
61  {
62  unsigned int max_index = 999999;
63  std::vector<Real> tensor_quantities;
64  tensor_quantities.reserve(numqp);
65  Real max_quantity = 0;
66  std::vector<RealVectorValue> directions;
67  directions.resize(numqp);
68  for (unsigned int qp = 0; qp < numqp; ++qp)
69  {
70  tensor_quantities[qp] =
71  _material_tensor_calculator.getTensorQuantity(_tensor[qp], _q_point[qp], directions[qp]);
72  if (directions[qp](0) == 0 && directions[qp](1) == 0 && directions[qp](2) == 0)
73  {
74  mooseError("Direction has zero length in XFEMMaterialTensorMarkerUserObject");
75  }
76  if (tensor_quantities[qp] > max_quantity)
77  {
78  max_quantity = tensor_quantities[qp];
79  max_index = qp;
80  }
81  }
82  if (max_quantity > _threshold * rnd_mult)
83  {
84  does_it_crack = true;
85  direction = directions[max_index];
86  }
87  }
88 
89  return does_it_crack;
90 }
Real getTensorQuantity(const SymmTensor &tensor, const Point &curr_point, RealVectorValue &direction)
const MaterialProperty< SymmTensor > & _tensor
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 XFEMMaterialTensorMarkerUserObject::_average
protected

Definition at line 29 of file XFEMMaterialTensorMarkerUserObject.h.

Referenced by doesElementCrack().

MaterialTensorCalculator XFEMMaterialTensorMarkerUserObject::_material_tensor_calculator
protected

Definition at line 26 of file XFEMMaterialTensorMarkerUserObject.h.

Referenced by doesElementCrack().

Real XFEMMaterialTensorMarkerUserObject::_random_range
protected

Definition at line 30 of file XFEMMaterialTensorMarkerUserObject.h.

Referenced by doesElementCrack().

const MaterialProperty<SymmTensor>& XFEMMaterialTensorMarkerUserObject::_tensor
protected

Definition at line 27 of file XFEMMaterialTensorMarkerUserObject.h.

Referenced by doesElementCrack().

Real XFEMMaterialTensorMarkerUserObject::_threshold
protected

Definition at line 28 of file XFEMMaterialTensorMarkerUserObject.h.

Referenced by doesElementCrack().


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