putting more things in the prototyping test.

This commit is contained in:
Kai Bao 2016-10-06 18:00:08 +02:00
parent 999b80a91a
commit a9335266c6
4 changed files with 35 additions and 7 deletions

View File

@ -194,12 +194,19 @@ namespace Opm
//TODO: later, it should be extended to update group targets //TODO: later, it should be extended to update group targets
bool WellCollection::needUpdateWellTargets() const bool WellCollection::needUpdateWellTargets() const
{ {
bool any_group_control_node = false;
bool any_should_update_node = false;
for (size_t i = 0; i < leaf_nodes_.size(); ++i) { for (size_t i = 0; i < leaf_nodes_.size(); ++i) {
if (leaf_nodes_[i]->shouldUpdateWellTargets() && !leaf_nodes_[i]->individualControl()) { std::cout << " well " << leaf_nodes_[i]->name() << " under group control ? " << !leaf_nodes_[i]->individualControl() << " should update well target? " << leaf_nodes_[i]->shouldUpdateWellTargets() << std::endl;
return true; if (leaf_nodes_[i]->shouldUpdateWellTargets()) {
any_should_update_node = true;
}
if (!leaf_nodes_[i]->individualControl()) {
any_group_control_node = true;
} }
} }
return false; std::cout << " any_group_control_node " << any_group_control_node << " any_should_update_node " << any_should_update_node << std::endl;
return (any_group_control_node && any_should_update_node);
} }
@ -215,4 +222,12 @@ namespace Opm
return leaf_nodes_[i]; return leaf_nodes_[i];
} }
bool WellCollection::justUpdateWellTargets() const {
return just_update_well_targets_;
}
void WellCollection::setJustUpdateWellTargets(const bool flag) {
just_update_well_targets_ = flag;
}
} }

View File

@ -124,6 +124,10 @@ namespace Opm
template <class WellState> template <class WellState>
void updateWellTargets(const WellState& well_state); void updateWellTargets(const WellState& well_state);
bool justUpdateWellTargets() const;
void setJustUpdateWellTargets(const bool flag);
private: private:
// To account for the possibility of a forest // To account for the possibility of a forest
std::vector<std::shared_ptr<WellsGroupInterface> > roots_; std::vector<std::shared_ptr<WellsGroupInterface> > roots_;
@ -131,6 +135,8 @@ namespace Opm
// This will be used to traverse the bottom nodes. // This will be used to traverse the bottom nodes.
std::vector<WellNode*> leaf_nodes_; std::vector<WellNode*> leaf_nodes_;
bool just_update_well_targets_;
}; };

View File

@ -308,6 +308,9 @@ namespace Opm
const double target, const double target,
const bool forced) const bool forced)
{ {
if (prodSpec().control_mode_ == ProductionSpecification::NONE) {
return;
}
if (forced || (prodSpec().control_mode_ == ProductionSpecification::FLD if (forced || (prodSpec().control_mode_ == ProductionSpecification::FLD
|| prodSpec().control_mode_ == ProductionSpecification::NONE)) { || prodSpec().control_mode_ == ProductionSpecification::NONE)) {
const double my_guide_rate = productionGuideRate(false); const double my_guide_rate = productionGuideRate(false);
@ -483,7 +486,7 @@ namespace Opm
// Apply for all children. // Apply for all children.
// Note, we do _not_ want to call the applyProdGroupControl in this object, // Note, we do _not_ want to call the applyProdGroupControl in this object,
// as that would check if we're under group control, something we're not. // as that would check if we're under group control, something we're not.
const double children_guide_rate = children_[i]->productionGuideRate(true); const double children_guide_rate = children_[i]->productionGuideRate(false);
children_[i]->applyProdGroupControl(prod_mode, children_[i]->applyProdGroupControl(prod_mode,
(children_guide_rate / my_guide_rate) * getTarget(prod_mode), (children_guide_rate / my_guide_rate) * getTarget(prod_mode),
false); false);
@ -930,13 +933,13 @@ namespace Opm
const bool forced) const bool forced)
{ {
// Not changing if we're not forced to change // Not changing if we're not forced to change
if (!forced && (prodSpec().control_mode_ != ProductionSpecification::GRUP /* if (!forced && (prodSpec().control_mode_ != ProductionSpecification::GRUP
&& prodSpec().control_mode_ != ProductionSpecification::NONE)) { && prodSpec().control_mode_ != ProductionSpecification::NONE)) {
std::cout << "Returning" << std::endl; std::cout << "Returning" << std::endl;
return; return;
} } */
if (wells_->type[self_index_] != PRODUCER) { if (wells_->type[self_index_] != PRODUCER) {
assert(target == 0.0); // assert(target == 0.0);
return; return;
} }
// We're a producer, so we need to negate the input // We're a producer, so we need to negate the input
@ -988,6 +991,9 @@ namespace Opm
OPM_THROW(std::runtime_error, "Group production control mode not handled: " << control_mode); OPM_THROW(std::runtime_error, "Group production control mode not handled: " << control_mode);
} }
std::cout << " well name " << name() << " group_control_index_ " << group_control_index_ << " ntarget " << ntarget
<< std::endl;
if (group_control_index_ < 0) { if (group_control_index_ < 0) {
// The well only had its own controls, no group controls. // The well only had its own controls, no group controls.
append_well_controls(wct, ntarget, invalid_alq, invalid_vfp, distr, self_index_, wells_); append_well_controls(wct, ntarget, invalid_alq, invalid_vfp, distr, self_index_, wells_);

View File

@ -411,6 +411,7 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
well_collection_.addField(fieldGroup, timeStep, pu); well_collection_.addField(fieldGroup, timeStep, pu);
addChildGroups(*fieldNode, schedule, timeStep, pu); addChildGroups(*fieldNode, schedule, timeStep, pu);
well_collection_.setJustUpdateWellTargets(false);
} }
for (auto w = wells.begin(), e = wells.end(); w != e; ++w) { for (auto w = wells.begin(), e = wells.end(); w != e; ++w) {