27 #ifndef OPM_ECL_TWO_PHASE_MATERIAL_HPP 28 #define OPM_ECL_TWO_PHASE_MATERIAL_HPP 32 #include <opm/common/Valgrind.hpp> 35 #include <opm/common/Exceptions.hpp> 36 #include <opm/common/ErrorMacros.hpp> 51 template <
class TraitsT,
52 class GasOilMaterialLawT,
53 class OilWaterMaterialLawT,
54 class ParamsT = EclTwoPhaseMaterialParams<TraitsT,
55 typename GasOilMaterialLawT::Params,
56 typename OilWaterMaterialLawT::Params> >
60 typedef GasOilMaterialLawT GasOilMaterialLaw;
61 typedef OilWaterMaterialLawT OilWaterMaterialLaw;
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(std::is_same<
typename GasOilMaterialLaw::Scalar,
74 typename OilWaterMaterialLaw::Scalar>::value,
75 "The two two-phase capillary pressure laws must use the same " 76 "type of floating point values.");
78 typedef TraitsT Traits;
79 typedef ParamsT Params;
80 typedef typename Traits::Scalar Scalar;
82 static const int numPhases = 3;
83 static const int waterPhaseIdx = Traits::wettingPhaseIdx;
84 static const int oilPhaseIdx = Traits::nonWettingPhaseIdx;
85 static const int gasPhaseIdx = Traits::gasPhaseIdx;
125 template <
class ContainerT,
class Flu
idState>
127 const Params& params,
128 const FluidState& fluidState)
130 typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
132 switch (params.approach()) {
133 case EclTwoPhaseGasOil: {
134 const Evaluation& So =
135 Opm::decay<Evaluation>(fluidState.saturation(oilPhaseIdx));
137 values[oilPhaseIdx] = 0.0;
138 values[gasPhaseIdx] = GasOilMaterialLaw::twoPhaseSatPcnw(params.gasOilParams(), So);
142 case EclTwoPhaseOilWater: {
143 const Evaluation&
Sw =
144 Opm::decay<Evaluation>(fluidState.saturation(waterPhaseIdx));
146 values[waterPhaseIdx] = 0.0;
147 values[oilPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatPcnw(params.oilWaterParams(),
Sw);
151 case EclTwoPhaseGasWater: {
152 const Evaluation&
Sw =
153 Opm::decay<Evaluation>(fluidState.saturation(waterPhaseIdx));
155 values[waterPhaseIdx] = 0.0;
156 values[gasPhaseIdx] =
157 OilWaterMaterialLaw::twoPhaseSatPcnw(params.oilWaterParams(),
Sw)
158 + GasOilMaterialLaw::twoPhaseSatPcnw(params.gasOilParams(), 0.0);
171 static void oilWaterHysteresisParams(Scalar& pcSwMdc,
173 const Params& params)
175 pcSwMdc = params.oilWaterParams().pcSwMdc();
176 krnSwMdc = params.oilWaterParams().krnSwMdc();
178 Valgrind::CheckDefined(pcSwMdc);
179 Valgrind::CheckDefined(krnSwMdc);
188 static void setOilWaterHysteresisParams(
const Scalar& pcSwMdc,
189 const Scalar& krnSwMdc,
192 const Scalar krwSw = 2.0;
193 params.oilWaterParams().update(pcSwMdc, krwSw, krnSwMdc);
202 static void gasOilHysteresisParams(Scalar& pcSwMdc,
204 const Params& params)
206 pcSwMdc = params.gasOilParams().pcSwMdc();
207 krnSwMdc = params.gasOilParams().krnSwMdc();
209 Valgrind::CheckDefined(pcSwMdc);
210 Valgrind::CheckDefined(krnSwMdc);
219 static void setGasOilHysteresisParams(
const Scalar& pcSwMdc,
220 const Scalar& krnSwMdc,
223 const Scalar krwSw = 2.0;
224 params.gasOilParams().update(pcSwMdc, krwSw, krnSwMdc);
236 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
237 static Evaluation
pcgn(
const Params& ,
240 OPM_THROW(std::logic_error,
"Not implemented: pcgn()");
252 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
253 static Evaluation
pcnw(
const Params& ,
256 OPM_THROW(std::logic_error,
"Not implemented: pcnw()");
262 template <
class ContainerT,
class Flu
idState>
267 OPM_THROW(std::logic_error,
"Not implemented: saturations()");
273 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
274 static Evaluation
Sg(
const Params& ,
277 OPM_THROW(std::logic_error,
"Not implemented: Sg()");
283 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
284 static Evaluation
Sn(
const Params& ,
287 OPM_THROW(std::logic_error,
"Not implemented: Sn()");
293 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
294 static Evaluation
Sw(
const Params& ,
297 OPM_THROW(std::logic_error,
"Not implemented: Sw()");
315 template <
class ContainerT,
class Flu
idState>
317 const Params& params,
318 const FluidState& fluidState)
320 typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
322 switch (params.approach()) {
323 case EclTwoPhaseGasOil: {
324 const Evaluation& So =
325 Opm::decay<Evaluation>(fluidState.saturation(oilPhaseIdx));
327 values[oilPhaseIdx] = GasOilMaterialLaw::twoPhaseSatKrw(params.gasOilParams(), So);
328 values[gasPhaseIdx] = GasOilMaterialLaw::twoPhaseSatKrn(params.gasOilParams(), So);
332 case EclTwoPhaseOilWater: {
333 const Evaluation&
Sw =
334 Opm::decay<Evaluation>(fluidState.saturation(waterPhaseIdx));
336 values[waterPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatKrw(params.oilWaterParams(),
Sw);
337 values[oilPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatKrn(params.oilWaterParams(),
Sw);
341 case EclTwoPhaseGasWater: {
342 const Evaluation&
Sw =
343 Opm::decay<Evaluation>(fluidState.saturation(waterPhaseIdx));
345 values[waterPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatKrw(params.oilWaterParams(),
Sw);
346 values[gasPhaseIdx] = GasOilMaterialLaw::twoPhaseSatKrn(params.gasOilParams(),
Sw);
355 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
356 static Evaluation
krg(
const Params& ,
359 OPM_THROW(std::logic_error,
"Not implemented: krg()");
365 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
366 static Evaluation
krw(
const Params& ,
369 OPM_THROW(std::logic_error,
"Not implemented: krw()");
375 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
376 static Evaluation
krn(
const Params& ,
379 OPM_THROW(std::logic_error,
"Not implemented: krn()");
390 template <
class Flu
idState>
393 switch (params.approach()) {
394 case EclTwoPhaseGasOil: {
395 Scalar So = Opm::scalarValue(fluidState.saturation(oilPhaseIdx));
397 params.gasOilParams().update(So, So, So);
401 case EclTwoPhaseOilWater: {
402 Scalar
Sw = Opm::scalarValue(fluidState.saturation(waterPhaseIdx));
404 params.oilWaterParams().update(
Sw,
Sw,
Sw);
408 case EclTwoPhaseGasWater: {
409 Scalar
Sw = Opm::scalarValue(fluidState.saturation(waterPhaseIdx));
411 params.oilWaterParams().update(
Sw,
Sw, 0);
412 params.gasOilParams().update(1.0, 0.0,
Sw);
static Evaluation krw(const Params &, const FluidState &)
The relative permeability of the wetting phase.
Definition: EclTwoPhaseMaterial.hpp:366
static Evaluation krg(const Params &, const FluidState &)
The relative permeability of the gas phase.
Definition: EclTwoPhaseMaterial.hpp:356
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:126
static Evaluation Sg(const Params &, const FluidState &)
The saturation of the gas phase.
Definition: EclTwoPhaseMaterial.hpp:274
static void saturations(ContainerT &, const Params &, const FluidState &)
The inverse of the capillary pressure.
Definition: EclTwoPhaseMaterial.hpp:263
Definition: Air_Mesitylene.hpp:33
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:253
static const bool isCompositionDependent
Specify whether the quantities defined by this material law are dependent on the phase composition...
Definition: EclTwoPhaseMaterial.hpp:109
static const bool isPressureDependent
Specify whether the quantities defined by this material law are dependent on the absolute pressure...
Definition: EclTwoPhaseMaterial.hpp:101
static const bool isSaturationDependent
Specify whether the quantities defined by this material law are saturation dependent.
Definition: EclTwoPhaseMaterial.hpp:97
static Evaluation Sn(const Params &, const FluidState &)
The saturation of the non-wetting (i.e., oil) phase.
Definition: EclTwoPhaseMaterial.hpp:284
static const bool implementsTwoPhaseSatApi
Specify whether this material law implements the two-phase convenience API which only depends on the ...
Definition: EclTwoPhaseMaterial.hpp:93
static Evaluation krn(const Params &, const FluidState &)
The relative permeability of the non-wetting (i.e., oil) phase.
Definition: EclTwoPhaseMaterial.hpp:376
static void relativePermeabilities(ContainerT &values, const Params ¶ms, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclTwoPhaseMaterial.hpp:316
static void updateHysteresis(Params ¶ms, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclTwoPhaseMaterial.hpp:391
static Evaluation pcgn(const Params &, const FluidState &)
Capillary pressure between the gas and the non-wetting liquid (i.e., oil) phase.
Definition: EclTwoPhaseMaterial.hpp:237
static Evaluation Sw(const Params &, const FluidState &)
The saturation of the wetting (i.e., water) phase.
Definition: EclTwoPhaseMaterial.hpp:294
Implements a multiplexer class that provides ECL saturation functions for twophase simulations...
Definition: EclTwoPhaseMaterial.hpp:57
Implementation for the parameters required by the material law for two-phase simulations.
static const bool isTemperatureDependent
Specify whether the quantities defined by this material law are temperature dependent.
Definition: EclTwoPhaseMaterial.hpp:105
static const bool implementsTwoPhaseApi
Specify whether this material law implements the two-phase convenience API.
Definition: EclTwoPhaseMaterial.hpp:89