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