Computes saturations based on depths

For constant capillar pressure function the saturation is
    determined by cell depths:

    Sg_max, Sw_min
    ----- goc ----
    Sg_min, Sw_min
    ----- woc ----
    Sg_min, Sw_max
This commit is contained in:
Tor Harald Sandve 2014-08-11 11:21:44 +02:00
parent aed3add8ae
commit bf635f3fe9

View File

@ -745,6 +745,7 @@ namespace Opm
const PcEq f(props, phase, cell, target_pc);
const double f0 = f(s0);
const double f1 = f(s1);
if (f0 <= 0.0) {
return s0;
} else if (f1 > 0.0) {
@ -833,6 +834,46 @@ namespace Opm
}
}
/// Compute saturation from depth. Used for constant capillary pressure function
inline double satFromDepth(const BlackoilPropertiesInterface& props,
const double cellDepth,
const double contactDepth,
const int phase,
const int cell,
const bool increasing = false)
{
// Find minimum and maximum saturations.
double sminarr[BlackoilPhases::MaxNumPhases];
double smaxarr[BlackoilPhases::MaxNumPhases];
props.satRange(1, &cell, sminarr, smaxarr);
const double s0 = increasing ? smaxarr[phase] : sminarr[phase];
const double s1 = increasing ? sminarr[phase] : smaxarr[phase];
if (cellDepth < contactDepth){
return s0;
} else {
return s1;
}
}
/// Return true if capillary pressure function is constant
bool isConstPc(const BlackoilPropertiesInterface& props,
const int phase,
const int cell)
{
// Find minimum and maximum saturations.
double sminarr[BlackoilPhases::MaxNumPhases];
double smaxarr[BlackoilPhases::MaxNumPhases];
props.satRange(1, &cell, sminarr, smaxarr);
// Create the equation f(s) = pc(s);
const PcEq f(props, phase, cell, 0);
const double f0 = f(sminarr[phase]);
const double f1 = f(smaxarr[phase]);
return std::abs(f0 - f1 < std::numeric_limits<double>::epsilon());
}
} // namespace Equil
} // namespace Opm