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