LCOV - code coverage report
Current view: top level - src/userobjects - RichardsSeff2gasRSC.C (source / functions) Hit Total Coverage
Test: idaholab/moose richards: #31405 (292dce) with base fef103 Lines: 28 29 96.6 %
Date: 2025-09-04 07:56:35 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             : //  Rogers-Stallybrass-Clements version of effective saturation of oil (gas) phase
      11             : //  valid for residual saturations = 0, and viscosityOil = 2*viscosityWater.  (the "2" is important
      12             : //  here!).
      13             : // C Rogers, MP Stallybrass and DL Clements "On two phase filtration under gravity and with boundary
      14             : // infiltration: application of a Backlund transformation" Nonlinear Analysis Theory Methods and
      15             : // Applications 7 (1983) 785--799.
      16             : //
      17             : #include "RichardsSeff2gasRSC.h"
      18             : 
      19             : registerMooseObject("RichardsApp", RichardsSeff2gasRSC);
      20             : 
      21             : InputParameters
      22          10 : RichardsSeff2gasRSC::validParams()
      23             : {
      24          10 :   InputParameters params = RichardsSeff::validParams();
      25          20 :   params.addParam<Real>(
      26             :       "oil_viscosity",
      27             :       "Viscosity of oil (gas) phase.  It is assumed this is double the water-phase viscosity");
      28          20 :   params.addParam<Real>("scale_ratio",
      29             :                         "This is porosity/permeability/beta^2, where beta may be "
      30             :                         "chosen by the user (RSC define beta<0, but MOOSE only uses "
      31             :                         "beta^2, so its sign is irrelevant).  It has dimensions "
      32             :                         "[time]");
      33          20 :   params.addParam<Real>("shift", "effective saturation is a function of (Pc - shift)");
      34          10 :   params.addClassDescription("Rogers-Stallybrass-Clements version of effective saturation for the "
      35             :                              "oil (gas) phase, valid for residual saturations = 0, and "
      36             :                              "viscosityOil = 2*viscosityWater.  seff_gas = 1 - 1/Sqrt(1 + Exp((Pc "
      37             :                              "- shift)/scale)), where scale = 0.25*scale_ratio*oil_viscosity");
      38          10 :   return params;
      39           0 : }
      40             : 
      41           5 : RichardsSeff2gasRSC::RichardsSeff2gasRSC(const InputParameters & parameters)
      42             :   : RichardsSeff(parameters),
      43           5 :     _oil_viscosity(getParam<Real>("oil_viscosity")),
      44          10 :     _scale_ratio(getParam<Real>("scale_ratio")),
      45          10 :     _shift(getParam<Real>("shift")),
      46           5 :     _scale(0.25 * _scale_ratio * _oil_viscosity)
      47             : {
      48           5 : }
      49             : 
      50             : Real
      51     1422644 : RichardsSeff2gasRSC::seff(std::vector<const VariableValue *> p, unsigned int qp) const
      52             : {
      53     1422644 :   Real pc = (*p[1])[qp] - (*p[0])[qp];
      54     1422644 :   return 1 - RichardsSeffRSC::seff(pc, _shift, _scale);
      55             : }
      56             : 
      57             : void
      58      798932 : RichardsSeff2gasRSC::dseff(std::vector<const VariableValue *> p,
      59             :                            unsigned int qp,
      60             :                            std::vector<Real> & result) const
      61             : {
      62      798932 :   Real pc = (*p[1])[qp] - (*p[0])[qp];
      63      798932 :   result[1] = -RichardsSeffRSC::dseff(pc, _shift, _scale);
      64      798932 :   result[0] = -result[1];
      65      798932 : }
      66             : 
      67             : void
      68      466932 : RichardsSeff2gasRSC::d2seff(std::vector<const VariableValue *> p,
      69             :                             unsigned int qp,
      70             :                             std::vector<std::vector<Real>> & result) const
      71             : {
      72      466932 :   Real pc = (*p[1])[qp] - (*p[0])[qp];
      73      466932 :   result[1][1] = -RichardsSeffRSC::d2seff(pc, _shift, _scale);
      74      466932 :   result[0][1] = -result[1][1];
      75      466932 :   result[1][0] = -result[1][1];
      76      466932 :   result[0][0] = result[1][1];
      77      466932 : }

Generated by: LCOV version 1.14