www.mooseframework.org
CrossTermBarrierFunctionMaterial.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 /****************************************************************/
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<CrossTermBarrierFunctionBase>();
14  params.addClassDescription(
15  "Free energy contribution symmetric across interfaces between arbitrary pairs of phases.");
16  return params;
17 }
18 
20  const InputParameters & parameters)
21  : CrossTermBarrierFunctionBase(parameters)
22 {
23  // error out if W_ij is not symmetric
24  for (unsigned int i = 0; i < _num_eta; ++i)
25  for (unsigned int j = 0; j < i; ++j)
26  if (_W_ij[_num_eta * i + j] != _W_ij[_num_eta * j + i])
27  mooseError("Please supply a symmetric W_ij matrix for CrossTermBarrierFunctionMaterial ",
28  name());
29 }
30 
31 void
33 {
34  // Initialize properties to zero before accumulating
36 
37  // Sum the components of our W_ij matrix to get constant used in our g function
38  for (unsigned int i = 0; i < _num_eta; ++i)
39  for (unsigned int j = i + 1; j < _num_eta; ++j)
40  {
41  const Real ni = (*_eta[i])[_qp];
42  const Real nj = (*_eta[j])[_qp];
43  const Real Wij = _W_ij[_num_eta * i + j];
44 
45  switch (_g_order)
46  {
47  case 0: // SIMPLE
48  _prop_g[_qp] += 16.0 * Wij * (ni * ni * nj * nj);
49  // first derivatives
50  (*_prop_dg[i])[_qp] += 16.0 * Wij * (2 * ni * nj * nj);
51  (*_prop_dg[j])[_qp] += 16.0 * Wij * (2 * ni * ni * nj);
52  // second derivatives (diagonal)
53  (*_prop_d2g[i][i])[_qp] += 16.0 * Wij * (2 * nj * nj);
54  (*_prop_d2g[j][j])[_qp] += 16.0 * Wij * (2 * ni * ni);
55  // second derivatives (off-diagonal)
56  (*_prop_d2g[i][j])[_qp] = 16.0 * Wij * (4 * ni * nj);
57  break;
58 
59  case 1: // LOW
60  _prop_g[_qp] += 4.0 * Wij * (ni * nj);
61  // first derivatives
62  (*_prop_dg[i])[_qp] += 4.0 * Wij * nj;
63  (*_prop_dg[j])[_qp] += 4.0 * Wij * ni;
64  // second derivatives (diagonal) vanish
65  // second derivatives (off-diagonal)
66  (*_prop_d2g[i][j])[_qp] = 4.0 * Wij;
67  break;
68 
69  default:
70  mooseError("Internal error");
71  }
72  }
73 }
std::vector< Real > _W_ij
barrier function height matrix
std::vector< std::vector< MaterialProperty< Real > * > > _prop_d2g
unsigned int _num_eta
order parameters
std::vector< MaterialProperty< Real > * > _prop_dg
InputParameters validParams< CrossTermBarrierFunctionMaterial >()
CrossTermBarrierFunctionMaterial(const InputParameters &parameters)
MaterialProperty< Real > & _prop_g
Barrier function and its derivatives.
InputParameters validParams< CrossTermBarrierFunctionBase >()
std::vector< const VariableValue * > _eta
unsigned int _g_order
polynomial order of the switching function
CrossTermBarrierFunctionBase is the base to a set of free energy penalties that set the phase interfa...