00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00027 #ifndef OPM_ECL_EPS_CONFIG_HPP
00028 #define OPM_ECL_EPS_CONFIG_HPP
00029
00030 #if HAVE_OPM_PARSER
00031 #include <opm/parser/eclipse/Deck/Deck.hpp>
00032 #include <opm/parser/eclipse/Deck/DeckItem.hpp>
00033 #include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
00034 #include <opm/parser/eclipse/Deck/DeckRecord.hpp>
00035 #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
00036 #endif
00037
00038 #include <opm/common/ErrorMacros.hpp>
00039 #include <opm/common/Exceptions.hpp>
00040 #include <opm/common/Unused.hpp>
00041
00042 #include <string>
00043 #include <cassert>
00044 #include <algorithm>
00045
00046 namespace Opm {
00051 enum EclTwoPhaseSystemType {
00052 EclGasOilSystem,
00053 EclOilWaterSystem,
00054 };
00055
00063 class EclEpsConfig
00064 {
00065 public:
00066 EclEpsConfig()
00067 {
00068
00069 enableSatScaling_ = false;
00070 enablePcScaling_ = false;
00071 enableLeverettScaling_ = false;
00072 enableKrwScaling_ = false;
00073 enableKrnScaling_ = false;
00074 enableThreePointKrSatScaling_ = false;
00075 }
00076
00080 void setEnableSatScaling(bool yesno)
00081 { enableSatScaling_ = yesno; }
00082
00086 bool enableSatScaling() const
00087 { return enableSatScaling_; }
00088
00093 void setEnableThreePointKrSatScaling(bool yesno)
00094 { enableThreePointKrSatScaling_ = yesno; }
00095
00100 bool enableThreePointKrSatScaling() const
00101 { return enableThreePointKrSatScaling_; }
00102
00106 void setEnableKrwScaling(bool yesno)
00107 { enableKrwScaling_ = yesno; }
00108
00112 bool enableKrwScaling() const
00113 { return enableKrwScaling_; }
00114
00118 void setEnableKrnScaling(bool yesno)
00119 { enableKrnScaling_ = yesno; }
00120
00124 bool enableKrnScaling() const
00125 { return enableKrnScaling_; }
00126
00130 void setEnablePcScaling(bool yesno)
00131 { enablePcScaling_ = yesno; }
00132
00136 bool enablePcScaling() const
00137 { return enablePcScaling_; }
00138
00146 void setEnableLeverettScaling(bool yesno)
00147 { enableLeverettScaling_ = yesno; }
00148
00156 bool enableLeverettScaling() const
00157 { return enableLeverettScaling_; }
00158
00159 #if HAVE_OPM_PARSER
00160
00165 void initFromDeck(const Opm::Deck& deck OPM_UNUSED,
00166 const Opm::EclipseState& eclState,
00167 Opm::EclTwoPhaseSystemType twoPhaseSystemType)
00168 {
00169 const auto& endscale = eclState.runspec().endpointScaling();
00170
00171 if (!endscale) {
00172
00173
00174 enableSatScaling_ = false;
00175 enableThreePointKrSatScaling_ = false;
00176 enablePcScaling_ = false;
00177 enableLeverettScaling_ = false;
00178 enableKrwScaling_ = false;
00179 enableKrnScaling_ = false;
00180 return;
00181 }
00182
00183
00184 enableSatScaling_ = true;
00185
00186 enableThreePointKrSatScaling_ = endscale.threepoint();
00187
00188 auto& props = eclState.get3DProperties();
00189
00190 if (twoPhaseSystemType == EclOilWaterSystem) {
00191 enablePcScaling_ =
00192 props.hasDeckDoubleGridProperty("PCW")
00193 || props.hasDeckDoubleGridProperty("SWATINIT");
00194
00195
00196 if (eclState.getTableManager().useJFunc()) {
00197 const auto& jfunc = eclState.getTableManager().getJFunc();
00198 auto flag = jfunc.flag();
00199 if (flag == Opm::JFunc::Flag::BOTH || flag == Opm::JFunc::Flag::WATER)
00200 enableLeverettScaling_ = true;
00201 }
00202
00203 if (enablePcScaling_ && enableLeverettScaling_)
00204 OPM_THROW(std::runtime_error,
00205 "Capillary pressure scaling and the Leverett scaling function are "
00206 "mutually exclusive: The deck contains the PCW property and the "
00207 "JFUNC keyword applies to the water phase.");
00208 }
00209 else {
00210 assert(twoPhaseSystemType == EclGasOilSystem);
00211 enablePcScaling_ = props.hasDeckDoubleGridProperty("PCG");
00212
00213
00214 if (eclState.getTableManager().useJFunc()) {
00215 const auto& jfunc = eclState.getTableManager().getJFunc();
00216 auto flag = jfunc.flag();
00217 if (flag == Opm::JFunc::Flag::BOTH || flag == Opm::JFunc::Flag::GAS)
00218 enableLeverettScaling_ = true;
00219 }
00220
00221 if (enablePcScaling_ && enableLeverettScaling_)
00222 OPM_THROW(std::runtime_error,
00223 "Capillary pressure scaling and the Leverett scaling function are "
00224 "mutually exclusive: The deck contains the PCG property and the "
00225 "JFUNC keyword applies to the gas phase.");
00226 }
00227
00228
00229 if (twoPhaseSystemType == EclOilWaterSystem)
00230 enableKrwScaling_ = props.hasDeckDoubleGridProperty("KRW");
00231 else {
00232 assert(twoPhaseSystemType == EclGasOilSystem);
00233 enableKrwScaling_ = props.hasDeckDoubleGridProperty("KRO");
00234 }
00235
00236
00237 if (twoPhaseSystemType == EclOilWaterSystem)
00238 enableKrnScaling_ = props.hasDeckDoubleGridProperty("KRO");
00239 else {
00240 assert(twoPhaseSystemType == EclGasOilSystem);
00241 enableKrnScaling_ = props.hasDeckDoubleGridProperty("KRG");
00242 }
00243 }
00244 #endif
00245
00246 private:
00247
00248 bool enableSatScaling_;
00249
00250
00251
00252
00253
00254
00255 bool enableThreePointKrSatScaling_;
00256
00257
00258
00259 bool enablePcScaling_;
00260 bool enableLeverettScaling_;
00261 bool enableKrwScaling_;
00262 bool enableKrnScaling_;
00263 };
00264
00265 }
00266
00267 #endif