Avoid false positives by introducing a tolerance

This commit is contained in:
Alf B. Rustad 2017-10-03 11:13:41 +02:00
parent 8321530c4e
commit 8f445699e9

View File

@ -33,7 +33,7 @@ namespace Opm {
const Opm::Deck& deck,
const GridT& grid)
{
OpmLog::info("\n***************Saturation Functions Diagnostics***************");
OpmLog::info("\n===============Saturation Functions Diagnostics===============");
phaseCheck_(eclState);
satFamilyCheck_(eclState);
tableCheck_(eclState);
@ -46,6 +46,8 @@ namespace Opm {
const EclipseState& eclState,
const GridT& grid)
{
// All end points are subject to round-off errors, checks should account for it
const float tolerance = 1e-6;
const int nc = Opm::UgGridHelpers::numCells(grid);
const auto& global_cell = Opm::UgGridHelpers::globalCell(grid);
const auto dims = Opm::UgGridHelpers::cartDims(grid);
@ -69,25 +71,25 @@ namespace Opm {
scaledEpsInfo_[c].extractScaled(eclState, epsGridProperties, cartIdx);
// SGU <= 1.0 - SWL
if (scaledEpsInfo_[c].Sgu > (1.0 - scaledEpsInfo_[c].Swl)) {
if (scaledEpsInfo_[c].Sgu > (1.0 - scaledEpsInfo_[c].Swl)+tolerance) {
const std::string msg = "For scaled endpoints input, cell" + cellIdx + " SATNUM = " + satnumIdx + ", SGU exceed 1.0 - SWL";
OpmLog::warning(tag, msg);
}
// SGL <= 1.0 - SWU
if (scaledEpsInfo_[c].Sgl > (1.0 - scaledEpsInfo_[c].Swu)) {
if (scaledEpsInfo_[c].Sgl > (1.0 - scaledEpsInfo_[c].Swu)+tolerance) {
const std::string msg = "For scaled endpoints input, cell" + cellIdx + " SATNUM = " + satnumIdx + ", SGL exceed 1.0 - SWU";
OpmLog::warning(tag, msg);
}
if (deck.hasKeyword("SCALECRS") && fluidSystem_ == FluidSystem::BlackOil) {
// Mobilility check.
if ((scaledEpsInfo_[c].Sowcr + scaledEpsInfo_[c].Swcr) >= 1.0) {
if ((scaledEpsInfo_[c].Sowcr + scaledEpsInfo_[c].Swcr) >= 1.0+tolerance) {
const std::string msg = "For scaled endpoints input, cell" + cellIdx + " SATNUM = " + satnumIdx + ", SOWCR + SWCR exceed 1.0";
OpmLog::warning(tag, msg);
}
if ((scaledEpsInfo_[c].Sogcr + scaledEpsInfo_[c].Sgcr + scaledEpsInfo_[c].Swl) >= 1.0) {
if ((scaledEpsInfo_[c].Sogcr + scaledEpsInfo_[c].Sgcr + scaledEpsInfo_[c].Swl) >= 1.0+tolerance) {
const std::string msg = "For scaled endpoints input, cell" + cellIdx + " SATNUM = " + satnumIdx + ", SOGCR + SGCR + SWL exceed 1.0";
OpmLog::warning(tag, msg);
}