27#ifndef OPM_ECL_MULTIPLEXER_MATERIAL_HPP
28#define OPM_ECL_MULTIPLEXER_MATERIAL_HPP
36#include <opm/common/TimingMacros.hpp>
49template <
class TraitsT,
50 class GasOilMaterialLawT,
51 class OilWaterMaterialLawT,
52 class GasWaterMaterialLawT,
53 class ParamsT = EclMultiplexerMaterialParams<TraitsT,
56 GasWaterMaterialLawT> >
60 using GasOilMaterialLaw = GasOilMaterialLawT;
61 using OilWaterMaterialLaw = OilWaterMaterialLawT;
62 using GasWaterMaterialLaw = GasWaterMaterialLawT;
70 static_assert(TraitsT::numPhases == 3,
71 "The number of phases considered by this capillary pressure "
72 "law is always three!");
73 static_assert(GasOilMaterialLaw::numPhases == 2,
74 "The number of phases considered by the gas-oil capillary "
75 "pressure law must be two!");
76 static_assert(OilWaterMaterialLaw::numPhases == 2,
77 "The number of phases considered by the oil-water capillary "
78 "pressure law must be two!");
79 static_assert(GasWaterMaterialLaw::numPhases == 2,
80 "The number of phases considered by the gas-water capillary "
81 "pressure law must be two!");
82 static_assert(std::is_same<
typename GasOilMaterialLaw::Scalar,
83 typename OilWaterMaterialLaw::Scalar>::value,
84 "The two two-phase capillary pressure laws must use the same "
85 "type of floating point values.");
87 using Traits = TraitsT;
88 using Params = ParamsT;
89 using Scalar =
typename Traits::Scalar;
91 static constexpr int numPhases = 3;
92 static constexpr int waterPhaseIdx = Traits::wettingPhaseIdx;
93 static constexpr int oilPhaseIdx = Traits::nonWettingPhaseIdx;
94 static constexpr int gasPhaseIdx = Traits::gasPhaseIdx;
134 template <
class ContainerT,
class Flu
idState>
136 const Params& params,
137 const FluidState& fluidState)
140 switch (params.approach()) {
141 case EclMultiplexerApproach::Stone1:
143 params.template getRealParams<EclMultiplexerApproach::Stone1>(),
147 case EclMultiplexerApproach::Stone2:
149 params.template getRealParams<EclMultiplexerApproach::Stone2>(),
153 case EclMultiplexerApproach::Default:
155 params.template getRealParams<EclMultiplexerApproach::Default>(),
159 case EclMultiplexerApproach::TwoPhase:
161 params.template getRealParams<EclMultiplexerApproach::TwoPhase>(),
165 case EclMultiplexerApproach::OnePhase:
177 static void oilWaterHysteresisParams(Scalar& pcSwMdc,
179 const Params& params)
181 switch (params.approach()) {
182 case EclMultiplexerApproach::Stone1:
183 Stone1Material::oilWaterHysteresisParams(pcSwMdc, krnSwMdc,
184 params.template getRealParams<EclMultiplexerApproach::Stone1>());
187 case EclMultiplexerApproach::Stone2:
188 Stone2Material::oilWaterHysteresisParams(pcSwMdc, krnSwMdc,
189 params.template getRealParams<EclMultiplexerApproach::Stone2>());
192 case EclMultiplexerApproach::Default:
193 DefaultMaterial::oilWaterHysteresisParams(pcSwMdc, krnSwMdc,
194 params.template getRealParams<EclMultiplexerApproach::Default>());
197 case EclMultiplexerApproach::TwoPhase:
198 TwoPhaseMaterial::oilWaterHysteresisParams(pcSwMdc, krnSwMdc,
199 params.template getRealParams<EclMultiplexerApproach::TwoPhase>());
202 case EclMultiplexerApproach::OnePhase:
214 static void setOilWaterHysteresisParams(
const Scalar& pcSwMdc,
215 const Scalar& krnSwMdc,
218 switch (params.approach()) {
219 case EclMultiplexerApproach::Stone1:
220 Stone1Material::setOilWaterHysteresisParams(pcSwMdc, krnSwMdc,
221 params.template getRealParams<EclMultiplexerApproach::Stone1>());
224 case EclMultiplexerApproach::Stone2:
225 Stone2Material::setOilWaterHysteresisParams(pcSwMdc, krnSwMdc,
226 params.template getRealParams<EclMultiplexerApproach::Stone2>());
229 case EclMultiplexerApproach::Default:
230 DefaultMaterial::setOilWaterHysteresisParams(pcSwMdc, krnSwMdc,
231 params.template getRealParams<EclMultiplexerApproach::Default>());
234 case EclMultiplexerApproach::TwoPhase:
235 TwoPhaseMaterial::setOilWaterHysteresisParams(pcSwMdc, krnSwMdc,
236 params.template getRealParams<EclMultiplexerApproach::TwoPhase>());
239 case EclMultiplexerApproach::OnePhase:
251 static void gasOilHysteresisParams(Scalar& pcSwMdc,
253 const Params& params)
255 switch (params.approach()) {
256 case EclMultiplexerApproach::Stone1:
257 Stone1Material::gasOilHysteresisParams(pcSwMdc, krnSwMdc,
258 params.template getRealParams<EclMultiplexerApproach::Stone1>());
261 case EclMultiplexerApproach::Stone2:
262 Stone2Material::gasOilHysteresisParams(pcSwMdc, krnSwMdc,
263 params.template getRealParams<EclMultiplexerApproach::Stone2>());
266 case EclMultiplexerApproach::Default:
267 DefaultMaterial::gasOilHysteresisParams(pcSwMdc, krnSwMdc,
268 params.template getRealParams<EclMultiplexerApproach::Default>());
271 case EclMultiplexerApproach::TwoPhase:
272 TwoPhaseMaterial::gasOilHysteresisParams(pcSwMdc, krnSwMdc,
273 params.template getRealParams<EclMultiplexerApproach::TwoPhase>());
276 case EclMultiplexerApproach::OnePhase:
288 static void setGasOilHysteresisParams(
const Scalar& pcSwMdc,
289 const Scalar& krnSwMdc,
292 switch (params.approach()) {
293 case EclMultiplexerApproach::Stone1:
294 Stone1Material::setGasOilHysteresisParams(pcSwMdc, krnSwMdc,
295 params.template getRealParams<EclMultiplexerApproach::Stone1>());
298 case EclMultiplexerApproach::Stone2:
299 Stone2Material::setGasOilHysteresisParams(pcSwMdc, krnSwMdc,
300 params.template getRealParams<EclMultiplexerApproach::Stone2>());
303 case EclMultiplexerApproach::Default:
304 DefaultMaterial::setGasOilHysteresisParams(pcSwMdc, krnSwMdc,
305 params.template getRealParams<EclMultiplexerApproach::Default>());
308 case EclMultiplexerApproach::TwoPhase:
309 TwoPhaseMaterial::setGasOilHysteresisParams(pcSwMdc, krnSwMdc,
310 params.template getRealParams<EclMultiplexerApproach::TwoPhase>());
313 case EclMultiplexerApproach::OnePhase:
328 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
329 static Evaluation
pcgn(
const Params& ,
332 throw std::logic_error(
"Not implemented: pcgn()");
344 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
345 static Evaluation
pcnw(
const Params& ,
348 throw std::logic_error(
"Not implemented: pcnw()");
354 template <
class ContainerT,
class Flu
idState>
359 throw std::logic_error(
"Not implemented: saturations()");
365 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
366 static Evaluation
Sg(
const Params& ,
369 throw std::logic_error(
"Not implemented: Sg()");
375 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
376 static Evaluation
Sn(
const Params& ,
379 throw std::logic_error(
"Not implemented: Sn()");
385 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
386 static Evaluation
Sw(
const Params& ,
389 throw std::logic_error(
"Not implemented: Sw()");
407 template <
class ContainerT,
class Flu
idState>
409 const Params& params,
410 const FluidState& fluidState)
413 switch (params.approach()) {
414 case EclMultiplexerApproach::Stone1:
416 params.template getRealParams<EclMultiplexerApproach::Stone1>(),
420 case EclMultiplexerApproach::Stone2:
422 params.template getRealParams<EclMultiplexerApproach::Stone2>(),
426 case EclMultiplexerApproach::Default:
428 params.template getRealParams<EclMultiplexerApproach::Default>(),
432 case EclMultiplexerApproach::TwoPhase:
434 params.template getRealParams<EclMultiplexerApproach::TwoPhase>(),
438 case EclMultiplexerApproach::OnePhase:
443 throw std::logic_error(
"Not implemented: relativePermeabilities() option for unknown EclMultiplexerApproach (="
444 + std::to_string(
static_cast<int>(params.approach())) +
")");
451 template <
class Evaluation,
class Flu
idState>
453 const FluidState& fluidState)
455 switch (params.approach()) {
456 case EclMultiplexerApproach::Stone1:
457 return Stone1Material::template relpermOilInOilGasSystem<Evaluation>
458 (params.template getRealParams<EclMultiplexerApproach::Stone1>(),
461 case EclMultiplexerApproach::Stone2:
462 return Stone2Material::template relpermOilInOilGasSystem<Evaluation>
463 (params.template getRealParams<EclMultiplexerApproach::Stone2>(),
466 case EclMultiplexerApproach::Default:
467 return DefaultMaterial::template relpermOilInOilGasSystem<Evaluation>
468 (params.template getRealParams<EclMultiplexerApproach::Default>(),
472 throw std::logic_error {
473 "relpermOilInOilGasSystem() is specific to three phases"
481 template <
class Evaluation,
class Flu
idState>
483 const FluidState& fluidState)
485 switch (params.approach()) {
486 case EclMultiplexerApproach::Stone1:
487 return Stone1Material::template relpermOilInOilWaterSystem<Evaluation>
488 (params.template getRealParams<EclMultiplexerApproach::Stone1>(),
491 case EclMultiplexerApproach::Stone2:
492 return Stone2Material::template relpermOilInOilWaterSystem<Evaluation>
493 (params.template getRealParams<EclMultiplexerApproach::Stone2>(),
496 case EclMultiplexerApproach::Default:
497 return DefaultMaterial::template relpermOilInOilWaterSystem<Evaluation>
498 (params.template getRealParams<EclMultiplexerApproach::Default>(),
502 throw std::logic_error {
503 "relpermOilInOilWaterSystem() is specific to three phases"
511 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
512 static Evaluation
krg(
const Params& ,
515 throw std::logic_error(
"Not implemented: krg()");
521 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
522 static Evaluation
krw(
const Params& ,
525 throw std::logic_error(
"Not implemented: krw()");
531 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
532 static Evaluation
krn(
const Params& ,
535 throw std::logic_error(
"Not implemented: krn()");
546 template <
class Flu
idState>
549 switch (params.approach()) {
550 case EclMultiplexerApproach::Stone1:
555 case EclMultiplexerApproach::Stone2:
560 case EclMultiplexerApproach::Default:
565 case EclMultiplexerApproach::TwoPhase:
569 case EclMultiplexerApproach::OnePhase:
Implements the default three phase capillary pressure law used by the ECLipse simulator.
Definition: EclDefaultMaterial.hpp:61
static void capillaryPressures(ContainerT &values, const Params ¶ms, const FluidState &state)
Implements the default three phase capillary pressure law used by the ECLipse simulator.
Definition: EclDefaultMaterial.hpp:136
static void relativePermeabilities(ContainerT &values, const Params ¶ms, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclDefaultMaterial.hpp:310
static void updateHysteresis(Params ¶ms, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclDefaultMaterial.hpp:424
Implements a multiplexer class that provides all three phase capillary pressure laws used by the ECLi...
Definition: EclMultiplexerMaterial.hpp:58
static void capillaryPressures(ContainerT &values, const Params ¶ms, const FluidState &fluidState)
Implements the multiplexer three phase capillary pressure law used by the ECLipse simulator.
Definition: EclMultiplexerMaterial.hpp:135
static Evaluation relpermOilInOilWaterSystem(const Params ¶ms, const FluidState &fluidState)
The relative permeability of oil in oil/water system.
Definition: EclMultiplexerMaterial.hpp:482
static Evaluation krw(const Params &, const FluidState &)
The relative permeability of the wetting phase.
Definition: EclMultiplexerMaterial.hpp:522
static Evaluation Sg(const Params &, const FluidState &)
The saturation of the gas phase.
Definition: EclMultiplexerMaterial.hpp:366
static Evaluation relpermOilInOilGasSystem(const Params ¶ms, const FluidState &fluidState)
The relative permeability of oil in oil/gas system.
Definition: EclMultiplexerMaterial.hpp:452
static Evaluation pcgn(const Params &, const FluidState &)
Capillary pressure between the gas and the non-wetting liquid (i.e., oil) phase.
Definition: EclMultiplexerMaterial.hpp:329
static Evaluation pcnw(const Params &, const FluidState &)
Capillary pressure between the non-wetting liquid (i.e., oil) and the wetting liquid (i....
Definition: EclMultiplexerMaterial.hpp:345
static void updateHysteresis(Params ¶ms, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclMultiplexerMaterial.hpp:547
static constexpr bool isPressureDependent
Specify whether the quantities defined by this material law are dependent on the absolute pressure.
Definition: EclMultiplexerMaterial.hpp:110
static constexpr bool implementsTwoPhaseSatApi
Specify whether this material law implements the two-phase convenience API which only depends on the ...
Definition: EclMultiplexerMaterial.hpp:102
static constexpr bool isSaturationDependent
Specify whether the quantities defined by this material law are saturation dependent.
Definition: EclMultiplexerMaterial.hpp:106
static constexpr bool isTemperatureDependent
Specify whether the quantities defined by this material law are temperature dependent.
Definition: EclMultiplexerMaterial.hpp:114
static constexpr bool implementsTwoPhaseApi
Specify whether this material law implements the two-phase convenience API.
Definition: EclMultiplexerMaterial.hpp:98
static void relativePermeabilities(ContainerT &values, const Params ¶ms, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclMultiplexerMaterial.hpp:408
static Evaluation Sn(const Params &, const FluidState &)
The saturation of the non-wetting (i.e., oil) phase.
Definition: EclMultiplexerMaterial.hpp:376
static Evaluation krg(const Params &, const FluidState &)
The relative permeability of the gas phase.
Definition: EclMultiplexerMaterial.hpp:512
static constexpr bool isCompositionDependent
Specify whether the quantities defined by this material law are dependent on the phase composition.
Definition: EclMultiplexerMaterial.hpp:118
static void saturations(ContainerT &, const Params &, const FluidState &)
The inverse of the capillary pressure.
Definition: EclMultiplexerMaterial.hpp:355
static Evaluation krn(const Params &, const FluidState &)
The relative permeability of the non-wetting (i.e., oil) phase.
Definition: EclMultiplexerMaterial.hpp:532
static Evaluation Sw(const Params &, const FluidState &)
The saturation of the wetting (i.e., water) phase.
Definition: EclMultiplexerMaterial.hpp:386
Implements the second phase capillary pressure/relperm law suggested by Stone as used by the ECLipse ...
Definition: EclStone1Material.hpp:60
static void relativePermeabilities(ContainerT &values, const Params ¶ms, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclStone1Material.hpp:313
static void capillaryPressures(ContainerT &values, const Params ¶ms, const FluidState &state)
Implements the default three phase capillary pressure law used by the ECLipse simulator.
Definition: EclStone1Material.hpp:135
static void updateHysteresis(Params ¶ms, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclStone1Material.hpp:420
Implements the second phase capillary pressure/relperm law suggested by Stone as used by the ECLipse ...
Definition: EclStone2Material.hpp:61
static void updateHysteresis(Params ¶ms, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclStone2Material.hpp:404
static void capillaryPressures(ContainerT &values, const Params ¶ms, const FluidState &state)
Implements the default three phase capillary pressure law used by the ECLipse simulator.
Definition: EclStone2Material.hpp:136
static void relativePermeabilities(ContainerT &values, const Params ¶ms, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclStone2Material.hpp:314
Implements a multiplexer class that provides ECL saturation functions for twophase simulations.
Definition: EclTwoPhaseMaterial.hpp:57
static void relativePermeabilities(ContainerT &values, const Params ¶ms, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclTwoPhaseMaterial.hpp:317
static void updateHysteresis(Params ¶ms, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclTwoPhaseMaterial.hpp:393
static void capillaryPressures(ContainerT &values, const Params ¶ms, const FluidState &fluidState)
Implements the multiplexer three phase capillary pressure law used by the ECLipse simulator.
Definition: EclTwoPhaseMaterial.hpp:129
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30