Extract update of guide rate model into separate function

This commit is contained in:
Joakim Hove
2020-10-13 09:52:33 +02:00
parent 94c697ccd0
commit ead5a19209
4 changed files with 11 additions and 5 deletions
@@ -67,10 +67,10 @@ public:
double getA() const;
double getB() const;
double getC() const;
double getD() const;
double getD() const;
double getE() const;
double getF() const;
static Target convert_target(Group::GuideRateTarget group_target);
static Target convert_target(Well::GuideRateTarget well_target);
static double pot(Target target, double oil_pot, double gas_pot, double wat_pot);
@@ -387,6 +387,7 @@ namespace Opm
DynamicState<std::shared_ptr<RPTConfig>> rpt_config;
void updateNetwork(std::shared_ptr<Network::ExtNetwork> network, std::size_t report_step);
void updateGuideRateModel(const GuideRateModel& new_model, std::size_t report_step);
GTNode groupTree(const std::string& root_node, std::size_t report_step, std::size_t level, const std::optional<std::string>& parent_name) const;
void updateGroup(std::shared_ptr<Group> group, std::size_t reportStep);
@@ -590,9 +590,7 @@ namespace {
const bool use_free_gas = DeckItem::to_bool( record.getItem<ParserKeywords::GUIDERAT::USE_FREE_GAS>().getTrimmedString(0));
const auto new_model = GuideRateModel(min_calc_delay, phase, A, B, C, D, E, F, allow_increase, damping_factor, use_free_gas);
auto new_config = std::make_shared<GuideRateConfig>(this->guideRateConfig(handlerContext.currentStep));
if (new_config->update_model(new_model))
this->guide_rate_config.update( handlerContext.currentStep, new_config );
this->updateGuideRateModel(new_model, handlerContext.currentStep);
}
void Schedule::handleLIFTOPT(const HandlerContext& handlerContext, const ParseContext&, ErrorGuard&) {
@@ -1029,6 +1029,13 @@ private:
dynamic_state.update(reportStep, std::move(group));
}
void Schedule::updateGuideRateModel(const GuideRateModel& new_model, std::size_t report_step) {
auto new_config = std::make_shared<GuideRateConfig>(this->guideRateConfig(report_step));
if (new_config->update_model(new_model))
this->guide_rate_config.update( report_step, new_config );
}
/*
There are many SCHEDULE keyword which take a wellname as argument. In
addition to giving a fully qualified name like 'W1' you can also specify