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")),
65 for (
unsigned int i = 0; i <
_op_num; ++i)
87 std::vector<RealTensorValue> dDgbdeta(
_op_num);
89 for (
unsigned int i = 0; i <
_op_num; ++i)
93 if (ngb.
norm() > 1.0e-10)
99 for (
unsigned int a = 0;
a < 3; ++
a)
100 for (
unsigned int b =
a;
b < 3; ++
b)
102 Tgb(
a,
b) = I(
a,
b) - ngb(
a) * ngb(
b);
103 Tgb(
b,
a) = I(
b,
a) - ngb(
b) * ngb(
a);
108 dDgbdeta[i] += 2.0 * (*
_vals[
j])[
_qp] * Tgb;
109 dDgbdeta[
j] += 2.0 * (*
_vals[i])[
_qp] * Tgb;
118 for (
unsigned int a = 0;
a < 3; ++
a)
119 for (
unsigned int b = 0;
b < 3; ++
b)
121 Ts(
a,
b) = I(
a,
b) - ns(
a) * ns(
b);
132 dTs(0, 0, 0) = -2.0 * dcx * (dcy * dcy + dcz * dcz) / norm4;
133 dTs(1, 0, 0) = dTs(0, 1, 0) = (dcx * dcx * dcy - dcy * dcy * dcy - dcy * dcz * dcz) / norm4;
134 dTs(1, 1, 0) = 2.0 * dcx * dcy * dcy / norm4;
135 dTs(2, 0, 0) = dTs(0, 2, 0) = (dcx * dcx * dcz - dcy * dcy * dcz - dcz * dcz * dcz) / norm4;
136 dTs(2, 1, 0) = dTs(1, 2, 0) = 2.0 * dcx * dcy * dcz / norm4;
137 dTs(2, 2, 0) = 2.0 * dcx * dcz * dcz / norm4;
140 dTs(0, 0, 1) = 2.0 * dcx * dcx * dcy / norm4;
141 dTs(1, 0, 1) = dTs(0, 1, 1) = (-dcx * dcx * dcx + dcx * dcy * dcy - dcx * dcz * dcz) / norm4;
142 dTs(1, 1, 1) = -2.0 * dcy * (dcx * dcx + dcz * dcz) / norm4;
143 dTs(2, 0, 1) = dTs(0, 2, 1) = 2.0 * dcx * dcy * dcz / norm4;
144 dTs(2, 1, 1) = dTs(1, 2, 1) = (dcy * dcy * dcz - dcx * dcx * dcz - dcz * dcz * dcz) / norm4;
145 dTs(2, 2, 1) = 2.0 * dcy * dcz * dcz / norm4;
148 dTs(0, 0, 2) = 2.0 * dcx * dcx * dcz / norm4;
149 dTs(1, 0, 2) = dTs(0, 1, 2) = 2.0 * dcx * dcy * dcz / norm4;
150 dTs(1, 1, 2) = 2.0 * dcy * dcy * dcz / norm4;
151 dTs(2, 0, 2) = dTs(0, 2, 2) = (dcx * dcz * dcz - dcx * dcx * dcx - dcy * dcy * dcx) / norm4;
152 dTs(2, 1, 2) = dTs(1, 2, 2) = (dcy * dcz * dcz - dcx * dcx * dcy - dcy * dcy * dcy) / norm4;
153 dTs(2, 2, 2) = -2.0 * dcz * (dcx * dcx + dcy * dcy) / norm4;
162 const Real mult_bulk = 1.0;
163 const Real dmult_bulk = 0.0;
171 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
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()
registerMooseObject("PhaseFieldApp", PolycrystalDiffusivityTensorBase)
void mooseError(Args &&... args) const
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
MaterialProperty< RealTensorValue > * _dDdc