From de9dd579b63b4f5226ab8e252d80c756c7a666b4 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Tue, 25 Feb 2020 06:14:29 +0100 Subject: [PATCH] Use DenT instances for temperature dependent density --- .../blackoilpvt/GasPvtThermal.hpp | 19 ++++++++++--------- .../blackoilpvt/OilPvtThermal.hpp | 17 ++++++++--------- .../blackoilpvt/WaterPvtThermal.hpp | 15 +++++++-------- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/opm/material/fluidsystems/blackoilpvt/GasPvtThermal.hpp b/opm/material/fluidsystems/blackoilpvt/GasPvtThermal.hpp index 56f530f2a..b69bf8402 100644 --- a/opm/material/fluidsystems/blackoilpvt/GasPvtThermal.hpp +++ b/opm/material/fluidsystems/blackoilpvt/GasPvtThermal.hpp @@ -110,7 +110,7 @@ public: ////// const auto& tables = eclState.getTableManager(); - enableThermalDensity_ = deck.hasKeyword("GASDENT"); + enableThermalDensity_ = tables.GasDenT().size() > 0; enableThermalViscosity_ = tables.hasTables("GASVISCT"); enableInternalEnergy_ = tables.hasTables("SPECHEAT"); @@ -121,7 +121,7 @@ public: if (enableThermalViscosity_) { const auto& gasvisctTables = tables.getGasvisctTables(); int gasCompIdx = deck.getKeyword("GCOMPIDX").getRecord(0).getItem("GAS_COMPONENT_INDEX").get< int >(0) - 1; - std::string gasvisctColumnName = "Viscosity"+std::to_string(static_cast(gasCompIdx)); + std::string gasvisctColumnName = "Viscosity" + std::to_string(static_cast(gasCompIdx)); for (unsigned regionIdx = 0; regionIdx < numRegions; ++regionIdx) { const auto& T = gasvisctTables[regionIdx].getColumn("Temperature").vectorCopy(); @@ -131,17 +131,18 @@ public: } // temperature dependence of gas density - if (enableThermalDensity_) { - const auto& gasdentKeyword = deck.getKeyword("GASDENT"); + if (tables.GasDenT().size() > 0) { + const auto& gasDenT = tables.GasDenT(); - assert(gasdentKeyword.size() == numRegions); + assert(gasDenT.size() == numRegions); for (unsigned regionIdx = 0; regionIdx < numRegions; ++regionIdx) { - const auto& gasdentRecord = gasdentKeyword.getRecord(regionIdx); + const auto& record = gasDenT[regionIdx]; - gasdentRefTemp_[regionIdx] = gasdentRecord.getItem("REFERENCE_TEMPERATURE").getSIDouble(0); - gasdentCT1_[regionIdx] = gasdentRecord.getItem("EXPANSION_COEFF_LINEAR").getSIDouble(0); - gasdentCT2_[regionIdx] = gasdentRecord.getItem("EXPANSION_COEFF_QUADRATIC").getSIDouble(0); + gasdentRefTemp_[regionIdx] = record.T0; + gasdentCT1_[regionIdx] = record.C1; + gasdentCT2_[regionIdx] = record.C2; } + enableThermalDensity_ = true; } if (enableInternalEnergy_) { diff --git a/opm/material/fluidsystems/blackoilpvt/OilPvtThermal.hpp b/opm/material/fluidsystems/blackoilpvt/OilPvtThermal.hpp index 919ce7336..48e645b43 100644 --- a/opm/material/fluidsystems/blackoilpvt/OilPvtThermal.hpp +++ b/opm/material/fluidsystems/blackoilpvt/OilPvtThermal.hpp @@ -116,7 +116,7 @@ public: ////// const auto& tables = eclState.getTableManager(); - enableThermalDensity_ = deck.hasKeyword("OILDENT"); + enableThermalDensity_ = tables.OilDenT().size() > 0; enableThermalViscosity_ = tables.hasTables("OILVISCT"); enableInternalEnergy_ = tables.hasTables("SPECHEAT"); @@ -157,16 +157,15 @@ public: } // temperature dependence of oil density - if (enableThermalDensity_) { - const auto& oildentKeyword = deck.getKeyword("OILDENT"); - - assert(oildentKeyword.size() == numRegions); + const auto& oilDenT = tables.OilDenT(); + if (oilDenT.size() > 0) { + assert(oilDenT.size() == numRegions); for (unsigned regionIdx = 0; regionIdx < numRegions; ++regionIdx) { - const auto& oildentRecord = oildentKeyword.getRecord(regionIdx); + const auto& record = oilDenT[regionIdx]; - oildentRefTemp_[regionIdx] = oildentRecord.getItem("REFERENCE_TEMPERATURE").getSIDouble(0); - oildentCT1_[regionIdx] = oildentRecord.getItem("EXPANSION_COEFF_LINEAR").getSIDouble(0); - oildentCT2_[regionIdx] = oildentRecord.getItem("EXPANSION_COEFF_QUADRATIC").getSIDouble(0); + oildentRefTemp_[regionIdx] = record.T0; + oildentCT1_[regionIdx] = record.C1; + oildentCT2_[regionIdx] = record.C2; } } diff --git a/opm/material/fluidsystems/blackoilpvt/WaterPvtThermal.hpp b/opm/material/fluidsystems/blackoilpvt/WaterPvtThermal.hpp index 1396acfcb..f1ddd7d73 100644 --- a/opm/material/fluidsystems/blackoilpvt/WaterPvtThermal.hpp +++ b/opm/material/fluidsystems/blackoilpvt/WaterPvtThermal.hpp @@ -122,7 +122,7 @@ public: ////// const auto& tables = eclState.getTableManager(); - enableThermalDensity_ = deck.hasKeyword("WATDENT"); + enableThermalDensity_ = tables.WatDenT().size() > 0; enableThermalViscosity_ = tables.hasTables("WATVISCT"); enableInternalEnergy_ = tables.hasTables("SPECHEAT"); @@ -130,20 +130,19 @@ public: setNumRegions(numRegions); if (enableThermalDensity_) { - const auto& watdentKeyword = deck.getKeyword("WATDENT"); + const auto& watDenT = tables.WatDenT(); - assert(watdentKeyword.size() == numRegions); + assert(watDenT.size() == numRegions); for (unsigned regionIdx = 0; regionIdx < numRegions; ++regionIdx) { - const auto& watdentRecord = watdentKeyword.getRecord(regionIdx); + const auto& record = watDenT[regionIdx]; - watdentRefTemp_[regionIdx] = watdentRecord.getItem("REFERENCE_TEMPERATURE").getSIDouble(0); - watdentCT1_[regionIdx] = watdentRecord.getItem("EXPANSION_COEFF_LINEAR").getSIDouble(0); - watdentCT2_[regionIdx] = watdentRecord.getItem("EXPANSION_COEFF_QUADRATIC").getSIDouble(0); + watdentRefTemp_[regionIdx] = record.T0; + watdentCT1_[regionIdx] = record.C1; + watdentCT2_[regionIdx] = record.C2; } } if (enableThermalViscosity_) { - if (tables.getViscrefTable().empty()) throw std::runtime_error("VISCREF is required when WATVISCT is present");