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

Coupled auxiliary value. More...

#include <XFEMMaterialStateMarkerBase.h>

Inheritance diagram for XFEMMaterialStateMarkerBase:
[legend]

Public Member Functions

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

Protected Member Functions

virtual bool doesElementCrack (RealVectorValue &direction)
 Determine whether the current element should be cut by a new crack. More...
 

Private Attributes

MooseMesh & _mesh
 
std::vector< BoundaryID > _initiation_boundary_ids
 
bool _secondary_cracks
 
std::shared_ptr< 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 20 of file XFEMMaterialStateMarkerBase.h.

Constructor & Destructor Documentation

◆ XFEMMaterialStateMarkerBase()

XFEMMaterialStateMarkerBase::XFEMMaterialStateMarkerBase ( const InputParameters &  parameters)

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

Definition at line 30 of file XFEMMaterialStateMarkerBase.C.

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

Member Function Documentation

◆ doesElementCrack()

bool XFEMMaterialStateMarkerBase::doesElementCrack ( RealVectorValue &  direction)
protectedvirtual

Determine whether the current element should be cut by a new crack.

Parameters
directionNormal direction of crack if it is cracked
Returns
bool true if element cracks

Reimplemented in XFEMRankTwoTensorMarkerUserObject, and XFEMMaterialTensorMarkerUserObject.

Definition at line 167 of file XFEMMaterialStateMarkerBase.C.

Referenced by execute().

168 {
169  direction(1) = 1.0;
170  return true;
171 }

◆ execute()

void XFEMMaterialStateMarkerBase::execute ( )
overridevirtual

Definition at line 62 of file XFEMMaterialStateMarkerBase.C.

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

◆ finalize()

void XFEMMaterialStateMarkerBase::finalize ( )
overridevirtual

Definition at line 138 of file XFEMMaterialStateMarkerBase.C.

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

◆ initialize()

void XFEMMaterialStateMarkerBase::initialize ( )
overridevirtual

Definition at line 53 of file XFEMMaterialStateMarkerBase.C.

54 {
55  _marked_elems.clear();
57  .clear(); // mark the fragment which has secondary crack growing from the primary crack
58  _marked_elem_sides.clear();
59 }
std::map< unsigned int, unsigned int > _marked_elem_sides
std::set< unsigned int > _marked_frags
std::map< unsigned int, RealVectorValue > _marked_elems

◆ threadJoin()

void XFEMMaterialStateMarkerBase::threadJoin ( const UserObject &  y)
overridevirtual

Definition at line 111 of file XFEMMaterialStateMarkerBase.C.

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

Member Data Documentation

◆ _initiation_boundary_ids

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

Definition at line 44 of file XFEMMaterialStateMarkerBase.h.

Referenced by execute(), and XFEMMaterialStateMarkerBase().

◆ _marked_elem_sides

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

Definition at line 49 of file XFEMMaterialStateMarkerBase.h.

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

◆ _marked_elems

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

Definition at line 47 of file XFEMMaterialStateMarkerBase.h.

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

◆ _marked_frags

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

Definition at line 48 of file XFEMMaterialStateMarkerBase.h.

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

◆ _mesh

MooseMesh& XFEMMaterialStateMarkerBase::_mesh
private

Definition at line 43 of file XFEMMaterialStateMarkerBase.h.

Referenced by execute(), and XFEMMaterialStateMarkerBase().

◆ _secondary_cracks

bool XFEMMaterialStateMarkerBase::_secondary_cracks
private

Definition at line 45 of file XFEMMaterialStateMarkerBase.h.

Referenced by execute().

◆ _xfem

std::shared_ptr<XFEM> XFEMMaterialStateMarkerBase::_xfem
private

Definition at line 46 of file XFEMMaterialStateMarkerBase.h.

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


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