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 "InteractionIntegralBenchmarkBC.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("SolidMechanicsApp", InteractionIntegralBenchmarkBC); 14 : 15 : InputParameters 16 0 : InteractionIntegralBenchmarkBC::validParams() 17 : { 18 0 : MooseEnum disp_component("x=0 y=1 z=2"); 19 0 : InputParameters params = DirichletBCBase::validParams(); 20 0 : params.addClassDescription("Implements a boundary condition that enforces a displacement field " 21 : "around a crack tip based on applied stress intensity factors."); 22 0 : params.addRequiredParam<MooseEnum>( 23 : "component", disp_component, "The component of the displacement to apply BC on."); 24 0 : params.addRequiredParam<UserObjectName>("crack_front_definition", 25 : "The CrackFrontDefinition user object name"); 26 0 : params.addParam<unsigned int>( 27 0 : "crack_front_point_index", 0, "The index of the point on the crack front."); 28 0 : params.addRequiredParam<Real>("poissons_ratio", "Poisson's ratio for the material."); 29 0 : params.addRequiredParam<Real>("youngs_modulus", "Young's modulus of the material."); 30 0 : params.addRequiredParam<FunctionName>("KI_function", 31 : "Function describing the Mode I stress intensity factor."); 32 0 : params.addRequiredParam<FunctionName>("KII_function", 33 : "Function describing the Mode II stress intensity factor."); 34 0 : params.addRequiredParam<FunctionName>( 35 : "KIII_function", "Function describing the Mode III stress intensity factor."); 36 0 : params.set<bool>("preset") = true; 37 0 : return params; 38 0 : } 39 : 40 0 : InteractionIntegralBenchmarkBC::InteractionIntegralBenchmarkBC(const InputParameters & parameters) 41 : : DirichletBCBase(parameters), 42 0 : _component(getParam<MooseEnum>("component")), 43 0 : _crack_front_definition(getUserObject<CrackFrontDefinition>("crack_front_definition")), 44 0 : _crack_front_point_index(getParam<unsigned int>("crack_front_point_index")), 45 0 : _poissons_ratio(getParam<Real>("poissons_ratio")), 46 0 : _youngs_modulus(getParam<Real>("youngs_modulus")), 47 0 : _ki_function(getFunction("KI_function")), 48 0 : _kii_function(getFunction("KII_function")), 49 0 : _kiii_function(getFunction("KIII_function")) 50 : { 51 0 : _kappa = 3 - 4 * _poissons_ratio; 52 0 : _mu = _youngs_modulus / (2 * (1 + _poissons_ratio)); 53 0 : } 54 : 55 : Real 56 0 : InteractionIntegralBenchmarkBC::computeQpValue() 57 : { 58 0 : const Real ki_val = _ki_function.value(_t, *_current_node); 59 0 : const Real kii_val = _kii_function.value(_t, *_current_node); 60 0 : const Real kiii_val = _kiii_function.value(_t, *_current_node); 61 : 62 0 : const Point p(*_current_node); 63 0 : _crack_front_definition.calculateRThetaToCrackFront(p, _crack_front_point_index, _r, _theta); 64 : 65 0 : if (_r == 0) 66 0 : _theta = 0; 67 : 68 0 : const Real st2 = std::sin(_theta / 2.0); 69 0 : const Real ct2 = std::cos(_theta / 2.0); 70 : 71 : Real disp(0.0); 72 : 73 0 : if (_component == 0) 74 0 : disp = 1 / (2 * _mu) * std::sqrt(_r / (2 * libMesh::pi)) * 75 0 : (ki_val * ct2 * (_kappa - 1 + 2 * st2 * st2) + 76 0 : kii_val * st2 * (_kappa + 1 + 2 * ct2 * ct2)); 77 0 : else if (_component == 1) 78 0 : disp = 1 / (2 * _mu) * std::sqrt(_r / (2 * libMesh::pi)) * 79 0 : (ki_val * st2 * (_kappa + 1 - 2 * ct2 * ct2) - 80 0 : kii_val * ct2 * (_kappa - 1 - 2 * st2 * st2)); 81 0 : else if (_component == 2) 82 0 : disp = 1 / _mu * std::sqrt(2 * _r / libMesh::pi) * kiii_val * st2; 83 : 84 0 : return disp; 85 : }