mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-08-09 02:48:04 -05:00
Add parameter enableDistributedWells to the well state an when set to true, do not throw when initalizing distributed multi-segment wells in WellState.cpp
This commit is contained in:
@@ -322,14 +322,13 @@ void FlowGenericVanguard::init()
|
||||
if (comm.rank() == 0)
|
||||
{
|
||||
std::string message =
|
||||
std::string("Option --allow-distributed-wells=true is only allowed if model\n")
|
||||
+ "only has only standard wells. You need to provide option \n"
|
||||
+ " with --enable-multisegement-wells=false to treat existing \n"
|
||||
std::string("Option --allow-distributed-wells=true in a model with\n")
|
||||
+ "multisegment wells. This feature is still experimental. You can\n"
|
||||
+ "set --enable-multisegment-wells=false to treat the existing \n"
|
||||
+ "multisegment wells as standard wells.";
|
||||
OpmLog::error(message);
|
||||
OpmLog::info(message);
|
||||
}
|
||||
comm.barrier();
|
||||
OPM_THROW(std::invalid_argument, "All wells need to be standard wells!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -882,7 +882,7 @@ namespace Opm {
|
||||
this->wellState().init(cellPressures, cellTemperatures, this->schedule(), this->wells_ecl_,
|
||||
this->local_parallel_well_info_, timeStepIdx,
|
||||
&this->prevWellState(), this->well_perf_data_,
|
||||
this->summaryState());
|
||||
this->summaryState(), simulator_.vanguard().enableDistributedWells());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -264,11 +264,13 @@ void WellState<Scalar>::init(const std::vector<Scalar>& cellPressures,
|
||||
const int report_step,
|
||||
const WellState* prevState,
|
||||
const std::vector<std::vector<PerforationData<Scalar>>>& well_perf_data,
|
||||
const SummaryState& summary_state)
|
||||
const SummaryState& summary_state,
|
||||
const bool enableDistributedWells)
|
||||
{
|
||||
// call init on base class
|
||||
this->base_init(cellPressures, cellTemperatures, wells_ecl, parallel_well_info,
|
||||
well_perf_data, summary_state);
|
||||
this->enableDistributedWells_ = enableDistributedWells;
|
||||
this->global_well_info = std::make_optional<GlobalWellInfo>(schedule,
|
||||
report_step,
|
||||
wells_ecl);
|
||||
@@ -439,7 +441,7 @@ void WellState<Scalar>::resize(const std::vector<Well>& wells_ecl,
|
||||
const SummaryState& summary_state)
|
||||
{
|
||||
const std::vector<Scalar> tmp(numCells, 0.0); // <- UGLY HACK to pass the size
|
||||
init(tmp, tmp, schedule, wells_ecl, parallel_well_info, 0, nullptr, well_perf_data, summary_state);
|
||||
init(tmp, tmp, schedule, wells_ecl, parallel_well_info, 0, nullptr, well_perf_data, summary_state, this->enableDistributedWells_);
|
||||
|
||||
if (handle_ms_well) {
|
||||
initWellStateMSWell(wells_ecl, nullptr);
|
||||
@@ -728,8 +730,8 @@ void WellState<Scalar>::initWellStateMSWell(const std::vector<Well>& wells_ecl,
|
||||
n_activeperf++;
|
||||
}
|
||||
}
|
||||
|
||||
if (static_cast<int>(ws.perf_data.size()) != n_activeperf)
|
||||
|
||||
if (!this->enableDistributedWells_ && static_cast<int>(ws.perf_data.size()) != n_activeperf)
|
||||
throw std::logic_error("Distributed multi-segment wells cannot be initialized properly yet.");
|
||||
|
||||
|
||||
|
||||
@@ -104,7 +104,8 @@ public:
|
||||
const int report_step,
|
||||
const WellState* prevState,
|
||||
const std::vector<std::vector<PerforationData<Scalar>>>& well_perf_data,
|
||||
const SummaryState& summary_state);
|
||||
const SummaryState& summary_state,
|
||||
const bool enableDistributedWells);
|
||||
|
||||
void resize(const std::vector<Well>& wells_ecl,
|
||||
const std::vector<std::reference_wrapper<ParallelWellInfo<Scalar>>>& parallel_well_info,
|
||||
@@ -353,6 +354,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool enableDistributedWells_ = false;
|
||||
|
||||
bool is_permanently_inactive_well(const std::string& wname) const {
|
||||
return std::find(this->permanently_inactive_well_names_.begin(), this->permanently_inactive_well_names_.end(), wname) != this->permanently_inactive_well_names_.end();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user