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_MULTIPLEXER_MATERIAL_HPP
00028 #define OPM_ECL_MULTIPLEXER_MATERIAL_HPP
00029
00030 #include "EclMultiplexerMaterialParams.hpp"
00031 #include "EclDefaultMaterial.hpp"
00032 #include "EclStone1Material.hpp"
00033 #include "EclStone2Material.hpp"
00034 #include "EclTwoPhaseMaterial.hpp"
00035
00036 #include <opm/common/Valgrind.hpp>
00037 #include <opm/material/common/MathToolbox.hpp>
00038 #include <opm/common/Exceptions.hpp>
00039 #include <opm/common/ErrorMacros.hpp>
00040
00041 #include <algorithm>
00042
00043 namespace Opm {
00044
00051 template <class TraitsT,
00052 class GasOilMaterialLawT,
00053 class OilWaterMaterialLawT,
00054 class ParamsT = EclMultiplexerMaterialParams<TraitsT,
00055 GasOilMaterialLawT,
00056 OilWaterMaterialLawT> >
00057 class EclMultiplexerMaterial : public TraitsT
00058 {
00059 public:
00060 typedef GasOilMaterialLawT GasOilMaterialLaw;
00061 typedef OilWaterMaterialLawT OilWaterMaterialLaw;
00062
00063 typedef Opm::EclStone1Material<TraitsT, GasOilMaterialLaw, OilWaterMaterialLaw> Stone1Material;
00064 typedef Opm::EclStone2Material<TraitsT, GasOilMaterialLaw, OilWaterMaterialLaw> Stone2Material;
00065 typedef Opm::EclDefaultMaterial<TraitsT, GasOilMaterialLaw, OilWaterMaterialLaw> DefaultMaterial;
00066 typedef Opm::EclTwoPhaseMaterial<TraitsT, GasOilMaterialLaw, OilWaterMaterialLaw> TwoPhaseMaterial;
00067
00068
00069 static_assert(TraitsT::numPhases == 3,
00070 "The number of phases considered by this capillary pressure "
00071 "law is always three!");
00072 static_assert(GasOilMaterialLaw::numPhases == 2,
00073 "The number of phases considered by the gas-oil capillary "
00074 "pressure law must be two!");
00075 static_assert(OilWaterMaterialLaw::numPhases == 2,
00076 "The number of phases considered by the oil-water capillary "
00077 "pressure law must be two!");
00078 static_assert(std::is_same<typename GasOilMaterialLaw::Scalar,
00079 typename OilWaterMaterialLaw::Scalar>::value,
00080 "The two two-phase capillary pressure laws must use the same "
00081 "type of floating point values.");
00082
00083 typedef TraitsT Traits;
00084 typedef ParamsT Params;
00085 typedef typename Traits::Scalar Scalar;
00086
00087 static const int numPhases = 3;
00088 static const int waterPhaseIdx = Traits::wettingPhaseIdx;
00089 static const int oilPhaseIdx = Traits::nonWettingPhaseIdx;
00090 static const int gasPhaseIdx = Traits::gasPhaseIdx;
00091
00094 static const bool implementsTwoPhaseApi = false;
00095
00098 static const bool implementsTwoPhaseSatApi = false;
00099
00102 static const bool isSaturationDependent = true;
00103
00106 static const bool isPressureDependent = false;
00107
00110 static const bool isTemperatureDependent = false;
00111
00114 static const bool isCompositionDependent = false;
00115
00130 template <class ContainerT, class FluidState>
00131 static void capillaryPressures(ContainerT& values,
00132 const Params& params,
00133 const FluidState& fluidState)
00134 {
00135 switch (params.approach()) {
00136 case EclStone1Approach:
00137 Stone1Material::capillaryPressures(values,
00138 params.template getRealParams<EclStone1Approach>(),
00139 fluidState);
00140 break;
00141
00142 case EclStone2Approach:
00143 Stone2Material::capillaryPressures(values,
00144 params.template getRealParams<EclStone2Approach>(),
00145 fluidState);
00146 break;
00147
00148 case EclDefaultApproach:
00149 DefaultMaterial::capillaryPressures(values,
00150 params.template getRealParams<EclDefaultApproach>(),
00151 fluidState);
00152 break;
00153
00154 case EclTwoPhaseApproach:
00155 TwoPhaseMaterial::capillaryPressures(values,
00156 params.template getRealParams<EclTwoPhaseApproach>(),
00157 fluidState);
00158 break;
00159 }
00160 }
00161
00162
00163
00164
00165
00166
00167
00168 static void oilWaterHysteresisParams(Scalar& pcSwMdc,
00169 Scalar& krnSwMdc,
00170 const Params& params)
00171 {
00172 switch (params.approach()) {
00173 case EclStone1Approach:
00174 Stone1Material::oilWaterHysteresisParams(pcSwMdc, krnSwMdc,
00175 params.template getRealParams<EclStone1Approach>());
00176 break;
00177
00178 case EclStone2Approach:
00179 Stone2Material::oilWaterHysteresisParams(pcSwMdc, krnSwMdc,
00180 params.template getRealParams<EclStone2Approach>());
00181 break;
00182
00183 case EclDefaultApproach:
00184 DefaultMaterial::oilWaterHysteresisParams(pcSwMdc, krnSwMdc,
00185 params.template getRealParams<EclDefaultApproach>());
00186 break;
00187
00188 case EclTwoPhaseApproach:
00189 TwoPhaseMaterial::oilWaterHysteresisParams(pcSwMdc, krnSwMdc,
00190 params.template getRealParams<EclTwoPhaseApproach>());
00191 break;
00192 }
00193 }
00194
00195
00196
00197
00198
00199
00200
00201 static void setOilWaterHysteresisParams(const Scalar& pcSwMdc,
00202 const Scalar& krnSwMdc,
00203 Params& params)
00204 {
00205 switch (params.approach()) {
00206 case EclStone1Approach:
00207 Stone1Material::setOilWaterHysteresisParams(pcSwMdc, krnSwMdc,
00208 params.template getRealParams<EclStone1Approach>());
00209 break;
00210
00211 case EclStone2Approach:
00212 Stone2Material::setOilWaterHysteresisParams(pcSwMdc, krnSwMdc,
00213 params.template getRealParams<EclStone2Approach>());
00214 break;
00215
00216 case EclDefaultApproach:
00217 DefaultMaterial::setOilWaterHysteresisParams(pcSwMdc, krnSwMdc,
00218 params.template getRealParams<EclDefaultApproach>());
00219 break;
00220
00221 case EclTwoPhaseApproach:
00222 TwoPhaseMaterial::setOilWaterHysteresisParams(pcSwMdc, krnSwMdc,
00223 params.template getRealParams<EclTwoPhaseApproach>());
00224 break;
00225 }
00226 }
00227
00228
00229
00230
00231
00232
00233
00234 static void gasOilHysteresisParams(Scalar& pcSwMdc,
00235 Scalar& krnSwMdc,
00236 const Params& params)
00237 {
00238 switch (params.approach()) {
00239 case EclStone1Approach:
00240 Stone1Material::gasOilHysteresisParams(pcSwMdc, krnSwMdc,
00241 params.template getRealParams<EclStone1Approach>());
00242 break;
00243
00244 case EclStone2Approach:
00245 Stone2Material::gasOilHysteresisParams(pcSwMdc, krnSwMdc,
00246 params.template getRealParams<EclStone2Approach>());
00247 break;
00248
00249 case EclDefaultApproach:
00250 DefaultMaterial::gasOilHysteresisParams(pcSwMdc, krnSwMdc,
00251 params.template getRealParams<EclDefaultApproach>());
00252 break;
00253
00254 case EclTwoPhaseApproach:
00255 TwoPhaseMaterial::gasOilHysteresisParams(pcSwMdc, krnSwMdc,
00256 params.template getRealParams<EclTwoPhaseApproach>());
00257 break;
00258 }
00259 }
00260
00261
00262
00263
00264
00265
00266
00267 static void setGasOilHysteresisParams(const Scalar& pcSwMdc,
00268 const Scalar& krnSwMdc,
00269 Params& params)
00270 {
00271 switch (params.approach()) {
00272 case EclStone1Approach:
00273 Stone1Material::setGasOilHysteresisParams(pcSwMdc, krnSwMdc,
00274 params.template getRealParams<EclStone1Approach>());
00275 break;
00276
00277 case EclStone2Approach:
00278 Stone2Material::setGasOilHysteresisParams(pcSwMdc, krnSwMdc,
00279 params.template getRealParams<EclStone2Approach>());
00280 break;
00281
00282 case EclDefaultApproach:
00283 DefaultMaterial::setGasOilHysteresisParams(pcSwMdc, krnSwMdc,
00284 params.template getRealParams<EclDefaultApproach>());
00285 break;
00286
00287 case EclTwoPhaseApproach:
00288 TwoPhaseMaterial::setGasOilHysteresisParams(pcSwMdc, krnSwMdc,
00289 params.template getRealParams<EclTwoPhaseApproach>());
00290 break;
00291 }
00292 }
00293
00303 template <class FluidState, class Evaluation = typename FluidState::Scalar>
00304 static Evaluation pcgn(const Params& ,
00305 const FluidState& )
00306 {
00307 OPM_THROW(std::logic_error, "Not implemented: pcgn()");
00308 }
00309
00319 template <class FluidState, class Evaluation = typename FluidState::Scalar>
00320 static Evaluation pcnw(const Params& ,
00321 const FluidState& )
00322 {
00323 OPM_THROW(std::logic_error, "Not implemented: pcnw()");
00324 }
00325
00329 template <class ContainerT, class FluidState>
00330 static void saturations(ContainerT& ,
00331 const Params& ,
00332 const FluidState& )
00333 {
00334 OPM_THROW(std::logic_error, "Not implemented: saturations()");
00335 }
00336
00340 template <class FluidState, class Evaluation = typename FluidState::Scalar>
00341 static Evaluation Sg(const Params& ,
00342 const FluidState& )
00343 {
00344 OPM_THROW(std::logic_error, "Not implemented: Sg()");
00345 }
00346
00350 template <class FluidState, class Evaluation = typename FluidState::Scalar>
00351 static Evaluation Sn(const Params& ,
00352 const FluidState& )
00353 {
00354 OPM_THROW(std::logic_error, "Not implemented: Sn()");
00355 }
00356
00360 template <class FluidState, class Evaluation = typename FluidState::Scalar>
00361 static Evaluation Sw(const Params& ,
00362 const FluidState& )
00363 {
00364 OPM_THROW(std::logic_error, "Not implemented: Sw()");
00365 }
00366
00382 template <class ContainerT, class FluidState>
00383 static void relativePermeabilities(ContainerT& values,
00384 const Params& params,
00385 const FluidState& fluidState)
00386 {
00387 switch (params.approach()) {
00388 case EclStone1Approach:
00389 Stone1Material::relativePermeabilities(values,
00390 params.template getRealParams<EclStone1Approach>(),
00391 fluidState);
00392 break;
00393
00394 case EclStone2Approach:
00395 Stone2Material::relativePermeabilities(values,
00396 params.template getRealParams<EclStone2Approach>(),
00397 fluidState);
00398 break;
00399
00400 case EclDefaultApproach:
00401 DefaultMaterial::relativePermeabilities(values,
00402 params.template getRealParams<EclDefaultApproach>(),
00403 fluidState);
00404 break;
00405
00406 case EclTwoPhaseApproach:
00407 TwoPhaseMaterial::relativePermeabilities(values,
00408 params.template getRealParams<EclTwoPhaseApproach>(),
00409 fluidState);
00410 break;
00411 }
00412 }
00413
00417 template <class FluidState, class Evaluation = typename FluidState::Scalar>
00418 static Evaluation krg(const Params& ,
00419 const FluidState& )
00420 {
00421 OPM_THROW(std::logic_error, "Not implemented: krg()");
00422 }
00423
00427 template <class FluidState, class Evaluation = typename FluidState::Scalar>
00428 static Evaluation krw(const Params& ,
00429 const FluidState& )
00430 {
00431 OPM_THROW(std::logic_error, "Not implemented: krw()");
00432 }
00433
00437 template <class FluidState, class Evaluation = typename FluidState::Scalar>
00438 static Evaluation krn(const Params& ,
00439 const FluidState& )
00440 {
00441 OPM_THROW(std::logic_error, "Not implemented: krn()");
00442 }
00443
00444
00452 template <class FluidState>
00453 static void updateHysteresis(Params& params, const FluidState& fluidState)
00454 {
00455 switch (params.approach()) {
00456 case EclStone1Approach:
00457 Stone1Material::updateHysteresis(params.template getRealParams<EclStone1Approach>(),
00458 fluidState);
00459 break;
00460
00461 case EclStone2Approach:
00462 Stone2Material::updateHysteresis(params.template getRealParams<EclStone2Approach>(),
00463 fluidState);
00464 break;
00465
00466 case EclDefaultApproach:
00467 DefaultMaterial::updateHysteresis(params.template getRealParams<EclDefaultApproach>(),
00468 fluidState);
00469 break;
00470
00471 case EclTwoPhaseApproach:
00472 TwoPhaseMaterial::updateHysteresis(params.template getRealParams<EclTwoPhaseApproach>(),
00473 fluidState);
00474 break;
00475 }
00476 }
00477 };
00478 }
00479
00480 #endif