www.mooseframework.org
DeformedGrainMaterial.C
Go to the documentation of this file.
3 
4 template <>
5 InputParameters
7 {
8  InputParameters params = validParams<Material>();
9  params.addRequiredCoupledVarWithAutoBuild(
10  "v", "var_name_base", "op_num", "Array of coupled variables");
11  params.addRequiredParam<unsigned int>("deformed_grain_num",
12  "Number of OP representing deformed grains");
13  params.addParam<Real>("length_scale", 1.0e-9, "Length scale in m, where default is nm");
14  params.addParam<Real>("int_width", 4.0, "Diffuse Interface width in length_scale unit");
15  params.addParam<Real>("time_scale", 1.0e-6, "Time scale in sec, where default is micro sec");
16  params.addParam<Real>("GBMobility", 2.0e-13, "GB mobility input in m^4/(J*s)");
17  params.addParam<Real>("GBE", 1.0, "Grain boundary energy in J/m^2");
18  params.addParam<Real>("Disloc_Den", 9.0e15, "Dislocation Density in m^-2");
19  params.addParam<Real>("Elas_Mod", 2.50e10, "Elastic Modulus in J/m^3");
20  params.addParam<Real>("Burg_vec", 3.0e-10, "Length of Burger Vector in m");
21  params.addRequiredParam<UserObjectName>("grain_tracker",
22  "The GrainTracker UserObject to get values from.");
23  return params;
24 }
25 
26 DeformedGrainMaterial::DeformedGrainMaterial(const InputParameters & parameters)
27  : Material(parameters),
28  _op_num(coupledComponents("v")),
29  _vals(_op_num),
30  _length_scale(getParam<Real>("length_scale")),
31  _int_width(getParam<Real>("int_width")),
32  _time_scale(getParam<Real>("time_scale")),
33  _GBMobility(getParam<Real>("GBMobility")),
34  _GBE(getParam<Real>("GBE")),
35  _Disloc_Den(getParam<Real>("Disloc_Den")),
36  _Elas_Mod(getParam<Real>("Elas_Mod")),
37  _Burg_vec(getParam<Real>("Burg_vec")),
38  _kappa(declareProperty<Real>("kappa_op")),
39  _gamma(declareProperty<Real>("gamma_asymm")),
40  _L(declareProperty<Real>("L")),
41  _mu(declareProperty<Real>("mu")),
42  _beta(declareProperty<Real>("beta")),
43  _Disloc_Den_i(declareProperty<Real>("Disloc_Den_i")),
44  _rho_eff(declareProperty<Real>("rho_eff")),
45  _Def_Eng(declareProperty<Real>("Def_Eng")),
46  _deformed_grain_num(getParam<unsigned int>("deformed_grain_num")),
47  _grain_tracker(getUserObject<GrainTrackerInterface>("grain_tracker")),
48  _kb(8.617343e-5), // Boltzmann constant in eV/K
49  _JtoeV(6.24150974e18) // Joule to eV conversion
50 {
51  if (_op_num == 0)
52  mooseError("Model requires op_num > 0");
53 
54  for (unsigned int i = 0; i < _op_num; ++i)
55  _vals[i] = &coupledValue("v", i);
56 }
57 
58 void
60 {
62 
63  Real rho_i;
64  Real rho0 = 0.0;
65  Real SumEtai2 = 0.0;
66  for (unsigned int i = 0; i < _op_num; ++i)
67  SumEtai2 += (*_vals[i])[_qp] * (*_vals[i])[_qp];
68 
69  // calculate effective dislocation density and assign zero dislocation densities to undeformed
70  // grains
71  const auto & op_to_grains = _grain_tracker.getVarToFeatureVector(_current_elem->id());
72 
73  // loop over active OPs
74  bool one_active = false;
75  for (auto op_index = beginIndex(op_to_grains); op_index < op_to_grains.size(); ++op_index)
76  {
77  if (op_to_grains[op_index] == FeatureFloodCount::invalid_id)
78  continue;
79 
80  one_active = true;
81  auto grain_id = op_to_grains[op_index];
82 
83  if (grain_id >= _deformed_grain_num)
84  rho_i = 0.0;
85  else
86  rho_i = _Disloc_Den_i[_qp];
87  rho0 += rho_i * (*_vals[op_index])[_qp] * (*_vals[op_index])[_qp];
88  }
89 
90  if (!one_active && _t_step > 0)
91  mooseError("No active order parameters");
92 
93  _rho_eff[_qp] = rho0 / SumEtai2;
94  if (_rho_eff[_qp] < 1e-9)
95  {
96  _rho_eff[_qp] = 0.0;
97  _Disloc_Den_i[_qp] = 0.0;
98  }
99 
100  _beta[_qp] = 0.5 * _Elas_Mod * _Burg_vec * _Burg_vec * _JtoeV * _length_scale;
101 
102  // Compute the deformation energy
103  _Def_Eng[_qp] = _beta[_qp] * _rho_eff[_qp];
104 
105  const Real sigma = _GBE * _JtoeV * (_length_scale * _length_scale);
106  const Real length_scale4 = _length_scale * _length_scale * _length_scale * _length_scale;
107  const Real M_GB = _GBMobility * _time_scale / (_JtoeV * length_scale4);
108 
109  _L[_qp] = 4.0 / 3.0 * M_GB / _int_width;
110  _kappa[_qp] = 3.0 / 4.0 * sigma * _int_width;
111  _gamma[_qp] = 1.5;
112  _mu[_qp] = 6.0 * sigma / _int_width;
113 }
MaterialProperty< Real > & _Def_Eng
the deformation energy
MaterialProperty< Real > & _Disloc_Den_i
dislocation density in grain i
std::vector< const VariableValue * > _vals
order parameter values
This class defines the interface for the GrainTracking objects.
const Real _GBE
the GB Energy
const Real _Burg_vec
the Length of Burger&#39;s Vector
MaterialProperty< Real > & _kappa
the same parameters that appear in the original grain growth model
MaterialProperty< Real > & _mu
MaterialProperty< Real > & _rho_eff
the average/effective dislocation density
const unsigned int _deformed_grain_num
number of deformed grains
virtual void computeQpProperties()
const unsigned int _op_num
total number of grains
const Real _Elas_Mod
the elastic modulus
virtual const std::vector< unsigned int > & getVarToFeatureVector(dof_id_type elem_id) const =0
Returns a list of active unique feature ids for a particular element.
const GrainTrackerInterface & _grain_tracker
Grain tracker object.
static const unsigned int invalid_id
MaterialProperty< Real > & _gamma
const Real _Disloc_Den
the average dislocation density
DeformedGrainMaterial(const InputParameters &parameters)
MaterialProperty< Real > & _beta
the prefactor needed to calculate the deformation energy from dislocation density ...
InputParameters validParams< DeformedGrainMaterial >()
MaterialProperty< Real > & _L