www.mooseframework.org
BarrierFunctionMaterial.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<OrderParameterFunctionMaterial>();
14  params.addClassDescription("Helper material to provide g(eta) and its derivative in a "
15  "polynomial.\nSIMPLE: eta^2*(1-eta)^2\nLOW: eta*(1-eta)"
16  "\nHIGH: eta^2*(1-eta^2)^2");
17  MooseEnum g_order("SIMPLE=0 LOW HIGH", "SIMPLE");
18  params.addParam<MooseEnum>("g_order", g_order, "Polynomial order of the barrier function g(eta)");
19  params.addParam<bool>("well_only",
20  false,
21  "Make the g zero in [0:1] so it only contributes to "
22  "enforcing the eta range and not to the phase "
23  "transformation berrier.");
24  params.set<std::string>("function_name") = std::string("g");
25  return params;
26 }
27 
28 BarrierFunctionMaterial::BarrierFunctionMaterial(const InputParameters & parameters)
29  : OrderParameterFunctionMaterial(parameters),
30  _g_order(getParam<MooseEnum>("g_order")),
31  _well_only(getParam<bool>("well_only"))
32 {
33 }
34 
35 void
37 {
38  const Real n = _eta[_qp];
39 
40  if (_well_only && n >= 0.0 && n <= 1.0)
41  {
42  _prop_f[_qp] = 0.0;
43  _prop_df[_qp] = 0.0;
44  _prop_d2f[_qp] = 0.0;
45  return;
46  }
47 
48  switch (_g_order)
49  {
50  case 0: // SIMPLE
51  _prop_f[_qp] = n * n * (1.0 - n) * (1.0 - n);
52  _prop_df[_qp] = 2.0 * n * (n - 1.0) * (2.0 * n - 1.0);
53  _prop_d2f[_qp] = 12.0 * (n * n - n) + 2.0;
54  break;
55 
56  case 1: // LOW
57  _prop_f[_qp] = n * (1.0 - n);
58  _prop_df[_qp] = 1.0 - 2.0 * n;
59  _prop_d2f[_qp] = -2.0;
60  break;
61 
62  case 2: // HIGH
63  _prop_f[_qp] = n * n * (1.0 - n * n) * (1.0 - n * n);
64  _prop_df[_qp] = n * (2.0 - n * n * (8.0 + 6.0 * n * n));
65  _prop_d2f[_qp] = 2.0 - n * n * (24.0 + 30.0 * n * n);
66  break;
67 
68  default:
69  mooseError("Internal error");
70  }
71 }
MooseEnum _g_order
Polynomial order of the switching function .
InputParameters validParams< OrderParameterFunctionMaterial >()
Material base class for materials that provide the switching function or the double well function ...
MaterialProperty< Real > & _prop_d2f
Material property to store the second derivative .
bool _well_only
zero out g contribution in the eta interval [0:1]
MaterialProperty< Real > & _prop_df
Material property to store the derivative .
BarrierFunctionMaterial(const InputParameters &parameters)
MaterialProperty< Real > & _prop_f
Material property to store .
InputParameters validParams< BarrierFunctionMaterial >()
const VariableValue & _eta
Coupled variable value for the order parameter .