brookscorey.hh 10 KB
Newer Older
1
2
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
3
/*****************************************************************************
4
 *   See the file COPYING for full copying permissions.                      *
5
 *                                                                           *
6
 *   This program is free software: you can redistribute it and/or modify    *
7
 *   it under the terms of the GNU General Public License as published by    *
8
9
 *   the Free Software Foundation, either version 2 of the License, or       *
 *   (at your option) any later version.                                     *
10
 *                                                                           *
11
12
 *   This program is distributed in the hope that it will be useful,         *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
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 <http://www.gnu.org/licenses/>.   *
18
19
20
21
 *****************************************************************************/
/*!
 * \file
 *
Bernd Flemisch's avatar
Bernd Flemisch committed
22
 * \brief Implementation of the capillary pressure and
23
 * relative permeability <-> saturation relations according to Brooks and Corey.
24
 *
25
26
27
28
29
30
31
32
33
34
 */
#ifndef DUMUX_BROOKS_COREY_HH
#define DUMUX_BROOKS_COREY_HH

#include "brookscoreyparams.hh"

#include <algorithm>

namespace Dumux
{
35
36
/*!
 * \ingroup fluidmatrixinteractionslaws
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
41
 *        absolute to effective saturations and vice versa.
42
 *
43
44
45
 * For general info: EffToAbsLaw
 *
 *\see BrooksCoreyParams
46
47
48
49
50
 */
template <class ScalarT, class ParamsT = BrooksCoreyParams<ScalarT> >
class BrooksCorey
{
public:
51
52
    typedef ParamsT     Params;
    typedef typename    Params::Scalar Scalar;
53
54

    /*!
55
     * \brief The capillary pressure-saturation curve according to Brooks & Corey.
56
     *
57
     * The Brooks-Corey empirical  capillary pressure <-> saturation
58
     * function is given by
59
     *
Alexander Kissinger's avatar
Alexander Kissinger committed
60
     *  \f$\mathrm{
61
        p_C = p_e\overline{S}_w^{-1/\lambda}
Alexander Kissinger's avatar
Alexander Kissinger committed
62
    *  }\f$
63
    *
Alexander Kissinger's avatar
Alexander Kissinger committed
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.
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's avatar
Alexander Kissinger committed
68
     * \return Capillary pressure calculated by Brooks & Corey constitutive relation.
69
     */
70
    static Scalar pc(const Params &params, Scalar swe)
71
    {
72
        assert(0 <= swe && swe <= 1);
73

74
        return params.pe()*pow(swe, -1.0/params.lambda());
75
76
77
    }

    /*!
78
     * \brief The saturation-capillary pressure curve according to Brooks & Corey.
79
80
     *
     * This is the inverse of the capillary pressure-saturation curve:
Alexander Kissinger's avatar
Alexander Kissinger committed
81
82
     * \f$\mathrm{
     \overline{S}_w = (\frac{p_C}{p_e})^{-\lambda}}\f$
83
     *
Alexander Kissinger's avatar
Alexander Kissinger committed
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.
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's avatar
Alexander Kissinger committed
88
     * \return Effective wetting phase saturation calculated as inverse of BrooksCorey constitutive relation.
89
     */
90
    static Scalar sw(const Params &params, Scalar pc)
91
    {
92
        assert(pc >= 0);
93

94
        Scalar tmp = pow(pc/params.pe(), -params.lambda());
95
96
97
98
        return std::min(std::max(tmp, Scalar(0.0)), Scalar(1.0));
    }

    /*!
99
100
     * \brief The partial derivative of the capillary
     *        pressure w.r.t. the effective saturation according to Brooks & Corey.
101
102
     *
     * This is equivalent to
Alexander Kissinger's avatar
Alexander Kissinger committed
103
     * \f$\mathrm{
104
     \frac{\partial p_C}{\partial \overline{S}_w} =
105
     -\frac{p_e}{\lambda} \overline{S}_w^{-1/\lambda - 1}
Alexander Kissinger's avatar
Alexander Kissinger committed
106
     }\f$
107
     *
Alexander Kissinger's avatar
Alexander Kissinger committed
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.
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's avatar
Alexander Kissinger committed
112
     * \return Partial derivative of \f$\mathrm{[p_c]}\f$ w.r.t. effective saturation according to Brooks & Corey.
113
    */
114
    static Scalar dpc_dsw(const Params &params, Scalar swe)
115
    {
116
        assert(0 <= swe && swe <= 1);
117

118
        return - params.pe()/params.lambda() * pow(swe, -1/params.lambda() - 1);
119
120
121
    }

    /*!
122
123
124
     * \brief The partial derivative of the effective
     *        saturation w.r.t. the capillary pressure according to Brooks & Corey.
     *
Alexander Kissinger's avatar
Alexander Kissinger committed
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.
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's avatar
Alexander Kissinger committed
129
     * \return Partial derivative of effective saturation w.r.t. \f$\mathrm{[p_c]}\f$ according to Brooks & Corey.
130
     */
131
    static Scalar dsw_dpc(const Params &params, Scalar pc)
132
    {
133
        assert(pc >= 0);
134

135
        return -params.lambda()/params.pe() * pow(pc/params.pe(), - params.lambda() - 1);
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's avatar
Alexander Kissinger committed
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.
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's avatar
Alexander Kissinger committed
147
     * \return Relative permeability of the wetting phase calculated as implied by Brooks & Corey.
148
     */
149
    static Scalar krw(const Params &params, Scalar swe)
150
    {
151
        assert(0 <= swe && swe <= 1);
152

153
        return pow(swe, 2.0/params.lambda() + 3);
154
    }
155
156
157

    /*!
     * \brief The derivative of the relative permeability for the
158
     *        wetting phase with regard to the wetting saturation of the
159
160
     *        medium implied by the Brooks-Corey parameterization.
     *
Alexander Kissinger's avatar
Alexander Kissinger committed
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.
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's avatar
Alexander Kissinger committed
165
     * \return Derivative of the relative permeability of the wetting phase w.r.t. effective wetting phase
166
     *                  saturation calculated as implied by Brooks & Corey.
167
     */
168
    static Scalar dkrw_dsw(const Params &params, Scalar swe)
169
    {
170
        assert(0 <= swe && swe <= 1);
171

172
        return (2.0/params.lambda() + 3)*pow(swe, 2.0/params.lambda() + 2);
173
    }
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's avatar
Alexander Kissinger committed
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.
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's avatar
Alexander Kissinger committed
184
     * \return Relative permeability of the non-wetting phase calculated as implied by Brooks & Corey.
185
     */
186
    static Scalar krn(const Params &params, Scalar swe)
187
    {
188
        assert(0 <= swe && swe <= 1);
189

190
        Scalar exponent = 2.0/params.lambda() + 1;
191
192
        Scalar tmp = 1. - swe;
        return tmp*tmp*(1. - pow(swe, exponent));
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's avatar
Alexander Kissinger committed
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.
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's avatar
Alexander Kissinger committed
205
     * \return Derivative of the relative permeability of the non-wetting phase w.r.t. effective wetting phase
206
     *                  saturation calculated as implied by Brooks & Corey.
207
     */
208
    static Scalar dkrn_dsw(const Params &params, Scalar swe)
209
    {
210
        assert(0 <= swe && swe <= 1);
211
212

        return
213
            2.0*(swe - 1)*(
214
                1 +
215
                pow(swe, 2.0/params.lambda())*(
216
                    1.0/params.lambda() + 1.0/2 -
217
                    swe*(1.0/params.lambda() + 1.0/2)
218
219
                    )
                );
220
221
    }

222
223
224
225
};
}

#endif // BROOKS_COREY_HH