moving the inj_multiplier to BlackoilWellModelGeneric

to handle the situation that a well can be `SHUT` in the Schedule.

If stored in PerfData, when a well is `SHUT`, the inforamtion related to
WINJMULT will be discarded.

Before we want to change how the `PerfData` works, storing
`inj_multiplier` in BlackoilWellModelGeneric is the viable approach.
This commit is contained in:
Kai Bao
2023-06-26 14:18:02 +02:00
parent b50c404247
commit cacec2739c
5 changed files with 12 additions and 12 deletions

View File

@@ -1411,16 +1411,18 @@ void BlackoilWellModelGeneric::initInjMult() {
if (well->isInjector() && well->wellEcl().getInjMultMode() != Well::InjMultMode::NONE) { if (well->isInjector() && well->wellEcl().getInjMultMode() != Well::InjMultMode::NONE) {
const auto& ws = this->wellState().well(well->indexOfWell()); const auto& ws = this->wellState().well(well->indexOfWell());
const auto& perf_data = ws.perf_data; const auto& perf_data = ws.perf_data;
well->initInjMult(perf_data.inj_multiplier); if ((this->prev_inj_multipliers_.count(well->name())) == 0 ) {
this->prev_inj_multipliers_[well->name()] = std::vector<double>(perf_data.size(), 1.0);
}
well->initInjMult(this->prev_inj_multipliers_.at(well->name()));
} }
} }
} }
void BlackoilWellModelGeneric::updateInjMult(DeferredLogger& deferred_logger) { void BlackoilWellModelGeneric::updateInjMult(DeferredLogger& deferred_logger) {
for (const auto& well : this->well_container_generic_) { for (const auto& well : this->well_container_generic_) {
if (well->wellEcl().getInjMultMode() != Well::InjMultMode::NONE && well->isInjector()) { if (well->isInjector() && well->wellEcl().getInjMultMode() != Well::InjMultMode::NONE) {
auto& perf_data = this->wellState().well(well->indexOfWell()).perf_data; well->updateInjMult(this->prev_inj_multipliers_[well->name()], deferred_logger);
well->updateInjMult(perf_data.inj_multiplier, deferred_logger);
} }
} }
} }

View File

@@ -192,6 +192,7 @@ public:
serializer(closed_this_step_); serializer(closed_this_step_);
serializer(guideRate_); serializer(guideRate_);
serializer(node_pressures_); serializer(node_pressures_);
serializer(prev_inj_multipliers_);
serializer(active_wgstate_); serializer(active_wgstate_);
serializer(last_valid_wgstate_); serializer(last_valid_wgstate_);
serializer(nupcol_wgstate_); serializer(nupcol_wgstate_);
@@ -208,6 +209,7 @@ public:
this->local_shut_wells_ == rhs.local_shut_wells_ && this->local_shut_wells_ == rhs.local_shut_wells_ &&
this->closed_this_step_ == rhs.closed_this_step_ && this->closed_this_step_ == rhs.closed_this_step_ &&
this->node_pressures_ == rhs.node_pressures_ && this->node_pressures_ == rhs.node_pressures_ &&
this->prev_inj_multipliers_ == rhs.prev_inj_multipliers_ &&
this->active_wgstate_ == rhs.active_wgstate_ && this->active_wgstate_ == rhs.active_wgstate_ &&
this->last_valid_wgstate_ == rhs.last_valid_wgstate_ && this->last_valid_wgstate_ == rhs.last_valid_wgstate_ &&
this->nupcol_wgstate_ == rhs.nupcol_wgstate_ && this->nupcol_wgstate_ == rhs.nupcol_wgstate_ &&
@@ -433,6 +435,9 @@ protected:
std::unique_ptr<VFPProperties> vfp_properties_{}; std::unique_ptr<VFPProperties> vfp_properties_{};
std::map<std::string, double> node_pressures_; // Storing network pressures for output. std::map<std::string, double> node_pressures_; // Storing network pressures for output.
// previous injection multiplier, it is used in the injection multiplier calculation for WINJMULT keyword
std::unordered_map<std::string, std::vector<double>> prev_inj_multipliers_;
/* /*
The various wellState members should be accessed and modified The various wellState members should be accessed and modified
through the accessor functions wellState(), prevWellState(), through the accessor functions wellState(), prevWellState(),

View File

@@ -43,7 +43,6 @@ PerfData::PerfData(std::size_t num_perf, double pressure_first_connection_, bool
, ecl_index(num_perf) , ecl_index(num_perf)
{ {
if (injector) { if (injector) {
this->inj_multiplier.resize(num_perf, 1.0);
this->water_throughput.resize(num_perf); this->water_throughput.resize(num_perf);
this->skin_pressure.resize(num_perf); this->skin_pressure.resize(num_perf);
this->water_velocity.resize(num_perf); this->water_velocity.resize(num_perf);
@@ -95,7 +94,6 @@ bool PerfData::try_assign(const PerfData& other) {
this->solvent_rates = other.solvent_rates; this->solvent_rates = other.solvent_rates;
this->polymer_rates = other.polymer_rates; this->polymer_rates = other.polymer_rates;
this->brine_rates = other.brine_rates; this->brine_rates = other.brine_rates;
this->inj_multiplier = other.inj_multiplier;
this->water_throughput = other.water_throughput; this->water_throughput = other.water_throughput;
this->skin_pressure = other.skin_pressure; this->skin_pressure = other.skin_pressure;
this->water_velocity = other.water_velocity; this->water_velocity = other.water_velocity;
@@ -119,7 +117,6 @@ bool PerfData::operator==(const PerfData& rhs) const
this->connection_transmissibility_factor == rhs.connection_transmissibility_factor && this->connection_transmissibility_factor == rhs.connection_transmissibility_factor &&
this->satnum_id == rhs.satnum_id && this->satnum_id == rhs.satnum_id &&
this->ecl_index == rhs.ecl_index && this->ecl_index == rhs.ecl_index &&
this->inj_multiplier == rhs.inj_multiplier &&
this->water_throughput == rhs.water_throughput && this->water_throughput == rhs.water_throughput &&
this->skin_pressure == rhs.skin_pressure && this->skin_pressure == rhs.skin_pressure &&
this->water_velocity == rhs.water_velocity; this->water_velocity == rhs.water_velocity;

View File

@@ -57,7 +57,6 @@ public:
serializer(connection_transmissibility_factor); serializer(connection_transmissibility_factor);
serializer(satnum_id); serializer(satnum_id);
serializer(ecl_index); serializer(ecl_index);
serializer(inj_multiplier);
serializer(water_throughput); serializer(water_throughput);
serializer(skin_pressure); serializer(skin_pressure);
serializer(water_velocity); serializer(water_velocity);
@@ -79,9 +78,6 @@ public:
std::vector<double> connection_transmissibility_factor; std::vector<double> connection_transmissibility_factor;
std::vector<int> satnum_id; std::vector<int> satnum_id;
std::vector<std::size_t> ecl_index; std::vector<std::size_t> ecl_index;
// the injection multiplier due to WINJMULT keyword
// it only applies to injectors
std::vector<double> inj_multiplier;
// The water_throughput, skin_pressure and water_velocity variables are only // The water_throughput, skin_pressure and water_velocity variables are only
// used for injectors to check the injectivity. // used for injectors to check the injectivity.

View File

@@ -177,7 +177,7 @@ add_test_compare_parallel_simulation(CASENAME winjmult_msw
FILENAME WINJMULT_MSW FILENAME WINJMULT_MSW
SIMULATOR flow SIMULATOR flow
ABS_TOL ${abs_tol} ABS_TOL ${abs_tol}
REL_TOL 0.21 REL_TOL 0.12
DIR winjmult DIR winjmult
TEST_ARGS --enable-tuning=true) TEST_ARGS --enable-tuning=true)