www.mooseframework.org
CrossTermBarrierFunctionBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 
12 template <>
13 InputParameters
15 {
16  InputParameters params = validParams<Material>();
17  params.addParam<std::string>("function_name", "g", "actual name for g(eta_i)");
18  MooseEnum g_order("SIMPLE=0 LOW", "SIMPLE");
19  params.addParam<MooseEnum>("g_order", g_order, "Polynomial order of the barrier function g(eta)");
20  params.addRequiredCoupledVar("etas", "eta_i order parameters, one for each h");
21  params.addRequiredParam<std::vector<Real>>("W_ij",
22  "Terms controlling barrier height set W=1 in "
23  "DerivativeMultiPhaseMaterial for these to "
24  "apply");
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  _W_ij(getParam<std::vector<Real>>("W_ij")),
33  _num_eta(coupledComponents("etas")),
34  _eta_names(_num_eta),
35  _eta(_num_eta),
36  _prop_g(declareProperty<Real>(_function_name)),
37  _prop_dg(_num_eta),
38  _prop_d2g(_num_eta)
39 {
40  // if Vector W_ij is not the correct size to fill the matrix give error
41  if (_num_eta * _num_eta != _W_ij.size())
42  paramError("W_ij",
43  "Size of W_ij does not match (number of etas)^2. Supply W_ij of correct size.");
44 
45  // error out if the W_ij diagonal values are not zero
46  for (unsigned int i = 0; i < _num_eta; ++i)
47  if (_W_ij[_num_eta * i + i] != 0)
48  paramError("W_ij", "Set on-diagonal values of W_ij to zero.");
49 
50  // declare g derivative properties, fetch eta values
51  for (unsigned int i = 0; i < _num_eta; ++i)
52  {
53  _prop_d2g[i].resize(_num_eta);
54  _eta_names[i] = getVar("etas", i)->name();
55  }
56 
57  for (unsigned int i = 0; i < _num_eta; ++i)
58  {
59  _prop_dg[i] = &declarePropertyDerivative<Real>(_function_name, _eta_names[i]);
60  _eta[i] = &coupledValue("etas", i);
61  for (unsigned int j = i; j < _num_eta; ++j)
62  {
63  _prop_d2g[i][j] = _prop_d2g[j][i] =
64  &declarePropertyDerivative<Real>(_function_name, _eta_names[i], _eta_names[j]);
65  }
66  }
67 }
68 
69 void
71 {
72  // Initialize properties to zero before accumulating
73  _prop_g[_qp] = 0.0;
74  for (unsigned int i = 0; i < _num_eta; ++i)
75  {
76  (*_prop_dg[i])[_qp] = 0.0;
77  (*_prop_d2g[i][i])[_qp] = 0.0;
78  }
79 }
validParams< CrossTermBarrierFunctionBase >
InputParameters validParams< CrossTermBarrierFunctionBase >()
Definition: CrossTermBarrierFunctionBase.C:14
CrossTermBarrierFunctionBase::_function_name
std::string _function_name
name of the function of eta (used to generate the material property names)
Definition: CrossTermBarrierFunctionBase.h:34
CrossTermBarrierFunctionBase::_prop_d2g
std::vector< std::vector< MaterialProperty< Real > * > > _prop_d2g
Definition: CrossTermBarrierFunctionBase.h:50
CrossTermBarrierFunctionBase::_num_eta
unsigned int _num_eta
order parameters
Definition: CrossTermBarrierFunctionBase.h:43
CrossTermBarrierFunctionBase::_eta_names
std::vector< VariableName > _eta_names
Definition: CrossTermBarrierFunctionBase.h:44
CrossTermBarrierFunctionBase::CrossTermBarrierFunctionBase
CrossTermBarrierFunctionBase(const InputParameters &parameters)
Definition: CrossTermBarrierFunctionBase.C:28
CrossTermBarrierFunctionBase.h
CrossTermBarrierFunctionBase::computeQpProperties
virtual void computeQpProperties()
Definition: CrossTermBarrierFunctionBase.C:70
CrossTermBarrierFunctionBase::_prop_g
MaterialProperty< Real > & _prop_g
Barrier function and its derivatives.
Definition: CrossTermBarrierFunctionBase.h:48
CrossTermBarrierFunctionBase::_prop_dg
std::vector< MaterialProperty< Real > * > _prop_dg
Definition: CrossTermBarrierFunctionBase.h:49
CrossTermBarrierFunctionBase::_W_ij
std::vector< Real > _W_ij
barrier function height matrix
Definition: CrossTermBarrierFunctionBase.h:40
CrossTermBarrierFunctionBase::_eta
std::vector< const VariableValue * > _eta
Definition: CrossTermBarrierFunctionBase.h:45