www.mooseframework.org
SusceptibilityTimeDerivative.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<TimeDerivative>();
19  params.addClassDescription(
20  "A modified time derivative Kernel that multiplies the time derivative "
21  "of a variable by a generalized susceptibility");
22  params.addRequiredParam<MaterialPropertyName>(
23  "f_name", "Susceptibility function F defined in a FunctionMaterial");
24  params.addCoupledVar("args", "Vector of arguments of the susceptibility");
25  return params;
26 }
27 
29  : DerivativeMaterialInterface<JvarMapKernelInterface<TimeDerivative>>(parameters),
30  _Chi(getMaterialProperty<Real>("f_name")),
31  _dChidu(getMaterialPropertyDerivative<Real>("f_name", _var.name())),
32  _dChidarg(_coupled_moose_vars.size())
33 {
34  // fetch derivatives
35  for (unsigned int i = 0; i < _dChidarg.size(); ++i)
36  _dChidarg[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 TimeDerivative::computeQpResidual() * _Chi[_qp];
49 }
50 
51 Real
53 {
54  return TimeDerivative::computeQpJacobian() * _Chi[_qp] +
55  TimeDerivative::computeQpResidual() * _dChidu[_qp] * _phi[_j][_qp];
56 }
57 
58 Real
60 {
61  // get the coupled variable jvar is referring to
62  const unsigned int cvar = mapJvarToCvar(jvar);
63 
64  return TimeDerivative::computeQpResidual() * (*_dChidarg[cvar])[_qp] * _phi[_j][_qp];
65 }
validParams< SusceptibilityTimeDerivative >
InputParameters validParams< SusceptibilityTimeDerivative >()
Definition: SusceptibilityTimeDerivative.C:16
SusceptibilityTimeDerivative::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: SusceptibilityTimeDerivative.C:59
SusceptibilityTimeDerivative::computeQpResidual
virtual Real computeQpResidual()
Definition: SusceptibilityTimeDerivative.C:46
SusceptibilityTimeDerivative
This calculates the time derivative for a variable multiplied by a generalized susceptibility.
Definition: SusceptibilityTimeDerivative.h:23
SusceptibilityTimeDerivative::_dChidarg
std::vector< const MaterialProperty< Real > * > _dChidarg
susceptibility derivatives w.r.t. coupled variables
Definition: SusceptibilityTimeDerivative.h:42
SusceptibilityTimeDerivative::initialSetup
virtual void initialSetup()
Definition: SusceptibilityTimeDerivative.C:40
name
const std::string name
Definition: Setup.h:21
SusceptibilityTimeDerivative::computeQpJacobian
virtual Real computeQpJacobian()
Definition: SusceptibilityTimeDerivative.C:52
SusceptibilityTimeDerivative.h
SusceptibilityTimeDerivative::_Chi
const MaterialProperty< Real > & _Chi
susceptibility
Definition: SusceptibilityTimeDerivative.h:36
SusceptibilityTimeDerivative::_dChidu
const MaterialProperty< Real > & _dChidu
susceptibility derivative w.r.t. the kernel variable
Definition: SusceptibilityTimeDerivative.h:39
SusceptibilityTimeDerivative::SusceptibilityTimeDerivative
SusceptibilityTimeDerivative(const InputParameters &parameters)
Definition: SusceptibilityTimeDerivative.C:28
registerMooseObject
registerMooseObject("PhaseFieldApp", SusceptibilityTimeDerivative)