opm-common
EclEpsScalingPoints.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_ECL_EPS_SCALING_POINTS_HPP
28 #define OPM_ECL_EPS_SCALING_POINTS_HPP
29 
30 #include <opm/common/utility/gpuDecorators.hpp>
31 
32 #include <array>
33 #include <vector>
34 
35 namespace Opm {
36 
37 class EclEpsConfig;
38 enum class EclTwoPhaseSystemType;
39 
40 class EclipseState;
41 class EclEpsGridProperties;
42 
43 namespace satfunc {
44 struct RawTableEndPoints;
45 struct RawFunctionValues;
46 }
47 
55 template <class Scalar>
57 {
58  // connate saturations
59  Scalar Swl; // water
60  Scalar Sgl; // gas
61 
62  // critical saturations
63  Scalar Swcr; // water
64  Scalar Sgcr; // gas
65  Scalar Sowcr; // oil for the oil-water system
66  Scalar Sogcr; // oil for the gas-oil system
67 
68  // maximum saturations
69  Scalar Swu; // water
70  Scalar Sgu; // gas
71 
72  // maximum capillary pressures
73  Scalar maxPcow; // maximum capillary pressure of the oil-water system
74  Scalar maxPcgo; // maximum capillary pressure of the gas-oil system
75 
76  // the Leverett capillary pressure scaling factors. (those only make sense for the
77  // scaled points, for the unscaled ones they are 1.0.)
78  Scalar pcowLeverettFactor;
79  Scalar pcgoLeverettFactor;
80 
81  // Scaled relative permeabilities at residual displacing saturation
82  Scalar Krwr; // water
83  Scalar Krgr; // gas
84  Scalar Krorw; // oil in water-oil system
85  Scalar Krorg; // oil in gas-oil system
86 
87  // maximum relative permabilities
88  Scalar maxKrw; // maximum relative permability of water
89  Scalar maxKrow; // maximum relative permability of oil in the oil-water system
90  Scalar maxKrog; // maximum relative permability of oil in the gas-oil system
91  Scalar maxKrg; // maximum relative permability of gas
92 
93  bool operator==(const EclEpsScalingPointsInfo<Scalar>& data) const
94  {
95  return (Swl == data.Swl)
96  && (Sgl == data.Sgl)
97  && (Swcr == data.Swcr)
98  && (Sgcr == data.Sgcr)
99  && (Sowcr == data.Sowcr)
100  && (Sogcr == data.Sogcr)
101  && (Swu == data.Swu)
102  && (Sgu == data.Sgu)
103  && (maxPcow == data.maxPcow)
104  && (maxPcgo == data.maxPcgo)
105  && (pcowLeverettFactor == data.pcowLeverettFactor)
106  && (pcgoLeverettFactor == data.pcgoLeverettFactor)
107  && (Krwr == data.Krwr)
108  && (Krgr == data.Krgr)
109  && (Krorw == data.Krorw)
110  && (Krorg == data.Krorg)
111  && (maxKrw == data.maxKrw)
112  && (maxKrow == data.maxKrow)
113  && (maxKrog == data.maxKrog)
114  && (maxKrg == data.maxKrg)
115  ;
116  }
117 
118  void print() const;
119 
127  const satfunc::RawFunctionValues& rfunc,
128  const std::vector<double>::size_type satRegionIdx);
129 
135  void extractScaled(const EclipseState& eclState,
136  const EclEpsGridProperties& epsProperties,
137  unsigned activeIndex);
138 
139 private:
140  void calculateLeverettFactors(const EclipseState& eclState,
141  const EclEpsGridProperties& epsProperties,
142  unsigned activeIndex);
143 };
144 
151 template <class Scalar>
153 {
154 public:
158  void init(const EclEpsScalingPointsInfo<Scalar>& epsInfo,
159  const EclEpsConfig& config,
160  EclTwoPhaseSystemType epsSystemType);
161 
165  void setSaturationPcPoint(unsigned pointIdx, Scalar value)
166  { saturationPcPoints_[pointIdx] = value; }
167 
171  OPM_HOST_DEVICE const std::array<Scalar, 3>& saturationPcPoints() const
172  { return saturationPcPoints_; }
173 
177  void setSaturationKrwPoint(unsigned pointIdx, Scalar value)
178  { saturationKrwPoints_[pointIdx] = value; }
179 
183  OPM_HOST_DEVICE const std::array<Scalar, 3>& saturationKrwPoints() const
184  { return saturationKrwPoints_; }
185 
189  void setSaturationKrnPoint(unsigned pointIdx, Scalar value)
190  { saturationKrnPoints_[pointIdx] = value; }
191 
195  OPM_HOST_DEVICE const std::array<Scalar, 3>& saturationKrnPoints() const
196  { return saturationKrnPoints_; }
197 
201  void setMaxPcnw(Scalar value)
202  { maxPcnwOrLeverettFactor_ = value; }
203 
207  OPM_HOST_DEVICE Scalar maxPcnw() const
208  { return maxPcnwOrLeverettFactor_; }
209 
214  { maxPcnwOrLeverettFactor_ = value; }
215 
219  OPM_HOST_DEVICE Scalar leverettFactor() const
220  { return maxPcnwOrLeverettFactor_; }
221 
226  void setKrwr(Scalar value)
227  { this->Krwr_ = value; }
228 
233  OPM_HOST_DEVICE Scalar krwr() const
234  { return this->Krwr_; }
235 
239  void setMaxKrw(Scalar value)
240  { maxKrw_ = value; }
241 
245  OPM_HOST_DEVICE Scalar maxKrw() const
246  { return maxKrw_; }
247 
252  void setKrnr(Scalar value)
253  { this->Krnr_ = value; }
254 
259  OPM_HOST_DEVICE Scalar krnr() const
260  { return this->Krnr_; }
261 
265  void setMaxKrn(Scalar value)
266  { maxKrn_ = value; }
267 
271  OPM_HOST_DEVICE Scalar maxKrn() const
272  { return maxKrn_; }
273 
274  void print() const;
275 
276 private:
277  // Points used for vertical scaling of capillary pressure
278  Scalar maxPcnwOrLeverettFactor_{};
279 
280  // Maximum wetting phase relative permability value.
281  Scalar maxKrw_{};
282 
283  // Scaled wetting phase relative permeability value at residual
284  // saturation of non-wetting phase.
285  Scalar Krwr_{};
286 
287  // Maximum non-wetting phase relative permability value
288  Scalar maxKrn_{};
289 
290  // Scaled non-wetting phase relative permeability value at residual
291  // saturation of wetting phase.
292  Scalar Krnr_{};
293 
294  // The the points used for saturation ("x-axis") scaling of capillary pressure
295  std::array<Scalar, 3> saturationPcPoints_{};
296 
297  // The the points used for saturation ("x-axis") scaling of wetting phase relative permeability
298  std::array<Scalar, 3> saturationKrwPoints_{};
299 
300  // The the points used for saturation ("x-axis") scaling of non-wetting phase relative permeability
301  std::array<Scalar, 3> saturationKrnPoints_{};
302 };
303 
304 } // namespace Opm
305 
306 #endif
Collection of unscaled/raw saturation range endpoints extracted directly from tables of tabulated sat...
Definition: SatfuncPropertyInitializers.hpp:35
void setMaxKrw(Scalar value)
Sets the maximum wetting phase relative permeability.
Definition: EclEpsScalingPoints.hpp:239
EclTwoPhaseSystemType
Specified which fluids are involved in a given twophase material law for endpoint scaling...
Definition: EclEpsConfig.hpp:42
void setSaturationPcPoint(unsigned pointIdx, Scalar value)
Sets an saturation value for capillary pressure saturation scaling.
Definition: EclEpsScalingPoints.hpp:165
void setMaxPcnw(Scalar value)
Sets the maximum capillary pressure.
Definition: EclEpsScalingPoints.hpp:201
OPM_HOST_DEVICE Scalar maxKrn() const
Returns the maximum wetting phase relative permeability.
Definition: EclEpsScalingPoints.hpp:271
void setSaturationKrnPoint(unsigned pointIdx, Scalar value)
Sets an saturation value for non-wetting phase relperm saturation scaling.
Definition: EclEpsScalingPoints.hpp:189
OPM_HOST_DEVICE Scalar krnr() const
Returns non-wetting phase relative permeability at residual saturation of wetting phase...
Definition: EclEpsScalingPoints.hpp:259
Collects all grid properties which are relevant for end point scaling.
Definition: EclEpsGridProperties.hpp:44
void extractScaled(const EclipseState &eclState, const EclEpsGridProperties &epsProperties, unsigned activeIndex)
Extract the values of the scaled scaling parameters.
Definition: EclEpsScalingPoints.cpp:118
OPM_HOST_DEVICE const std::array< Scalar, 3 > & saturationKrnPoints() const
Returns the points used for non-wetting phase relperm saturation scaling.
Definition: EclEpsScalingPoints.hpp:195
void setSaturationKrwPoint(unsigned pointIdx, Scalar value)
Sets an saturation value for wetting-phase relperm saturation scaling.
Definition: EclEpsScalingPoints.hpp:177
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Specifies the configuration used by the endpoint scaling code.
Definition: EclEpsConfig.hpp:55
void setKrnr(Scalar value)
Set non-wetting phase relative permeability at residual saturation of wetting phase.
Definition: EclEpsScalingPoints.hpp:252
Collection of unscaled/raw saturation function value range endpoints extracted directly from tables o...
Definition: SatfuncPropertyInitializers.hpp:92
This structure represents all values which can be possibly used as scaling points in the endpoint sca...
Definition: EclEpsScalingPoints.hpp:56
OPM_HOST_DEVICE Scalar krwr() const
Returns wetting-phase relative permeability at residual saturation of non-wetting phase...
Definition: EclEpsScalingPoints.hpp:233
OPM_HOST_DEVICE Scalar leverettFactor() const
Returns the Leverett scaling factor for capillary pressure.
Definition: EclEpsScalingPoints.hpp:219
Definition: EclipseState.hpp:66
Represents the points on the X and Y axis to be scaled if endpoint scaling is used.
Definition: EclEpsScalingPoints.hpp:152
void setLeverettFactor(Scalar value)
Sets the Leverett scaling factor for capillary pressure.
Definition: EclEpsScalingPoints.hpp:213
void setMaxKrn(Scalar value)
Sets the maximum wetting phase relative permeability.
Definition: EclEpsScalingPoints.hpp:265
void setKrwr(Scalar value)
Set wetting-phase relative permeability at residual saturation of non-wetting phase.
Definition: EclEpsScalingPoints.hpp:226
OPM_HOST_DEVICE const std::array< Scalar, 3 > & saturationKrwPoints() const
Returns the points used for wetting phase relperm saturation scaling.
Definition: EclEpsScalingPoints.hpp:183
OPM_HOST_DEVICE Scalar maxKrw() const
Returns the maximum wetting phase relative permeability.
Definition: EclEpsScalingPoints.hpp:245
OPM_HOST_DEVICE const std::array< Scalar, 3 > & saturationPcPoints() const
Returns the points used for capillary pressure saturation scaling.
Definition: EclEpsScalingPoints.hpp:171
OPM_HOST_DEVICE Scalar maxPcnw() const
Returns the maximum capillary pressure.
Definition: EclEpsScalingPoints.hpp:207
void init(const EclEpsScalingPointsInfo< Scalar > &epsInfo, const EclEpsConfig &config, EclTwoPhaseSystemType epsSystemType)
Assigns the scaling points which actually ought to be used.
Definition: EclEpsScalingPoints.cpp:234
void extractUnscaled(const satfunc::RawTableEndPoints &rtep, const satfunc::RawFunctionValues &rfunc, const std::vector< double >::size_type satRegionIdx)
Extract the values of the unscaled scaling parameters.
Definition: EclEpsScalingPoints.cpp:83