www.mooseframework.org
MixedSwitchingFunctionMaterial.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 h(eta) and its derivative in one of two "
15  "polynomial forms. MIX234 and MIX246");
16  MooseEnum h_order("MIX234=0 MIX246", "MIX234");
17  params.addParam<MooseEnum>(
18  "h_order", h_order, "Polynomial order of the switching function h(eta)");
19  params.set<std::string>("function_name") = std::string("h");
20 
21  params.addRangeCheckedParam<Real>(
22  "weight", 1.0, "weight <= 1 & weight >= 0", "Weight parameter for MIX type h(eta)");
23 
24  return params;
25 }
26 
28  : OrderParameterFunctionMaterial(parameters),
29  _h_order(getParam<MooseEnum>("h_order")),
30  _weight(getParam<Real>("weight"))
31 {
32 }
33 
34 void
36 {
37  Real n = _eta[_qp];
38  n = n > 1 ? 1 : (n < 0 ? 0 : n);
39 
40  switch (_h_order)
41  {
42  case 0: // MIX234
43  _prop_f[_qp] =
44  n * n * (3.0 * _weight + (4.0 - 6.0 * _weight) * n + (3.0 * _weight - 3.0) * n * n);
45  _prop_df[_qp] =
46  n * (6.0 * _weight + (12.0 - 18.0 * _weight) * n + (12.0 * _weight - 12.0) * n * n);
47  _prop_d2f[_qp] = 6.0 * _weight + ((24.0 - 36.0 * _weight) + (36.0 * _weight - 36.0) * n) * n;
48  break;
49 
50  case 1: // MIX246
51  _prop_f[_qp] =
52  n * n * (2.0 * _weight + n * n * ((3.0 - 4.0 * _weight) + (2.0 * _weight - 2.0) * n * n));
53  _prop_df[_qp] =
54  n * (4.0 * _weight + n * n * ((12.0 - 16.0 * _weight) + (12.0 * _weight - 12.0) * n * n));
55  _prop_d2f[_qp] =
56  4.0 * _weight + n * n * ((36.0 - 48.0 * _weight) + (60.0 * _weight - 60.0) * n * n);
57  break;
58 
59  default:
60  mooseError("Internal error");
61  }
62 }
InputParameters validParams< OrderParameterFunctionMaterial >()
MooseEnum _h_order
Polynomial order of the switching function .
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 .
Real _weight
Weight parameter of mixed-type h(eta)
MaterialProperty< Real > & _prop_df
Material property to store the derivative .
MaterialProperty< Real > & _prop_f
Material property to store .
InputParameters validParams< MixedSwitchingFunctionMaterial >()
MixedSwitchingFunctionMaterial(const InputParameters &parameters)
const VariableValue & _eta
Coupled variable value for the order parameter .