12 #include "libmesh/quadrature.h"
13 #include "RankTwoTensor.h"
25 params.addClassDescription(
26 "Mark elements to be cut by XFEM based on a scalar extracted from a RankTwoTensor");
27 params.addParam<MooseEnum>(
30 "Scalar quantity to be computed from tensor and used as a failure criterion");
31 params.addRequiredParam<std::string>(
"tensor",
"The material tensor name.");
32 params.addRequiredCoupledVar(
"threshold",
"The threshold for crack growth.");
33 params.addRequiredParam<
bool>(
34 "average",
"Should the tensor quantity be averaged over the quadrature points?");
35 params.addParam<Point>(
38 "Start point for axis used to calculate some cylindrical material tensor quantities");
39 params.addParam<Point>(
42 "End point for axis used to calculate some cylindrical material tensor quantities");
47 const InputParameters & parameters)
49 _tensor(getMaterialProperty<
RankTwoTensor>(getParam<std::string>(
"tensor"))),
50 _scalar_type(getParam<MooseEnum>(
"scalar_type")),
51 _point1(parameters.get<Point>(
"point1")),
52 _point2(parameters.get<Point>(
"point2")),
53 _threshold(coupledValue(
"threshold")),
54 _average(getParam<bool>(
"average")),
55 _JxW(_assembly.JxW()),
56 _coord(_assembly.coordTransformation())
63 bool does_it_crack =
false;
64 unsigned int numqp = _qrule->n_points();
69 Real average_threshold = 0.0;
72 for (
unsigned int qp = 0; qp < numqp; ++qp)
75 mooseError(
"Threshold must be strictly positive in XFEMRankTwoTensorMarkerUserObject");
78 average_point +=
_JxW[qp] *
_coord[qp] * _q_point[qp];
83 if (point_dir.absolute_fuzzy_equals(zero))
84 mooseError(
"Direction has zero length in XFEMRankTwoTensorMarkerUserObject");
85 direction = point_dir;
86 if (tensor_quantity > average_threshold)
91 unsigned int max_index = std::numeric_limits<unsigned int>::max();
93 std::vector<Point> directions(numqp);
94 for (
unsigned int qp = 0; qp < numqp; ++qp)
97 mooseError(
"Threshold must be strictly positive in XFEMRankTwoTensorMarkerUserObject");
100 if (directions[qp].absolute_fuzzy_equals(zero))
101 mooseError(
"Direction has zero length in XFEMRankTwoTensorMarkerUserObject");
102 Real ratio = tensor_quantity /
_threshold[qp];
103 if (ratio > max_ratio)
111 if (max_index == std::numeric_limits<unsigned int>::max())
112 mooseError(
"max_index out of bounds in XFEMRankTwoTensorMarkerUserObject");
113 does_it_crack =
true;
114 direction = directions[max_index];
118 return does_it_crack;