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