LCOV - code coverage report
Current view: top level - src/kernels - HeatConductionTimeDerivative.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #31405 (292dce) with base fef103 Lines: 28 29 96.6 %
Date: 2025-09-04 07:53:51 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      10             : #include "HeatConductionTimeDerivative.h"
      11             : 
      12             : registerMooseObject("HeatTransferApp", HeatConductionTimeDerivative);
      13             : 
      14             : InputParameters
      15        1027 : HeatConductionTimeDerivative::validParams()
      16             : {
      17        1027 :   InputParameters params = TimeDerivative::validParams();
      18        1027 :   params.addClassDescription("Time derivative term $\\rho c_p \\frac{\\partial T}{\\partial t}$ of "
      19             :                              "the thermal energy conservation equation.");
      20             : 
      21             :   // Density may be changing with deformation, so we must integrate
      22             :   // over current volume by setting the use_displaced_mesh flag.
      23        1027 :   params.set<bool>("use_displaced_mesh") = true;
      24             : 
      25        2054 :   params.addParam<MaterialPropertyName>(
      26             :       "specific_heat",
      27             :       "specific_heat",
      28             :       "Name of the volumetric isobaric specific heat material property");
      29        2054 :   params.addParam<MaterialPropertyName>(
      30             :       "specific_heat_dT",
      31             :       "Name of the material property for the derivative of the specific heat with respect "
      32             :       "to the variable.");
      33             : 
      34             :   /**
      35             :    * We would like to rename this input parameter to 'density' but gratuitous use of
      36             :    * 'density' in the GlobalParams block of many many Bison simulations (for the
      37             :    * Density kernel)prevent us from doing this.
      38             :    */
      39        2054 :   params.addParam<MaterialPropertyName>(
      40             :       "density_name", "density", "Property name of the density material property");
      41        2054 :   params.addParam<MaterialPropertyName>(
      42             :       "density_name_dT",
      43             :       "Name of material property for the derivative of the density with respect to the variable.");
      44        1027 :   return params;
      45           0 : }
      46             : 
      47         506 : HeatConductionTimeDerivative::HeatConductionTimeDerivative(const InputParameters & parameters)
      48             :   : TimeDerivative(parameters),
      49         506 :     _specific_heat(getMaterialProperty<Real>("specific_heat")),
      50         506 :     _specific_heat_dT(isParamValid("specific_heat_dT")
      51         572 :                           ? &getMaterialProperty<Real>("specific_heat_dT")
      52             :                           : nullptr),
      53        1012 :     _density(getMaterialProperty<Real>("density_name")),
      54        1078 :     _density_dT(isParamValid("density_name_dT") ? &getMaterialProperty<Real>("density_name_dT")
      55         506 :                                                 : nullptr)
      56             : {
      57         506 : }
      58             : 
      59             : Real
      60    87463090 : HeatConductionTimeDerivative::computeQpResidual()
      61             : {
      62    87463090 :   return _specific_heat[_qp] * _density[_qp] * TimeDerivative::computeQpResidual();
      63             : }
      64             : 
      65             : Real
      66   198061570 : HeatConductionTimeDerivative::computeQpJacobian()
      67             : {
      68   198061570 :   auto jac = _specific_heat[_qp] * _density[_qp] * TimeDerivative::computeQpJacobian();
      69   198061570 :   if (_specific_heat_dT)
      70      640000 :     jac += (*_specific_heat_dT)[_qp] * _density[_qp] * _phi[_j][_qp] *
      71      640000 :            TimeDerivative::computeQpResidual();
      72   198061570 :   if (_density_dT)
      73      640000 :     jac += _specific_heat[_qp] * (*_density_dT)[_qp] * _phi[_j][_qp] *
      74      640000 :            TimeDerivative::computeQpResidual();
      75   198061570 :   return jac;
      76             : }

Generated by: LCOV version 1.14