RegularizedBrooksCoreyParams.hpp
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM 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 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
27#ifndef OPM_REGULARIZED_BROOKS_COREY_PARAMS_HPP
28#define OPM_REGULARIZED_BROOKS_COREY_PARAMS_HPP
29
30#include "BrooksCorey.hpp"
31#include "BrooksCoreyParams.hpp"
32
33#include <cassert>
34
36
37namespace Opm {
44template <class TraitsT>
46{
47 typedef ::Opm::BrooksCoreyParams<TraitsT> BrooksCoreyParams;
48 typedef ::Opm::BrooksCorey<TraitsT, RegularizedBrooksCoreyParams> BrooksCorey;
49 typedef typename TraitsT::Scalar Scalar;
50
51public:
52 typedef TraitsT Traits;
53
56 , pcnwLowSw_(0.01)
57 {
58 }
59
62 , pcnwLowSw_(0.01)
63 { finalize(); }
64
69 void finalize()
70 {
72
73 pcnwLow_ = BrooksCorey::twoPhaseSatPcnw(*this, pcnwLowSw_);
74 pcnwSlopeLow_ = dPcnw_dSw_(pcnwLowSw_);
75 pcnwHigh_ = BrooksCorey::twoPhaseSatPcnw(*this, 1.0);
76 pcnwSlopeHigh_ = dPcnw_dSw_(1.0);
77 }
78
83 Scalar pcnwLowSw() const
84 { EnsureFinalized::check(); return pcnwLowSw_; }
85
90 Scalar pcnwLow() const
91 { EnsureFinalized::check(); return pcnwLow_; }
92
99 Scalar pcnwSlopeLow() const
100 { EnsureFinalized::check(); return pcnwSlopeLow_; }
101
106 void setPcLowSw(Scalar value)
107 { pcnwLowSw_ = value; }
108
113 Scalar pcnwHigh() const
114 { EnsureFinalized::check(); return pcnwHigh_; }
115
122 Scalar pcnwSlopeHigh() const
123 { EnsureFinalized::check(); return pcnwSlopeHigh_; }
124
125private:
126 Scalar dPcnw_dSw_(Scalar Sw) const
127 {
128 // use finite differences to calculate the derivative w.r.t. Sw of the
129 // unregularized curve's capillary pressure.
130 const Scalar eps = 1e-7;
131 Scalar delta = 0.0;
132 Scalar pc1;
133 Scalar pc2;
134 if (Sw + eps < 1.0) {
135 pc2 = BrooksCorey::twoPhaseSatPcnw(*this, Sw + eps);
136 delta += eps;
137 }
138 else
139 pc2 = BrooksCorey::twoPhaseSatPcnw(*this, Sw);
140
141 if (Sw - eps > 0.0) {
142 pc1 = BrooksCorey::twoPhaseSatPcnw(*this, Sw - eps);
143 delta += eps;
144 }
145 else
146 pc1 = BrooksCorey::twoPhaseSatPcnw(*this, Sw);
147
148 return (pc2 - pc1)/delta;
149 }
150
151 Scalar pcnwLowSw_;
152 Scalar pcnwLow_;
153 Scalar pcnwSlopeLow_;
154 Scalar pcnwHigh_;
155 Scalar pcnwSlopeHigh_;
156};
157} // namespace Opm
158
159#endif
Specification of the material parameters for the Brooks-Corey constitutive relations.
Definition: BrooksCoreyParams.hpp:47
Scalar lambda() const
Returns the lambda shape parameter.
Definition: BrooksCoreyParams.hpp:81
Scalar entryPressure() const
Returns the entry pressure [Pa].
Definition: BrooksCoreyParams.hpp:68
Implementation of the Brooks-Corey capillary pressure <-> saturation relation.
Definition: BrooksCorey.hpp:54
static Evaluation twoPhaseSatPcnw(const Params &params, const Evaluation &Sw)
Definition: BrooksCorey.hpp:163
void finalize()
Mark the object as finalized.
Definition: EnsureFinalized.hpp:75
void check() const
Definition: EnsureFinalized.hpp:63
Parameters that are necessary for the regularization of the Brooks-Corey capillary pressure model.
Definition: RegularizedBrooksCoreyParams.hpp:46
Scalar pcnwSlopeHigh() const
Return the slope capillary pressure curve if Sw is larger or equal to 1.
Definition: RegularizedBrooksCoreyParams.hpp:122
TraitsT Traits
Definition: RegularizedBrooksCoreyParams.hpp:52
Scalar pcnwLowSw() const
Return the threshold saturation below which the capillary pressure is regularized.
Definition: RegularizedBrooksCoreyParams.hpp:83
RegularizedBrooksCoreyParams()
Definition: RegularizedBrooksCoreyParams.hpp:54
void finalize()
Calculate all dependent quantities once the independent quantities of the parameter object have been ...
Definition: RegularizedBrooksCoreyParams.hpp:69
Scalar pcnwLow() const
Return the capillary pressure at the low threshold saturation of the wetting phase.
Definition: RegularizedBrooksCoreyParams.hpp:90
Scalar pcnwSlopeLow() const
Return the slope capillary pressure curve if Sw is smaller or equal to the low threshold saturation.
Definition: RegularizedBrooksCoreyParams.hpp:99
Scalar pcnwHigh() const
Return the capillary pressure at the high threshold saturation of the wetting phase.
Definition: RegularizedBrooksCoreyParams.hpp:113
RegularizedBrooksCoreyParams(Scalar entryPressure, Scalar lambda)
Definition: RegularizedBrooksCoreyParams.hpp:60
void setPcLowSw(Scalar value)
Set the threshold saturation below which the capillary pressure is regularized.
Definition: RegularizedBrooksCoreyParams.hpp:106
Definition: Air_Mesitylene.hpp:34