www.mooseframework.org
ACGrGrPoly.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 "ACGrGrPoly.h"
11 
12 registerMooseObject("PhaseFieldApp", ACGrGrPoly);
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<ACGrGrBase>();
19  params.addClassDescription("Grain-Boundary model poly-crystalline interface Allen-Cahn Kernel");
20  return params;
21 }
22 
23 ACGrGrPoly::ACGrGrPoly(const InputParameters & parameters)
24  : ACGrGrBase(parameters), _gamma(getMaterialProperty<Real>("gamma_asymm"))
25 {
26 }
27 
28 Real
29 ACGrGrPoly::computeDFDOP(PFFunctionType type)
30 {
31  // Sum all other order parameters
32  Real SumEtaj = 0.0;
33  for (unsigned int i = 0; i < _op_num; ++i)
34  SumEtaj += (*_vals[i])[_qp] * (*_vals[i])[_qp];
35 
36  // Calculate either the residual or Jacobian of the grain growth free energy
37  switch (type)
38  {
39  case Residual:
40  {
41  return _mu[_qp] *
42  (_u[_qp] * _u[_qp] * _u[_qp] - _u[_qp] + 2.0 * _gamma[_qp] * _u[_qp] * SumEtaj);
43  }
44 
45  case Jacobian:
46  {
47  return _mu[_qp] *
48  (_phi[_j][_qp] * (3.0 * _u[_qp] * _u[_qp] - 1.0 + 2.0 * _gamma[_qp] * SumEtaj));
49  }
50 
51  default:
52  mooseError("Invalid type passed in");
53  }
54 }
55 
56 Real
58 {
59  for (unsigned int i = 0; i < _op_num; ++i)
60  if (jvar == _vals_var[i])
61  {
62  // Derivative of SumEtaj
63  const Real dSumEtaj = 2.0 * (*_vals[i])[_qp] * _phi[_j][_qp];
64  const Real dDFDOP = _mu[_qp] * 2.0 * _gamma[_qp] * _u[_qp] * dSumEtaj;
65 
66  return _L[_qp] * _test[_i][_qp] * dDFDOP;
67  }
68 
69  return 0.0;
70 }
ACBulk< Real >::Residual
Definition: ACBulk.h:40
ACGrGrBase::_vals
std::vector< const VariableValue * > _vals
Definition: ACGrGrBase.h:33
ACGrGrPoly::_gamma
const MaterialProperty< Real > & _gamma
Definition: ACGrGrPoly.h:34
ACGrGrBase::_op_num
const unsigned int _op_num
Definition: ACGrGrBase.h:31
ACGrGrPoly::computeDFDOP
virtual Real computeDFDOP(PFFunctionType type)
Definition: ACGrGrPoly.C:29
ACGrGrBase::_vals_var
std::vector< unsigned int > _vals_var
Definition: ACGrGrBase.h:34
ACGrGrBase
This is the base class for kernels that calculate the residual for grain growth.
Definition: ACGrGrBase.h:25
validParams< ACGrGrBase >
InputParameters validParams< ACGrGrBase >()
Definition: ACGrGrBase.C:14
ACGrGrPoly.h
ACGrGrPoly
This kernel calculates the residual for grain growth for a single phase, poly-crystal system.
Definition: ACGrGrPoly.h:25
ACBulk< Real >::Jacobian
Definition: ACBulk.h:39
ACGrGrPoly::ACGrGrPoly
ACGrGrPoly(const InputParameters &parameters)
Definition: ACGrGrPoly.C:23
registerMooseObject
registerMooseObject("PhaseFieldApp", ACGrGrPoly)
validParams< ACGrGrPoly >
InputParameters validParams< ACGrGrPoly >()
Definition: ACGrGrPoly.C:16
ACGrGrPoly::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: ACGrGrPoly.C:57
ACBulk< Real >::_L
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:46
ACGrGrBase::_mu
const MaterialProperty< Real > & _mu
Definition: ACGrGrBase.h:36