mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2294 Use phase saturation corrected PORV when calculating TOF for a single phase
This commit is contained in:
parent
27835aceae
commit
3f22c096d8
@ -191,39 +191,7 @@ RigFlowDiagSolverInterface::~RigFlowDiagSolverInterface()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void removeCrossFlowCells(std::pair<const std::string, std::vector<int>> & tracerCellIdxsPair,
|
|
||||||
std::map<Opm::FlowDiagnostics::CellSetID, Opm::FlowDiagnostics::CellSetValues> & WellInFluxPrCell,
|
|
||||||
std::function<bool(double)> isFlowOkFunction)
|
|
||||||
{
|
|
||||||
std::string tracerName = tracerCellIdxsPair.first;
|
|
||||||
tracerName = RimFlowDiagSolution::removeCrossFlowEnding(QString::fromStdString(tracerName)).toStdString();
|
|
||||||
auto cellSetIdInFlowsPair = WellInFluxPrCell.find(Opm::FlowDiagnostics::CellSetID(tracerName));
|
|
||||||
|
|
||||||
CVF_TIGHT_ASSERT(cellSetIdInFlowsPair != WellInFluxPrCell.end());
|
|
||||||
|
|
||||||
std::vector<int> filteredCellIndices;
|
|
||||||
|
|
||||||
for ( int activeCellIdx : tracerCellIdxsPair.second )
|
|
||||||
{
|
|
||||||
auto activeCellIdxFluxPair = cellSetIdInFlowsPair->second.find(activeCellIdx);
|
|
||||||
CVF_TIGHT_ASSERT(activeCellIdxFluxPair != cellSetIdInFlowsPair->second.end());
|
|
||||||
|
|
||||||
if ( isFlowOkFunction(activeCellIdxFluxPair->second) )
|
|
||||||
{
|
|
||||||
filteredCellIndices.push_back(activeCellIdx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( tracerCellIdxsPair.second.size() != filteredCellIndices.size() )
|
|
||||||
{
|
|
||||||
tracerCellIdxsPair.second = filteredCellIndices;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -285,7 +253,6 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
|||||||
// Create the Toolbox.
|
// Create the Toolbox.
|
||||||
|
|
||||||
m_opmFlowDiagStaticData->m_fldToolbox.reset(new Opm::FlowDiagnostics::Toolbox{ connGraph });
|
m_opmFlowDiagStaticData->m_fldToolbox.reset(new Opm::FlowDiagnostics::Toolbox{ connGraph });
|
||||||
m_opmFlowDiagStaticData->m_fldToolbox->assignPoreVolume( m_opmFlowDiagStaticData->m_poreVolume);
|
|
||||||
|
|
||||||
// Look for unified restart file
|
// Look for unified restart file
|
||||||
QStringList m_filesWithSameBaseName;
|
QStringList m_filesWithSameBaseName;
|
||||||
@ -325,6 +292,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
|||||||
progressInfo.setProgress(3);
|
progressInfo.setProgress(3);
|
||||||
progressInfo.setProgressDescription("Assigning Flux Field");
|
progressInfo.setProgressDescription("Assigning Flux Field");
|
||||||
|
|
||||||
|
assignPhaseCorrecedPORV(phaseSelection, timeStepIndex);
|
||||||
|
|
||||||
Opm::ECLRestartData* currentRestartData = nullptr;
|
Opm::ECLRestartData* currentRestartData = nullptr;
|
||||||
|
|
||||||
if ( ! m_opmFlowDiagStaticData->m_hasUnifiedRestartFile )
|
if ( ! m_opmFlowDiagStaticData->m_hasUnifiedRestartFile )
|
||||||
@ -384,56 +353,6 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
|||||||
|
|
||||||
m_opmFlowDiagStaticData->m_fldToolbox->assignInflowFlux(WellInFluxPrCell);
|
m_opmFlowDiagStaticData->m_fldToolbox->assignInflowFlux(WellInFluxPrCell);
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Start Hack: Filter connection cells with inconsistent well in flow direction (Hack, we should do something better)
|
|
||||||
for ( auto& tracerCellIdxsPair: injectorTracers )
|
|
||||||
{
|
|
||||||
std::vector<int> filteredCellIndices;
|
|
||||||
|
|
||||||
for (int activeCellIdx : tracerCellIdxsPair.second)
|
|
||||||
{
|
|
||||||
auto activeCellIdxFluxPair = WellInFluxPrCell.find(activeCellIdx);
|
|
||||||
CVF_TIGHT_ASSERT(activeCellIdxFluxPair != WellInFluxPrCell.end());
|
|
||||||
|
|
||||||
if (activeCellIdxFluxPair->second > 0 )
|
|
||||||
{
|
|
||||||
filteredCellIndices.push_back(activeCellIdx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tracerCellIdxsPair.second.size() != filteredCellIndices.size()) tracerCellIdxsPair.second = filteredCellIndices;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( auto& tracerCellIdxsPair: producerTracers )
|
|
||||||
{
|
|
||||||
std::vector<int> filteredCellIndices;
|
|
||||||
|
|
||||||
for (int activeCellIdx : tracerCellIdxsPair.second)
|
|
||||||
{
|
|
||||||
auto activeCellIdxFluxPair = WellInFluxPrCell.find(activeCellIdx);
|
|
||||||
CVF_TIGHT_ASSERT(activeCellIdxFluxPair != WellInFluxPrCell.end());
|
|
||||||
|
|
||||||
if (activeCellIdxFluxPair->second < 0 )
|
|
||||||
{
|
|
||||||
filteredCellIndices.push_back(activeCellIdx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tracerCellIdxsPair.second.size() != filteredCellIndices.size()) tracerCellIdxsPair.second = filteredCellIndices;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// End Hack
|
|
||||||
// New Filtering Probably not neccesary
|
|
||||||
for ( auto& tracerCellIdxsPair: injectorTracers )
|
|
||||||
{
|
|
||||||
removeCrossFlowCells(tracerCellIdxsPair, WellInFluxPrCell, [](double inFlow){ return inFlow > 0;});
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( auto& tracerCellIdxsPair: producerTracers )
|
|
||||||
{
|
|
||||||
removeCrossFlowCells(tracerCellIdxsPair, WellInFluxPrCell, [](double inFlow){ return inFlow < 0;});
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
progressInfo.incrementProgress();
|
progressInfo.incrementProgress();
|
||||||
@ -590,6 +509,50 @@ bool RigFlowDiagSolverInterface::ensureStaticDataObjectInstanceCreated()
|
|||||||
return m_opmFlowDiagStaticData.notNull() ? true : false;
|
return m_opmFlowDiagStaticData.notNull() ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigFlowDiagSolverInterface::assignPhaseCorrecedPORV(RigFlowDiagResultAddress::PhaseSelection phaseSelection,
|
||||||
|
size_t timeStepIdx)
|
||||||
|
{
|
||||||
|
RigEclipseCaseData* eclipseCaseData = m_eclipseCase->eclipseCaseData();
|
||||||
|
|
||||||
|
const std::vector<double>* phaseSaturation = nullptr;
|
||||||
|
|
||||||
|
switch ( phaseSelection )
|
||||||
|
{
|
||||||
|
case RigFlowDiagResultAddress::PHASE_OIL:
|
||||||
|
phaseSaturation = eclipseCaseData->resultValues(RiaDefines::MATRIX_MODEL, RiaDefines::DYNAMIC_NATIVE, "SOIL", timeStepIdx);
|
||||||
|
break;
|
||||||
|
case RigFlowDiagResultAddress::PHASE_GAS:
|
||||||
|
phaseSaturation = eclipseCaseData->resultValues(RiaDefines::MATRIX_MODEL, RiaDefines::DYNAMIC_NATIVE, "SGAS", timeStepIdx);
|
||||||
|
break;
|
||||||
|
case RigFlowDiagResultAddress::PHASE_WAT:
|
||||||
|
phaseSaturation = eclipseCaseData->resultValues(RiaDefines::MATRIX_MODEL, RiaDefines::DYNAMIC_NATIVE, "SWAT", timeStepIdx);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_opmFlowDiagStaticData->m_fldToolbox->assignPoreVolume(m_opmFlowDiagStaticData->m_poreVolume);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (phaseSaturation)
|
||||||
|
{
|
||||||
|
std::vector<double> porvAdjusted = m_opmFlowDiagStaticData->m_poreVolume;
|
||||||
|
CAF_ASSERT(porvAdjusted.size() == phaseSaturation->size());
|
||||||
|
for (size_t idx = 0; idx < porvAdjusted.size(); ++idx )
|
||||||
|
{
|
||||||
|
porvAdjusted[idx] *= phaseSaturation->at(idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_opmFlowDiagStaticData->m_fldToolbox->assignPoreVolume(porvAdjusted);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_opmFlowDiagStaticData->m_fldToolbox->assignPoreVolume(m_opmFlowDiagStaticData->m_poreVolume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -109,7 +109,7 @@ public:
|
|||||||
explicit RigFlowDiagSolverInterface(RimEclipseResultCase * eclipseCase);
|
explicit RigFlowDiagSolverInterface(RimEclipseResultCase * eclipseCase);
|
||||||
virtual ~RigFlowDiagSolverInterface();
|
virtual ~RigFlowDiagSolverInterface();
|
||||||
|
|
||||||
RigFlowDiagTimeStepResult calculate(size_t timestep,
|
RigFlowDiagTimeStepResult calculate(size_t timeStepIdx,
|
||||||
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
|
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
|
||||||
std::map<std::string, std::vector<int> > injectorTracers,
|
std::map<std::string, std::vector<int> > injectorTracers,
|
||||||
std::map<std::string, std::vector<int> > producerTracers);
|
std::map<std::string, std::vector<int> > producerTracers);
|
||||||
@ -127,11 +127,11 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::string getInitFileName() const;
|
std::string getInitFileName() const;
|
||||||
bool ensureStaticDataObjectInstanceCreated();
|
bool ensureStaticDataObjectInstanceCreated();
|
||||||
|
void assignPhaseCorrecedPORV(RigFlowDiagResultAddress::PhaseSelection phaseSelection,
|
||||||
|
size_t timeStepIdx);
|
||||||
|
|
||||||
RimEclipseResultCase * m_eclipseCase;
|
RimEclipseResultCase * m_eclipseCase;
|
||||||
|
|
||||||
cvf::ref<RigOpmFlowDiagStaticData> m_opmFlowDiagStaticData;
|
cvf::ref<RigOpmFlowDiagStaticData> m_opmFlowDiagStaticData;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user