18 InputParameters params = validParams<Kernel>();
19 params.addClassDescription(
20 "Penalty kernel to constrain the sum of all switching functions in a multiphase system.");
21 params.addParam<std::vector<MaterialPropertyName>>(
22 "h_names",
"Switching Function Materials that provide h(eta_i)");
23 params.addRequiredCoupledVar(
"etas",
"eta_i order parameters, one for each h");
24 params.addParam<Real>(
"penalty", 1.0,
"Penalty scaling factor");
29 : DerivativeMaterialInterface<Kernel>(parameters),
30 _h_names(getParam<std::vector<MaterialPropertyName>>(
"h_names")),
31 _num_h(_h_names.size()),
34 _penalty(getParam<Real>(
"penalty")),
35 _number_of_nl_variables(_fe_problem.getNonlinearSystemBase().nVariables()),
36 _j_eta(_number_of_nl_variables, -1),
40 if (
_num_h != coupledComponents(
"etas"))
41 paramError(
"h_names",
"Need to pass in as many h_names as etas");
44 for (
unsigned int i = 0; i <
_num_h; ++i)
46 _h[i] = &getMaterialPropertyByName<Real>(
_h_names[i]);
47 _dh[i] = &getMaterialPropertyDerivative<Real>(
_h_names[i], getVar(
"etas", i)->
name());
50 unsigned int num = coupled(
"etas", i);
55 if (num == _var.number())
60 paramError(
"etas",
"Kernel variable must be listed in etas");
62 _d2h = &getMaterialPropertyDerivative<Real>(
_h_names[
_a], _var.name(), _var.name());
69 for (
unsigned int i = 0; i <
_num_h; ++i)
79 for (
unsigned int i = 0; i <
_num_h; ++i)
82 return _test[_i][_qp] *
_penalty * _phi[_j][_qp] * 2.0 *
83 ((*
_dh[
_a])[_qp] * (*
_dh[
_a])[_qp] + g * (*_d2h)[_qp]);
89 const int eta =
_j_eta[j_var];
92 return _test[_i][_qp] *
_penalty * _phi[_j][_qp] * 2.0 * (*
_dh[eta])[_qp] * (*
_dh[
_a])[_qp];