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
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) {
if (leaf_nodes_[i]->shouldUpdateWellTargets() && !leaf_nodes_[i]->individualControl()) {
return true;
std::cout << " well " << leaf_nodes_[i]->name() << " under group control ? " << !leaf_nodes_[i]->individualControl() << " should update well target? " << leaf_nodes_[i]->shouldUpdateWellTargets() << std::endl;
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];
}
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>
void updateWellTargets(const WellState& well_state);
bool justUpdateWellTargets() const;
void setJustUpdateWellTargets(const bool flag);
private:
// To account for the possibility of a forest
std::vector<std::shared_ptr<WellsGroupInterface> > roots_;
@ -131,6 +135,8 @@ namespace Opm
// This will be used to traverse the bottom nodes.
std::vector<WellNode*> leaf_nodes_;
bool just_update_well_targets_;
};

View File

@ -308,6 +308,9 @@ namespace Opm
const double target,
const bool forced)
{
if (prodSpec().control_mode_ == ProductionSpecification::NONE) {
return;
}
if (forced || (prodSpec().control_mode_ == ProductionSpecification::FLD
|| prodSpec().control_mode_ == ProductionSpecification::NONE)) {
const double my_guide_rate = productionGuideRate(false);
@ -483,7 +486,7 @@ namespace Opm
// Apply for all children.
// 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.
const double children_guide_rate = children_[i]->productionGuideRate(true);
const double children_guide_rate = children_[i]->productionGuideRate(false);
children_[i]->applyProdGroupControl(prod_mode,
(children_guide_rate / my_guide_rate) * getTarget(prod_mode),
false);
@ -930,13 +933,13 @@ namespace Opm
const bool forced)
{
// 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)) {
std::cout << "Returning" << std::endl;
return;
}
} */
if (wells_->type[self_index_] != PRODUCER) {
assert(target == 0.0);
// assert(target == 0.0);
return;
}
// 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);
}
std::cout << " well name " << name() << " group_control_index_ " << group_control_index_ << " ntarget " << ntarget
<< std::endl;
if (group_control_index_ < 0) {
// The well only had its own controls, no group controls.
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);
addChildGroups(*fieldNode, schedule, timeStep, pu);
well_collection_.setJustUpdateWellTargets(false);
}
for (auto w = wells.begin(), e = wells.end(); w != e; ++w) {