11 #include "libmesh/quadrature.h" 19 params.
addClassDescription(
"Generates a diffusion tensor to distinguish between the bulk, grain " 20 "boundaries, and surfaces");
22 "v",
"var_name_base",
"op_num",
"Array of coupled variables");
28 "diffusivity_name",
"D",
"Name for the diffusivity material property");
29 params.
addParam<
Real>(
"surfindex", 1.0,
"Surface diffusion index weight");
30 params.
addParam<
Real>(
"gbindex", 1.0,
"Grain boundary diffusion index weight");
31 params.
addParam<
Real>(
"bulkindex", 1.0,
"Bulk diffusion index weight");
38 _T(coupledValue(
"T")),
39 _c(coupledValue(
"c")),
40 _grad_c(coupledGradient(
"c")),
41 _c_name(coupledName(
"c", 0)),
42 _diffusivity_name(getParam<
std::string>(
"diffusivity_name")),
44 _dDdc(isCoupledConstant(
"_c_name")
46 : &declarePropertyDerivative<
RealTensorValue>(_diffusivity_name, _c_name)),
47 _dDdgradc(isCoupledConstant(
"_c_name")
49 : &declarePropertyDerivative<
RankThreeTensor>(_diffusivity_name,
"gradc")),
50 _D0(getParam<
Real>(
"D0")),
51 _Em(getParam<
Real>(
"Em")),
52 _s_index(getParam<
Real>(
"surfindex")),
53 _gb_index(getParam<
Real>(
"gbindex")),
54 _b_index(getParam<
Real>(
"bulkindex")),
56 _op_num(coupledComponents(
"v")),
66 for (
unsigned int i = 0; i <
_op_num; ++i)
91 std::vector<RealTensorValue> dDgbdeta(
_op_num);
92 std::vector<RankThreeTensor> dDgbdgradeta(
_op_num);
94 for (
unsigned int i = 0; i <
_op_num; ++i)
98 if (ngb.
norm() > 1.0e-10)
104 for (
unsigned int a = 0;
a < 3; ++
a)
105 for (
unsigned int b =
a;
b < 3; ++
b)
107 Tgb(
a,
b) = I(
a,
b) - ngb(
a) * ngb(
b);
108 Tgb(
b,
a) = I(
b,
a) - ngb(
b) * ngb(
a);
119 dTgbi(0, 0, 0) = -2.0 * detax * (detay * detay + detaz * detaz) / norm4;
120 dTgbi(1, 0, 0) = dTgbi(0, 1, 0) =
121 (detax * detax * detay - detay * detay * detay - detay * detaz * detaz) / norm4;
122 dTgbi(1, 1, 0) = 2.0 * detax * detay * detay / norm4;
123 dTgbi(2, 0, 0) = dTgbi(0, 2, 0) =
124 (detax * detax * detaz - detay * detay * detaz - detaz * detaz * detaz) / norm4;
125 dTgbi(2, 1, 0) = dTgbi(1, 2, 0) = 2.0 * detax * detay * detaz / norm4;
126 dTgbi(2, 2, 0) = 2.0 * detax * detaz * detaz / norm4;
128 dTgbi(0, 0, 1) = 2.0 * detax * detax * detay / norm4;
129 dTgbi(1, 0, 1) = dTgbi(0, 1, 1) =
130 (-detax * detax * detax + detax * detay * detay - detax * detaz * detaz) / norm4;
131 dTgbi(1, 1, 1) = -2.0 * detay * (detax * detax + detaz * detaz) / norm4;
132 dTgbi(2, 0, 1) = dTgbi(0, 2, 1) = 2.0 * detax * detay * detaz / norm4;
133 dTgbi(2, 1, 1) = dTgbi(1, 2, 1) =
134 (detay * detay * detaz - detax * detax * detaz - detaz * detaz * detaz) / norm4;
135 dTgbi(2, 2, 1) = 2.0 * detay * detaz * detaz / norm4;
138 dTgbi(0, 0, 2) = 2.0 * detax * detax * detaz / norm4;
139 dTgbi(1, 0, 2) = dTgbi(0, 1, 2) = 2.0 * detax * detay * detaz / norm4;
140 dTgbi(1, 1, 2) = 2.0 * detay * detay * detaz / norm4;
141 dTgbi(2, 0, 2) = dTgbi(0, 2, 2) =
142 (detax * detaz * detaz - detax * detax * detax - detay * detay * detax) / norm4;
143 dTgbi(2, 1, 2) = dTgbi(1, 2, 2) =
144 (detay * detaz * detaz - detax * detax * detay - detay * detay * detay) / norm4;
145 dTgbi(2, 2, 2) = -2.0 * detaz * (detax * detax + detay * detay) / norm4;
152 dDgbdeta[i] += 2.0 * (*
_vals[
j])[
_qp] * Tgb;
153 dDgbdeta[
j] += 2.0 * (*
_vals[i])[
_qp] * Tgb;
164 for (
unsigned int a = 0;
a < 3; ++
a)
165 for (
unsigned int b = 0;
b < 3; ++
b)
167 Ts(
a,
b) = I(
a,
b) - ns(
a) * ns(
b);
178 dTs(0, 0, 0) = -2.0 * dcx * (dcy * dcy + dcz * dcz) / norm4;
179 dTs(1, 0, 0) = dTs(0, 1, 0) = (dcx * dcx * dcy - dcy * dcy * dcy - dcy * dcz * dcz) / norm4;
180 dTs(1, 1, 0) = 2.0 * dcx * dcy * dcy / norm4;
181 dTs(2, 0, 0) = dTs(0, 2, 0) = (dcx * dcx * dcz - dcy * dcy * dcz - dcz * dcz * dcz) / norm4;
182 dTs(2, 1, 0) = dTs(1, 2, 0) = 2.0 * dcx * dcy * dcz / norm4;
183 dTs(2, 2, 0) = 2.0 * dcx * dcz * dcz / norm4;
186 dTs(0, 0, 1) = 2.0 * dcx * dcx * dcy / norm4;
187 dTs(1, 0, 1) = dTs(0, 1, 1) = (-dcx * dcx * dcx + dcx * dcy * dcy - dcx * dcz * dcz) / norm4;
188 dTs(1, 1, 1) = -2.0 * dcy * (dcx * dcx + dcz * dcz) / norm4;
189 dTs(2, 0, 1) = dTs(0, 2, 1) = 2.0 * dcx * dcy * dcz / norm4;
190 dTs(2, 1, 1) = dTs(1, 2, 1) = (dcy * dcy * dcz - dcx * dcx * dcz - dcz * dcz * dcz) / norm4;
191 dTs(2, 2, 1) = 2.0 * dcy * dcz * dcz / norm4;
194 dTs(0, 0, 2) = 2.0 * dcx * dcx * dcz / norm4;
195 dTs(1, 0, 2) = dTs(0, 1, 2) = 2.0 * dcx * dcy * dcz / norm4;
196 dTs(1, 1, 2) = 2.0 * dcy * dcy * dcz / norm4;
197 dTs(2, 0, 2) = dTs(0, 2, 2) = (dcx * dcz * dcz - dcx * dcx * dcx - dcy * dcy * dcx) / norm4;
198 dTs(2, 1, 2) = dTs(1, 2, 2) = (dcy * dcz * dcz - dcx * dcx * dcy - dcy * dcy * dcy) / norm4;
199 dTs(2, 2, 2) = -2.0 * dcz * (dcx * dcx + dcy * dcy) / norm4;
208 const Real mult_bulk = 1.0;
209 const Real dmult_bulk = 0.0;
217 for (
unsigned int i = 0; i <
_op_num; ++i)
Generates a diffusion tensor to distinguish between the bulk, grain boundary, and surface diffusion r...
const QBase *const & _qrule
const VariableGradient & _grad_c
virtual bool isCoupledConstant(const std::string &var_name) const
auto norm() const -> decltype(std::norm(Real()))
std::vector< const VariableGradient * > _grad_vals
VariableName coupledName(const std::string &var_name, unsigned int comp=0) const
std::vector< const VariableValue * > _vals
const unsigned int _op_num
MaterialProperty< RealTensorValue > & _D
std::string _diffusivity_name
std::vector< NonlinearVariableName > _vals_name
solid phase order parameters
static InputParameters validParams()
virtual const VariableGradient & coupledGradient(const std::string &var_name, unsigned int comp=0) const
MaterialProperty< RankThreeTensor > * _dDdgradc
virtual const VariableValue & coupledValue(const std::string &var_name, unsigned int comp=0) const
TensorValue< Real > RealTensorValue
static InputParameters validParams()
std::vector< MaterialProperty< RealTensorValue > * > _dDdeta
std::vector< MaterialProperty< RankThreeTensor > * > _dDdgradeta
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
PolycrystalDiffusivityTensorBase(const InputParameters ¶meters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void computeProperties()
void mooseError(Args &&... args) const
registerMooseObject("PhaseFieldApp", PolycrystalDiffusivityTensorBase)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
MaterialProperty< RealTensorValue > * _dDdc