27 #ifndef OPM_ECL_TWO_PHASE_MATERIAL_HPP
28 #define OPM_ECL_TWO_PHASE_MATERIAL_HPP
48 template <
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> >
59 using GasOilMaterialLaw = GasOilMaterialLawT;
60 using OilWaterMaterialLaw = OilWaterMaterialLawT;
61 using GasWaterMaterialLaw = GasWaterMaterialLawT;
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.");
81 using Traits = TraitsT;
82 using Params = ParamsT;
83 using Scalar =
typename Traits::Scalar;
85 static constexpr
int numPhases = 3;
86 static constexpr
int waterPhaseIdx = Traits::wettingPhaseIdx;
87 static constexpr
int oilPhaseIdx = Traits::nonWettingPhaseIdx;
88 static constexpr
int gasPhaseIdx = Traits::gasPhaseIdx;
128 template <
class ContainerT,
class Flu
idState>
130 const Params& params,
131 const FluidState& fluidState)
133 using Evaluation =
typename std::remove_reference<decltype(values[0])>::type;
135 switch (params.approach()) {
136 case EclTwoPhaseApproach::EclTwoPhaseGasOil: {
137 const Evaluation& So =
138 decay<Evaluation>(fluidState.saturation(oilPhaseIdx));
140 values[oilPhaseIdx] = 0.0;
141 values[gasPhaseIdx] = GasOilMaterialLaw::twoPhaseSatPcnw(params.gasOilParams(), So);
145 case EclTwoPhaseApproach::EclTwoPhaseOilWater: {
146 const Evaluation&
Sw =
147 decay<Evaluation>(fluidState.saturation(waterPhaseIdx));
149 values[waterPhaseIdx] = 0.0;
150 values[oilPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatPcnw(params.oilWaterParams(),
Sw);
154 case EclTwoPhaseApproach::EclTwoPhaseGasWater: {
155 const Evaluation&
Sw =
156 decay<Evaluation>(fluidState.saturation(waterPhaseIdx));
158 values[waterPhaseIdx] = 0.0;
159 values[gasPhaseIdx] = GasWaterMaterialLaw::twoPhaseSatPcnw(params.gasWaterParams(),
Sw);
172 static void oilWaterHysteresisParams(Scalar& pcSwMdc,
174 const Params& params)
176 pcSwMdc = params.oilWaterParams().pcSwMdc();
177 krnSwMdc = params.oilWaterParams().krnSwMdc();
179 Valgrind::CheckDefined(pcSwMdc);
180 Valgrind::CheckDefined(krnSwMdc);
189 static void setOilWaterHysteresisParams(
const Scalar& pcSwMdc,
190 const Scalar& krnSwMdc,
193 constexpr
const Scalar krwSw = 2.0;
194 params.oilWaterParams().update(pcSwMdc, krwSw, krnSwMdc);
203 static void gasOilHysteresisParams(Scalar& pcSwMdc,
205 const Params& params)
207 pcSwMdc = params.gasOilParams().pcSwMdc();
208 krnSwMdc = params.gasOilParams().krnSwMdc();
210 Valgrind::CheckDefined(pcSwMdc);
211 Valgrind::CheckDefined(krnSwMdc);
220 static void setGasOilHysteresisParams(
const Scalar& pcSwMdc,
221 const Scalar& 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>
238 static Evaluation
pcgn(
const Params& ,
241 throw std::logic_error(
"Not implemented: pcgn()");
253 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
254 static Evaluation
pcnw(
const Params& ,
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>
275 static Evaluation
Sg(
const Params& ,
278 throw std::logic_error(
"Not implemented: Sg()");
284 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
285 static Evaluation
Sn(
const Params& ,
288 throw std::logic_error(
"Not implemented: Sn()");
294 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
295 static Evaluation
Sw(
const Params& ,
298 throw std::logic_error(
"Not implemented: Sw()");
316 template <
class ContainerT,
class Flu
idState>
318 const Params& params,
319 const FluidState& fluidState)
321 using Evaluation =
typename std::remove_reference<decltype(values[0])>::type;
323 switch (params.approach()) {
324 case EclTwoPhaseApproach::EclTwoPhaseGasOil: {
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);
333 case EclTwoPhaseApproach::EclTwoPhaseOilWater: {
334 const Evaluation&
Sw =
335 decay<Evaluation>(fluidState.saturation(waterPhaseIdx));
337 values[waterPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatKrw(params.oilWaterParams(),
Sw);
338 values[oilPhaseIdx] = OilWaterMaterialLaw::twoPhaseSatKrn(params.oilWaterParams(),
Sw);
342 case EclTwoPhaseApproach::EclTwoPhaseGasWater: {
343 const Evaluation&
Sw =
344 decay<Evaluation>(fluidState.saturation(waterPhaseIdx));
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>
358 static Evaluation
krg(
const Params& ,
361 throw std::logic_error(
"Not implemented: krg()");
367 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
368 static Evaluation
krw(
const Params& ,
371 throw std::logic_error(
"Not implemented: krw()");
377 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
378 static Evaluation
krn(
const Params& ,
381 throw std::logic_error(
"Not implemented: krn()");
392 template <
class Flu
idState>
395 switch (params.approach()) {
396 case EclTwoPhaseApproach::EclTwoPhaseGasOil: {
397 Scalar So = scalarValue(fluidState.saturation(oilPhaseIdx));
399 params.gasOilParams().update(So, So, So);
403 case EclTwoPhaseApproach::EclTwoPhaseOilWater: {
404 Scalar
Sw = scalarValue(fluidState.saturation(waterPhaseIdx));
406 params.oilWaterParams().update(
Sw,
Sw,
Sw);
410 case EclTwoPhaseApproach::EclTwoPhaseGasWater: {
411 Scalar
Sw = scalarValue(fluidState.saturation(waterPhaseIdx));
413 params.gasWaterParams().update(1.0, 0.0,
Sw);
Implementation for the parameters required by the material law for two-phase simulations.
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 constexpr bool isTemperatureDependent
Specify whether the quantities defined by this material law are temperature dependent.
Definition: EclTwoPhaseMaterial.hpp:108
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
Specify whether this material law implements the two-phase convenience API.
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 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
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 bool isSaturationDependent
Specify whether the quantities defined by this material law are saturation dependent.
Definition: EclTwoPhaseMaterial.hpp:100
static constexpr bool isPressureDependent
Specify whether the quantities defined by this material law are dependent on the absolute pressure.
Definition: EclTwoPhaseMaterial.hpp:104
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 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
Specify whether the quantities defined by this material law are dependent on the phase composition.
Definition: EclTwoPhaseMaterial.hpp:112
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
static Evaluation krw(const Params &, const FluidState &)
The relative permeability of the wetting phase.
Definition: EclTwoPhaseMaterial.hpp:368
static constexpr bool implementsTwoPhaseSatApi
Specify whether this material law implements the two-phase convenience API which only depends on the ...
Definition: EclTwoPhaseMaterial.hpp:96