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 "AllenCahnElasticEnergyOffDiag.h" 11 : #include "MathUtils.h" 12 : #include "RankTwoTensor.h" 13 : 14 : registerMooseObject("PhaseFieldApp", AllenCahnElasticEnergyOffDiag); 15 : 16 : InputParameters 17 0 : AllenCahnElasticEnergyOffDiag::validParams() 18 : { 19 0 : InputParameters params = Kernel::validParams(); 20 0 : params.addClassDescription("This kernel calculates off-diagonal Jacobian of elastic energy in " 21 : "AllenCahn with respect to displacements"); 22 0 : params.addCoupledVar("displacements", 23 : "The vector of displacements suitable for the problem statement"); 24 0 : params.addParam<MaterialPropertyName>( 25 : "F_name", "E_el", "Name of material property storing the elastic energy"); 26 0 : params.addParam<MaterialPropertyName>("mob_name", "L", "The mobility used with the kernel"); 27 0 : return params; 28 0 : } 29 : 30 0 : AllenCahnElasticEnergyOffDiag::AllenCahnElasticEnergyOffDiag(const InputParameters & parameters) 31 : : DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>(parameters), 32 0 : _L(getMaterialProperty<Real>("mob_name")), 33 0 : _disp_map(getParameterJvarMap("displacements")), 34 0 : _d2Fdcdstrain(getMaterialProperty<RankTwoTensor>("d2Fdcdstrain")) 35 : { 36 0 : } 37 : 38 : Real 39 0 : AllenCahnElasticEnergyOffDiag::computeQpOffDiagJacobian(unsigned int jvar) 40 : { 41 : auto dispvar = mapJvarToCvar(jvar, _disp_map); 42 0 : if (dispvar >= 0) 43 : { 44 0 : const Real dxddFdc = _L[_qp] * _test[_i][_qp]; 45 : const Real d2Fdcdstrain_comp = 46 0 : (_d2Fdcdstrain[_qp].column(dispvar) + _d2Fdcdstrain[_qp].row(dispvar)) / 2.0 * 47 0 : _grad_phi[_j][_qp]; 48 0 : return dxddFdc * d2Fdcdstrain_comp; 49 : } 50 : 51 : return 0.0; 52 : }