www.mooseframework.org
MultiBarrierFunctionMaterial.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<Material>();
14  params.addClassDescription("Double well phase transformation barrier free energy contribution.");
15  params.addParam<std::string>("function_name", "g", "actual name for g(eta_i)");
16  MooseEnum h_order("SIMPLE=0", "SIMPLE");
17  params.addParam<MooseEnum>(
18  "g_order", h_order, "Polynomial order of the switching function h(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.addRequiredCoupledVar("etas", "eta_i order parameters, one for each h");
25  return params;
26 }
27 
29  : DerivativeMaterialInterface<Material>(parameters),
30  _function_name(getParam<std::string>("function_name")),
31  _g_order(getParam<MooseEnum>("g_order")),
32  _well_only(getParam<bool>("well_only")),
33  _num_eta(coupledComponents("etas")),
34  _eta(_num_eta),
35  _prop_g(declareProperty<Real>(_function_name)),
36  _prop_dg(_num_eta),
37  _prop_d2g(_num_eta)
38 {
39  // declare derivative properties, fetch eta values
40  for (unsigned int i = 0; i < _num_eta; ++i)
41  {
42  const VariableName & eta_name = getVar("etas", i)->name();
43  _prop_dg[i] = &declarePropertyDerivative<Real>(_function_name, eta_name);
44  _prop_d2g[i] = &declarePropertyDerivative<Real>(_function_name, eta_name, eta_name);
45  _eta[i] = &coupledValue("etas", i);
46  }
47 }
48 
49 void
51 {
52  Real g = 0.0;
53 
54  for (unsigned int i = 0; i < _num_eta; ++i)
55  {
56  const Real n = (*_eta[i])[_qp];
57 
58  if (_well_only && n >= 0.0 && n <= 1.0)
59  {
60  _prop_g[_qp] = 0.0;
61  (*_prop_dg[i])[_qp] = 0.0;
62  (*_prop_d2g[i])[_qp] = 0.0;
63  continue;
64  }
65 
66  switch (_g_order)
67  {
68  case 0: // SIMPLE
69  g += n * n * (1.0 - n) * (1.0 - n);
70  (*_prop_dg[i])[_qp] = 2.0 * n * (n - 1.0) * (2.0 * n - 1.0);
71  (*_prop_d2g[i])[_qp] = 12.0 * (n * n - n) + 2.0;
72  break;
73  }
74  }
75 
76  _prop_g[_qp] = g;
77 }
std::vector< MaterialProperty< Real > * > _prop_dg
unsigned int _num_eta
order parameters
std::vector< const VariableValue * > _eta
MooseEnum _g_order
Polynomial order of the barrier function .
MultiBarrierFunctionMaterial(const InputParameters &parameters)
std::string _function_name
name of the function of eta (used to generate the material property names)
InputParameters validParams< MultiBarrierFunctionMaterial >()
bool _well_only
zero out g contribution in the eta interval [0:1]
std::vector< MaterialProperty< Real > * > _prop_d2g
MaterialProperty< Real > & _prop_g
Barrier functions and their drivatives.