Пример #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimSimWellInViewCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
    updateStateForVisibilityCheckboxes();

    caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Visibility");
    appearanceGroup->add(&showWellsIntersectingVisibleCells);
    appearanceGroup->add(&m_showWellLabel);
    appearanceGroup->add(&m_showWellHead);
    appearanceGroup->add(&m_showWellPipe);
    appearanceGroup->add(&m_showWellSpheres);
    appearanceGroup->add(&m_showWellCommunicationLines);
    
    caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well Cells and Fence");
    filterGroup->add(&m_showWellCells);
    filterGroup->add(&m_showWellCellFence);
    filterGroup->add(&wellCellFenceType);

    caf::PdmUiGroup* sizeScalingGroup = uiOrdering.addNewGroup("Size Scaling");
    sizeScalingGroup->add(&wellHeadScaleFactor);
    sizeScalingGroup->add(&pipeScaleFactor);
    sizeScalingGroup->add(&spheresScaleFactor);

    caf::PdmUiGroup* colorGroup = uiOrdering.addNewGroup("Colors");
    colorGroup->setCollapsedByDefault(true);
    colorGroup->add(&showConnectionStatusColors);
    colorGroup->add(&wellLabelColor);
    colorGroup->add(&m_applyIndividualColorsToWells);
    colorGroup->add(&m_applySingleColorToWells);
    colorGroup->add(&m_wellColorForApply);

    caf::PdmUiGroup* wellPipeGroup = uiOrdering.addNewGroup("Well Pipe Geometry" );
    wellPipeGroup->add(&wellPipeCoordType);
    wellPipeGroup->add(&isAutoDetectingBranches);

    caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup("Advanced");
    advancedGroup->setCollapsedByDefault(true);
    advancedGroup->add(&wellCellTransparencyLevel);
    advancedGroup->add(&wellHeadPosition);

    RimEclipseResultCase* ownerCase = nullptr; 
    firstAncestorOrThisOfType(ownerCase);
    if (ownerCase)
    {
        m_showWellCommunicationLines.uiCapability()->setUiHidden(!ownerCase->flowDiagSolverInterface());
    }

    m_showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells());
    wellCellFenceType.uiCapability()->setUiReadOnly(!showWellCells());
}
Пример #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RigFlowDiagVisibleCellsStatCalc::mobileVolumeWeightedMean(size_t timeStepIndex, double &result)
{
    RimEclipseResultCase* eclCase = nullptr;
    m_resultsData->flowDiagSolution()->firstAncestorOrThisOfType(eclCase);
    if (!eclCase) return;

    RigCaseCellResultsData* caseCellResultsData = eclCase->results(RiaDefines::MATRIX_MODEL);

    size_t mobPVResultIndex = caseCellResultsData->findOrLoadScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName());
    
    const std::vector<double>& weights = caseCellResultsData->cellScalarResults(mobPVResultIndex, 0);
    const std::vector<double>* values = m_resultsData->resultValues(m_resVarAddr, timeStepIndex);

    const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo(m_resVarAddr);

    RigWeightedMeanCalc::weightedMeanOverCells(&weights, values, m_cellVisibilities.p(), true, actCellInfo, true, &result);
}
Пример #3
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RiuRelativePermeabilityPlotUpdater::queryDataAndUpdatePlot(const RimEclipseView& eclipseView, size_t gridIndex, size_t gridLocalCellIndex, RiuRelativePermeabilityPlotPanel* plotPanel)
{
    CVF_ASSERT(plotPanel);

    RimEclipseResultCase* eclipseResultCase = dynamic_cast<RimEclipseResultCase*>(eclipseView.eclipseCase());
    RigEclipseCaseData* eclipseCaseData = eclipseResultCase ? eclipseResultCase->eclipseCaseData() : nullptr;
    if (eclipseResultCase && eclipseCaseData && eclipseResultCase->flowDiagSolverInterface())
    {
        size_t activeCellIndex = CellLookupHelper::mapToActiveCellIndex(eclipseCaseData, gridIndex, gridLocalCellIndex);
        if (activeCellIndex != cvf::UNDEFINED_SIZE_T)
        {
            //cvf::Trace::show("Updating RelPerm plot for active cell index: %d", static_cast<int>(activeCellIndex));

            std::vector<RigFlowDiagSolverInterface::RelPermCurve> relPermCurveArr = eclipseResultCase->flowDiagSolverInterface()->calculateRelPermCurves(activeCellIndex);

            // Make sure we load the results that we'll query below
            RigCaseCellResultsData* cellResultsData = eclipseCaseData->results(RiaDefines::MATRIX_MODEL);
            cellResultsData->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT");
            cellResultsData->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS");
            cellResultsData->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "SATNUM");

            // Fetch SWAT and SGAS cell values for the selected cell
            const size_t timeStepIndex = static_cast<size_t>(eclipseView.currentTimeStep());
            cvf::ref<RigResultAccessor> swatAccessor = RigResultAccessorFactory::createFromNameAndType(eclipseCaseData, gridIndex, RiaDefines::MATRIX_MODEL, timeStepIndex, "SWAT", RiaDefines::DYNAMIC_NATIVE);
            cvf::ref<RigResultAccessor> sgasAccessor = RigResultAccessorFactory::createFromNameAndType(eclipseCaseData, gridIndex, RiaDefines::MATRIX_MODEL, timeStepIndex, "SGAS", RiaDefines::DYNAMIC_NATIVE);
            cvf::ref<RigResultAccessor> satnumAccessor = RigResultAccessorFactory::createFromNameAndType(eclipseCaseData, gridIndex, RiaDefines::MATRIX_MODEL, timeStepIndex, "SATNUM", RiaDefines::STATIC_NATIVE);
            const double cellSWAT = swatAccessor.notNull() ? swatAccessor->cellScalar(gridLocalCellIndex) : HUGE_VAL;
            const double cellSGAS = sgasAccessor.notNull() ? sgasAccessor->cellScalar(gridLocalCellIndex) : HUGE_VAL;
            const double cellSATNUM = satnumAccessor.notNull() ? satnumAccessor->cellScalar(gridLocalCellIndex) : HUGE_VAL;
            //cvf::Trace::show("cellSWAT = %f  cellSGAS = %f  cellSATNUM = %f", cellSWAT, cellSGAS, cellSATNUM);

            QString cellRefText = constructCellReferenceText(eclipseCaseData, gridIndex, gridLocalCellIndex, cellSATNUM);
            QString caseName = eclipseResultCase->caseUserDescription;

            plotPanel->setPlotData(eclipseCaseData->unitsType(), relPermCurveArr, cellSWAT, cellSGAS, caseName, cellRefText);

            return true;
        }
    }

    return false;
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicPasteEclipseCasesFeature::addCasesToGridCaseGroup(PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup)
{
    RimProject* proj = RiaApplication::instance()->project();
    CVF_ASSERT(proj);

    std::vector<RimEclipseResultCase*> resultCases;

    for (size_t i = 0; i < objectGroup.objects.size(); i++)
    {
        RimEclipseResultCase* eclCase = dynamic_cast<RimEclipseResultCase*>(objectGroup.objects[i]);
        if (eclCase)
        {
            RimEclipseResultCase* eclCaseCopy = dynamic_cast<RimEclipseResultCase*>(eclCase->copyByXmlSerialization(PdmDefaultObjectFactory::instance()));
            resultCases.push_back(eclCaseCopy);
        }
    }

    if (resultCases.size() == 0)
    {
        return;
    }

    RimEclipseResultCase* mainResultCase = NULL;
    std::vector< std::vector<int> > mainCaseGridDimensions;

    // Read out main grid and main grid dimensions if present in case group
    if (gridCaseGroup->mainCase())
    {
        mainResultCase = dynamic_cast<RimEclipseResultCase*>(gridCaseGroup->mainCase());
        CVF_ASSERT(mainResultCase);

        mainResultCase->readGridDimensions(mainCaseGridDimensions);
    }

    std::vector<RimEclipseResultCase*> insertedCases;

    // Add cases to case group
    for (size_t i = 0; i < resultCases.size(); i++)
    {
        RimEclipseResultCase* rimResultReservoir = resultCases[i];

        proj->assignCaseIdToCase(rimResultReservoir);

        if (gridCaseGroup->contains(rimResultReservoir))
        {
            continue;
        }

        insertedCases.push_back(rimResultReservoir);
    }

    // Load stuff 
    for (size_t i = 0; i < insertedCases.size(); i++)
    {
        RimEclipseResultCase* rimResultReservoir = insertedCases[i];

        if (!mainResultCase)
        {
            rimResultReservoir->openEclipseGridFile();
            rimResultReservoir->readGridDimensions(mainCaseGridDimensions);

            mainResultCase = rimResultReservoir;
        }
        else
        {
            std::vector< std::vector<int> > caseGridDimensions;
            rimResultReservoir->readGridDimensions(caseGridDimensions);

            bool identicalGrid = RigGridManager::isGridDimensionsEqual(mainCaseGridDimensions, caseGridDimensions);
            if (!identicalGrid)
            {
                continue;
            }

            if (!rimResultReservoir->openAndReadActiveCellData(mainResultCase->reservoirData()))
            {
                CVF_ASSERT(false);
            }
        }

        RimOilField* activeOilField = proj ? proj->activeOilField() : NULL;
        RimEclipseCaseCollection* analysisModels = (activeOilField) ? activeOilField->analysisModels() : NULL;
        if (analysisModels) analysisModels->insertCaseInCaseGroup(gridCaseGroup, rimResultReservoir);

        caf::PdmDocument::updateUiIconStateRecursively(rimResultReservoir);

        gridCaseGroup->updateConnectedEditors();

        for (size_t rvIdx = 0; rvIdx < rimResultReservoir->reservoirViews.size(); rvIdx++)
        {
            RimEclipseView* riv = rimResultReservoir->reservoirViews()[rvIdx];
            riv->loadDataAndUpdate();
        }
    }
}