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 : // shifted van-Genuchten gas effective saturation as a function of (Pwater, Pgas), and its derivs 11 : // wrt to that pressure 12 : // 13 : #include "RichardsSeff2gasVGshifted.h" 14 : 15 : registerMooseObject("RichardsApp", RichardsSeff2gasVGshifted); 16 : 17 : InputParameters 18 4 : RichardsSeff2gasVGshifted::validParams() 19 : { 20 4 : InputParameters params = RichardsSeff::validParams(); 21 8 : params.addRequiredRangeCheckedParam<Real>( 22 : "al", 23 : "al > 0", 24 : "van-Genuchten alpha parameter. Must be positive. seff = (1 + " 25 : "(-al*(P0-P1-shift))^(1/(1-m)))^(-m) (then scaled to 0 to 1)"); 26 8 : params.addRequiredRangeCheckedParam<Real>( 27 : "m", 28 : "m > 0 & m < 1", 29 : "van-Genuchten m parameter. Must be between 0 and 1, and optimally " 30 : "should be set to >0.5 seff = (1 + " 31 : "(-al*(P0-P1-shift)^(1/(1-m)))^(-m) (then scaled to 0 to 1)"); 32 8 : params.addRequiredRangeCheckedParam<Real>( 33 : "shift", 34 : "shift > 0", 35 : "Shift in capillary-pressure porepressure values. Standard " 36 : "van-Genuchten Seff = Seff(Pwater-Pgas) is shifted to the right, and " 37 : "then scaled to 0<=Seff<=1. This means that dS/dP>0 at S=1 which is " 38 : "useful to provide nonsingular Jacobians for small dt."); 39 4 : params.addClassDescription("Shifted van-Genuchten effective saturation as a function of (Pwater, " 40 : "Pgas) suitable for use for the gas phase in two-phase simulations. " 41 : " seff = (1 + (-al*(P0-p1-shift))^(1/(1-m)))^(-m), then scaled so it " 42 : "runs between 0 and 1."); 43 4 : return params; 44 0 : } 45 : 46 2 : RichardsSeff2gasVGshifted::RichardsSeff2gasVGshifted(const InputParameters & parameters) 47 : : RichardsSeff(parameters), 48 2 : _al(getParam<Real>("al")), 49 4 : _m(getParam<Real>("m")), 50 6 : _shift(getParam<Real>("shift")) 51 : { 52 2 : _scale = RichardsSeffVG::seff(-_shift, _al, _m); 53 2 : } 54 : 55 : Real 56 606 : RichardsSeff2gasVGshifted::seff(std::vector<const VariableValue *> p, unsigned int qp) const 57 : { 58 606 : Real negpc = (*p[0])[qp] - (*p[1])[qp]; 59 606 : negpc = negpc - _shift; 60 606 : return std::max(1 - RichardsSeffVG::seff(negpc, _al, _m) / _scale, 0.0); 61 : } 62 : 63 : void 64 606 : RichardsSeff2gasVGshifted::dseff(std::vector<const VariableValue *> p, 65 : unsigned int qp, 66 : std::vector<Real> & result) const 67 : { 68 606 : Real negpc = (*p[0])[qp] - (*p[1])[qp]; 69 606 : negpc = negpc - _shift; 70 606 : result[0] = -RichardsSeffVG::dseff(negpc, _al, _m) / _scale; 71 606 : result[1] = -result[0]; 72 606 : } 73 : 74 : void 75 606 : RichardsSeff2gasVGshifted::d2seff(std::vector<const VariableValue *> p, 76 : unsigned int qp, 77 : std::vector<std::vector<Real>> & result) const 78 : { 79 606 : Real negpc = (*p[0])[qp] - (*p[1])[qp]; 80 606 : negpc = negpc - _shift; 81 606 : result[0][0] = -RichardsSeffVG::d2seff(negpc, _al, _m) / _scale; 82 606 : result[0][1] = -result[0][0]; 83 606 : result[1][0] = -result[0][0]; 84 606 : result[1][1] = result[0][0]; 85 606 : }