www.mooseframework.org
ThirdPhaseSuppressionMaterial.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 
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<Material>();
19  params.addParam<std::string>("function_name", "g", "actual name for g(eta_i)");
20  params.addRequiredCoupledVar("etas", "eta_i order parameters, one for each h");
21  params.addClassDescription(
22  "Free Energy contribution that penalizes more than two order parameters being non-zero");
23  return params;
24 }
25 
27  : DerivativeMaterialInterface<Material>(parameters),
28  _function_name(getParam<std::string>("function_name")),
29  _num_eta(coupledComponents("etas")),
30  _eta(_num_eta),
31  _prop_g(declareProperty<Real>(_function_name)),
32  _prop_dg(_num_eta),
33  _prop_d2g(_num_eta)
34 {
35  std::vector<std::string> eta_name(_num_eta);
36  for (unsigned int i = 0; i < _num_eta; ++i)
37  {
38  _prop_d2g[i].resize(_num_eta);
39  // declare derivative properties, fetch eta values
40  eta_name[i] = getVar("etas", i)->name();
41  }
42  for (unsigned int i = 0; i < _num_eta; ++i)
43  {
44  _prop_dg[i] = &declarePropertyDerivative<Real>(_function_name, eta_name[i]);
45  _eta[i] = &coupledValue("etas", i);
46  for (unsigned int j = i; j < _num_eta; ++j)
47  {
48  _prop_d2g[i][j] = _prop_d2g[j][i] =
49  &declarePropertyDerivative<Real>(_function_name, eta_name[i], eta_name[j]);
50  }
51  }
52 }
53 
54 void
56 {
57  // Initialize properties to zero before accumulating
58  _prop_g[_qp] = 0.0;
59  for (unsigned int i = 0; i < _num_eta; ++i)
60  {
61  (*_prop_dg[i])[_qp] = 0.0;
62  for (unsigned int j = i; j < _num_eta; ++j)
63  (*_prop_d2g[i][j])[_qp] = 0.0;
64  }
65 
66  // Create Interface barrier preventing interfaces involving more than two order parameters
67  for (unsigned int i = 0; i < _num_eta; ++i)
68  for (unsigned int j = 0; j < i; ++j)
69  for (unsigned int k = 0; k < j; ++k)
70  {
71  const Real ni = (*_eta[i])[_qp];
72  const Real nj = (*_eta[j])[_qp];
73  const Real nk = (*_eta[k])[_qp];
74 
75  _prop_g[_qp] += ni * ni * nj * nj * nk * nk;
76  (*_prop_dg[i])[_qp] += 2 * ni * nj * nj * nk * nk;
77  (*_prop_dg[j])[_qp] += 2 * ni * ni * nj * nk * nk;
78  (*_prop_dg[k])[_qp] += 2 * ni * ni * nj * nj * nk;
79  (*_prop_d2g[i][i])[_qp] += 2 * nj * nj * nk * nk;
80  (*_prop_d2g[j][j])[_qp] += 2 * ni * ni * nk * nk;
81  (*_prop_d2g[k][k])[_qp] += 2 * ni * ni * nj * nj;
82  (*_prop_d2g[i][j])[_qp] += 4 * ni * nj * nk * nk;
83  (*_prop_d2g[i][k])[_qp] += 4 * ni * nj * nj * nk;
84  (*_prop_d2g[k][j])[_qp] += 4 * ni * ni * nj * nk;
85  }
86 }
ThirdPhaseSuppressionMaterial.h
ThirdPhaseSuppressionMaterial
OPInterfaceBarrierMaterial is a Free Energy Penalty contribution material that acts on all of the eta...
Definition: ThirdPhaseSuppressionMaterial.h:26
ThirdPhaseSuppressionMaterial::computeQpProperties
virtual void computeQpProperties()
Definition: ThirdPhaseSuppressionMaterial.C:55
ThirdPhaseSuppressionMaterial::_num_eta
unsigned int _num_eta
order parameters
Definition: ThirdPhaseSuppressionMaterial.h:38
ThirdPhaseSuppressionMaterial::ThirdPhaseSuppressionMaterial
ThirdPhaseSuppressionMaterial(const InputParameters &parameters)
Definition: ThirdPhaseSuppressionMaterial.C:26
registerMooseObject
registerMooseObject("PhaseFieldApp", ThirdPhaseSuppressionMaterial)
ThirdPhaseSuppressionMaterial::_eta
std::vector< const VariableValue * > _eta
Definition: ThirdPhaseSuppressionMaterial.h:39
ThirdPhaseSuppressionMaterial::_function_name
std::string _function_name
name of the function of eta (used to generate the material property names)
Definition: ThirdPhaseSuppressionMaterial.h:35
ThirdPhaseSuppressionMaterial::_prop_g
MaterialProperty< Real > & _prop_g
Barrier functions and their drivatives.
Definition: ThirdPhaseSuppressionMaterial.h:42
ThirdPhaseSuppressionMaterial::_prop_dg
std::vector< MaterialProperty< Real > * > _prop_dg
Definition: ThirdPhaseSuppressionMaterial.h:43
ThirdPhaseSuppressionMaterial::_prop_d2g
std::vector< std::vector< MaterialProperty< Real > * > > _prop_d2g
Material properties to store the second derivatives.
Definition: ThirdPhaseSuppressionMaterial.h:46
validParams< ThirdPhaseSuppressionMaterial >
InputParameters validParams< ThirdPhaseSuppressionMaterial >()
Definition: ThirdPhaseSuppressionMaterial.C:16