LCOV - code coverage report
Current view: top level - src/kernels - PorousFlowHeatMassTransfer.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #33380 (547b29) with base 8581c3 Lines: 21 23 91.3 %
Date: 2026-07-20 19:40:36 Functions: 9 12 75.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 "PorousFlowHeatMassTransfer.h"
      11             : 
      12             : #include "MooseVariable.h"
      13             : 
      14             : registerMooseObject("PorousFlowApp", PorousFlowHeatMassTransfer);
      15             : registerMooseObject("PorousFlowApp", ADPorousFlowHeatMassTransfer);
      16             : 
      17             : template <bool is_ad>
      18             : InputParameters
      19         467 : PorousFlowHeatMassTransferTempl<is_ad>::validParams()
      20             : {
      21             :   InputParameters params = GenericKernel<is_ad>::validParams();
      22             : 
      23         240 :   params.addClassDescription(
      24             :       "Calculate heat or mass transfer from a coupled variable v to the variable u. "
      25             :       "No mass lumping is performed here.");
      26         480 :   params.addRequiredCoupledVar(
      27             :       "v", "The variable which is tranfsered to u using a transfer coefficient");
      28         480 :   params.addCoupledVar("transfer_coefficient",
      29             :                        1.0,
      30             :                        "Transfer coefficient for heat or mass transferred between variables");
      31             : 
      32         240 :   return params;
      33           0 : }
      34             : 
      35             : template <bool is_ad>
      36         127 : PorousFlowHeatMassTransferTempl<is_ad>::PorousFlowHeatMassTransferTempl(
      37             :     const InputParameters & parameters)
      38             :   : GenericKernel<is_ad>(parameters),
      39         127 :     _v_var(coupled("v")),
      40         127 :     _v(this->template coupledGenericValue<is_ad>("v")),
      41         254 :     _coef_var(this->template coupledGenericValue<is_ad>("transfer_coefficient"))
      42             : {
      43         127 : }
      44             : 
      45             : template <bool is_ad>
      46             : GenericReal<is_ad>
      47      459376 : PorousFlowHeatMassTransferTempl<is_ad>::computeQpResidual()
      48             : {
      49      460208 :   return _coef_var[_qp] * (_u[_qp] - _v[_qp]) * _test[_i][_qp];
      50             : }
      51             : 
      52             : template <bool is_ad>
      53             : Real
      54      983012 : PorousFlowHeatMassTransferTempl<is_ad>::computeQpJacobian()
      55             : {
      56      983012 :   return jac(_var.number());
      57             : }
      58             : 
      59             : template <bool is_ad>
      60             : Real
      61      955716 : PorousFlowHeatMassTransferTempl<is_ad>::computeQpOffDiagJacobian(unsigned int jvar)
      62             : {
      63      955716 :   return jac(jvar);
      64             : }
      65             : 
      66             : template <bool is_ad>
      67             : Real
      68     1938728 : PorousFlowHeatMassTransferTempl<is_ad>::jac(unsigned int jvar) const
      69             : {
      70             :   if constexpr (!is_ad)
      71             :   {
      72     1938728 :     if (jvar == _var.number())
      73      983012 :       return _coef_var[_qp] * _phi[_j][_qp] * _test[_i][_qp];
      74      955716 :     else if (jvar == _v_var)
      75       18240 :       return -_coef_var[_qp] * _phi[_j][_qp] * _test[_i][_qp];
      76             :     return 0.0;
      77             :   }
      78             :   else
      79             :     libmesh_ignore(jvar);
      80           0 :   return 0.0;
      81             : }
      82             : 
      83             : template class PorousFlowHeatMassTransferTempl<false>;
      84             : template class PorousFlowHeatMassTransferTempl<true>;

Generated by: LCOV version 1.14