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

Generated by: LCOV version 1.14