27 #ifndef OPM_ECL_STONE1_MATERIAL_HPP 28 #define OPM_ECL_STONE1_MATERIAL_HPP 32 #include <opm/common/Valgrind.hpp> 35 #include <opm/common/Exceptions.hpp> 36 #include <opm/common/ErrorMacros.hpp> 56 template <
class TraitsT,
57 class GasOilMaterialLawT,
58 class OilWaterMaterialLawT,
59 class ParamsT = EclStone1MaterialParams<TraitsT, GasOilMaterialLawT, OilWaterMaterialLawT> >
63 typedef GasOilMaterialLawT GasOilMaterialLaw;
64 typedef OilWaterMaterialLawT OilWaterMaterialLaw;
67 static_assert(TraitsT::numPhases == 3,
68 "The number of phases considered by this capillary pressure " 69 "law is always three!");
70 static_assert(GasOilMaterialLaw::numPhases == 2,
71 "The number of phases considered by the gas-oil capillary " 72 "pressure law must be two!");
73 static_assert(OilWaterMaterialLaw::numPhases == 2,
74 "The number of phases considered by the oil-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 static_assert(GasOilMaterialLaw::implementsTwoPhaseSatApi,
82 "The gas-oil material law must implement the two-phase saturation " 83 "only API to for the default Ecl capillary pressure law!");
84 static_assert(OilWaterMaterialLaw::implementsTwoPhaseSatApi,
85 "The oil-water material law must implement the two-phase saturation " 86 "only API to for the default Ecl capillary pressure law!");
88 typedef TraitsT Traits;
89 typedef ParamsT Params;
90 typedef typename Traits::Scalar Scalar;
92 static const int numPhases = 3;
93 static const int waterPhaseIdx = Traits::wettingPhaseIdx;
94 static const int oilPhaseIdx = Traits::nonWettingPhaseIdx;
95 static const int gasPhaseIdx = Traits::gasPhaseIdx;
135 template <
class ContainerT,
class Flu
idState>
137 const Params& params,
138 const FluidState& state)
140 typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
141 values[gasPhaseIdx] = pcgn<FluidState, Evaluation>(params, state);
142 values[oilPhaseIdx] = 0;
143 values[waterPhaseIdx] = - pcnw<FluidState, Evaluation>(params, state);
144 Valgrind::CheckDefined(values[gasPhaseIdx]);
145 Valgrind::CheckDefined(values[oilPhaseIdx]);
146 Valgrind::CheckDefined(values[waterPhaseIdx]);
155 static void oilWaterHysteresisParams(Scalar& pcSwMdc,
157 const Params& params)
159 pcSwMdc = params.oilWaterParams().pcSwMdc();
160 krnSwMdc = params.oilWaterParams().krnSwMdc();
162 Valgrind::CheckDefined(pcSwMdc);
163 Valgrind::CheckDefined(krnSwMdc);
172 static void setOilWaterHysteresisParams(
const Scalar& pcSwMdc,
173 const Scalar& krnSwMdc,
176 const double krwSw = 2.0;
177 params.oilWaterParams().update(pcSwMdc, krwSw, krnSwMdc);
186 static void gasOilHysteresisParams(Scalar& pcSwMdc,
188 const Params& params)
190 pcSwMdc = params.gasOilParams().pcSwMdc();
191 krnSwMdc = params.gasOilParams().krnSwMdc();
193 Valgrind::CheckDefined(pcSwMdc);
194 Valgrind::CheckDefined(krnSwMdc);
203 static void setGasOilHysteresisParams(
const Scalar& pcSwMdc,
204 const Scalar& krnSwMdc,
207 const double krwSw = 2.0;
208 params.gasOilParams().update(pcSwMdc, krwSw, krnSwMdc);
220 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
221 static Evaluation
pcgn(
const Params& params,
222 const FluidState& fs)
224 const auto&
Sw = 1.0 - Opm::decay<Evaluation>(fs.saturation(gasPhaseIdx));
225 return GasOilMaterialLaw::twoPhaseSatPcnw(params.gasOilParams(),
Sw);
237 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
238 static Evaluation
pcnw(
const Params& params,
239 const FluidState& fs)
241 const auto&
Sw = Opm::decay<Evaluation>(fs.saturation(waterPhaseIdx));
242 Valgrind::CheckDefined(
Sw);
243 const auto& result = OilWaterMaterialLaw::twoPhaseSatPcnw(params.oilWaterParams(),
Sw);
244 Valgrind::CheckDefined(result);
251 template <
class ContainerT,
class Flu
idState>
256 OPM_THROW(std::logic_error,
"Not implemented: saturations()");
262 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
263 static Evaluation
Sg(
const Params& ,
266 OPM_THROW(std::logic_error,
"Not implemented: Sg()");
272 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
273 static Evaluation
Sn(
const Params& ,
276 OPM_THROW(std::logic_error,
"Not implemented: Sn()");
282 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
283 static Evaluation
Sw(
const Params& ,
286 OPM_THROW(std::logic_error,
"Not implemented: Sw()");
304 template <
class ContainerT,
class Flu
idState>
306 const Params& params,
307 const FluidState& fluidState)
309 typedef typename std::remove_reference<decltype(values[0])>::type Evaluation;
311 values[waterPhaseIdx] = krw<FluidState, Evaluation>(params, fluidState);
312 values[oilPhaseIdx] = krn<FluidState, Evaluation>(params, fluidState);
313 values[gasPhaseIdx] = krg<FluidState, Evaluation>(params, fluidState);
319 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
320 static Evaluation
krg(
const Params& params,
321 const FluidState& fluidState)
323 const Evaluation&
Sw = 1 - Opm::decay<Evaluation>(fluidState.saturation(gasPhaseIdx));
324 return GasOilMaterialLaw::twoPhaseSatKrn(params.gasOilParams(),
Sw);
330 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
331 static Evaluation
krw(
const Params& params,
332 const FluidState& fluidState)
334 const Evaluation&
Sw = Opm::decay<Evaluation>(fluidState.saturation(waterPhaseIdx));
335 return OilWaterMaterialLaw::twoPhaseSatKrw(params.oilWaterParams(),
Sw);
341 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
342 static Evaluation
krn(
const Params& params,
343 const FluidState& fluidState)
348 Scalar Swco = params.Swl();
351 Scalar krocw = params.krocw();
353 const Evaluation&
Sw = Opm::decay<Evaluation>(fluidState.saturation(waterPhaseIdx));
354 const Evaluation&
Sg = Opm::decay<Evaluation>(fluidState.saturation(gasPhaseIdx));
356 Evaluation kro_ow = OilWaterMaterialLaw::twoPhaseSatKrn(params.oilWaterParams(),
Sw);
357 Evaluation kro_go = GasOilMaterialLaw::twoPhaseSatKrw(params.gasOilParams(), 1 -
Sg - Swco);
366 Evaluation SSw = (
Sw - Swco)/(1.0 - Swco);
367 Evaluation SSg =
Sg/(1.0 - Swco);
368 Evaluation SSo = 1.0 - SSw - SSg;
370 if (SSw >= 1.0 || SSg >= 1.0)
373 beta = Opm::pow( SSo/((1 - SSw)*(1 - SSg)), params.eta());
376 return Opm::max(0.0, Opm::min(1.0, beta*kro_ow*kro_go/krocw));
386 template <
class Flu
idState>
389 Scalar
Sw = Opm::scalarValue(fluidState.saturation(waterPhaseIdx));
390 Scalar
Sg = Opm::scalarValue(fluidState.saturation(gasPhaseIdx));
392 params.oilWaterParams().update(
Sw,
Sw,
Sw);
393 params.gasOilParams().update(1 -
Sg, 1 -
Sg, 1 -
Sg);
static void saturations(ContainerT &, const Params &, const FluidState &)
The inverse of the capillary pressure.
Definition: EclStone1Material.hpp:252
Default implementation for the parameters required by the three-phase capillary pressure/relperm Ston...
static Evaluation Sg(const Params &, const FluidState &)
The saturation of the gas phase.
Definition: EclStone1Material.hpp:263
static Evaluation Sn(const Params &, const FluidState &)
The saturation of the non-wetting (i.e., oil) phase.
Definition: EclStone1Material.hpp:273
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: EclStone1Material.hpp:238
static const bool implementsTwoPhaseSatApi
Specify whether this material law implements the two-phase convenience API which only depends on the ...
Definition: EclStone1Material.hpp:103
static Evaluation Sw(const Params &, const FluidState &)
The saturation of the wetting (i.e., water) phase.
Definition: EclStone1Material.hpp:283
static Evaluation krg(const Params ¶ms, const FluidState &fluidState)
The relative permeability of the gas phase.
Definition: EclStone1Material.hpp:320
Definition: Air_Mesitylene.hpp:33
static void relativePermeabilities(ContainerT &values, const Params ¶ms, const FluidState &fluidState)
The relative permeability of all phases.
Definition: EclStone1Material.hpp:305
static void updateHysteresis(Params ¶ms, const FluidState &fluidState)
Update the hysteresis parameters after a time step.
Definition: EclStone1Material.hpp:387
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: EclStone1Material.hpp:136
Implements the second phase capillary pressure/relperm law suggested by Stone as used by the ECLipse ...
Definition: EclStone1Material.hpp:60
static const bool isPressureDependent
Specify whether the quantities defined by this material law are dependent on the absolute pressure...
Definition: EclStone1Material.hpp:111
static const bool implementsTwoPhaseApi
Specify whether this material law implements the two-phase convenience API.
Definition: EclStone1Material.hpp:99
static Evaluation krw(const Params ¶ms, const FluidState &fluidState)
The relative permeability of the wetting phase.
Definition: EclStone1Material.hpp:331
static const bool isCompositionDependent
Specify whether the quantities defined by this material law are dependent on the phase composition...
Definition: EclStone1Material.hpp:119
static Evaluation krn(const Params ¶ms, const FluidState &fluidState)
The relative permeability of the non-wetting (i.e., oil) phase.
Definition: EclStone1Material.hpp:342
static const bool isSaturationDependent
Specify whether the quantities defined by this material law are saturation dependent.
Definition: EclStone1Material.hpp:107
static const bool isTemperatureDependent
Specify whether the quantities defined by this material law are temperature dependent.
Definition: EclStone1Material.hpp:115
static Evaluation pcgn(const Params ¶ms, const FluidState &fs)
Capillary pressure between the gas and the non-wetting liquid (i.e., oil) phase.
Definition: EclStone1Material.hpp:221