www.mooseframework.org
CoupledSusceptibilityTimeDerivative.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 /****************************************************************/
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<CoupledTimeDerivative>();
14  params.addClassDescription("A modified coupled time derivative Kernel that multiplies the time "
15  "derivative of a coupled variable by a generalized susceptibility");
16  params.addRequiredParam<MaterialPropertyName>(
17  "f_name", "Susceptibility function F defined in a FunctionMaterial");
18  params.addCoupledVar("args", "Vector of arguments of the susceptibility");
19  return params;
20 }
21 
23  const InputParameters & parameters)
24  : DerivativeMaterialInterface<JvarMapKernelInterface<CoupledTimeDerivative>>(parameters),
25  _F(getMaterialProperty<Real>("f_name")),
26  _dFdu(getMaterialPropertyDerivative<Real>("f_name", _var.name())),
27  _dFdarg(_coupled_moose_vars.size())
28 {
29  // fetch derivatives
30  for (unsigned int i = 0; i < _dFdarg.size(); ++i)
31  _dFdarg[i] = &getMaterialPropertyDerivative<Real>("f_name", _coupled_moose_vars[i]->name());
32 }
33 
34 void
36 {
37  validateNonlinearCoupling<Real>("f_name");
38 }
39 
40 Real
42 {
43  return CoupledTimeDerivative::computeQpResidual() * _F[_qp];
44 }
45 
46 Real
48 {
49  return CoupledTimeDerivative::computeQpResidual() * _dFdu[_qp] * _phi[_j][_qp];
50 }
51 
52 Real
54 {
55  // get the coupled variable jvar is referring to
56  const unsigned int cvar = mapJvarToCvar(jvar);
57 
58  if (jvar == _v_var)
59  return CoupledTimeDerivative::computeQpOffDiagJacobian(jvar) * _F[_qp] +
60  CoupledTimeDerivative::computeQpResidual() * _phi[_j][_qp] * (*_dFdarg[cvar])[_qp];
61 
62  return CoupledTimeDerivative::computeQpResidual() * _phi[_j][_qp] * (*_dFdarg[cvar])[_qp];
63 }
std::vector< const MaterialProperty< Real > * > _dFdarg
function derivatives w.r.t. coupled variables
InputParameters validParams< CoupledSusceptibilityTimeDerivative >()
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const MaterialProperty< Real > & _dFdu
function derivative w.r.t. the kernel variable
CoupledSusceptibilityTimeDerivative(const InputParameters &parameters)
const MaterialProperty< Real > & _F
The function multiplied by the coupled time derivative.