GroupTree interface changed upstream
Updates to the slightly modified GroupTree interface from opm-parser.
This commit is contained in:
parent
76bdc081c0
commit
48cbbdee19
@ -729,15 +729,6 @@ namespace Opm
|
||||
|
||||
}
|
||||
|
||||
void WellsManager::addChildGroups(const GroupTreeNode& parentNode, const Schedule& schedule, size_t timeStep, const PhaseUsage& phaseUsage) {
|
||||
for (auto childIter = parentNode.begin(); childIter != parentNode.end(); ++childIter) {
|
||||
const auto& childNode = (*childIter).second;
|
||||
well_collection_.addGroup(schedule.getGroup(childNode->name()), parentNode.name(), timeStep, phaseUsage);
|
||||
addChildGroups(*childNode, schedule, timeStep, phaseUsage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WellsManager::setupGuideRates(std::vector< const Well* >& wells, const size_t timeStep, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index,
|
||||
const PhaseUsage& phaseUsage, const std::vector<double>& well_potentials)
|
||||
{
|
||||
|
@ -193,7 +193,6 @@ namespace Opm
|
||||
const std::unordered_set<std::string>& deactivated_wells,
|
||||
const DynamicListEconLimited& list_econ_limited);
|
||||
|
||||
void addChildGroups(const GroupTreeNode& parentNode, const Schedule& schedule, size_t timeStep, const PhaseUsage& phaseUsage);
|
||||
void setupGuideRates(std::vector<const Well*>& wells, const size_t timeStep, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index,
|
||||
const PhaseUsage& phaseUsage, const std::vector<double>& well_potentials);
|
||||
// Data
|
||||
|
@ -404,13 +404,23 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
|
||||
setupWellControls(wells, timeStep, well_names, pu, wells_on_proc, list_econ_limited);
|
||||
|
||||
{
|
||||
const auto& fieldNode =
|
||||
schedule.getGroupTree(timeStep).getNode("FIELD");
|
||||
|
||||
const auto& fieldGroup = schedule.getGroup(fieldNode->name());
|
||||
|
||||
const auto& fieldGroup = schedule.getGroup( "FIELD" );
|
||||
well_collection_.addField(fieldGroup, timeStep, pu);
|
||||
addChildGroups(*fieldNode, schedule, timeStep, pu);
|
||||
|
||||
const auto& grouptree = schedule.getGroupTree( timeStep );
|
||||
std::vector< std::string > group_stack = { "FIELD" };
|
||||
|
||||
do {
|
||||
auto parent = group_stack.back();
|
||||
group_stack.pop_back();
|
||||
const auto& children = grouptree.children( parent );
|
||||
group_stack.insert( group_stack.end(), children.begin(), children.end() );
|
||||
|
||||
for( const auto& child : children ) {
|
||||
well_collection_.addGroup( schedule.getGroup( child ), parent, timeStep, pu );
|
||||
}
|
||||
|
||||
} while( !group_stack.empty() );
|
||||
}
|
||||
|
||||
for (auto w = wells.begin(), e = wells.end(); w != e; ++w) {
|
||||
|
@ -47,33 +47,14 @@ BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) {
|
||||
EclipseState eclipseState(deck, parseContext);
|
||||
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
|
||||
|
||||
const auto& field=eclipseState.getSchedule().getGroupTree(2).getNode("FIELD");
|
||||
const auto& g1=eclipseState.getSchedule().getGroupTree(2).getNode("G1");
|
||||
const auto& g2=eclipseState.getSchedule().getGroupTree(2).getNode("G2");
|
||||
|
||||
WellCollection collection;
|
||||
|
||||
// Add groups to WellCollection
|
||||
const auto& fieldGroup = eclipseState.getSchedule().getGroup(field->name());
|
||||
const auto& fieldGroup = eclipseState.getSchedule().getGroup("FIELD");
|
||||
collection.addField(fieldGroup, 2, pu);
|
||||
|
||||
for (auto iter = field->begin(); iter != field->end(); ++iter) {
|
||||
const auto& childGroupNode = eclipseState.getSchedule().getGroup((*iter).second->name());
|
||||
collection.addGroup(childGroupNode, fieldGroup.name(), 2, pu);
|
||||
}
|
||||
|
||||
const auto& g1Group = eclipseState.getSchedule().getGroup(g1->name());
|
||||
for (auto iter = g1->begin(); iter != g1->end(); ++iter) {
|
||||
const auto& childGroupNode = eclipseState.getSchedule().getGroup((*iter).second->name());
|
||||
collection.addGroup(childGroupNode, g1Group.name(), 2, pu);
|
||||
}
|
||||
|
||||
|
||||
const auto& g2Group = eclipseState.getSchedule().getGroup(g2->name());
|
||||
for (auto iter = g2->begin(); iter != g2->end(); ++iter) {
|
||||
const auto& childGroupNode = eclipseState.getSchedule().getGroup((*iter).second->name());
|
||||
collection.addGroup(childGroupNode, g2Group.name(), 2, pu);
|
||||
}
|
||||
collection.addGroup( eclipseState.getSchedule().getGroup( "G1" ), fieldGroup.name(), 2, pu);
|
||||
collection.addGroup( eclipseState.getSchedule().getGroup( "G2" ), fieldGroup.name(), 2, pu);
|
||||
|
||||
BOOST_CHECK_EQUAL("FIELD", collection.findNode("FIELD")->name());
|
||||
BOOST_CHECK_EQUAL("FIELD", collection.findNode("G1")->getParent()->name());
|
||||
|
@ -88,10 +88,12 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromGroup) {
|
||||
EclipseState eclipseState(deck , parseContext);
|
||||
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
|
||||
|
||||
auto nodes = eclipseState.getSchedule().getGroupTree(2).getNodes();
|
||||
const auto& nodes = eclipseState.getSchedule().getGroupTree(2);
|
||||
|
||||
for( const auto& grp : eclipseState.getSchedule().getGroups() ) {
|
||||
if( !nodes.exists( grp->name() ) ) continue;
|
||||
const auto& group = *grp;
|
||||
|
||||
for (size_t i=0; i<nodes.size(); i++) {
|
||||
const auto& group = eclipseState.getSchedule().getGroup(nodes[i]->name());
|
||||
std::shared_ptr<WellsGroupInterface> wellsGroup = createGroupWellsGroup(group, 2, pu);
|
||||
BOOST_CHECK_EQUAL(group.name(), wellsGroup->name());
|
||||
if (group.isInjectionGroup(2)) {
|
||||
|
Loading…
Reference in New Issue
Block a user