From 94974f045452651e0bf58d392db61b94ca2895c6 Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Thu, 20 Nov 2014 16:20:54 +0800 Subject: [PATCH] add WPOLYMER to schedule section. --- opm/parser/eclipse/CMakeLists.txt | 2 ++ .../EclipseState/Schedule/Schedule.cpp | 28 +++++++++++++++ .../EclipseState/Schedule/Schedule.hpp | 1 + .../eclipse/EclipseState/Schedule/Well.cpp | 15 ++++++++ .../eclipse/EclipseState/Schedule/Well.hpp | 6 ++++ .../Schedule/WellPolymerProperties.cpp | 12 +++++++ .../Schedule/WellPolymerProperties.hpp | 34 +++++++++++++++++++ 7 files changed, 98 insertions(+) create mode 100644 opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp create mode 100644 opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp diff --git a/opm/parser/eclipse/CMakeLists.txt b/opm/parser/eclipse/CMakeLists.txt index f2a300605..476015fe7 100644 --- a/opm/parser/eclipse/CMakeLists.txt +++ b/opm/parser/eclipse/CMakeLists.txt @@ -70,6 +70,7 @@ EclipseState/Schedule/Schedule.cpp EclipseState/Schedule/Well.cpp EclipseState/Schedule/WellProductionProperties.cpp EclipseState/Schedule/WellInjectionProperties.cpp +EclipseState/Schedule/WellPolymerProperties.cpp EclipseState/Schedule/WellSet.cpp EclipseState/Schedule/Group.cpp EclipseState/Schedule/Completion.cpp @@ -134,6 +135,7 @@ EclipseState/Schedule/Schedule.hpp EclipseState/Schedule/Well.hpp EclipseState/Schedule/WellProductionProperties.hpp EclipseState/Schedule/WellInjectionProperties.hpp +EclipseState/Schedule/WellPolymerProperties.hpp EclipseState/Schedule/WellSet.hpp EclipseState/Schedule/Group.hpp EclipseState/Schedule/DynamicState.hpp diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 32ade4b51..0856f9cf2 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -83,6 +84,9 @@ namespace Opm { if (keyword->name() == "WCONINJE") handleWCONINJE(deck, keyword, parserLog, currentStep); + if (keyword->name() == "WPOLYMER") + handleWPOLYMER(deck, keyword, parserLog, currentStep); + if (keyword->name() == "WCONINJH") handleWCONINJH(deck, keyword, parserLog, currentStep); @@ -321,6 +325,29 @@ namespace Opm { } + void Schedule::handleWPOLYMER(DeckConstPtr deck, DeckKeywordConstPtr keyword, ParserLogPtr /*parserLog*/, size_t currentStep) { + for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) { + DeckRecordConstPtr record = keyword->getRecord(recordNr); + const std::string& wellNamePattern = record->getItem("WELL")->getTrimmedString(0); + std::vector wells = getWells(wellNamePattern); + + for (auto wellIter=wells.begin(); wellIter != wells.end(); ++wellIter) { + WellPtr well = *wellIter; + + WellPolymerProperties properties(well->getPolymerPropertiesCopy(currentStep)); + + if (!record->getItem("POLYMER_CONCENTRATION")->defaultApplied(0)) { + properties.m_polymerConcentration = record->getItem("POLYMER_CONCENTRATION")->getSIDouble(0); + } + if (!record->getItem("SALT_CONCENTRATION")->defaultApplied(0)) { + properties.m_saltConcentration = record->getItem("SALT_CONCENTRATION")->getSIDouble(0); + } + + well->setPolymerProperties(currentStep, properties); + } + } + } + void Schedule::handleWCONINJH(DeckConstPtr deck, DeckKeywordConstPtr keyword, ParserLogPtr /*parserLog*/, size_t currentStep) { for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) { DeckRecordConstPtr record = keyword->getRecord(recordNr); @@ -617,6 +644,7 @@ namespace Opm { } } + bool Schedule::convertEclipseStringToBool(const std::string& eclipseString) { std::string lowerTrimmed = boost::algorithm::to_lower_copy(eclipseString); boost::algorithm::trim(lowerTrimmed); diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 124857418..a7fc3c7ca 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -79,6 +79,7 @@ namespace Opm void handleWGRUPCON(DeckKeywordConstPtr keyword, ParserLogPtr parserLog, size_t currentStep); void handleCOMPDAT(DeckKeywordConstPtr keyword, ParserLogPtr parserLog, size_t currentStep); void handleWCONINJE(DeckConstPtr deck, DeckKeywordConstPtr keyword, ParserLogPtr parserLog, size_t currentStep); + void handleWPOLYMER(DeckConstPtr deck, DeckKeywordConstPtr keyword, ParserLogPtr parserLog, size_t currentStep); void handleWCONINJH(DeckConstPtr deck, DeckKeywordConstPtr keyword, ParserLogPtr parserLog, size_t currentStep); void handleWELOPEN(DeckKeywordConstPtr keyword, ParserLogPtr parserLog, size_t currentStep); void handleGCONINJE(DeckConstPtr deck, DeckKeywordConstPtr keyword, ParserLogPtr parserLog, size_t currentStep); diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well.cpp b/opm/parser/eclipse/EclipseState/Schedule/Well.cpp index a16b974cf..26afc7941 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well.cpp @@ -38,6 +38,7 @@ namespace Opm { m_completions( new DynamicState( timeMap , CompletionSetConstPtr( new CompletionSet()) )), m_productionProperties( new DynamicState(timeMap, WellProductionProperties() )), m_injectionProperties( new DynamicState(timeMap, WellInjectionProperties() )), + m_polymerProperties( new DynamicState(timeMap, WellPolymerProperties() )), m_groupName( new DynamicState( timeMap , "" )), m_headI(headI), m_headJ(headJ), @@ -60,6 +61,7 @@ namespace Opm { m_completions( new DynamicState( timeMap , CompletionSetConstPtr( new CompletionSet()) )), m_productionProperties( new DynamicState(timeMap, WellProductionProperties() )), m_injectionProperties( new DynamicState(timeMap, WellInjectionProperties() )), + m_polymerProperties( new DynamicState(timeMap, WellPolymerProperties() )), m_groupName( new DynamicState( timeMap , "" )), m_headI(headI), m_headJ(headJ), @@ -102,6 +104,19 @@ namespace Opm { return m_injectionProperties->at(timeStep); } + void Well::setPolymerProperties(size_t timeStep , const WellPolymerProperties newProperties) { + m_isProducer->add(timeStep , false); + m_polymerProperties->add(timeStep, newProperties); + } + + WellPolymerProperties Well::getPolymerPropertiesCopy(size_t timeStep) const { + return m_polymerProperties->get(timeStep); + } + + const WellPolymerProperties& Well::getPolymerProperties(size_t timeStep) const { + return m_polymerProperties->at(timeStep); + } + bool Well::hasBeenDefined(size_t timeStep) const { if (timeStep < m_creationTimeStep) return false; diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well.hpp index f10a51e62..a7068dfec 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well.hpp @@ -27,6 +27,7 @@ #include #include #include +#include #include @@ -83,6 +84,10 @@ namespace Opm { WellInjectionProperties getInjectionPropertiesCopy(size_t timeStep) const; const WellInjectionProperties& getInjectionProperties(size_t timeStep) const; + void setPolymerProperties(size_t timeStep , const WellPolymerProperties properties); + WellPolymerProperties getPolymerPropertiesCopy(size_t timeStep) const; + const WellPolymerProperties& getPolymerProperties(size_t timeStep) const; + private: size_t m_creationTimeStep; std::string m_name; @@ -98,6 +103,7 @@ namespace Opm { std::shared_ptr > m_completions; std::shared_ptr > m_productionProperties; std::shared_ptr > m_injectionProperties; + std::shared_ptr > m_polymerProperties; std::shared_ptr > m_groupName; // WELSPECS data - assumes this is not dynamic diff --git a/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp b/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp new file mode 100644 index 000000000..8a04c496c --- /dev/null +++ b/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp @@ -0,0 +1,12 @@ +#include + +#include +#include + +namespace Opm { + + WellPolymerProperties::WellPolymerProperties() { + m_polymerConcentration = 0.0; + m_saltConcentration = 0.0; + } +} diff --git a/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp b/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp new file mode 100644 index 000000000..236d96a11 --- /dev/null +++ b/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp @@ -0,0 +1,34 @@ +/* + Copyright 2014 Statoil ASA. + + This file is part of the Open Porous Media project (OPM). + + OPM 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. + + OPM 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 for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ + +#ifndef WELLPOLYMERPROPERTIES_HPP_HEADER_INCLUDED +#define WELLPOLYMERPROPERTIES_HPP_HEADER_INCLUDED + + +namespace Opm { + + struct WellPolymerProperties { + double m_polymerConcentration; + double m_saltConcentration; + + WellPolymerProperties(); + }; +} + +#endif