https://mooseframework.inl.gov
MixedModeEquivalentK.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 "MixedModeEquivalentK.h"
11 
12 registerMooseObject("SolidMechanicsApp", MixedModeEquivalentK);
13 
16 {
18  params.addClassDescription("Computes the mixed-mode stress intensity factor "
19  "given the $K_I$, $K_{II}$, and $K_{III}$ stress "
20  "intensity factors");
21  params.addParam<unsigned int>("ring_index", "Ring ID");
22  params.addRequiredParam<VectorPostprocessorName>(
23  "KI_vectorpostprocessor", "The name of the VectorPostprocessor that computes KI");
24  params.addRequiredParam<VectorPostprocessorName>(
25  "KII_vectorpostprocessor", "The name of the VectorPostprocessor that computes KII");
26  params.addRequiredParam<VectorPostprocessorName>(
27  "KIII_vectorpostprocessor", "The name of the VectorPostprocessor that computes KIII");
28  params.addRequiredParam<std::string>("KI_vector_name", "The name of the vector that contains KI");
29  params.addRequiredParam<std::string>("KII_vector_name",
30  "The name of the vector that contains KII");
31  params.addRequiredParam<std::string>("KIII_vector_name",
32  "The name of the vector that contains KIII");
33  params.addRequiredParam<Real>("poissons_ratio", "Poisson's ratio for the material.");
34  return params;
35 }
36 
38  : GeneralVectorPostprocessor(parameters),
39  _ki_vpp_name(getParam<VectorPostprocessorName>("KI_vectorpostprocessor")),
40  _kii_vpp_name(getParam<VectorPostprocessorName>("KII_vectorpostprocessor")),
41  _kiii_vpp_name(getParam<VectorPostprocessorName>("KIII_vectorpostprocessor")),
42  _ki_vector_name(getParam<std::string>("KI_vector_name")),
43  _kii_vector_name(getParam<std::string>("KII_vector_name")),
44  _kiii_vector_name(getParam<std::string>("KIII_vector_name")),
45  _ki_value(getVectorPostprocessorValue("KI_vectorpostprocessor", _ki_vector_name)),
46  _kii_value(getVectorPostprocessorValue("KII_vectorpostprocessor", _kii_vector_name)),
47  _kiii_value(getVectorPostprocessorValue("KIII_vectorpostprocessor", _kiii_vector_name)),
48  _x_value(getVectorPostprocessorValue("KI_vectorpostprocessor", "x")),
49  _y_value(getVectorPostprocessorValue("KI_vectorpostprocessor", "y")),
50  _z_value(getVectorPostprocessorValue("KI_vectorpostprocessor", "z")),
51  _position_value(getVectorPostprocessorValue("KI_vectorpostprocessor", "id")),
52  _poissons_ratio(getParam<Real>("poissons_ratio")),
53  _ring_index(getParam<unsigned int>("ring_index")),
54  _x(declareVector("x")),
55  _y(declareVector("y")),
56  _z(declareVector("z")),
57  _position(declareVector("id")),
58  _k_eq(declareVector("Keq_" + Moose::stringify(_ring_index)))
59 {
60 }
61 
62 void
64 {
65  const unsigned int num_pts = _x_value.size();
66 
67  _x.assign(num_pts, 0.0);
68  _y.assign(num_pts, 0.0);
69  _z.assign(num_pts, 0.0);
70  _position.assign(num_pts, 0.0);
71  _k_eq.assign(num_pts, 0.0);
72 }
73 
74 void
76 {
77  for (unsigned int i = 0; i < _k_eq.size(); ++i)
78  {
79  _x[i] = _x_value[i];
80  _y[i] = _y_value[i];
81  _z[i] = _z_value[i];
82  _position[i] = _position_value[i];
83  _k_eq[i] = std::sqrt(_ki_value[i] * _ki_value[i] + _kii_value[i] * _kii_value[i] +
84  1.0 / (1.0 - _poissons_ratio) * _kiii_value[i] * _kiii_value[i]);
85  }
86 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
VectorPostprocessorValue & _x
static InputParameters validParams()
registerMooseObject("SolidMechanicsApp", MixedModeEquivalentK)
void addRequiredParam(const std::string &name, const std::string &doc_string)
const VectorPostprocessorValue & _ki_value
const VectorPostprocessorValue & _x_value
const VectorPostprocessorValue & _z_value
static InputParameters validParams()
MixedModeEquivalentK(const InputParameters &parameters)
VectorPostprocessorValue & _y
VectorPostprocessorValue & _position
std::string stringify(const T &t)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VectorPostprocessorValue & _position_value
VectorPostprocessorValue & _k_eq
const VectorPostprocessorValue & _kiii_value
void addClassDescription(const std::string &doc_string)
VectorPostprocessorValue & _z
const VectorPostprocessorValue & _y_value
void ErrorVector unsigned int
const VectorPostprocessorValue & _kii_value