25 #ifndef OPM_ECL_TWO_PHASE_MATERIAL_HPP
26 #define OPM_ECL_TWO_PHASE_MATERIAL_HPP
33 #include <opm/common/Exceptions.hpp>
34 #include <opm/common/ErrorMacros.hpp>
49 template <
class TraitsT,
50 class GasOilMaterialLawT,
51 class OilWaterMaterialLawT,
52 class ParamsT = EclTwoPhaseMaterialParams<TraitsT,
53 typename GasOilMaterialLawT::Params,
54 typename OilWaterMaterialLawT::Params> >
62 static_assert(TraitsT::numPhases == 3,
63 "The number of phases considered by this capillary pressure "
64 "law is always three!");
65 static_assert(GasOilMaterialLaw::numPhases == 2,
66 "The number of phases considered by the gas-oil capillary "
67 "pressure law must be two!");
68 static_assert(OilWaterMaterialLaw::numPhases == 2,
69 "The number of phases considered by the oil-water capillary "
70 "pressure law must be two!");
71 static_assert(std::is_same<
typename GasOilMaterialLaw::Scalar,
72 typename OilWaterMaterialLaw::Scalar>::value,
73 "The two two-phase capillary pressure laws must use the same "
74 "type of floating point values.");
76 typedef TraitsT Traits;
77 typedef ParamsT Params;
78 typedef typename Traits::Scalar Scalar;
80 static const int numPhases = 3;
81 static const int waterPhaseIdx = Traits::wettingPhaseIdx;
82 static const int oilPhaseIdx = Traits::nonWettingPhaseIdx;
83 static const int gasPhaseIdx = Traits::gasPhaseIdx;
87 static const bool implementsTwoPhaseApi =
false;
91 static const bool implementsTwoPhaseSatApi =
false;
95 static const bool isSaturationDependent =
true;
99 static const bool isPressureDependent =
false;
103 static const bool isTemperatureDependent =
false;
107 static const bool isCompositionDependent =
false;
123 template <
class ContainerT,
class Flu
idState>
124 static void capillaryPressures(ContainerT &values,
125 const Params ¶ms,
126 const FluidState &fluidState)
128 typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
131 switch (params.approach()) {
133 const Evaluation& So =
134 FsToolbox::template toLhs<Evaluation>(fluidState.saturation(oilPhaseIdx));
136 values[oilPhaseIdx] = 0.0;
137 values[gasPhaseIdx] = GasOilMaterialLaw::twoPhaseSatPcnw(params.gasOilParams(), So);
142 const Evaluation& Sw =
143 FsToolbox::template toLhs<Evaluation>(fluidState.saturation(waterPhaseIdx));
145 values[waterPhaseIdx] = 0.0;
146 values[oilPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatPcnw(params.oilWaterParams(), Sw);
151 const Evaluation& Sw =
152 FsToolbox::template toLhs<Evaluation>(fluidState.saturation(waterPhaseIdx));
154 values[waterPhaseIdx] = 0.0;
155 values[gasPhaseIdx] =
156 OilWaterMaterialLaw::twoPhaseSatPcnw(params.oilWaterParams(), Sw)
157 + GasOilMaterialLaw::twoPhaseSatPcnw(params.gasOilParams(), 0.0);
172 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
173 static Evaluation pcgn(
const Params& ,
176 OPM_THROW(std::logic_error,
"Not implemented: pcgn()");
188 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
189 static Evaluation pcnw(
const Params& ,
192 OPM_THROW(std::logic_error,
"Not implemented: pcnw()");
198 template <
class ContainerT,
class Flu
idState>
199 static void saturations(ContainerT& ,
203 OPM_THROW(std::logic_error,
"Not implemented: saturations()");
209 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
210 static Evaluation Sg(
const Params& ,
213 OPM_THROW(std::logic_error,
"Not implemented: Sg()");
219 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
220 static Evaluation Sn(
const Params& ,
223 OPM_THROW(std::logic_error,
"Not implemented: Sn()");
229 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
230 static Evaluation Sw(
const Params& ,
233 OPM_THROW(std::logic_error,
"Not implemented: Sw()");
251 template <
class ContainerT,
class Flu
idState>
252 static void relativePermeabilities(ContainerT &values,
253 const Params ¶ms,
254 const FluidState &fluidState)
256 typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
257 typedef MathToolbox<typename FluidState::Scalar> FsToolbox;
259 switch (params.approach()) {
261 const Evaluation& So =
262 FsToolbox::template toLhs<Evaluation>(fluidState.saturation(oilPhaseIdx));
264 values[oilPhaseIdx] = GasOilMaterialLaw::twoPhaseSatKrw(params.gasOilParams(), So);
265 values[gasPhaseIdx] = GasOilMaterialLaw::twoPhaseSatKrn(params.gasOilParams(), So);
270 const Evaluation& Sw =
271 FsToolbox::template toLhs<Evaluation>(fluidState.saturation(waterPhaseIdx));
273 values[waterPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatKrw(params.oilWaterParams(), Sw);
274 values[oilPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatKrn(params.oilWaterParams(), Sw);
279 const Evaluation& Sw =
280 FsToolbox::template toLhs<Evaluation>(fluidState.saturation(waterPhaseIdx));
282 values[waterPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatKrw(params.oilWaterParams(), Sw);
283 values[gasPhaseIdx] = GasOilMaterialLaw::twoPhaseSatKrn(params.gasOilParams(), Sw);
292 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
293 static Evaluation krg(
const Params& ,
296 OPM_THROW(std::logic_error,
"Not implemented: krg()");
302 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
303 static Evaluation krw(
const Params& ,
306 OPM_THROW(std::logic_error,
"Not implemented: krw()");
312 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
313 static Evaluation krn(
const Params& ,
316 OPM_THROW(std::logic_error,
"Not implemented: krn()");
327 template <
class Flu
idState>
328 static void updateHysteresis(Params ¶ms,
const FluidState &fluidState)
330 typedef MathToolbox<typename FluidState::Scalar> FsToolbox;
332 switch (params.approach()) {
334 Scalar So = FsToolbox::value(fluidState.saturation(oilPhaseIdx));
336 params.oilWaterParams().update(0.0, 0.0, 0.0);
337 params.gasOilParams().update(So, So, So);
342 Scalar Sw = FsToolbox::value(fluidState.saturation(waterPhaseIdx));
344 params.oilWaterParams().update(Sw, Sw, Sw);
345 params.gasOilParams().update(0.0, 0.0, 0.0);
350 Scalar Sw = FsToolbox::value(fluidState.saturation(waterPhaseIdx));
352 params.oilWaterParams().update(Sw, Sw, 0);
353 params.gasOilParams().update(1.0, 0.0, Sw);
Definition: EclTwoPhaseMaterialParams.hpp:35
Definition: Air_Mesitylene.hpp:31
Some templates to wrap the valgrind client request macros.
Implementation for the parameters required by the material law for two-phase simulations.
Definition: EclTwoPhaseMaterialParams.hpp:34
Implements a multiplexer class that provides ECL saturation functions for twophase simulations...
Definition: EclTwoPhaseMaterial.hpp:55
GasOilMaterialLawT GasOilMaterialLaw
Definition: EclTwoPhaseMaterial.hpp:58
OilWaterMaterialLawT OilWaterMaterialLaw
Definition: EclTwoPhaseMaterial.hpp:59
Definition: EclTwoPhaseMaterialParams.hpp:36