12#include "libmesh/quadrature.h"
25 "Mark elements to be cut by XFEM based on a scalar extracted from a RankTwoTensor");
29 "Scalar quantity to be computed from tensor and used as a failure criterion");
33 "average",
"Should the tensor quantity be averaged over the quadrature points?");
37 "Start point for axis used to calculate some cylindrical material tensor quantities");
41 "End point for axis used to calculate some cylindrical material tensor quantities");
48 _tensor(getMaterialProperty<
RankTwoTensor>(getParam<
std::string>(
"tensor"))),
49 _scalar_type(getParam<
MooseEnum>(
"scalar_type")),
50 _point1(parameters.get<Point>(
"point1")),
51 _point2(parameters.get<Point>(
"point2")),
52 _threshold(coupledValue(
"threshold")),
53 _average(getParam<bool>(
"average")),
54 _JxW(_assembly.JxW()),
55 _coord(_assembly.coordTransformation())
62 bool does_it_crack =
false;
63 unsigned int numqp =
_qrule->n_points();
68 Real average_threshold = 0.0;
71 for (
unsigned int qp = 0; qp < numqp; ++qp)
74 mooseError(
"Threshold must be strictly positive in XFEMRankTwoTensorMarkerUserObject");
82 if (point_dir.absolute_fuzzy_equals(zero))
83 mooseError(
"Direction has zero length in XFEMRankTwoTensorMarkerUserObject");
84 direction = point_dir;
85 if (tensor_quantity > average_threshold)
90 unsigned int max_index = std::numeric_limits<unsigned int>::max();
92 std::vector<Point> directions(numqp);
93 for (
unsigned int qp = 0; qp < numqp; ++qp)
96 mooseError(
"Threshold must be strictly positive in XFEMRankTwoTensorMarkerUserObject");
99 if (directions[qp].absolute_fuzzy_equals(zero))
100 mooseError(
"Direction has zero length in XFEMRankTwoTensorMarkerUserObject");
101 Real ratio = tensor_quantity /
_threshold[qp];
102 if (ratio > max_ratio)
110 if (max_index == std::numeric_limits<unsigned int>::max())
111 mooseError(
"max_index out of bounds in XFEMRankTwoTensorMarkerUserObject");
112 does_it_crack =
true;
113 direction = directions[max_index];
117 return does_it_crack;
registerMooseObject("XFEMApp", XFEMRankTwoTensorMarkerUserObject)
const QBase *const & _qrule
const MooseArray< Point > & _q_point
void mooseError(Args &&... args) const
static InputParameters validParams()
Factory constructor, takes parameters so that all derived classes can be built using the same constru...
const VariableValue & _threshold
Threshold value of the scalar.
const MooseArray< Real > & _JxW
Transformed Jacobian weights.
const Point _point1
Points used to define an axis of rotation for some scalar quantities.
XFEMRankTwoTensorMarkerUserObject(const InputParameters ¶meters)
const MooseArray< Real > & _coord
bool _average
Whether to average the value for all quadrature points in an element.
MooseEnum _scalar_type
The type of scalar to be extracted from the tensor.
const MaterialProperty< RankTwoTensor > & _tensor
The tensor from which the scalar quantity used as a marking criterion is extracted.
static InputParameters validParams()
virtual bool doesElementCrack(RealVectorValue &direction) override
Determine whether the current element should be cut by a new crack.