My Project
RegularizedVanGenuchtenParams.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_VAN_GENUCHTEN_PARAMS_HPP
28 #define OPM_REGULARIZED_VAN_GENUCHTEN_PARAMS_HPP
29 
30 #include "VanGenuchten.hpp"
31 #include "VanGenuchtenParams.hpp"
32 
34 
35 #include <cassert>
36 
37 namespace Opm {
45 template<class TraitsT>
47 {
48  typedef typename TraitsT::Scalar Scalar;
50  typedef ::Opm::VanGenuchten<TraitsT> VanGenuchten;
51 
52 public:
53  using Parent :: finalize;
54 
55  typedef TraitsT Traits;
56 
58  : pcnwLowSw_(0.01)
59  , pcnwHighSw_(0.99)
60  {}
61 
63  : Parent(vgAlpha, vgN)
64  , pcnwLowSw_(0.01)
65  , pcnwHighSw_(0.99)
66  {
67  finalize();
68  }
69 
74  void finalize()
75  {
77 
78  pcnwLow_ = VanGenuchten::twoPhaseSatPcnw(*this, pcnwLowSw_);
79  pcnwSlopeLow_ = dPcnw_dSw_(pcnwLowSw_);
80  pcnwHigh_ = VanGenuchten::twoPhaseSatPcnw(*this, pcnwHighSw_);
81  pcnwSlopeHigh_ = 2*(0.0 - pcnwHigh_)/(1.0 - pcnwHighSw_);
82 
83  Scalar mThreshold = dPcnw_dSw_(pcnwHighSw_);
84 
85  pcnwHighSpline_.set(pcnwHighSw_, 1.0, // x0, x1
86  pcnwHigh_, 0, // y0, y1
87  mThreshold, pcnwSlopeHigh_); // m0, m1
88  }
89 
94  Scalar pcnwLowSw() const
95  { EnsureFinalized::check(); return pcnwLowSw_; }
96 
101  Scalar pcnwLow() const
102  { EnsureFinalized::check(); return pcnwLow_; }
103 
110  Scalar pcnwSlopeLow() const
111  { EnsureFinalized::check(); return pcnwSlopeLow_; }
112 
117  void setPCLowSw(Scalar value)
118  { pcnwLowSw_ = value; }
119 
124  Scalar pcnwHighSw() const
125  { EnsureFinalized::check(); return pcnwHighSw_; }
126 
131  Scalar pcnwHigh() const
132  { EnsureFinalized::check(); return pcnwHigh_; }
133 
139  { EnsureFinalized::check(); return pcnwHighSpline_; }
140 
147  Scalar pcnwSlopeHigh() const
148  { EnsureFinalized::check(); return pcnwSlopeHigh_; }
149 
154  void setPCHighSw(Scalar value)
155  { pcnwHighSw_ = value; }
156 
157 private:
158  Scalar dPcnw_dSw_(Scalar Sw) const
159  {
160  // use finite differences to calculate the derivative w.r.t. Sw of the
161  // unregularized curve's capillary pressure.
162  const Scalar eps = 1e-7;
163  Scalar pc1 = VanGenuchten::twoPhaseSatPcnw(*this, Sw - eps);
164  Scalar pc2 = VanGenuchten::twoPhaseSatPcnw(*this, Sw + eps);
165  return (pc2 - pc1)/(2*eps);
166  }
167 
168  Scalar pcnwLowSw_;
169  Scalar pcnwHighSw_;
170 
171  Scalar pcnwLow_;
172  Scalar pcnwHigh_;
173 
174  Scalar pcnwSlopeLow_;
175  Scalar pcnwSlopeHigh_;
176 
177  Spline<Scalar> pcnwHighSpline_;
178 };
179 } // namespace Opm
180 
181 #endif
Class implementing cubic splines.
Specification of the material parameters for the van Genuchten constitutive relations.
Implementation of the van Genuchten capillary pressure - saturation relation.
void finalize()
Mark the object as finalized.
Definition: EnsureFinalized.hpp:75
Parameters that are necessary for the regularization of VanGenuchten "material law".
Definition: RegularizedVanGenuchtenParams.hpp:47
Scalar pcnwHigh() const
Return the capillary pressure at the high threshold saturation of the wetting phase.
Definition: RegularizedVanGenuchtenParams.hpp:131
Scalar pcnwHighSw() const
Return the threshold saturation below which the capillary pressure is regularized.
Definition: RegularizedVanGenuchtenParams.hpp:124
void finalize()
Calculate all dependent quantities once the independent quantities of the parameter object have been ...
Definition: RegularizedVanGenuchtenParams.hpp:74
Scalar pcnwLow() const
Return the capillary pressure at the low threshold saturation of the wetting phase.
Definition: RegularizedVanGenuchtenParams.hpp:101
Scalar pcnwLowSw() const
Return the threshold saturation below which the capillary pressure is regularized.
Definition: RegularizedVanGenuchtenParams.hpp:94
void setPCLowSw(Scalar value)
Set the threshold saturation below which the capillary pressure is regularized.
Definition: RegularizedVanGenuchtenParams.hpp:117
void setPCHighSw(Scalar value)
Set the threshold saturation below which the capillary pressure is regularized.
Definition: RegularizedVanGenuchtenParams.hpp:154
Scalar pcnwSlopeLow() const
Return the slope capillary pressure curve if Sw is smaller or equal to the low threshold saturation.
Definition: RegularizedVanGenuchtenParams.hpp:110
const Spline< Scalar > & pcnwHighSpline() const
Return the spline curve which ought to be used between the upper threshold saturation and 1.
Definition: RegularizedVanGenuchtenParams.hpp:138
Scalar pcnwSlopeHigh() const
Return the slope capillary pressure curve if Sw is larger or equal to 1.
Definition: RegularizedVanGenuchtenParams.hpp:147
Class implementing cubic splines.
Definition: Spline.hpp:91
Specification of the material parameters for the van Genuchten constitutive relations.
Definition: VanGenuchtenParams.hpp:45
Scalar vgN() const
Return the shape parameter of van Genuchten's curve.
Definition: VanGenuchtenParams.hpp:98
Scalar vgAlpha() const
Return the shape parameter of van Genuchten's curve.
Definition: VanGenuchtenParams.hpp:68
Implementation of the van Genuchten capillary pressure - saturation relation.
Definition: VanGenuchten.hpp:56
static Evaluation twoPhaseSatPcnw(const Params &params, const Evaluation &Sw)
The saturation-capillary pressure curve according to van Genuchten using a material law specific API.
Definition: VanGenuchten.hpp:194