LCOV - code coverage report
Current view: top level - src/materials - PorousFlow1PhaseFullySaturated.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #31405 (292dce) with base fef103 Lines: 35 36 97.2 %
Date: 2025-09-04 07:55:56 Functions: 10 10 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 "PorousFlow1PhaseFullySaturated.h"
      11             : 
      12             : registerMooseObject("PorousFlowApp", PorousFlow1PhaseFullySaturated);
      13             : registerMooseObject("PorousFlowApp", ADPorousFlow1PhaseFullySaturated);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17       16913 : PorousFlow1PhaseFullySaturatedTempl<is_ad>::validParams()
      18             : {
      19       16913 :   InputParameters params = PorousFlowVariableBase::validParams();
      20       33826 :   params.addRequiredCoupledVar("porepressure",
      21             :                                "Variable that represents the porepressure of the single phase");
      22       16913 :   params.addClassDescription("This Material is used for the fully saturated single-phase situation "
      23             :                              "where porepressure is the primary variable");
      24       16913 :   return params;
      25           0 : }
      26             : 
      27             : template <bool is_ad>
      28       13187 : PorousFlow1PhaseFullySaturatedTempl<is_ad>::PorousFlow1PhaseFullySaturatedTempl(
      29             :     const InputParameters & parameters)
      30             :   : PorousFlowVariableBaseTempl<is_ad>(parameters),
      31             : 
      32        5253 :     _porepressure_var(_nodal_material ? this->template coupledGenericDofValue<is_ad>("porepressure")
      33       21121 :                                       : this->template coupledGenericValue<is_ad>("porepressure")),
      34       13187 :     _gradp_qp_var(this->template coupledGenericGradient<is_ad>("porepressure")),
      35       13187 :     _porepressure_varnum(coupled("porepressure")),
      36       13187 :     _p_var_num(_dictator.isPorousFlowVariable(_porepressure_varnum)
      37       13187 :                    ? _dictator.porousFlowVariableNum(_porepressure_varnum)
      38       13187 :                    : 0)
      39             : {
      40       13187 :   if (_num_phases != 1)
      41           2 :     mooseError("The Dictator proclaims that the number of phases is ",
      42           2 :                _dictator.numPhases(),
      43             :                " whereas PorousFlow1PhaseFullySaturated can only be used for 1-phase simulations."
      44             :                " Be aware that the Dictator has noted your mistake.");
      45       13185 : }
      46             : 
      47             : template <bool is_ad>
      48             : void
      49     3687367 : PorousFlow1PhaseFullySaturatedTempl<is_ad>::initQpStatefulProperties()
      50             : {
      51     3687367 :   PorousFlowVariableBaseTempl<is_ad>::initQpStatefulProperties();
      52     3687367 :   buildQpPPSS();
      53     3687367 : }
      54             : 
      55             : template <bool is_ad>
      56             : void
      57    43213140 : PorousFlow1PhaseFullySaturatedTempl<is_ad>::computeQpProperties()
      58             : {
      59             :   // Size vectors correctly and prepare the derivative matrices with zeroes
      60    43213140 :   PorousFlowVariableBaseTempl<is_ad>::computeQpProperties();
      61             : 
      62    43213140 :   buildQpPPSS();
      63             : 
      64    43213140 :   if (!_nodal_material)
      65    25589390 :     (*_gradp_qp)[_qp][0] = _gradp_qp_var[_qp];
      66             : 
      67             :   // _porepressure is only dependent on _porepressure, and its derivative is 1
      68    43060333 :   if (!is_ad && _dictator.isPorousFlowVariable(_porepressure_varnum))
      69             :   {
      70             :     // _porepressure is a PorousFlow variable
      71    41785469 :     (*_dporepressure_dvar)[_qp][0][_p_var_num] = 1.0;
      72    41785469 :     if (!_nodal_material)
      73    24800717 :       (*_dgradp_qp_dgradv)[_qp][0][_p_var_num] = 1.0;
      74             :   }
      75    43213140 : }
      76             : 
      77             : template <bool is_ad>
      78             : void
      79    46900507 : PorousFlow1PhaseFullySaturatedTempl<is_ad>::buildQpPPSS()
      80             : {
      81    46900507 :   _porepressure[_qp][0] = _porepressure_var[_qp];
      82    46900507 :   _saturation[_qp][0] = 1.0;
      83    46900507 : }
      84             : 
      85             : template class PorousFlow1PhaseFullySaturatedTempl<false>;
      86             : template class PorousFlow1PhaseFullySaturatedTempl<true>;

Generated by: LCOV version 1.14