mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-10 08:03:05 -06:00
Added riMULTXYZ and X,Y,Z
This commit is contained in:
parent
1e59e050e6
commit
03a9bf459d
@ -649,7 +649,8 @@ void RivFaultPartMgr::updateNNCColors(RimResultSlot* cellResultSlot)
|
||||
|
||||
if (cellResultSlot
|
||||
&& ( cellResultSlot->resultVariable() == RimDefines::combinedTransmissibilityResultName()
|
||||
|| cellResultSlot->resultVariable() == RimDefines::combinedRiTransResultName()))
|
||||
|| cellResultSlot->resultVariable() == RimDefines::combinedRiTransResultName()
|
||||
|| cellResultSlot->resultVariable() == RimDefines::combinedRiMultResultName()) )
|
||||
{
|
||||
size_t scalarSetIndex = cellResultSlot->gridScalarIndex();
|
||||
|
||||
|
@ -68,6 +68,10 @@ bool RimDefines::isPerCellFaceResult(const QString& resultName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RimDefines::combinedRiMultResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -50,7 +50,10 @@ public:
|
||||
static QString riTransXResultName() { return "riTRANSX"; }
|
||||
static QString riTransYResultName() { return "riTRANSY"; }
|
||||
static QString riTransZResultName() { return "riTRANSZ"; }
|
||||
|
||||
static QString riMultXResultName() { return "riMULTX"; }
|
||||
static QString riMultYResultName() { return "riMULTY"; }
|
||||
static QString riMultZResultName() { return "riMULTZ"; }
|
||||
static QString combinedRiMultResultName() { return "riMULTXYZ"; }
|
||||
|
||||
// Mock model text identifiers
|
||||
static QString mockModelBasic() { return "Result Mock Debug Model Simple"; }
|
||||
|
@ -278,6 +278,32 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RimDefines::Result
|
||||
this->findOrLoadScalarResult(type, "MULTZ");
|
||||
this->findOrLoadScalarResult(type, "MULTZ-");
|
||||
}
|
||||
else if (resultName == RimDefines::combinedRiTransResultName())
|
||||
{
|
||||
computeRiTransComponent(RimDefines::riTransXResultName());
|
||||
computeRiTransComponent(RimDefines::riTransYResultName());
|
||||
computeRiTransComponent(RimDefines::riTransZResultName());
|
||||
computeNncCombRiTrans();
|
||||
}
|
||||
else if (resultName == RimDefines::riTransXResultName()
|
||||
|| resultName == RimDefines::riTransYResultName()
|
||||
|| resultName == RimDefines::riTransZResultName())
|
||||
{
|
||||
computeRiTransComponent(resultName);
|
||||
}
|
||||
else if (resultName == RimDefines::combinedRiMultResultName())
|
||||
{
|
||||
computeRiMULTComponent(RimDefines::riMultXResultName());
|
||||
computeRiMULTComponent(RimDefines::riMultYResultName());
|
||||
computeRiMULTComponent(RimDefines::riMultZResultName());
|
||||
computeNncCombRiMULT();
|
||||
}
|
||||
else if (resultName == RimDefines::riMultXResultName()
|
||||
|| resultName == RimDefines::riMultYResultName()
|
||||
|| resultName == RimDefines::riMultZResultName())
|
||||
{
|
||||
computeRiMULTComponent(resultName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -300,20 +326,7 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RimDefines::Result
|
||||
return scalarResultIndex;
|
||||
}
|
||||
|
||||
if (resultName == RimDefines::combinedRiTransResultName())
|
||||
{
|
||||
computeRiTransComponent(RimDefines::riTransXResultName());
|
||||
computeRiTransComponent(RimDefines::riTransYResultName());
|
||||
computeRiTransComponent(RimDefines::riTransZResultName());
|
||||
computeNncCombRiTrans();
|
||||
}
|
||||
|
||||
if ( resultName == RimDefines::riTransXResultName()
|
||||
|| resultName == RimDefines::riTransYResultName()
|
||||
|| resultName == RimDefines::riTransZResultName())
|
||||
{
|
||||
computeRiTransComponent(resultName);
|
||||
}
|
||||
|
||||
|
||||
if (type == RimDefines::GENERATED)
|
||||
{
|
||||
@ -1060,6 +1073,111 @@ void RimReservoirCellResultsStorage::computeNncCombRiTrans()
|
||||
}
|
||||
|
||||
|
||||
double riMult(double transResults, double riTransResults)
|
||||
{
|
||||
// To make 0.0 values give 1.0 in mult value
|
||||
// We might want a tolerance here.
|
||||
if (transResults == riTransResults)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return transResults / riTransResults;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirCellResultsStorage::computeRiMULTComponent(const QString& riMultCompName)
|
||||
{
|
||||
if (!m_cellResults) return;
|
||||
|
||||
// Set up which component to compute
|
||||
|
||||
cvf::StructGridInterface::FaceType faceId;
|
||||
QString riTransCompName;
|
||||
QString transCompName;
|
||||
|
||||
if (riMultCompName == RimDefines::riMultXResultName())
|
||||
{
|
||||
riTransCompName = RimDefines::riTransXResultName();
|
||||
transCompName = "TRANX";
|
||||
}
|
||||
else if (riMultCompName == RimDefines::riMultYResultName())
|
||||
{
|
||||
riTransCompName = RimDefines::riTransYResultName();
|
||||
transCompName = "TRANY";
|
||||
}
|
||||
else if (riMultCompName == RimDefines::riMultZResultName())
|
||||
{
|
||||
riTransCompName = RimDefines::riTransZResultName();
|
||||
transCompName = "TRANZ";
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
}
|
||||
|
||||
// Get the needed result indices we depend on
|
||||
|
||||
size_t transResultIdx = findOrLoadScalarResult(RimDefines::STATIC_NATIVE, transCompName);
|
||||
size_t riTransResultIdx = findOrLoadScalarResult(RimDefines::STATIC_NATIVE, riTransCompName);
|
||||
|
||||
// Get the result index of the output
|
||||
|
||||
size_t riMultResultIdx = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, riMultCompName);
|
||||
CVF_ASSERT(riMultResultIdx != cvf::UNDEFINED_SIZE_T);
|
||||
|
||||
// Get the result count, to handle that one of them might be globally defined
|
||||
|
||||
CVF_ASSERT(m_cellResults->cellScalarResults(riTransResultIdx)[0].size() == m_cellResults->cellScalarResults(transResultIdx)[0].size());
|
||||
|
||||
size_t resultValueCount = m_cellResults->cellScalarResults(transResultIdx)[0].size();
|
||||
|
||||
// Get all the actual result values
|
||||
|
||||
std::vector<double> & riTransResults = m_cellResults->cellScalarResults(riTransResultIdx)[0];
|
||||
std::vector<double> & transResults = m_cellResults->cellScalarResults(transResultIdx)[0];
|
||||
|
||||
std::vector<double> & riMultResults = m_cellResults->cellScalarResults(riMultResultIdx)[0];
|
||||
|
||||
// Set up output container to correct number of results
|
||||
|
||||
riMultResults.resize(resultValueCount);
|
||||
|
||||
const RigActiveCellInfo* activeCellInfo = m_cellResults->activeCellInfo();
|
||||
|
||||
for (size_t vIdx = 0; vIdx < transResults.size(); ++vIdx)
|
||||
{
|
||||
riMultResults[vIdx] = riMult(transResults[vIdx], riTransResults[vIdx]);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirCellResultsStorage::computeNncCombRiMULT()
|
||||
{
|
||||
if (!m_cellResults) return;
|
||||
|
||||
size_t riCombMultScalarResultIndex = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedRiMultResultName());
|
||||
size_t riCombTransScalarResultIndex = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedRiTransResultName());
|
||||
size_t combTransScalarResultIndex = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedTransmissibilityResultName());
|
||||
|
||||
if (m_ownerMainGrid->nncData()->connectionScalarResult(riCombMultScalarResultIndex)) return;
|
||||
|
||||
std::vector<double> & riMultResults = m_ownerMainGrid->nncData()->makeConnectionScalarResult(riCombMultScalarResultIndex);
|
||||
const std::vector<double> * riTransResults = m_ownerMainGrid->nncData()->connectionScalarResult(riCombTransScalarResultIndex);
|
||||
const std::vector<double> * transResults = m_ownerMainGrid->nncData()->connectionScalarResult(combTransScalarResultIndex);
|
||||
|
||||
for (size_t nncConIdx = 0; nncConIdx < riMultResults.size(); ++nncConIdx)
|
||||
{
|
||||
riMultResults[nncConIdx] = riMult((*transResults)[nncConIdx], (*riTransResults)[nncConIdx]);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -67,6 +67,8 @@ private:
|
||||
void computeSOILForTimeStep(size_t timeStepIndex);
|
||||
void computeRiTransComponent(const QString& riTransComponentResultName);
|
||||
void computeNncCombRiTrans();
|
||||
void computeRiMULTComponent(const QString& riMultCompName);
|
||||
void computeNncCombRiMULT();
|
||||
|
||||
QString getValidCacheFileName();
|
||||
QString getCacheDirectoryPath();
|
||||
|
@ -2146,6 +2146,20 @@ void RimReservoirView::appendTextFromResultSlot(RigCaseData* eclipseCase, size_t
|
||||
resultInfoText->append(QString("riTran Z : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else if (resultSlot->resultVariable().compare(RimDefines::combinedRiMultResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedRiMultResultName());
|
||||
{
|
||||
double scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
||||
resultInfoText->append(QString("riMult X : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
||||
resultInfoText->append(QString("riMult Y : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
||||
resultInfoText->append(QString("riMult Z : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, resultSlot->gridScalarIndex());
|
||||
|
@ -270,6 +270,14 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty
|
||||
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riTransZResultName()));
|
||||
statisticsCalculator = calc;
|
||||
}
|
||||
else if (resultName == RimDefines::combinedRiMultResultName())
|
||||
{
|
||||
cvf::ref<RigMultipleDatasetStatCalc> calc = new RigMultipleDatasetStatCalc();
|
||||
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riMultXResultName()));
|
||||
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riMultYResultName()));
|
||||
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riMultZResultName()));
|
||||
statisticsCalculator = calc;
|
||||
}
|
||||
else
|
||||
{
|
||||
statisticsCalculator = new RigNativeStatCalc(this, scalarResultIndex);
|
||||
@ -542,6 +550,21 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
addStaticScalarResult(RimDefines::STATIC_NATIVE, RimDefines::combinedRiTransResultName(), false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// riMULTXYZ and X, Y, Z
|
||||
{
|
||||
size_t tranX, tranY, tranZ;
|
||||
if (findTransmissibilityResults(tranX, tranY, tranZ)
|
||||
&& findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riTransXResultName()) != cvf::UNDEFINED_SIZE_T
|
||||
&& findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riTransYResultName()) != cvf::UNDEFINED_SIZE_T
|
||||
&& findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riTransZResultName()) != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
addStaticScalarResult(RimDefines::STATIC_NATIVE, RimDefines::riMultXResultName(), false, 0);
|
||||
addStaticScalarResult(RimDefines::STATIC_NATIVE, RimDefines::riMultYResultName(), false, 0);
|
||||
addStaticScalarResult(RimDefines::STATIC_NATIVE, RimDefines::riMultZResultName(), false, 0);
|
||||
addStaticScalarResult(RimDefines::STATIC_NATIVE, RimDefines::combinedRiMultResultName(), false, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -91,6 +91,18 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCa
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if (uiResultName == RimDefines::combinedRiMultResultName())
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid);
|
||||
|
||||
cvf::ref<RigResultAccessor> xRiMultAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, RimDefines::riMultXResultName());
|
||||
cvf::ref<RigResultAccessor> yRiMultAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, RimDefines::riMultYResultName());
|
||||
cvf::ref<RigResultAccessor> zRiMultAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, RimDefines::riMultZResultName());
|
||||
|
||||
cellFaceAccessObject->setTransResultAccessors(xRiMultAccessor.p(), yRiMultAccessor.p(), zRiMultAccessor.p());
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
|
||||
return RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, uiResultName);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user