Merge pull request #2270 from joakim-hove/jr-janitor

Remove unused arguments
This commit is contained in:
Joakim Hove
2021-02-03 15:04:16 +01:00
committed by GitHub
7 changed files with 42 additions and 75 deletions
@@ -520,7 +520,7 @@ namespace Opm
GTNode groupTree(const std::string& root_node, std::size_t report_step, std::size_t level, const std::optional<std::string>& parent_name) const;
bool checkGroups(const ParseContext& parseContext, ErrorGuard& errors);
bool updateWellStatus( const std::string& well, std::size_t reportStep, bool runtime, Well::Status status, std::optional<KeywordLocation> = {});
bool updateWellStatus( const std::string& well, std::size_t reportStep, Well::Status status, std::optional<KeywordLocation> = {});
void addWellToGroup( const std::string& group_name, const std::string& well_name , std::size_t timeStep);
void iterateScheduleSection(std::size_t load_start,
std::size_t load_end,
@@ -543,10 +543,9 @@ public:
bool updateRefDepth(const std::optional<double>& ref_dpeth);
bool updateDrainageRadius(double drainage_radius);
void updateSegments(std::shared_ptr<WellSegments> segments_arg);
bool updateConnections(std::shared_ptr<WellConnections> connections, std::size_t report_step, bool runtime, bool force = false);
bool updateConnections(std::shared_ptr<WellConnections> connections, std::size_t report_step, const EclipseGrid& grid, const std::vector<int>& pvtnum);
bool updateConnections(std::shared_ptr<WellConnections> connections, bool runtime, bool force);
bool updateConnections(std::shared_ptr<WellConnections> connections, const EclipseGrid& grid, const std::vector<int>& pvtnum);
bool updateStatus(Status status);
bool updateConnectionStatus(Status well_state, std::size_t report_step, bool runtime);
bool updateGroup(const std::string& group);
bool updateWellGuideRate(bool available, double guide_rate, GuideRateTarget guide_phase, double scale_factor);
bool updateWellGuideRate(double guide_rate);
@@ -567,10 +566,10 @@ public:
void updateWPaveRefDepth(double ref_depth);
bool handleWELSEGS(const DeckKeyword& keyword);
bool handleCOMPSEGS(const DeckKeyword& keyword, std::size_t report_step, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors);
bool handleWELOPENConnections(const DeckRecord& record, std::size_t report_step, Connection::State status, bool action_mode);
bool handleCOMPLUMP(const DeckRecord& record, std::size_t report_step);
bool handleWPIMULT(const DeckRecord& record, std::size_t report_step);
bool handleCOMPSEGS(const DeckKeyword& keyword, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors);
bool handleWELOPENConnections(const DeckRecord& record, Connection::State status, bool action_mode);
bool handleCOMPLUMP(const DeckRecord& record);
bool handleWPIMULT(const DeckRecord& record);
void filterConnections(const ActiveGridCells& grid);
ProductionControls productionControls(const SummaryState& st) const;
@@ -159,7 +159,7 @@ namespace {
auto well2 = std::shared_ptr<Well>(new Well( this->getWell(name, handlerContext.currentStep)));
auto connections = std::shared_ptr<WellConnections>( new WellConnections( well2->getConnections()));
connections->loadCOMPDAT(record, *handlerContext.grid_ptr, *handlerContext.fp_ptr, name, handlerContext.keyword.location());
if (well2->updateConnections(connections, handlerContext.currentStep, *handlerContext.grid_ptr, handlerContext.fp_ptr->get_int("PVTNUM"))) {
if (well2->updateConnections(connections, *handlerContext.grid_ptr, handlerContext.fp_ptr->get_int("PVTNUM"))) {
this->updateWell(std::move(well2), handlerContext.currentStep);
wells.insert( name );
}
@@ -195,7 +195,7 @@ namespace {
for (const auto& wname : well_names) {
auto& dynamic_state = this->wells_static.at(wname);
auto well_ptr = std::make_shared<Well>( *dynamic_state[handlerContext.currentStep] );
if (well_ptr->handleCOMPLUMP(record, handlerContext.currentStep))
if (well_ptr->handleCOMPLUMP(record))
this->updateWell(std::move(well_ptr), handlerContext.currentStep);
}
}
@@ -236,7 +236,7 @@ namespace {
return;
}
if (well_ptr->handleCOMPSEGS(handlerContext.keyword, handlerContext.currentStep, *handlerContext.grid_ptr, parseContext, errors))
if (well_ptr->handleCOMPSEGS(handlerContext.keyword, *handlerContext.grid_ptr, parseContext, errors))
this->updateWell(std::move(well_ptr), handlerContext.currentStep);
}
@@ -857,7 +857,7 @@ namespace {
const Well::Status status = Well::StatusFromString(record.getItem("STATUS").getTrimmedString(0));
for (const auto& well_name : well_names) {
this->updateWellStatus( well_name , handlerContext.currentStep , false, status, handlerContext.keyword.location() );
this->updateWellStatus( well_name , handlerContext.currentStep , status, handlerContext.keyword.location() );
std::optional<VFPProdTable::ALQ_TYPE> alq_type;
auto& dynamic_state = this->wells_static.at(well_name);
@@ -909,7 +909,7 @@ namespace {
"Well " + well2->name() + " is a history matched well with zero rate where crossflow is banned. " +
"This well will be closed at " + std::to_string(m_timeMap.getTimePassedUntil(handlerContext.currentStep) / (60*60*24)) + " days";
OpmLog::note(msg);
this->updateWellStatus( well_name, handlerContext.currentStep, false, Well::Status::SHUT);
this->updateWellStatus( well_name, handlerContext.currentStep, Well::Status::SHUT);
}
}
}
@@ -926,7 +926,7 @@ namespace {
const Well::Status status = Well::StatusFromString(record.getItem("STATUS").getTrimmedString(0));
for (const auto& well_name : well_names) {
bool update_well = this->updateWellStatus(well_name, handlerContext.currentStep, false, status, handlerContext.keyword.location());
bool update_well = this->updateWellStatus(well_name, handlerContext.currentStep, status, handlerContext.keyword.location());
std::optional<VFPProdTable::ALQ_TYPE> alq_type;
auto& dynamic_state = this->wells_static.at(well_name);
auto well2 = std::make_shared<Well>(*dynamic_state[handlerContext.currentStep]);
@@ -981,7 +981,7 @@ namespace {
const Well::Status status = Well::StatusFromString(record.getItem("STATUS").getTrimmedString(0));
for (const auto& well_name : well_names) {
this->updateWellStatus(well_name, handlerContext.currentStep, false, status, handlerContext.keyword.location());
this->updateWellStatus(well_name, handlerContext.currentStep, status, handlerContext.keyword.location());
bool update_well = false;
auto& dynamic_state = this->wells_static.at(well_name);
@@ -1014,14 +1014,14 @@ namespace {
if (injection->surfaceInjectionRate.is<double>()) {
if (injection->hasInjectionControl(Well::InjectorCMode::RATE) && injection->surfaceInjectionRate.zero()) {
OpmLog::note(msg);
this->updateWellStatus( well_name, handlerContext.currentStep, false, Well::Status::SHUT);
this->updateWellStatus( well_name, handlerContext.currentStep, Well::Status::SHUT);
}
}
if (injection->reservoirInjectionRate.is<double>()) {
if (injection->hasInjectionControl(Well::InjectorCMode::RESV) && injection->reservoirInjectionRate.zero()) {
OpmLog::note(msg);
this->updateWellStatus( well_name, handlerContext.currentStep, false, Well::Status::SHUT);
this->updateWellStatus( well_name, handlerContext.currentStep, Well::Status::SHUT);
}
}
}
@@ -1043,7 +1043,7 @@ namespace {
const Well::Status status = Well::StatusFromString( record.getItem("STATUS").getTrimmedString(0));
for (const auto& well_name : well_names) {
this->updateWellStatus(well_name, handlerContext.currentStep, false, status, handlerContext.keyword.location());
this->updateWellStatus(well_name, handlerContext.currentStep, status, handlerContext.keyword.location());
bool update_well = false;
auto& dynamic_state = this->wells_static.at(well_name);
auto well2 = std::make_shared<Well>(*dynamic_state[handlerContext.currentStep]);
@@ -1070,7 +1070,7 @@ namespace {
"Well " + well_name + " is an injector with zero rate where crossflow is banned. " +
"This well will be closed at " + std::to_string ( m_timeMap.getTimePassedUntil(handlerContext.currentStep) / (60*60*24) ) + " days";
OpmLog::note(msg);
this->updateWellStatus( well_name, handlerContext.currentStep, false, Well::Status::SHUT);
this->updateWellStatus( well_name, handlerContext.currentStep, Well::Status::SHUT);
}
}
}
@@ -1158,7 +1158,7 @@ namespace {
// Well::updateWellProductivityIndex() implicitly mutates
// internal state in the WellConnections class.
auto connections = std::make_shared<WellConnections>(well2->getConnections());
well2->updateConnections(std::move(connections), event_step, false, true);
well2->updateConnections(std::move(connections), false, true);
if (well2->updateWellProductivityIndex(rawProdIndex))
this->updateWell(std::move(well2), event_step);
@@ -1538,7 +1538,7 @@ namespace {
for (const auto& wname : well_names) {
auto& dynamic_state = this->wells_static.at(wname);
auto well_ptr = std::make_shared<Well>( *dynamic_state[handlerContext.currentStep] );
if (well_ptr->handleWPIMULT(record, handlerContext.currentStep))
if (well_ptr->handleWPIMULT(record))
this->updateWell(std::move(well_ptr), handlerContext.currentStep);
}
}
@@ -529,15 +529,15 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
}
void Schedule::shut_well(const std::string& well_name, std::size_t report_step) {
this->updateWellStatus(well_name, report_step, true, Well::Status::SHUT);
this->updateWellStatus(well_name, report_step, Well::Status::SHUT);
}
void Schedule::open_well(const std::string& well_name, std::size_t report_step) {
this->updateWellStatus(well_name, report_step, true, Well::Status::OPEN);
this->updateWellStatus(well_name, report_step, Well::Status::OPEN);
}
void Schedule::stop_well(const std::string& well_name, std::size_t report_step) {
this->updateWellStatus(well_name, report_step, true, Well::Status::STOP);
this->updateWellStatus(well_name, report_step, Well::Status::STOP);
}
void Schedule::updateWell(std::shared_ptr<Well> well, std::size_t reportStep) {
@@ -550,7 +550,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
Function is quite dangerous - because if this is called while holding a
Well pointer that will go stale and needs to be refreshed.
*/
bool Schedule::updateWellStatus( const std::string& well_name, std::size_t reportStep , bool runtime, Well::Status status, std::optional<KeywordLocation> location) {
bool Schedule::updateWellStatus( const std::string& well_name, std::size_t reportStep, Well::Status status, std::optional<KeywordLocation> location) {
auto& dynamic_state = this->wells_static.at(well_name);
auto well2 = std::make_shared<Well>(*dynamic_state[reportStep]);
if (well2->getConnections().empty() && status == Well::Status::OPEN) {
@@ -657,7 +657,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
+ std::to_string( days ) + " days";
OpmLog::note(msg);
} else {
this->updateWellStatus( wname, currentStep, runtime, well_status);
this->updateWellStatus( wname, currentStep, well_status);
if (well_status == open)
this->rft_config.addWellOpen(wname, currentStep);
}
@@ -684,7 +684,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
{
auto& dynamic_state = this->wells_static.at(wname);
auto well_ptr = std::make_shared<Well>( *dynamic_state[currentStep] );
if (well_ptr->handleWELOPENConnections(record, currentStep, connection_status, runtime))
if (well_ptr->handleWELOPENConnections(record, connection_status, runtime))
dynamic_state.update(currentStep, std::move(well_ptr));
}
@@ -1184,7 +1184,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
"All completions in well " + well.name() + " is shut at " + std::to_string ( m_timeMap.getTimePassedUntil(timeStep) / (60*60*24) ) + " days. \n" +
"The well is therefore also shut.";
OpmLog::note(msg);
this->updateWellStatus( well.name(), timeStep, false, Well::Status::SHUT);
this->updateWellStatus( well.name(), timeStep, Well::Status::SHUT);
}
}
}
@@ -1452,7 +1452,7 @@ namespace {
rst_well.ij[0],
rst_well.ij[1],
rst_connections);
well.updateConnections( std::make_shared<WellConnections>( std::move(connections) ), report_step, grid, fp.get_int("PVTNUM"));
well.updateConnections( std::make_shared<WellConnections>( std::move(connections) ), grid, fp.get_int("PVTNUM"));
} else {
std::unordered_map<int, Opm::Segment> rst_segments;
for (const auto& rst_segment : rst_well.segments) {
@@ -1461,7 +1461,7 @@ namespace {
}
auto [connections, segments] = Compsegs::rstUpdate(rst_well, rst_connections, rst_segments);
well.updateConnections( std::make_shared<WellConnections>(std::move(connections)), report_step, grid, fp.get_int("PVTNUM"));
well.updateConnections( std::make_shared<WellConnections>(std::move(connections)), grid, fp.get_int("PVTNUM"));
well.updateSegments( std::make_shared<WellSegments>(std::move(segments) ));
}
@@ -618,37 +618,6 @@ bool Well::updateStatus(Status well_state) {
bool Well::updateConnectionStatus(Status well_state, std::size_t report_step, bool runtime) {
Connection::State connection_state;
if (runtime)
throw std::logic_error("runtime and update_connections can not be combined");
switch (well_state) {
case Status::OPEN:
connection_state = Connection::State::OPEN;
break;
case Status::SHUT:
connection_state = Connection::State::SHUT;
break;
case Status::AUTO:
connection_state = Connection::State::AUTO;
break;
case Status::STOP:
connection_state = Connection::State::SHUT;
break;
default:
throw std::logic_error("Bug - should not be here");
}
auto new_connections = std::make_shared<WellConnections>(this->connections->ordering(), this->headI, this->headJ);
for (auto c : *this->connections) {
c.setState(connection_state);
new_connections->add(c);
}
this->updateConnections(std::move(new_connections), report_step, runtime);
return true;
}
bool Well::updateRefDepth(const std::optional<double>& ref_depth_arg) {
@@ -689,7 +658,7 @@ bool Well::updateAutoShutin(bool auto_shutin) {
}
bool Well::updateConnections(std::shared_ptr<WellConnections> connections_arg, std::size_t report_step, bool runtime, bool force) {
bool Well::updateConnections(std::shared_ptr<WellConnections> connections_arg, bool runtime, bool force) {
connections_arg->order( );
if (force || *this->connections != *connections_arg) {
this->connections = connections_arg;
@@ -709,8 +678,8 @@ bool Well::updateConnections(std::shared_ptr<WellConnections> connections_arg, s
return false;
}
bool Well::updateConnections(std::shared_ptr<WellConnections> connections_arg, std::size_t report_step, const EclipseGrid& grid, const std::vector<int>& pvtnum) {
bool update = this->updateConnections(connections_arg, report_step, false);
bool Well::updateConnections(std::shared_ptr<WellConnections> connections_arg, const EclipseGrid& grid, const std::vector<int>& pvtnum) {
bool update = this->updateConnections(connections_arg, false, false);
if (this->pvt_table == 0 && !this->connections->empty()) {
const auto& lowest = this->connections->lowest();
auto active_index = grid.activeIndex(lowest.global_index());
@@ -731,14 +700,13 @@ bool Well::updateSolventFraction(double solvent_fraction_arg) {
bool Well::handleCOMPSEGS(const DeckKeyword& keyword,
std::size_t report_step,
const EclipseGrid& grid,
const ParseContext& parseContext,
ErrorGuard& errors) {
auto [new_connections, new_segments] = Compsegs::processCOMPSEGS(keyword, *this->connections, *this->segments , grid,
parseContext, errors);
this->updateConnections( std::make_shared<WellConnections>(std::move(new_connections)), report_step, false );
this->updateConnections( std::make_shared<WellConnections>(std::move(new_connections)), false, false );
this->updateSegments( std::make_shared<WellSegments>( std::move(new_segments)) );
return true;
}
@@ -1038,7 +1006,7 @@ int Well::fip_region_number() const {
*/
bool Well::handleWELOPENConnections(const DeckRecord& record, std::size_t report_step, Connection::State state_arg, bool runtime) {
bool Well::handleWELOPENConnections(const DeckRecord& record, Connection::State state_arg, bool runtime) {
auto match = [=]( const Connection &c) -> bool {
if (!match_eq(c.getI(), record, "I" , -1)) return false;
@@ -1058,14 +1026,14 @@ bool Well::handleWELOPENConnections(const DeckRecord& record, std::size_t report
new_connections->add(c);
}
return this->updateConnections(std::move(new_connections), report_step, runtime);
return this->updateConnections(std::move(new_connections), runtime, false);
}
bool Well::handleCOMPLUMP(const DeckRecord& record, std::size_t report_step) {
bool Well::handleCOMPLUMP(const DeckRecord& record) {
auto match = [=]( const Connection &c) -> bool {
if (!match_eq(c.getI(), record, "I" , -1)) return false;
@@ -1088,12 +1056,12 @@ bool Well::handleCOMPLUMP(const DeckRecord& record, std::size_t report_step) {
new_connections->add(c);
}
return this->updateConnections(std::move(new_connections), report_step, false);
return this->updateConnections(std::move(new_connections), false, false);
}
bool Well::handleWPIMULT(const DeckRecord& record, std::size_t report_step) {
bool Well::handleWPIMULT(const DeckRecord& record) {
auto match = [=]( const Connection &c) -> bool {
if (!match_ge(c.complnum(), record, "FIRST")) return false;
@@ -1115,7 +1083,7 @@ bool Well::handleWPIMULT(const DeckRecord& record, std::size_t report_step) {
new_connections->add(c);
}
return this->updateConnections(std::move(new_connections), report_step, false);
return this->updateConnections(std::move(new_connections), false, false);
}
+2 -2
View File
@@ -3259,8 +3259,8 @@ BOOST_AUTO_TEST_CASE(WELL_STATIC) {
10,
100);
BOOST_CHECK( ws.updateConnections(c2, 0, false) );
BOOST_CHECK( !ws.updateConnections(c2, 0, false) );
BOOST_CHECK( ws.updateConnections(c2, false, false) );
BOOST_CHECK( !ws.updateConnections(c2, false, false) );
}
+1 -1
View File
@@ -1343,7 +1343,7 @@ END
"P and Q must have the same internal connections pointers");
auto connQ = std::make_shared<WellConnections>(wellP.getConnections());
wellQ.updateConnections(std::move(connQ), 0, true, true);
wellQ.updateConnections(std::move(connQ), true, true);
BOOST_CHECK_MESSAGE(! wellP.hasSameConnectionsPointers(wellQ),
"P and Q must NOT have the same internal connections pointers "
"after forcibly updating the connections structure");