LCOV - code coverage report
Current view: top level - src/materials - PorousFlowDiffusivityConst.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #31405 (292dce) with base fef103 Lines: 16 19 84.2 %
Date: 2025-09-04 07:55:56 Functions: 6 6 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 "PorousFlowDiffusivityConst.h"
      11             : 
      12             : registerMooseObject("PorousFlowApp", PorousFlowDiffusivityConst);
      13             : registerMooseObject("PorousFlowApp", ADPorousFlowDiffusivityConst);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17        1591 : PorousFlowDiffusivityConstTempl<is_ad>::validParams()
      18             : {
      19        1591 :   InputParameters params = PorousFlowDiffusivityBaseTempl<is_ad>::validParams();
      20        3182 :   params.addRequiredParam<std::vector<Real>>(
      21             :       "tortuosity", "List of tortuosities. Order is i) phase 0; ii) phase 1; etc");
      22        1591 :   params.addClassDescription(
      23             :       "This Material provides constant tortuosity and diffusion coefficients");
      24        1591 :   return params;
      25           0 : }
      26             : 
      27             : template <bool is_ad>
      28        1245 : PorousFlowDiffusivityConstTempl<is_ad>::PorousFlowDiffusivityConstTempl(
      29             :     const InputParameters & parameters)
      30             :   : PorousFlowDiffusivityBaseTempl<is_ad>(parameters),
      31        3735 :     _input_tortuosity(this->template getParam<std::vector<Real>>("tortuosity"))
      32             : {
      33             :   // Check that the number of tortuosities entered is equal to the number of phases
      34        1245 :   if (_input_tortuosity.size() != _num_phases)
      35           0 :     this->paramError("tortuosity",
      36             :                      "The number of tortuosity values entered is not equal to the number of phases "
      37             :                      "specified in the Dictator");
      38             : 
      39             :   // Check that all tortuosities are (0, 1]
      40        2742 :   for (unsigned int i = 0; i < _num_phases; ++i)
      41        1497 :     if (_input_tortuosity[i] <= 0.0 || _input_tortuosity[i] > 1)
      42           0 :       this->paramError(
      43             :           "tortuosity",
      44             :           "All tortuosities must be greater than zero and less than (or equal to) one"
      45             :           ".\nNote: the definition of tortuosity used is l/le, where l is the straight line "
      46             :           "length and le is the effective flow length");
      47        1245 : }
      48             : 
      49             : template <bool is_ad>
      50             : void
      51     2065120 : PorousFlowDiffusivityConstTempl<is_ad>::computeQpProperties()
      52             : {
      53     2065120 :   PorousFlowDiffusivityBaseTempl<is_ad>::computeQpProperties();
      54             : 
      55     4461860 :   for (unsigned int ph = 0; ph < _num_phases; ++ph)
      56     2396740 :     _tortuosity[_qp][ph] = _input_tortuosity[ph];
      57     2065120 : }
      58             : 
      59             : template class PorousFlowDiffusivityConstTempl<false>;
      60             : template class PorousFlowDiffusivityConstTempl<true>;

Generated by: LCOV version 1.14