www.mooseframework.org
HeatCapacityConductionTimeDerivative.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<TimeDerivative>();
14  params.addClassDescription("Time derivative term $C_p \\frac{\\partial T}{\\partial t}$ of "
15  "the heat equation with the heat capacity $C_p$ as an argument.");
16 
17  // Density may be changing with deformation, so we must integrate
18  // over current volume by setting the use_displaced_mesh flag.
19  params.set<bool>("use_displaced_mesh") = true;
20 
21  params.addParam<MaterialPropertyName>(
22  "heat_capacity", "heat_capacity", "Property name of the heat capacity material property");
23  params.addCoupledVar("args", "Vector of additional arguments of the heat capacity");
24  return params;
25 }
26 
28  const InputParameters & parameters)
29  : DerivativeMaterialInterface<JvarMapKernelInterface<TimeDerivative>>(parameters),
30  _heat_capacity(getMaterialProperty<Real>("heat_capacity")),
31  _d_heat_capacity_dT(getMaterialPropertyDerivative<Real>("heat_capacity", _var.name()))
32 {
33  // get number of coupled variables
34  unsigned int nvar = _coupled_moose_vars.size();
35 
36  // reserve space for derivatives
37  _d_heat_capacity_dargs.resize(nvar);
38 
39  // iterate over all coupled variables
40  for (unsigned int i = 0; i < nvar; ++i)
42  &getMaterialPropertyDerivative<Real>("heat_capacity", _coupled_moose_vars[i]->name());
43 }
44 
45 Real
47 {
48  return _heat_capacity[_qp] * TimeDerivative::computeQpResidual();
49 }
50 
51 Real
53 {
54  // on-diagonal Jacobian with all terms that may depend on the kernel variable
55  return _heat_capacity[_qp] * TimeDerivative::computeQpJacobian() +
56  _d_heat_capacity_dT[_qp] * _phi[_j][_qp] * TimeDerivative::computeQpResidual();
57 }
58 
59 Real
61 {
62  // get the coupled variable jvar is referring to
63  const unsigned int cvar = mapJvarToCvar(jvar);
64 
65  // off-diagonal contribution with terms that depend on coupled variables
66  return (*_d_heat_capacity_dargs[cvar])[_qp] * _phi[_j][_qp] * TimeDerivative::computeQpResidual();
67 }
const MaterialProperty< Real > & _heat_capacity
Heat capacity and its derivatives with respect to temperature and other coupled variables.
InputParameters validParams< HeatCapacityConductionTimeDerivative >()
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
HeatCapacityConductionTimeDerivative(const InputParameters &parameters)
std::vector< const MaterialProperty< Real > * > _d_heat_capacity_dargs