27#ifndef OPM_ECL_TWO_PHASE_MATERIAL_HPP
28#define OPM_ECL_TWO_PHASE_MATERIAL_HPP
48template <
class TraitsT,
49 class GasOilMaterialLawT,
50 class OilWaterMaterialLawT,
51 class GasWaterMaterialLawT,
52 class ParamsT = EclTwoPhaseMaterialParams<TraitsT,
53 typename GasOilMaterialLawT::Params,
54 typename OilWaterMaterialLawT::Params,
55 typename GasWaterMaterialLawT::Params> >
64 static_assert(TraitsT::numPhases == 3,
65 "The number of phases considered by this capillary pressure "
66 "law is always three!");
67 static_assert(GasOilMaterialLaw::numPhases == 2,
68 "The number of phases considered by the gas-oil capillary "
69 "pressure law must be two!");
70 static_assert(OilWaterMaterialLaw::numPhases == 2,
71 "The number of phases considered by the oil-water capillary "
72 "pressure law must be two!");
73 static_assert(GasWaterMaterialLaw::numPhases == 2,
74 "The number of phases considered by the gas-water capillary "
75 "pressure law must be two!");
76 static_assert(std::is_same<
typename GasOilMaterialLaw::Scalar,
77 typename OilWaterMaterialLaw::Scalar>::value,
78 "The two two-phase capillary pressure laws must use the same "
79 "type of floating point values.");
83 using Scalar =
typename Traits::Scalar;
87 static constexpr int oilPhaseIdx = Traits::nonWettingPhaseIdx;
128 template <
class ContainerT,
class Flu
idState>
131 const FluidState& fluidState)
133 using Evaluation =
typename std::remove_reference<
decltype(values[0])>::type;
135 switch (params.approach()) {
137 const Evaluation& So =
138 decay<Evaluation>(fluidState.saturation(
oilPhaseIdx));
141 values[
gasPhaseIdx] = GasOilMaterialLaw::twoPhaseSatPcnw(params.gasOilParams(), So);
146 const Evaluation&
Sw =
150 values[
oilPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatPcnw(params.oilWaterParams(),
Sw);
155 const Evaluation&
Sw =
159 values[
gasPhaseIdx] = GasWaterMaterialLaw::twoPhaseSatPcnw(params.gasWaterParams(),
Sw);
176 pcSwMdc = params.oilWaterParams().pcSwMdc();
177 krnSwMdc = params.oilWaterParams().krnSwMdc();
193 constexpr const Scalar krwSw = 2.0;
194 params.oilWaterParams().update(pcSwMdc, krwSw, krnSwMdc);
207 pcSwMdc = params.gasOilParams().pcSwMdc();
208 krnSwMdc = params.gasOilParams().krnSwMdc();
224 constexpr const Scalar krwSw = 2.0;
225 params.gasOilParams().update(pcSwMdc, krwSw, krnSwMdc);
237 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
241 throw std::logic_error(
"Not implemented: pcgn()");
253 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
257 throw std::logic_error(
"Not implemented: pcnw()");
263 template <
class ContainerT,
class Flu
idState>
268 throw std::logic_error(
"Not implemented: saturations()");
274 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
278 throw std::logic_error(
"Not implemented: Sg()");
284 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
288 throw std::logic_error(
"Not implemented: Sn()");
294 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
298 throw std::logic_error(
"Not implemented: Sw()");
316 template <
class ContainerT,
class Flu
idState>
319 const FluidState& fluidState)
321 using Evaluation =
typename std::remove_reference<
decltype(values[0])>::type;
323 switch (params.approach()) {
325 const Evaluation& So =
326 decay<Evaluation>(fluidState.saturation(
oilPhaseIdx));
328 values[
oilPhaseIdx] = GasOilMaterialLaw::twoPhaseSatKrw(params.gasOilParams(), So);
329 values[
gasPhaseIdx] = GasOilMaterialLaw::twoPhaseSatKrn(params.gasOilParams(), So);
334 const Evaluation&
Sw =
337 values[
waterPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatKrw(params.oilWaterParams(),
Sw);
338 values[
oilPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatKrn(params.oilWaterParams(),
Sw);
343 const Evaluation&
Sw =
346 values[
waterPhaseIdx] = GasWaterMaterialLaw::twoPhaseSatKrw(params.gasWaterParams(),
Sw);
347 values[
gasPhaseIdx] = GasWaterMaterialLaw::twoPhaseSatKrn(params.gasWaterParams(),
Sw);
357 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
361 throw std::logic_error(
"Not implemented: krg()");
367 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
371 throw std::logic_error(
"Not implemented: krw()");
377 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
381 throw std::logic_error(
"Not implemented: krn()");
392 template <
class Flu
idState>
395 switch (params.approach()) {
399 params.gasOilParams().update(So, So, So);
406 params.oilWaterParams().update(
Sw,
Sw,
Sw);
413 params.gasWaterParams().update(1.0, 0.0,
Sw);
Some templates to wrap the valgrind client request macros.
Implements a multiplexer class that provides ECL saturation functions for twophase simulations.
Definition: EclTwoPhaseMaterial.hpp:57
static void setOilWaterHysteresisParams(const Scalar &pcSwMdc, const Scalar &krnSwMdc, Params ¶ms)
Definition: EclTwoPhaseMaterial.hpp:189
static constexpr bool isTemperatureDependent
Definition: EclTwoPhaseMaterial.hpp:108
GasOilMaterialLawT GasOilMaterialLaw
Definition: EclTwoPhaseMaterial.hpp:59
static void relativePermeabilities(ContainerT &values, const Params ¶ms, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclTwoPhaseMaterial.hpp:317
static constexpr bool implementsTwoPhaseApi
Definition: EclTwoPhaseMaterial.hpp:92
static Evaluation Sw(const Params &, const FluidState &)
The saturation of the wetting (i.e., water) phase.
Definition: EclTwoPhaseMaterial.hpp:295
static Evaluation pcgn(const Params &, const FluidState &)
Capillary pressure between the gas and the non-wetting liquid (i.e., oil) phase.
Definition: EclTwoPhaseMaterial.hpp:238
static constexpr int numPhases
Definition: EclTwoPhaseMaterial.hpp:85
ParamsT Params
Definition: EclTwoPhaseMaterial.hpp:82
static void saturations(ContainerT &, const Params &, const FluidState &)
The inverse of the capillary pressure.
Definition: EclTwoPhaseMaterial.hpp:264
static Evaluation krn(const Params &, const FluidState &)
The relative permeability of the non-wetting (i.e., oil) phase.
Definition: EclTwoPhaseMaterial.hpp:378
GasWaterMaterialLawT GasWaterMaterialLaw
Definition: EclTwoPhaseMaterial.hpp:61
static void updateHysteresis(Params ¶ms, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclTwoPhaseMaterial.hpp:393
static Evaluation Sn(const Params &, const FluidState &)
The saturation of the non-wetting (i.e., oil) phase.
Definition: EclTwoPhaseMaterial.hpp:285
static constexpr int oilPhaseIdx
Definition: EclTwoPhaseMaterial.hpp:87
static constexpr bool isSaturationDependent
Definition: EclTwoPhaseMaterial.hpp:100
static constexpr bool isPressureDependent
Definition: EclTwoPhaseMaterial.hpp:104
static void setGasOilHysteresisParams(const Scalar &pcSwMdc, const Scalar &krnSwMdc, Params ¶ms)
Definition: EclTwoPhaseMaterial.hpp:220
static Evaluation krg(const Params &, const FluidState &)
The relative permeability of the gas phase.
Definition: EclTwoPhaseMaterial.hpp:358
static Evaluation Sg(const Params &, const FluidState &)
The saturation of the gas phase.
Definition: EclTwoPhaseMaterial.hpp:275
static void gasOilHysteresisParams(Scalar &pcSwMdc, Scalar &krnSwMdc, const Params ¶ms)
Definition: EclTwoPhaseMaterial.hpp:203
static void oilWaterHysteresisParams(Scalar &pcSwMdc, Scalar &krnSwMdc, const Params ¶ms)
Definition: EclTwoPhaseMaterial.hpp:172
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
static constexpr bool isCompositionDependent
Definition: EclTwoPhaseMaterial.hpp:112
static constexpr int waterPhaseIdx
Definition: EclTwoPhaseMaterial.hpp:86
static Evaluation pcnw(const Params &, const FluidState &)
Capillary pressure between the non-wetting liquid (i.e., oil) and the wetting liquid (i....
Definition: EclTwoPhaseMaterial.hpp:254
TraitsT Traits
Definition: EclTwoPhaseMaterial.hpp:81
static constexpr int gasPhaseIdx
Definition: EclTwoPhaseMaterial.hpp:88
typename Traits::Scalar Scalar
Definition: EclTwoPhaseMaterial.hpp:83
OilWaterMaterialLawT OilWaterMaterialLaw
Definition: EclTwoPhaseMaterial.hpp:60
static Evaluation krw(const Params &, const FluidState &)
The relative permeability of the wetting phase.
Definition: EclTwoPhaseMaterial.hpp:368
static constexpr bool implementsTwoPhaseSatApi
Definition: EclTwoPhaseMaterial.hpp:96
bool CheckDefined(const T &value)
Make valgrind complain if any of the memory occupied by an object is undefined.
Definition: Valgrind.hpp:74
Definition: Air_Mesitylene.hpp:34
auto scalarValue(const Evaluation &val) -> decltype(MathToolbox< Evaluation >::scalarValue(val))
Definition: MathToolbox.hpp:335