https://mooseframework.inl.gov
SusceptibilityTimeDerivative.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 
14 
15 template <bool is_ad>
18 {
20  params.addClassDescription(
21  "A modified time derivative Kernel that multiplies the time derivative "
22  "of a variable by a generalized susceptibility");
23  params.addRequiredParam<MaterialPropertyName>(
24  "f_name", "Susceptibility function F defined in a FunctionMaterial");
25  params.addCoupledVar("coupled_variables", "Vector of variable arguments of the susceptibility");
26  return params;
27 }
28 
29 template <bool is_ad>
31  const InputParameters & parameters)
33  parameters),
34  _Chi(this->template getGenericMaterialProperty<Real, is_ad>("f_name"))
35 {
36 }
37 
39  : SusceptibilityTimeDerivativeTempl<false>(parameters),
40  _dChidu(getMaterialPropertyDerivative<Real>("f_name", _var.name())),
41  _dChidarg(_n_args)
42 {
43  // fetch derivatives
44  for (unsigned int i = 0; i < _n_args; ++i)
45  _dChidarg[i] = &getMaterialPropertyDerivative<Real>("f_name", i);
46 }
47 
48 void
50 {
51  validateNonlinearCoupling<Real>("f_name");
52 }
53 
54 Real
56 {
58 }
59 
60 ADReal
62 {
63  return _u_dot[_qp] * _Chi[_qp];
64 }
65 
66 Real
68 {
69  return TimeDerivative::computeQpJacobian() * _Chi[_qp] +
70  TimeDerivative::computeQpResidual() * _dChidu[_qp] * _phi[_j][_qp];
71 }
72 
73 Real
75 {
76  // get the coupled variable jvar is referring to
77  const unsigned int cvar = mapJvarToCvar(jvar);
78 
79  return TimeDerivative::computeQpResidual() * (*_dChidarg[cvar])[_qp] * _phi[_j][_qp];
80 }
virtual Real computeQpResidual() override
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
std::vector< const MaterialProperty< Real > * > _dChidarg
susceptibility derivatives w.r.t. coupled variables
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
InputParameters validParams()
virtual Real computeQpJacobian() override
const std::string name
Definition: Setup.h:20
typename std::conditional< is_ad, ADTimeDerivative, TimeDerivative >::type SusceptibilityTimeDerivativeBase
This calculates the time derivative for a variable multiplied by a generalized susceptibility.
void addCoupledVar(const std::string &name, const std::string &doc_string)
virtual ADReal precomputeQpResidual() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObject("PhaseFieldApp", SusceptibilityTimeDerivative)
void addClassDescription(const std::string &doc_string)
SusceptibilityTimeDerivativeTempl(const InputParameters &parameters)
SusceptibilityTimeDerivative(const InputParameters &parameters)
const GenericMaterialProperty< Real, is_ad > & _Chi
susceptibility
const MaterialProperty< Real > & _dChidu
susceptibility derivative w.r.t. the kernel variable