Removed FieldPropsManager* parameter from applyAction()

This commit is contained in:
Daniel 2021-11-09 11:44:00 +01:00
parent d8a2061a14
commit 243c46a9a6
5 changed files with 11 additions and 22 deletions

View File

@ -505,7 +505,6 @@ namespace Opm
ErrorGuard& errors,
const ScheduleGrid& grid,
const std::unordered_map<std::string, double> * target_wellpi,
const FieldPropsManager* fp,
const std::string& prefix);
void addACTIONX(const Action::ActionX& action);
void addGroupToGroup( const std::string& parent_group, const std::string& child_group);
@ -520,7 +519,6 @@ namespace Opm
const DeckKeyword& keyword,
const ParseContext& parseContext, ErrorGuard& errors,
const ScheduleGrid& grid,
const FieldPropsManager* fp,
const std::vector<std::string>& matching_wells,
bool runtime,
std::unordered_set<std::string> * affected_wells,
@ -543,7 +541,6 @@ namespace Opm
std::unordered_set<std::string> * affected_wells;
const std::unordered_map<std::string, double> * target_wellpi;
const ScheduleGrid& grid;
const FieldPropsManager* fp_ptr;
HandlerContext(const ScheduleBlock& block_,
const DeckKeyword& keyword_,
@ -561,7 +558,6 @@ namespace Opm
, affected_wells(affected_wells_)
, target_wellpi(target_wellpi_)
, grid(grid_)
, fp_ptr(nullptr)
{}
void affected_well(const std::string& well_name) {

View File

@ -586,7 +586,7 @@ public:
bool updateDrainageRadius(double drainage_radius);
void updateSegments(std::shared_ptr<WellSegments> segments_arg);
bool updateConnections(std::shared_ptr<WellConnections> connections, bool force);
bool updateConnections(std::shared_ptr<WellConnections> connections, const ScheduleGrid& grid, const std::vector<int>& pvtnum);
bool updateConnections(std::shared_ptr<WellConnections> connections, const ScheduleGrid& grid);
bool updateStatus(Status status);
bool updateGroup(const std::string& group);
bool updateWellGuideRate(bool available, double guide_rate, GuideRateTarget guide_phase, double scale_factor);

View File

@ -156,7 +156,7 @@ namespace {
auto well2 = this->snapshots.back().wells.get(name);
auto connections = std::shared_ptr<WellConnections>( new WellConnections( well2.getConnections()));
connections->loadCOMPDAT(record, handlerContext.grid, name, handlerContext.keyword.location());
if (well2.updateConnections(connections, handlerContext.grid, handlerContext.fp_ptr->get_int("PVTNUM"))) {
if (well2.updateConnections(connections, handlerContext.grid)) {
this->snapshots.back().wells.update( well2 );
wells.insert( name );
}

View File

@ -166,13 +166,13 @@ namespace Opm {
if (rst) {
auto restart_step = this->m_static.rst_info.report_step;
this->iterateScheduleSection( 0, restart_step, parseContext, errors, grid, nullptr, &fp, "");
this->iterateScheduleSection( 0, restart_step, parseContext, errors, grid, nullptr, "");
this->load_rst(*rst, grid, fp);
if (! this->restart_output.writeRestartFile(restart_step))
this->restart_output.addRestartOutput(restart_step);
this->iterateScheduleSection( restart_step, this->m_sched_deck.size(), parseContext, errors, grid, nullptr, &fp, "");
this->iterateScheduleSection( restart_step, this->m_sched_deck.size(), parseContext, errors, grid, nullptr, "");
} else {
this->iterateScheduleSection( 0, this->m_sched_deck.size(), parseContext, errors, grid, nullptr, &fp, "");
this->iterateScheduleSection( 0, this->m_sched_deck.size(), parseContext, errors, grid, nullptr, "");
}
//m_grid = std::make_shared<SparseScheduleGrid>(grid, gridWrapper.getHitKeys());
@ -296,7 +296,6 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const std::optional
const ParseContext& parseContext,
ErrorGuard& errors,
const ScheduleGrid& grid,
const FieldPropsManager* fp,
const std::vector<std::string>& matching_wells,
bool actionx_mode,
std::unordered_set<std::string> * affected_wells,
@ -313,9 +312,6 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const std::optional
The grid and fieldProps members create problems for reiterating the
Schedule section. We therefor single them out very clearly here.
*/
if (require_grid.count(keyword.name()) > 0) {
handlerContext.fp_ptr = fp;
}
if (handleNormalKeyword(handlerContext, parseContext, errors))
return;
@ -391,7 +387,6 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
ErrorGuard& errors,
const ScheduleGrid& grid,
const std::unordered_map<std::string, double> * target_wellpi,
const FieldPropsManager* fp,
const std::string& prefix) {
std::vector<std::pair< const DeckKeyword* , std::size_t> > rftProperties;
@ -506,7 +501,6 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
parseContext,
errors,
grid,
fp,
{},
false,
nullptr,
@ -1268,7 +1262,6 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
parseContext,
errors,
grid,
nullptr,
result.wells(),
true,
&affected_wells,
@ -1282,7 +1275,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
}
if (reportStep < this->m_sched_deck.size() - 1)
iterateScheduleSection(reportStep + 1, this->m_sched_deck.size(), parseContext, errors, grid, &target_wellpi, nullptr, prefix);
iterateScheduleSection(reportStep + 1, this->m_sched_deck.size(), parseContext, errors, grid, &target_wellpi, prefix);
OpmLog::info("\\----------------------------------------------------------------------");
return affected_wells;
@ -1446,7 +1439,7 @@ namespace {
rst_well.ij[0],
rst_well.ij[1],
rst_connections);
well.updateConnections( std::make_shared<WellConnections>( std::move(connections) ), grid, fp.get_int("PVTNUM"));
well.updateConnections( std::make_shared<WellConnections>( std::move(connections) ), grid);
} else {
std::unordered_map<int, Opm::Segment> rst_segments;
for (const auto& rst_segment : rst_well.segments) {
@ -1455,7 +1448,7 @@ namespace {
}
auto [connections, segments] = Compsegs::rstUpdate(rst_well, rst_connections, rst_segments);
well.updateConnections( std::make_shared<WellConnections>(std::move(connections)), grid, fp.get_int("PVTNUM"));
well.updateConnections( std::make_shared<WellConnections>(std::move(connections)), grid);
well.updateSegments( std::make_shared<WellSegments>(std::move(segments) ));
}

View File

@ -689,12 +689,12 @@ bool Well::updateConnections(std::shared_ptr<WellConnections> connections_arg, b
return false;
}
bool Well::updateConnections(std::shared_ptr<WellConnections> connections_arg, const ScheduleGrid& grid, const std::vector<int>& pvtnum) {
bool Well::updateConnections(std::shared_ptr<WellConnections> connections_arg, const ScheduleGrid& grid) {
bool update = this->updateConnections(connections_arg, false);
if (this->pvt_table == 0 && !this->connections->empty()) {
const auto& lowest = this->connections->lowest();
auto active_index = grid.get_cell(lowest.getI(), lowest.getJ(), lowest.getK()).active_index();
this->pvt_table = pvtnum[active_index];
const auto& props = grid.get_cell(lowest.getI(), lowest.getJ(), lowest.getK()).props;
this->pvt_table = props->pvtnum;
update = true;
}
return update;