Line data Source code
1 : //* This file is part of the RACCOON application 2 : //* being developed at Dolbow lab at Duke University 3 : //* http://dolbow.pratt.duke.edu 4 : 5 : #include "PhaseFieldJIntegral.h" 6 : 7 : registerMooseObject("raccoonApp", PhaseFieldJIntegral); 8 : 9 : InputParameters 10 144 : PhaseFieldJIntegral::validParams() 11 : { 12 144 : InputParameters params = SideIntegralPostprocessor::validParams(); 13 144 : params += BaseNameInterface::validParams(); 14 144 : params.addClassDescription("Compute the J integral for a phase-field model of fracture"); 15 288 : params.addRequiredParam<RealVectorValue>("J_direction", "direction of J integral"); 16 288 : params.addParam<MaterialPropertyName>("strain_energy_density", 17 : "psie" 18 : "Name of the strain energy density"); 19 288 : params.addRequiredCoupledVar( 20 : "displacements", 21 : "The displacements appropriate for the simulation geometry and coordinate system"); 22 144 : return params; 23 0 : } 24 : 25 3 : PhaseFieldJIntegral::PhaseFieldJIntegral(const InputParameters & parameters) 26 : : SideIntegralPostprocessor(parameters), 27 : BaseNameInterface(parameters), 28 9 : _stress(getADMaterialPropertyByName<RankTwoTensor>(prependBaseName("stress"))), 29 6 : _psie(getADMaterialProperty<Real>(prependBaseName("strain_energy_density"))), 30 3 : _ndisp(coupledComponents("displacements")), 31 3 : _grad_disp(coupledGradients("displacements")), 32 9 : _t(getParam<RealVectorValue>("J_direction")) 33 : { 34 : // set unused dimensions to zero 35 6 : for (unsigned i = _ndisp; i < 3; ++i) 36 3 : _grad_disp.push_back(&_grad_zero); 37 3 : } 38 : 39 : Real 40 8904 : PhaseFieldJIntegral::computeQpIntegral() 41 : { 42 : auto H = RankTwoTensor::initializeFromRows( 43 8904 : (*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]); 44 8904 : RankTwoTensor I2(RankTwoTensor::initIdentity); 45 17808 : ADRankTwoTensor Sigma = _psie[_qp] * I2 - H.transpose() * _stress[_qp]; 46 8904 : RealVectorValue n = _normals[_qp]; 47 8904 : return raw_value(_t * Sigma * n); 48 : }