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("args", "Vector of variable arguments of the susceptibility");
26  params.deprecateCoupledVar("args", "coupled_variables", "02/27/2024");
27  return params;
28 }
29 
30 template <bool is_ad>
32  const InputParameters & parameters)
34  parameters),
35  _Chi(this->template getGenericMaterialProperty<Real, is_ad>("f_name"))
36 {
37 }
38 
40  : SusceptibilityTimeDerivativeTempl<false>(parameters),
41  _dChidu(getMaterialPropertyDerivative<Real>("f_name", _var.name())),
42  _dChidarg(_n_args)
43 {
44  // fetch derivatives
45  for (unsigned int i = 0; i < _n_args; ++i)
46  _dChidarg[i] = &getMaterialPropertyDerivative<Real>("f_name", i);
47 }
48 
49 void
51 {
52  validateNonlinearCoupling<Real>("f_name");
53 }
54 
55 Real
57 {
59 }
60 
61 ADReal
63 {
64  return _u_dot[_qp] * _Chi[_qp];
65 }
66 
67 Real
69 {
70  return TimeDerivative::computeQpJacobian() * _Chi[_qp] +
71  TimeDerivative::computeQpResidual() * _dChidu[_qp] * _phi[_j][_qp];
72 }
73 
74 Real
76 {
77  // get the coupled variable jvar is referring to
78  const unsigned int cvar = mapJvarToCvar(jvar);
79 
80  return TimeDerivative::computeQpResidual() * (*_dChidarg[cvar])[_qp] * _phi[_j][_qp];
81 }
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 deprecateCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
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