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 "ACGrGrElasticDrivingForce.h" 11 : 12 : #include "Material.h" 13 : #include "RankFourTensor.h" 14 : #include "RankTwoTensor.h" 15 : 16 : registerMooseObject("PhaseFieldApp", ACGrGrElasticDrivingForce); 17 : 18 : InputParameters 19 0 : ACGrGrElasticDrivingForce::validParams() 20 : { 21 0 : InputParameters params = ACBulk<Real>::validParams(); 22 0 : params.addClassDescription("Adds elastic energy contribution to the Allen-Cahn equation"); 23 0 : params.addRequiredParam<MaterialPropertyName>( 24 : "D_tensor_name", "The elastic tensor derivative for the specific order parameter"); 25 0 : return params; 26 0 : } 27 : 28 0 : ACGrGrElasticDrivingForce::ACGrGrElasticDrivingForce(const InputParameters & parameters) 29 : : ACBulk<Real>(parameters), 30 0 : _D_elastic_tensor(getMaterialProperty<RankFourTensor>("D_tensor_name")), 31 0 : _elastic_strain(getMaterialPropertyByName<RankTwoTensor>("elastic_strain")) 32 : { 33 0 : } 34 : 35 : Real 36 0 : ACGrGrElasticDrivingForce::computeDFDOP(PFFunctionType type) 37 : { 38 : // Access the heterogeneous strain calculated by the Solid Mechanics kernels 39 0 : RankTwoTensor strain(_elastic_strain[_qp]); 40 : 41 : // Compute the partial derivative of the stress wrt the order parameter 42 0 : RankTwoTensor D_stress = _D_elastic_tensor[_qp] * strain; 43 : 44 0 : switch (type) 45 : { 46 0 : case Residual: 47 : return 0.5 * 48 0 : D_stress.doubleContraction(strain); // Compute the deformation energy driving force 49 : 50 : case Jacobian: 51 : return 0.0; 52 : } 53 : 54 0 : mooseError("Invalid type passed in"); 55 : }