www.mooseframework.org
SpecificHeatConductionTimeDerivative.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 
15 
16 InputParameters
18 {
19  InputParameters params = TimeDerivative::validParams();
20  params.addClassDescription(
21  "Time derivative term $\\rho c_p \\frac{\\partial T}{\\partial t}$ of "
22  "the heat equation with the specific heat $c_p$ and the density $\\rho$ as arguments.");
23 
24  // Density may be changing with deformation, so we must integrate
25  // over current volume by setting the use_displaced_mesh flag.
26  params.set<bool>("use_displaced_mesh") = true;
27 
28  params.addParam<MaterialPropertyName>(
29  "specific_heat", "specific_heat", "Property name of the specific heat material property");
30  params.addParam<MaterialPropertyName>(
31  "density", "density", "Property name of the density material property");
32  params.addCoupledVar("args", "Vector of additional arguments of the specific heat and density");
33  return params;
34 }
35 
37  const InputParameters & parameters)
38  : DerivativeMaterialInterface<JvarMapKernelInterface<TimeDerivative>>(parameters),
39  _specific_heat(getMaterialProperty<Real>("specific_heat")),
40  _d_specific_heat_dT(getMaterialPropertyDerivative<Real>("specific_heat", _var.name())),
41  _density(getMaterialProperty<Real>("density")),
42  _d_density_dT(getMaterialPropertyDerivative<Real>("density", _var.name()))
43 {
44  // Get number of coupled variables
45  unsigned int nvar = _coupled_moose_vars.size();
46 
47  // reserve space for derivatives
48  _d_specific_heat_dargs.resize(nvar);
49  _d_density_dargs.resize(nvar);
50 
51  // Iterate over all coupled variables
52  for (unsigned int i = 0; i < nvar; ++i)
53  {
54  const std::string iname = _coupled_moose_vars[i]->name();
55  _d_specific_heat_dargs[i] = &getMaterialPropertyDerivative<Real>("specific_heat", iname);
56  _d_density_dargs[i] = &getMaterialPropertyDerivative<Real>("density", iname);
57  }
58 }
59 
60 Real
62 {
63  return _specific_heat[_qp] * _density[_qp] * TimeDerivative::computeQpResidual();
64 }
65 
66 Real
68 {
69  const Real dT = TimeDerivative::computeQpResidual();
70 
71  // on-diagonal Jacobian with all terms that may depend on the kernel variable
72  return _specific_heat[_qp] * _density[_qp] * TimeDerivative::computeQpJacobian() +
73  _d_specific_heat_dT[_qp] * _phi[_j][_qp] * _density[_qp] * dT +
74  _specific_heat[_qp] * _d_density_dT[_qp] * _phi[_j][_qp] * dT;
75 }
76 
77 Real
79 {
80  // get the coupled variable jvar is referring to
81  const unsigned int cvar = mapJvarToCvar(jvar);
82 
83  // off-diagonal contribution with terms that depend on coupled variables
84  const Real dT = TimeDerivative::computeQpResidual();
85  return (*_d_specific_heat_dargs[cvar])[_qp] * _phi[_j][_qp] * _density[_qp] * dT +
86  _specific_heat[_qp] * (*_d_density_dargs[cvar])[_qp] * _phi[_j][_qp] * dT;
87 }
SpecificHeatConductionTimeDerivative::SpecificHeatConductionTimeDerivative
SpecificHeatConductionTimeDerivative(const InputParameters &parameters)
Definition: SpecificHeatConductionTimeDerivative.C:36
SpecificHeatConductionTimeDerivative::_d_density_dargs
std::vector< const MaterialProperty< Real > * > _d_density_dargs
Definition: SpecificHeatConductionTimeDerivative.h:53
SpecificHeatConductionTimeDerivative::_d_density_dT
const MaterialProperty< Real > & _d_density_dT
Definition: SpecificHeatConductionTimeDerivative.h:52
SpecificHeatConductionTimeDerivative::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
Definition: SpecificHeatConductionTimeDerivative.C:78
SpecificHeatConductionTimeDerivative::computeQpResidual
virtual Real computeQpResidual() override
Definition: SpecificHeatConductionTimeDerivative.C:61
SpecificHeatConductionTimeDerivative::_density
const MaterialProperty< Real > & _density
Density and its derivatives with respect to temperature and other coupled variables.
Definition: SpecificHeatConductionTimeDerivative.h:51
registerMooseObject
registerMooseObject("HeatConductionApp", SpecificHeatConductionTimeDerivative)
SpecificHeatConductionTimeDerivative::computeQpJacobian
virtual Real computeQpJacobian() override
Definition: SpecificHeatConductionTimeDerivative.C:67
validParams
InputParameters validParams()
name
const std::string name
Definition: Setup.h:21
SpecificHeatConductionTimeDerivative.h
SpecificHeatConductionTimeDerivative::_specific_heat
const MaterialProperty< Real > & _specific_heat
Specific heat and its derivatives with respect to temperature and other coupled variables.
Definition: SpecificHeatConductionTimeDerivative.h:45
SpecificHeatConductionTimeDerivative::validParams
static InputParameters validParams()
Definition: SpecificHeatConductionTimeDerivative.C:17
SpecificHeatConductionTimeDerivative::_d_specific_heat_dT
const MaterialProperty< Real > & _d_specific_heat_dT
Definition: SpecificHeatConductionTimeDerivative.h:46
defineLegacyParams
defineLegacyParams(SpecificHeatConductionTimeDerivative)
SpecificHeatConductionTimeDerivative::_d_specific_heat_dargs
std::vector< const MaterialProperty< Real > * > _d_specific_heat_dargs
Definition: SpecificHeatConductionTimeDerivative.h:47
SpecificHeatConductionTimeDerivative
A class for defining the time derivative of the heat equation.
Definition: SpecificHeatConductionTimeDerivative.h:31