LCOV - code coverage report
Current view: top level - src/materials - PorousFlowDiffusivityMillingtonQuirk.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #31405 (292dce) with base fef103 Lines: 25 26 96.2 %
Date: 2025-09-04 07:55:56 Functions: 3 6 50.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 "PorousFlowDiffusivityMillingtonQuirk.h"
      11             : 
      12             : registerMooseObject("PorousFlowApp", PorousFlowDiffusivityMillingtonQuirk);
      13             : registerMooseObject("PorousFlowApp", ADPorousFlowDiffusivityMillingtonQuirk);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17          41 : PorousFlowDiffusivityMillingtonQuirkTempl<is_ad>::validParams()
      18             : {
      19          41 :   InputParameters params = PorousFlowDiffusivityBaseTempl<is_ad>::validParams();
      20          41 :   params.addClassDescription(
      21             :       "This Material provides saturation-dependent diffusivity using the Millington-Quirk model");
      22          41 :   return params;
      23           0 : }
      24             : 
      25             : template <bool is_ad>
      26          33 : PorousFlowDiffusivityMillingtonQuirkTempl<is_ad>::PorousFlowDiffusivityMillingtonQuirkTempl(
      27             :     const InputParameters & parameters)
      28             :   : PorousFlowDiffusivityBaseTempl<is_ad>(parameters),
      29          33 :     _porosity_qp(this->template getGenericMaterialProperty<Real, is_ad>("PorousFlow_porosity_qp")),
      30          33 :     _dporosity_qp_dvar(is_ad ? nullptr
      31          33 :                              : &this->template getMaterialProperty<std::vector<Real>>(
      32             :                                    "dPorousFlow_porosity_qp_dvar")),
      33          33 :     _saturation_qp(this->template getGenericMaterialProperty<std::vector<Real>, is_ad>(
      34             :         "PorousFlow_saturation_qp")),
      35          33 :     _dsaturation_qp_dvar(is_ad
      36             :                              ? nullptr
      37          33 :                              : &this->template getMaterialProperty<std::vector<std::vector<Real>>>(
      38          33 :                                    "dPorousFlow_saturation_qp_dvar"))
      39             : {
      40          33 : }
      41             : 
      42             : template <bool is_ad>
      43             : void
      44        1260 : PorousFlowDiffusivityMillingtonQuirkTempl<is_ad>::computeQpProperties()
      45             : {
      46        1260 :   PorousFlowDiffusivityBaseTempl<is_ad>::computeQpProperties();
      47             : 
      48        3780 :   for (unsigned int ph = 0; ph < _num_phases; ++ph)
      49             :   {
      50        2520 :     _tortuosity[_qp][ph] =
      51        2520 :         std::cbrt(_porosity_qp[_qp]) * std::pow(_saturation_qp[_qp][ph], 10.0 / 3.0);
      52             : 
      53             :     if (!is_ad)
      54        7560 :       for (unsigned int var = 0; var < _num_var; ++var)
      55        5040 :         (*_dtortuosity_dvar)[_qp][ph][var] = MetaPhysicL::raw_value(
      56        5040 :             1.0 / 3.0 * std::cbrt(_porosity_qp[_qp]) *
      57        5040 :             std::pow(_saturation_qp[_qp][ph], 7.0 / 3.0) *
      58        5040 :             (_saturation_qp[_qp][ph] / _porosity_qp[_qp] * (*_dporosity_qp_dvar)[_qp][var] +
      59        5040 :              10.0 * (*_dsaturation_qp_dvar)[_qp][ph][var]));
      60             :   }
      61        1260 : }
      62             : 
      63             : template class PorousFlowDiffusivityMillingtonQuirkTempl<false>;
      64             : template class PorousFlowDiffusivityMillingtonQuirkTempl<true>;

Generated by: LCOV version 1.14