https://mooseframework.inl.gov
GBEvolutionBase.C
Go to the documentation of this file.
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 "GBEvolutionBase.h"
11 
12 template <bool is_ad>
15 {
17  params.addClassDescription(
18  "Computes necessary material properties for the isotropic grain growth model");
19  params.addRequiredCoupledVar("T", "Temperature in Kelvin");
20  params.addParam<Real>("f0s", 0.125, "The GB energy constant ");
21  params.addRequiredParam<Real>("wGB", "Diffuse GB width in the length scale of the model");
22  params.addParam<Real>("length_scale", 1.0e-9, "Length scale in m, where default is nm");
23  params.addParam<Real>("time_scale", 1.0e-9, "Time scale in s, where default is ns");
24  params.addParam<Real>(
25  "GBMobility",
26  -1,
27  "GB mobility input in m^4/(J*s), that overrides the temperature dependent calculation");
28  params.addParam<Real>("GBmob0", 0, "Grain boundary mobility prefactor in m^4/(J*s)");
29  params.addParam<Real>("Q", 0, "Grain boundary migration activation energy in eV");
30  params.addParam<Real>("molar_volume",
31  24.62e-6,
32  "Molar volume in m^3/mol, needed for temperature gradient driving force");
33  return params;
34 }
35 
36 template <bool is_ad>
39  _f0s(getParam<Real>("f0s")),
40  _wGB(getParam<Real>("wGB")),
41  _length_scale(getParam<Real>("length_scale")),
42  _time_scale(getParam<Real>("time_scale")),
43  _GBmob0(getParam<Real>("GBmob0")),
44  _Q(getParam<Real>("Q")),
45  _GBMobility(getParam<Real>("GBMobility")),
46  _molar_vol(getParam<Real>("molar_volume")),
47  _T(coupledValue("T")),
48  _sigma(declareGenericProperty<Real, is_ad>("sigma")),
49  _M_GB(declareGenericProperty<Real, is_ad>("M_GB")),
50  _kappa(declareGenericProperty<Real, is_ad>("kappa_op")),
51  _gamma(declareGenericProperty<Real, is_ad>("gamma_asymm")),
52  _L(declareGenericProperty<Real, is_ad>("L")),
53  _dLdT(parameters.hasDefaultCoupledValue("T")
54  ? nullptr
55  : &declarePropertyDerivative<Real>("L", coupledName("T", 0))),
56  _l_GB(declareGenericProperty<Real, is_ad>("l_GB")),
57  _mu(declareGenericProperty<Real, is_ad>("mu")),
58  _entropy_diff(declareGenericProperty<Real, is_ad>("entropy_diff")),
59  _molar_volume(declareGenericProperty<Real, is_ad>("molar_volume")),
60  _act_wGB(declareGenericProperty<Real, is_ad>("act_wGB")),
61  _kb(8.617343e-5), // Boltzmann constant in eV/K
62  _JtoeV(6.24150974e18) // Joule to eV conversion
63 {
64  if (_GBMobility == -1 && _GBmob0 == 0)
65  mooseError("Either a value for GBMobility or for GBmob0 and Q must be provided");
66 }
67 
68 template <bool is_ad>
69 void
71 {
72  const Real length_scale4 = _length_scale * _length_scale * _length_scale * _length_scale;
73 
74  // GB mobility Derivative
75  Real dM_GBdT;
76 
77  if (_GBMobility < 0)
78  {
79  // Convert to lengthscale^4/(eV*timescale);
80  const Real M0 = _GBmob0 * _time_scale / (_JtoeV * length_scale4);
81 
82  _M_GB[_qp] = M0 * std::exp(-_Q / (_kb * _T[_qp]));
83  dM_GBdT = MetaPhysicL::raw_value(_M_GB[_qp] * _Q / (_kb * _T[_qp] * _T[_qp]));
84  }
85  else
86  {
87  // Convert to lengthscale^4/(eV*timescale)
88  _M_GB[_qp] = _GBMobility * _time_scale / (_JtoeV * length_scale4);
89  dM_GBdT = 0.0;
90  }
91 
92  // in the length scale of the system
93  _l_GB[_qp] = _wGB;
94 
95  _L[_qp] = 4.0 / 3.0 * _M_GB[_qp] / _l_GB[_qp];
96  if (_dLdT)
97  (*_dLdT)[_qp] = MetaPhysicL::raw_value(4.0 / 3.0 * dM_GBdT / _l_GB[_qp]);
98  _kappa[_qp] = 3.0 / 4.0 * _sigma[_qp] * _l_GB[_qp];
99  _gamma[_qp] = 1.5;
100  _mu[_qp] = 3.0 / 4.0 * 1.0 / _f0s * _sigma[_qp] / _l_GB[_qp];
101 
102  // J/(K mol) converted to eV(K mol)
103  _entropy_diff[_qp] = 8.0e3 * _JtoeV;
104 
105  // m^3/mol converted to ls^3/mol
106  _molar_volume[_qp] = _molar_vol / (_length_scale * _length_scale * _length_scale);
107  _act_wGB[_qp] = 0.5e-9 / _length_scale;
108 }
109 
110 template class GBEvolutionBaseTempl<false>;
111 template class GBEvolutionBaseTempl<true>;
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
GBEvolutionBaseTempl(const InputParameters &parameters)
auto raw_value(const Eigen::Map< T > &in)
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
virtual void computeQpProperties()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)