mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
remove cartesian to compressed vector
This commit is contained in:
parent
5717a95cb4
commit
1cfe3e0aad
@ -370,8 +370,6 @@ namespace Opm {
|
|||||||
// setting the well_solutions_ based on well_state.
|
// setting the well_solutions_ based on well_state.
|
||||||
void updatePrimaryVariables(DeferredLogger& deferred_logger);
|
void updatePrimaryVariables(DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
void setupCartesianToCompressed_(const int* global_cell, int local_num__cells);
|
|
||||||
|
|
||||||
void updateAverageFormationFactor();
|
void updateAverageFormationFactor();
|
||||||
|
|
||||||
void computePotentials(const std::size_t widx,
|
void computePotentials(const std::size_t widx,
|
||||||
@ -421,6 +419,10 @@ namespace Opm {
|
|||||||
|
|
||||||
void assignWellTracerRates(data::Wells& wsrpt) const;
|
void assignWellTracerRates(data::Wells& wsrpt) const;
|
||||||
|
|
||||||
|
int compressedIndex(int cartesian_cell_idx) const override {
|
||||||
|
return ebosSimulator_.vanguard().compressedIndex(cartesian_cell_idx);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BlackoilWellModel(Simulator& ebosSimulator, const PhaseUsage& pu);
|
BlackoilWellModel(Simulator& ebosSimulator, const PhaseUsage& pu);
|
||||||
};
|
};
|
||||||
|
@ -349,8 +349,7 @@ initializeWellPerfData()
|
|||||||
parallelWellInfo.beginReset();
|
parallelWellInfo.beginReset();
|
||||||
|
|
||||||
for (const auto& completion : well.getConnections()) {
|
for (const auto& completion : well.getConnections()) {
|
||||||
const int active_index =
|
const int active_index = compressedIndex(completion.global_index());
|
||||||
cartesian_to_compressed_[completion.global_index()];
|
|
||||||
if (completion.state() == Connection::State::OPEN) {
|
if (completion.state() == Connection::State::OPEN) {
|
||||||
if (active_index >= 0) {
|
if (active_index >= 0) {
|
||||||
if (firstOpenCompletion)
|
if (firstOpenCompletion)
|
||||||
@ -1706,7 +1705,7 @@ BlackoilWellModelGeneric::
|
|||||||
setRepRadiusPerfLength()
|
setRepRadiusPerfLength()
|
||||||
{
|
{
|
||||||
for (const auto& well : well_container_generic_) {
|
for (const auto& well : well_container_generic_) {
|
||||||
well->setRepRadiusPerfLength(cartesian_to_compressed_);
|
well->setRepRadiusPerfLength();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,6 +374,9 @@ protected:
|
|||||||
void runWellPIScaling(const int timeStepIdx,
|
void runWellPIScaling(const int timeStepIdx,
|
||||||
DeferredLogger& local_deferredLogger);
|
DeferredLogger& local_deferredLogger);
|
||||||
|
|
||||||
|
virtual int compressedIndex(int cartesian_cell_idx) const = 0;
|
||||||
|
|
||||||
|
|
||||||
Schedule& schedule_;
|
Schedule& schedule_;
|
||||||
const SummaryState& summaryState_;
|
const SummaryState& summaryState_;
|
||||||
const EclipseState& eclState_;
|
const EclipseState& eclState_;
|
||||||
@ -401,11 +404,6 @@ protected:
|
|||||||
|
|
||||||
std::vector<WellProdIndexCalculator> prod_index_calc_;
|
std::vector<WellProdIndexCalculator> prod_index_calc_;
|
||||||
|
|
||||||
// Map from logically cartesian cell indices to compressed ones.
|
|
||||||
// Cells not in the interior are not mapped. This deactivates
|
|
||||||
// these for distributed wells and makes the distribution non-overlapping.
|
|
||||||
std::vector<int> cartesian_to_compressed_;
|
|
||||||
|
|
||||||
std::vector<int> pvt_region_idx_;
|
std::vector<int> pvt_region_idx_;
|
||||||
|
|
||||||
mutable std::unordered_set<std::string> closed_this_step_;
|
mutable std::unordered_set<std::string> closed_this_step_;
|
||||||
|
@ -51,18 +51,11 @@ namespace Opm {
|
|||||||
// Number of cells the global grid view
|
// Number of cells the global grid view
|
||||||
global_num_cells_ = ebosSimulator_.vanguard().globalNumCells();
|
global_num_cells_ = ebosSimulator_.vanguard().globalNumCells();
|
||||||
|
|
||||||
// Set up cartesian mapping.
|
// Set up parallel wells
|
||||||
{
|
{
|
||||||
const auto& grid = this->ebosSimulator_.vanguard().grid();
|
|
||||||
const auto& cartDims = UgGridHelpers::cartDims(grid);
|
|
||||||
setupCartesianToCompressed_(UgGridHelpers::globalCell(grid),
|
|
||||||
cartDims[0] * cartDims[1] * cartDims[2]);
|
|
||||||
|
|
||||||
auto& parallel_wells = ebosSimulator.vanguard().parallelWells();
|
auto& parallel_wells = ebosSimulator.vanguard().parallelWells();
|
||||||
|
this->parallel_well_info_.assign(parallel_wells.begin(),
|
||||||
for (const auto& wellinfo : parallel_wells) {
|
parallel_wells.end());
|
||||||
this->parallel_well_info_.emplace_back(wellinfo, grid.comm());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->alternative_well_rate_init_ =
|
this->alternative_well_rate_init_ =
|
||||||
@ -129,8 +122,7 @@ namespace Opm {
|
|||||||
for ( size_t c=0; c < connectionSet.size(); c++ )
|
for ( size_t c=0; c < connectionSet.size(); c++ )
|
||||||
{
|
{
|
||||||
const auto& connection = connectionSet.get(c);
|
const auto& connection = connectionSet.get(c);
|
||||||
int compressed_idx = cartesian_to_compressed_
|
int compressed_idx = compressedIndex(connection.global_index());
|
||||||
.at(connection.global_index());
|
|
||||||
|
|
||||||
if ( compressed_idx >= 0 ) { // Ignore connections in inactive/remote cells.
|
if ( compressed_idx >= 0 ) { // Ignore connections in inactive/remote cells.
|
||||||
wellCells.push_back(compressed_idx);
|
wellCells.push_back(compressed_idx);
|
||||||
@ -1431,31 +1423,6 @@ namespace Opm {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
void
|
|
||||||
BlackoilWellModel<TypeTag>::
|
|
||||||
setupCartesianToCompressed_(const int* global_cell, int number_of_cartesian_cells)
|
|
||||||
{
|
|
||||||
cartesian_to_compressed_.resize(number_of_cartesian_cells, -1);
|
|
||||||
if (global_cell) {
|
|
||||||
auto elemIt = ebosSimulator_.gridView().template begin</*codim=*/ 0>();
|
|
||||||
for (unsigned i = 0; i < local_num_cells_; ++i) {
|
|
||||||
// Skip perforations in the overlap/ghost for distributed wells.
|
|
||||||
if (elemIt->partitionType() == Dune::InteriorEntity)
|
|
||||||
{
|
|
||||||
assert(ebosSimulator_.gridView().indexSet().index(*elemIt) == static_cast<int>(i));
|
|
||||||
cartesian_to_compressed_[global_cell[i]] = i;
|
|
||||||
}
|
|
||||||
++elemIt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (unsigned i = 0; i < local_num_cells_; ++i) {
|
|
||||||
cartesian_to_compressed_[i] = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
|
@ -263,7 +263,7 @@ void WellInterfaceGeneric::setWellEfficiencyFactor(const double efficiency_facto
|
|||||||
well_efficiency_factor_ = efficiency_factor;
|
well_efficiency_factor_ = efficiency_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellInterfaceGeneric::setRepRadiusPerfLength(const std::vector<int>& cartesian_to_compressed)
|
void WellInterfaceGeneric::setRepRadiusPerfLength()
|
||||||
{
|
{
|
||||||
const int nperf = number_of_perforations_;
|
const int nperf = number_of_perforations_;
|
||||||
|
|
||||||
@ -275,31 +275,35 @@ void WellInterfaceGeneric::setRepRadiusPerfLength(const std::vector<int>& cartes
|
|||||||
perf_length_.reserve(nperf);
|
perf_length_.reserve(nperf);
|
||||||
bore_diameters_.reserve(nperf);
|
bore_diameters_.reserve(nperf);
|
||||||
|
|
||||||
// COMPDAT handling
|
const WellConnections& connections = well_ecl_.getConnections();
|
||||||
const auto& connectionSet = well_ecl_.getConnections();
|
const std::size_t num_conns = connections.size();
|
||||||
CheckDistributedWellConnections checker(well_ecl_, parallel_well_info_);
|
int num_active_connections = 0;
|
||||||
for (size_t c=0; c<connectionSet.size(); c++) {
|
auto my_next_perf = perf_data_->begin();
|
||||||
const auto& connection = connectionSet.get(c);
|
for (std::size_t c = 0; c < num_conns; ++c) {
|
||||||
const int cell =
|
if (my_next_perf == perf_data_->end())
|
||||||
cartesian_to_compressed[connection.global_index()];
|
|
||||||
if (connection.state() != Connection::State::OPEN || cell >= 0)
|
|
||||||
{
|
{
|
||||||
checker.connectionFound(c);
|
break;
|
||||||
}
|
}
|
||||||
|
if (my_next_perf->ecl_index > c)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
assert(my_next_perf->ecl_index == c);
|
||||||
|
const auto& connection = connections[c];
|
||||||
if (connection.state() == Connection::State::OPEN) {
|
if (connection.state() == Connection::State::OPEN) {
|
||||||
|
double radius = connection.rw();
|
||||||
if (cell >= 0) {
|
double re = connection.re(); // area equivalent radius of the grid block
|
||||||
double radius = connection.rw();
|
double perf_length = connection.connectionLength(); // the length of the well perforation
|
||||||
double re = connection.re(); // area equivalent radius of the grid block
|
const double repR = std::sqrt(re * radius);
|
||||||
double perf_length = connection.connectionLength(); // the length of the well perforation
|
perf_rep_radius_.push_back(repR);
|
||||||
const double repR = std::sqrt(re * radius);
|
perf_length_.push_back(perf_length);
|
||||||
perf_rep_radius_.push_back(repR);
|
bore_diameters_.push_back(2. * radius);
|
||||||
perf_length_.push_back(perf_length);
|
num_active_connections++;
|
||||||
bore_diameters_.push_back(2. * radius);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
++my_next_perf;
|
||||||
}
|
}
|
||||||
checker.checkAllConnectionsFound();
|
assert(my_next_perf == perf_data_->end());
|
||||||
|
assert(num_active_connections == nperf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WellInterfaceGeneric::setWsolvent(const double wsolvent)
|
void WellInterfaceGeneric::setWsolvent(const double wsolvent)
|
||||||
|
@ -93,7 +93,7 @@ public:
|
|||||||
void setVFPProperties(const VFPProperties* vfp_properties_arg);
|
void setVFPProperties(const VFPProperties* vfp_properties_arg);
|
||||||
void setGuideRate(const GuideRate* guide_rate_arg);
|
void setGuideRate(const GuideRate* guide_rate_arg);
|
||||||
void setWellEfficiencyFactor(const double efficiency_factor);
|
void setWellEfficiencyFactor(const double efficiency_factor);
|
||||||
void setRepRadiusPerfLength(const std::vector<int>& cartesian_to_compressed);
|
void setRepRadiusPerfLength();
|
||||||
void setWsolvent(const double wsolvent);
|
void setWsolvent(const double wsolvent);
|
||||||
void setDynamicThpLimit(const double thp_limit);
|
void setDynamicThpLimit(const double thp_limit);
|
||||||
void updatePerforatedCell(std::vector<bool>& is_cell_perforated);
|
void updatePerforatedCell(std::vector<bool>& is_cell_perforated);
|
||||||
|
Loading…
Reference in New Issue
Block a user