Skip to content

Commit

Permalink
Daniel helped me move the property name to the derived class. closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
lynnmunday committed Dec 31, 2024
1 parent 78c7bb5 commit 4512c85
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class CrackFrontNonlocalMaterialBase : public ElementVectorPostprocessor
public:
static InputParameters validParams();

CrackFrontNonlocalMaterialBase(const InputParameters & parameters);
CrackFrontNonlocalMaterialBase(const InputParameters & parameters,
const std::string & property_name);

virtual void initialSetup() override;
virtual void initialize() override;
Expand All @@ -32,6 +33,8 @@ class CrackFrontNonlocalMaterialBase : public ElementVectorPostprocessor
virtual void threadJoin(const UserObject & y) override;

protected:
/// Material property name from derived class
const std::string _property_name;
/** dimensions of the box in front of the crack tip that the stress is averaged over
* The box is centered in front of the crack tip
* _box_length distance box extends in front of the crack tip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include "RankTwoTensor.h"

/**
* Computes the average stress magnitude in the direction normal to the crack front at points provided by the
* crack_front_definition vectorpostprocessor.
* Computes the average stress magnitude in the direction normal to the crack front at points
* provided by the crack_front_definition vectorpostprocessor.
*/

class CrackFrontNonlocalStress : public CrackFrontNonlocalMaterialBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ CrackFrontNonlocalMaterialBase::validParams()
params.addRequiredParam<Real>("box_length", "Distance in front of crack front.");
params.addRequiredParam<Real>("box_height", "Distance normal to front of crack front.");
params.addParam<Real>("box_width", "Distance tangent to front of crack front.");
params.addRequiredParam<std::string>("material_name",
"Get name of material property to compute at crack front");
params.addParam<std::string>("base_name",
"Optional parameter that allows the user to define "
"multiple mechanics material systems on the same "
Expand All @@ -31,8 +29,10 @@ CrackFrontNonlocalMaterialBase::validParams()
return params;
}

CrackFrontNonlocalMaterialBase::CrackFrontNonlocalMaterialBase(const InputParameters & parameters)
CrackFrontNonlocalMaterialBase::CrackFrontNonlocalMaterialBase(const InputParameters & parameters,
const std::string & property_name)
: ElementVectorPostprocessor(parameters),
_property_name(property_name),
_box_length(getParam<Real>("box_length")),
_box_width(isParamValid("box_width") ? getParam<Real>("box_width") : 1),
_box_height(getParam<Real>("box_height")),
Expand All @@ -41,8 +41,8 @@ CrackFrontNonlocalMaterialBase::CrackFrontNonlocalMaterialBase(const InputParame
_y(declareVector("y")),
_z(declareVector("z")),
_position(declareVector("id")),
_avg_crack_tip_scalar(
declareVector("crack_tip_" + _base_name + getParam<std::string>("material_name")))
// get the property name instead of materialname
_avg_crack_tip_scalar(declareVector("crack_tip_" + _base_name + _property_name))
{
if (_mesh.dimension() == 3 && !isParamSetByUser("box_width"))
paramError("box_width", "Must define box_width in 3D problems.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@ CrackFrontNonlocalScalarMaterial::validParams()
InputParameters params = CrackFrontNonlocalMaterialBase::validParams();
params.addClassDescription("Computes the average material at points provided by the "
"crack_front_definition vectorpostprocessor.");
params.addRequiredParam<MaterialPropertyName>(
"property_name", "Get name of material property to compute at crack front");

return params;
}

CrackFrontNonlocalScalarMaterial::CrackFrontNonlocalScalarMaterial(const InputParameters & parameters)
: CrackFrontNonlocalMaterialBase(parameters),
_scalar(getMaterialProperty<Real>(_base_name + getParam<std::string>("material_name")))
CrackFrontNonlocalScalarMaterial::CrackFrontNonlocalScalarMaterial(
const InputParameters & parameters)
: CrackFrontNonlocalMaterialBase(parameters,
parameters.get<MaterialPropertyName>("property_name")),
_scalar(getMaterialProperty<Real>(_base_name + _property_name))
{
}

Real
CrackFrontNonlocalScalarMaterial::getQPCrackFrontScalar(const unsigned int qp,
const Point /*crack_face_normal*/) const
const Point /*crack_face_normal*/) const
{
return _scalar[qp];
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ CrackFrontNonlocalStress::validParams()
{
InputParameters params = CrackFrontNonlocalMaterialBase::validParams();
params.addClassDescription("Computes the average stress normal to the crack face.");
params.addRequiredParam<MaterialPropertyName>(
"stress_name", "Get name of stress tensor to compute at crack front");
return params;
}

CrackFrontNonlocalStress::CrackFrontNonlocalStress(const InputParameters & parameters)
: CrackFrontNonlocalMaterialBase(parameters),
_stress(getMaterialProperty<RankTwoTensor>(_base_name + getParam<std::string>("material_name")))
: CrackFrontNonlocalMaterialBase(parameters, parameters.get<MaterialPropertyName>("stress_name")),
_stress(getMaterialProperty<RankTwoTensor>(_base_name + _property_name))
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
[VectorPostprocessors]
[CrackFrontNonlocalStress]
type = CrackFrontNonlocalStress
material_name = stress
stress_name = stress
base_name = generic
crack_front_definition = crack
box_length = 0.1
Expand All @@ -54,7 +54,7 @@
[]
[CrackFrontNonlocalKcrit]
type = CrackFrontNonlocalScalarMaterial
material_name = kcrit
property_name = kcrit
base_name = scalar
crack_front_definition = crack
box_length = 0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The crack propagates if the failure criterion is met, given by:
K_c \le \sqrt{K^2_I+K^2_{II}}
\end{equation}

where $K_I$ and $K_{II}$ are the mode I and II stress intensity factors provided by the fracture integral and the material property $K_c$ is defined in the input file with a constant value for the entire domain using [!param](/UserObjects/MeshCut2DFractureUserObject/k_critical) or from a [CrackFrontNonlocalScalar.md] VectorPostprocessor that samples a material property at each crack front point and is specified by [!param](/UserObjects/MeshCut2DFractureUserObject/k_critical_vectorpostprocessor) and [!param](/UserObjects/MeshCut2DFractureUserObject/k_critical_vector_name). The crack growth direction is given by the direction that maximizes the crack-tip hoop stress, given by Equation 5 in [!cite](jiang2020). The growth increment is a user provided input given by [!param](/UserObjects/MeshCut2DFractureUserObject/growth_increment). The fracture integrals $K_I$ and $K_{II}$ are obtained from the [InteractionIntegral.md] vectorpostprocessor specified in the input file by [!param](/UserObjects/MeshCut2DFractureUserObject/ki_vectorpostprocessor) and [!param](/UserObjects/MeshCut2DFractureUserObject/kii_vectorpostprocessor). Defaults for [!param](/UserObjects/MeshCut2DFractureUserObject/ki_vectorpostprocessor) and [!param](/UserObjects/MeshCut2DFractureUserObject/kii_vectorpostprocessor) use the names produced by the [/DomainIntegralAction.md] which is the standard way to set-up the [InteractionIntegral.md].
where $K_I$ and $K_{II}$ are the mode I and II stress intensity factors provided by the fracture integral and the material property $K_c$ is defined in the input file with a constant value for the entire domain using [!param](/UserObjects/MeshCut2DFractureUserObject/k_critical) or from a [CrackFrontNonlocalScalarMaterial.md] VectorPostprocessor that samples a material property at each crack front point and is specified by [!param](/UserObjects/MeshCut2DFractureUserObject/k_critical_vectorpostprocessor) and [!param](/UserObjects/MeshCut2DFractureUserObject/k_critical_vector_name). The crack growth direction is given by the direction that maximizes the crack-tip hoop stress, given by Equation 5 in [!cite](jiang2020). The growth increment is a user provided input given by [!param](/UserObjects/MeshCut2DFractureUserObject/growth_increment). The fracture integrals $K_I$ and $K_{II}$ are obtained from the [InteractionIntegral.md] vectorpostprocessor specified in the input file by [!param](/UserObjects/MeshCut2DFractureUserObject/ki_vectorpostprocessor) and [!param](/UserObjects/MeshCut2DFractureUserObject/kii_vectorpostprocessor). Defaults for [!param](/UserObjects/MeshCut2DFractureUserObject/ki_vectorpostprocessor) and [!param](/UserObjects/MeshCut2DFractureUserObject/kii_vectorpostprocessor) use the names produced by the [/DomainIntegralAction.md] which is the standard way to set-up the [InteractionIntegral.md].

Near a free surface, the integration volumes of the rings used to compute the `InteractionIntegral` will intersect the surface, leading to a reduction in the fracture integral values. This can lead to cracks becoming unable to farther propagate as they approach free surfaces. For these cases, a maximum stress criterion computed using [CrackFrontNonlocalStress.md] vectorpostprocessor can be used for crack growth using an additional failure criterion given by:

Expand Down
13 changes: 6 additions & 7 deletions modules/xfem/src/userobjects/MeshCut2DFractureUserObject.C
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,12 @@ MeshCut2DFractureUserObject::findActiveBoundaryGrowth()
_original_and_current_front_node_ids.size());

if (_k_critical_vpp && ((_k_critical_vpp->size() != _original_and_current_front_node_ids.size())))
mooseError(
"k_critical_vectorpostprocessor must have the same number of crack front points as "
"CrackFrontDefinition.",
"\n k_critical_vectorpostprocessor size = ",
_k_critical_vpp->size(),
"\n cracktips in MeshCut2DFractureUserObject = ",
_original_and_current_front_node_ids.size());
mooseError("k_critical_vectorpostprocessor must have the same number of crack front points as "
"CrackFrontDefinition.",
"\n k_critical_vectorpostprocessor size = ",
_k_critical_vpp->size(),
"\n cracktips in MeshCut2DFractureUserObject = ",
_original_and_current_front_node_ids.size());

_active_front_node_growth_vectors.clear();
for (unsigned int i = 0; i < _original_and_current_front_node_ids.size(); ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
[CrackFrontNonlocalStress]
type = CrackFrontNonlocalStress
base_name = generic
material_name = stress
stress_name = stress
crack_front_definition = crack_tip
box_length = 0.1
box_height = 0.05
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[VectorPostprocessors]
[CrackFrontNonlocalStressVpp]
type = CrackFrontNonlocalStress
material_name = stress
stress_name = stress
crack_front_definition = crackFrontDefinition
box_length = 0.05
box_height = 0.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[VectorPostprocessors]
[CrackFrontNonlocalScalarVpp]
type = CrackFrontNonlocalScalarMaterial
material_name = k_crit_mat
property_name = k_crit_mat
crack_front_definition = crackFrontDefinition
box_length = 0.05
box_height = 0.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[VectorPostprocessors]
[CrackFrontNonlocalStressVpp]
type = CrackFrontNonlocalStress
material_name = stress
stress_name = stress
crack_front_definition = crackFrontDefinition
box_length = 0.05
box_height = 0.1
Expand Down
1 change: 1 addition & 0 deletions modules/xfem/test/tests/mesh_cut_2D_fracture/tests
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
input = 'edge_crack_2d_propagation.i kvpp_based_meshCut_uo.i'
cli_args = "UserObjects/cut_mesh2/k_critical=100"
expect_err = 'Fracture toughness cannot be specified by both k_critical and k_critical_vectorpostprocessor.'
detail = ' and produce an error when fracture toughness is specified by more than one input source.''
[]
[stress_check]
type = CSVDiff
Expand Down

0 comments on commit 4512c85

Please sign in to comment.