www.mooseframework.org
SwitchingFunctionMaterial.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.\nSIMPLE: 3*eta^2-2*eta^3\nHIGH: "
16  "eta^3*(6*eta^2-15*eta+10)");
17  MooseEnum h_order("SIMPLE=0 HIGH", "SIMPLE");
18  params.addParam<MooseEnum>(
19  "h_order", h_order, "Polynomial order of the switching function h(eta)");
20  params.set<std::string>("function_name") = std::string("h");
21  return params;
22 }
23 
24 SwitchingFunctionMaterial::SwitchingFunctionMaterial(const InputParameters & parameters)
25  : OrderParameterFunctionMaterial(parameters), _h_order(getParam<MooseEnum>("h_order"))
26 {
27 }
28 
29 void
31 {
32  Real n = _eta[_qp];
33  n = n > 1 ? 1 : (n < 0 ? 0 : n);
34 
35  switch (_h_order)
36  {
37  case 0: // SIMPLE
38  _prop_f[_qp] = 3.0 * n * n - 2.0 * n * n * n;
39  _prop_df[_qp] = 6.0 * n - 6.0 * n * n;
40  _prop_d2f[_qp] = 6.0 - 12.0 * n;
41  break;
42 
43  case 1: // HIGH
44  _prop_f[_qp] = n * n * n * (6.0 * n * n - 15.0 * n + 10.0);
45  _prop_df[_qp] = 30.0 * n * n * (n * n - 2.0 * n + 1.0);
46  _prop_d2f[_qp] = n * (120.0 * n * n - 180.0 * n + 60.0);
47  break;
48 
49  default:
50  mooseError("Internal error");
51  }
52 }
InputParameters validParams< OrderParameterFunctionMaterial >()
InputParameters validParams< SwitchingFunctionMaterial >()
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 .
MaterialProperty< Real > & _prop_df
Material property to store the derivative .
MooseEnum _h_order
Polynomial order of the switching function .
MaterialProperty< Real > & _prop_f
Material property to store .
SwitchingFunctionMaterial(const InputParameters &parameters)
const VariableValue & _eta
Coupled variable value for the order parameter .