https://mooseframework.inl.gov
ParisLaw.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 "ParisLaw.h"
11 
12 // MOOSE includes
13 #include "Function.h"
14 #include "MooseMesh.h"
15 #include "MooseVariable.h"
16 #include "SubProblem.h"
17 
18 #include "libmesh/system.h"
19 
20 registerMooseObject("XFEMApp", ParisLaw);
21 
24 {
26  params.addClassDescription("Computes the crack extension size at all active crack front points.");
27  params.addRequiredParam<Real>(
28  "max_growth_size",
29  "the max growth size at the crack front in each increment of a fatigue simulation");
30  params.addRequiredParam<Real>("paris_law_c", "parameter C in the Paris law for fatigue");
31  params.addRequiredParam<Real>("paris_law_m", "parameter m in the Paris law for fatigue");
32  return params;
33 }
34 
36  : GeneralPostprocessor(parameters),
37  _cutter(&_fe_problem.getUserObject<CrackMeshCut3DUserObject>("cut_mesh")),
38  _max_growth_size(getParam<Real>("max_growth_size")),
39  _paris_law_c(getParam<Real>("paris_law_c")),
40  _paris_law_m(getParam<Real>("paris_law_m"))
41 {
42 }
43 
44 void
46 {
47 }
48 
49 void
51 {
52  // Generate _active_boundary and _inactive_boundary_pos;
53  // This is a duplicated call before the one in CrackMeshCut3DUserObject;
54  // That one cannot be deleted because this one is for subcritical cracking only.
56 
57  std::vector<int> index = _cutter->getFrontPointsIndex();
58 
59  const VectorPostprocessorValue & k1 = getVectorPostprocessorValueByName("II_KI_1", "II_KI_1");
60  const VectorPostprocessorValue & k2 = getVectorPostprocessorValueByName("II_KII_1", "II_KII_1");
61  mooseAssert(k1.size() == k2.size(), "KI and KII VPPs should have the same size");
62  unsigned int size_this_segment = k1.size();
63 
64  _effective_k.clear();
65 
66  for (unsigned int i = 0; i < size_this_segment; ++i)
67  {
68  int ind = index[i];
69  if (ind == -1)
70  _effective_k.push_back(0.0);
71  else if (ind >= 0)
72  {
73  Real effective_k = sqrt(pow(k1[ind], 2) + 2 * pow(k2[ind], 2));
74  _effective_k.push_back(effective_k);
75  }
76  else
77  mooseError("index must be either -1 (inactive) or >= 0 (active)");
78  }
79 
80  Real _max_k = *std::max_element(_effective_k.begin(), _effective_k.end());
81 
82  // Calculate dN
83  _dn = (unsigned long int)(_max_growth_size / (_paris_law_c * pow(_max_k, _paris_law_m)));
84 
85  _growth_size.clear();
86 
87  for (unsigned int i = 0; i < size_this_segment; ++i)
88  {
89  int ind = index[i];
90  if (ind == -1)
91  _growth_size.push_back(0.0);
92  else if (ind >= 0)
93  {
94  Real effective_k = _effective_k[i];
95  Real growth_size = _max_growth_size * pow(effective_k / _max_k, _paris_law_m);
96  _growth_size.push_back(growth_size);
97  }
98  }
99 
101 }
102 
103 Real
105 {
106  return Real(_dn);
107 }
CrackMeshCut3DUserObject: (1) reads in a mesh describing the crack surface, (2) uses the mesh to do i...
unsigned long int _dn
Number of cycles for this growth increament.
Definition: ParisLaw.h:31
const Real _paris_law_c
Paris law parameters.
Definition: ParisLaw.h:35
std::vector< int > getFrontPointsIndex()
Get crack front points in the active segment -1 means inactive; positive is the point&#39;s index in the ...
void findActiveBoundaryNodes()
Find all active boundary nodes in the cutter mesh Find boundary nodes that will grow; nodes outside o...
void setSubCriticalGrowthSize(std::vector< Real > &growth_size)
Return growth size at the active boundary to the mesh cutter.
void addRequiredParam(const std::string &name, const std::string &doc_string)
ParisLaw(const InputParameters &parameters)
Definition: ParisLaw.C:35
virtual void initialize() override
Definition: ParisLaw.C:45
std::vector< Real > _growth_size
Growth length for active cutter nodes.
Definition: ParisLaw.h:40
static InputParameters validParams()
const Real _paris_law_m
Definition: ParisLaw.h:36
std::vector< Real > _effective_k
Effective K for active cutter nodes.
Definition: ParisLaw.h:38
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
const Real _max_growth_size
Length of crack growth at the point with largest K.
Definition: ParisLaw.h:33
virtual Real getValue() const override
Definition: ParisLaw.C:104
std::vector< Real > VectorPostprocessorValue
Real _max_k
Maximum effective K.
Definition: ParisLaw.h:42
static InputParameters validParams()
Definition: ParisLaw.C:23
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObject("XFEMApp", ParisLaw)
virtual void execute() override
Definition: ParisLaw.C:50
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const VectorPostprocessorValue & getVectorPostprocessorValueByName(const VectorPostprocessorName &name, const std::string &vector_name) const
void ErrorVector unsigned int
CrackMeshCut3DUserObject * _cutter
Cutter mesh.
Definition: ParisLaw.h:29