27 #ifndef OPM_ECL_HYSTERESIS_TWO_PHASE_LAW_HPP
28 #define OPM_ECL_HYSTERESIS_TWO_PHASE_LAW_HPP
41 template <
class EffectiveLawT,
42 class ParamsT = EclHysteresisTwoPhaseLawParams<EffectiveLawT> >
46 using EffectiveLaw = EffectiveLawT;
47 using EffectiveLawParams =
typename EffectiveLaw::Params;
49 using Traits =
typename EffectiveLaw::Traits;
50 using Params = ParamsT;
51 using Scalar =
typename EffectiveLaw::Scalar;
53 enum { wettingPhaseIdx = Traits::wettingPhaseIdx };
54 enum { nonWettingPhaseIdx = Traits::nonWettingPhaseIdx };
57 static constexpr
int numPhases = EffectiveLaw::numPhases;
59 "The endpoint scaling applies to the nested twophase laws, not to "
60 "the threephase one!");
66 static_assert(EffectiveLaw::implementsTwoPhaseApi,
67 "The material laws put into EclEpsTwoPhaseLaw must implement the "
68 "two-phase material law API!");
74 static_assert(EffectiveLaw::implementsTwoPhaseSatApi,
75 "The material laws put into EclEpsTwoPhaseLaw must implement the "
76 "two-phase material law saturation API!");
104 template <
class Container,
class Flu
idState>
109 throw std::invalid_argument(
"The capillaryPressures(fs) method is not yet implemented");
122 template <
class Container,
class Flu
idState>
127 throw std::invalid_argument(
"The pcnw(fs) method is not yet implemented");
141 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
142 static Evaluation
pcnw(
const Params& ,
145 throw std::invalid_argument(
"The pcnw(fs) method is not yet implemented");
148 template <
class Evaluation>
149 static Evaluation twoPhaseSatPcnw(
const Params& params,
const Evaluation&
Sw)
152 if (!params.config().enableHysteresis() || params.config().pcHysteresisModel() < 0)
153 return EffectiveLaw::twoPhaseSatPcnw(params.drainageParams(),
Sw);
156 if (params.initialImb()) {
157 if (
Sw >= params.pcSwMic()) {
158 return EffectiveLaw::twoPhaseSatPcnw(params.imbibitionParams(),
Sw);
161 const Evaluation& F = (1.0/(params.pcSwMic()-
Sw+params.curvatureCapPrs())-1.0/params.curvatureCapPrs())
162 / (1.0/(params.pcSwMic()-params.Swcrd()+params.curvatureCapPrs())-1.0/params.curvatureCapPrs());
164 const Evaluation& Pcd = EffectiveLaw::twoPhaseSatPcnw(params.drainageParams(),
Sw);
165 const Evaluation& Pci = EffectiveLaw::twoPhaseSatPcnw(params.imbibitionParams(),
Sw);
166 const Evaluation& pc_Killough = Pci+F*(Pcd-Pci);
173 if (
Sw <= params.pcSwMdc())
174 return EffectiveLaw::twoPhaseSatPcnw(params.drainageParams(),
Sw);
177 Scalar Swma = 1.0-params.Sncrt();
179 const Evaluation& Pci = EffectiveLaw::twoPhaseSatPcnw(params.imbibitionParams(),
Sw);
183 Scalar pciwght = params.pcWght();
185 const Evaluation& SwEff =
Sw;
186 const Evaluation& Pci = pciwght*EffectiveLaw::twoPhaseSatPcnw(params.imbibitionParams(), SwEff);
188 const Evaluation& Pcd = EffectiveLaw::twoPhaseSatPcnw(params.drainageParams(),
Sw);
193 const Evaluation& F = (1.0/(
Sw-params.pcSwMdc()+params.curvatureCapPrs())-1.0/params.curvatureCapPrs())
194 / (1.0/(Swma-params.pcSwMdc()+params.curvatureCapPrs())-1.0/params.curvatureCapPrs());
196 const Evaluation& pc_Killough = Pcd+F*(Pci-Pcd);
207 template <
class Container,
class Flu
idState>
212 throw std::invalid_argument(
"The saturations(fs) method is not yet implemented");
219 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
220 static Evaluation
Sw(
const Params& ,
223 throw std::invalid_argument(
"The Sw(fs) method is not yet implemented");
226 template <
class Evaluation>
227 static Evaluation twoPhaseSatSw(
const Params& ,
230 throw std::invalid_argument(
"The twoPhaseSatSw(pc) method is not yet implemented");
237 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
238 static Evaluation
Sn(
const Params& ,
241 throw std::invalid_argument(
"The Sn(pc) method is not yet implemented");
244 template <
class Evaluation>
245 static Evaluation twoPhaseSatSn(
const Params& ,
248 throw std::invalid_argument(
"The twoPhaseSatSn(pc) method is not yet implemented");
260 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
261 static Evaluation
krw(
const Params& ,
264 throw std::invalid_argument(
"The krw(fs) method is not yet implemented");
267 template <
class Evaluation>
268 static Evaluation twoPhaseSatKrw(
const Params& params,
const Evaluation&
Sw)
271 if (!params.config().enableHysteresis() || params.config().krHysteresisModel() < 0)
272 return EffectiveLaw::twoPhaseSatKrw(params.drainageParams(),
Sw);
274 if (params.config().krHysteresisModel() == 0 || params.config().krHysteresisModel() == 2)
276 return EffectiveLaw::twoPhaseSatKrw(params.drainageParams(),
Sw);
279 assert(params.config().krHysteresisModel() == 1 || params.config().krHysteresisModel() == 3);
280 return EffectiveLaw::twoPhaseSatKrw(params.imbibitionParams(),
Sw);
286 template <
class Flu
idState,
class Evaluation =
typename Flu
idState::Scalar>
287 static Evaluation
krn(
const Params& ,
290 throw std::invalid_argument(
"The krn(fs) method is not yet implemented");
293 template <
class Evaluation>
294 static Evaluation twoPhaseSatKrn(
const Params& params,
const Evaluation&
Sw)
297 if (!params.config().enableHysteresis() || params.config().krHysteresisModel() < 0)
298 return EffectiveLaw::twoPhaseSatKrn(params.drainageParams(),
Sw);
302 if (
Sw <= params.krnSwMdc())
303 return EffectiveLaw::twoPhaseSatKrn(params.drainageParams(),
Sw);
305 if (params.config().krHysteresisModel() <= 1) {
306 return EffectiveLaw::twoPhaseSatKrn(params.imbibitionParams(),
307 Sw + params.deltaSwImbKrn());
311 assert(params.config().krHysteresisModel() == 2 || params.config().krHysteresisModel() == 3);
312 Evaluation Snorm = params.Sncri()+(1.0-
Sw-params.Sncrt())*(params.Snmaxd()-params.Sncri())/(params.Snhy()-params.Sncrt());
313 return params.krnWght()*EffectiveLaw::twoPhaseSatKrn(params.imbibitionParams(),1.0-Snorm);
A default implementation of the parameters for the material law which implements the ECL relative per...
This material law implements the hysteresis model of the ECL file format.
Definition: EclHysteresisTwoPhaseLaw.hpp:44
static constexpr bool isSaturationDependent
Specify whether the quantities defined by this material law are saturation dependent.
Definition: EclHysteresisTwoPhaseLaw.hpp:80
static Evaluation krn(const Params &, const FluidState &)
The relative permeability of the non-wetting phase.
Definition: EclHysteresisTwoPhaseLaw.hpp:287
static void capillaryPressures(Container &, const Params &, const FluidState &)
The capillary pressure-saturation curves depending on absolute saturations.
Definition: EclHysteresisTwoPhaseLaw.hpp:105
static constexpr bool implementsTwoPhaseApi
Specify whether this material law implements the two-phase convenience API.
Definition: EclHysteresisTwoPhaseLaw.hpp:64
static constexpr bool isCompositionDependent
Specify whether the quantities defined by this material law are dependent on the phase composition.
Definition: EclHysteresisTwoPhaseLaw.hpp:92
static Evaluation Sw(const Params &, const FluidState &)
Calculate wetting liquid phase saturation given that the rest of the fluid state has been initialized...
Definition: EclHysteresisTwoPhaseLaw.hpp:220
static Evaluation Sn(const Params &, const FluidState &)
Calculate non-wetting liquid phase saturation given that the rest of the fluid state has been initial...
Definition: EclHysteresisTwoPhaseLaw.hpp:238
static void saturations(Container &, const Params &, const FluidState &)
The saturation-capillary pressure curves.
Definition: EclHysteresisTwoPhaseLaw.hpp:208
static Evaluation krw(const Params &, const FluidState &)
The relative permeability for the wetting phase.
Definition: EclHysteresisTwoPhaseLaw.hpp:261
static constexpr int numPhases
The number of fluid phases.
Definition: EclHysteresisTwoPhaseLaw.hpp:57
static constexpr bool isPressureDependent
Specify whether the quantities defined by this material law are dependent on the absolute pressure.
Definition: EclHysteresisTwoPhaseLaw.hpp:84
static constexpr bool implementsTwoPhaseSatApi
Specify whether this material law implements the two-phase convenience API which only depends on the ...
Definition: EclHysteresisTwoPhaseLaw.hpp:72
static constexpr bool isTemperatureDependent
Specify whether the quantities defined by this material law are temperature dependent.
Definition: EclHysteresisTwoPhaseLaw.hpp:88
static Evaluation pcnw(const Params &, const FluidState &)
The capillary pressure-saturation curve.
Definition: EclHysteresisTwoPhaseLaw.hpp:142
static void relativePermeabilities(Container &, const Params &, const FluidState &)
The relative permeability-saturation curves depending on absolute saturations.
Definition: EclHysteresisTwoPhaseLaw.hpp:123