mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move loadRestartData into BlackoilWellModelRestart
This commit is contained in:
parent
35386a79bf
commit
3fdf28508f
@ -385,48 +385,6 @@ getWellEcl(const std::string& well_name) const
|
||||
return *well_ecl;
|
||||
}
|
||||
|
||||
void
|
||||
BlackoilWellModelGeneric::
|
||||
loadRestartData(const data::Wells& rst_wells,
|
||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||
const PhaseUsage& phases,
|
||||
const bool handle_ms_well,
|
||||
WellState& well_state)
|
||||
{
|
||||
using rt = data::Rates::opt;
|
||||
const auto np = phases.num_phases;
|
||||
|
||||
std::vector<rt> phs(np);
|
||||
if (phases.phase_used[BlackoilPhases::Aqua]) {
|
||||
phs.at(phases.phase_pos[BlackoilPhases::Aqua]) = rt::wat;
|
||||
}
|
||||
|
||||
if (phases.phase_used[BlackoilPhases::Liquid]) {
|
||||
phs.at( phases.phase_pos[BlackoilPhases::Liquid] ) = rt::oil;
|
||||
}
|
||||
|
||||
if (phases.phase_used[BlackoilPhases::Vapour]) {
|
||||
phs.at( phases.phase_pos[BlackoilPhases::Vapour] ) = rt::gas;
|
||||
}
|
||||
|
||||
for (auto well_index = 0*well_state.size();
|
||||
well_index < well_state.size();
|
||||
++well_index)
|
||||
{
|
||||
const auto& well_name = well_state.name(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) {
|
||||
BlackoilWellModelRestart(*this).loadRestartGroupData(group, value, this->groupState());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BlackoilWellModelGeneric::
|
||||
initFromRestartFile(const RestartValue& restartValues,
|
||||
@ -456,8 +414,11 @@ initFromRestartFile(const RestartValue& restartValues,
|
||||
this->schedule(), handle_ms_well, numCells,
|
||||
this->well_perf_data_, this->summaryState_);
|
||||
|
||||
loadRestartData(restartValues.wells, restartValues.grp_nwrk,
|
||||
this->phase_usage_, handle_ms_well, this->wellState());
|
||||
BlackoilWellModelRestart(*this).loadRestartData(restartValues.wells,
|
||||
restartValues.grp_nwrk,
|
||||
handle_ms_well,
|
||||
this->wellState(),
|
||||
this->groupState());
|
||||
|
||||
if (config.has_model()) {
|
||||
BlackoilWellModelRestart(*this).loadRestartGuideRates(report_step,
|
||||
|
@ -130,13 +130,6 @@ public:
|
||||
const std::unordered_set<std::string>& wells,
|
||||
const SummaryState& st);
|
||||
|
||||
|
||||
void loadRestartData(const data::Wells& rst_wells,
|
||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||
const PhaseUsage& phases,
|
||||
const bool handle_ms_well,
|
||||
WellState& well_state);
|
||||
|
||||
void initFromRestartFile(const RestartValue& restartValues,
|
||||
WellTestState wtestState,
|
||||
const size_t numCells,
|
||||
@ -163,6 +156,10 @@ public:
|
||||
bool forceShutWellByName(const std::string& wellname,
|
||||
const double simulation_time);
|
||||
|
||||
|
||||
const std::vector<PerforationData>& perfData(const int well_idx) const
|
||||
{ return well_perf_data_[well_idx]; }
|
||||
|
||||
protected:
|
||||
|
||||
/*
|
||||
|
@ -217,4 +217,45 @@ loadRestartGuideRates(const int report_step,
|
||||
}
|
||||
}
|
||||
|
||||
void BlackoilWellModelRestart::
|
||||
loadRestartData(const data::Wells& rst_wells,
|
||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||
const bool handle_ms_well,
|
||||
WellState& well_state,
|
||||
GroupState& grpState) const
|
||||
{
|
||||
using rt = data::Rates::opt;
|
||||
const auto& phases = wellModel_.phaseUsage();
|
||||
const auto np = phases.num_phases;
|
||||
|
||||
std::vector<rt> phs(np);
|
||||
if (phases.phase_used[BlackoilPhases::Aqua]) {
|
||||
phs.at(phases.phase_pos[BlackoilPhases::Aqua]) = rt::wat;
|
||||
}
|
||||
|
||||
if (phases.phase_used[BlackoilPhases::Liquid]) {
|
||||
phs.at( phases.phase_pos[BlackoilPhases::Liquid] ) = rt::oil;
|
||||
}
|
||||
|
||||
if (phases.phase_used[BlackoilPhases::Vapour]) {
|
||||
phs.at( phases.phase_pos[BlackoilPhases::Vapour] ) = rt::gas;
|
||||
}
|
||||
|
||||
for (auto well_index = 0*well_state.size();
|
||||
well_index < well_state.size();
|
||||
++well_index)
|
||||
{
|
||||
const auto& well_name = well_state.name(well_index);
|
||||
|
||||
this->loadRestartWellData(well_name, handle_ms_well, phs,
|
||||
rst_wells.at(well_name),
|
||||
wellModel_.perfData(well_index),
|
||||
well_state.well(well_index));
|
||||
}
|
||||
|
||||
for (const auto& [group, value] : grpNwrkValues.groupData) {
|
||||
this->loadRestartGroupData(group, value, grpState);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -33,12 +33,15 @@ namespace Opm {
|
||||
class BlackoilWellModelGeneric;
|
||||
namespace data {
|
||||
class GroupData;
|
||||
class GroupAndNetworkValues;
|
||||
}
|
||||
class GroupState;
|
||||
class GuideRate;
|
||||
class GuideRateConfig;
|
||||
struct PerforationData;
|
||||
class PhaseUsage;
|
||||
class SingleWellState;
|
||||
class WellState;
|
||||
|
||||
/// Class for restarting the blackoil well model.
|
||||
class BlackoilWellModelRestart
|
||||
@ -49,19 +52,6 @@ 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;
|
||||
|
||||
//! \brief Loads per-group data from restart structures.
|
||||
void loadRestartGroupData(const std::string& group,
|
||||
const data::GroupData& value,
|
||||
GroupState& grpState) const;
|
||||
|
||||
//! \brief Loads guide rates from restart structures.
|
||||
void loadRestartGuideRates(const int report_step,
|
||||
const GuideRateModel::Target target,
|
||||
@ -74,6 +64,13 @@ public:
|
||||
const std::map<std::string, data::GroupData>& rst_groups,
|
||||
GuideRate& guide_rate) const;
|
||||
|
||||
//! \brief Loads well data from restart structures.
|
||||
void loadRestartData(const data::Wells& rst_wells,
|
||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||
const bool handle_ms_well,
|
||||
WellState& well_state,
|
||||
GroupState& grpState) const;
|
||||
|
||||
private:
|
||||
//! \brief Loads per-connection data from restart structures.
|
||||
void loadRestartConnectionData(const std::vector<data::Rates::opt>& phs,
|
||||
@ -87,6 +84,19 @@ private:
|
||||
const data::Well& rst_well,
|
||||
SingleWellState& ws) const;
|
||||
|
||||
//! \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;
|
||||
|
||||
//! \brief Loads per-group data from restart structures.
|
||||
void loadRestartGroupData(const std::string& group,
|
||||
const data::GroupData& value,
|
||||
GroupState& grpState) const;
|
||||
|
||||
const BlackoilWellModelGeneric& wellModel_; //!< Reference to well model
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user