move loadRestartWellData into BlackoilWellModelRestart

This commit is contained in:
Arne Morten Kvarving 2022-10-24 09:36:05 +02:00
parent 09c1127c34
commit 0f853a8566
4 changed files with 48 additions and 46 deletions

View File

@ -415,40 +415,6 @@ getWellEcl(const std::string& well_name) const
return *well_ecl;
}
void
BlackoilWellModelGeneric::
loadRestartWellData(const std::string& well_name,
const bool handle_ms_well,
const std::vector<data::Rates::opt>& phs,
const data::Well& rst_well,
const std::vector<PerforationData>& old_perf_data,
SingleWellState& ws)
{
const auto np = phs.size();
ws.bhp = rst_well.bhp;
ws.thp = rst_well.thp;
ws.temperature = rst_well.temperature;
if (rst_well.current_control.isProducer) {
ws.production_cmode = rst_well.current_control.prod;
}
else {
ws.injection_cmode = rst_well.current_control.inj;
}
for (auto i = 0*np; i < np; ++i) {
assert( rst_well.rates.has( phs[ i ] ) );
ws.surface_rates[i] = rst_well.rates.get(phs[i]);
}
BlackoilWellModelRestart(*this).loadRestartConnectionData(phs, rst_well, old_perf_data, ws);
if (handle_ms_well && !rst_well.segments.empty()) {
BlackoilWellModelRestart(*this).loadRestartSegmentData(well_name, phs, rst_well, ws);
}
}
void
BlackoilWellModelGeneric::
loadRestartGroupData(const std::string& group,
@ -545,10 +511,11 @@ loadRestartData(const data::Wells& rst_wells,
{
const auto& well_name = well_state.name(well_index);
this->loadRestartWellData(well_name, handle_ms_well, phs,
rst_wells.at(well_name),
this->well_perf_data_[well_index],
well_state.well(well_index));
BlackoilWellModelRestart(*this).
loadRestartWellData(well_name, handle_ms_well, phs,
rst_wells.at(well_name),
this->well_perf_data_[well_index],
well_state.well(well_index));
}
for (const auto& [group, value] : grpNwrkValues.groupData) {

View File

@ -286,13 +286,6 @@ protected:
std::map<std::string, data::GroupData>& gvalues) const;
void assignNodeValues(std::map<std::string, data::NodeData>& nodevalues) const;
void loadRestartWellData(const std::string& well_name,
const bool handle_ms_well,
const std::vector<data::Rates::opt>& phs,
const data::Well& rst_well,
const std::vector<PerforationData>& old_perf_data,
SingleWellState& ws);
void loadRestartGroupData(const std::string& group,
const data::GroupData& value);

View File

@ -84,4 +84,38 @@ loadRestartSegmentData(const std::string& well_name,
}
}
void BlackoilWellModelRestart::
loadRestartWellData(const std::string& well_name,
const bool handle_ms_well,
const std::vector<data::Rates::opt>& phs,
const data::Well& rst_well,
const std::vector<PerforationData>& old_perf_data,
SingleWellState& ws) const
{
const auto np = phs.size();
ws.bhp = rst_well.bhp;
ws.thp = rst_well.thp;
ws.temperature = rst_well.temperature;
if (rst_well.current_control.isProducer) {
ws.production_cmode = rst_well.current_control.prod;
}
else {
ws.injection_cmode = rst_well.current_control.inj;
}
for (auto i = 0*np; i < np; ++i) {
assert( rst_well.rates.has( phs[ i ] ) );
ws.surface_rates[i] = rst_well.rates.get(phs[i]);
}
this->loadRestartConnectionData(phs, rst_well, old_perf_data, ws);
if (handle_ms_well && !rst_well.segments.empty()) {
this->loadRestartSegmentData(well_name, phs, rst_well, ws);
}
}
} // namespace Opm

View File

@ -42,6 +42,15 @@ public:
: wellModel_(wellModel)
{}
//! \brief Loads per-well data from restart structures.
void loadRestartWellData(const std::string& well_name,
const bool handle_ms_well,
const std::vector<data::Rates::opt>& phs,
const data::Well& rst_well,
const std::vector<PerforationData>& old_perf_data,
SingleWellState& ws) const;
private:
//! \brief Loads per-connection data from restart structures.
void loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
const data::Well& rst_well,
@ -54,7 +63,6 @@ public:
const data::Well& rst_well,
SingleWellState& ws) const;
private:
const BlackoilWellModelGeneric& wellModel_; //!< Reference to well model
};