19 "Penalty kernel to constrain the sum of all switching functions in a multiphase system.");
20 params.
addParam<std::vector<MaterialPropertyName>>(
21 "h_names",
"Switching Function Materials that provide h(eta_i)");
23 params.
addParam<
Real>(
"penalty", 1.0,
"Penalty scaling factor");
29 _h_names(getParam<
std::vector<MaterialPropertyName>>(
"h_names")),
30 _num_h(_h_names.size()),
33 _penalty(getParam<
Real>(
"penalty")),
34 _number_of_nl_variables(_sys.nVariables()),
35 _j_eta(_number_of_nl_variables, -1),
39 if (
_num_h != coupledComponents(
"etas"))
40 paramError(
"h_names",
"Need to pass in as many h_names as etas");
43 for (
unsigned int i = 0; i <
_num_h; ++i)
45 _h[i] = &getMaterialPropertyByName<Real>(
_h_names[i]);
46 _dh[i] = &getMaterialPropertyDerivative<Real>(
_h_names[i], coupledName(
"etas", i));
49 unsigned int num = coupled(
"etas", i);
54 if (num == _var.number())
59 paramError(
"etas",
"Kernel variable must be listed in etas");
61 _d2h = &getMaterialPropertyDerivative<Real>(
_h_names[
_a], _var.name(), _var.name());
68 for (
unsigned int i = 0; i <
_num_h; ++i)
78 for (
unsigned int i = 0; i <
_num_h; ++i)
81 return _test[_i][_qp] *
_penalty * _phi[_j][_qp] * 2.0 *
82 ((*
_dh[
_a])[_qp] * (*
_dh[
_a])[_qp] + g * (*_d2h)[_qp]);
88 const int eta =
_j_eta[j_var];
91 return _test[_i][_qp] *
_penalty * _phi[_j][_qp] * 2.0 * (*
_dh[eta])[_qp] * (*
_dh[
_a])[_qp];
static InputParameters validParams()
virtual Real computeQpOffDiagJacobian(unsigned int)
virtual Real computeQpJacobian()
const unsigned int _number_of_nl_variables
number of non-linear variables in the problem
std::vector< const MaterialProperty< Real > * > _h
Switching functions and their drivatives.
static InputParameters validParams()
virtual Real computeQpResidual()
SwitchingFunctionPenalty(const InputParameters ¶meters)
SwitchingFunctionPenalty is a constraint kernel adds a penalty to each order parameter to enforce ...
std::vector< int > _j_eta
eta index for the j_vars in the jacobian computation
std::vector< MaterialPropertyName > _h_names
Switching function names.
const Real _penalty
Penalty pre-factor.
std::vector< const MaterialProperty< Real > * > _dh
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
int _a
Index of the eta this kernel is operating on.
registerMooseObject("PhaseFieldApp", SwitchingFunctionPenalty)
const MaterialProperty< Real > * _d2h