Schedule handles keyword GCONSUMP.

GConSump: added and linked soruce files.

gconsump added to dynamicstate.

added handleGCONSUMP.

GConSump: add.

GConSump: has.

GConSump: get.

GConSump: added UDA values.

GConSump: added network_node.
This commit is contained in:
Steinar Foss
2019-11-06 11:33:32 +01:00
parent 3bf3c34899
commit f75c3921e5
6 changed files with 160 additions and 1 deletions

View File

@@ -100,6 +100,7 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GConSale.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GConSump.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GTNode.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MessageLimits.cpp
@@ -623,6 +624,7 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GuideRate.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GConSale.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GConSump.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp
opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp

View File

@@ -0,0 +1,51 @@
/*
Copyright 2019 Equinor 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 <http://www.gnu.org/licenses/>.
*/
#ifndef GCONSUMP_H
#define GCONSUMP_H
#include <map>
#include <string>
#include <opm/parser/eclipse/Deck/UDAValue.hpp>
namespace Opm {
class GConSump {
public:
GConSump();
struct GCONSUMPGroup {
UDAValue consumption_rate;
UDAValue import_rate;
std::string network_node;
};
bool has(const std::string& name) const;
const GCONSUMPGroup& get(const std::string& name) const;
void add(const std::string& name, const UDAValue& consumption_rate, const UDAValue& import_rate, const std::string network_node);
size_t size() const;
private:
std::map<std::string, GCONSUMPGroup> groups;
};
}
#endif

View File

@@ -32,6 +32,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GConSale.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GConSump.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
#include <opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp>
@@ -182,6 +183,7 @@ namespace Opm
const UDQActive& udqActive(size_t timeStep) const;
const WellTestConfig& wtestConfig(size_t timestep) const;
const GConSale& gConSale(size_t timestep) const;
const GConSump& gConSump(size_t timestep) const;
const WListManager& getWListManager(size_t timeStep) const;
const UDQConfig& getUDQConfig(size_t timeStep) const;
const Action::Actions& actions(std::size_t timeStep) const;
@@ -237,6 +239,7 @@ namespace Opm
DynamicState<std::shared_ptr<UDQActive>> udq_active;
DynamicState<std::shared_ptr<GuideRateConfig>> guide_rate_config;
DynamicState<std::shared_ptr<GConSale>> gconsale;
DynamicState<std::shared_ptr<GConSump>> gconsump;
DynamicState<Well2::ProducerCMode> global_whistctl_mode;
DynamicState<std::shared_ptr<Action::Actions>> m_actions;
RFTConfig rft_config;
@@ -285,6 +288,7 @@ namespace Opm
void handleGCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleGEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleGCONSALE( const DeckKeyword& keyword, size_t currentStep);
void handleGCONSUMP( const DeckKeyword& keyword, size_t currentStep);
void handleGUIDERAT( const DeckKeyword& keyword, size_t currentStep);
void handleLINCOM( const DeckKeyword& keyword, size_t currentStep);
void handleWEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);

View File

@@ -0,0 +1,56 @@
/*
Copyright 2019 Equinor 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 <http://www.gnu.org/licenses/>.
*/
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GConSump.hpp>
namespace Opm {
GConSump::GConSump() {
}
bool GConSump::has(const std::string& name) const {
return (groups.find(name) != groups.end());
}
const GConSump::GCONSUMPGroup& GConSump::get(const std::string& name) const {
auto it = groups.find(name);
if (it == groups.end())
throw std::invalid_argument("Current GConSump obj. does not contain '" + name + "'.");
else
return it->second;
}
void GConSump::add(const std::string& name, const UDAValue& consumption_rate, const UDAValue& import_rate, const std::string network_node) {
groups[name] = GCONSUMPGroup();
GConSump::GCONSUMPGroup& group = groups[name];
group.consumption_rate = consumption_rate;
group.import_rate = import_rate;
group.network_node = network_node;
}
size_t GConSump::size() const {
return groups.size();
}
}

View File

@@ -124,6 +124,7 @@ namespace {
udq_active(this->m_timeMap, std::make_shared<UDQActive>()),
guide_rate_config(this->m_timeMap, std::make_shared<GuideRateConfig>()),
gconsale(this->m_timeMap, std::make_shared<GConSale>() ),
gconsump(this->m_timeMap, std::make_shared<GConSump>() ),
global_whistctl_mode(this->m_timeMap, Well2::ProducerCMode::CMODE_UNDEFINED),
m_actions(this->m_timeMap, std::make_shared<Action::Actions>()),
rft_config(this->m_timeMap),
@@ -341,6 +342,9 @@ namespace {
else if (keyword.name() == "GCONSALE")
handleGCONSALE(keyword, currentStep);
else if (keyword.name() == "GCONSUMP")
handleGCONSUMP(keyword, currentStep);
else if (keyword.name() == "GUIDERAT")
handleGUIDERAT(keyword, currentStep);
@@ -1615,7 +1619,6 @@ namespace {
auto sales_target = record.getItem("SALES_TARGET").get<UDAValue>(0);
auto max_rate = record.getItem("MAX_SALES_RATE").get<UDAValue>(0);
auto min_rate = record.getItem("MIN_SALES_RATE").get<UDAValue>(0);
std::cout << "SALES TARGET = " << sales_target.get<double>() << std::endl;
std::string procedure = record.getItem("MAX_PROC").getTrimmedString(0);
new_gconsale->add(groupName, sales_target, max_rate, min_rate, procedure);
@@ -1625,6 +1628,25 @@ namespace {
}
void Schedule::handleGCONSUMP( const DeckKeyword& keyword, size_t currentStep) {
const auto& current = *this->gconsump.get(currentStep);
std::shared_ptr<GConSump> new_gconsump(new GConSump(current));
for( const auto& record : keyword ) {
const std::string& groupName = record.getItem("GROUP").getTrimmedString(0);
auto consumption_rate = record.getItem("GAS_CONSUMP_RATE").get<UDAValue>(0);
auto import_rate = record.getItem("GAS_IMPORT_RATE").get<UDAValue>(0);
std::string network_node_name;
auto network_node = record.getItem("NETWORK_NODE");
if (!network_node.defaultApplied(0))
network_node_name = network_node.getTrimmedString(0);
new_gconsump->add(groupName, consumption_rate, import_rate, network_node_name);
}
this->gconsump.update(currentStep, new_gconsump);
}
void Schedule::handleGUIDERAT( const DeckKeyword& keyword, size_t currentStep) {
const auto& record = keyword.getRecord(0);
@@ -2603,6 +2625,11 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c
return *ptr;
}
const GConSump& Schedule::gConSump(size_t timeStep) const {
const auto& ptr = this->gconsump.get(timeStep);
return *ptr;
}
const WListManager& Schedule::getWListManager(size_t timeStep) const {
const auto& ptr = this->wlist_manager.get(timeStep);
return *ptr;

View File

@@ -394,6 +394,12 @@ BOOST_AUTO_TEST_CASE(TESTGCONSALE) {
GCONSALE
'G1' 50000 55000 45000 WELL /
/
GCONSUMP
'G1' 20 50 'a_node' /
'G2' 30 60 /
/
)";
auto deck = parser.parseString(input);
@@ -415,5 +421,18 @@ BOOST_AUTO_TEST_CASE(TESTGCONSALE) {
BOOST_CHECK_EQUAL(group.min_sales_rate.get<double>(), 45000 * metric_to_si);
BOOST_CHECK(group.max_proc == GConSale::MaxProcedure::WELL);
const auto& gconsump = schedule.gConSump(0);
BOOST_CHECK_EQUAL(gconsump.size(), 2);
BOOST_CHECK(gconsump.has("G1"));
BOOST_CHECK(gconsump.has("G2"));
const GConSump::GCONSUMPGroup group1 = gconsump.get("G1");
BOOST_CHECK_EQUAL(group1.consumption_rate.get<double>(), 20 * metric_to_si);
BOOST_CHECK_EQUAL(group1.import_rate.get<double>(), 50 * metric_to_si);
BOOST_CHECK( group1.network_node == "a_node" );
const GConSump::GCONSUMPGroup group2 = gconsump.get("G2");
BOOST_CHECK_EQUAL( group2.network_node.size(), 0 );
}