LCOV - code coverage report
Current view: top level - src/materials - PorousFlowPorosityConst.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #31405 (292dce) with base fef103 Lines: 16 17 94.1 %
Date: 2025-09-04 07:55:56 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 "PorousFlowPorosityConst.h"
      11             : 
      12             : registerMooseObject("PorousFlowApp", PorousFlowPorosityConst);
      13             : registerMooseObject("PorousFlowApp", ADPorousFlowPorosityConst);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17       38774 : PorousFlowPorosityConstTempl<is_ad>::validParams()
      18             : {
      19       38774 :   InputParameters params = PorousFlowPorosityBaseTempl<is_ad>::validParams();
      20       77548 :   params.addRequiredCoupledVar(
      21             :       "porosity",
      22             :       "The porosity (assumed indepenent of porepressure, temperature, "
      23             :       "strain, etc, for this material).  This should be a real number, or "
      24             :       "a constant monomial variable (not a linear lagrange or other kind of variable).");
      25       38774 :   params.addClassDescription("This Material calculates the porosity assuming it is constant");
      26       38774 :   return params;
      27           0 : }
      28             : 
      29             : template <bool is_ad>
      30       30234 : PorousFlowPorosityConstTempl<is_ad>::PorousFlowPorosityConstTempl(
      31             :     const InputParameters & parameters)
      32       30234 :   : PorousFlowPorosityBaseTempl<is_ad>(parameters), _input_porosity(coupledValue("porosity"))
      33             : {
      34       30234 : }
      35             : 
      36             : template <bool is_ad>
      37             : void
      38    84453200 : PorousFlowPorosityConstTempl<is_ad>::initQpStatefulProperties()
      39             : {
      40             :   // note the [0] below: _phi0 is a constant monomial and we use [0] regardless of _nodal_material
      41    84453200 :   _porosity[_qp] = _input_porosity[0];
      42    84453200 : }
      43             : 
      44             : template <bool is_ad>
      45             : void
      46    79578170 : PorousFlowPorosityConstTempl<is_ad>::computeQpProperties()
      47             : {
      48    79578170 :   initQpStatefulProperties();
      49             : 
      50             :   if (!is_ad)
      51             :   {
      52             :     // The derivatives are zero for all time
      53    78820461 :     (*_dporosity_dvar)[_qp].assign(_num_var, 0.0);
      54    78820461 :     (*_dporosity_dgradvar)[_qp].assign(_num_var, RealGradient());
      55             :   }
      56    79578170 : }
      57             : 
      58             : template class PorousFlowPorosityConstTempl<false>;
      59             : template class PorousFlowPorosityConstTempl<true>;

Generated by: LCOV version 1.14