mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added riTRANSXYZbyArea (and X, Y, Z )
This commit is contained in:
parent
e40e3c40f1
commit
d76dd6a588
@ -650,7 +650,9 @@ void RivFaultPartMgr::updateNNCColors(RimResultSlot* cellResultSlot)
|
||||
if (cellResultSlot
|
||||
&& ( cellResultSlot->resultVariable() == RimDefines::combinedTransmissibilityResultName()
|
||||
|| cellResultSlot->resultVariable() == RimDefines::combinedRiTransResultName()
|
||||
|| cellResultSlot->resultVariable() == RimDefines::combinedRiMultResultName()) )
|
||||
|| cellResultSlot->resultVariable() == RimDefines::combinedRiMultResultName()
|
||||
|| cellResultSlot->resultVariable() == RimDefines::combinedRiAreaNormTransResultName()
|
||||
))
|
||||
{
|
||||
size_t scalarSetIndex = cellResultSlot->gridScalarIndex();
|
||||
|
||||
|
@ -72,6 +72,10 @@ bool RimDefines::isPerCellFaceResult(const QString& resultName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RimDefines::combinedRiAreaNormTransResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -46,15 +46,22 @@ public:
|
||||
static QString combinedTransmissibilityResultName() { return "TRANSXYZ"; }
|
||||
static QString ternarySaturationResultName() { return "TERNARY"; }
|
||||
static QString combinedMultResultName() { return "MULTXYZ"; }
|
||||
static QString combinedRiTransResultName() { return "riTRANSXYZ"; }
|
||||
|
||||
static QString riTransXResultName() { return "riTRANSX"; }
|
||||
static QString riTransYResultName() { return "riTRANSY"; }
|
||||
static QString riTransZResultName() { return "riTRANSZ"; }
|
||||
static QString combinedRiTransResultName() { return "riTRANSXYZ"; }
|
||||
|
||||
static QString riMultXResultName() { return "riMULTX"; }
|
||||
static QString riMultYResultName() { return "riMULTY"; }
|
||||
static QString riMultZResultName() { return "riMULTZ"; }
|
||||
static QString combinedRiMultResultName() { return "riMULTXYZ"; }
|
||||
|
||||
static QString riAreaNormTransXResultName() { return "riTRANSXbyArea"; }
|
||||
static QString riAreaNormTransYResultName() { return "riTRANSYbyArea"; }
|
||||
static QString riAreaNormTransZResultName() { return "riTRANSZbyArea"; }
|
||||
static QString combinedRiAreaNormTransResultName() { return "riTRANSXYZbyArea"; }
|
||||
|
||||
// Mock model text identifiers
|
||||
static QString mockModelBasic() { return "Result Mock Debug Model Simple"; }
|
||||
static QString mockModelBasicWithResults() { return "Result Mock Debug Model With Results"; }
|
||||
|
@ -305,6 +305,19 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RimDefines::Result
|
||||
{
|
||||
computeRiMULTComponent(resultName);
|
||||
}
|
||||
else if (resultName == RimDefines::combinedRiAreaNormTransResultName())
|
||||
{
|
||||
computeRiTRANSbyAreaComponent(RimDefines::riAreaNormTransXResultName());
|
||||
computeRiTRANSbyAreaComponent(RimDefines::riAreaNormTransYResultName());
|
||||
computeRiTRANSbyAreaComponent(RimDefines::riAreaNormTransZResultName());
|
||||
computeNncCombRiTRANSbyArea();
|
||||
}
|
||||
else if (resultName == RimDefines::riAreaNormTransXResultName()
|
||||
|| resultName == RimDefines::riAreaNormTransYResultName()
|
||||
|| resultName == RimDefines::riAreaNormTransZResultName())
|
||||
{
|
||||
computeRiTRANSbyAreaComponent(resultName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1179,6 +1192,148 @@ void RimReservoirCellResultsStorage::computeNncCombRiMULT()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirCellResultsStorage::computeRiTRANSbyAreaComponent(const QString& riTransByAreaCompResultName)
|
||||
{
|
||||
if (!m_cellResults) return;
|
||||
|
||||
// Set up which component to compute
|
||||
|
||||
cvf::StructGridInterface::FaceType faceId;
|
||||
QString transCompName;
|
||||
|
||||
if (riTransByAreaCompResultName == RimDefines::riAreaNormTransXResultName())
|
||||
{
|
||||
transCompName = "TRANX";
|
||||
faceId = cvf::StructGridInterface::POS_I;
|
||||
}
|
||||
else if (riTransByAreaCompResultName == RimDefines::riAreaNormTransYResultName())
|
||||
{
|
||||
transCompName = "TRANY";
|
||||
faceId = cvf::StructGridInterface::POS_J;
|
||||
}
|
||||
else if (riTransByAreaCompResultName == RimDefines::riAreaNormTransZResultName())
|
||||
{
|
||||
transCompName = "TRANZ";
|
||||
faceId = cvf::StructGridInterface::POS_K;
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
}
|
||||
|
||||
// Get the needed result indices we depend on
|
||||
|
||||
size_t tranCompScResIdx = findOrLoadScalarResult(RimDefines::STATIC_NATIVE, transCompName);
|
||||
|
||||
// Get the result index of the output
|
||||
|
||||
size_t riTranByAreaScResIdx = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, riTransByAreaCompResultName);
|
||||
CVF_ASSERT(riTranByAreaScResIdx != cvf::UNDEFINED_SIZE_T);
|
||||
|
||||
// Get the result count, to handle that one of them might be globally defined
|
||||
|
||||
size_t resultValueCount = m_cellResults->cellScalarResults(tranCompScResIdx)[0].size();
|
||||
|
||||
// Get all the actual result values
|
||||
|
||||
std::vector<double> & transResults = m_cellResults->cellScalarResults(tranCompScResIdx)[0];
|
||||
std::vector<double> & riTransByAreaResults = m_cellResults->cellScalarResults(riTranByAreaScResIdx)[0];
|
||||
|
||||
// Set up output container to correct number of results
|
||||
|
||||
riTransByAreaResults.resize(resultValueCount);
|
||||
|
||||
// Prepare how to index the result values:
|
||||
|
||||
bool isUsingResIdx = m_cellResults->isUsingGlobalActiveIndex(tranCompScResIdx);
|
||||
|
||||
// Set up result index function pointers
|
||||
|
||||
ResultIndexFunction resValIdxFunc = isUsingResIdx ? &reservoirActiveCellIndex : &directReservoirCellIndex;
|
||||
|
||||
const RigActiveCellInfo* activeCellInfo = m_cellResults->activeCellInfo();
|
||||
const std::vector<cvf::Vec3d>& nodes = m_ownerMainGrid->nodes();
|
||||
bool isFaceNormalsOutwards = m_ownerMainGrid->faceNormalsIsOutwards();
|
||||
|
||||
for (size_t nativeResvCellIndex = 0; nativeResvCellIndex < m_ownerMainGrid->cells().size(); nativeResvCellIndex++)
|
||||
{
|
||||
// Do nothing if we are only dealing with active cells, and this cell is not active:
|
||||
size_t nativeCellResValIdx = (*resValIdxFunc)(activeCellInfo, nativeResvCellIndex);
|
||||
|
||||
if (nativeCellResValIdx == cvf::UNDEFINED_SIZE_T) continue;
|
||||
|
||||
const RigCell& nativeCell = m_ownerMainGrid->cells()[nativeResvCellIndex];
|
||||
RigGridBase* grid = nativeCell.hostGrid();
|
||||
|
||||
size_t gridLocalNativeCellIndex = nativeCell.gridLocalCellIndex();
|
||||
|
||||
size_t i, j, k, gridLocalNeighborCellIdx;
|
||||
|
||||
grid->ijkFromCellIndex(gridLocalNativeCellIndex, &i, &j, &k);
|
||||
|
||||
if (grid->cellIJKNeighbor(i, j, k, faceId, &gridLocalNeighborCellIdx))
|
||||
{
|
||||
size_t neighborResvCellIdx = grid->reservoirCellIndex(gridLocalNeighborCellIdx);
|
||||
const RigCell& neighborCell = m_ownerMainGrid->cells()[neighborResvCellIdx];
|
||||
|
||||
// Connection geometry
|
||||
|
||||
const RigFault* fault = grid->mainGrid()->findFaultFromCellIndexAndCellFace(nativeResvCellIndex, faceId);
|
||||
bool isOnFault = fault;
|
||||
|
||||
cvf::Vec3d faceAreaVec;
|
||||
cvf::Vec3d faceCenter;
|
||||
|
||||
if (isOnFault)
|
||||
{
|
||||
calculateConnectionGeometry(nativeCell, neighborCell, nodes, faceId,
|
||||
&faceCenter, &faceAreaVec);
|
||||
}
|
||||
else
|
||||
{
|
||||
faceCenter = nativeCell.faceCenter(faceId);
|
||||
faceAreaVec = nativeCell.faceNormalWithAreaLenght(faceId);
|
||||
}
|
||||
|
||||
double areaOfOverlap = faceAreaVec.length();
|
||||
double transCompValue = transResults[nativeCellResValIdx];
|
||||
|
||||
riTransByAreaResults[nativeCellResValIdx] = transCompValue / areaOfOverlap;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirCellResultsStorage::computeNncCombRiTRANSbyArea()
|
||||
{
|
||||
if (!m_cellResults) return;
|
||||
|
||||
size_t riCombTransByAreaScResIdx = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedRiAreaNormTransResultName());
|
||||
size_t combTransScalarResultIndex = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedTransmissibilityResultName());
|
||||
|
||||
if (m_ownerMainGrid->nncData()->connectionScalarResult(riCombTransByAreaScResIdx)) return;
|
||||
|
||||
std::vector<double> & riAreaNormTransResults = m_ownerMainGrid->nncData()->makeConnectionScalarResult(riCombTransByAreaScResIdx);
|
||||
const std::vector<double> * transResults = m_ownerMainGrid->nncData()->connectionScalarResult(combTransScalarResultIndex);
|
||||
|
||||
const std::vector<RigConnection>& connections = m_ownerMainGrid->nncData()->connections();
|
||||
|
||||
for (size_t nncConIdx = 0; nncConIdx < riAreaNormTransResults.size(); ++nncConIdx)
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& realPolygon = connections[nncConIdx].m_polygon;
|
||||
cvf::Vec3d faceAreaVec = cvf::GeometryTools::polygonAreaNormal3D(realPolygon);
|
||||
double areaOfOverlap = faceAreaVec.length();
|
||||
|
||||
riAreaNormTransResults[nncConIdx] = (*transResults)[nncConIdx] / areaOfOverlap;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -69,6 +69,8 @@ private:
|
||||
void computeNncCombRiTrans();
|
||||
void computeRiMULTComponent(const QString& riMultCompName);
|
||||
void computeNncCombRiMULT();
|
||||
void computeRiTRANSbyAreaComponent(const QString& riTransByAreaCompResultName);
|
||||
void computeNncCombRiTRANSbyArea();
|
||||
|
||||
QString getValidCacheFileName();
|
||||
QString getCacheDirectoryPath();
|
||||
|
@ -2160,6 +2160,20 @@ void RimReservoirView::appendTextFromResultSlot(RigCaseData* eclipseCase, size_t
|
||||
resultInfoText->append(QString("riMult Z : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else if (resultSlot->resultVariable().compare(RimDefines::combinedRiAreaNormTransResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedRiAreaNormTransResultName());
|
||||
{
|
||||
double scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
||||
resultInfoText->append(QString("riTransByArea X : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
||||
resultInfoText->append(QString("riTransByArea Y : %1\n").arg(scalarValue));
|
||||
|
||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
||||
resultInfoText->append(QString("riTransByArea Z : %1\n").arg(scalarValue));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, resultSlot->gridScalarIndex());
|
||||
|
@ -278,6 +278,14 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty
|
||||
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riMultZResultName()));
|
||||
statisticsCalculator = calc;
|
||||
}
|
||||
else if (resultName == RimDefines::combinedRiAreaNormTransResultName())
|
||||
{
|
||||
cvf::ref<RigMultipleDatasetStatCalc> calc = new RigMultipleDatasetStatCalc();
|
||||
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTransXResultName()));
|
||||
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTransYResultName()));
|
||||
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTransZResultName()));
|
||||
statisticsCalculator = calc;
|
||||
}
|
||||
else
|
||||
{
|
||||
statisticsCalculator = new RigNativeStatCalc(this, scalarResultIndex);
|
||||
@ -565,6 +573,30 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
addStaticScalarResult(RimDefines::STATIC_NATIVE, RimDefines::combinedRiMultResultName(), false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// riTRANSXYZbyArea and X, Y, Z
|
||||
{
|
||||
if (findScalarResultIndex(RimDefines::STATIC_NATIVE, "TRANX") != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
addStaticScalarResult(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTransXResultName(), false, 0);
|
||||
}
|
||||
|
||||
if (findScalarResultIndex(RimDefines::STATIC_NATIVE, "TRANY") != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
addStaticScalarResult(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTransYResultName(), false, 0);
|
||||
}
|
||||
|
||||
if (findScalarResultIndex(RimDefines::STATIC_NATIVE, "TRANZ") != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
addStaticScalarResult(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTransZResultName(), false, 0);
|
||||
}
|
||||
|
||||
size_t tranX, tranY, tranZ;
|
||||
if (findTransmissibilityResults(tranX, tranY, tranZ))
|
||||
{
|
||||
addStaticScalarResult(RimDefines::STATIC_NATIVE, RimDefines::combinedRiAreaNormTransResultName(), false, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -103,7 +103,18 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCa
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if (uiResultName == RimDefines::combinedRiAreaNormTransResultName())
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid);
|
||||
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, RimDefines::riAreaNormTransXResultName());
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, RimDefines::riAreaNormTransYResultName());
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, RimDefines::riAreaNormTransZResultName());
|
||||
|
||||
cellFaceAccessObject->setTransResultAccessors(xRiAreaNormTransAccessor.p(), yRiAreaNormTransAccessor.p(), zRiAreaNormTransAccessor.p());
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
return RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, uiResultName);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user