LCOV - code coverage report
Current view: top level - src/kernels - PorousFlowHeatConduction.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #33416 (b10b36) with base 9fbd27 Lines: 27 30 90.0 %
Date: 2026-07-23 16:19:25 Functions: 8 10 80.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 "PorousFlowHeatConduction.h"
      11             : 
      12             : #include "MooseVariable.h"
      13             : 
      14             : registerMooseObject("PorousFlowApp", PorousFlowHeatConduction);
      15             : registerMooseObject("PorousFlowApp", ADPorousFlowHeatConduction);
      16             : 
      17             : template <bool is_ad>
      18             : InputParameters
      19        1329 : PorousFlowHeatConductionTempl<is_ad>::validParams()
      20             : {
      21             :   InputParameters params = GenericKernel<is_ad>::validParams();
      22        1342 :   params.addRequiredParam<UserObjectName>(
      23             :       "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names");
      24         671 :   params.addClassDescription("Heat conduction in the Porous Flow module");
      25         671 :   return params;
      26           0 : }
      27             : 
      28             : template <bool is_ad>
      29         355 : PorousFlowHeatConductionTempl<is_ad>::PorousFlowHeatConductionTempl(
      30             :     const InputParameters & parameters)
      31             :   : GenericKernel<is_ad>(parameters),
      32         355 :     _dictator(this->template getUserObject<PorousFlowDictator>("PorousFlowDictator")),
      33         710 :     _la(this->template getGenericMaterialProperty<RealTensorValue, is_ad>(
      34             :         "PorousFlow_thermal_conductivity_qp")),
      35         355 :     _dla_dvar(is_ad ? nullptr
      36         348 :                     : &this->template getMaterialProperty<std::vector<RealTensorValue>>(
      37             :                           "dPorousFlow_thermal_conductivity_qp_dvar")),
      38         710 :     _grad_t(this->template getGenericMaterialProperty<RealGradient, is_ad>(
      39             :         "PorousFlow_grad_temperature_qp")),
      40         355 :     _dgrad_t_dvar(is_ad ? nullptr
      41         348 :                         : &this->template getMaterialProperty<std::vector<RealGradient>>(
      42             :                               "dPorousFlow_grad_temperature_qp_dvar")),
      43         355 :     _dgrad_t_dgradvar(is_ad ? nullptr
      44         348 :                             : &this->template getMaterialProperty<std::vector<Real>>(
      45         355 :                                   "dPorousFlow_grad_temperature_qp_dgradvar"))
      46             : {
      47         355 : }
      48             : 
      49             : template <bool is_ad>
      50             : GenericReal<is_ad>
      51     6138328 : PorousFlowHeatConductionTempl<is_ad>::computeQpResidual()
      52             : {
      53     6138328 :   return _grad_test[_i][_qp] * (_la[_qp] * _grad_t[_qp]);
      54             : }
      55             : 
      56             : template <bool is_ad>
      57             : Real
      58    26362556 : PorousFlowHeatConductionTempl<is_ad>::computeQpJacobian()
      59             : {
      60             :   if constexpr (!is_ad)
      61    26362556 :     return computeQpOffDiagJacobian(_var.number());
      62           0 :   return 0.0;
      63             : }
      64             : 
      65             : template <bool is_ad>
      66             : Real
      67    78840888 : PorousFlowHeatConductionTempl<is_ad>::computeQpOffDiagJacobian(unsigned int jvar)
      68             : {
      69             :   if constexpr (!is_ad)
      70             :   {
      71    78840888 :     if (_dictator.notPorousFlowVariable(jvar))
      72             :       return 0.0;
      73    78840888 :     const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
      74    78840888 :     return _grad_test[_i][_qp] *
      75    78840888 :            (((*_dla_dvar)[_qp][pvar] * _grad_t[_qp] + _la[_qp] * (*_dgrad_t_dvar)[_qp][pvar]) *
      76    78840888 :                 _phi[_j][_qp] +
      77    78840888 :             _la[_qp] * (*_dgrad_t_dgradvar)[_qp][pvar] * _grad_phi[_j][_qp]);
      78             :   }
      79             :   else
      80             :     libmesh_ignore(jvar);
      81           0 :   return 0.0;
      82             : }
      83             : 
      84             : template class PorousFlowHeatConductionTempl<false>;
      85             : template class PorousFlowHeatConductionTempl<true>;

Generated by: LCOV version 1.14