27 #ifndef OPM_ECL_STONE2_MATERIAL_HPP 28 #define OPM_ECL_STONE2_MATERIAL_HPP 32 #include <opm/common/Valgrind.hpp> 35 #include <opm/common/Exceptions.hpp> 36 #include <opm/common/ErrorMacros.hpp> 55 template <
class TraitsT,
56 class GasOilMaterialLawT,
57 class OilWaterMaterialLawT,
58 class ParamsT = EclStone2MaterialParams<TraitsT,
59 typename GasOilMaterialLawT::Params,
60 typename OilWaterMaterialLawT::Params> >
64 typedef GasOilMaterialLawT GasOilMaterialLaw;
65 typedef OilWaterMaterialLawT OilWaterMaterialLaw;
68 static_assert(TraitsT::numPhases == 3,
69 "The number of phases considered by this capillary pressure " 70 "law is always three!");
71 static_assert(GasOilMaterialLaw::numPhases == 2,
72 "The number of phases considered by the gas-oil capillary " 73 "pressure law must be two!");
74 static_assert(OilWaterMaterialLaw::numPhases == 2,
75 "The number of phases considered by the oil-water capillary " 76 "pressure law must be two!");
77 static_assert(std::is_same<
typename GasOilMaterialLaw::Scalar,
78 typename OilWaterMaterialLaw::Scalar>::value,
79 "The two two-phase capillary pressure laws must use the same " 80 "type of floating point values.");
82 static_assert(GasOilMaterialLaw::implementsTwoPhaseSatApi,
83 "The gas-oil material law must implement the two-phase saturation " 84 "only API to for the default Ecl capillary pressure law!");
85 static_assert(OilWaterMaterialLaw::implementsTwoPhaseSatApi,
86 "The oil-water material law must implement the two-phase saturation " 87 "only API to for the default Ecl capillary pressure law!");
89 typedef TraitsT Traits;
90 typedef ParamsT Params;
91 typedef typename Traits::Scalar Scalar;
93 static const int numPhases = 3;
94 static const int waterPhaseIdx = Traits::wettingPhaseIdx;
95 static const int oilPhaseIdx = Traits::nonWettingPhaseIdx;
96 static const int gasPhaseIdx = Traits::gasPhaseIdx;
136 template <
class ContainerT,
class Flu
idState>
138 const Params& params,
139 const FluidState& state)
141 typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
142 values[gasPhaseIdx] = pcgn<FluidState, Evaluation>(params, state);
143 values[oilPhaseIdx] = 0;
144 values[waterPhaseIdx] = - pcnw<FluidState, Evaluation>(params, state);
145 Valgrind::CheckDefined(values[gasPhaseIdx]);
146 Valgrind::CheckDefined(values[oilPhaseIdx]);
147 Valgrind::CheckDefined(values[waterPhaseIdx]);
156 static void oilWaterHysteresisParams(Scalar& pcSwMdc,
158 const Params& params)
160 pcSwMdc = params.oilWaterParams().pcSwMdc();
161 krnSwMdc = params.oilWaterParams().krnSwMdc();
163 Valgrind::CheckDefined(pcSwMdc);
164 Valgrind::CheckDefined(krnSwMdc);
173 static void setOilWaterHysteresisParams(
const Scalar& pcSwMdc,
174 const Scalar& krnSwMdc,
177 const double krwSw = 2.0;
178 params.oilWaterParams().update(pcSwMdc, krwSw, krnSwMdc);
187 static void gasOilHysteresisParams(Scalar& pcSwMdc,
189 const Params& params)
191 pcSwMdc = params.gasOilParams().pcSwMdc();
192 krnSwMdc = params.gasOilParams().krnSwMdc();
194 Valgrind::CheckDefined(pcSwMdc);
195 Valgrind::CheckDefined(krnSwMdc);
204 static void setGasOilHysteresisParams(
const Scalar& pcSwMdc,
205 const Scalar& krnSwMdc,
208 const double krwSw = 2.0;
209 params.gasOilParams().update(pcSwMdc, krwSw, krnSwMdc);
221 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
222 static Evaluation
pcgn(
const Params& params,
223 const FluidState& fs)
225 const auto&
Sw = 1.0 - Opm::decay<Evaluation>(fs.saturation(gasPhaseIdx));
226 return GasOilMaterialLaw::twoPhaseSatPcnw(params.gasOilParams(),
Sw);
238 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
239 static Evaluation
pcnw(
const Params& params,
240 const FluidState& fs)
242 const auto&
Sw = Opm::decay<Evaluation>(fs.saturation(waterPhaseIdx));
243 Valgrind::CheckDefined(
Sw);
244 const auto& result = OilWaterMaterialLaw::twoPhaseSatPcnw(params.oilWaterParams(),
Sw);
245 Valgrind::CheckDefined(result);
252 template <
class ContainerT,
class Flu
idState>
257 OPM_THROW(std::logic_error,
"Not implemented: saturations()");
263 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
264 static Evaluation
Sg(
const Params& ,
267 OPM_THROW(std::logic_error,
"Not implemented: Sg()");
273 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
274 static Evaluation
Sn(
const Params& ,
277 OPM_THROW(std::logic_error,
"Not implemented: Sn()");
283 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
284 static Evaluation
Sw(
const Params& ,
287 OPM_THROW(std::logic_error,
"Not implemented: Sw()");
305 template <
class ContainerT,
class Flu
idState>
307 const Params& params,
308 const FluidState& fluidState)
310 typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
312 values[waterPhaseIdx] = krw<FluidState, Evaluation>(params, fluidState);
313 values[oilPhaseIdx] = krn<FluidState, Evaluation>(params, fluidState);
314 values[gasPhaseIdx] = krg<FluidState, Evaluation>(params, fluidState);
320 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
321 static Evaluation
krg(
const Params& params,
322 const FluidState& fluidState)
324 const Evaluation&
Sw = 1 - Opm::decay<Evaluation>(fluidState.saturation(gasPhaseIdx));
325 return GasOilMaterialLaw::twoPhaseSatKrn(params.gasOilParams(),
Sw);
331 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
332 static Evaluation
krw(
const Params& params,
333 const FluidState& fluidState)
335 const Evaluation&
Sw = Opm::decay<Evaluation>(fluidState.saturation(waterPhaseIdx));
336 return OilWaterMaterialLaw::twoPhaseSatKrw(params.oilWaterParams(),
Sw);
342 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
343 static Evaluation
krn(
const Params& params,
344 const FluidState& fluidState)
346 Scalar Swco = params.Swl();
347 const Evaluation&
Sw = Opm::decay<Evaluation>(fluidState.saturation(waterPhaseIdx));
348 const Evaluation&
Sg = Opm::decay<Evaluation>(fluidState.saturation(gasPhaseIdx));
350 Scalar krocw = OilWaterMaterialLaw::twoPhaseSatKrn(params.oilWaterParams(), Swco);
351 Evaluation krow = OilWaterMaterialLaw::twoPhaseSatKrn(params.oilWaterParams(),
Sw);
352 Evaluation
krw = OilWaterMaterialLaw::twoPhaseSatKrw(params.oilWaterParams(),
Sw);
353 Evaluation
krg = GasOilMaterialLaw::twoPhaseSatKrn(params.gasOilParams(), 1 -
Sg);
354 Evaluation krog = GasOilMaterialLaw::twoPhaseSatKrw(params.gasOilParams(), 1 -
Sg);
356 return krocw*((krow/krocw +
krw)*(krog/krocw +
krg) -
krw -
krg);
366 template <
class Flu
idState>
369 Scalar
Sw = Opm::scalarValue(fluidState.saturation(waterPhaseIdx));
370 Scalar
Sg = Opm::scalarValue(fluidState.saturation(gasPhaseIdx));
372 params.oilWaterParams().update(
Sw,
Sw,
Sw);
373 params.gasOilParams().update(1 -
Sg, 1 -
Sg, 1 -
Sg);
static Evaluation krw(const Params ¶ms, const FluidState &fluidState)
The relative permeability of the wetting phase.
Definition: EclStone2Material.hpp:332
static void updateHysteresis(Params ¶ms, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclStone2Material.hpp:367
static void relativePermeabilities(ContainerT &values, const Params ¶ms, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclStone2Material.hpp:306
static const bool implementsTwoPhaseApi
Specify whether this material law implements the two-phase convenience API.
Definition: EclStone2Material.hpp:100
Definition: Air_Mesitylene.hpp:33
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:137
static const bool isSaturationDependent
Specify whether the quantities defined by this material law are saturation dependent.
Definition: EclStone2Material.hpp:108
static void saturations(ContainerT &, const Params &, const FluidState &)
The inverse of the capillary pressure.
Definition: EclStone2Material.hpp:253
Default implementation for the parameters required by the three-phase capillary pressure/relperm Ston...
static Evaluation krn(const Params ¶ms, const FluidState &fluidState)
The relative permeability of the non-wetting (i.e., oil) phase.
Definition: EclStone2Material.hpp:343
Implements the second phase capillary pressure/relperm law suggested by Stone as used by the ECLipse ...
Definition: EclStone2Material.hpp:61
static Evaluation Sg(const Params &, const FluidState &)
The saturation of the gas phase.
Definition: EclStone2Material.hpp:264
static Evaluation krg(const Params ¶ms, const FluidState &fluidState)
The relative permeability of the gas phase.
Definition: EclStone2Material.hpp:321
static const bool isTemperatureDependent
Specify whether the quantities defined by this material law are temperature dependent.
Definition: EclStone2Material.hpp:116
static Evaluation Sn(const Params &, const FluidState &)
The saturation of the non-wetting (i.e., oil) phase.
Definition: EclStone2Material.hpp:274
static const bool isCompositionDependent
Specify whether the quantities defined by this material law are dependent on the phase composition...
Definition: EclStone2Material.hpp:120
static const bool implementsTwoPhaseSatApi
Specify whether this material law implements the two-phase convenience API which only depends on the ...
Definition: EclStone2Material.hpp:104
static Evaluation pcgn(const Params ¶ms, const FluidState &fs)
Capillary pressure between the gas and the non-wetting liquid (i.e., oil) phase.
Definition: EclStone2Material.hpp:222
static Evaluation pcnw(const Params ¶ms, const FluidState &fs)
Capillary pressure between the non-wetting liquid (i.e., oil) and the wetting liquid (i...
Definition: EclStone2Material.hpp:239
static Evaluation Sw(const Params &, const FluidState &)
The saturation of the wetting (i.e., water) phase.
Definition: EclStone2Material.hpp:284
static const bool isPressureDependent
Specify whether the quantities defined by this material law are dependent on the absolute pressure...
Definition: EclStone2Material.hpp:112