Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : #include "ElementUserObject.h" 13 : 14 : class XFEM; 15 : 16 : class MeshCut2DNucleationBase : public ElementUserObject 17 : { 18 : public: 19 : static InputParameters validParams(); 20 : 21 : MeshCut2DNucleationBase(const InputParameters & parameters); 22 : 23 : virtual void initialize() override; 24 : virtual void execute() override; 25 : virtual void threadJoin(const UserObject & y) override; 26 : virtual void finalize() override; 27 : /** 28 : * Provide getter to MeshCut2DUserObjectBase for a map of nucleated cracks 29 : * @return map with key for element id and value is a pair containing the node points for creating 30 : * a nucleated element on the xfem cutter mesh. 31 : */ 32 : std::map<unsigned int, std::pair<RealVectorValue, RealVectorValue>> getNucleatedElemsMap() const 33 : { 34 : return _nucleated_elems; 35 : } 36 : /** 37 : * Provide getter to MeshCut2DUserObjectBase for member data set in input 38 : * @return nucleation radius member variable set from input file 39 : */ 40 180 : Real getNucleationRadius() const { return _nucleation_radius; } 41 : 42 : protected: 43 : /** 44 : * Determine whether the current element should be cut by a new crack. 45 : * @param cutterElemNodes nodes of line segment that will be used to create the cutter mesh 46 : * @return bool true if element cracks 47 : */ 48 : virtual bool doesElementCrack(std::pair<RealVectorValue, RealVectorValue> & cutterElemNodes) = 0; 49 : 50 : private: 51 : /// The FE solution mesh 52 : MooseMesh & _mesh; 53 : // New cracks can only be nucleated if they are at least this far from another crack 54 : Real _nucleation_radius; 55 : /// shared pointer to XFEM 56 : std::shared_ptr<XFEM> _xfem; 57 : // Boundaries where cracks can nucleate 58 : std::vector<BoundaryID> _initiation_boundary_ids; 59 : // map with key for element id and value is a pair containing the node points for creating a 60 : // nucleated element on the xfem cutter mesh. 61 : std::map<unsigned int, std::pair<RealVectorValue, RealVectorValue>> _nucleated_elems; 62 : };