pass CartesianIndexMapper instead of the grid to the RelpermDiagnositics

This commit is contained in:
Tor Harald Sandve
2021-01-26 14:59:36 +01:00
parent 3a0dbdc6e7
commit c145722798
6 changed files with 47 additions and 62 deletions
@@ -52,9 +52,9 @@ namespace Opm {
///output if they're found.
///\param[in] eclState eclipse state.
///\param[in] grid unstructured grid.
template <class GridT>
template <class CartesianIndexMapper>
void diagnosis(const EclipseState& eclState,
const GridT& grid);
const CartesianIndexMapper& cartesianIndexMapper);
private:
enum FluidSystem {
@@ -91,9 +91,9 @@ namespace Opm {
///Check endpoints in the saturation tables.
void unscaledEndPointsCheck_(const EclipseState& eclState);
template <class GridT>
template <class CartesianIndexMapper>
void scaledEndPointsCheck_(const EclipseState& eclState,
const GridT& grid);
const CartesianIndexMapper& cartesianIndexMapper);
///For every table, need to deal with case by case.
void swofTableCheck_(const Opm::SwofTable& swofTables,
@@ -31,28 +31,25 @@
namespace Opm {
template <class GridT>
template <class CartesianIndexMapper>
void RelpermDiagnostics::diagnosis(const Opm::EclipseState& eclState,
const GridT& grid)
const CartesianIndexMapper& cartesianIndexMapper)
{
OpmLog::info("\n===============Saturation Functions Diagnostics===============\n");
phaseCheck_(eclState);
satFamilyCheck_(eclState);
tableCheck_(eclState);
unscaledEndPointsCheck_(eclState);
scaledEndPointsCheck_(eclState, grid);
scaledEndPointsCheck_(eclState, cartesianIndexMapper);
}
template <class GridT>
template <class CartesianIndexMapper>
void RelpermDiagnostics::scaledEndPointsCheck_(const EclipseState& eclState,
const GridT& grid)
const CartesianIndexMapper& cartesianIndexMapper)
{
// 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);
const auto& compressedToCartesianIdx = Opm::compressedToCartesian(nc, global_cell);
const int nc = cartesianIndexMapper.compressedSize();
const bool threepoint = eclState.runspec().endpointScaling().threepoint();
scaledEpsInfo_.resize(nc);
EclEpsGridProperties epsGridProperties(eclState, false);
@@ -62,10 +59,7 @@ namespace Opm {
std::string cellIdx;
{
std::array<int, 3> ijk;
int cartIdx = compressedToCartesianIdx[c];
ijk[0] = cartIdx % dims[0]; cartIdx /= dims[0];
ijk[1] = cartIdx % dims[1];
ijk[2] = cartIdx / dims[1];
cartesianIndexMapper.cartesianCoordinate(c, ijk);
cellIdx = "(" + std::to_string(ijk[0]) + ", " +
std::to_string(ijk[1]) + ", " +
std::to_string(ijk[2]) + ")";