convert from UDA to double for GCONSALE and GCONSUMP
This commit is contained in:
@@ -23,6 +23,10 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/UDAValue.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class GConSale {
|
||||
@@ -37,14 +41,24 @@ namespace Opm {
|
||||
UDAValue max_sales_rate;
|
||||
UDAValue min_sales_rate;
|
||||
MaxProcedure max_proc;
|
||||
double udq_undefined;
|
||||
UnitSystem unit_system;
|
||||
};
|
||||
|
||||
struct GCONSALEGroupProp {
|
||||
double sales_target;
|
||||
double max_sales_rate;
|
||||
double min_sales_rate;
|
||||
MaxProcedure max_proc;
|
||||
};
|
||||
|
||||
GConSale() = default;
|
||||
|
||||
bool has(const std::string& name) const;
|
||||
const GCONSALEGroup& get(const std::string& name) const;
|
||||
const GCONSALEGroupProp get(const std::string& name, const SummaryState& st) const;
|
||||
static MaxProcedure stringToProcedure(const std::string& procedure);
|
||||
void add(const std::string& name, const UDAValue& sales_target, const UDAValue& max_rate, const UDAValue& min_rate, const std::string& procedure);
|
||||
void add(const std::string& name, const UDAValue& sales_target, const UDAValue& max_rate, const UDAValue& min_rate, const std::string& procedure, double udq_undefined_arg, const UnitSystem& unit_system);
|
||||
size_t size() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <string>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/UDAValue.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -35,11 +37,20 @@ namespace Opm {
|
||||
UDAValue consumption_rate;
|
||||
UDAValue import_rate;
|
||||
std::string network_node;
|
||||
double udq_undefined;
|
||||
UnitSystem unit_system;
|
||||
};
|
||||
|
||||
struct GCONSUMPGroupProp {
|
||||
double consumption_rate;
|
||||
double 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);
|
||||
const GCONSUMPGroupProp get(const std::string& name, const SummaryState& st) const;
|
||||
void add(const std::string& name, const UDAValue& consumption_rate, const UDAValue& import_rate, const std::string network_node, double udq_undefined_arg, const UnitSystem& unit_system);
|
||||
size_t size() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -287,8 +287,8 @@ namespace Opm
|
||||
void handleGCONINJE( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
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 handleGCONSALE( const DeckKeyword& keyword, size_t currentStep, const UnitSystem& unit_system);
|
||||
void handleGCONSUMP( const DeckKeyword& keyword, size_t currentStep, const UnitSystem& unit_system);
|
||||
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);
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <opm/parser/eclipse/Deck/UDAValue.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GConSale.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include "../eval_uda.hpp"
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -36,6 +38,17 @@ const GConSale::GCONSALEGroup& GConSale::get(const std::string& name) const {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
const GConSale::GCONSALEGroupProp GConSale::get(const std::string& name, const SummaryState& st) const {
|
||||
|
||||
GCONSALEGroupProp prop;
|
||||
const GConSale::GCONSALEGroup& group = this->get(name);
|
||||
prop.sales_target = UDA::eval_group_uda_rate(group.sales_target, name, st, group.udq_undefined, Phase::GAS, group.unit_system);
|
||||
prop.max_sales_rate = UDA::eval_group_uda_rate(group.max_sales_rate, name, st, group.udq_undefined, Phase::GAS, group.unit_system);
|
||||
prop.min_sales_rate = UDA::eval_group_uda_rate(group.min_sales_rate, name, st, group.udq_undefined, Phase::GAS, group.unit_system);
|
||||
prop.max_proc = group.max_proc;
|
||||
return prop;
|
||||
}
|
||||
|
||||
GConSale::MaxProcedure GConSale::stringToProcedure(const std::string& str_proc) {
|
||||
|
||||
if (str_proc == "NONE") return MaxProcedure::NONE;
|
||||
@@ -52,12 +65,14 @@ GConSale::MaxProcedure GConSale::stringToProcedure(const std::string& str_proc)
|
||||
return MaxProcedure::NONE;
|
||||
}
|
||||
|
||||
void GConSale::add(const std::string& name, const UDAValue& sales_target, const UDAValue& max_rate, const UDAValue& min_rate, const std::string& procedure) {
|
||||
void GConSale::add(const std::string& name, const UDAValue& sales_target, const UDAValue& max_rate, const UDAValue& min_rate, const std::string& procedure, double udq_undefined_arg, const UnitSystem& unit_system) {
|
||||
GConSale::GCONSALEGroup& group = groups[name];
|
||||
group.sales_target = sales_target;
|
||||
group.max_sales_rate = max_rate;
|
||||
group.min_sales_rate = min_rate;
|
||||
group.max_proc = stringToProcedure(procedure);
|
||||
group.udq_undefined = udq_undefined_arg;
|
||||
group.unit_system = unit_system;
|
||||
}
|
||||
|
||||
size_t GConSale::size() const {
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GConSump.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include "../eval_uda.hpp"
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -36,13 +38,25 @@ const GConSump::GCONSUMPGroup& GConSump::get(const std::string& name) const {
|
||||
}
|
||||
|
||||
|
||||
void GConSump::add(const std::string& name, const UDAValue& consumption_rate, const UDAValue& import_rate, const std::string network_node) {
|
||||
const GConSump::GCONSUMPGroupProp GConSump::get(const std::string& name, const SummaryState& st) const {
|
||||
|
||||
GCONSUMPGroupProp prop;
|
||||
const GConSump::GCONSUMPGroup& group = this->get(name);
|
||||
prop.consumption_rate = UDA::eval_group_uda_rate(group.consumption_rate, name, st, group.udq_undefined, Phase::GAS, group.unit_system);
|
||||
prop.import_rate = UDA::eval_group_uda_rate(group.import_rate, name, st, group.udq_undefined, Phase::GAS, group.unit_system);
|
||||
prop.network_node = group.network_node;
|
||||
return prop;
|
||||
}
|
||||
|
||||
void GConSump::add(const std::string& name, const UDAValue& consumption_rate, const UDAValue& import_rate, const std::string network_node, double udq_undefined_arg, const UnitSystem& unit_system) {
|
||||
|
||||
GConSump::GCONSUMPGroup& group = groups[name];
|
||||
|
||||
group.consumption_rate = consumption_rate;
|
||||
group.import_rate = import_rate;
|
||||
group.network_node = network_node;
|
||||
group.udq_undefined = udq_undefined_arg;
|
||||
group.unit_system = unit_system;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -341,10 +341,10 @@ namespace {
|
||||
handleGEFAC(keyword, currentStep, parseContext, errors);
|
||||
|
||||
else if (keyword.name() == "GCONSALE")
|
||||
handleGCONSALE(keyword, currentStep);
|
||||
handleGCONSALE(keyword, currentStep, unit_system);
|
||||
|
||||
else if (keyword.name() == "GCONSUMP")
|
||||
handleGCONSUMP(keyword, currentStep);
|
||||
handleGCONSUMP(keyword, currentStep, unit_system);
|
||||
|
||||
else if (keyword.name() == "GUIDERAT")
|
||||
handleGUIDERAT(keyword, currentStep);
|
||||
@@ -1617,7 +1617,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
void Schedule::handleGCONSALE( const DeckKeyword& keyword, size_t currentStep) {
|
||||
void Schedule::handleGCONSALE( const DeckKeyword& keyword, size_t currentStep, const UnitSystem& unit_system) {
|
||||
const auto& current = *this->gconsale.get(currentStep);
|
||||
std::shared_ptr<GConSale> new_gconsale(new GConSale(current));
|
||||
for( const auto& record : keyword ) {
|
||||
@@ -1626,8 +1626,9 @@ namespace {
|
||||
auto max_rate = record.getItem("MAX_SALES_RATE").get<UDAValue>(0);
|
||||
auto min_rate = record.getItem("MIN_SALES_RATE").get<UDAValue>(0);
|
||||
std::string procedure = record.getItem("MAX_PROC").getTrimmedString(0);
|
||||
auto udqconfig = this->getUDQConfig(currentStep).params().undefinedValue();
|
||||
|
||||
new_gconsale->add(groupName, sales_target, max_rate, min_rate, procedure);
|
||||
new_gconsale->add(groupName, sales_target, max_rate, min_rate, procedure, udqconfig, unit_system);
|
||||
|
||||
auto group_ptr = std::make_shared<Group>(this->getGroup(groupName, currentStep));
|
||||
Group::GroupInjectionProperties injection;
|
||||
@@ -1640,7 +1641,7 @@ namespace {
|
||||
}
|
||||
|
||||
|
||||
void Schedule::handleGCONSUMP( const DeckKeyword& keyword, size_t currentStep) {
|
||||
void Schedule::handleGCONSUMP( const DeckKeyword& keyword, size_t currentStep, const UnitSystem& unit_system) {
|
||||
const auto& current = *this->gconsump.get(currentStep);
|
||||
std::shared_ptr<GConSump> new_gconsump(new GConSump(current));
|
||||
for( const auto& record : keyword ) {
|
||||
@@ -1653,7 +1654,9 @@ namespace {
|
||||
if (!network_node.defaultApplied(0))
|
||||
network_node_name = network_node.getTrimmedString(0);
|
||||
|
||||
new_gconsump->add(groupName, consumption_rate, import_rate, network_node_name);
|
||||
auto udqconfig = this->getUDQConfig(currentStep).params().undefinedValue();
|
||||
|
||||
new_gconsump->add(groupName, consumption_rate, import_rate, network_node_name, udqconfig, unit_system);
|
||||
}
|
||||
this->gconsump.update(currentStep, new_gconsump);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user