LCOV - code coverage report
Current view: top level - src/materials - PorousFlow1PhaseHysP.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #31405 (292dce) with base fef103 Lines: 44 45 97.8 %
Date: 2025-09-04 07:55:56 Functions: 5 5 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 "PorousFlow1PhaseHysP.h"
      11             : 
      12             : registerMooseObject("PorousFlowApp", PorousFlow1PhaseHysP);
      13             : 
      14             : InputParameters
      15         773 : PorousFlow1PhaseHysP::validParams()
      16             : {
      17         773 :   InputParameters params = PorousFlowHystereticCapillaryPressure::validParams();
      18        1546 :   params.addRequiredCoupledVar(
      19             :       "porepressure", "Variable that represents the porepressure of the single liquid phase");
      20         773 :   params.addClassDescription(
      21             :       "This Material is used for unsaturated single-phase situations "
      22             :       "where porepressure is the primary variable and the capillary pressure is hysteretic.  The "
      23             :       "hysteretic formulation assumes that the single phase is a liquid");
      24         773 :   return params;
      25           0 : }
      26             : 
      27         602 : PorousFlow1PhaseHysP::PorousFlow1PhaseHysP(const InputParameters & parameters)
      28             :   : PorousFlowHystereticCapillaryPressure(parameters),
      29         198 :     _pc(_nodal_material ? declareProperty<Real>("PorousFlow_hysteretic_capillary_pressure_nodal")
      30         994 :                         : declareProperty<Real>("PorousFlow_hysteretic_capillary_pressure_qp")),
      31         596 :     _porepressure_var(_nodal_material ? coupledDofValues("porepressure")
      32         994 :                                       : coupledValue("porepressure")),
      33         596 :     _gradp_qp_var(coupledGradient("porepressure")),
      34         596 :     _porepressure_varnum(coupled("porepressure")),
      35         596 :     _p_var_num(_dictator.isPorousFlowVariable(_porepressure_varnum)
      36         596 :                    ? _dictator.porousFlowVariableNum(_porepressure_varnum)
      37         602 :                    : 0)
      38             : {
      39         596 :   if (_num_phases != 1)
      40           4 :     mooseError("The Dictator proclaims that the number of phases is ",
      41           2 :                _dictator.numPhases(),
      42             :                " whereas PorousFlow1PhaseHysP can only be used for 1-phase simulations.  Be aware "
      43             :                "that the Dictator has noted your mistake.");
      44         594 : }
      45             : 
      46             : void
      47       12978 : PorousFlow1PhaseHysP::initQpStatefulProperties()
      48             : {
      49       12978 :   PorousFlowHystereticCapillaryPressure::initQpStatefulProperties();
      50       12978 :   buildQpPPSS();
      51       12978 : }
      52             : 
      53             : void
      54      127878 : PorousFlow1PhaseHysP::computeQpProperties()
      55             : {
      56             :   // size stuff correctly and prepare the derivative matrices with zeroes
      57      127878 :   PorousFlowHystereticCapillaryPressure::computeQpProperties();
      58             : 
      59      127878 :   buildQpPPSS();
      60      127878 :   const Real pc = -_porepressure_var[_qp];
      61      127878 :   const Real ds = -dliquidSaturationQp(pc);
      62             : 
      63      127878 :   if (!_nodal_material)
      64             :   {
      65       72474 :     (*_gradp_qp)[_qp][0] = _gradp_qp_var[_qp];
      66       72474 :     (*_grads_qp)[_qp][0] = ds * _gradp_qp_var[_qp];
      67             :   }
      68             : 
      69             :   // _porepressure is only dependent on _porepressure, and its derivative is 1
      70      127878 :   if (_dictator.isPorousFlowVariable(_porepressure_varnum))
      71             :   {
      72             :     // _porepressure is a PorousFlow variable
      73      127878 :     (*_dporepressure_dvar)[_qp][0][_p_var_num] = 1.0;
      74      127878 :     (*_dsaturation_dvar)[_qp][0][_p_var_num] = ds;
      75      127878 :     if (!_nodal_material)
      76             :     {
      77       72474 :       (*_dgradp_qp_dgradv)[_qp][0][_p_var_num] = 1.0;
      78       72474 :       (*_dgrads_qp_dgradv)[_qp][0][_p_var_num] = ds;
      79       72474 :       (*_dgrads_qp_dv)[_qp][0][_p_var_num] = d2liquidSaturationQp(pc) * _gradp_qp_var[_qp];
      80             :     }
      81             :   }
      82      127878 : }
      83             : 
      84             : void
      85      140856 : PorousFlow1PhaseHysP::buildQpPPSS()
      86             : {
      87      140856 :   _porepressure[_qp][0] = _porepressure_var[_qp];
      88      140856 :   _pc[_qp] = -_porepressure_var[_qp];
      89      140856 :   _saturation[_qp][0] = liquidSaturationQp(_pc[_qp]);
      90      140856 : }

Generated by: LCOV version 1.14