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 "CrackGrowthReporterBase.h" 11 : #include "CrackMeshCut3DUserObject.h" 12 : #include "VectorPostprocessorInterface.h" 13 : #include "MathUtils.h" 14 : 15 : InputParameters 16 16 : CrackGrowthReporterBase::validParams() 17 : { 18 16 : InputParameters params = GeneralReporter::validParams(); 19 32 : params.addRequiredParam<UserObjectName>("crackMeshCut3DUserObject_name", 20 : "The CrackMeshCut3DUserObject user object name"); 21 32 : params.addRequiredRangeCheckedParam<Real>( 22 : "max_growth_increment", 23 : "max_growth_increment>0", 24 : "the max growth size at the crack front in each increment of a fatigue simulation"); 25 32 : params.addParam<VectorPostprocessorName>( 26 : "ki_vectorpostprocessor", "II_KI_1", "The name of the vectorpostprocessor that contains KI"); 27 : 28 : // these flags must must match those used by the InteractionIntegral set in the 29 : // DomainIntegralAction 30 16 : ExecFlagEnum & exec = params.set<ExecFlagEnum>("execute_on"); 31 16 : exec.addAvailableFlags(EXEC_XFEM_MARK); 32 32 : params.setDocString("execute_on", exec.getDocString()); 33 64 : params.set<ExecFlagEnum>("execute_on") = {EXEC_XFEM_MARK, EXEC_TIMESTEP_END}; 34 16 : return params; 35 16 : } 36 : 37 8 : CrackGrowthReporterBase::CrackGrowthReporterBase(const InputParameters & parameters) 38 : : GeneralReporter(parameters), 39 8 : _cutter_name(getParam<UserObjectName>("crackMeshCut3DUserObject_name")), 40 8 : _3Dcutter(&_fe_problem.getUserObject<CrackMeshCut3DUserObject>(_cutter_name)), 41 16 : _max_growth_increment(getParam<Real>("max_growth_increment")), 42 8 : _ki_vpp(getVectorPostprocessorValue( 43 8 : "ki_vectorpostprocessor", getParam<VectorPostprocessorName>("ki_vectorpostprocessor"))), 44 8 : _ki_x(getVectorPostprocessorValue("ki_vectorpostprocessor", "x")), 45 8 : _ki_y(getVectorPostprocessorValue("ki_vectorpostprocessor", "y")), 46 8 : _ki_z(getVectorPostprocessorValue("ki_vectorpostprocessor", "z")), 47 8 : _ki_id(getVectorPostprocessorValue("ki_vectorpostprocessor", "id")), 48 24 : _x(declareValueByName<std::vector<Real>>("x", REPORTER_MODE_ROOT)), 49 16 : _y(declareValueByName<std::vector<Real>>("y", REPORTER_MODE_ROOT)), 50 16 : _z(declareValueByName<std::vector<Real>>("z", REPORTER_MODE_ROOT)), 51 16 : _id(declareValueByName<std::vector<Real>>("id", REPORTER_MODE_ROOT)) 52 : { 53 8 : } 54 : 55 : void 56 60 : CrackGrowthReporterBase::execute() 57 : { 58 60 : copyCoordinates(); 59 60 : std::vector<int> index = getCutterMeshIndices(); 60 60 : computeGrowth(index); 61 60 : } 62 : 63 : void 64 60 : CrackGrowthReporterBase::copyCoordinates() const 65 : { 66 60 : _x.resize(_ki_x.size()); 67 60 : _y.resize(_ki_y.size()); 68 60 : _z.resize(_ki_z.size()); 69 60 : _id.resize(_ki_id.size()); 70 60 : std::copy(_ki_x.begin(), _ki_x.end(), _x.begin()); 71 60 : std::copy(_ki_y.begin(), _ki_y.end(), _y.begin()); 72 60 : std::copy(_ki_z.begin(), _ki_z.end(), _z.begin()); 73 60 : std::copy(_ki_id.begin(), _ki_id.end(), _id.begin()); 74 60 : } 75 : 76 : std::vector<int> 77 60 : CrackGrowthReporterBase::getCutterMeshIndices() const 78 : { 79 : // Generate _active_boundary and _inactive_boundary_pos; 80 : // This is a duplicated call before the one in CrackMeshCut3DUserObject; 81 : // That one cannot be deleted because this one is for subcritical cracking only 82 : // the test still pass so lynn is not sure if this is actually needed but it was 83 : // in the original post processor so I'll keep it, even though it is non const. 84 60 : _3Dcutter->findActiveBoundaryNodes(); 85 60 : return _3Dcutter->getFrontPointsIndex(); 86 : }