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 : #pragma once 11 : 12 : #include "MooseTypes.h" 13 : 14 : /** 15 : * Brooks-Corey effective saturation, capillary pressure and relative 16 : * permeability functions. 17 : * 18 : * Note: capillary pressure and relative permeability are functions of effective 19 : * saturation. The derivatives are therefore given wrt effective saturation. These 20 : * derivatives must be multiplied by the derivative of effective saturation wrt 21 : * the true saturation in objects using these relations. 22 : * 23 : * From Brooks, R. H. and A. T. Corey (1966), Properties of porous media affecting 24 : * fluid flow, J. Irrig. Drain. Div., 92, 61-88 25 : */ 26 : 27 : namespace PorousFlowBrooksCorey 28 : { 29 : /** 30 : * Effective saturation as a function of capillary pressure 31 : * Note: seff = 1 for p >= 0 32 : * @param pc capillary pressure 33 : * @param pe threshold entry pressure 34 : * @param lambda Brooks-Corey exponent 35 : * @return effective saturation 36 : */ 37 : Real effectiveSaturation(Real pc, Real pe, Real lambda); 38 : 39 : /** 40 : * Derivative of effective saturation wrt porepressure 41 : * @param pc capillary pressure 42 : * @param pe threshold entry pressure 43 : * @param lambda Brooks-Corey exponent 44 : * @return derivative of effective saturation wrt porepressure 45 : */ 46 : Real dEffectiveSaturation(Real pc, Real pe, Real lambda); 47 : 48 : /** 49 : * Second derivative of effective saturation wrt porepressure 50 : * @param pc capillary pressure 51 : * @param pe threshold entry pressure 52 : * @param lambda Brooks-Corey exponent 53 : * @return second derivative of effective saturation wrt porepressure 54 : */ 55 : Real d2EffectiveSaturation(Real pc, Real pe, Real lambda); 56 : 57 : /** 58 : * Capillary pressure as a function of effective saturation 59 : * 60 : * @param seff effective saturation 61 : * @param pe threshold entry pressure 62 : * @param lambda Brooks-Corey exponent 63 : * @param pc_max maximum capillary pressure (Pa) 64 : * @return capillary pressure (Pa) 65 : */ 66 : Real capillaryPressure(Real seff, Real pe, Real lambda, Real pc_max); 67 : 68 : /** 69 : * Derivative of capillary pressure wrt effective saturation 70 : * 71 : * @param seff effective saturation 72 : * @param pe threshold entry pressure 73 : * @param lambda Brooks-Corey exponent 74 : * @param pc_max maximum capillary pressure (Pa) 75 : * @return derivative of capillary pressure wrt effective saturation 76 : */ 77 : Real dCapillaryPressure(Real seff, Real pe, Real lambda, Real pc_max); 78 : 79 : /** 80 : * Second derivative of capillary pressure wrt effective saturation 81 : * 82 : * @param seff effective saturation 83 : * @param pe threshold entry pressure 84 : * @param lambda Brooks-Corey exponent 85 : * @param pc_max maximum capillary pressure (Pa) 86 : * @return second derivative of capillary pressure wrt effective saturation 87 : */ 88 : Real d2CapillaryPressure(Real seff, Real pe, Real lambda, Real pc_max); 89 : 90 : /** 91 : * Relative permeability of the wetting phase as a function of effective saturation 92 : * @param seff effective saturation 93 : * @param lambda Brooks-Corey exponent 94 : * @return relative permeability 95 : */ 96 : template <typename T> 97 : T 98 173605 : relativePermeabilityW(const T & seff, Real lambda) 99 : { 100 173605 : if (MetaPhysicL::raw_value(seff) <= 0.0) 101 0 : return 0.0; 102 173604 : else if (MetaPhysicL::raw_value(seff) >= 1.0) 103 8064 : return 1.0; 104 : 105 165539 : return std::pow(seff, (2.0 + 3.0 * lambda) / lambda); 106 : } 107 : 108 : /** 109 : * Derivative of relative permeability of the wetting phase wrt to effective saturation 110 : * @param seff effective saturation 111 : * @param lambda Brooks-Corey exponent 112 : * @return derivative of relative permeability wrt effective saturation 113 : */ 114 : Real dRelativePermeabilityW(Real seff, Real lambda); 115 : 116 : /** 117 : * Relative permeability of the non-wetting phase as a function of effective saturation 118 : * @param seff effective saturation 119 : * @param lambda Brooks-Corey exponent 120 : * @return relative permeability 121 : */ 122 : template <typename T> 123 : T 124 225901 : relativePermeabilityNW(const T & seff, Real lambda) 125 : { 126 225901 : if (MetaPhysicL::raw_value(seff) <= 0.0) 127 8064 : return 0.0; 128 216828 : else if (MetaPhysicL::raw_value(seff) >= 1.0) 129 0 : return 1.0; 130 : 131 216829 : return seff * seff * (1.0 - std::pow(1.0 - seff, (2.0 + lambda) / lambda)); 132 : } 133 : 134 : /** 135 : * Derivative of relative permeability of the non-wetting phase wrt to effective saturation 136 : * @param seff effective saturation 137 : * @param lambda Brooks-Corey exponent 138 : * @return derivative of relative permeability wrt effective saturation 139 : */ 140 : Real dRelativePermeabilityNW(Real seff, Real lambda); 141 : }