www.mooseframework.org
ACGrGrPoly.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "ACGrGrPoly.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<ACGrGrBase>();
14  params.addClassDescription("Grain-Boundary model poly-crystaline interface Allen-Cahn Kernel");
15  return params;
16 }
17 
18 ACGrGrPoly::ACGrGrPoly(const InputParameters & parameters)
19  : ACGrGrBase(parameters), _gamma(getMaterialProperty<Real>("gamma_asymm"))
20 {
21 }
22 
23 Real
25 {
26  // Sum all other order parameters
27  Real SumEtaj = 0.0;
28  for (unsigned int i = 0; i < _op_num; ++i)
29  SumEtaj += (*_vals[i])[_qp] * (*_vals[i])[_qp];
30 
31  // Calculate either the residual or Jacobian of the grain growth free energy
32  switch (type)
33  {
34  case Residual:
35  {
36  return _mu[_qp] *
37  (_u[_qp] * _u[_qp] * _u[_qp] - _u[_qp] + 2.0 * _gamma[_qp] * _u[_qp] * SumEtaj);
38  }
39 
40  case Jacobian:
41  {
42  return _mu[_qp] *
43  (_phi[_j][_qp] * (3.0 * _u[_qp] * _u[_qp] - 1.0 + 2.0 * _gamma[_qp] * SumEtaj));
44  }
45 
46  default:
47  mooseError("Invalid type passed in");
48  }
49 }
50 
51 Real
53 {
54  for (unsigned int i = 0; i < _op_num; ++i)
55  if (jvar == _vals_var[i])
56  {
57  // Derivative of SumEtaj
58  const Real dSumEtaj = 2.0 * (*_vals[i])[_qp] * _phi[_j][_qp];
59  const Real dDFDOP = _mu[_qp] * 2.0 * _gamma[_qp] * _u[_qp] * dSumEtaj;
60 
61  return _L[_qp] * _test[_i][_qp] * dDFDOP;
62  }
63 
64  return 0.0;
65 }
This is the base class for kernels that calculate the residual for grain growth.
Definition: ACGrGrBase.h:23
const unsigned int _op_num
Definition: ACGrGrBase.h:29
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:44
std::vector< unsigned int > _vals_var
Definition: ACGrGrBase.h:32
InputParameters validParams< ACGrGrBase >()
Definition: ACGrGrBase.C:11
const MaterialProperty< Real > & _mu
Definition: ACGrGrBase.h:34
InputParameters validParams< ACGrGrPoly >()
Definition: ACGrGrPoly.C:11
virtual Real computeDFDOP(PFFunctionType type)
Definition: ACGrGrPoly.C:24
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: ACGrGrPoly.C:52
ACGrGrPoly(const InputParameters &parameters)
Definition: ACGrGrPoly.C:18
std::vector< const VariableValue * > _vals
Definition: ACGrGrBase.h:31
const MaterialProperty< Real > & _gamma
Definition: ACGrGrPoly.h:32