www.mooseframework.org
XFEM.h
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 /****************************************************************/
7 
8 #ifndef XFEM_H
9 #define XFEM_H
10 
11 #include "ElementPairLocator.h"
13 #include "XFEMInterface.h"
15 
16 #include "libmesh/vector_value.h"
17 #include "libmesh/quadrature.h"
18 
19 #include "GeometricCutUserObject.h"
20 
21 // Forward declarations
22 class SystemBase;
23 
24 namespace Xfem
25 {
27 {
34 };
35 
37 {
41 };
42 } // namespace Xfem
43 
44 class XFEMCutElem;
46 class EFANode;
47 class EFAEdge;
48 class EFAElement;
49 class EFAElement2D;
50 class EFAElement3D;
51 
58 // ------------------------------------------------------------
59 // XFEM class definition
60 class XFEM : public XFEMInterface
61 {
62 public:
63  explicit XFEM(const InputParameters & params);
64 
65  ~XFEM();
66 
67  void addGeometricCut(const GeometricCutUserObject * geometric_cut);
68 
69  void addStateMarkedElem(unsigned int elem_id, RealVectorValue & normal);
70  void addStateMarkedElem(unsigned int elem_id, RealVectorValue & normal, unsigned int marked_side);
71  void addStateMarkedFrag(unsigned int elem_id, RealVectorValue & normal);
72 
73  void clearStateMarkedElems();
74 
78  virtual bool update(Real time, NonlinearSystemBase & nl, AuxiliarySystem & aux);
79 
83  virtual void initSolution(NonlinearSystemBase & nl, AuxiliarySystem & aux);
84 
85  void buildEFAMesh();
86  bool markCuts(Real time);
87  bool markCutEdgesByGeometry(Real time);
88  bool markCutEdgesByState(Real time);
89  bool markCutFacesByGeometry(Real time);
90  bool markCutFacesByState();
91  bool initCutIntersectionEdge(
92  Point cut_origin, RealVectorValue cut_normal, Point & edge_p1, Point & edge_p2, Real & dist);
93  bool cutMeshWithEFA(NonlinearSystemBase & nl, AuxiliarySystem & aux);
94  Point getEFANodeCoords(EFANode * CEMnode,
95  EFAElement * CEMElem,
96  const Elem * elem,
97  MeshBase * displaced_mesh = NULL) const;
98 
102  Real getPhysicalVolumeFraction(const Elem * elem) const;
103 
107  Real getCutPlane(const Elem * elem,
108  const Xfem::XFEM_CUTPLANE_QUANTITY quantity,
109  unsigned int plane_id) const;
110 
111  bool isElemAtCrackTip(const Elem * elem) const;
112  bool isElemCut(const Elem * elem, XFEMCutElem *& xfce) const;
113  bool isElemCut(const Elem * elem) const;
114  void getFragmentFaces(const Elem * elem,
115  std::vector<std::vector<Point>> & frag_faces,
116  bool displaced_mesh = false) const;
117  void storeCrackTipOriginAndDirection();
118 
119  void correctCrackExtensionDirection(const Elem * elem,
120  EFAElement2D * CEMElem,
121  EFAEdge * orig_edge,
122  Point normal,
123  Point crack_tip_origin,
124  Point crack_tip_direction,
125  Real & distance_keep,
126  unsigned int & edge_id_keep,
127  Point & normal_keep);
128 
129  void getCrackTipOrigin(std::map<unsigned int, const Elem *> & elem_id_crack_tip,
130  std::vector<Point> & crack_front_points);
131  // void update_crack_propagation_direction(const Elem* elem, Point direction);
132  // void clear_crack_propagation_direction();
136  std::vector<Real> & getXFEMCutData();
137  void setXFEMCutData(std::vector<Real> & cut_data);
138  std::string & getXFEMCutType();
139  void setXFEMCutType(std::string & cut_type);
140  Xfem::XFEM_QRULE & getXFEMQRule();
141  void setXFEMQRule(std::string & xfem_qrule);
142  void setCrackGrowthMethod(bool use_crack_growth_increment, Real crack_growth_increment);
143  virtual bool getXFEMWeights(MooseArray<Real> & weights,
144  const Elem * elem,
145  QBase * qrule,
146  const MooseArray<Point> & q_points);
147  virtual const ElementPairLocator::ElementPairList * getXFEMCutElemPairs() const
148  {
149  return &_sibling_elems;
150  }
151  virtual const ElementPairLocator::ElementPairList * getXFEMDisplacedCutElemPairs() const
152  {
153  return &_sibling_displaced_elems;
154  }
155  virtual void getXFEMIntersectionInfo(const Elem * elem,
156  unsigned int plane_id,
157  Point & normal,
158  std::vector<Point> & intersectionPoints,
159  bool displaced_mesh = false) const;
160  virtual void getXFEMqRuleOnLine(std::vector<Point> & intersection_points,
161  std::vector<Point> & quad_pts,
162  std::vector<Real> & quad_wts) const;
163  virtual void getXFEMqRuleOnSurface(std::vector<Point> & intersection_points,
164  std::vector<Point> & quad_pts,
165  std::vector<Real> & quad_wts) const;
166  bool has_secondary_cut() { return _has_secondary_cut; }
167 
168 private:
169  void getFragmentEdges(const Elem * elem,
170  EFAElement2D * CEMElem,
171  std::vector<std::vector<Point>> & frag_edges) const;
172  void getFragmentFaces(const Elem * elem,
173  EFAElement3D * CEMElem,
174  std::vector<std::vector<Point>> & frag_faces) const;
175 
176 private:
178 
180 
183 
184  std::vector<const GeometricCutUserObject *> _geometric_cuts;
185 
186  std::map<unique_id_type, XFEMCutElem *> _cut_elem_map;
187  std::set<const Elem *> _crack_tip_elems;
188  ElementPairLocator::ElementPairList _sibling_elems;
189  ElementPairLocator::ElementPairList _sibling_displaced_elems;
190 
191  std::map<const Elem *, std::vector<Point>> _elem_crack_origin_direction_map;
192 
193  // std::map<const Elem*, Point> _crack_propagation_direction_map;
194 
195  std::map<const Elem *, RealVectorValue> _state_marked_elems;
196  std::set<const Elem *> _state_marked_frags;
197  std::map<const Elem *, unsigned int> _state_marked_elem_sides;
198 
200 
208  std::map<unique_id_type, std::vector<Real>> _cached_solution;
209 
217  std::map<unique_id_type, std::vector<Real>> _cached_aux_solution;
218 
229  void storeSolutionForNode(const Node * node_to_store_to,
230  const Node * node_to_store_from,
231  SystemBase & sys,
232  std::map<unique_id_type, std::vector<Real>> & stored_solution,
233  const NumericVector<Number> & current_solution,
234  const NumericVector<Number> & old_solution,
235  const NumericVector<Number> & older_solution);
236 
247  void storeSolutionForElement(const Elem * elem_to_store_to,
248  const Elem * elem_to_store_from,
249  SystemBase & sys,
250  std::map<unique_id_type, std::vector<Real>> & stored_solution,
251  const NumericVector<Number> & current_solution,
252  const NumericVector<Number> & old_solution,
253  const NumericVector<Number> & older_solution);
254 
263  void setSolution(SystemBase & sys,
264  const std::map<unique_id_type, std::vector<Real>> & stored_solution,
265  NumericVector<Number> & current_solution,
266  NumericVector<Number> & old_solution,
267  NumericVector<Number> & older_solution);
268 
277  void setSolutionForDOFs(const std::vector<Real> & stored_solution,
278  const std::vector<dof_id_type> & stored_solution_dofs,
279  NumericVector<Number> & current_solution,
280  NumericVector<Number> & old_solution,
281  NumericVector<Number> & older_solution);
282 
289  std::vector<dof_id_type> getElementSolutionDofs(const Elem * elem, SystemBase & sys) const;
290 
297  std::vector<dof_id_type> getNodeSolutionDofs(const Node * node, SystemBase & sys) const;
298 };
299 
300 #endif // XFEM_H
bool _use_crack_growth_increment
Definition: XFEM.h:181
XFEM_QRULE
Definition: XFEM.h:36
ElementPairLocator::ElementPairList _sibling_elems
Definition: XFEM.h:188
std::vector< const GeometricCutUserObject * > _geometric_cuts
Definition: XFEM.h:184
Real _crack_growth_increment
Definition: XFEM.h:182
std::map< unique_id_type, XFEMCutElem * > _cut_elem_map
Definition: XFEM.h:186
std::set< const Elem * > _crack_tip_elems
Definition: XFEM.h:187
ElementFragmentAlgorithm _efa_mesh
Definition: XFEM.h:199
virtual const ElementPairLocator::ElementPairList * getXFEMDisplacedCutElemPairs() const
Definition: XFEM.h:151
This is the XFEM class.
Definition: XFEM.h:60
bool _has_secondary_cut
Definition: XFEM.h:177
std::map< unique_id_type, std::vector< Real > > _cached_aux_solution
Data structure to store the auxiliary solution for nodes/elements affected by XFEM For each node/elem...
Definition: XFEM.h:217
Definition: XFEM.h:24
virtual const ElementPairLocator::ElementPairList * getXFEMCutElemPairs() const
Definition: XFEM.h:147
Xfem::XFEM_QRULE _XFEM_qrule
Definition: XFEM.h:179
std::map< const Elem *, std::vector< Point > > _elem_crack_origin_direction_map
Definition: XFEM.h:191
XFEM_CUTPLANE_QUANTITY
Definition: XFEM.h:26
std::set< const Elem * > _state_marked_frags
Definition: XFEM.h:196
bool has_secondary_cut()
Definition: XFEM.h:166
ElementPairLocator::ElementPairList _sibling_displaced_elems
Definition: XFEM.h:189
std::map< unique_id_type, std::vector< Real > > _cached_solution
Data structure to store the nonlinear solution for nodes/elements affected by XFEM For each node/elem...
Definition: XFEM.h:208
std::map< const Elem *, unsigned int > _state_marked_elem_sides
Definition: XFEM.h:197
std::map< const Elem *, RealVectorValue > _state_marked_elems
Definition: XFEM.h:195