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 
14 {
16  params.addParam<std::string>("function_name", "g", "actual name for g(eta_i)");
17  MooseEnum g_order("SIMPLE=0 LOW", "SIMPLE");
18  params.addParam<MooseEnum>("g_order", g_order, "Polynomial order of the barrier function g(eta)");
19  params.addRequiredCoupledVar("etas", "eta_i order parameters, one for each h");
20  params.addRequiredParam<std::vector<Real>>("W_ij",
21  "Terms controlling barrier height set W=1 in "
22  "DerivativeMultiPhaseMaterial for these to "
23  "apply");
24  return params;
25 }
26 
29  _function_name(getParam<std::string>("function_name")),
30  _g_order(getParam<MooseEnum>("g_order")),
31  _W_ij(getParam<std::vector<Real>>("W_ij")),
32  _num_eta(coupledComponents("etas")),
33  _eta_names(coupledNames("etas")),
34  _eta(coupledValues("etas")),
35  _prop_g(declareProperty<Real>(_function_name)),
36  _prop_dg(_num_eta),
37  _prop_d2g(_num_eta)
38 {
39  // if Vector W_ij is not the correct size to fill the matrix give error
40  if (_num_eta * _num_eta != _W_ij.size())
41  paramError("W_ij",
42  "Size of W_ij does not match (number of etas)^2. Supply W_ij of correct size.");
43 
44  // error out if the W_ij diagonal values are not zero
45  for (unsigned int i = 0; i < _num_eta; ++i)
46  if (_W_ij[_num_eta * i + i] != 0)
47  paramError("W_ij", "Set on-diagonal values of W_ij to zero.");
48 
49  // declare g derivative properties, fetch eta values
50  for (unsigned int i = 0; i < _num_eta; ++i)
51  _prop_d2g[i].resize(_num_eta);
52 
53  for (unsigned int i = 0; i < _num_eta; ++i)
54  {
55  _prop_dg[i] = &declarePropertyDerivative<Real>(_function_name, _eta_names[i]);
56  for (unsigned int j = i; j < _num_eta; ++j)
57  {
58  _prop_d2g[i][j] = _prop_d2g[j][i] =
59  &declarePropertyDerivative<Real>(_function_name, _eta_names[i], _eta_names[j]);
60  }
61  }
62 }
63 
64 void
66 {
67  // Initialize properties to zero before accumulating
68  _prop_g[_qp] = 0.0;
69  for (unsigned int i = 0; i < _num_eta; ++i)
70  {
71  (*_prop_dg[i])[_qp] = 0.0;
72  (*_prop_d2g[i][i])[_qp] = 0.0;
73  }
74 }
std::vector< Real > _W_ij
barrier function height matrix
std::vector< std::vector< MaterialProperty< Real > * > > _prop_d2g
const std::vector< VariableName > _eta_names
std::string _function_name
name of the function of eta (used to generate the material property names)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
unsigned int _num_eta
order parameters
std::vector< MaterialProperty< Real > * > _prop_dg
void addRequiredParam(const std::string &name, const std::string &doc_string)
CrossTermBarrierFunctionBase(const InputParameters &parameters)
static InputParameters validParams()
void paramError(const std::string &param, Args... args) const
MaterialProperty< Real > & _prop_g
Barrier function and its derivatives.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")