20#ifndef OPM_RELPERMDIAGNOSTICS_IMPL_HEADER_INCLUDED
21#define OPM_RELPERMDIAGNOSTICS_IMPL_HEADER_INCLUDED
27#include <opm/core/utility/compressedToCartesian.hpp>
31 template <
class Gr
idT>
33 const Opm::Deck& deck,
36 OpmLog::info(
"\n===============Saturation Functions Diagnostics===============\n");
37 phaseCheck_(eclState);
38 satFamilyCheck_(eclState);
39 tableCheck_(eclState);
40 unscaledEndPointsCheck_(deck, eclState);
41 scaledEndPointsCheck_(deck, eclState, grid);
44 template <
class Gr
idT>
45 void RelpermDiagnostics::scaledEndPointsCheck_(
const Deck& deck,
46 const EclipseState& eclState,
50 const float tolerance = 1e-6;
51 const int nc = Opm::UgGridHelpers::numCells(grid);
52 const auto& global_cell = Opm::UgGridHelpers::globalCell(grid);
53 const auto dims = Opm::UgGridHelpers::cartDims(grid);
54 const auto& compressedToCartesianIdx = Opm::compressedToCartesian(nc, global_cell);
55 scaledEpsInfo_.resize(nc);
56 EclEpsGridProperties epsGridProperties;
57 epsGridProperties.initFromDeck(deck, eclState,
false);
58 const auto& satnum = eclState.get3DProperties().getIntGridProperty(
"SATNUM");
60 const std::string tag =
"Scaled endpoints";
61 for (
int c = 0; c < nc; ++c) {
62 const int cartIdx = compressedToCartesianIdx[c];
63 const std::string satnumIdx = std::to_string(satnum.iget(cartIdx));
64 std::array<int, 3> ijk;
65 ijk[0] = cartIdx % dims[0];
66 ijk[1] = (cartIdx / dims[0]) % dims[1];
67 ijk[2] = cartIdx / dims[0] / dims[1];
68 const std::string cellIdx =
"(" + std::to_string(ijk[0]) +
", " +
69 std::to_string(ijk[1]) +
", " +
70 std::to_string(ijk[2]) +
")";
71 scaledEpsInfo_[c].extractScaled(eclState, epsGridProperties, cartIdx);
74 if (scaledEpsInfo_[c].Sgu > (1.0 - scaledEpsInfo_[c].Swl + tolerance)) {
75 const std::string msg =
"For scaled endpoints input, cell" + cellIdx +
" SATNUM = " + satnumIdx +
", SGU exceed 1.0 - SWL";
76 OpmLog::warning(tag, msg);
80 if (scaledEpsInfo_[c].Sgl > (1.0 - scaledEpsInfo_[c].Swu + tolerance)) {
81 const std::string msg =
"For scaled endpoints input, cell" + cellIdx +
" SATNUM = " + satnumIdx +
", SGL exceed 1.0 - SWU";
82 OpmLog::warning(tag, msg);
85 if (deck.hasKeyword(
"SCALECRS") && fluidSystem_ == FluidSystem::BlackOil) {
87 if ((scaledEpsInfo_[c].Sowcr + scaledEpsInfo_[c].Swcr) >= (1.0 + tolerance)) {
88 const std::string msg =
"For scaled endpoints input, cell" + cellIdx +
" SATNUM = " + satnumIdx +
", SOWCR + SWCR exceed 1.0";
89 OpmLog::warning(tag, msg);
92 if ((scaledEpsInfo_[c].Sogcr + scaledEpsInfo_[c].Sgcr + scaledEpsInfo_[c].Swl) >= (1.0 + tolerance)) {
93 const std::string msg =
"For scaled endpoints input, cell" + cellIdx +
" SATNUM = " + satnumIdx +
", SOGCR + SGCR + SWL exceed 1.0";
94 OpmLog::warning(tag, msg);
void diagnosis(const EclipseState &eclState, const Deck &deck, const GridT &grid)
Definition: AnisotropicEikonal.hpp:44