www.mooseframework.org
CoupledSusceptibilityTimeDerivative.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<CoupledTimeDerivative>();
19  params.addClassDescription("A modified coupled time derivative Kernel that multiplies the time "
20  "derivative of a coupled variable by a generalized susceptibility");
21  params.addRequiredParam<MaterialPropertyName>(
22  "f_name", "Susceptibility function F defined in a FunctionMaterial");
23  params.addCoupledVar("args", "Vector of arguments of the susceptibility");
24  return params;
25 }
26 
28  const InputParameters & parameters)
29  : DerivativeMaterialInterface<JvarMapKernelInterface<CoupledTimeDerivative>>(parameters),
30  _F(getMaterialProperty<Real>("f_name")),
31  _dFdu(getMaterialPropertyDerivative<Real>("f_name", _var.name())),
32  _dFdarg(_coupled_moose_vars.size())
33 {
34  // fetch derivatives
35  for (unsigned int i = 0; i < _dFdarg.size(); ++i)
36  _dFdarg[i] = &getMaterialPropertyDerivative<Real>("f_name", _coupled_moose_vars[i]->name());
37 }
38 
39 void
41 {
42  validateNonlinearCoupling<Real>("f_name");
43 }
44 
45 Real
47 {
48  return CoupledTimeDerivative::computeQpResidual() * _F[_qp];
49 }
50 
51 Real
53 {
54  return CoupledTimeDerivative::computeQpResidual() * _dFdu[_qp] * _phi[_j][_qp];
55 }
56 
57 Real
59 {
60  // get the coupled variable jvar is referring to
61  const unsigned int cvar = mapJvarToCvar(jvar);
62 
63  if (jvar == _v_var)
64  return CoupledTimeDerivative::computeQpOffDiagJacobian(jvar) * _F[_qp] +
65  CoupledTimeDerivative::computeQpResidual() * _phi[_j][_qp] * (*_dFdarg[cvar])[_qp];
66 
67  return CoupledTimeDerivative::computeQpResidual() * _phi[_j][_qp] * (*_dFdarg[cvar])[_qp];
68 }
CoupledSusceptibilityTimeDerivative::_dFdarg
std::vector< const MaterialProperty< Real > * > _dFdarg
function derivatives w.r.t. coupled variables
Definition: CoupledSusceptibilityTimeDerivative.h:44
CoupledSusceptibilityTimeDerivative.h
CoupledSusceptibilityTimeDerivative::_F
const MaterialProperty< Real > & _F
The function multiplied by the coupled time derivative.
Definition: CoupledSusceptibilityTimeDerivative.h:38
CoupledSusceptibilityTimeDerivative::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: CoupledSusceptibilityTimeDerivative.C:58
validParams< CoupledSusceptibilityTimeDerivative >
InputParameters validParams< CoupledSusceptibilityTimeDerivative >()
Definition: CoupledSusceptibilityTimeDerivative.C:16
CoupledSusceptibilityTimeDerivative
This calculates a modified coupled time derivative that multiplies the time derivative of a coupled v...
Definition: CoupledSusceptibilityTimeDerivative.h:25
CoupledSusceptibilityTimeDerivative::computeQpResidual
virtual Real computeQpResidual()
Definition: CoupledSusceptibilityTimeDerivative.C:46
CoupledSusceptibilityTimeDerivative::initialSetup
virtual void initialSetup()
Definition: CoupledSusceptibilityTimeDerivative.C:40
name
const std::string name
Definition: Setup.h:21
registerMooseObject
registerMooseObject("PhaseFieldApp", CoupledSusceptibilityTimeDerivative)
CoupledSusceptibilityTimeDerivative::CoupledSusceptibilityTimeDerivative
CoupledSusceptibilityTimeDerivative(const InputParameters &parameters)
Definition: CoupledSusceptibilityTimeDerivative.C:27
CoupledSusceptibilityTimeDerivative::computeQpJacobian
virtual Real computeQpJacobian()
Definition: CoupledSusceptibilityTimeDerivative.C:52
CoupledSusceptibilityTimeDerivative::_dFdu
const MaterialProperty< Real > & _dFdu
function derivative w.r.t. the kernel variable
Definition: CoupledSusceptibilityTimeDerivative.h:41