BlackoilWellModel: move getMaxWellConnections to generic class

This commit is contained in:
Arne Morten Kvarving 2023-05-22 10:01:33 +02:00
parent 7ab8d94215
commit dd9a2835fe
4 changed files with 25 additions and 27 deletions

View File

@ -329,8 +329,6 @@ namespace Opm {
void addWellPressureEquations(PressureMatrix& jacobian, const BVector& weights,const bool use_well_weights) const; void addWellPressureEquations(PressureMatrix& jacobian, const BVector& weights,const bool use_well_weights) const;
std::vector<std::vector<int>> getMaxWellConnections() const;
void addWellPressureEquationsStruct(PressureMatrix& jacobian) const; void addWellPressureEquationsStruct(PressureMatrix& jacobian) const;
void initGliftEclWellMap(GLiftEclWells &ecl_well_map); void initGliftEclWellMap(GLiftEclWells &ecl_well_map);

View File

@ -1369,4 +1369,28 @@ assignWellTracerRates(data::Wells& wsrpt,
} }
} }
std::vector<std::vector<int>>
BlackoilWellModelGeneric::
getMaxWellConnections() const
{
std::vector<std::vector<int>> wells;
auto schedule_wells = schedule().getWellsatEnd();
schedule_wells.erase(std::remove_if(schedule_wells.begin(), schedule_wells.end(), not_on_process_), schedule_wells.end());
wells.reserve(schedule_wells.size());
// initialize the additional cell connections introduced by wells.
for ( const auto& well : schedule_wells )
{
std::vector<int> compressed_well_perforations = this->getCellsForConnections(well);
// also include wells with no perforations in case
std::sort(compressed_well_perforations.begin(),
compressed_well_perforations.end());
wells.push_back(compressed_well_perforations);
}
return wells;
}
} }

View File

@ -382,6 +382,7 @@ protected:
virtual int compressedIndexForInterior(int cartesian_cell_idx) const = 0; virtual int compressedIndexForInterior(int cartesian_cell_idx) const = 0;
std::vector<int> getCellsForConnections(const Well& well) const; std::vector<int> getCellsForConnections(const Well& well) const;
std::vector<std::vector<int>> getMaxWellConnections() const;
std::vector<std::string> getWellsForTesting(const int timeStepIdx, std::vector<std::string> getWellsForTesting(const int timeStepIdx,
const double simulationTime); const double simulationTime);

View File

@ -1472,31 +1472,6 @@ namespace Opm {
return w.size(); return w.size();
} }
template<typename TypeTag>
std::vector<std::vector<int>>
BlackoilWellModel<TypeTag>::
getMaxWellConnections() const
{
std::vector<std::vector<int>> wells;
auto schedule_wells = schedule().getWellsatEnd();
schedule_wells.erase(std::remove_if(schedule_wells.begin(), schedule_wells.end(), not_on_process_), schedule_wells.end());
wells.reserve(schedule_wells.size());
// initialize the additional cell connections introduced by wells.
for ( const auto& well : schedule_wells )
{
std::vector<int> compressed_well_perforations = this->getCellsForConnections(well);
// also include wells with no perforations in case
std::sort(compressed_well_perforations.begin(),
compressed_well_perforations.end());
wells.push_back(compressed_well_perforations);
}
return wells;
}
template<typename TypeTag> template<typename TypeTag>
void void
BlackoilWellModel<TypeTag>:: BlackoilWellModel<TypeTag>::