Silence warnings and fix whitespace.

This commit is contained in:
Atgeirr Flø Rasmussen 2020-04-08 10:41:20 +02:00
parent 97876530e3
commit e7e4cf6f20
6 changed files with 36 additions and 52 deletions

View File

@ -427,14 +427,14 @@ namespace Opm {
void updateGroupIndividualControl(const Group& group, Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups); void updateGroupIndividualControl(const Group& group, Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups);
bool checkGroupConstraints(const Group& group, Opm::DeferredLogger& deferred_logger) const; bool checkGroupConstraints(const Group& group, Opm::DeferredLogger& deferred_logger) const;
Group::ProductionCMode checkGroupProductionConstraints(const Group& group, Opm::DeferredLogger& deferred_logger) const; Group::ProductionCMode checkGroupProductionConstraints(const Group& group, Opm::DeferredLogger& deferred_logger) const;
Group::InjectionCMode checkGroupInjectionConstraints(const Group& group, const Phase& phase, Opm::DeferredLogger& deferred_logger) const; Group::InjectionCMode checkGroupInjectionConstraints(const Group& group, const Phase& phase) const;
void updateGroupHigherControls(Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups); void updateGroupHigherControls(Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups);
void checkGroupHigherConstraints(const Group& group, Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups); void checkGroupHigherConstraints(const Group& group, Opm::DeferredLogger& deferred_logger, std::set<std::string>& switched_groups);
void actionOnBrokenConstraints(const Group& group, const Group::ExceedAction& exceed_action, const Group::ProductionCMode& newControl, const int reportStepIdx, Opm::DeferredLogger& deferred_logger); void actionOnBrokenConstraints(const Group& group, const Group::ExceedAction& exceed_action, const Group::ProductionCMode& newControl, Opm::DeferredLogger& deferred_logger);
void actionOnBrokenConstraints(const Group& group, const Group::InjectionCMode& newControl, const Phase& topUpPhase, const int reportStepIdx, Opm::DeferredLogger& deferred_logger); void actionOnBrokenConstraints(const Group& group, const Group::InjectionCMode& newControl, const Phase& topUpPhase, Opm::DeferredLogger& deferred_logger);
WellInterfacePtr getWell(const std::string& well_name) const; WellInterfacePtr getWell(const std::string& well_name) const;

View File

@ -1308,7 +1308,6 @@ namespace Opm {
summaryConfig.hasSummaryKey( "WOPP:" + well->name()) || summaryConfig.hasSummaryKey( "WOPP:" + well->name()) ||
summaryConfig.hasSummaryKey( "WGPP:" + well->name())) && well->isProducer()); summaryConfig.hasSummaryKey( "WGPP:" + well->name())) && well->isProducer());
const Well& eclWell = well->wellEcl();
bool needPotentialsForGuideRate = true;//eclWell.getGuideRatePhase() == Well::GuideRateTarget::UNDEFINED; bool needPotentialsForGuideRate = true;//eclWell.getGuideRatePhase() == Well::GuideRateTarget::UNDEFINED;
if (write_restart_file || needed_for_summary || needPotentialsForGuideRate) if (write_restart_file || needed_for_summary || needPotentialsForGuideRate)
{ {
@ -1761,25 +1760,23 @@ namespace Opm {
if (!group.hasInjectionControl(phase)) { if (!group.hasInjectionControl(phase)) {
continue; continue;
} }
Group::InjectionCMode newControl = checkGroupInjectionConstraints(group, phase, deferred_logger); Group::InjectionCMode newControl = checkGroupInjectionConstraints(group, phase);
if (newControl != Group::InjectionCMode::NONE) if (newControl != Group::InjectionCMode::NONE)
{ {
switched_groups.insert(group.name()); switched_groups.insert(group.name());
actionOnBrokenConstraints(group, newControl, phase, reportStepIdx, deferred_logger); actionOnBrokenConstraints(group, newControl, phase, deferred_logger);
} }
} }
} else if (!skip && group.isProductionGroup()) }
{ if (!skip && group.isProductionGroup()) {
Group::ProductionCMode newControl = checkGroupProductionConstraints(group, deferred_logger); Group::ProductionCMode newControl = checkGroupProductionConstraints(group, deferred_logger);
const auto& summaryState = ebosSimulator_.vanguard().summaryState(); const auto& summaryState = ebosSimulator_.vanguard().summaryState();
const auto controls = group.productionControls(summaryState); const auto controls = group.productionControls(summaryState);
if (newControl != Group::ProductionCMode::NONE) if (newControl != Group::ProductionCMode::NONE)
{ {
switched_groups.insert(group.name()); switched_groups.insert(group.name());
actionOnBrokenConstraints(group, controls.exceed_action, newControl, reportStepIdx, deferred_logger); actionOnBrokenConstraints(group, controls.exceed_action, newControl, deferred_logger);
} }
} else {
//neither production or injecting group FIELD?
} }
// call recursively down the group hiearchy // call recursively down the group hiearchy
@ -1794,30 +1791,24 @@ namespace Opm {
checkGroupConstraints(const Group& group, Opm::DeferredLogger& deferred_logger) const { checkGroupConstraints(const Group& group, Opm::DeferredLogger& deferred_logger) const {
const int reportStepIdx = ebosSimulator_.episodeIndex(); const int reportStepIdx = ebosSimulator_.episodeIndex();
if (group.isInjectionGroup()) if (group.isInjectionGroup()) {
{
const Phase all[] = {Phase::WATER, Phase::OIL, Phase::GAS}; const Phase all[] = {Phase::WATER, Phase::OIL, Phase::GAS};
for (Phase phase : all) { for (Phase phase : all) {
if (!group.hasInjectionControl(phase)) { if (!group.hasInjectionControl(phase)) {
continue; continue;
} }
Group::InjectionCMode newControl = checkGroupInjectionConstraints(group, phase, deferred_logger); Group::InjectionCMode newControl = checkGroupInjectionConstraints(group, phase);
if (newControl != Group::InjectionCMode::NONE) if (newControl != Group::InjectionCMode::NONE) {
{
return true; return true;
} }
} }
} else if (group.isProductionGroup()) }
{ if (group.isProductionGroup()) {
Group::ProductionCMode newControl = checkGroupProductionConstraints(group, deferred_logger); Group::ProductionCMode newControl = checkGroupProductionConstraints(group, deferred_logger);
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
const auto controls = group.productionControls(summaryState);
if (newControl != Group::ProductionCMode::NONE) if (newControl != Group::ProductionCMode::NONE)
{ {
return true; return true;
} }
} else {
//neither production or injecting group FIELD?
} }
// call recursively down the group hiearchy // call recursively down the group hiearchy
@ -1829,6 +1820,7 @@ namespace Opm {
} }
template<typename TypeTag> template<typename TypeTag>
Group::ProductionCMode Group::ProductionCMode
BlackoilWellModel<TypeTag>:: BlackoilWellModel<TypeTag>::
@ -1839,7 +1831,6 @@ namespace Opm {
const auto& comm = ebosSimulator_.vanguard().grid().comm(); const auto& comm = ebosSimulator_.vanguard().grid().comm();
const auto& well_state = well_state_; const auto& well_state = well_state_;
const auto controls = group.productionControls(summaryState); const auto controls = group.productionControls(summaryState);
const Group::ProductionCMode& currentControl = well_state.currentProductionGroupControl(group.name()); const Group::ProductionCMode& currentControl = well_state.currentProductionGroupControl(group.name());
@ -1939,7 +1930,7 @@ namespace Opm {
template<typename TypeTag> template<typename TypeTag>
Group::InjectionCMode Group::InjectionCMode
BlackoilWellModel<TypeTag>:: BlackoilWellModel<TypeTag>::
checkGroupInjectionConstraints(const Group& group, const Phase& phase, Opm::DeferredLogger& deferred_logger) const { checkGroupInjectionConstraints(const Group& group, const Phase& phase) const {
const int reportStepIdx = ebosSimulator_.episodeIndex(); const int reportStepIdx = ebosSimulator_.episodeIndex();
const auto& summaryState = ebosSimulator_.vanguard().summaryState(); const auto& summaryState = ebosSimulator_.vanguard().summaryState();
@ -2077,7 +2068,7 @@ namespace Opm {
template<typename TypeTag> template<typename TypeTag>
void void
BlackoilWellModel<TypeTag>:: BlackoilWellModel<TypeTag>::
actionOnBrokenConstraints(const Group& group, const Group::ExceedAction& exceed_action, const Group::ProductionCMode& newControl, const int reportStepIdx, Opm::DeferredLogger& deferred_logger) { actionOnBrokenConstraints(const Group& group, const Group::ExceedAction& exceed_action, const Group::ProductionCMode& newControl, Opm::DeferredLogger& deferred_logger) {
auto& well_state = well_state_; auto& well_state = well_state_;
const Group::ProductionCMode& oldControl = well_state.currentProductionGroupControl(group.name()); const Group::ProductionCMode& oldControl = well_state.currentProductionGroupControl(group.name());
@ -2132,7 +2123,7 @@ namespace Opm {
template<typename TypeTag> template<typename TypeTag>
void void
BlackoilWellModel<TypeTag>:: BlackoilWellModel<TypeTag>::
actionOnBrokenConstraints(const Group& group, const Group::InjectionCMode& newControl, const Phase& controlPhase, const int reportStepIdx, Opm::DeferredLogger& deferred_logger) { actionOnBrokenConstraints(const Group& group, const Group::InjectionCMode& newControl, const Phase& controlPhase, Opm::DeferredLogger& deferred_logger) {
auto& well_state = well_state_; auto& well_state = well_state_;
const Group::InjectionCMode& oldControl = well_state.currentInjectionGroupControl(controlPhase, group.name()); const Group::InjectionCMode& oldControl = well_state.currentInjectionGroupControl(controlPhase, group.name());
@ -2224,7 +2215,7 @@ namespace Opm {
deferred_logger); deferred_logger);
if (changed.first) { if (changed.first) {
switched_groups.insert(group.name()); switched_groups.insert(group.name());
actionOnBrokenConstraints(group, Group::InjectionCMode::FLD, phase, reportStepIdx, deferred_logger); actionOnBrokenConstraints(group, Group::InjectionCMode::FLD, phase, deferred_logger);
} }
} }
} }
@ -2259,7 +2250,7 @@ namespace Opm {
if (changed.first) { if (changed.first) {
switched_groups.insert(group.name()); switched_groups.insert(group.name());
const auto exceed_action = group.productionControls(summaryState).exceed_action; const auto exceed_action = group.productionControls(summaryState).exceed_action;
actionOnBrokenConstraints(group, exceed_action, Group::ProductionCMode::FLD, reportStepIdx, deferred_logger); actionOnBrokenConstraints(group, exceed_action, Group::ProductionCMode::FLD, deferred_logger);
} }
} }
} }

View File

@ -1795,7 +1795,6 @@ namespace Opm
EvalWell control_eq(0.0); EvalWell control_eq(0.0);
const auto& well = well_ecl_; const auto& well = well_ecl_;
const double efficiencyFactor = well.getEfficiencyFactor();
auto getRates = [&]() { auto getRates = [&]() {
std::vector<EvalWell> rates(3, 0.0); std::vector<EvalWell> rates(3, 0.0);

View File

@ -772,7 +772,6 @@ namespace Opm
EvalWell control_eq(numWellEq_ + numEq, 0.0); EvalWell control_eq(numWellEq_ + numEq, 0.0);
const auto& well = well_ecl_; const auto& well = well_ecl_;
const double efficiencyFactor = well.getEfficiencyFactor();
auto getRates = [&]() { auto getRates = [&]() {
std::vector<EvalWell> rates(3, EvalWell(numWellEq_ + numEq, 0.0)); std::vector<EvalWell> rates(3, EvalWell(numWellEq_ + numEq, 0.0));

View File

@ -486,9 +486,7 @@ namespace Opm
DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
bool checkIndividualConstraints(WellState& well_state, bool checkIndividualConstraints(WellState& well_state,
const Schedule& schedule, const SummaryState& summaryState) const;
const SummaryState& summaryState,
DeferredLogger& deferred_logger) const;
bool checkGroupConstraints(WellState& well_state, bool checkGroupConstraints(WellState& well_state,
const Schedule& schedule, const Schedule& schedule,

View File

@ -485,7 +485,7 @@ namespace Opm
bool changed = false; bool changed = false;
if (iog == IndividualOrGroup::Individual) { if (iog == IndividualOrGroup::Individual) {
changed = checkIndividualConstraints(well_state, schedule, summaryState, deferred_logger); changed = checkIndividualConstraints(well_state, summaryState);
} else if (iog == IndividualOrGroup::Group) { } else if (iog == IndividualOrGroup::Group) {
changed = checkGroupConstraints(well_state, schedule, summaryState, deferred_logger); changed = checkGroupConstraints(well_state, schedule, summaryState, deferred_logger);
} else { } else {
@ -1460,7 +1460,7 @@ namespace Opm
const SummaryState& summaryState, const SummaryState& summaryState,
DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
const bool ind_broken = checkIndividualConstraints(well_state, schedule, summaryState, deferred_logger); const bool ind_broken = checkIndividualConstraints(well_state, summaryState);
if (ind_broken) { if (ind_broken) {
return true; return true;
} else { } else {
@ -1475,9 +1475,7 @@ namespace Opm
template <typename TypeTag> template <typename TypeTag>
bool bool
WellInterface<TypeTag>::checkIndividualConstraints(WellState& well_state, WellInterface<TypeTag>::checkIndividualConstraints(WellState& well_state,
const Schedule& schedule, const SummaryState& summaryState) const
const SummaryState& summaryState,
DeferredLogger& deferred_logger) const
{ {
const auto& well = well_ecl_; const auto& well = well_ecl_;
const PhaseUsage& pu = phaseUsage(); const PhaseUsage& pu = phaseUsage();
@ -1680,7 +1678,6 @@ namespace Opm
const int well_index = index_of_well_; const int well_index = index_of_well_;
if (well.isInjector()) { if (well.isInjector()) {
const auto controls = well.injectionControls(summaryState);
Opm::Well::InjectorCMode& currentControl = well_state.currentInjectionControls()[well_index]; Opm::Well::InjectorCMode& currentControl = well_state.currentInjectionControls()[well_index];
if (currentControl != Well::InjectorCMode::GRUP) { if (currentControl != Well::InjectorCMode::GRUP) {
@ -1708,7 +1705,6 @@ namespace Opm
} }
if (well.isProducer( )) { if (well.isProducer( )) {
const auto controls = well.productionControls(summaryState);
Well::ProducerCMode& currentControl = well_state.currentProductionControls()[well_index]; Well::ProducerCMode& currentControl = well_state.currentProductionControls()[well_index];
if (currentControl != Well::ProducerCMode::GRUP) { if (currentControl != Well::ProducerCMode::GRUP) {
@ -1973,7 +1969,6 @@ namespace Opm
control_eq = total_rate - controls.resv_rate; control_eq = total_rate - controls.resv_rate;
} else { } else {
std::vector<double> hrates(number_of_phases_, 0.); std::vector<double> hrates(number_of_phases_, 0.);
const PhaseUsage& pu = phaseUsage();
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
hrates[pu.phase_pos[Water]] = controls.water_rate; hrates[pu.phase_pos[Water]] = controls.water_rate;
} }
@ -2044,9 +2039,11 @@ namespace Opm
const auto& well = well_ecl_; const auto& well = well_ecl_;
const auto pu = phaseUsage(); const auto pu = phaseUsage();
// Setting some defaults to silence warnings below.
// Will be overwritten in the switch statement.
int phasePos = -1; int phasePos = -1;
Well::GuideRateTarget wellTarget; Well::GuideRateTarget wellTarget = Well::GuideRateTarget::UNDEFINED;
Phase injectionPhase; Phase injectionPhase = Phase::WATER;
switch (injectorType) { switch (injectorType) {
case InjectorType::WATER: case InjectorType::WATER:
{ {