Use PerfData for water throughput, water velocity and skin pressure

This commit is contained in:
Joakim Hove 2021-06-07 09:04:42 +02:00
parent db02b9f112
commit 81c5ce8843
6 changed files with 21 additions and 80 deletions

View File

@ -32,10 +32,10 @@ PerfData::PerfData(std::size_t num_perf, const PhaseUsage& pu_arg):
solvent_rates(num_perf),
polymer_rates(num_perf),
brine_rates(num_perf),
prod_index(num_perf),
water_throughput(num_perf),
skin_pressure(num_perf),
water_velocity(num_perf),
prod_index(num_perf)
water_velocity(num_perf)
{
}

View File

@ -45,10 +45,13 @@ public:
std::vector<double> solvent_rates;
std::vector<double> polymer_rates;
std::vector<double> brine_rates;
std::vector<double> prod_index;
// The water_throughput, skin_pressure and water_velocity variables are only
// used for injectors to check the injectivity.
std::vector<double> water_throughput;
std::vector<double> skin_pressure;
std::vector<double> water_velocity;
std::vector<double> prod_index;
};
} // namespace Opm

View File

@ -691,8 +691,9 @@ StandardWellEval<FluidSystem,Indices,Scalar>::
updateWellStateFromPrimaryVariablesPolyMW(WellState& well_state) const
{
if (baseif_.isInjector()) {
auto& perf_water_velocity = well_state.perfWaterVelocity(baseif_.indexOfWell());
auto& perf_skin_pressure = well_state.perfSkinPressure(baseif_.indexOfWell());
auto& perf_data = well_state.perfData(baseif_.indexOfWell());
auto& perf_water_velocity = perf_data.water_velocity;
auto& perf_skin_pressure = perf_data.skin_pressure;
for (int perf = 0; perf < baseif_.numPerfs(); ++perf) {
perf_water_velocity[perf] = primary_variables_[Bhp + 1 + perf];
perf_skin_pressure[perf] = primary_variables_[Bhp + 1 + baseif_.numPerfs() + perf];

View File

@ -1598,8 +1598,9 @@ namespace Opm
// other primary variables related to polymer injection
if constexpr (Base::has_polymermw) {
if (this->isInjector()) {
const auto& water_velocity = well_state.perfWaterVelocity(this->index_of_well_);
const auto& skin_pressure = well_state.perfSkinPressure(this->index_of_well_);
const auto& perf_data = well_state.perfData(this->index_of_well_);
const auto& water_velocity = perf_data.water_velocity;
const auto& skin_pressure = perf_data.skin_pressure;
for (int perf = 0; perf < number_of_perforations_; ++perf) {
this->primary_variables_[Bhp + 1 + perf] = water_velocity[perf];
this->primary_variables_[Bhp + 1 + number_of_perforations_ + perf] = skin_pressure[perf];
@ -1823,7 +1824,7 @@ namespace Opm
{
if constexpr (Base::has_polymermw) {
if (this->isInjector()) {
auto& perf_water_throughput = well_state.perfThroughput(this->index_of_well_);
auto& perf_water_throughput = well_state.perfData(this->index_of_well_).water_throughput;
for (int perf = 0; perf < number_of_perforations_; ++perf) {
const double perf_water_vel = this->primary_variables_[Bhp + 1 + perf];
// we do not consider the formation damage due to water flowing from reservoir into wellbore
@ -1884,7 +1885,8 @@ namespace Opm
const EvalWell eq_wat_vel = this->primary_variables_evaluation_[wat_vel_index] - water_velocity;
this->resWell_[0][wat_vel_index] = eq_wat_vel.value();
const auto& perf_water_throughput = well_state.perfThroughput(this->index_of_well_);
const auto& perf_data = well_state.perfData(this->index_of_well_);
const auto& perf_water_throughput = perf_data.water_throughput;
const double throughput = perf_water_throughput[perf];
const int pskin_index = Bhp + 1 + number_of_perforations_ + perf;
@ -1945,7 +1947,7 @@ namespace Opm
const int wat_vel_index = Bhp + 1 + perf;
const EvalWell water_velocity = this->primary_variables_evaluation_[wat_vel_index];
if (water_velocity > 0.) { // injecting
const auto& perf_water_throughput = well_state.perfThroughput(this->index_of_well_);
const auto& perf_water_throughput = well_state.perfData(this->index_of_well_).water_throughput;
const double throughput = perf_water_throughput[perf];
const EvalWell molecular_weight = wpolymermw(throughput, water_velocity, deferred_logger);
cq_s_polymw *= molecular_weight;

View File

@ -41,9 +41,6 @@ void WellState::base_init(const std::vector<double>& cellPressures,
// clear old name mapping
this->wellMap_.clear();
this->perfdata.clear();
this->perf_skin_pressure_.clear();
this->perf_water_throughput_.clear();
this->perf_water_velocity_.clear();
this->status_.clear();
this->well_perf_data_.clear();
this->parallel_well_info_.clear();
@ -105,9 +102,6 @@ void WellState::initSingleWell(const std::vector<double>& cellPressures,
const int num_perf_this_well = well_info->communication().sum(well_perf_data_[w].size());
this->segment_state.add(well.name(), SegmentState{});
this->perfdata.add(well.name(), PerfData{static_cast<std::size_t>(num_perf_this_well), this->phase_usage_});
this->perf_skin_pressure_.add(well.name(), std::vector<double>(num_perf_this_well, 0));
this->perf_water_velocity_.add(well.name(), std::vector<double>(num_perf_this_well, 0));
this->perf_water_throughput_.add(well.name(), std::vector<double>(num_perf_this_well, 0));
this->bhp_.add(well.name(), 0.0);
this->thp_.add(well.name(), 0.0);
this->productivity_index_.add(well.name(), std::vector<double>(np, 0));
@ -418,7 +412,7 @@ void WellState::init(const std::vector<double>& cellPressures,
{
auto& perf_data = this->perfData(w);
const auto& prev_perf_data = prevState->perfData(w);
perf_data.try_assign(prev_perf_data);
perf_data.try_assign( prev_perf_data );
} else {
const int global_num_perf_this_well = well.getConnections().num_open();
auto& perf_data = this->perfData(w);
@ -430,29 +424,7 @@ void WellState::init(const std::vector<double>& cellPressures,
}
}
// perf data
if (global_num_perf_same)
{
auto& perf_data = this->perfData(w);
const auto& prev_perf_data = prevState->perfData(w);
perf_data.try_assign( prev_perf_data );
}
// polymer injectivity related
//
// here we did not consider the case that we close
// some perforation during the running and also,
// wells can be shut and re-opened
if (pu.has_polymermw) {
if (global_num_perf_same)
{
this->perf_water_velocity_.copy_welldata(prevState->perf_water_velocity_, wname);
this->perf_skin_pressure_.copy_welldata(prevState->perf_skin_pressure_, wname);
this->perf_water_throughput_.copy_welldata(prevState->perf_water_throughput_, wname);
}
}
// Productivity index.
// Productivity index.
this->productivity_index_.copy_welldata( prevState->productivity_index_, wname );
}
@ -730,7 +702,7 @@ void WellState::reportConnections(data::Well& well,
comp.rates.set( rt::brine, perf_brine_rate[local_comp_index]);
}
if ( pu.has_solvent ) {
const auto& perf_solvent_rate = this->perfRateSolvent(well_index);
const auto& perf_solvent_rate = perf_data.solvent_rates;
comp.rates.set( rt::solvent, perf_solvent_rate[local_comp_index] );
}
@ -894,7 +866,8 @@ WellState::calculateSegmentRates(const std::vector<std::vector<int>>& segment_in
double WellState::solventWellRate(const int w) const
{
const auto& perf_rates_solvent = this->perfRateSolvent(w);
const auto& perf_data = this->perfData(w);
const auto& perf_rates_solvent = perf_data.solvent_rates;
return parallel_well_info_[w]->sumPerfValues(perf_rates_solvent.begin(), perf_rates_solvent.end());
}

View File

@ -219,30 +219,6 @@ public:
return this->well_potentials_[well_index];
}
std::vector<double>& perfThroughput(std::size_t well_index) {
return perf_water_throughput_[well_index];
}
const std::vector<double>& perfThroughput(std::size_t well_index) const {
return perf_water_throughput_[well_index];
}
std::vector<double>& perfSkinPressure(std::size_t well_index) {
return perf_skin_pressure_[well_index];
}
const std::vector<double>& perfSkinPressure(std::size_t well_index) const {
return perf_skin_pressure_[well_index];
}
std::vector<double>& perfWaterVelocity(std::size_t well_index) {
return perf_water_velocity_[well_index];
}
const std::vector<double>& perfWaterVelocity(std::size_t well_index) const {
return perf_water_velocity_[well_index];
}
template<class Comm>
void communicateGroupRates(const Comm& comm);
@ -411,20 +387,6 @@ private:
// not.
std::map<std::string, std::pair<bool, std::vector<double>>> well_rates;
// it is the throughput of water flow through the perforations
// it is used as a measure of formation damage around well-bore due to particle deposition
// it will only be used for injectors to check the injectivity
WellContainer<std::vector<double>> perf_water_throughput_;
// skin pressure of peforation
// it will only be used for injectors to check the injectivity
WellContainer<std::vector<double>> perf_skin_pressure_;
// it will only be used for injectors to check the injectivity
// water velocity of perforation
WellContainer<std::vector<double>> perf_water_velocity_;
// phase rates under reservoir condition for wells
// or voidage phase rates
WellContainer<std::vector<double>> well_reservoir_rates_;