LCOV - code coverage report
Current view: top level - src/kernels - PorousFlowFullySaturatedDarcyFlow.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #33380 (547b29) with base 8581c3 Lines: 21 26 80.8 %
Date: 2026-07-20 19:40:36 Functions: 7 8 87.5 %
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 "PorousFlowFullySaturatedDarcyFlow.h"
      11             : 
      12             : registerMooseObject("PorousFlowApp", PorousFlowFullySaturatedDarcyFlow);
      13             : registerMooseObject("PorousFlowApp", ADPorousFlowFullySaturatedDarcyFlow);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17         605 : PorousFlowFullySaturatedDarcyFlowTempl<is_ad>::validParams()
      18             : {
      19         605 :   InputParameters params = PorousFlowFullySaturatedDarcyBaseTempl<is_ad>::validParams();
      20        1210 :   params.addParam<unsigned int>(
      21        1210 :       "fluid_component", 0, "The index corresponding to the fluid component for this kernel");
      22         605 :   params.addClassDescription(
      23             :       "Darcy flux suitable for models involving a fully-saturated single phase, multi-component "
      24             :       "fluid.  No upwinding is used.");
      25         605 :   return params;
      26           0 : }
      27             : 
      28             : template <bool is_ad>
      29         338 : PorousFlowFullySaturatedDarcyFlowTempl<is_ad>::PorousFlowFullySaturatedDarcyFlowTempl(
      30             :     const InputParameters & parameters)
      31             :   : PorousFlowFullySaturatedDarcyBaseTempl<is_ad>(parameters),
      32         338 :     _mfrac(this->template getGenericMaterialProperty<std::vector<std::vector<Real>>, is_ad>(
      33             :         "PorousFlow_mass_frac_qp")),
      34         338 :     _dmfrac_dvar(
      35             :         is_ad ? nullptr
      36         317 :               : &this->template getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
      37             :                     "dPorousFlow_mass_frac_qp_dvar")),
      38        1014 :     _fluid_component(this->template getParam<unsigned int>("fluid_component"))
      39             : {
      40         338 :   if (_fluid_component >= _dictator.numComponents())
      41           0 :     this->paramError(
      42             :         "fluid_component",
      43             :         "The Dictator proclaims that the maximum fluid component index in this simulation is ",
      44           0 :         _dictator.numComponents() - 1,
      45             :         " whereas you have used ",
      46           0 :         _fluid_component,
      47             :         ". Remember that indexing starts at 0. Happiness equals perfection.");
      48         338 : }
      49             : 
      50             : template <bool is_ad>
      51             : GenericReal<is_ad>
      52    43098440 : PorousFlowFullySaturatedDarcyFlowTempl<is_ad>::mobility() const
      53             : {
      54             :   const unsigned ph = 0;
      55    43098440 :   return _mfrac[_qp][ph][_fluid_component] *
      56    43098440 :          PorousFlowFullySaturatedDarcyBaseTempl<is_ad>::mobility();
      57             : }
      58             : 
      59             : template <bool is_ad>
      60             : Real
      61    37693728 : PorousFlowFullySaturatedDarcyFlowTempl<is_ad>::dmobility(unsigned int pvar) const
      62             : {
      63             :   if constexpr (!is_ad)
      64             :   {
      65             :     const unsigned ph = 0;
      66    37693728 :     const Real darcy_mob = PorousFlowFullySaturatedDarcyBaseTempl<is_ad>::mobility();
      67    37693728 :     const Real ddarcy_mob = PorousFlowFullySaturatedDarcyBaseTempl<is_ad>::dmobility(pvar);
      68    37693728 :     return (*_dmfrac_dvar)[_qp][ph][_fluid_component][pvar] * darcy_mob +
      69    37693728 :            _mfrac[_qp][ph][_fluid_component] * ddarcy_mob;
      70             :   }
      71             :   else
      72             :     libmesh_ignore(pvar);
      73           0 :   return 0.0;
      74             : }
      75             : 
      76             : template class PorousFlowFullySaturatedDarcyFlowTempl<false>;
      77             : template class PorousFlowFullySaturatedDarcyFlowTempl<true>;

Generated by: LCOV version 1.14