mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-25 02:30:18 -06:00
commit
3e15ec4ba3
@ -30,17 +30,17 @@
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
void WellCollection::addField(const Group2& fieldGroup, const PhaseUsage& phaseUsage) {
|
||||
void WellCollection::addField(const Group2& fieldGroup, const SummaryState& summaryState, const PhaseUsage& phaseUsage) {
|
||||
WellsGroupInterface* fieldNode = findNode(fieldGroup.name());
|
||||
if (fieldNode) {
|
||||
OPM_THROW(std::runtime_error, "Trying to add FIELD node, but this already exists. Can only have one FIELD node.");
|
||||
}
|
||||
|
||||
roots_.push_back(createGroupWellsGroup(fieldGroup, phaseUsage));
|
||||
roots_.push_back(createGroupWellsGroup(fieldGroup, summaryState, phaseUsage));
|
||||
}
|
||||
|
||||
void WellCollection::addGroup(const Group2& groupChild, std::string parent_name,
|
||||
const PhaseUsage& phaseUsage) {
|
||||
const SummaryState& summaryState, const PhaseUsage& phaseUsage) {
|
||||
WellsGroupInterface* parent = findNode(parent_name);
|
||||
if (!parent) {
|
||||
OPM_THROW(std::runtime_error, "Trying to add child group to group named " << parent_name << ", but this does not exist in the WellCollection.");
|
||||
@ -55,8 +55,7 @@ namespace Opm
|
||||
group_control_active_ = true;
|
||||
}
|
||||
|
||||
std::shared_ptr<WellsGroupInterface> child = createGroupWellsGroup(groupChild, phaseUsage);
|
||||
|
||||
std::shared_ptr<WellsGroupInterface> child = createGroupWellsGroup(groupChild, summaryState, phaseUsage);
|
||||
if (child->injSpec().control_mode_ == InjectionSpecification::VREP) {
|
||||
having_vrep_groups_ = true;
|
||||
}
|
||||
|
@ -36,12 +36,12 @@ namespace Opm
|
||||
{
|
||||
public:
|
||||
|
||||
void addField(const Group2& fieldGroup, const PhaseUsage& phaseUsage);
|
||||
void addField(const Group2& fieldGroup, const SummaryState& summaryState, const PhaseUsage& phaseUsage);
|
||||
|
||||
void addWell(const Well2& wellChild, const SummaryState& summaryState, const PhaseUsage& phaseUsage);
|
||||
|
||||
void addGroup(const Group2& groupChild, std::string parent_name,
|
||||
const PhaseUsage& phaseUsage);
|
||||
const SummaryState& summaryState, const PhaseUsage& phaseUsage);
|
||||
|
||||
/// Adds the child to the collection
|
||||
/// and appends it to parent's children.
|
||||
|
@ -1556,12 +1556,12 @@ namespace Opm
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
std::shared_ptr<WellsGroupInterface> createGroupWellsGroup(const Group2& group, const PhaseUsage& phase_usage )
|
||||
std::shared_ptr<WellsGroupInterface> createGroupWellsGroup(const Group2& group, const SummaryState& st, const PhaseUsage& phase_usage )
|
||||
{
|
||||
InjectionSpecification injection_specification;
|
||||
ProductionSpecification production_specification;
|
||||
if (group.isInjectionGroup()) {
|
||||
const auto& injection = group.injectionProperties();
|
||||
const auto& injection = group.injectionControls(st);
|
||||
injection_specification.injector_type_ = toInjectorType(injection.phase);
|
||||
injection_specification.control_mode_ = toInjectionControlMode(GroupInjection::ControlEnum2String(injection.cmode));
|
||||
injection_specification.surface_flow_max_rate_ = injection.surface_max_rate;
|
||||
@ -1571,7 +1571,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
if (group.isProductionGroup()) {
|
||||
const auto& production = group.productionProperties();
|
||||
const auto& production = group.productionControls(st);
|
||||
production_specification.oil_max_rate_ = production.oil_target;
|
||||
production_specification.control_mode_ = toProductionControlMode(GroupProduction::ControlEnum2String(production.cmode));
|
||||
production_specification.water_max_rate_ = production.water_target;
|
||||
|
@ -550,6 +550,7 @@ namespace Opm
|
||||
/// \param[in] timeStep the time step in question
|
||||
/// \param[in] the phase usage
|
||||
std::shared_ptr<WellsGroupInterface> createGroupWellsGroup(const Group2& group,
|
||||
const SummaryState& summaryState,
|
||||
const PhaseUsage& phase_usage );
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
|
||||
|
||||
{
|
||||
const auto& fieldGroup = schedule.getGroup2( "FIELD", timeStep);
|
||||
well_collection_.addField(fieldGroup, pu);
|
||||
well_collection_.addField(fieldGroup, summaryState, pu);
|
||||
std::vector< std::string > group_stack = { "FIELD" };
|
||||
|
||||
do {
|
||||
@ -380,7 +380,7 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
|
||||
group_stack.pop_back();
|
||||
for (const auto& child: parent.groups()) {
|
||||
group_stack.push_back(child);
|
||||
well_collection_.addGroup( schedule.getGroup2( child, timeStep ), parent.name(), pu );
|
||||
well_collection_.addGroup( schedule.getGroup2( child, timeStep ), parent.name(), summaryState, pu );
|
||||
}
|
||||
|
||||
} while( !group_stack.empty() );
|
||||
|
@ -50,10 +50,10 @@ BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) {
|
||||
|
||||
// Add groups to WellCollection
|
||||
const auto& fieldGroup = sched.getGroup2("FIELD", 2);
|
||||
collection.addField(fieldGroup, pu);
|
||||
collection.addField(fieldGroup, summaryState, pu);
|
||||
|
||||
collection.addGroup( sched.getGroup2( "G1", 2 ), fieldGroup.name(), pu);
|
||||
collection.addGroup( sched.getGroup2( "G2", 2 ), fieldGroup.name(), pu);
|
||||
collection.addGroup( sched.getGroup2( "G1", 2 ), fieldGroup.name(), summaryState, pu);
|
||||
collection.addGroup( sched.getGroup2( "G2", 2 ), fieldGroup.name(), summaryState, pu);
|
||||
|
||||
BOOST_CHECK_EQUAL("FIELD", collection.findNode("FIELD")->name());
|
||||
BOOST_CHECK_EQUAL("FIELD", collection.findNode("G1")->getParent()->name());
|
||||
@ -89,9 +89,9 @@ BOOST_AUTO_TEST_CASE(EfficiencyFactor) {
|
||||
WellCollection collection;
|
||||
// Add groups to WellCollection
|
||||
const auto& fieldGroup = sched.getGroup2("FIELD", timestep);
|
||||
collection.addField(fieldGroup, pu);
|
||||
collection.addGroup( sched.getGroup2( "G1", timestep ), fieldGroup.name(), pu);
|
||||
collection.addGroup( sched.getGroup2( "G2", timestep ), fieldGroup.name(), pu);
|
||||
collection.addField( fieldGroup, summaryState, pu);
|
||||
collection.addGroup( sched.getGroup2( "G1", timestep ), fieldGroup.name(), summaryState, pu);
|
||||
collection.addGroup( sched.getGroup2( "G2", timestep ), fieldGroup.name(), summaryState, pu);
|
||||
|
||||
BOOST_CHECK_EQUAL(1.0, collection.findNode("FIELD")->efficiencyFactor());
|
||||
BOOST_CHECK_EQUAL(1.0, collection.findNode("G1")->getParent()->efficiencyFactor());
|
||||
|
@ -89,14 +89,15 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromGroup) {
|
||||
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
||||
const Opm::Runspec runspec (deck);
|
||||
const Schedule sched(deck, grid, eclipseProperties, runspec);
|
||||
SummaryState summaryState;
|
||||
|
||||
for( const auto& grp_name : sched.groupNames() ) {
|
||||
const auto& group = sched.getGroup2(grp_name, 2);
|
||||
|
||||
std::shared_ptr<WellsGroupInterface> wellsGroup = createGroupWellsGroup(group, pu);
|
||||
std::shared_ptr<WellsGroupInterface> wellsGroup = createGroupWellsGroup(group, summaryState, pu);
|
||||
BOOST_CHECK_EQUAL(group.name(), wellsGroup->name());
|
||||
if (group.isInjectionGroup()) {
|
||||
const auto& injection = group.injectionProperties();
|
||||
const auto& injection = group.injectionControls(summaryState);
|
||||
|
||||
BOOST_CHECK_EQUAL(injection.surface_max_rate, wellsGroup->injSpec().surface_flow_max_rate_);
|
||||
BOOST_CHECK_EQUAL(injection.resv_max_rate, wellsGroup->injSpec().reservoir_flow_max_rate_);
|
||||
@ -105,7 +106,7 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromGroup) {
|
||||
}
|
||||
|
||||
if (group.isProductionGroup()) {
|
||||
const auto& production = group.productionProperties();
|
||||
const auto& production = group.productionControls(summaryState);
|
||||
BOOST_CHECK_EQUAL(production.resv_target, wellsGroup->prodSpec().reservoir_flow_max_rate_);
|
||||
BOOST_CHECK_EQUAL(production.gas_target, wellsGroup->prodSpec().gas_max_rate_);
|
||||
BOOST_CHECK_EQUAL(production.oil_target, wellsGroup->prodSpec().oil_max_rate_);
|
||||
@ -126,12 +127,12 @@ BOOST_AUTO_TEST_CASE(EfficiencyFactor) {
|
||||
const Eclipse3DProperties eclipseProperties ( deck , table, grid);
|
||||
const Opm::Runspec runspec (deck);
|
||||
const Schedule sched(deck, grid, eclipseProperties, runspec);
|
||||
|
||||
SummaryState summaryState;
|
||||
|
||||
for( const auto& grp_name : sched.groupNames() ) {
|
||||
const auto& group = sched.getGroup2(grp_name, 2);
|
||||
|
||||
std::shared_ptr<WellsGroupInterface> wellsGroup = createGroupWellsGroup(group, pu);
|
||||
std::shared_ptr<WellsGroupInterface> wellsGroup = createGroupWellsGroup(group, summaryState, pu);
|
||||
BOOST_CHECK_EQUAL(group.name(), wellsGroup->name());
|
||||
BOOST_CHECK_EQUAL(group.getGroupEfficiencyFactor(), wellsGroup->efficiencyFactor());
|
||||
BOOST_CHECK_EQUAL(group.getGroupEfficiencyFactor(), wellsGroup->efficiencyFactor());
|
||||
|
Loading…
Reference in New Issue
Block a user