Determine pressure and depth above for distributed wells.

This commit is contained in:
Markus Blatt 2020-11-27 18:26:59 +01:00
parent 6f4fa114c1
commit f7ed1b21fa
2 changed files with 23 additions and 6 deletions

View File

@ -460,6 +460,11 @@ namespace Opm {
void
BlackoilWellModel<TypeTag>::
endReportStep() {
// Clear the communication data structures for above values.
for(auto&& pinfo : local_parallel_well_info_)
{
pinfo->clearCommunicateAbove();
}
}
// called at the end of a report step
@ -612,12 +617,15 @@ namespace Opm {
well_perf_data_.resize(wells_ecl_.size());
int well_index = 0;
for (const auto& well : wells_ecl_) {
std::size_t completion_index = 0;
int completion_index = 0;
int completion_index_above = -1; // -1 marks no above perf available
well_perf_data_[well_index].clear();
well_perf_data_[well_index].reserve(well.getConnections().size());
CheckDistributedWellConnections checker(well, *local_parallel_well_info_[well_index]);
bool hasFirstPerforation = false;
bool firstOpenCompletion = true;
auto& parallelWellInfo = *local_parallel_well_info_[well_index];
parallelWellInfo.beginReset();
for (const auto& completion : well.getConnections()) {
const int i = completion.getI();
@ -638,6 +646,8 @@ namespace Opm {
pd.satnum_id = completion.satTableId();
pd.ecl_index = completion_index;
well_perf_data_[well_index].push_back(pd);
parallelWellInfo.pushBackEclIndex(completion_index_above,
completion_index);
}
firstOpenCompletion = false;
} else {
@ -647,10 +657,14 @@ namespace Opm {
"Completion state: " << Connection::State2String(completion.state()) << " not handled");
}
}
// Note: we rely on the connections being filtered! I.e. there are only connections
// to active cells in the global grid.
++completion_index;
++completion_index_above;
}
parallelWellInfo.endReset();
checker.checkAllConnectionsFound();
local_parallel_well_info_[well_index]->communicateFirstPerforation(hasFirstPerforation);
parallelWellInfo.communicateFirstPerforation(hasFirstPerforation);
++well_index;
}
}

View File

@ -1963,6 +1963,10 @@ namespace Opm
}
// Compute the average pressure in each well block
auto p_above = this->parallel_well_info_.communicateAboveValues(well_state.bhp()[w],
well_state.perfPress().data()+first_perf_,
nperf);
for (int perf = 0; perf < nperf; ++perf) {
const int cell_idx = well_cells_[perf];
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/0));
@ -1970,8 +1974,7 @@ namespace Opm
// TODO: this is another place to show why WellState need to be a vector of WellState.
// TODO: to check why should be perf - 1
const double p_above = perf == 0 ? well_state.bhp()[w] : well_state.perfPress()[first_perf_ + perf - 1];
const double p_avg = (well_state.perfPress()[first_perf_ + perf] + p_above)/2;
const double p_avg = (well_state.perfPress()[first_perf_ + perf] + p_above[perf])/2;
const double temperature = fs.temperature(FluidSystem::oilPhaseIdx).value();
const double saltConcentration = fs.saltConcentration().value();
@ -2209,10 +2212,10 @@ namespace Opm
const int nperf = number_of_perforations_;
perf_pressure_diffs_.resize(nperf, 0.0);
auto z_above = this->parallel_well_info_.communicateAboveValues(ref_depth_, perf_depth_);
for (int perf = 0; perf < nperf; ++perf) {
const double z_above = perf == 0 ? ref_depth_ : perf_depth_[perf - 1];
const double dz = perf_depth_[perf] - z_above;
const double dz = perf_depth_[perf] - z_above[perf];
perf_pressure_diffs_[perf] = dz * perf_densities_[perf] * gravity_;
}