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 "GrandPotentialTensorMaterial.h" 11 : 12 : // libMesh includes 13 : #include "libmesh/quadrature.h" 14 : 15 : registerMooseObject("PhaseFieldApp", GrandPotentialTensorMaterial); 16 : 17 : InputParameters 18 217 : GrandPotentialTensorMaterial::validParams() 19 : { 20 217 : InputParameters params = PolycrystalDiffusivityTensorBase::validParams(); 21 217 : params.addClassDescription("Diffusion and mobility parameters for grand potential model " 22 : "governing equations. Uses a tensor diffusivity"); 23 434 : params.addRequiredParam<Real>("int_width", 24 : "The interfacial width in the lengthscale of the problem"); 25 434 : params.addParam<MaterialPropertyName>("chi", "Coefficient to multiply by D"); 26 434 : params.addParam<Real>("GBmob0", 0.0, "Grain boundary mobility prefactor"); 27 434 : params.addRequiredParam<Real>("Q", "Grain boundary migration activation energy in eV"); 28 434 : params.addParam<Real>( 29 434 : "GBMobility", -1, "GB mobility input that overrides the temperature dependent calculation"); 30 434 : params.addParam<std::string>("f_name", "chiD", "Name for the mobility material property"); 31 434 : params.addRequiredParam<MaterialPropertyName>("surface_energy", "Surface energy of material"); 32 434 : params.addParam<std::string>("solid_mobility", "L", "Name of grain mobility for solid phase"); 33 434 : params.addParam<std::string>("void_mobility", "Lv", "Name of void phase mobility"); 34 217 : return params; 35 0 : } 36 : 37 168 : GrandPotentialTensorMaterial::GrandPotentialTensorMaterial(const InputParameters & parameters) 38 : : PolycrystalDiffusivityTensorBase(parameters), 39 168 : _chiD_name(getParam<std::string>("f_name")), 40 168 : _chiD(declareProperty<RealTensorValue>(_chiD_name)), 41 168 : _dchiDdc(isCoupledConstant(_c_name) 42 168 : ? nullptr 43 336 : : &declarePropertyDerivative<RealTensorValue>(_chiD_name, _c_name)), 44 168 : _dchiDdgradc(isCoupledConstant(_c_name) 45 168 : ? nullptr 46 504 : : &declarePropertyDerivative<RankThreeTensor>(_chiD_name, "gradc")), 47 336 : _Ls_name(getParam<std::string>("solid_mobility")), 48 168 : _Ls(declareProperty<Real>(_Ls_name)), 49 336 : _Lv_name(getParam<std::string>("void_mobility")), 50 168 : _Lv(declareProperty<Real>(_Lv_name)), 51 168 : _chiDmag(declareProperty<Real>(_chiD_name + "_mag")), 52 336 : _sigma_s(getMaterialProperty<Real>("surface_energy")), 53 336 : _int_width(getParam<Real>("int_width")), 54 336 : _chi_name(getParam<MaterialPropertyName>("chi")), 55 168 : _chi(getMaterialProperty<Real>(_chi_name)), 56 168 : _dchidc(getMaterialPropertyDerivative<Real>(_chi_name, _c_name)), 57 168 : _dchideta(_op_num), 58 168 : _dchiDdeta(_op_num), 59 168 : _dchiDdgradeta(_op_num), 60 336 : _GBMobility(getParam<Real>("GBMobility")), 61 336 : _GBmob0(getParam<Real>("GBmob0")), 62 504 : _Q(getParam<Real>("Q")) 63 : { 64 552 : for (unsigned int i = 0; i < _op_num; ++i) 65 : { 66 384 : _dchideta[i] = &getMaterialPropertyDerivative<Real>(_chi_name, _vals_name[i]); 67 384 : if (!isCoupledConstant(_vals_name[i])) 68 384 : _dchiDdeta[i] = &declarePropertyDerivative<RealTensorValue>(_chiD_name, _vals_name[i]); 69 384 : if (!isCoupledConstant(_vals_name[i])) 70 384 : _dchiDdgradeta[i] = 71 768 : &declarePropertyDerivative<RankThreeTensor>(_chiD_name, ("grad" + _vals_name[i])); 72 : } 73 168 : } 74 : 75 : void 76 1730991 : GrandPotentialTensorMaterial::computeProperties() 77 : { 78 1730991 : PolycrystalDiffusivityTensorBase::computeProperties(); 79 : 80 7947755 : for (_qp = 0; _qp < _qrule->n_points(); ++_qp) 81 : { 82 6216764 : _chiD[_qp] = _D[_qp] * _chi[_qp]; 83 6216764 : if (_dchiDdc) 84 6216764 : (*_dchiDdc)[_qp] = (*_dDdc)[_qp] * _chi[_qp] + _D[_qp] * _dchidc[_qp]; 85 6216764 : if (_dchiDdgradc) 86 6216764 : (*_dchiDdgradc)[_qp] = (*_dDdgradc)[_qp] * _chi[_qp]; 87 18703468 : for (unsigned int i = 0; i < _op_num; ++i) 88 : { 89 12486704 : if (_dchiDdeta[i]) 90 12486704 : (*_dchiDdeta[i])[_qp] = _D[_qp] * (*_dchideta[i])[_qp] + (*_dDdeta[i])[_qp] * _chi[_qp]; 91 12486704 : if (_dchiDdgradeta[i]) 92 12486704 : (*_dchiDdgradeta[i])[_qp] = (*_dDdgradeta[i])[_qp] * _chi[_qp]; 93 : } 94 : 95 6216764 : _chiDmag[_qp] = _chiD[_qp].norm(); 96 : 97 : Real GBmob; 98 6216764 : if (_GBMobility < 0) 99 6216764 : GBmob = _GBmob0 * std::exp(-_Q / (_kb * _T[_qp])); 100 : else 101 : GBmob = _GBMobility; 102 : 103 6216764 : _Ls[_qp] = 4.0 / 3.0 * GBmob / _int_width; 104 6216764 : _Lv[_qp] = 40 * _Ls[_qp]; 105 : } 106 1730991 : }