mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
TP #3805: Fixed bug related to computation of SOIL based on SGAS/SWAT
p4#: 20152
This commit is contained in:
@@ -380,20 +380,8 @@ void RigReservoirCellResults::loadOrComputeSOIL()
|
||||
|
||||
if (soilResultGridIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
const std::vector< std::vector<double> >* swat = NULL;
|
||||
const std::vector< std::vector<double> >* sgas = NULL;
|
||||
|
||||
size_t scalarIndexSWAT = findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SWAT");
|
||||
if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
swat = &(cellScalarResults(scalarIndexSWAT));
|
||||
}
|
||||
|
||||
size_t scalarIndexSGAS = findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SGAS");
|
||||
if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
sgas = &(cellScalarResults(scalarIndexSGAS));
|
||||
}
|
||||
|
||||
// Early exit if none of SWAT or SGAS is present
|
||||
if (scalarIndexSWAT == cvf::UNDEFINED_SIZE_T && scalarIndexSGAS == cvf::UNDEFINED_SIZE_T)
|
||||
@@ -401,6 +389,20 @@ void RigReservoirCellResults::loadOrComputeSOIL()
|
||||
return;
|
||||
}
|
||||
|
||||
soilResultGridIndex = addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, "SOIL");
|
||||
|
||||
const std::vector< std::vector<double> >* swat = NULL;
|
||||
const std::vector< std::vector<double> >* sgas = NULL;
|
||||
if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
swat = &(cellScalarResults(scalarIndexSWAT));
|
||||
}
|
||||
|
||||
if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
sgas = &(cellScalarResults(scalarIndexSGAS));
|
||||
}
|
||||
|
||||
size_t soilResultValueCount = 0;
|
||||
size_t soilTimeStepCount = 0;
|
||||
if (swat)
|
||||
@@ -417,7 +419,6 @@ void RigReservoirCellResults::loadOrComputeSOIL()
|
||||
soilTimeStepCount = qMax(soilTimeStepCount, sgasTimeStepCount);
|
||||
}
|
||||
|
||||
soilResultGridIndex = addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, "SOIL");
|
||||
m_cellScalarResults[soilResultGridIndex].resize(soilTimeStepCount);
|
||||
|
||||
std::vector< std::vector<double> >& soil = cellScalarResults(soilResultGridIndex);
|
||||
@@ -427,9 +428,8 @@ void RigReservoirCellResults::loadOrComputeSOIL()
|
||||
{
|
||||
soil[timeStepIdx].resize(soilResultValueCount);
|
||||
|
||||
int idx = 0;
|
||||
#pragma omp parallel for
|
||||
for (idx = 0; idx < static_cast<int>(soilResultValueCount); idx++)
|
||||
for (int idx = 0; idx < static_cast<int>(soilResultValueCount); idx++)
|
||||
{
|
||||
double soilValue = 1.0;
|
||||
if (sgas)
|
||||
|
||||
Reference in New Issue
Block a user