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 "StressCorrosionCrackingExponential.h" 11 : #include "VectorPostprocessorInterface.h" 12 : 13 : registerMooseObject("XFEMApp", StressCorrosionCrackingExponential); 14 : 15 : InputParameters 16 8 : StressCorrosionCrackingExponential::validParams() 17 : { 18 8 : InputParameters params = CrackGrowthReporterBase::validParams(); 19 8 : params.addClassDescription( 20 : "This reporter computes the crack growth increment at all active crack front points " 21 : "in the CrackMeshCut3DUserObject for stress corrosion cracking fit to an exponential " 22 : "function. Crack growth rates computed by this reporter are stored in the same order as in " 23 : "the fracture integral VectorPostprocessors."); 24 : 25 16 : params.addRequiredRangeCheckedParam<Real>("k_low", 26 : "k_low>0", 27 : "Value of K_I below which the crack growth rate is " 28 : "constant and equal to the mid growth rate function " 29 : "evaluated with a K_I=k_low."); 30 16 : params.addRequiredRangeCheckedParam<Real>("k_high", 31 : "k_high>0", 32 : "Value of K_I above which the crack growth rate is " 33 : "constant and equal to the mid growth rate function " 34 : "evaluated with a K_I=k_high."); 35 16 : params.addRequiredParam<Real>("growth_rate_mid_multiplier", 36 : "Growth rate multiplier when K_I is between k_low and k_high"); 37 16 : params.addRequiredParam<Real>("growth_rate_mid_exp_factor", "Growth rate exponential factor"); 38 : 39 16 : params.addParam<ReporterValueName>( 40 : "growth_increment_name", 41 : "growth_increment", 42 : "ReporterValueName for storing computed growth increments for the crack front points."); 43 16 : params.addParam<ReporterValueName>( 44 : "time_to_max_growth_increment_name", 45 : "max_growth_timestep", 46 : "ReporterValueName for storing computed timestep to reach max_growth_increment."); 47 8 : return params; 48 0 : } 49 : 50 4 : StressCorrosionCrackingExponential::StressCorrosionCrackingExponential( 51 4 : const InputParameters & parameters) 52 : : CrackGrowthReporterBase(parameters), 53 4 : _k_low(getParam<Real>("k_low")), 54 8 : _k_high(getParam<Real>("k_high")), 55 8 : _growth_rate_mid_multiplier(getParam<Real>("growth_rate_mid_multiplier")), 56 8 : _growth_rate_mid_exp_factor(getParam<Real>("growth_rate_mid_exp_factor")), 57 : 58 12 : _time_increment(declareValueByName<Real>( 59 : getParam<ReporterValueName>("time_to_max_growth_increment_name"), REPORTER_MODE_ROOT)), 60 8 : _growth_increment(declareValueByName<std::vector<Real>>( 61 4 : getParam<ReporterValueName>("growth_increment_name"), REPORTER_MODE_ROOT)) 62 : { 63 4 : if (_k_low > _k_high) 64 0 : paramError("k_high", "k_high must be larger than k_low"); 65 4 : } 66 : 67 : void 68 22 : StressCorrosionCrackingExponential::computeGrowth(std::vector<int> & index) 69 : { 70 22 : _growth_increment.resize(_ki_x.size(), 0.0); 71 22 : std::vector<Real> growth_rate(_ki_x.size(), 0.0); 72 : 73 110 : for (std::size_t i = 0; i < _ki_vpp.size(); ++i) 74 : { 75 88 : if (index[i] != -1) 76 : { 77 44 : Real ki = _ki_vpp[i]; 78 44 : if (ki < _k_low) 79 : ki = _k_low; 80 36 : else if (ki > _k_high) 81 : ki = _k_high; 82 : 83 44 : growth_rate[i] = _growth_rate_mid_multiplier * std::pow(ki, _growth_rate_mid_exp_factor); 84 : } 85 : } 86 : 87 22 : Real max_growth_rate = *std::max_element(growth_rate.begin(), growth_rate.end()); 88 22 : if (max_growth_rate <= 0) 89 0 : mooseError("Negative max growth rate encountered on crack front. "); 90 : 91 22 : _time_increment = _max_growth_increment / max_growth_rate; 92 : 93 110 : for (std::size_t i = 0; i < _ki_vpp.size(); ++i) 94 : { 95 88 : if (index[i] != -1) 96 44 : _growth_increment[i] = growth_rate[i] * _time_increment; 97 : } 98 22 : }