#7335 Dual poro models : Support using matrix part of PORV

For dual porosity models, use PORV from the matrix part.

Also guard all conversion of 1-based to 0-based indexing to avoid potential undefined behaviour.
This commit is contained in:
Magne Sjaastad 2021-02-05 08:16:10 +01:00
parent 4bd76a78ad
commit b2fc74e73e
6 changed files with 16 additions and 9 deletions

View File

@ -597,6 +597,13 @@ ECL::getPVolVector(const ecl_grid_type* G,
if (init.haveKeywordData(kw, gridID)) {
pvol = init.keywordData<double>(kw, gridID);
if (pvol.size() == nglob * 2)
{
// For dual perm/poro models, the result count is 2x the number of cells, as results are present for
// both matrix and fracture. Use only the matrix results (first half of the result values)
pvol.resize(nglob);
}
assert ((pvol.size() == nglob) &&
"Pore-volume must be provided for all global cells");

View File

@ -309,7 +309,7 @@ Opm::ECLPVT::surfaceMassDensity(const ECLInitFileData& init,
const auto& tab = init.keywordData<double>("TAB");
// Subtract one to account for 1-based indices.
const auto start = tabdims[ TABDIMS_IBDENS_OFFSET_ITEM ] - 1;
const auto start = std::max(tabdims[ TABDIMS_IBDENS_OFFSET_ITEM ] - 1, 0);
const auto nreg = tabdims[ TABDIMS_NTDENS_ITEM ];
// Phase densities for 'phase' constitute 'nreg' consecutive entries

View File

@ -641,7 +641,7 @@ fromECLOutput(const ECLInitFileData& init)
const auto nTabElem = raw.numPrimary * raw.numTables;
// Subtract one to account for 1-based indices.
const auto start = tabdims[ TABDIMS_JBPVTG_OFFSET_ITEM ] - 1;
const auto start = std::max(tabdims[ TABDIMS_JBPVTG_OFFSET_ITEM ] - 1, 0);
raw.primaryKey.assign(&tab[start], &tab[start] + nTabElem);
}
@ -652,7 +652,7 @@ fromECLOutput(const ECLInitFileData& init)
raw.numPrimary * raw.numRows * raw.numCols * raw.numTables;
// Subtract one to account for 1-based indices.
const auto start = tabdims[ TABDIMS_IBPVTG_OFFSET_ITEM ] - 1;
const auto start = std::max(tabdims[ TABDIMS_IBPVTG_OFFSET_ITEM ] - 1, 0);
raw.data.assign(&tab[start], &tab[start] + nTabElem);
}

View File

@ -836,7 +836,7 @@ fromECLOutput(const ECLInitFileData& init)
const auto nTabElem = raw.numPrimary * raw.numTables;
// Subtract one to account for 1-based indices.
const auto start = tabdims[ TABDIMS_JBPVTO_OFFSET_ITEM ] - 1;
const auto start = std::max(tabdims[ TABDIMS_JBPVTO_OFFSET_ITEM ] - 1, 0);
raw.primaryKey.assign(&tab[start], &tab[start] + nTabElem);
}
@ -847,7 +847,7 @@ fromECLOutput(const ECLInitFileData& init)
raw.numPrimary * raw.numRows * raw.numCols * raw.numTables;
// Subtract one to account for 1-based indices.
const auto start = tabdims[ TABDIMS_IBPVTO_OFFSET_ITEM ] - 1;
const auto start = std::max(tabdims[ TABDIMS_IBPVTO_OFFSET_ITEM ] - 1, 0);
raw.data.assign(&tab[start], &tab[start] + nTabElem);
}

View File

@ -363,7 +363,7 @@ fromECLOutput(const ECLInitFileData& init)
raw.numPrimary * raw.numRows * raw.numCols * raw.numTables;
// Subtract one to account for 1-based indices.
const auto start = tabdims[ TABDIMS_IBPVTW_OFFSET_ITEM ] - 1;
const auto start = std::max(tabdims[ TABDIMS_IBPVTW_OFFSET_ITEM ] - 1, 0);
raw.data.assign(&tab[start], &tab[start] + nTabElem);
}

View File

@ -597,7 +597,7 @@ Gas::Details::tableData(const std::vector<int>& tabdims,
const auto nTabElems = t.numRows * t.numTables * t.numCols;
// Subtract one to account for offset being one-based index.
const auto start = tabdims[ TABDIMS_IBSGFN_OFFSET_ITEM ] - 1;
const auto start = std::max(tabdims[ TABDIMS_IBSGFN_OFFSET_ITEM ] - 1, 0);
t.data.assign(&tab[start], &tab[start] + nTabElems);
@ -648,7 +648,7 @@ Oil::Details::tableData(const std::vector<int>& tabdims,
const auto nTabElems = t.numRows * t.numTables * t.numCols;
// Subtract one to account for offset being one-based index.
const auto start = tabdims[ TABDIMS_IBSOFN_OFFSET_ITEM ] - 1;
const auto start = std::max(tabdims[ TABDIMS_IBSOFN_OFFSET_ITEM ] - 1, 0);
t.data.assign(&tab[start], &tab[start] + nTabElems);
@ -688,7 +688,7 @@ Water::Details::tableData(const std::vector<int>& tabdims,
const auto nTabElems = t.numRows * t.numTables * t.numCols;
// Subtract one to account for offset being one-based index.
const auto start = tabdims[ TABDIMS_IBSWFN_OFFSET_ITEM ] - 1;
const auto start = std::max(tabdims[ TABDIMS_IBSWFN_OFFSET_ITEM ] - 1, 0);
t.data.assign(&tab[start], &tab[start] + nTabElems);