Move resetConnectionFactor to SingleWellState

This commit is contained in:
Joakim Hove 2021-10-31 14:58:36 +01:00
parent ec780676e2
commit 53dba36513
5 changed files with 42 additions and 48 deletions

View File

@ -1237,9 +1237,10 @@ updateEclWells(const int timeStepIdx,
++pdIter;
}
}
auto& ws = this->wellState().well(well_index);
this->wellState().updateStatus(well_index, well.getStatus());
this->wellState().resetConnectionTransFactors(well_index, pd);
ws.reset_connection_factors(pd);
this->prod_index_calc_[well_index].reInit(well);
}
}
@ -2028,7 +2029,8 @@ runWellPIScaling(const int timeStepIdx,
++pdIter;
}
}
this->wellState().resetConnectionTransFactors(well_index, pd);
auto& ws = this->wellState().well(well_index);
ws.reset_connection_factors(pd);
this->prod_index_calc_[well_index].reInit(well);
};

View File

@ -95,6 +95,36 @@ void SingleWellState::updateStatus(Well::Status new_status) {
}
}
void SingleWellState::reset_connection_factors(const std::vector<PerforationData>& new_perf_data) {
if (this->perf_data.size() != new_perf_data.size()) {
throw std::invalid_argument {
"Size mismatch for perforation data in well " + this->name
};
}
for (std::size_t conn_index = 0; conn_index < new_perf_data.size(); conn_index++) {
if (this->perf_data.cell_index[conn_index] != static_cast<std::size_t>(new_perf_data[conn_index].cell_index)) {
throw std::invalid_argument {
"Cell index mismatch in connection "
+ std::to_string(conn_index)
+ " of well "
+ this->name
};
}
if (this->perf_data.satnum_id[conn_index] != new_perf_data[conn_index].satnum_id) {
throw std::invalid_argument {
"Saturation function table mismatch in connection "
+ std::to_string(conn_index)
+ " of well "
+ this->name
};
}
this->perf_data.connection_transmissibility_factor[conn_index] = new_perf_data[conn_index].connection_transmissibility_factor;
}
}
double SingleWellState::sum_connection_rates(const std::vector<double>& connection_rates) const {
return this->parallel_info.get().sumPerfValues(connection_rates.begin(), connection_rates.end());
}

View File

@ -58,6 +58,14 @@ public:
Well::ProducerCMode production_cmode{Well::ProducerCMode::CMODE_UNDEFINED};
/// Special purpose method to support dynamically rescaling a well's
/// CTFs through WELPI.
///
/// \param[in] new_perf_data New perforation data. Only
/// PerforationData::connection_transmissibility_factor actually
/// used (overwrites existing internal values).
void reset_connection_factors(const std::vector<PerforationData>& new_perf_data);
void updateStatus(Well::Status status);
void init_timestep(const SingleWellState& other);
void shut();

View File

@ -906,40 +906,6 @@ void WellState::updateWellsDefaultALQ( const std::vector<Well>& wells_ecl )
}
}
void WellState::resetConnectionTransFactors(const int well_index,
const std::vector<PerforationData>& new_perf_data)
{
auto& ws = this->well(well_index);
auto& perf_data = ws.perf_data;
if (perf_data.size() != new_perf_data.size()) {
throw std::invalid_argument {
"Size mismatch for perforation data in well "
+ std::to_string(well_index)
};
}
for (std::size_t conn_index = 0; conn_index < new_perf_data.size(); conn_index++) {
if (perf_data.cell_index[conn_index] != static_cast<std::size_t>(new_perf_data[conn_index].cell_index)) {
throw std::invalid_argument {
"Cell index mismatch in connection "
+ std::to_string(conn_index)
+ " of well "
+ std::to_string(well_index)
};
}
if (perf_data.satnum_id[conn_index] != new_perf_data[conn_index].satnum_id) {
throw std::invalid_argument {
"Saturation function table mismatch in connection "
+ std::to_string(conn_index)
+ " of well "
+ std::to_string(well_index)
};
}
perf_data.connection_transmissibility_factor[conn_index] = new_perf_data[conn_index].connection_transmissibility_factor;
}
}
const ParallelWellInfo&
WellState::parallelWellInfo(std::size_t well_index) const

View File

@ -197,18 +197,6 @@ public:
bool wellIsOwned(const std::string& wellName) const;
/// Special purpose method to support dynamically rescaling a well's
/// CTFs through WELPI.
///
/// \param[in] well_index Process-local linear index of single well.
/// Must be in the range 0..numWells()-1.
///
/// \param[in] well_perf_data New perforation data. Only
/// PerforationData::connection_transmissibility_factor actually
/// used (overwrites existing internal values).
void resetConnectionTransFactors(const int well_index,
const std::vector<PerforationData>& well_perf_data);
void updateStatus(int well_index, Well::Status status);
void openWell(int well_index);