https://mooseframework.inl.gov
Loading...
Searching...
No Matches
DomainIntegralQFunction.C
Go to the documentation of this file.
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
11
13
16{
18 params.addClassDescription("Computes the q-function for a segment along the crack front, used in "
19 "the calculation of the J-integral");
20 params.addRequiredParam<Real>("j_integral_radius_inner", "Radius for J-Integral calculation");
21 params.addRequiredParam<Real>("j_integral_radius_outer", "Radius for J-Integral calculation");
22 params.addRequiredParam<UserObjectName>("crack_front_definition",
23 "The CrackFrontDefinition user object name");
24 params.addParam<unsigned int>(
25 "crack_front_point_index",
26 "The index of the point on the crack front corresponding to this q function");
27 params.set<bool>("use_displaced_mesh") = false;
28 return params;
29}
30
32 : AuxKernel(parameters),
33 _j_integral_radius_inner(getParam<Real>("j_integral_radius_inner")),
34 _j_integral_radius_outer(getParam<Real>("j_integral_radius_outer")),
35 _crack_front_definition(&getUserObject<CrackFrontDefinition>("crack_front_definition")),
36 _has_crack_front_point_index(isParamValid("crack_front_point_index")),
37 _crack_front_point_index(
38 _has_crack_front_point_index ? getParam<unsigned int>("crack_front_point_index") : 0),
39 _treat_as_2d(false),
40 _is_point_on_intersecting_boundary(false)
41{
42}
43
44void
46{
48 bool using_mesh_cutter = _crack_front_definition->usingMeshCutter();
49 if (_treat_as_2d && using_mesh_cutter == false)
50 {
52 {
54 "crack_front_point_index ignored because CrackFrontDefinition is set to treat as 2D");
55 }
56 }
57 else
58 {
60 {
61 mooseError("crack_front_point_index must be specified in DomainIntegralQFunction");
62 }
63 }
66}
67
68Real
70{
71 Real dist_to_crack_front;
72 Real dist_along_tangent;
73 projectToFrontAtPoint(dist_to_crack_front, dist_along_tangent);
74
75 Real q = 1.0;
76 if (dist_to_crack_front > _j_integral_radius_inner &&
77 dist_to_crack_front < _j_integral_radius_outer)
78 q = (_j_integral_radius_outer - dist_to_crack_front) /
80 else if (dist_to_crack_front >= _j_integral_radius_outer)
81 q = 0.0;
82
83 if (q > 0.0)
84 {
85 Real tangent_multiplier = 1.0;
86 if (!_treat_as_2d)
87 {
88 const Real forward_segment_length =
90 const Real backward_segment_length =
92
93 if (dist_along_tangent >= 0.0)
94 {
95 if (forward_segment_length > 0.0)
96 tangent_multiplier = 1.0 - dist_along_tangent / forward_segment_length;
97 }
98 else
99 {
100 if (backward_segment_length > 0.0)
101 tangent_multiplier = 1.0 + dist_along_tangent / backward_segment_length;
102 }
103 }
104
105 tangent_multiplier = std::max(tangent_multiplier, 0.0);
106 tangent_multiplier = std::min(tangent_multiplier, 1.0);
107
108 // Set to zero if a node is on a designated free surface and its crack front node is not.
111 tangent_multiplier = 0.0;
112
113 q *= tangent_multiplier;
114 }
115
116 return q;
117}
118
119void
120DomainIntegralQFunction::projectToFrontAtPoint(Real & dist_to_front, Real & dist_along_tangent)
121{
122 const Point * crack_front_point =
124
125 Point p = *_current_node;
126 const RealVectorValue & crack_front_tangent =
128
129 RealVectorValue crack_node_to_current_node = p - *crack_front_point;
130 dist_along_tangent = crack_node_to_current_node * crack_front_tangent;
131 RealVectorValue projection_point = *crack_front_point + dist_along_tangent * crack_front_tangent;
132 RealVectorValue axis_to_current_node = p - projection_point;
133 dist_to_front = axis_to_current_node.norm();
134}
registerMooseObject("SolidMechanicsApp", DomainIntegralQFunction)
const Real p
void ErrorVector unsigned int
const Node *const & _current_node
static InputParameters validParams()
Class used in fracture integrals to define geometric characteristics of the crack front.
const Point * getCrackFrontPoint(const std::size_t point_index) const
Get a Point object for a specified point on the crack front.
Real getCrackFrontBackwardSegmentLength(const std::size_t point_index) const
Get the length of the line segment on the crack front behind the specified position.
bool treatAs2D() const
Whether the fracture computations are treated as 2D for the model.
Real getCrackFrontForwardSegmentLength(const std::size_t point_index) const
Get the length of the line segment on the crack front ahead of the specified position.
bool usingMeshCutter() const
Is the crack defined by a mesh cutter object.
bool isNodeOnIntersectingBoundary(const Node *const node) const
Determine whether a given node is on one of the boundaries that intersects an end of the crack front.
const RealVectorValue & getCrackFrontTangent(const std::size_t point_index) const
Get the vector tangent to the crack front at a specified position.
bool isPointWithIndexOnIntersectingBoundary(const std::size_t point_index) const
Determine whether a given crack front point is on one of the boundaries that intersects an end of the...
Coupled auxiliary value.
static InputParameters validParams()
const unsigned int _crack_front_point_index
void projectToFrontAtPoint(Real &dist_to_front, Real &dist_along_tangent)
DomainIntegralQFunction(const InputParameters &parameters)
Factory constructor, takes parameters so that all derived classes can be built using the same constru...
const CrackFrontDefinition *const _crack_front_definition
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
void mooseError(Args &&... args) const
void mooseWarning(Args &&... args) const