///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2022- Equinor ASA // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RimWellAllocationTools.h" #include "RiaDefines.h" #include "RigFlowDiagResults.h" #include "RigSimWellData.h" #include "RimFlowDiagSolution.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::map*> RimWellAllocationTools::findOrCreateRelevantTracerCellFractions( const RigSimWellData* simWellData, RimFlowDiagSolution* flowDiagSolution, int timeStepIndex ) { return findOrCreateRelevantTracerCellFractions( simWellData, flowDiagSolution, RigFlowDiagResultAddress::PHASE_ALL, timeStepIndex ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::map*> RimWellAllocationTools::findOrCreateRelevantTracerCellFractions( const RigSimWellData* simWellData, RimFlowDiagSolution* flowDiagSolution, RigFlowDiagResultAddress::PhaseSelection phaseSelection, int timeStepIndex ) { std::map*> tracerCellFractionValues = {}; if ( flowDiagSolution && simWellData->hasWellResult( timeStepIndex ) ) { RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::TracerStatusType::UNDEFINED; const RiaDefines::WellProductionType prodType = simWellData->wellProductionType( timeStepIndex ); if ( prodType == RiaDefines::WellProductionType::PRODUCER || prodType == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE ) { requestedTracerType = RimFlowDiagSolution::TracerStatusType::INJECTOR; } else { requestedTracerType = RimFlowDiagSolution::TracerStatusType::PRODUCER; } std::vector tracerNames = flowDiagSolution->tracerNames(); for ( const QString& tracerName : tracerNames ) { if ( flowDiagSolution->tracerStatusInTimeStep( tracerName, timeStepIndex ) == requestedTracerType ) { RigFlowDiagResultAddress resAddr( RIG_FLD_CELL_FRACTION_RESNAME, phaseSelection, tracerName.toStdString() ); const std::vector* tracerCellFractions = flowDiagSolution->flowDiagResults()->resultValues( resAddr, timeStepIndex ); if ( tracerCellFractions ) { tracerCellFractionValues[tracerName] = tracerCellFractions; } } } } return tracerCellFractionValues; }