www.mooseframework.org
ACGBPoly.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 "ACGBPoly.h"
11 #include "Material.h"
12 
13 registerMooseObject("PhaseFieldApp", ACGBPoly);
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = ACBulk<Real>::validParams();
20  params.addClassDescription("Grain-Boundary model concentration dependent residual");
21  params.addRequiredCoupledVar("c", "Other species concentration");
22  params.addParam<Real>("en_ratio", 1.0, "Ratio of surface energy to GB energy");
23  return params;
24 }
25 
26 ACGBPoly::ACGBPoly(const InputParameters & parameters)
27  : ACBulk<Real>(parameters),
28  _c(coupledValue("c")),
29  _c_var(coupled("c")),
30  _mu(getMaterialProperty<Real>("mu")),
31  _gamma(getMaterialProperty<Real>("gamma_asymm")),
32  _en_ratio(getParam<Real>("en_ratio"))
33 {
34 }
35 
36 Real
37 ACGBPoly::computeDFDOP(PFFunctionType type)
38 {
39  Real mult = 2.0 * _en_ratio * _mu[_qp] * _gamma[_qp];
40 
41  Real c = _c[_qp];
42  if (c < 1.0e-8)
43  c = 0.0;
44  if (c > 1.0)
45  c = 1.0;
46 
47  switch (type)
48  {
49  case Residual:
50  return mult * _u[_qp] * c * c;
51 
52  case Jacobian:
53  return mult * _phi[_j][_qp] * c * c;
54  }
55 
56  mooseError("Invalid type passed in");
57 }
58 
59 Real
61 {
62  Real c = _c[_qp];
63  if (c < 1.0e-8)
64  c = 0.0;
65  if (c > 1.0)
66  c = 1.0;
67 
68  if (jvar == _c_var)
69  {
70  Real mult = 2.0 * _en_ratio * _mu[_qp] * _gamma[_qp];
71  Real dDFDOP = 2.0 * mult * _u[_qp] * c * _phi[_j][_qp];
72 
73  return _L[_qp] * _test[_i][_qp] * dDFDOP;
74  }
75 
76  return 0.0;
77 }
ACGBPoly.h
ACGBPoly::ACGBPoly
ACGBPoly(const InputParameters &parameters)
Definition: ACGBPoly.C:26
ACBulk< Real >::Residual
Definition: ACBulk.h:40
ACGBPoly::computeDFDOP
virtual Real computeDFDOP(PFFunctionType type)
Definition: ACGBPoly.C:37
ACBulk
This is the Allen-Cahn equation base class that implements the bulk or local energy term of the equat...
Definition: ACBulk.h:24
ACGBPoly::_c_var
unsigned int _c_var
Definition: ACGBPoly.h:30
registerMooseObject
registerMooseObject("PhaseFieldApp", ACGBPoly)
validParams< ACGBPoly >
InputParameters validParams< ACGBPoly >()
Definition: ACGBPoly.C:17
ACGBPoly::_c
const VariableValue & _c
Definition: ACGBPoly.h:29
ACGBPoly
Definition: ACGBPoly.h:20
ACGBPoly::_gamma
const MaterialProperty< Real > & _gamma
Definition: ACGBPoly.h:33
ACBulk< Real >::Jacobian
Definition: ACBulk.h:39
ACGBPoly::_en_ratio
Real _en_ratio
Definition: ACGBPoly.h:35
ACBulk::validParams
static InputParameters validParams()
Definition: ACBulk.h:74
ACGBPoly::_mu
const MaterialProperty< Real > & _mu
Definition: ACGBPoly.h:32
ACGBPoly::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: ACGBPoly.C:60
ACBulk< Real >::_L
const MaterialProperty< Real > & _L
Mobility.
Definition: ACBulk.h:46