27 #ifndef OPM_ECL_HYSTERESIS_TWO_PHASE_LAW_PARAMS_HPP
28 #define OPM_ECL_HYSTERESIS_TWO_PHASE_LAW_PARAMS_HPP
34 #include <opm/input/eclipse/EclipseState/EclipseState.hpp>
50 template <
class EffLawT>
53 using EffLawParams =
typename EffLawT::Params;
54 using Scalar =
typename EffLawParams::Traits::Scalar;
57 using Traits =
typename EffLawParams::Traits;
70 oilWaterSystem_ =
false;
84 if (
config().enableHysteresis()) {
85 if (
config().krHysteresisModel() == 2 ||
config().krHysteresisModel() == 3 ||
config().pcHysteresisModel() == 0) {
86 C_ = 1.0/(Sncri_ - Sncrd_ + 1.0e-12) - 1.0/(Snmaxd_ - Sncrd_);
90 updateDynamicParams_();
99 void setConfig(std::shared_ptr<EclHysteresisConfig> value)
115 drainageParams_ = value;
117 oilWaterSystem_ = (twoPhaseSystem == EclOilWaterSystem);
123 if (twoPhaseSystem == EclGasOilSystem) {
124 Sncrd_ = info.Sgcr+info.Swl;
125 Snmaxd_ = info.Sgu+info.Swl;
126 KrndMax_ = EffLawT::twoPhaseSatKrn(
drainageParams(), 1.0-Snmaxd_);
129 assert(twoPhaseSystem == EclOilWaterSystem);
131 Snmaxd_ = 1.0 - info.Swl - info.Sgl;
132 KrndMax_ = EffLawT::twoPhaseSatKrn(
drainageParams(), 1.0-Snmaxd_);
137 if (
config().pcHysteresisModel() == 0) {
138 if (twoPhaseSystem == EclGasOilSystem) {
140 pcmaxd_ = info.maxPcgo;
143 assert(twoPhaseSystem == EclOilWaterSystem);
154 {
return drainageParams_; }
157 {
return drainageParams_; }
166 imbibitionParams_ = value;
168 if (!
config().enableHysteresis())
172 if (
config().krHysteresisModel() == 2 ||
config().krHysteresisModel() == 3 ||
config().pcHysteresisModel() == 0) {
173 if (twoPhaseSystem == EclGasOilSystem) {
174 Sncri_ = info.Sgcr+info.Swl;
177 assert(twoPhaseSystem == EclOilWaterSystem);
183 if (
config().pcHysteresisModel() == 0) {
184 if (twoPhaseSystem == EclGasOilSystem) {
186 Swmaxi_ = 1.0 - info.Sgl - info.Swl;
187 pcmaxi_ = info.maxPcgo;
190 assert(twoPhaseSystem == EclOilWaterSystem);
193 pcmaxi_ = info.maxPcow;
202 {
return imbibitionParams_; }
205 {
return imbibitionParams_; }
214 Scalar pcSwMic()
const
221 {
return initialImb_; }
247 { krnSwMdc_ = value; }
255 {
return krnSwMdc_; }
287 { deltaSwImbKrn_ = value; }
297 {
return deltaSwImbKrn_; }
306 Scalar Swmaxi()
const
318 Scalar Snmaxd()
const
322 {
return 1.0 - krnSwMdc_; }
324 Scalar krnWght()
const
325 {
return KrndHy_/KrndMax_; }
327 Scalar pcWght() const
330 return EffLawT::twoPhaseSatPcnw(
drainageParams(), 0.0)/(pcmaxi_+1e-6);
332 return pcmaxd_/(pcmaxi_+1e-6);
335 Scalar curvatureCapPrs()
const
336 {
return curvatureCapPrs_;}
345 void update(Scalar pcSw, Scalar , Scalar krnSw)
347 bool updateParams =
false;
349 if (
config().pcHysteresisModel() == 0 && pcSw < pcSwMdc_) {
350 if (pcSwMdc_ == 2.0 && pcSw+1.0e-6 < Swcrd_ && oilWaterSystem_) {
357 if (initialImb_ && pcSw > pcSwMic_) {
375 if (krnSw < krnSwMdc_) {
382 updateDynamicParams_();
386 void updateDynamicParams_()
396 if (
config().krHysteresisModel() == 0 ||
config().krHysteresisModel() == 1) {
397 Scalar krnMdcDrainage = EffLawT::twoPhaseSatKrn(
drainageParams(), krnSwMdc_);
398 Scalar SwKrnMdcImbibition = EffLawT::twoPhaseSatKrnInv(
imbibitionParams(), krnMdcDrainage);
399 deltaSwImbKrn_ = SwKrnMdcImbibition - krnSwMdc_;
400 assert(std::abs(EffLawT::twoPhaseSatKrn(
imbibitionParams(), krnSwMdc_ + deltaSwImbKrn_)
415 if (
config().krHysteresisModel() == 2 ||
config().krHysteresisModel() == 3 ||
config().pcHysteresisModel() == 0) {
416 Scalar Snhy = 1.0 - krnSwMdc_;
418 Sncrt_ = Sncrd_ + (Snhy - Sncrd_)/((1.0+
config().modParamTrapped()*(Snmaxd_-Snhy)) + C_*(Snhy - Sncrd_));
426 std::shared_ptr<EclHysteresisConfig> config_;
427 EffLawParams imbibitionParams_;
428 EffLawParams drainageParams_;
442 bool oilWaterSystem_;
448 Scalar deltaSwImbKrn_;
479 Scalar curvatureCapPrs_;
EclTwoPhaseSystemType
Specified which fluids are involved in a given twophase material law for endpoint scaling.
Definition: EclEpsConfig.hpp:43
Specifies the configuration used by the ECL kr/pC hysteresis code.
Default implementation for asserting finalization of parameter objects.
Specifies the configuration used by the ECL kr/pC hysteresis code.
Definition: EclHysteresisConfig.hpp:41
int pcHysteresisModel() const
Return the type of the hysteresis model which is used for capillary pressure.
Definition: EclHysteresisConfig.hpp:77
int krHysteresisModel() const
Return the type of the hysteresis model which is used for relative permeability.
Definition: EclHysteresisConfig.hpp:103
double curvatureCapPrs() const
Curvature parameter used for capillary pressure hysteresis.
Definition: EclHysteresisConfig.hpp:119
bool enableHysteresis() const
Returns whether hysteresis is enabled.
Definition: EclHysteresisConfig.hpp:59
A default implementation of the parameters for the material law which implements the ECL relative per...
Definition: EclHysteresisTwoPhaseLawParams.hpp:52
Scalar pcSwMdc() const
Get the saturation of the wetting phase where the last switch from the main drainage curve to imbibit...
Definition: EclHysteresisTwoPhaseLawParams.hpp:211
bool initialImb() const
Status of initial process.
Definition: EclHysteresisTwoPhaseLawParams.hpp:220
const EffLawParams & drainageParams() const
Returns the parameters used for the drainage curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:153
void setDeltaSwImbKrn(Scalar value)
Sets the saturation value which must be added if krn is calculated using the imbibition curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:286
void setConfig(std::shared_ptr< EclHysteresisConfig > value)
Set the endpoint scaling configuration object.
Definition: EclHysteresisTwoPhaseLawParams.hpp:99
Scalar krnSwMdc() const
Get the saturation of the wetting phase where the last switch from the main drainage curve to imbibit...
Definition: EclHysteresisTwoPhaseLawParams.hpp:254
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:246
void setDeltaSwImbKrw(Scalar)
Sets the saturation value which must be added if krw is calculated using the imbibition curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:264
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:228
void finalize()
Calculate all dependent quantities once the independent quantities of the parameter object have been ...
Definition: EclHysteresisTwoPhaseLawParams.hpp:82
void setDrainageParams(const EffLawParams &value, const EclEpsScalingPointsInfo< Scalar > &info, EclTwoPhaseSystemType twoPhaseSystem)
Sets the parameters used for the drainage curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:111
Scalar deltaSwImbKrn() const
Returns the saturation value which must be added if krn is calculated using the imbibition curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:296
void setImbibitionParams(const EffLawParams &value, const EclEpsScalingPointsInfo< Scalar > &info, EclTwoPhaseSystemType twoPhaseSystem)
Sets the parameters used for the imbibition curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:162
Scalar deltaSwImbKrw() const
Returns the saturation value which must be added if krw is calculated using the imbibition curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:275
const EclHysteresisConfig & config() const
Returns the endpoint scaling configuration object.
Definition: EclHysteresisTwoPhaseLawParams.hpp:105
Scalar krwSwMdc() const
Get the saturation of the wetting phase where the last switch from the main drainage curve to imbibit...
Definition: EclHysteresisTwoPhaseLawParams.hpp:237
const EffLawParams & imbibitionParams() const
Returns the parameters used for the imbibition curve.
Definition: EclHysteresisTwoPhaseLawParams.hpp:201
void update(Scalar pcSw, Scalar, Scalar krnSw)
Notify the hysteresis law that a given wetting-phase saturation has been seen.
Definition: EclHysteresisTwoPhaseLawParams.hpp:345
Default implementation for asserting finalization of parameter objects.
Definition: EnsureFinalized.hpp:47
void finalize()
Mark the object as finalized.
Definition: EnsureFinalized.hpp:75
This structure represents all values which can be possibly used as scaling points in the endpoint sca...
Definition: EclEpsScalingPoints.hpp:60