Merge pull request #2847 from blattms/blackoilmodel-getLocalNonshutWells

Added BlackoilWellModel::getLocalNonshutWells to reduce code duplicat…
This commit is contained in:
Atgeirr Flø Rasmussen
2020-10-09 16:35:50 +02:00
committed by GitHub
2 changed files with 18 additions and 13 deletions
@@ -331,6 +331,12 @@ namespace Opm {
const std::string &msg, const std::string &msg,
Opm::DeferredLogger& deferred_logger) const; Opm::DeferredLogger& deferred_logger) const;
/// \brief Get the wells of our partition that are not shut.
/// \param timeStepIdx The index of the time step.
/// \param[out] globalNumWells the number of wells globally.
std::vector< Well > getLocalNonshutWells(const int timeStepIdx,
int& globalNumWells) const;
// compute the well fluxes and assemble them in to the reservoir equations as source terms // compute the well fluxes and assemble them in to the reservoir equations as source terms
// and in the well equations. // and in the well equations.
void assemble(const int iterationIdx, void assemble(const int iterationIdx,
+12 -13
View File
@@ -211,7 +211,16 @@ namespace Opm {
} }
template<typename TypeTag>
std::vector< Well >
BlackoilWellModel<TypeTag>::
getLocalNonshutWells(const int timeStepIdx, int& globalNumWells) const
{
auto w = schedule().getWells(timeStepIdx);
globalNumWells = w.size();
w.erase(std::remove_if(w.begin(), w.end(), is_shut_or_defunct_), w.end());
return w;
}
template<typename TypeTag> template<typename TypeTag>
void void
@@ -225,12 +234,7 @@ namespace Opm {
const auto& summaryState = ebosSimulator_.vanguard().summaryState(); const auto& summaryState = ebosSimulator_.vanguard().summaryState();
int globalNumWells = 0; int globalNumWells = 0;
// Make wells_ecl_ contain only this partition's non-shut wells. // Make wells_ecl_ contain only this partition's non-shut wells.
{ wells_ecl_ = getLocalNonshutWells(timeStepIdx, globalNumWells);
auto w = schedule().getWells(timeStepIdx);
globalNumWells = w.size();
w.erase(std::remove_if(w.begin(), w.end(), is_shut_or_defunct_), w.end());
wells_ecl_.swap(w);
}
initializeWellPerfData(); initializeWellPerfData();
// Wells are active if they are active wells on at least // Wells are active if they are active wells on at least
@@ -549,12 +553,7 @@ namespace Opm {
const auto& summaryState = ebosSimulator_.vanguard().summaryState(); const auto& summaryState = ebosSimulator_.vanguard().summaryState();
int globalNumWells = 0; int globalNumWells = 0;
// Make wells_ecl_ contain only this partition's non-shut wells. // Make wells_ecl_ contain only this partition's non-shut wells.
{ wells_ecl_ = getLocalNonshutWells(report_step, globalNumWells);
auto w = schedule().getWells(report_step);
globalNumWells = w.size();
w.erase(std::remove_if(w.begin(), w.end(), is_shut_or_defunct_), w.end());
wells_ecl_.swap(w);
}
initializeWellPerfData(); initializeWellPerfData();