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();
93 for (
unsigned int qp = 0; qp < numqp; ++qp)
96 mooseError(
"Threshold must be strictly positive in XFEMRankTwoTensorMarkerUserObject");
100 mooseError(
"Direction has zero length in XFEMRankTwoTensorMarkerUserObject");
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;
117 return does_it_crack;
static InputParameters validParams()
Factory constructor, takes parameters so that all derived classes can be built using the same constru...
const MooseArray< Point > & _q_point
const MaterialProperty< RankTwoTensor > & _tensor
The tensor from which the scalar quantity used as a marking criterion is extracted.
const Point _point1
Points used to define an axis of rotation for some scalar quantities.
const VariableValue & _threshold
Threshold value of the scalar.
const MooseArray< Real > & _coord
virtual bool doesElementCrack(RealVectorValue &direction) override
Determine whether the current element should be cut by a new crack.
static InputParameters validParams()
XFEMRankTwoTensorMarkerUserObject(const InputParameters ¶meters)
MooseEnum _scalar_type
The type of scalar to be extracted from the tensor.
static const std::string directions[3]
registerMooseObject("XFEMApp", XFEMRankTwoTensorMarkerUserObject)
bool absolute_fuzzy_equals(const T &var1, const T2 &var2, const Real tol=TOLERANCE *TOLERANCE)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const QBase *const & _qrule
void mooseError(Args &&... args) const
const MooseArray< Real > & _JxW
Transformed Jacobian weights.
const Elem & get(const ElemType type_in)
bool _average
Whether to average the value for all quadrature points in an element.