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  Copyright (C) 2012-2013 by Andreas Lauser
5  Copyright (C) 2010 by Philipp Nuske
6 
7  This file is part of the Open Porous Media project (OPM).
8 
9  OPM is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 2 of the License, or
12  (at your option) any later version.
13 
14  OPM is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OPM. If not, see <http://www.gnu.org/licenses/>.
21 */
26 #ifndef OPM_REGULARIZED_VAN_GENUCHTEN_PARAMS_HPP
27 #define OPM_REGULARIZED_VAN_GENUCHTEN_PARAMS_HPP
28 
29 #include "VanGenuchten.hpp"
30 #include "VanGenuchtenParams.hpp"
31 
33 
34 #include <cassert>
35 
36 namespace Opm {
44 template<class TraitsT>
46 {
47  typedef typename TraitsT::Scalar Scalar;
50 
51 public:
52  typedef TraitsT Traits;
53 
55  : pcnwLowSw_(0.01)
56  , pcnwHighSw_(0.99)
57  {}
58 
60  : Parent(vgAlpha, vgN)
61  , pcnwLowSw_(0.01)
62  , pcnwHighSw_(0.99)
63  {
64  finalize();
65  }
66 
71  void finalize()
72  {
74 
75  pcnwLow_ = VanGenuchten::twoPhaseSatPcnw(*this, pcnwLowSw_);
76  pcnwSlopeLow_ = dPcnw_dSw_(pcnwLowSw_);
77  pcnwHigh_ = VanGenuchten::twoPhaseSatPcnw(*this, pcnwHighSw_);
78  pcnwSlopeHigh_ = 2*(0.0 - pcnwHigh_)/(1.0 - pcnwHighSw_);
79 
80  Scalar mThreshold = dPcnw_dSw_(pcnwHighSw_);
81 
82  pcnwHighSpline_.set(pcnwHighSw_, 1.0, // x0, x1
83  pcnwHigh_, 0, // y0, y1
84  mThreshold, pcnwSlopeHigh_); // m0, m1
85 
86 #ifndef NDEBUG
87  finalized_ = true;
88 #endif
89  }
90 
95  Scalar pcnwLowSw() const
96  { assertFinalized_(); return pcnwLowSw_; }
97 
102  Scalar pcnwLow() const
103  { assertFinalized_(); return pcnwLow_; }
104 
111  Scalar pcnwSlopeLow() const
112  { assertFinalized_(); return pcnwSlopeLow_; }
113 
118  void setPCLowSw(Scalar value)
119  { pcnwLowSw_ = value; }
120 
125  Scalar pcnwHighSw() const
126  { assertFinalized_(); return pcnwHighSw_; }
127 
132  Scalar pcnwHigh() const
133  { assertFinalized_(); return pcnwHigh_; }
134 
140  { assertFinalized_(); return pcnwHighSpline_; }
141 
148  Scalar pcnwSlopeHigh() const
149  { assertFinalized_(); return pcnwSlopeHigh_; }
150 
155  void setPCHighSw(Scalar value)
156  { pcnwHighSw_ = value; }
157 
158 private:
159 #ifndef NDEBUG
160  void assertFinalized_() const
161  { assert(finalized_); }
162 
163  bool finalized_;
164 #else
165  void assertFinalized_() const
166  { }
167 #endif
168 
169  Scalar dPcnw_dSw_(Scalar Sw) const
170  {
171  // use finite differences to calculate the derivative w.r.t. Sw of the
172  // unregularized curve's capillary pressure.
173  const Scalar eps = 1e-7;
174  Scalar pc1 = VanGenuchten::twoPhaseSatPcnw(*this, Sw - eps);
175  Scalar pc2 = VanGenuchten::twoPhaseSatPcnw(*this, Sw + eps);
176  return (pc2 - pc1)/(2*eps);
177  }
178 
179  Scalar pcnwLowSw_;
180  Scalar pcnwHighSw_;
181 
182  Scalar pcnwLow_;
183  Scalar pcnwHigh_;
184 
185  Scalar pcnwSlopeLow_;
186  Scalar pcnwSlopeHigh_;
187 
188  Spline<Scalar> pcnwHighSpline_;
189 };
190 } // namespace Opm
191 
192 #endif
Scalar pcnwLow() const
Return the capillary pressure at the low threshold saturation of the wetting phase.
Definition: RegularizedVanGenuchtenParams.hpp:102
Definition: Air_Mesitylene.hpp:31
Implementation of the van Genuchten capillary pressure - saturation relation.
Definition: VanGenuchten.hpp:54
void finalize()
Calculate all dependent quantities once the independent quantities of the parameter object have been ...
Definition: RegularizedVanGenuchtenParams.hpp:71
Implementation of the van Genuchten capillary pressure - saturation relation.
void setPCHighSw(Scalar value)
Set the threshold saturation below which the capillary pressure is regularized.
Definition: RegularizedVanGenuchtenParams.hpp:155
const Spline< Scalar > & pcnwHighSpline() const
Return the spline curve which ought to be used between the upper threshold saturation and 1...
Definition: RegularizedVanGenuchtenParams.hpp:139
RegularizedVanGenuchtenParams(Scalar vgAlpha, Scalar vgN)
Definition: RegularizedVanGenuchtenParams.hpp:59
void finalize()
Calculate all dependent quantities once the independent quantities of the parameter object have been ...
Definition: VanGenuchtenParams.hpp:67
Class implementing cubic splines.
Scalar pcnwSlopeLow() const
Return the slope capillary pressure curve if Sw is smaller or equal to the low threshold saturation...
Definition: RegularizedVanGenuchtenParams.hpp:111
Class implementing cubic splines.
Definition: Spline.hpp:89
void setPCLowSw(Scalar value)
Set the threshold saturation below which the capillary pressure is regularized.
Definition: RegularizedVanGenuchtenParams.hpp:118
Scalar vgAlpha() const
Return the shape parameter of van Genuchten's curve.
Definition: VanGenuchtenParams.hpp:78
TraitsT Traits
Definition: RegularizedVanGenuchtenParams.hpp:52
RegularizedVanGenuchtenParams()
Definition: RegularizedVanGenuchtenParams.hpp:54
Scalar vgN() const
Return the shape parameter of van Genuchten's curve.
Definition: VanGenuchtenParams.hpp:108
Parameters that are necessary for the regularization of VanGenuchten "material law".
Definition: RegularizedVanGenuchtenParams.hpp:45
Scalar pcnwHigh() const
Return the capillary pressure at the high threshold saturation of the wetting phase.
Definition: RegularizedVanGenuchtenParams.hpp:132
Scalar pcnwLowSw() const
Return the threshold saturation below which the capillary pressure is regularized.
Definition: RegularizedVanGenuchtenParams.hpp:95
Specification of the material parameters for the van Genuchten constitutive relations.
Definition: VanGenuchtenParams.hpp:42
Specification of the material parameters for the van Genuchten constitutive relations.
Scalar pcnwHighSw() const
Return the threshold saturation below which the capillary pressure is regularized.
Definition: RegularizedVanGenuchtenParams.hpp:125
Scalar pcnwSlopeHigh() const
Return the slope capillary pressure curve if Sw is larger or equal to 1.
Definition: RegularizedVanGenuchtenParams.hpp:148