diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index bc1253daae..c6763aad77 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -1287,15 +1287,26 @@ void RimWellRftPlot::calculateValueOptionsForWells(QList if (proj != nullptr) { const std::vector simWellNames = proj->simulationWellNames(); - auto wellNames = std::set(simWellNames.begin(), simWellNames.end()); + std::set simWellsAssociatedWithWellPath; + std::set wellNames; // Observed wells - for (const auto& oilField : proj->oilFields()) + for (RimWellPath* const wellPath : proj->allWellPaths()) { - auto wellPathColl = oilField->wellPathCollection(); - for (const auto& wellPath : wellPathColl->wellPaths) + wellNames.insert(wellPath->name()); + + if (!wellPath->associatedSimulationWell().isEmpty()) { - wellNames.insert(wellPath->name()); + simWellsAssociatedWithWellPath.insert(wellPath->associatedSimulationWell()); + } + } + + // Sim wells not associated with well path + for (const QString& simWellName : simWellNames) + { + if (simWellsAssociatedWithWellPath.count(simWellName) == 0) + { + wellNames.insert(simWellName); } }