EclEpsConfig.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) 2015 by Andreas Lauser
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 2 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
25 #ifndef OPM_ECL_EPS_CONFIG_HPP
26 #define OPM_ECL_EPS_CONFIG_HPP
27 
28 #if HAVE_OPM_PARSER
29 #include <opm/parser/eclipse/Deck/Deck.hpp>
30 #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
31 #endif
32 
33 #include <string>
34 #include <cassert>
35 #include <algorithm>
36 
37 namespace Opm {
45 };
46 
55 {
56 public:
58  {
59  // by default, do not scale anything
60  enableSatScaling_ = false;
61  enablePcScaling_ = false;
62  enableKrwScaling_ = false;
63  enableKrnScaling_ = false;
64  enableThreePointKrSatScaling_ = false;
65  }
66 
70  void setEnableSatScaling(bool yesno)
71  { enableSatScaling_ = yesno; }
72 
76  bool enableSatScaling() const
77  { return enableSatScaling_; }
78 
84  { enableThreePointKrSatScaling_ = yesno; }
85 
91  { return enableThreePointKrSatScaling_; }
92 
96  void setEnableKrwScaling(bool yesno)
97  { enableKrwScaling_ = yesno; }
98 
102  bool enableKrwScaling() const
103  { return enableKrwScaling_; }
104 
108  void setEnableKrnScaling(bool yesno)
109  { enableKrnScaling_ = yesno; }
110 
114  bool enableKrnScaling() const
115  { return enableKrnScaling_; }
116 
120  void setEnablePcScaling(bool yesno)
121  { enablePcScaling_ = yesno; }
122 
126  bool enablePcScaling() const
127  { return enablePcScaling_; }
128 
129 #if HAVE_OPM_PARSER
130 
135  void initFromDeck(Opm::DeckConstPtr deck,
136  Opm::EclipseStateConstPtr eclState,
137  Opm::EclTwoPhaseSystemType twoPhaseSystemType)
138  {
139  // find out if endpoint scaling is used in the first place
140  if (!deck->hasKeyword("ENDSCALE")) {
141  // it is not used, i.e., just set all enable$Foo attributes to 0 and be done
142  // with it.
143  enableSatScaling_ = false;
144  enableThreePointKrSatScaling_ = false;
145  enablePcScaling_ = false;
146  enableKrwScaling_ = false;
147  enableKrnScaling_ = false;
148  return;
149  }
150 
151  // endpoint scaling is used, i.e., at least saturation scaling needs to be enabled
152  enableSatScaling_ = true;
153 
154  // check if three-point scaling is to be used for the saturations of the relative
155  // permeabilities
156  if (deck->hasKeyword("SCALECRS")) {
157  // if the deck features the SCALECRS keyword, it must be set to 'YES'
158  Opm::DeckKeywordConstPtr scalecrsKeyword = deck->getKeyword("SCALECRS");
159  std::string scalecrsValue =
160  scalecrsKeyword->getRecord(0)->getItem("VALUE")->getString(0);
161  // convert the value of the SCALECRS keyword to upper case, just to be sure
162  std::transform(scalecrsValue.begin(),
163  scalecrsValue.end(),
164  scalecrsValue.begin(),
165  ::toupper);
166 
167  if (scalecrsValue == "YES" || scalecrsValue == "Y")
168  enableThreePointKrSatScaling_ = true;
169  else
170  enableThreePointKrSatScaling_ = false;
171  }
172  else
173  enableThreePointKrSatScaling_ = false;
174 
175  // check if we are supposed to scale the Y axis of the capillary pressure
176  if (twoPhaseSystemType == EclOilWaterSystem)
177  enablePcScaling_ =
178  eclState->hasDoubleGridProperty("PCW")
179  || eclState->hasDoubleGridProperty("SWATINIT");
180 
181  else {
182  assert(twoPhaseSystemType == EclGasOilSystem);
183  enablePcScaling_ = eclState->hasDoubleGridProperty("PCG");
184  }
185 
186  // check if we are supposed to scale the Y axis of the wetting phase relperm
187  if (twoPhaseSystemType == EclOilWaterSystem)
188  enableKrwScaling_ = eclState->hasDoubleGridProperty("KRW");
189  else {
190  assert(twoPhaseSystemType == EclGasOilSystem);
191  enableKrwScaling_ = eclState->hasDoubleGridProperty("KRO");
192  }
193 
194  // check if we are supposed to scale the Y axis of the non-wetting phase relperm
195  if (twoPhaseSystemType == EclOilWaterSystem)
196  enableKrnScaling_ = eclState->hasDoubleGridProperty("KRO");
197  else {
198  assert(twoPhaseSystemType == EclGasOilSystem);
199  enableKrnScaling_ = eclState->hasDoubleGridProperty("KRG");
200  }
201  }
202 #endif
203 
204 private:
205  // enable scaling of the input saturations (i.e., rescale the x-Axis)
206  bool enableSatScaling_;
207 
208  // use three (instead of two) points to scale the saturations for the relative
209  // permeabilities.
210  //
211  // This means that two piecewise linear functions are used for saturation scaling
212  // instead of a single linear one
213  bool enableThreePointKrSatScaling_;
214 
215  // enable the scaling of the capillary pressure and relative permeability outputs
216  // (i.e., rescale the y-Axis)
217  bool enablePcScaling_;
218  bool enableKrwScaling_;
219  bool enableKrnScaling_;
220 };
221 
222 } // namespace Opm
223 
224 #endif
EclTwoPhaseSystemType
Specified which fluids are involved in a given twophase material law for endpoint scaling...
Definition: EclEpsConfig.hpp:42
Definition: Air_Mesitylene.hpp:31
bool enableSatScaling() const
Returns whether saturation scaling is enabled.
Definition: EclEpsConfig.hpp:76
void setEnablePcScaling(bool yesno)
Specify whether capillary pressure scaling is enabled.
Definition: EclEpsConfig.hpp:120
EclEpsConfig()
Definition: EclEpsConfig.hpp:57
bool enableKrnScaling() const
Returns whether relative permeability scaling is enabled for the non-wetting phase.
Definition: EclEpsConfig.hpp:114
void setEnableKrwScaling(bool yesno)
Specify whether relative permeability scaling is enabled for the wetting phase.
Definition: EclEpsConfig.hpp:96
void setEnableSatScaling(bool yesno)
Specify whether saturation scaling is enabled.
Definition: EclEpsConfig.hpp:70
bool enableKrwScaling() const
Returns whether relative permeability scaling is enabled for the wetting phase.
Definition: EclEpsConfig.hpp:102
Definition: EclEpsConfig.hpp:44
bool enableThreePointKrSatScaling() const
Returns whether three point saturation scaling is enabled for the relative permeabilities.
Definition: EclEpsConfig.hpp:90
Specifies the configuration used by the endpoint scaling code.
Definition: EclEpsConfig.hpp:54
bool enablePcScaling() const
Returns whether capillary pressure scaling is enabled.
Definition: EclEpsConfig.hpp:126
void setEnableThreePointKrSatScaling(bool yesno)
Specify whether three point saturation scaling is enabled for the relative permeabilities.
Definition: EclEpsConfig.hpp:83
Definition: EclEpsConfig.hpp:43
void setEnableKrnScaling(bool yesno)
Specify whether relative permeability scaling is enabled for the non-wetting phase.
Definition: EclEpsConfig.hpp:108