LCOV - code coverage report
Current view: top level - src/materials - PorousFlowMatrixInternalEnergy.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #33380 (547b29) with base 8581c3 Lines: 29 30 96.7 %
Date: 2026-07-20 19:40:36 Functions: 8 8 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 "PorousFlowMatrixInternalEnergy.h"
      11             : 
      12             : registerMooseObject("PorousFlowApp", PorousFlowMatrixInternalEnergy);
      13             : registerMooseObject("PorousFlowApp", ADPorousFlowMatrixInternalEnergy);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17        2473 : PorousFlowMatrixInternalEnergyTempl<is_ad>::validParams()
      18             : {
      19        2473 :   InputParameters params = PorousFlowMaterialVectorBase::validParams();
      20        4946 :   params.addRequiredParam<Real>("specific_heat_capacity",
      21             :                                 "Specific heat capacity of the rock grains (J/kg/K).");
      22        4946 :   params.addRequiredParam<Real>("density", "Density of the rock grains");
      23        4946 :   params.addPrivateParam<std::string>("pf_material_type", "matrix_internal_energy");
      24        2473 :   params.addClassDescription("This Material calculates the internal energy of solid rock grains, "
      25             :                              "which is specific_heat_capacity * density * temperature.  Kernels "
      26             :                              "multiply this by (1 - porosity) to find the energy density of the "
      27             :                              "porous rock in a rock-fluid system");
      28        2473 :   return params;
      29           0 : }
      30             : 
      31             : template <bool is_ad>
      32        1920 : PorousFlowMatrixInternalEnergyTempl<is_ad>::PorousFlowMatrixInternalEnergyTempl(
      33             :     const InputParameters & parameters)
      34             :   : PorousFlowMaterialVectorBase(parameters),
      35        1920 :     _cp(getParam<Real>("specific_heat_capacity")),
      36        3840 :     _density(getParam<Real>("density")),
      37        1920 :     _heat_cap(_cp * _density),
      38        3750 :     _temperature(getGenericMaterialProperty<Real, is_ad>(
      39        1920 :         _dictator.isFV() ? "PorousFlow_temperature_qp" : "PorousFlow_temperature_nodal")),
      40        1920 :     _dtemperature_dvar(
      41             :         is_ad ? nullptr
      42        1788 :               : &getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_nodal_dvar")),
      43        3840 :     _energy(declareGenericProperty<Real, is_ad>("PorousFlow_matrix_internal_energy_nodal")),
      44        1920 :     _denergy_dvar(is_ad ? nullptr
      45        1788 :                         : &declareProperty<std::vector<Real>>(
      46        1920 :                               "dPorousFlow_matrix_internal_energy_nodal_dvar"))
      47             : {
      48        1920 : }
      49             : 
      50             : template <bool is_ad>
      51             : void
      52       98335 : PorousFlowMatrixInternalEnergyTempl<is_ad>::initQpStatefulProperties()
      53             : {
      54       99373 :   _energy[_qp] = _heat_cap * _temperature[_qp];
      55       98335 : }
      56             : 
      57             : template <bool is_ad>
      58             : void
      59     4037634 : PorousFlowMatrixInternalEnergyTempl<is_ad>::computeQpProperties()
      60             : {
      61     4242010 :   _energy[_qp] = _heat_cap * _temperature[_qp];
      62             : 
      63             :   if constexpr (!is_ad)
      64             :   {
      65     3833258 :     (*_denergy_dvar)[_qp].assign(_num_var, 0.0);
      66    12109098 :     for (unsigned v = 0; v < _num_var; ++v)
      67     8275840 :       (*_denergy_dvar)[_qp][v] = _heat_cap * (*_dtemperature_dvar)[_qp][v];
      68             :   }
      69     4037634 : }
      70             : 
      71             : template class PorousFlowMatrixInternalEnergyTempl<false>;
      72             : template class PorousFlowMatrixInternalEnergyTempl<true>;

Generated by: LCOV version 1.14