www.mooseframework.org
KKSMultiACBulkBase.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 /****************************************************************/
7 #include "KKSMultiACBulkBase.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = ACBulk<Real>::validParams();
14  params.addClassDescription("Multi-order parameter KKS model kernel for the Bulk Allen-Cahn. This "
15  "operates on one of the order parameters 'eta_i' as the non-linear "
16  "variable");
17  params.addRequiredParam<std::vector<MaterialPropertyName>>(
18  "Fj_names", "List of free energies for each phase. Place in same order as hj_names!");
19  params.addRequiredParam<std::vector<MaterialPropertyName>>(
20  "hj_names", "Switching Function Materials that provide h. Place in same order as Fj_names!");
21  params.addRequiredCoupledVar("eta_i",
22  "Order parameter that derivatives are taken with respect to");
23  return params;
24 }
25 
26 KKSMultiACBulkBase::KKSMultiACBulkBase(const InputParameters & parameters)
27  : ACBulk<Real>(parameters),
28  _nvar(_coupled_moose_vars.size()), // number of coupled variables
29  _etai_name(getVar("eta_i", 0)->name()),
30  _etai_var(coupled("eta_i", 0)),
31  _Fj_names(getParam<std::vector<MaterialPropertyName>>("Fj_names")),
32  _num_j(_Fj_names.size()),
33  _prop_Fj(_num_j),
34  _prop_dFjdarg(_num_j),
35  _hj_names(getParam<std::vector<MaterialPropertyName>>("hj_names")),
36  _prop_hj(_num_j),
37  _prop_dhjdetai(_num_j),
38  _prop_d2hjdetai2(_num_j),
39  _prop_d2hjdetaidarg(_num_j)
40 {
41  // check passed in parameter vectors
42  if (_num_j != _hj_names.size())
43  mooseError(
44  "Need to pass in as many hj_names as Fj_names in KKSMultiACBulkF and KKSMultiACBulkC ",
45  name());
46 
47  // reserve space and set phase material properties
48  for (unsigned int n = 0; n < _num_j; ++n)
49  {
50  // get phase free energy
51  _prop_Fj[n] = &getMaterialPropertyByName<Real>(_Fj_names[n]);
52  _prop_dFjdarg[n].resize(_nvar);
53 
54  // get switching function and derivatives wrt eta_i, the nonlinear variable
55  _prop_hj[n] = &getMaterialPropertyByName<Real>(_hj_names[n]);
56  _prop_dhjdetai[n] = &getMaterialPropertyDerivative<Real>(_hj_names[n], _etai_name);
57  _prop_d2hjdetai2[n] =
58  &getMaterialPropertyDerivative<Real>(_hj_names[n], _etai_name, _etai_name);
59  _prop_d2hjdetaidarg[n].resize(_nvar);
60 
61  for (unsigned int i = 0; i < _nvar; ++i)
62  {
63  MooseVariable * cvar = _coupled_moose_vars[i];
64  // Get derivatives of all Fj wrt all coupled variables
65  _prop_dFjdarg[n][i] = &getMaterialPropertyDerivative<Real>(_Fj_names[n], cvar->name());
66 
67  // Get second derivatives of all hj wrt eta_i and all coupled variables
68  _prop_d2hjdetaidarg[n][i] =
69  &getMaterialPropertyDerivative<Real>(_hj_names[n], _etai_name, cvar->name());
70  }
71  }
72 }
73 
74 void
76 {
78 
79  for (unsigned int n = 0; n < _num_j; ++n)
80  {
81  validateNonlinearCoupling<Real>(_Fj_names[n]);
82  validateNonlinearCoupling<Real>(_hj_names[n]);
83  }
84 }
unsigned int _nvar
Number of coupled variables.
virtual void initialSetup()
Definition: ACBulk.h:83
InputParameters validParams< KKSMultiACBulkBase >()
std::vector< MaterialPropertyName > _Fj_names
Names of free energy functions for each phase .
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_d2hjdetaidarg
Second derivatives of the switching functions (needed for off-diagonal Jacobians) ...
This is the Allen-Cahn equation base class that implements the bulk or local energy term of the equat...
Definition: ACBulk.h:22
std::vector< const MaterialProperty< Real > * > _prop_dhjdetai
Derivatives of the switching functions wrt the order parameter for this kernel.
std::vector< MaterialPropertyName > _hj_names
switching function names
std::vector< const MaterialProperty< Real > * > _prop_hj
Values of the switching functions for each phase .
virtual void initialSetup()
std::vector< const MaterialProperty< Real > * > _prop_Fj
Values of the free energy functions for each phase .
std::vector< const MaterialProperty< Real > * > _prop_d2hjdetai2
Second derivatives of the switching functions wrt the order parameter for this kernel.
VariableName _etai_name
name of order parameter that derivatives are taken wrt (needed to retrieve the derivative material pr...
KKSMultiACBulkBase(const InputParameters &parameters)
static InputParameters validParams()
Definition: ACBulk.h:72
std::vector< std::vector< const MaterialProperty< Real > * > > _prop_dFjdarg
Derivatives of the free energy functions (needed for off-diagonal Jacobians)