From 5278a1f193d9e9f139df053c29819a43c3c4f4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= Date: Thu, 15 Dec 2016 16:03:53 +0100 Subject: [PATCH] Use Density from EclipseState --- opm/core/props/IncompPropertiesSinglePhase.cpp | 6 +++--- opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/opm/core/props/IncompPropertiesSinglePhase.cpp b/opm/core/props/IncompPropertiesSinglePhase.cpp index abe57576c..0b9e9a485 100644 --- a/opm/core/props/IncompPropertiesSinglePhase.cpp +++ b/opm/core/props/IncompPropertiesSinglePhase.cpp @@ -37,9 +37,9 @@ namespace Opm { rock_.init(eclState, grid.number_of_cells, grid.global_cell, grid.cartdims); - if (deck.hasKeyword("DENSITY")) { - const auto& densityRecord = deck.getKeyword("DENSITY").getRecord(0); - surface_density_ = densityRecord.getItem("OIL").getSIDouble(0); + const auto& densities = eclState.getTableManager().getDensityTable(); + if( !densities.empty() ) { + surface_density_ = densities[0].oil; } else { surface_density_ = 1000.0; OPM_MESSAGE("Input is missing DENSITY -- using a standard density of " diff --git a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp index c713170c8..19a0d4e7a 100644 --- a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp +++ b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp @@ -47,10 +47,10 @@ namespace Opm } // Surface densities. Accounting for different orders in eclipse and our code. - if (deck.hasKeyword("DENSITY")) { - const auto& densityRecord = deck.getKeyword("DENSITY").getRecord(region_number); - surface_density_[phase_usage.phase_pos[PhaseUsage::Aqua]] = densityRecord.getItem("OIL").getSIDouble(0); - surface_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] = densityRecord.getItem("WATER").getSIDouble(0); + const auto& densities = es.getTableManager().getDensityTable(); + if (!densities.empty()) { + surface_density_[phase_usage.phase_pos[PhaseUsage::Aqua]] = densities[region_number].water; + surface_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] = densities[region_number].oil; } else { OPM_THROW(std::runtime_error, "Input is missing DENSITY\n"); }