19 params.addClassDescription(
20 "Enforce the sum of sublattice concentrations to a given phase concentration.");
21 params.addRequiredCoupledVar(
"cs",
"other sublattice concentrations in the same phase");
22 params.addRequiredParam<Real>(
"a",
"Sublattice site fraction for the kernel variable");
23 params.addRequiredParam<std::vector<Real>>(
"as",
"Phase a sublattice site fractions");
24 params.addRequiredCoupledVar(
"sum",
"prescribed sum");
30 _ncs(coupledComponents(
"cs")),
32 _a_cs(getParam<
std::vector<Real>>(
"as")),
33 _cs_map(getParameterJvarMap(
"cs")),
34 _a_u(getParam<Real>(
"a")),
35 _target(coupledValue(
"sum"))
38 paramError(
"as",
"Specify one sublattice site fraction per sublattice concentration variable");
42 for (std::size_t i = 0; i <
_ncs; ++i)
45 paramError(
"as",
"The sum of the 'as' values and 'a' must be greater than zero");
46 for (std::size_t i = 0; i <
_ncs; ++i)
51 for (std::size_t i = 0; i <
_ncs; ++i)
52 _cs[i] = &coupledValue(
"cs", i);
58 Real csum = _u[_qp] *
_a_u;
59 for (std::size_t i = 0; i <
_ncs; ++i)
62 return _test[_i][_qp] * (csum -
_target[_qp]);
68 return _test[_i][_qp] * _phi[_j][_qp] *
_a_u;
76 return _test[_i][_qp] * _phi[_j][_qp] *
_a_cs[csvar];
registerMooseObject("PhaseFieldApp", SLKKSSum)
unsigned int mapJvarToCvar(unsigned int jvar)
static InputParameters validParams()
Enforce the sum of sublattice concentrations to a given phase concentration.
unsigned int _ncs
sublattice A variables
virtual Real computeQpResidual()
std::vector< Real > _a_cs
SLKKSSum(const InputParameters ¶meters)
virtual Real computeQpJacobian()
static InputParameters validParams()
Real _a_u
sublattice fraction for the sublattice B concentration represented by the kernel variable
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const VariableValue & _target
AuxVariable to hold the target sum.
std::vector< const VariableValue * > _cs