13 #include "libmesh/string_to_enum.h" 22 "level_set_var",
"The name of level set variable used to represent the interface");
25 "negative_id", 0,
"The CutSubdomainID corresponding to a non-positive signed distance");
27 "positive_id", 1,
"The CutSubdomainID corresponding to a positive signed distance");
33 _level_set_var_number(_subproblem
35 parameters.
get<VariableName>(
"level_set_var"),
39 _system(_subproblem.getSystem(getParam<VariableName>(
"level_set_var"))),
40 _solution(*_system.current_local_solution.
get()),
45 "LevelSetCutUserObject expects different CutSubdomainIDs for the " 46 "negative_id and the positive_id.");
51 std::vector<Xfem::CutEdge> & cut_edges,
52 std::vector<Xfem::CutNode> & )
const 54 bool cut_elem =
false;
56 unsigned int n_sides = elem->n_sides();
58 for (
unsigned int i = 0; i < n_sides; ++i)
60 std::unique_ptr<const Elem> curr_side = elem->side_ptr(i);
62 if (curr_side->type() !=
EDGE2)
63 mooseError(
"In LevelSetCutUserObject element side must be EDGE2, but type is: ",
65 " base element type is: ",
68 const Node * node1 = curr_side->node_ptr(0);
69 const Node * node2 = curr_side->node_ptr(1);
77 if (ls_node_1 * ls_node_2 < 0)
81 mycut.
_id1 = node1->id();
82 mycut.
_id2 = node2->id();
83 Real seg_int_frac = std::abs(ls_node_1) / std::abs(ls_node_1 - ls_node_2);
86 cut_edges.push_back(mycut);
95 std::vector<Xfem::CutFace> & cut_faces)
const 97 bool cut_elem =
false;
99 for (
unsigned int i = 0; i < elem->n_sides(); ++i)
101 std::unique_ptr<const Elem> curr_side = elem->side_ptr(i);
102 if (curr_side->dim() != 2)
103 mooseError(
"In LevelSetCutUserObject dimension of side must be 2, but it is ",
105 unsigned int n_edges = curr_side->n_sides();
107 std::vector<unsigned int> cut_edges;
108 std::vector<Real> cut_pos;
110 for (
unsigned int j = 0;
j < n_edges;
j++)
113 std::unique_ptr<const Elem> curr_edge = curr_side->side_ptr(
j);
114 if (curr_edge->type() !=
EDGE2)
115 mooseError(
"In LevelSetCutUserObject face edge must be EDGE2, but type is: ",
117 " base element type is: ",
120 const Node * node1 = curr_edge->node_ptr(0);
121 const Node * node2 = curr_edge->node_ptr(1);
129 if (ls_node_1 * ls_node_2 < 0)
131 Real seg_int_frac = std::abs(ls_node_1) / std::abs(ls_node_1 - ls_node_2);
132 cut_edges.push_back(
j);
133 cut_pos.push_back(seg_int_frac);
137 if (cut_edges.size() == 2)
146 cut_faces.push_back(mycut);
154 std::vector<Xfem::CutEdge> & )
const 161 std::vector<Xfem::CutFace> & )
const 163 mooseError(
"cutFragmentByGeometry not yet implemented for 3d level set cutting");
167 const std::vector<Point>
170 mooseError(
"getCrackFrontPoints() is not implemented for this object.");
173 const std::vector<RealVectorValue>
176 mooseError(
"getCrackPlaneNormals() is not implemented for this object.");
virtual const std::vector< Point > getCrackFrontPoints(unsigned int num_crack_front_points) const override
get a set of points along a crack front from a XFEM GeometricCutUserObject
const unsigned int _level_set_var_number
The variable number of the level set variable we using to define the cuts.
static InputParameters validParams()
Factory constructor, takes parameters so that all derived classes can be built using the same constru...
registerMooseObject("XFEMApp", LevelSetCutUserObject)
const NumericVector< Number > & _solution
The subproblem solution vector.
const System & _system
System reference.
virtual bool cutElementByGeometry(const Elem *elem, std::vector< Xfem::CutEdge > &cut_edges, std::vector< Xfem::CutNode > &cut_nodes) const override
std::vector< Real > _position
Fractional distance along the cut edges where the cut is located.
virtual const std::vector< RealVectorValue > getCrackPlaneNormals(unsigned int num_crack_front_points) const override
get a set of normal vectors along a crack front from a XFEM GeometricCutUserObject ...
Data structure defining a cut through a face.
unsigned int CutSubdomainID
const CutSubdomainID _negative_id
The ID for the negative side of the cut.
Data structure defining a cut on an element edge.
static InputParameters validParams()
virtual CutSubdomainID getCutSubdomainID(const Node *node) const override
If the levelset value is positive, return 1, otherwise return 0.
unsigned int _id1
ID of the first node on the edge.
virtual bool cutFragmentByGeometry(std::vector< std::vector< Point >> &frag_edges, std::vector< Xfem::CutEdge > &cut_edges) const override
std::string enum_to_string(const T e)
Real _distance
Fractional distance along the edge (from node 1 to 2) where the cut is located.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int _id2
ID of the second node on the edge.
void mooseError(Args &&... args) const
unsigned int _host_side_id
Local ID of this side in the host element.
LevelSetCutUserObject(const InputParameters ¶meters)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const CutSubdomainID _positive_id
The ID for the positive side of the cut.
const Elem & get(const ElemType type_in)
std::vector< unsigned int > _face_edge
IDs of all cut faces.
unsigned int _face_id
ID of the cut face.