dont use explicit vfp lookup for newly opened wells

This commit is contained in:
Tor Harald Sandve
2022-04-12 08:44:52 +02:00
parent 9364d4c54b
commit 96222f8afb
12 changed files with 29 additions and 18 deletions

View File

@@ -142,7 +142,7 @@ namespace Opm {
BlackoilWellModel(Simulator& ebosSimulator); BlackoilWellModel(Simulator& ebosSimulator);
void init(); void init();
void initWellContainer() override; void initWellContainer(const int reportStepIdx) override;
///////////// /////////////
// <eWoms auxiliary module stuff> // <eWoms auxiliary module stuff>

View File

@@ -2358,7 +2358,7 @@ runWellPIScaling(const int timeStepIdx,
this->createWellContainer(timeStepIdx); this->createWellContainer(timeStepIdx);
this->inferLocalShutWells(); this->inferLocalShutWells();
this->initWellContainer(); this->initWellContainer(timeStepIdx);
this->calculateProductivityIndexValues(local_deferredLogger); this->calculateProductivityIndexValues(local_deferredLogger);
this->calculateProductivityIndexValuesShutWells(timeStepIdx, local_deferredLogger); this->calculateProductivityIndexValuesShutWells(timeStepIdx, local_deferredLogger);

View File

@@ -400,7 +400,7 @@ protected:
// create the well container // create the well container
virtual void createWellContainer(const int time_step) = 0; virtual void createWellContainer(const int time_step) = 0;
virtual void initWellContainer() = 0; virtual void initWellContainer(const int reportStepIdx) = 0;
virtual void calculateProductivityIndexValuesShutWells(const int reportStepIdx, virtual void calculateProductivityIndexValuesShutWells(const int reportStepIdx,
DeferredLogger& deferred_logger) = 0; DeferredLogger& deferred_logger) = 0;

View File

@@ -97,11 +97,15 @@ namespace Opm {
template<typename TypeTag> template<typename TypeTag>
void void
BlackoilWellModel<TypeTag>:: BlackoilWellModel<TypeTag>::
initWellContainer() initWellContainer(const int reportStepIdx)
{ {
const uint64_t effective_events_mask = ScheduleEvents::WELL_STATUS_CHANGE
+ ScheduleEvents::NEW_WELL;
const auto& events = schedule()[reportStepIdx].wellgroup_events();
for (auto& wellPtr : this->well_container_) { for (auto& wellPtr : this->well_container_) {
const bool well_opened_this_step = report_step_starts_ && events.hasEvent(wellPtr->name(), effective_events_mask);
wellPtr->init(&this->phase_usage_, this->depth_, this->gravity_, wellPtr->init(&this->phase_usage_, this->depth_, this->gravity_,
this->local_num_cells_, this->B_avg_); this->local_num_cells_, this->B_avg_, well_opened_this_step);
} }
} }
@@ -268,7 +272,7 @@ namespace Opm {
// do the initialization for all the wells // do the initialization for all the wells
// TODO: to see whether we can postpone of the intialization of the well containers to // TODO: to see whether we can postpone of the intialization of the well containers to
// optimize the usage of the following several member variables // optimize the usage of the following several member variables
this->initWellContainer(); this->initWellContainer(reportStepIdx);
// update the updated cell flag // update the updated cell flag
std::fill(is_cell_perforated_.begin(), is_cell_perforated_.end(), false); std::fill(is_cell_perforated_.begin(), is_cell_perforated_.end(), false);
@@ -395,7 +399,7 @@ namespace Opm {
WellInterfacePtr well = createWellForWellTest(well_name, timeStepIdx, deferred_logger); WellInterfacePtr well = createWellForWellTest(well_name, timeStepIdx, deferred_logger);
// some preparation before the well can be used // some preparation before the well can be used
well->init(&phase_usage_, depth_, gravity_, local_num_cells_, B_avg_); well->init(&phase_usage_, depth_, gravity_, local_num_cells_, B_avg_, true);
double well_efficiency_factor = wellEcl.getEfficiencyFactor(); double well_efficiency_factor = wellEcl.getEfficiencyFactor();
WellGroupHelpers::accumulateGroupEfficiencyFactor(schedule().getGroup(wellEcl.groupName(), timeStepIdx), WellGroupHelpers::accumulateGroupEfficiencyFactor(schedule().getGroup(wellEcl.groupName(), timeStepIdx),
@@ -1582,7 +1586,7 @@ namespace Opm {
<StandardWell<TypeTag>>(shutWell, reportStepIdx); <StandardWell<TypeTag>>(shutWell, reportStepIdx);
wellPtr->init(&this->phase_usage_, this->depth_, this->gravity_, wellPtr->init(&this->phase_usage_, this->depth_, this->gravity_,
this->local_num_cells_, this->B_avg_); this->local_num_cells_, this->B_avg_, true);
this->calculateProductivityIndexValues(wellPtr.get(), deferred_logger); this->calculateProductivityIndexValues(wellPtr.get(), deferred_logger);
} }

View File

@@ -91,7 +91,8 @@ namespace Opm
const std::vector<double>& depth_arg, const std::vector<double>& depth_arg,
const double gravity_arg, const double gravity_arg,
const int num_cells, const int num_cells,
const std::vector< Scalar >& B_avg) override; const std::vector< Scalar >& B_avg,
const bool changed_to_open_this_step) override;
virtual void initPrimaryVariablesEvaluation() const override; virtual void initPrimaryVariablesEvaluation() const override;

View File

@@ -94,9 +94,10 @@ namespace Opm
const std::vector<double>& depth_arg, const std::vector<double>& depth_arg,
const double gravity_arg, const double gravity_arg,
const int num_cells, const int num_cells,
const std::vector< Scalar >& B_avg) const std::vector< Scalar >& B_avg,
const bool changed_to_open_this_step)
{ {
Base::init(phase_usage_arg, depth_arg, gravity_arg, num_cells, B_avg); Base::init(phase_usage_arg, depth_arg, gravity_arg, num_cells, B_avg, changed_to_open_this_step);
// TODO: for StandardWell, we need to update the perf depth here using depth_arg. // TODO: for StandardWell, we need to update the perf depth here using depth_arg.
// for MultisegmentWell, it is much more complicated. // for MultisegmentWell, it is much more complicated.

View File

@@ -139,7 +139,8 @@ namespace Opm
const std::vector<double>& depth_arg, const std::vector<double>& depth_arg,
const double gravity_arg, const double gravity_arg,
const int num_cells, const int num_cells,
const std::vector< Scalar >& B_avg) override; const std::vector< Scalar >& B_avg,
const bool changed_to_open_this_step) override;
virtual void initPrimaryVariablesEvaluation() const override; virtual void initPrimaryVariablesEvaluation() const override;

View File

@@ -61,9 +61,10 @@ namespace Opm
const std::vector<double>& depth_arg, const std::vector<double>& depth_arg,
const double gravity_arg, const double gravity_arg,
const int num_cells, const int num_cells,
const std::vector< Scalar >& B_avg) const std::vector< Scalar >& B_avg,
const bool changed_to_open_this_step)
{ {
Base::init(phase_usage_arg, depth_arg, gravity_arg, num_cells, B_avg); Base::init(phase_usage_arg, depth_arg, gravity_arg, num_cells, B_avg, changed_to_open_this_step);
this->StdWellEval::init(this->perf_depth_, depth_arg, num_cells, Base::has_polymermw); this->StdWellEval::init(this->perf_depth_, depth_arg, num_cells, Base::has_polymermw);
} }

View File

@@ -147,7 +147,8 @@ public:
const std::vector<double>& depth_arg, const std::vector<double>& depth_arg,
const double gravity_arg, const double gravity_arg,
const int num_cells, const int num_cells,
const std::vector< Scalar >& B_avg); const std::vector< Scalar >& B_avg,
const bool changed_to_open_this_step);
virtual void initPrimaryVariablesEvaluation() const = 0; virtual void initPrimaryVariablesEvaluation() const = 0;

View File

@@ -417,7 +417,7 @@ bool WellInterfaceGeneric::isOperableAndSolvable() const
bool WellInterfaceGeneric::useVfpExplicit() const bool WellInterfaceGeneric::useVfpExplicit() const
{ {
const auto& wvfpexp = well_ecl_.getWVFPEXP(); const auto& wvfpexp = well_ecl_.getWVFPEXP();
return (wvfpexp.extrapolate() || operability_status_.use_vfpexplicit); return ((wvfpexp.extrapolate() && !changedToOpenThisStep())|| operability_status_.use_vfpexplicit);
} }
double WellInterfaceGeneric::getALQ(const WellState& well_state) const double WellInterfaceGeneric::getALQ(const WellState& well_state) const

View File

@@ -356,7 +356,7 @@ protected:
std::vector< std::string> well_control_log_; std::vector< std::string> well_control_log_;
bool changed_to_open_this_step_ = false; bool changed_to_open_this_step_ = true;
}; };
} }

View File

@@ -73,11 +73,13 @@ namespace Opm
const std::vector<double>& /* depth_arg */, const std::vector<double>& /* depth_arg */,
const double gravity_arg, const double gravity_arg,
const int /* num_cells */, const int /* num_cells */,
const std::vector< Scalar >& B_avg) const std::vector< Scalar >& B_avg,
const bool changed_to_open_this_step)
{ {
this->phase_usage_ = phase_usage_arg; this->phase_usage_ = phase_usage_arg;
this->gravity_ = gravity_arg; this->gravity_ = gravity_arg;
B_avg_ = B_avg; B_avg_ = B_avg;
this->changed_to_open_this_step_ = changed_to_open_this_step;
} }