27#ifndef OPM_ECL_HYSTERESIS_TWO_PHASE_LAW_PARAMS_HPP
28#define OPM_ECL_HYSTERESIS_TWO_PHASE_LAW_PARAMS_HPP
46template <
class EffLawT>
49 using EffLawParams =
typename EffLawT::Params;
50 using Scalar =
typename EffLawParams::Traits::Scalar;
53 using Traits =
typename EffLawParams::Traits;
66 oilWaterSystem_ =
false;
77 result.deltaSwImbKrn_ = 1.0;
79 result.initialImb_ =
true;
80 result.pcSwMic_ = 3.0;
81 result.krnSwMdc_ = 4.0;
93 if (
config().enableHysteresis()) {
94 if (
config().krHysteresisModel() == 2 ||
config().krHysteresisModel() == 3 ||
config().pcHysteresisModel() == 0) {
95 C_ = 1.0/(Sncri_ - Sncrd_ + 1.0e-12) - 1.0/(Snmaxd_ - Sncrd_);
99 updateDynamicParams_();
108 void setConfig(std::shared_ptr<EclHysteresisConfig> value)
109 { config_ = *value; }
124 drainageParams_ = value;
126 oilWaterSystem_ = (twoPhaseSystem == EclTwoPhaseSystemType::OilWater);
132 if (twoPhaseSystem == EclTwoPhaseSystemType::GasOil) {
133 Sncrd_ = info.Sgcr+info.Swl;
134 Snmaxd_ = info.Sgu+info.Swl;
135 KrndMax_ = EffLawT::twoPhaseSatKrn(
drainageParams(), 1.0-Snmaxd_);
137 else if (twoPhaseSystem == EclTwoPhaseSystemType::GasWater) {
140 KrndMax_ = EffLawT::twoPhaseSatKrn(
drainageParams(), 1.0-Snmaxd_);
143 assert(twoPhaseSystem == EclTwoPhaseSystemType::OilWater);
145 Snmaxd_ = 1.0 - info.Swl - info.Sgl;
146 KrndMax_ = EffLawT::twoPhaseSatKrn(
drainageParams(), 1.0-Snmaxd_);
151 if (
config().pcHysteresisModel() == 0) {
152 if (twoPhaseSystem == EclTwoPhaseSystemType::GasOil) {
154 pcmaxd_ = info.maxPcgo;
155 }
else if (twoPhaseSystem == EclTwoPhaseSystemType::GasWater) {
157 pcmaxd_ = info.maxPcgo + info.maxPcow;
160 assert(twoPhaseSystem == EclTwoPhaseSystemType::OilWater);
171 {
return drainageParams_; }
174 {
return drainageParams_; }
183 imbibitionParams_ = value;
185 if (!
config().enableHysteresis())
189 if (
config().krHysteresisModel() == 2 ||
config().krHysteresisModel() == 3 ||
config().pcHysteresisModel() == 0) {
190 if (twoPhaseSystem == EclTwoPhaseSystemType::GasOil) {
191 Sncri_ = info.Sgcr+info.Swl;
193 else if (twoPhaseSystem == EclTwoPhaseSystemType::GasWater) {
197 assert(twoPhaseSystem == EclTwoPhaseSystemType::OilWater);
203 if (
config().pcHysteresisModel() == 0) {
204 if (twoPhaseSystem == EclTwoPhaseSystemType::GasOil) {
206 Swmaxi_ = 1.0 - info.Sgl - info.Swl;
207 pcmaxi_ = info.maxPcgo;
208 }
else if (twoPhaseSystem == EclTwoPhaseSystemType::GasWater) {
210 Swmaxi_ = 1.0 - info.Sgl;
211 pcmaxi_ = info.maxPcgo + info.maxPcow;
214 assert(twoPhaseSystem == EclTwoPhaseSystemType::OilWater);
217 pcmaxi_ = info.maxPcow;
226 {
return imbibitionParams_; }
229 {
return imbibitionParams_; }
238 Scalar pcSwMic()
const
245 {
return initialImb_; }
271 { krnSwMdc_ = value; }
279 {
return krnSwMdc_; }
311 { deltaSwImbKrn_ = value; }
321 {
return deltaSwImbKrn_; }
330 Scalar Swmaxi()
const
342 Scalar Snmaxd()
const
346 {
return 1.0 - krnSwMdc_; }
348 Scalar krnWght()
const
349 {
return KrndHy_/KrndMax_; }
351 Scalar pcWght() const
354 return EffLawT::twoPhaseSatPcnw(
drainageParams(), 0.0)/(pcmaxi_+1e-6);
356 return pcmaxd_/(pcmaxi_+1e-6);
359 Scalar curvatureCapPrs()
const
360 {
return curvatureCapPrs_;}
369 void update(Scalar pcSw, Scalar , Scalar krnSw)
371 bool updateParams =
false;
373 if (
config().pcHysteresisModel() == 0 && pcSw < pcSwMdc_) {
374 if (pcSwMdc_ == 2.0 && pcSw+1.0e-6 < Swcrd_ && oilWaterSystem_) {
381 if (initialImb_ && pcSw > pcSwMic_) {
399 if (krnSw < krnSwMdc_) {
406 updateDynamicParams_();
409 template<
class Serializer>
413 serializer(deltaSwImbKrn_);
415 serializer(initialImb_);
416 serializer(pcSwMic_);
417 serializer(krnSwMdc_);
421 bool operator==(
const EclHysteresisTwoPhaseLawParams& rhs)
const
423 return this->deltaSwImbKrn_ == rhs.deltaSwImbKrn_ &&
424 this->Sncrt_ == rhs.Sncrt_ &&
425 this->initialImb_ == rhs.initialImb_ &&
426 this->pcSwMic_ == rhs.pcSwMic_ &&
427 this->krnSwMdc_ == rhs.krnSwMdc_ &&
428 this->KrndHy_ == rhs.KrndHy_;
432 void updateDynamicParams_()
442 if (
config().krHysteresisModel() == 0 ||
config().krHysteresisModel() == 1) {
443 Scalar krnMdcDrainage = EffLawT::twoPhaseSatKrn(
drainageParams(), krnSwMdc_);
444 Scalar SwKrnMdcImbibition = EffLawT::twoPhaseSatKrnInv(
imbibitionParams(), krnMdcDrainage);
445 deltaSwImbKrn_ = SwKrnMdcImbibition - krnSwMdc_;
446 assert(std::abs(EffLawT::twoPhaseSatKrn(
imbibitionParams(), krnSwMdc_ + deltaSwImbKrn_)
461 if (
config().krHysteresisModel() == 2 ||
config().krHysteresisModel() == 3 ||
config().pcHysteresisModel() == 0) {
462 Scalar Snhy = 1.0 - krnSwMdc_;
464 Sncrt_ = Sncrd_ + (Snhy - Sncrd_)/((1.0+
config().modParamTrapped()*(Snmaxd_-Snhy)) + C_*(Snhy - Sncrd_));
472 EclHysteresisConfig config_;
473 EffLawParams imbibitionParams_;
474 EffLawParams drainageParams_;
488 bool oilWaterSystem_;
494 Scalar deltaSwImbKrn_;
525 Scalar curvatureCapPrs_;
Specifies the configuration used by the ECL kr/pC hysteresis code.
Definition: EclHysteresisConfig.hpp:42
int pcHysteresisModel() const
Return the type of the hysteresis model which is used for capillary pressure.
Definition: EclHysteresisConfig.hpp:71
int krHysteresisModel() const
Return the type of the hysteresis model which is used for relative permeability.
Definition: EclHysteresisConfig.hpp:97
double curvatureCapPrs() const
Curvature parameter used for capillary pressure hysteresis.
Definition: EclHysteresisConfig.hpp:113
bool enableHysteresis() const
Returns whether hysteresis is enabled.
Definition: EclHysteresisConfig.hpp:53
A default implementation of the parameters for the material law which implements the ECL relative per...
Definition: EclHysteresisTwoPhaseLawParams.hpp:48
Scalar pcSwMdc() const
Get the saturation of the wetting phase where the last switch from the main drainage curve to imbibit...
Definition: EclHysteresisTwoPhaseLawParams.hpp:235
bool initialImb() const
Status of initial process.
Definition: EclHysteresisTwoPhaseLawParams.hpp:244
const EclHysteresisConfig & config() const
Returns the endpoint scaling configuration object.
Definition: EclHysteresisTwoPhaseLawParams.hpp:114
void setDeltaSwImbKrn(Scalar value)
Sets the saturation value which must be added if krn is calculated using the imbibition curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:310
void setConfig(std::shared_ptr< EclHysteresisConfig > value)
Set the endpoint scaling configuration object.
Definition: EclHysteresisTwoPhaseLawParams.hpp:108
Scalar krnSwMdc() const
Get the saturation of the wetting phase where the last switch from the main drainage curve to imbibit...
Definition: EclHysteresisTwoPhaseLawParams.hpp:278
void setKrnSwMdc(Scalar value)
Set the saturation of the wetting phase where the last switch from the main drainage curve (MDC) to i...
Definition: EclHysteresisTwoPhaseLawParams.hpp:270
void setDeltaSwImbKrw(Scalar)
Sets the saturation value which must be added if krw is calculated using the imbibition curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:288
void setKrwSwMdc(Scalar)
Set the saturation of the wetting phase where the last switch from the main drainage curve (MDC) to i...
Definition: EclHysteresisTwoPhaseLawParams.hpp:252
void finalize()
Calculate all dependent quantities once the independent quantities of the parameter object have been ...
Definition: EclHysteresisTwoPhaseLawParams.hpp:91
void setDrainageParams(const EffLawParams &value, const EclEpsScalingPointsInfo< Scalar > &info, EclTwoPhaseSystemType twoPhaseSystem)
Sets the parameters used for the drainage curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:120
Scalar deltaSwImbKrn() const
Returns the saturation value which must be added if krn is calculated using the imbibition curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:320
void setImbibitionParams(const EffLawParams &value, const EclEpsScalingPointsInfo< Scalar > &info, EclTwoPhaseSystemType twoPhaseSystem)
Sets the parameters used for the imbibition curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:179
Scalar deltaSwImbKrw() const
Returns the saturation value which must be added if krw is calculated using the imbibition curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:299
const EffLawParams & imbibitionParams() const
Returns the parameters used for the imbibition curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:225
Scalar krwSwMdc() const
Get the saturation of the wetting phase where the last switch from the main drainage curve to imbibit...
Definition: EclHysteresisTwoPhaseLawParams.hpp:261
const EffLawParams & drainageParams() const
Returns the parameters used for the drainage curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:170
void update(Scalar pcSw, Scalar, Scalar krnSw)
Notify the hysteresis law that a given wetting-phase saturation has been seen.
Definition: EclHysteresisTwoPhaseLawParams.hpp:369
Default implementation for asserting finalization of parameter objects.
Definition: EnsureFinalized.hpp:47
void finalize()
Mark the object as finalized.
Definition: EnsureFinalized.hpp:75
Class for (de-)serializing.
Definition: Serializer.hpp:84
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
EclTwoPhaseSystemType
Specified which fluids are involved in a given twophase material law for endpoint scaling.
Definition: EclEpsConfig.hpp:42
This structure represents all values which can be possibly used as scaling points in the endpoint sca...
Definition: EclEpsScalingPoints.hpp:57