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

Coupled auxiliary value. More...

#include <XFEMMarkerUserObject.h>

Inheritance diagram for XFEMMarkerUserObject:
[legend]

Public Member Functions

 XFEMMarkerUserObject (const InputParameters &parameters)
 Factory constructor, takes parameters so that all derived classes can be built using the same constructor. More...
 
virtual ~XFEMMarkerUserObject ()
 
virtual void initialize ()
 
virtual void execute ()
 
virtual void threadJoin (const UserObject &y)
 
virtual void finalize ()
 

Protected Member Functions

virtual bool doesElementCrack (RealVectorValue &direction)
 

Private Attributes

MooseMesh & _mesh
 
std::vector< BoundaryID > _initiation_boundary_ids
 
bool _secondary_cracks
 
MooseSharedPointer< XFEM_xfem
 
std::map< unsigned int, RealVectorValue > _marked_elems
 
std::set< unsigned int > _marked_frags
 
std::map< unsigned int, unsigned int > _marked_elem_sides
 

Detailed Description

Coupled auxiliary value.

Definition at line 18 of file XFEMMarkerUserObject.h.

Constructor & Destructor Documentation

XFEMMarkerUserObject::XFEMMarkerUserObject ( const InputParameters &  parameters)

Factory constructor, takes parameters so that all derived classes can be built using the same constructor.

Definition at line 28 of file XFEMMarkerUserObject.C.

29  : ElementUserObject(parameters),
30  _mesh(_subproblem.mesh()),
31  _secondary_cracks(getParam<bool>("secondary_cracks"))
32 {
33  FEProblemBase * fe_problem = dynamic_cast<FEProblemBase *>(&_subproblem);
34  if (fe_problem == NULL)
35  mooseError("Problem casting _subproblem to FEProblemBase in XFEMMarkerUserObject");
36  _xfem = MooseSharedNamespace::dynamic_pointer_cast<XFEM>(fe_problem->getXFEM());
37  if (_xfem == NULL)
38  mooseError("Problem casting to XFEM in XFEMMarkerUserObject");
39  if (isNodal())
40  mooseError("XFEMMarkerUserObject can only be run on an element variable");
41 
42  if (isParamValid("initiate_on_boundary"))
43  {
44  std::vector<BoundaryName> initiation_boundary_names =
45  getParam<std::vector<BoundaryName>>("initiate_on_boundary");
46  _initiation_boundary_ids = _mesh.getBoundaryIDs(initiation_boundary_names, true);
47  }
48 }
std::vector< BoundaryID > _initiation_boundary_ids
MooseSharedPointer< XFEM > _xfem
This is the XFEM class.
Definition: XFEM.h:60
virtual XFEMMarkerUserObject::~XFEMMarkerUserObject ( )
inlinevirtual

Definition at line 27 of file XFEMMarkerUserObject.h.

27 {}

Member Function Documentation

bool XFEMMarkerUserObject::doesElementCrack ( RealVectorValue &  direction)
protectedvirtual

Reimplemented in XFEMRankTwoTensorMarkerUserObject, and XFEMMaterialTensorMarkerUserObject.

Definition at line 165 of file XFEMMarkerUserObject.C.

Referenced by execute(), and ~XFEMMarkerUserObject().

166 {
167  direction(1) = 1.0;
168  return true;
169 }
void XFEMMarkerUserObject::execute ( )
virtual

Definition at line 60 of file XFEMMarkerUserObject.C.

Referenced by ~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 ( )
virtual

Definition at line 136 of file XFEMMarkerUserObject.C.

Referenced by ~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 ( )
virtual

Definition at line 51 of file XFEMMarkerUserObject.C.

Referenced by ~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)
virtual

Definition at line 109 of file XFEMMarkerUserObject.C.

Referenced by ~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

std::vector<BoundaryID> XFEMMarkerUserObject::_initiation_boundary_ids
private

Definition at line 39 of file XFEMMarkerUserObject.h.

Referenced by execute(), and XFEMMarkerUserObject().

std::map<unsigned int, unsigned int> XFEMMarkerUserObject::_marked_elem_sides
private

Definition at line 44 of file XFEMMarkerUserObject.h.

Referenced by execute(), finalize(), initialize(), and threadJoin().

std::map<unsigned int, RealVectorValue> XFEMMarkerUserObject::_marked_elems
private

Definition at line 42 of file XFEMMarkerUserObject.h.

Referenced by execute(), finalize(), initialize(), and threadJoin().

std::set<unsigned int> XFEMMarkerUserObject::_marked_frags
private

Definition at line 43 of file XFEMMarkerUserObject.h.

Referenced by execute(), finalize(), initialize(), and threadJoin().

MooseMesh& XFEMMarkerUserObject::_mesh
private

Definition at line 38 of file XFEMMarkerUserObject.h.

Referenced by execute(), and XFEMMarkerUserObject().

bool XFEMMarkerUserObject::_secondary_cracks
private

Definition at line 40 of file XFEMMarkerUserObject.h.

Referenced by execute().

MooseSharedPointer<XFEM> XFEMMarkerUserObject::_xfem
private

Definition at line 41 of file XFEMMarkerUserObject.h.

Referenced by execute(), finalize(), and XFEMMarkerUserObject().


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