LCOV - code coverage report
Current view: top level - src/materials - PorousFlowPermeabilityTensorFromVar.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #31405 (292dce) with base fef103 Lines: 19 20 95.0 %
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 "PorousFlowPermeabilityTensorFromVar.h"
      11             : 
      12             : registerMooseObject("PorousFlowApp", PorousFlowPermeabilityTensorFromVar);
      13             : registerMooseObject("PorousFlowApp", ADPorousFlowPermeabilityTensorFromVar);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17         340 : PorousFlowPermeabilityTensorFromVarTempl<is_ad>::validParams()
      18             : {
      19         340 :   InputParameters params = PorousFlowPermeabilityBase::validParams();
      20         680 :   params.addRequiredCoupledVar("perm", "The scalar permeability");
      21         680 :   params.addParam<RealTensorValue>("k_anisotropy",
      22             :                                    "A tensor to multiply the scalar "
      23             :                                    "permeability, in order to obtain anisotropy if "
      24             :                                    "required. Defaults to isotropic permeability "
      25             :                                    "if not specified.");
      26         340 :   params.addClassDescription(
      27             :       "This Material calculates the permeability tensor from a coupled variable "
      28             :       "multiplied by a tensor");
      29         340 :   return params;
      30           0 : }
      31             : 
      32             : template <bool is_ad>
      33         264 : PorousFlowPermeabilityTensorFromVarTempl<is_ad>::PorousFlowPermeabilityTensorFromVarTempl(
      34             :     const InputParameters & parameters)
      35             :   : PorousFlowPermeabilityBaseTempl<is_ad>(parameters),
      36         264 :     _perm(coupledValue("perm")),
      37         462 :     _k_anisotropy(parameters.isParamValid("k_anisotropy")
      38         528 :                       ? this->template getParam<RealTensorValue>("k_anisotropy")
      39         264 :                       : RealTensorValue(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0))
      40             : {
      41         264 : }
      42             : 
      43             : template <bool is_ad>
      44             : void
      45        1296 : PorousFlowPermeabilityTensorFromVarTempl<is_ad>::computeQpProperties()
      46             : {
      47        1296 :   _permeability_qp[_qp] = _k_anisotropy * _perm[_qp];
      48             : 
      49             :   if (!is_ad)
      50             :   {
      51         972 :     (*_dpermeability_qp_dvar)[_qp].resize(_num_var, RealTensorValue());
      52         972 :     (*_dpermeability_qp_dgradvar)[_qp].resize(LIBMESH_DIM);
      53             : 
      54        3888 :     for (const auto i : make_range(Moose::dim))
      55        2916 :       (*_dpermeability_qp_dgradvar)[_qp][i].resize(_num_var, RealTensorValue());
      56             :   }
      57        1296 : }
      58             : 
      59             : template class PorousFlowPermeabilityTensorFromVarTempl<false>;
      60             : template class PorousFlowPermeabilityTensorFromVarTempl<true>;

Generated by: LCOV version 1.14