https://mooseframework.inl.gov
ComputeCrackedStress.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 
10 #include "ComputeCrackedStress.h"
11 
12 registerMooseObject("SolidMechanicsApp", ComputeCrackedStress);
13 
16 {
18  params.addClassDescription("Computes energy and modifies the stress for phase field fracture");
19  params.addRequiredCoupledVar("c", "Order parameter for damage");
20  params.addParam<Real>("kdamage", 1e-9, "Stiffness of damaged matrix");
21  params.addParam<bool>("finite_strain_model", false, "The model is using finite strain");
22  params.addParam<bool>(
23  "use_current_history_variable", false, "Use the current value of the history variable.");
24  params.addParam<MaterialPropertyName>(
25  "F_name", "E_el", "Name of material property storing the elastic energy");
26  params.addParam<MaterialPropertyName>(
27  "kappa_name",
28  "kappa_op",
29  "Name of material property being created to store the interfacial parameter kappa");
30  params.addParam<MaterialPropertyName>(
31  "mobility_name", "L", "Name of material property being created to store the mobility L");
32  params.addParam<std::string>("base_name", "The base name used to save the cracked stress");
33  params.addRequiredParam<std::string>("uncracked_base_name",
34  "The base name used to calculate the original stress");
35  return params;
36 }
37 
40  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
41  _uncracked_base_name(getParam<std::string>("uncracked_base_name") + "_"),
42  _finite_strain_model(getParam<bool>("finite_strain_model")),
43  _use_current_hist(getParam<bool>("use_current_history_variable")),
44  _strain(
45  _finite_strain_model
46  ? getMaterialPropertyByName<RankTwoTensor>(_uncracked_base_name + "elastic_strain")
47  : getMaterialPropertyByName<RankTwoTensor>(_uncracked_base_name + "mechanical_strain")),
48  _uncracked_stress(getMaterialPropertyByName<RankTwoTensor>(_uncracked_base_name + "stress")),
49  _uncracked_Jacobian_mult(
50  getMaterialPropertyByName<RankFourTensor>(_uncracked_base_name + "Jacobian_mult")),
51  _c(coupledValue("c")),
52  _gc_prop(getMaterialProperty<Real>("gc_prop")),
53  _l(getMaterialProperty<Real>("l")),
54  _visco(getMaterialProperty<Real>("visco")),
55  _kdamage(getParam<Real>("kdamage")),
56  _stress(declareProperty<RankTwoTensor>(_base_name + "stress")),
57  _F(declareProperty<Real>(getParam<MaterialPropertyName>("F_name"))),
58  _dFdc(declarePropertyDerivative<Real>(getParam<MaterialPropertyName>("F_name"),
59  coupledName("c", 0))),
60  _d2Fdc2(declarePropertyDerivative<Real>(
61  getParam<MaterialPropertyName>("F_name"), coupledName("c", 0), coupledName("c", 0))),
62  _d2Fdcdstrain(declareProperty<RankTwoTensor>("d2Fdcdstrain")),
63  _dstress_dc(declarePropertyDerivative<RankTwoTensor>("stress", coupledName("c", 0))),
64  _hist(declareProperty<Real>("hist")),
65  _hist_old(getMaterialPropertyOld<Real>("hist")),
66  _Jacobian_mult(declareProperty<RankFourTensor>(_base_name + "Jacobian_mult")),
67  _kappa(declareProperty<Real>(getParam<MaterialPropertyName>("kappa_name"))),
68  _L(declareProperty<Real>(getParam<MaterialPropertyName>("mobility_name")))
69 {
70 }
71 
72 void
74 {
75  _stress[_qp].zero();
76  _hist[_qp] = 0.0;
77 }
78 
79 void
81 {
82  const Real c = _c[_qp];
83 
84  // Zero out values when c > 1
85  Real cfactor = 1.0;
86  if (c > 1.0)
87  cfactor = 0.0;
88 
89  // Create the positive and negative projection tensors
91  std::vector<Real> eigval;
92  RankTwoTensor eigvec;
93  RankFourTensor Ppos = _uncracked_stress[_qp].positiveProjectionEigenDecomposition(eigval, eigvec);
94  RankFourTensor Pneg = I4sym - Ppos;
95 
96  // Project the positive and negative stresses
97  RankTwoTensor stress0pos = Ppos * _uncracked_stress[_qp];
98  RankTwoTensor stress0neg = Pneg * _uncracked_stress[_qp];
99 
100  // Compute the positive and negative elastic energies
101  Real G0_pos = (stress0pos).doubleContraction(_strain[_qp]) / 2.0;
102  Real G0_neg = (stress0neg).doubleContraction(_strain[_qp]) / 2.0;
103 
104  // Update the history variable
105  if (G0_pos > _hist_old[_qp])
106  _hist[_qp] = G0_pos;
107  else
108  _hist[_qp] = _hist_old[_qp];
109 
110  Real hist_variable = _hist_old[_qp];
111  if (_use_current_hist)
112  hist_variable = _hist[_qp];
113 
114  // Compute degredation function and derivatives
115  Real h = cfactor * (1.0 - c) * (1.0 - c) * (1.0 - _kdamage) + _kdamage;
116  Real dhdc = -2.0 * cfactor * (1.0 - c) * (1.0 - _kdamage);
117  Real d2hdc2 = 2.0 * cfactor * (1.0 - _kdamage);
118 
119  // Compute stress and its derivatives
120  _stress[_qp] = (Ppos * h + Pneg) * _uncracked_stress[_qp];
121  _dstress_dc[_qp] = stress0pos * dhdc;
122  _Jacobian_mult[_qp] = (Ppos * h + Pneg) * _uncracked_Jacobian_mult[_qp];
123 
124  // Compute energy and its derivatives
125  _F[_qp] = hist_variable * h - G0_neg + _gc_prop[_qp] * c * c / (2 * _l[_qp]);
126  _dFdc[_qp] = hist_variable * dhdc + _gc_prop[_qp] * c / _l[_qp];
127  _d2Fdc2[_qp] = hist_variable * d2hdc2 + _gc_prop[_qp] / _l[_qp];
128 
129  // 2nd derivative wrt c and strain = 0.0 if we used the previous step's history varible
130  if (_use_current_hist)
131  _d2Fdcdstrain[_qp] = stress0pos * dhdc;
132 
133  // Assign L and kappa
134  _kappa[_qp] = _gc_prop[_qp] * _l[_qp];
135  _L[_qp] = 1.0 / (_gc_prop[_qp] * _visco[_qp]);
136 }
const MaterialProperty< Real > & _hist_old
const VariableValue & _c
Variable defining the phase field damage parameter.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
MaterialProperty< Real > & _kappa
Property where the value for kappa will be defined.
const MaterialProperty< RankTwoTensor > & _strain
Mechanical_strain if finite_strain_model = false, otherwise elastic_strain.
MaterialProperty< Real > & _hist
history variable storing the maximum positive deformation energy
Computes energy and modifies the stress for phase field fracture.
void addRequiredParam(const std::string &name, const std::string &doc_string)
bool _use_current_hist
Use current value of history variable.
const MaterialProperty< Real > & _visco
const MaterialProperty< RankTwoTensor > & _uncracked_stress
Uncracked stress calculated by another material.
static InputParameters validParams()
virtual void initQpStatefulProperties()
const MaterialProperty< RankFourTensor > & _uncracked_Jacobian_mult
Uncracked Jacobian_mult calculated by another material.
const MaterialProperty< Real > & _l
Characteristic length, controls damage zone thickness.
MaterialProperty< Real > & _dFdc
MaterialProperty< Real > & _F
const MaterialProperty< Real > & _gc_prop
Critical energy release rate for fracture.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
registerMooseObject("SolidMechanicsApp", ComputeCrackedStress)
ComputeCrackedStress(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void computeQpProperties()
MaterialProperty< RankTwoTensor > & _stress
Stress being computed by this kernel.
void addClassDescription(const std::string &doc_string)
MaterialProperty< RankTwoTensor > & _dstress_dc
MaterialProperty< Real > & _L
Property where the value for L will be defined.
MaterialProperty< RankFourTensor > & _Jacobian_mult
derivative of stress w.r.t. strain (_dstress_dstrain)
MaterialProperty< RankTwoTensor > & _d2Fdcdstrain
Real _kdamage
Small number to avoid non-positive definiteness at or near complete damage.
MaterialProperty< Real > & _d2Fdc2