27 #ifndef OPM_SAT_CURVE_MULTIPLEXER_HPP 28 #define OPM_SAT_CURVE_MULTIPLEXER_HPP 32 #include <opm/common/ErrorMacros.hpp> 33 #include <opm/common/utility/gpuDecorators.hpp> 39 #if (defined(__GNUC__) && (__GNUC__ < 13)) || defined(__CUDACC__) 40 #define STATIC_ASSERT_SATCURVE_MULTIPLEXER_UNLESS_GCC_LT_13 throw std::logic_error("Unhandled SatCurveMultiplexerApproach") 42 #define STATIC_ASSERT_SATCURVE_MULTIPLEXER_UNLESS_GCC_LT_13 static_assert(false, "Unhandled SatCurveMultiplexerApproach") 53 template <
class TraitsT,
class ParamsT = SatCurveMultiplexerParams<TraitsT> >
57 using Traits = TraitsT;
58 using Params = ParamsT;
59 using Scalar =
typename Traits::Scalar;
65 using Traits::numPhases;
66 static_assert(numPhases == 2,
67 "The Brooks-Corey capillary pressure law only applies " 68 "to the case of two fluid phases");
94 static_assert(Traits::numPhases == 2,
95 "The number of fluid phases must be two if you want to use " 96 "this material law!");
101 template <
class Container,
class Flu
idState>
102 static void capillaryPressures(Container& values,
const Params& params,
const FluidState& fluidState)
104 switch (params.approach()) {
105 case SatCurveMultiplexerApproach::LET:
107 params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
111 case SatCurveMultiplexerApproach::PiecewiseLinear:
113 params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
123 template <
class Container,
class Flu
idState>
124 static void saturations(Container& values,
const Params& params,
const FluidState& fluidState)
126 switch (params.approach()) {
127 case SatCurveMultiplexerApproach::LET:
129 params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
133 case SatCurveMultiplexerApproach::PiecewiseLinear:
135 params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
151 template <
class Container,
class Flu
idState>
154 switch (params.approach()) {
155 case SatCurveMultiplexerApproach::LET:
157 params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
161 case SatCurveMultiplexerApproach::PiecewiseLinear:
163 params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
172 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::ValueType>
173 static Evaluation
pcnw(
const Params& params,
const FluidState& fluidState)
175 switch (params.approach()) {
176 case SatCurveMultiplexerApproach::LET:
181 case SatCurveMultiplexerApproach::PiecewiseLinear:
182 return PLTwoPhaseLaw::pcnw(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
190 template <
class Evaluation,
class ...Args>
191 OPM_HOST_DEVICE
static Evaluation twoPhaseSatPcnw(
const Params& params,
const Evaluation&
Sw)
193 if constexpr (FrontIsSatCurveMultiplexerDispatchV<Args...>) {
194 return twoPhaseSatPcnwT<Evaluation, Args...>(params,
Sw);
197 #if OPM_IS_INSIDE_DEVICE_FUNCTION 201 switch (params.approach()) {
202 case SatCurveMultiplexerApproach::LET:
203 return LETTwoPhaseLaw::twoPhaseSatPcnw(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
207 case SatCurveMultiplexerApproach::PiecewiseLinear:
217 template <
class Evaluation,
class Head,
class ...Args>
218 OPM_HOST_DEVICE
static Evaluation twoPhaseSatPcnwT(
const Params& params,
const Evaluation&
Sw)
220 if constexpr (Head::approach == SatCurveMultiplexerApproach::LET) {
221 return LETTwoPhaseLaw::twoPhaseSatPcnw(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
223 }
else if constexpr (Head::approach == SatCurveMultiplexerApproach::PiecewiseLinear) {
227 STATIC_ASSERT_SATCURVE_MULTIPLEXER_UNLESS_GCC_LT_13;
231 template <
class Evaluation>
232 static Evaluation twoPhaseSatPcnwInv(
const Params&,
const Evaluation&)
234 throw std::logic_error(
"SatCurveMultiplexer::twoPhaseSatPcnwInv" 235 " not implemented!");
241 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::ValueType>
242 static Evaluation
Sw(
const Params& params,
const FluidState& fluidstate)
244 switch (params.approach()) {
245 case SatCurveMultiplexerApproach::LET:
246 return LETTwoPhaseLaw::Sw(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
250 case SatCurveMultiplexerApproach::PiecewiseLinear:
251 return PLTwoPhaseLaw::Sw(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
259 template <
class Evaluation>
260 static Evaluation twoPhaseSatSw(
const Params&,
const Evaluation&)
262 throw std::logic_error(
"SatCurveMultiplexer::twoPhaseSatSw" 263 " not implemented!");
270 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::ValueType>
271 static Evaluation
Sn(
const Params& params,
const FluidState& fluidstate)
273 switch (params.approach()) {
274 case SatCurveMultiplexerApproach::LET:
275 return LETTwoPhaseLaw::Sn(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
279 case SatCurveMultiplexerApproach::PiecewiseLinear:
280 return PLTwoPhaseLaw::Sn(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
288 template <
class Evaluation>
289 static Evaluation twoPhaseSatSn(
const Params& params,
const Evaluation& pc)
291 switch (params.approach()) {
292 case SatCurveMultiplexerApproach::LET:
293 return LETTwoPhaseLaw::twoPhaseSatSn(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
297 case SatCurveMultiplexerApproach::PiecewiseLinear:
298 return PLTwoPhaseLaw::twoPhaseSatSn(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
310 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::ValueType>
311 static Evaluation
krw(
const Params& params,
const FluidState& fluidstate)
313 switch (params.approach()) {
314 case SatCurveMultiplexerApproach::LET:
315 return LETTwoPhaseLaw::krw(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
319 case SatCurveMultiplexerApproach::PiecewiseLinear:
320 return PLTwoPhaseLaw::krw(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
328 template <
class Evaluation,
class ...Args>
329 OPM_HOST_DEVICE
static Evaluation twoPhaseSatKrw(
const Params& params,
const Evaluation&
Sw)
331 if constexpr (FrontIsSatCurveMultiplexerDispatchV<Args...>) {
332 return twoPhaseSatKrwT<Evaluation, Args...>(params,
Sw);
335 #if OPM_IS_INSIDE_DEVICE_FUNCTION 336 return PLTwoPhaseLaw::twoPhaseSatKrw(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
339 switch (params.approach()) {
340 case SatCurveMultiplexerApproach::LET:
341 return LETTwoPhaseLaw::twoPhaseSatKrw(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
345 case SatCurveMultiplexerApproach::PiecewiseLinear:
346 return PLTwoPhaseLaw::twoPhaseSatKrw(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
355 template <
class Evaluation,
class Head,
class ...Args>
356 OPM_HOST_DEVICE
static Evaluation twoPhaseSatKrwT(
const Params& params,
const Evaluation&
Sw)
358 if constexpr (Head::approach == SatCurveMultiplexerApproach::LET) {
359 return LETTwoPhaseLaw::twoPhaseSatKrw(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
361 }
else if constexpr (Head::approach == SatCurveMultiplexerApproach::PiecewiseLinear) {
362 return PLTwoPhaseLaw::twoPhaseSatKrw(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
365 STATIC_ASSERT_SATCURVE_MULTIPLEXER_UNLESS_GCC_LT_13;
369 template <
class Evaluation>
370 static Evaluation twoPhaseSatKrwInv(
const Params& params,
const Evaluation&
krw)
372 switch (params.approach()) {
373 case SatCurveMultiplexerApproach::LET:
374 return LETTwoPhaseLaw::twoPhaseSatKrwInv(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
378 case SatCurveMultiplexerApproach::PiecewiseLinear:
379 return PLTwoPhaseLaw::twoPhaseSatKrwInv(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
391 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::ValueType>
392 static Evaluation
krn(
const Params& params,
const FluidState& fluidstate)
394 switch (params.approach()) {
395 case SatCurveMultiplexerApproach::LET:
396 return LETTwoPhaseLaw::krn(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
400 case SatCurveMultiplexerApproach::PiecewiseLinear:
401 return PLTwoPhaseLaw::krn(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
409 template <
class Evaluation,
class ...Args>
410 OPM_HOST_DEVICE
static Evaluation twoPhaseSatKrn(
const Params& params,
const Evaluation&
Sw)
412 if constexpr (FrontIsSatCurveMultiplexerDispatchV<Args...>) {
413 return twoPhaseSatKrnT<Evaluation, Args...>(params,
Sw);
416 #if OPM_IS_INSIDE_DEVICE_FUNCTION 417 return PLTwoPhaseLaw::twoPhaseSatKrn(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
420 switch (params.approach()) {
421 case SatCurveMultiplexerApproach::LET:
422 return LETTwoPhaseLaw::twoPhaseSatKrn(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
426 case SatCurveMultiplexerApproach::PiecewiseLinear:
427 return PLTwoPhaseLaw::twoPhaseSatKrn(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
436 template <
class Evaluation,
class Head,
class ...Args>
437 OPM_HOST_DEVICE
static Evaluation twoPhaseSatKrnT(
const Params& params,
const Evaluation&
Sw)
439 if constexpr (Head::approach == SatCurveMultiplexerApproach::LET) {
440 return LETTwoPhaseLaw::twoPhaseSatKrn(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
442 }
else if constexpr (Head::approach == SatCurveMultiplexerApproach::PiecewiseLinear) {
443 return PLTwoPhaseLaw::twoPhaseSatKrn(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
446 STATIC_ASSERT_SATCURVE_MULTIPLEXER_UNLESS_GCC_LT_13;
450 template <
class Evaluation>
451 static Evaluation twoPhaseSatKrnInv(
const Params& params,
const Evaluation&
krn)
453 switch (params.approach()) {
454 case SatCurveMultiplexerApproach::LET:
455 return LETTwoPhaseLaw::twoPhaseSatKrnInv(params.template getRealParams<SatCurveMultiplexerApproach::LET>(),
459 case SatCurveMultiplexerApproach::PiecewiseLinear:
460 return PLTwoPhaseLaw::twoPhaseSatKrnInv(params.template getRealParams<SatCurveMultiplexerApproach::PiecewiseLinear>(),
471 #endif // OPM_SAT_CURVE_MULTIPLEXER_HPP static OPM_HOST_DEVICE void saturations(Container &, const Params &, const FluidState &)
The saturations of the fluid phases starting from their pressure differences.
Definition: PiecewiseLinearTwoPhaseMaterial.hpp:115
static constexpr bool implementsTwoPhaseApi
Specify whether this material law implements the two-phase convenience API.
Definition: SatCurveMultiplexer.hpp:72
static Evaluation krw(const Params ¶ms, const FluidState &fluidstate)
The relative permeability for the wetting phase of the medium.
Definition: SatCurveMultiplexer.hpp:311
static constexpr bool isSaturationDependent
Specify whether the quantities defined by this material law are saturation dependent.
Definition: SatCurveMultiplexer.hpp:80
Specification of the material parameters for the saturation function multiplexer. ...
static Evaluation pcnw(const Params &, const FluidState &)
The capillary pressure-saturation curve.
Definition: TwoPhaseLETCurves.hpp:130
static constexpr bool isCompositionDependent
Specify whether the quantities defined by this material law are dependent on the phase composition...
Definition: SatCurveMultiplexer.hpp:92
static constexpr bool isPressureDependent
Specify whether the quantities defined by this material law are dependent on the absolute pressure...
Definition: SatCurveMultiplexer.hpp:84
static OPM_HOST_DEVICE void relativePermeabilities(Container &values, const Params ¶ms, const FluidState &fs)
The relative permeabilities.
Definition: PiecewiseLinearTwoPhaseMaterial.hpp:122
static void capillaryPressures(Container &values, const Params ¶ms, const FluidState &fluidState)
The capillary pressure-saturation curves.
Definition: SatCurveMultiplexer.hpp:102
static void saturations(Container &, const Params &, const FluidState &)
Calculate the saturations of the phases starting from their pressure differences. ...
Definition: TwoPhaseLETCurves.hpp:103
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
static constexpr bool implementsTwoPhaseSatApi
Specify whether this material law implements the two-phase convenience API which only depends on the ...
Definition: SatCurveMultiplexer.hpp:76
Implementation of a tabulated, piecewise linear capillary pressure law.
Definition: PiecewiseLinearTwoPhaseMaterial.hpp:53
static OPM_HOST_DEVICE void capillaryPressures(Container &values, const Params ¶ms, const FluidState &fs)
The capillary pressure-saturation curve.
Definition: PiecewiseLinearTwoPhaseMaterial.hpp:101
static void relativePermeabilities(Container &, const Params &, const FluidState &)
The relative permeability-saturation curves.
Definition: TwoPhaseLETCurves.hpp:119
static Evaluation krn(const Params ¶ms, const FluidState &fluidstate)
The relative permeability for the non-wetting phase of the medium.
Definition: SatCurveMultiplexer.hpp:392
static constexpr bool isTemperatureDependent
Specify whether the quantities defined by this material law are temperature dependent.
Definition: SatCurveMultiplexer.hpp:88
static OPM_HOST_DEVICE Evaluation krn(const Params ¶ms, const FluidState &fs)
The relative permeability for the non-wetting phase of the porous medium.
Definition: PiecewiseLinearTwoPhaseMaterial.hpp:214
Implementation of the LET curve saturation functions.
Definition: TwoPhaseLETCurves.hpp:49
static OPM_HOST_DEVICE Evaluation krw(const Params ¶ms, const FluidState &fs)
The relative permeability for the wetting phase of the porous medium.
Definition: PiecewiseLinearTwoPhaseMaterial.hpp:186
static OPM_HOST_DEVICE Evaluation Sw(const Params &, const FluidState &)
The saturation-capillary pressure curve.
Definition: PiecewiseLinearTwoPhaseMaterial.hpp:162
static Evaluation krw(const Params &, const FluidState &)
The relative permeability for the wetting phase of the medium implied by the LET parameterization.
Definition: TwoPhaseLETCurves.hpp:193
static Evaluation krn(const Params &, const FluidState &)
The relative permeability for the non-wetting phase of the medium as implied by the LET parameterizat...
Definition: TwoPhaseLETCurves.hpp:237
static OPM_HOST_DEVICE Evaluation twoPhaseSatPcnw(const Params ¶ms, const Evaluation &Sw)
The saturation-capillary pressure curve.
Definition: PiecewiseLinearTwoPhaseMaterial.hpp:148
static Evaluation Sn(const Params ¶ms, const FluidState &fluidstate)
Calculate the non-wetting phase saturations depending on the phase pressures.
Definition: SatCurveMultiplexer.hpp:271
static OPM_HOST_DEVICE Evaluation pcnw(const Params ¶ms, const FluidState &fs)
The capillary pressure-saturation curve.
Definition: PiecewiseLinearTwoPhaseMaterial.hpp:135
static void saturations(Container &values, const Params ¶ms, const FluidState &fluidState)
Calculate the saturations of the phases starting from their pressure differences. ...
Definition: SatCurveMultiplexer.hpp:124
static OPM_HOST_DEVICE Evaluation Sn(const Params ¶ms, const FluidState &fs)
Calculate the non-wetting phase saturations depending on the phase pressures.
Definition: PiecewiseLinearTwoPhaseMaterial.hpp:174
static void capillaryPressures(Container &, const Params &, const FluidState &)
The capillary pressure-saturation curves.
Definition: TwoPhaseLETCurves.hpp:93
static Evaluation pcnw(const Params ¶ms, const FluidState &fluidState)
The capillary pressure-saturation curve.
Definition: SatCurveMultiplexer.hpp:173
static void relativePermeabilities(Container &values, const Params ¶ms, const FluidState &fluidState)
The relative permeability-saturation curves.
Definition: SatCurveMultiplexer.hpp:152
static Evaluation Sw(const Params ¶ms, const FluidState &fluidstate)
The saturation-capillary pressure curve.
Definition: SatCurveMultiplexer.hpp:242
Implements a multiplexer class that provides LET curves and piecewise linear saturation functions...
Definition: SatCurveMultiplexer.hpp:54