www.mooseframework.org
DeformedGrainMaterial.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "DeformedGrainMaterial.h"
11 #include "GrainTrackerInterface.h"
12 
14 
17 {
20  "v", "var_name_base", "op_num", "Array of coupled variables");
21  params.addRequiredParam<unsigned int>("deformed_grain_num",
22  "Number of OP representing deformed grains");
23  params.addParam<Real>("length_scale", 1.0e-9, "Length scale in m, where default is nm");
24  params.addParam<Real>("int_width", 4.0, "Diffuse Interface width in length_scale unit");
25  params.addParam<Real>("time_scale", 1.0e-6, "Time scale in sec, where default is micro sec");
26  params.addParam<Real>("GBMobility", 2.0e-13, "GB mobility input in m^4/(J*s)");
27  params.addParam<Real>("GBE", 1.0, "Grain boundary energy in J/m^2");
28  params.addParam<Real>("Disloc_Den", 9.0e15, "Dislocation Density in m^-2");
29  params.addParam<Real>("Elas_Mod", 2.50e10, "Elastic Modulus in J/m^3");
30  params.addParam<Real>("Burg_vec", 3.0e-10, "Length of Burger Vector in m");
31  params.addRequiredParam<UserObjectName>("grain_tracker",
32  "The GrainTracker UserObject to get values from.");
33  return params;
34 }
35 
37  : Material(parameters),
38  _op_num(coupledComponents("v")),
39  _vals(coupledValues("v")),
40  _length_scale(getParam<Real>("length_scale")),
41  _int_width(getParam<Real>("int_width")),
42  _time_scale(getParam<Real>("time_scale")),
43  _GBMobility(getParam<Real>("GBMobility")),
44  _GBE(getParam<Real>("GBE")),
45  _Disloc_Den(getParam<Real>("Disloc_Den")),
46  _Elas_Mod(getParam<Real>("Elas_Mod")),
47  _Burg_vec(getParam<Real>("Burg_vec")),
48  _kappa(declareProperty<Real>("kappa_op")),
49  _gamma(declareProperty<Real>("gamma_asymm")),
50  _L(declareProperty<Real>("L")),
51  _mu(declareProperty<Real>("mu")),
52  _beta(declareProperty<Real>("beta")),
53  _Disloc_Den_i(declareProperty<Real>("Disloc_Den_i")),
54  _rho_eff(declareProperty<Real>("rho_eff")),
55  _Def_Eng(declareProperty<Real>("Def_Eng")),
56  _deformed_grain_num(getParam<unsigned int>("deformed_grain_num")),
57  _grain_tracker(getUserObject<GrainTrackerInterface>("grain_tracker")),
58  _kb(8.617343e-5), // Boltzmann constant in eV/K
59  _JtoeV(6.24150974e18) // Joule to eV conversion
60 {
61  if (_op_num == 0)
62  paramError("op_num", "Model requires op_num > 0");
63 }
64 
65 void
67 {
69 
70  Real rho_i;
71  Real rho0 = 0.0;
72  Real SumEtai2 = 0.0;
73  for (unsigned int i = 0; i < _op_num; ++i)
74  SumEtai2 += (*_vals[i])[_qp] * (*_vals[i])[_qp];
75 
76  // calculate effective dislocation density and assign zero dislocation densities to undeformed
77  // grains
78  const auto & op_to_grains = _grain_tracker.getVarToFeatureVector(_current_elem->id());
79 
80  // loop over active OPs
81  bool one_active = false;
82  for (MooseIndex(op_to_grains) op_index = 0; op_index < op_to_grains.size(); ++op_index)
83  {
84  if (op_to_grains[op_index] == FeatureFloodCount::invalid_id)
85  continue;
86 
87  one_active = true;
88  auto grain_id = op_to_grains[op_index];
89 
90  if (grain_id >= _deformed_grain_num)
91  rho_i = 0.0;
92  else
93  rho_i = _Disloc_Den_i[_qp];
94  rho0 += rho_i * (*_vals[op_index])[_qp] * (*_vals[op_index])[_qp];
95  }
96 
97  if (!one_active && _t_step > 0)
98  mooseError("No active order parameters");
99 
100  _rho_eff[_qp] = rho0 / SumEtai2;
101  if (_rho_eff[_qp] < 1e-9)
102  {
103  _rho_eff[_qp] = 0.0;
104  _Disloc_Den_i[_qp] = 0.0;
105  }
106 
108 
109  // Compute the deformation energy
110  _Def_Eng[_qp] = _beta[_qp] * _rho_eff[_qp];
111 
113  const Real length_scale4 = _length_scale * _length_scale * _length_scale * _length_scale;
114  const Real M_GB = _GBMobility * _time_scale / (_JtoeV * length_scale4);
115 
116  _L[_qp] = 4.0 / 3.0 * M_GB / _int_width;
117  _kappa[_qp] = 3.0 / 4.0 * sigma * _int_width;
118  _gamma[_qp] = 1.5;
119  _mu[_qp] = 6.0 * sigma / _int_width;
120 }
MaterialProperty< Real > & _Def_Eng
the deformation energy
MaterialProperty< Real > & _Disloc_Den_i
dislocation density in grain i
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
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
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
const std::vector< const VariableValue * > _vals
order parameter values
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
virtual void computeQpProperties()
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.
unsigned int _qp
int & _t_step
const unsigned int _op_num
total number of grains
static InputParameters validParams()
const Real _Elas_Mod
the elastic modulus
const GrainTrackerInterface & _grain_tracker
Grain tracker object.
static const unsigned int invalid_id
void paramError(const std::string &param, Args... args) const
registerMooseObject("PhaseFieldApp", DeformedGrainMaterial)
MaterialProperty< Real > & _gamma
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real _Disloc_Den
the average dislocation density
void addRequiredCoupledVarWithAutoBuild(const std::string &name, const std::string &base_name, const std::string &num_name, const std::string &doc_string)
DeformedGrainMaterial(const InputParameters &parameters)
void mooseError(Args &&... args) const
MaterialProperty< Real > & _beta
the prefactor needed to calculate the deformation energy from dislocation density ...
MaterialProperty< Real > & _L
Calculates The Deformation Energy associated with a specific dislocation density. ...
void ErrorVector unsigned int
const Elem *const & _current_elem