brookscorey.hh 10 KB
 Andreas Lauser committed Dec 16, 2011 1 2 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=4 sw=4 sts=4:  Bernd Flemisch committed Jul 14, 2010 3 /*****************************************************************************  Bernd Flemisch committed Aug 27, 2012 4  * See the file COPYING for full copying permissions. *  Bernd Flemisch committed Jul 14, 2010 5  * *  Andreas Lauser committed Jan 04, 2011 6  * This program is free software: you can redistribute it and/or modify *  Bernd Flemisch committed Jul 14, 2010 7  * it under the terms of the GNU General Public License as published by *  Andreas Lauser committed Jan 04, 2011 8 9  * the Free Software Foundation, either version 2 of the License, or * * (at your option) any later version. *  Bernd Flemisch committed Jul 14, 2010 10  * *  Andreas Lauser committed Jan 04, 2011 11 12  * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of *  Christoph Grueninger committed Sep 18, 2012 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *  Andreas Lauser committed Jan 04, 2011 14 15 16 17  * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . *  Bernd Flemisch committed Jul 14, 2010 18 19 20 21  *****************************************************************************/ /*! * \file *  Bernd Flemisch committed Oct 21, 2010 22  * \brief Implementation of the capillary pressure and  Philipp Nuske committed Nov 10, 2010 23  * relative permeability <-> saturation relations according to Brooks and Corey.  Philipp Nuske committed Nov 11, 2010 24  *  Bernd Flemisch committed Jul 14, 2010 25 26 27 28 29 30 31 32 33 34  */ #ifndef DUMUX_BROOKS_COREY_HH #define DUMUX_BROOKS_COREY_HH #include "brookscoreyparams.hh" #include namespace Dumux {  Philipp Nuske committed Nov 10, 2010 35 36 /*! * \ingroup fluidmatrixinteractionslaws  Bernd Flemisch committed Jul 14, 2010 37 38 39 40  * * \brief Implementation of the Brooks-Corey capillary pressure <-> * saturation relation. This class bundles the "raw" curves * as static members and doesn't concern itself converting  Philipp Nuske committed Nov 10, 2010 41  * absolute to effective saturations and vice versa.  Bernd Flemisch committed Jul 14, 2010 42  *  Philipp Nuske committed Nov 11, 2010 43 44 45  * For general info: EffToAbsLaw * *\see BrooksCoreyParams  Bernd Flemisch committed Jul 14, 2010 46 47 48 49 50  */ template > class BrooksCorey { public:  Philipp Nuske committed Nov 10, 2010 51 52  typedef ParamsT Params; typedef typename Params::Scalar Scalar;  Bernd Flemisch committed Jul 14, 2010 53 54  /*!  Philipp Nuske committed Nov 11, 2010 55  * \brief The capillary pressure-saturation curve according to Brooks & Corey.  Bernd Flemisch committed Jul 14, 2010 56  *  Philipp Nuske committed Nov 10, 2010 57  * The Brooks-Corey empirical capillary pressure <-> saturation  Bernd Flemisch committed Jul 14, 2010 58  * function is given by  Philipp Nuske committed Nov 10, 2010 59  *  Alexander Kissinger committed Sep 08, 2015 60  * \f$\mathrm{  Holger Class committed Mar 31, 2011 61  p_C = p_e\overline{S}_w^{-1/\lambda}  Alexander Kissinger committed Sep 08, 2015 62  * }\f$  Philipp Nuske committed Nov 10, 2010 63  *  Alexander Kissinger committed Sep 08, 2015 64 65  * \param swe Effective saturation of the wetting phase \f$\mathrm{[\overline{S}_w]}\f$ * \param params A container object that is populated with the appropriate coefficients for the respective law.  Thomas Fetzer committed Feb 06, 2014 66 67  * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container is constructed accordingly. Afterwards the values are set there, too.  Alexander Kissinger committed Sep 08, 2015 68  * \return Capillary pressure calculated by Brooks & Corey constitutive relation.  Bernd Flemisch committed Jul 14, 2010 69  */  Bernd Flemisch committed May 29, 2013 70  static Scalar pc(const Params ¶ms, Scalar swe)  Bernd Flemisch committed Jul 14, 2010 71  {  Bernd Flemisch committed May 29, 2013 72  assert(0 <= swe && swe <= 1);  Bernd Flemisch committed Jul 14, 2010 73   Bernd Flemisch committed May 29, 2013 74  return params.pe()*pow(swe, -1.0/params.lambda());  Bernd Flemisch committed Jul 14, 2010 75 76 77  } /*!  Philipp Nuske committed Nov 11, 2010 78  * \brief The saturation-capillary pressure curve according to Brooks & Corey.  Bernd Flemisch committed Jul 14, 2010 79 80  * * This is the inverse of the capillary pressure-saturation curve:  Alexander Kissinger committed Sep 08, 2015 81 82  * \f$\mathrm{ \overline{S}_w = (\frac{p_C}{p_e})^{-\lambda}}\f$  Bernd Flemisch committed Jul 14, 2010 83  *  Alexander Kissinger committed Sep 08, 2015 84 85  * \param pc Capillary pressure \f$\mathrm{[p_C]}\f$ in \f$\mathrm{[Pa]}\f$. * \param params A container object that is populated with the appropriate coefficients for the respective law.  Philipp Nuske committed Nov 10, 2010 86 87  * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too.  Alexander Kissinger committed Sep 08, 2015 88  * \return Effective wetting phase saturation calculated as inverse of BrooksCorey constitutive relation.  Bernd Flemisch committed Jul 14, 2010 89  */  Bernd Flemisch committed May 29, 2013 90  static Scalar sw(const Params ¶ms, Scalar pc)  Bernd Flemisch committed Jul 14, 2010 91  {  Bernd Flemisch committed May 29, 2013 92  assert(pc >= 0);  Bernd Flemisch committed Jul 14, 2010 93   Bernd Flemisch committed May 29, 2013 94  Scalar tmp = pow(pc/params.pe(), -params.lambda());  Bernd Flemisch committed Jul 14, 2010 95 96 97 98  return std::min(std::max(tmp, Scalar(0.0)), Scalar(1.0)); } /*!  Philipp Nuske committed Nov 11, 2010 99 100  * \brief The partial derivative of the capillary * pressure w.r.t. the effective saturation according to Brooks & Corey.  Bernd Flemisch committed Jul 14, 2010 101 102  * * This is equivalent to  Alexander Kissinger committed Sep 08, 2015 103  * \f$\mathrm{  Bernd Flemisch committed Jul 14, 2010 104  \frac{\partial p_C}{\partial \overline{S}_w} =  Holger Class committed Mar 31, 2011 105  -\frac{p_e}{\lambda} \overline{S}_w^{-1/\lambda - 1}  Alexander Kissinger committed Sep 08, 2015 106  }\f$  Philipp Nuske committed Nov 11, 2010 107  *  Alexander Kissinger committed Sep 08, 2015 108 109  * \param swe Effective saturation of the wetting phase \f$\mathrm{[\overline{S}_w]}\f$ * \param params A container object that is populated with the appropriate coefficients for the respective law.  Philipp Nuske committed Nov 10, 2010 110 111  * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too.  Alexander Kissinger committed Sep 08, 2015 112  * \return Partial derivative of \f$\mathrm{[p_c]}\f$ w.r.t. effective saturation according to Brooks & Corey.  Bernd Flemisch committed Jul 14, 2010 113  */  Bernd Flemisch committed May 29, 2013 114  static Scalar dpc_dsw(const Params ¶ms, Scalar swe)  Bernd Flemisch committed Jul 14, 2010 115  {  Bernd Flemisch committed May 29, 2013 116  assert(0 <= swe && swe <= 1);  Bernd Flemisch committed Jul 14, 2010 117   Bernd Flemisch committed May 29, 2013 118  return - params.pe()/params.lambda() * pow(swe, -1/params.lambda() - 1);  Bernd Flemisch committed Jul 14, 2010 119 120 121  } /*!  Philipp Nuske committed Nov 11, 2010 122 123 124  * \brief The partial derivative of the effective * saturation w.r.t. the capillary pressure according to Brooks & Corey. *  Alexander Kissinger committed Sep 08, 2015 125 126  * \param pc Capillary pressure \f$\mathrm{[p_c]}\f$ in \f$\mathrm{[Pa]}\f$. * \param params A container object that is populated with the appropriate coefficients for the respective law.  Philipp Nuske committed Nov 10, 2010 127 128  * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too.  Alexander Kissinger committed Sep 08, 2015 129  * \return Partial derivative of effective saturation w.r.t. \f$\mathrm{[p_c]}\f$ according to Brooks & Corey.  Bernd Flemisch committed Jul 14, 2010 130  */  Bernd Flemisch committed May 29, 2013 131  static Scalar dsw_dpc(const Params ¶ms, Scalar pc)  Bernd Flemisch committed Jul 14, 2010 132  {  Bernd Flemisch committed May 29, 2013 133  assert(pc >= 0);  Bernd Flemisch committed Jul 14, 2010 134   Bernd Flemisch committed May 29, 2013 135  return -params.lambda()/params.pe() * pow(pc/params.pe(), - params.lambda() - 1);  Bernd Flemisch committed Jul 14, 2010 136 137 138 139 140 141 142  } /*! * \brief The relative permeability for the wetting phase of * the medium implied by the Brooks-Corey * parameterization. *  Alexander Kissinger committed Sep 08, 2015 143 144  * \param swe The mobile saturation of the wetting phase. * \param params A container object that is populated with the appropriate coefficients for the respective law.  Thomas Fetzer committed Feb 06, 2014 145 146  * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, * and then the params container is constructed accordingly. Afterwards the values are set there, too.  Alexander Kissinger committed Sep 08, 2015 147  * \return Relative permeability of the wetting phase calculated as implied by Brooks & Corey.  Bernd Flemisch committed Jul 14, 2010 148  */  Bernd Flemisch committed May 29, 2013 149  static Scalar krw(const Params ¶ms, Scalar swe)  Bernd Flemisch committed Jul 14, 2010 150  {  Bernd Flemisch committed May 29, 2013 151  assert(0 <= swe && swe <= 1);  Bernd Flemisch committed Jul 14, 2010 152   Bernd Flemisch committed May 29, 2013 153  return pow(swe, 2.0/params.lambda() + 3);  Christoph Grueninger committed Feb 10, 2014 154  }  Bernd Flemisch committed Jul 14, 2010 155 156 157  /*! * \brief The derivative of the relative permeability for the  Philipp Nuske committed Nov 10, 2010 158  * wetting phase with regard to the wetting saturation of the  Bernd Flemisch committed Jul 14, 2010 159 160  * medium implied by the Brooks-Corey parameterization. *  Alexander Kissinger committed Sep 08, 2015 161 162  * \param swe The mobile saturation of the wetting phase. * \param params A container object that is populated with the appropriate coefficients for the respective law.  Thomas Fetzer committed Feb 06, 2014 163 164  * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, * and then the params container is constructed accordingly. Afterwards the values are set there, too.  Alexander Kissinger committed Sep 08, 2015 165  * \return Derivative of the relative permeability of the wetting phase w.r.t. effective wetting phase  Thomas Fetzer committed Feb 06, 2014 166  * saturation calculated as implied by Brooks & Corey.  Bernd Flemisch committed Jul 14, 2010 167  */  Bernd Flemisch committed May 29, 2013 168  static Scalar dkrw_dsw(const Params ¶ms, Scalar swe)  Bernd Flemisch committed Jul 14, 2010 169  {  Bernd Flemisch committed May 29, 2013 170  assert(0 <= swe && swe <= 1);  Bernd Flemisch committed Jul 14, 2010 171   Bernd Flemisch committed May 29, 2013 172  return (2.0/params.lambda() + 3)*pow(swe, 2.0/params.lambda() + 2);  Christoph Grueninger committed Feb 10, 2014 173  }  Bernd Flemisch committed Jul 14, 2010 174 175 176 177 178 179  /*! * \brief The relative permeability for the non-wetting phase of * the medium as implied by the Brooks-Corey * parameterization. *  Alexander Kissinger committed Sep 08, 2015 180 181  * \param swe The mobile saturation of the wetting phase. * \param params A container object that is populated with the appropriate coefficients for the respective law.  Philipp Nuske committed Nov 10, 2010 182 183  * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container * is constructed accordingly. Afterwards the values are set there, too.  Alexander Kissinger committed Sep 08, 2015 184  * \return Relative permeability of the non-wetting phase calculated as implied by Brooks & Corey.  Bernd Flemisch committed Jul 14, 2010 185  */  Bernd Flemisch committed May 29, 2013 186  static Scalar krn(const Params ¶ms, Scalar swe)  Bernd Flemisch committed Jul 14, 2010 187  {  Bernd Flemisch committed May 29, 2013 188  assert(0 <= swe && swe <= 1);  Bernd Flemisch committed Jul 14, 2010 189   Holger Class committed Mar 31, 2011 190  Scalar exponent = 2.0/params.lambda() + 1;  Bernd Flemisch committed May 29, 2013 191 192  Scalar tmp = 1. - swe; return tmp*tmp*(1. - pow(swe, exponent));  Bernd Flemisch committed Jul 14, 2010 193 194 195 196 197 198 199 200  } /*! * \brief The derivative of the relative permeability for the * non-wetting phase in regard to the wetting saturation of * the medium as implied by the Brooks-Corey * parameterization. *  Alexander Kissinger committed Sep 08, 2015 201 202  * \param swe The mobile saturation of the wetting phase. * \param params A container object that is populated with the appropriate coefficients for the respective law.  Thomas Fetzer committed Feb 06, 2014 203 204  * Therefore, in the (problem specific) spatialParameters first, the material law is chosen, * and then the params container is constructed accordingly. Afterwards the values are set there, too.  Alexander Kissinger committed Sep 08, 2015 205  * \return Derivative of the relative permeability of the non-wetting phase w.r.t. effective wetting phase  Thomas Fetzer committed Feb 06, 2014 206  * saturation calculated as implied by Brooks & Corey.  Bernd Flemisch committed Jul 14, 2010 207  */  Bernd Flemisch committed May 29, 2013 208  static Scalar dkrn_dsw(const Params ¶ms, Scalar swe)  Bernd Flemisch committed Jul 14, 2010 209  {  Bernd Flemisch committed May 29, 2013 210  assert(0 <= swe && swe <= 1);  Bernd Flemisch committed Jul 14, 2010 211 212  return  Bernd Flemisch committed May 29, 2013 213  2.0*(swe - 1)*(  Andreas Lauser committed Jan 20, 2011 214  1 +  Bernd Flemisch committed May 29, 2013 215  pow(swe, 2.0/params.lambda())*(  Holger Class committed Mar 31, 2011 216  1.0/params.lambda() + 1.0/2 -  Bernd Flemisch committed May 29, 2013 217  swe*(1.0/params.lambda() + 1.0/2)  Bernd Flemisch committed Jul 14, 2010 218 219  ) );  Bernd Flemisch committed May 28, 2013 220 221  }  Bernd Flemisch committed Jul 14, 2010 222 223 224 225 }; } #endif // BROOKS_COREY_HH