LCOV - code coverage report
Current view: top level - src/interfacekernels - ThinLayerHeatTransfer.C (source / functions) Hit Total Coverage
Test: idaholab/moose heat_transfer: #32971 (54bef8) with base c6cf66 Lines: 64 65 98.5 %
Date: 2026-05-29 20:37:03 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 "ThinLayerHeatTransfer.h"
      11             : 
      12             : registerMooseObject("HeatTransferApp", ThinLayerHeatTransfer);
      13             : 
      14             : InputParameters
      15          73 : ThinLayerHeatTransfer::validParams()
      16             : {
      17          73 :   InputParameters params = InterfaceKernel::validParams();
      18          73 :   params.addClassDescription("Model heat transfer across a thin domain with an interface.");
      19         146 :   params.addParam<MaterialPropertyName>(
      20             :       "specific_heat", "Property name of the specific heat material property of the thin layer");
      21             : 
      22         146 :   params.addParam<MaterialPropertyName>(
      23             :       "density", "Property name of the density material property of the thin layer");
      24             : 
      25         146 :   params.addParam<MaterialPropertyName>(
      26             :       "heat_source", "Property name of the heat source material property of the thin layer");
      27             : 
      28         146 :   params.addParam<MaterialPropertyName>(
      29             :       "thermal_conductivity", "thermal_conductivity", "Property name of the thermal conductivity");
      30             : 
      31         146 :   params.addRequiredParam<Real>("thickness", "The thin layer thickness");
      32          73 :   return params;
      33           0 : }
      34             : 
      35          39 : ThinLayerHeatTransfer::ThinLayerHeatTransfer(const InputParameters & parameters)
      36             :   : InterfaceKernel(parameters),
      37          39 :     _specific_heat(parameters.isParamValid("specific_heat")
      38         101 :                        ? getMaterialProperty<Real>("specific_heat")
      39          16 :                        : getGenericZeroMaterialProperty<Real, false>()),
      40         101 :     _density(parameters.isParamValid("density") ? getMaterialProperty<Real>("density")
      41          16 :                                                 : getGenericZeroMaterialProperty<Real, false>()),
      42          39 :     _heat_source(parameters.isParamValid("heat_source")
      43         101 :                      ? getMaterialProperty<Real>("heat_source")
      44          16 :                      : getGenericZeroMaterialProperty<Real, false>()),
      45          78 :     _thermal_conductivity(getMaterialProperty<Real>("thermal_conductivity")),
      46          78 :     _thickness(getParam<Real>("thickness")),
      47          39 :     _u_dot(_var.uDot()),
      48          39 :     _du_dot_du(_var.duDotDu()),
      49          39 :     _u_dot_neighbor(_var.uDotNeighbor()),
      50          78 :     _du_dot_du_neighbor(_var.duDotDuNeighbor())
      51             : {
      52          39 : }
      53             : 
      54             : Real
      55      420320 : ThinLayerHeatTransfer::computeQpResidual(Moose::DGResidualType type)
      56             : {
      57             :   Real r = 0;
      58             : 
      59      420320 :   switch (type)
      60             :   {
      61      210160 :     case Moose::Element:
      62      210160 :       r = -_test[_i][_qp] * (0.5 * _thickness * _heat_source[_qp] -
      63      420320 :                              _density[_qp] * _specific_heat[_qp] * 0.5 * _thickness * _u_dot[_qp] -
      64      420320 :                              (-_thermal_conductivity[_qp] * (_neighbor_value[_qp] - _u[_qp]) /
      65      210160 :                               std::max(_thickness, libMesh::TOLERANCE)));
      66      210160 :       break;
      67      210160 :     case Moose::Neighbor:
      68      210160 :       r = -_test_neighbor[_i][_qp] *
      69      210160 :           (0.5 * _thickness * _heat_source[_qp] -
      70      420320 :            _density[_qp] * _specific_heat[_qp] * 0.5 * _thickness * _u_dot_neighbor[_qp] -
      71      420320 :            (-_thermal_conductivity[_qp] * (_u[_qp] - _neighbor_value[_qp]) /
      72      210160 :             (std::max(_thickness, libMesh::TOLERANCE))));
      73      210160 :       break;
      74             :   }
      75      420320 :   return r;
      76             : }
      77             : 
      78             : Real
      79      760320 : ThinLayerHeatTransfer::computeQpJacobian(Moose::DGJacobianType type)
      80             : {
      81             :   Real jac = 0;
      82             : 
      83      760320 :   switch (type)
      84             :   {
      85      190080 :     case Moose::ElementElement:
      86      190080 :       jac = -_test[_i][_qp] * (-_density[_qp] * _specific_heat[_qp] * 0.5 * _thickness *
      87      380160 :                                    _du_dot_du[_qp] * _phi[_j][_qp] -
      88      380160 :                                (-_thermal_conductivity[_qp] * -_phi[_j][_qp] /
      89      190080 :                                 std::max(_thickness, libMesh::TOLERANCE)));
      90      190080 :       break;
      91      190080 :     case Moose::NeighborNeighbor:
      92      190080 :       jac = -_test_neighbor[_i][_qp] * (-_density[_qp] * _specific_heat[_qp] * 0.5 * _thickness *
      93      380160 :                                             _du_dot_du_neighbor[_qp] * _phi_neighbor[_j][_qp] -
      94      380160 :                                         (-_thermal_conductivity[_qp] * -_phi_neighbor[_j][_qp] /
      95      190080 :                                          std::max(_thickness, libMesh::TOLERANCE)));
      96      190080 :       break;
      97             : 
      98      190080 :     case Moose::NeighborElement:
      99      190080 :       jac = -_test_neighbor[_i][_qp] * (-(-_thermal_conductivity[_qp] * _phi[_j][_qp] /
     100      190080 :                                           std::max(_thickness, libMesh::TOLERANCE)));
     101      190080 :       break;
     102             : 
     103      190080 :     case Moose::ElementNeighbor:
     104      190080 :       jac = -_test[_i][_qp] * (-(-_thermal_conductivity[_qp] * _phi_neighbor[_j][_qp] /
     105      190080 :                                  std::max(_thickness, libMesh::TOLERANCE)));
     106      190080 :       break;
     107             :   }
     108             : 
     109      760320 :   return jac;
     110             : }

Generated by: LCOV version 1.14