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 "PhaseFieldFractureMechanicsOffDiag.h" 11 : 12 : registerMooseObject("SolidMechanicsApp", PhaseFieldFractureMechanicsOffDiag); 13 : 14 : InputParameters 15 0 : PhaseFieldFractureMechanicsOffDiag::validParams() 16 : { 17 0 : InputParameters params = Kernel::validParams(); 18 0 : params.addClassDescription("Stress divergence kernel for phase-field fracture: Computes off " 19 : "diagonal damage dependent Jacobian components. To be used with " 20 : "StressDivergenceTensors or DynamicStressDivergenceTensors."); 21 0 : params.addParam<std::string>("base_name", "Material property base name"); 22 0 : params.addRequiredParam<unsigned int>("component", 23 : "An integer corresponding to the direction " 24 : "the variable this kernel acts in. (0 for x, " 25 : "1 for y, 2 for z)"); 26 0 : params.addCoupledVar( 27 : "c", 28 : "Phase field damage variable: Used to indicate calculation of Off Diagonal Jacobian term"); 29 0 : return params; 30 0 : } 31 : 32 0 : PhaseFieldFractureMechanicsOffDiag::PhaseFieldFractureMechanicsOffDiag( 33 0 : const InputParameters & parameters) 34 : : DerivativeMaterialInterface<Kernel>(parameters), 35 0 : _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""), 36 0 : _component(getParam<unsigned int>("component")), 37 0 : _c_coupled(isCoupled("c")), 38 0 : _c_var(_c_coupled ? coupled("c") : 0), 39 0 : _d_stress_dc( 40 0 : getMaterialPropertyDerivative<RankTwoTensor>(_base_name + "stress", coupledName("c", 0))) 41 : { 42 0 : } 43 : 44 : Real 45 0 : PhaseFieldFractureMechanicsOffDiag::computeQpOffDiagJacobian(unsigned int jvar) 46 : { 47 0 : if (_c_coupled && jvar == _c_var) 48 : { 49 : Real val = 0.0; 50 0 : for (unsigned int k = 0; k < 3; ++k) 51 0 : val += _d_stress_dc[_qp](_component, k) * _grad_test[_i][_qp](k); 52 0 : return val * _phi[_j][_qp]; 53 : } 54 : 55 : // Returns if coupled variable is not c (damage variable) 56 : return 0.0; 57 : }