BlackoilWellModel: move assignWellTracerRates to generic class

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

View File

@ -256,7 +256,9 @@ namespace Opm {
return this->wasDynamicallyShutThisTimeStep(well_index);
});
this->assignWellTracerRates(wsrpt);
const auto& tracerRates = ebosSimulator_.problem().tracerModel().getWellTracerRates();
this->assignWellTracerRates(wsrpt, tracerRates);
BlackoilWellModelGuideRates(*this).assignWellGuideRates(wsrpt, this->reportStepIndex());
this->assignShutConnections(wsrpt, this->reportStepIndex());
@ -512,8 +514,6 @@ namespace Opm {
void computeWellTemperature();
void assignWellTracerRates(data::Wells& wsrpt) const;
int compressedIndexForInterior(int cartesian_cell_idx) const override {
return ebosSimulator_.vanguard().compressedIndexForInterior(cartesian_cell_idx);
}

View File

@ -1349,4 +1349,24 @@ BlackoilWellModelGeneric::getWellsForTesting(const int timeStepIdx,
return {};
}
void
BlackoilWellModelGeneric::
assignWellTracerRates(data::Wells& wsrpt,
const WellTracerRates& wellTracerRates) const
{
if (wellTracerRates.empty())
return; // no tracers
for (const auto& wTR : wellTracerRates) {
std::string wellName = wTR.first.first;
auto xwPos = wsrpt.find(wellName);
if (xwPos == wsrpt.end()) { // No well results.
continue;
}
std::string tracerName = wTR.first.second;
double rate = wTR.second;
xwPos->second.rates.set(data::Rates::opt::tracer, rate, tracerName);
}
}
}

View File

@ -386,6 +386,10 @@ protected:
std::vector<std::string> getWellsForTesting(const int timeStepIdx,
const double simulationTime);
using WellTracerRates = std::map<std::pair<std::string, std::string>, double>;
void assignWellTracerRates(data::Wells& wsrpt,
const WellTracerRates& wellTracerRates) const;
Schedule& schedule_;
const SummaryState& summaryState_;
const EclipseState& eclState_;

View File

@ -1330,7 +1330,7 @@ namespace Opm {
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::
apply( BVector& r) const
apply(BVector& r) const
{
for (auto& well : well_container_) {
well->apply(r);
@ -2311,29 +2311,6 @@ namespace Opm {
template <typename TypeTag>
void
BlackoilWellModel<TypeTag>::
assignWellTracerRates(data::Wells& wsrpt) const
{
const auto & wellTracerRates = ebosSimulator_.problem().tracerModel().getWellTracerRates();
if (wellTracerRates.empty())
return; // no tracers
for (const auto& wTR : wellTracerRates) {
std::string wellName = wTR.first.first;
auto xwPos = wsrpt.find(wellName);
if (xwPos == wsrpt.end()) { // No well results.
continue;
}
std::string tracerName = wTR.first.second;
double rate = wTR.second;
xwPos->second.rates.set(data::Rates::opt::tracer, rate, tracerName);
}
}
template <typename TypeTag>
void
BlackoilWellModel<TypeTag>::