computeWellBlockAveragePressures: move to BlackoilWellModelGeneric

This commit is contained in:
Arne Morten Kvarving 2024-11-18 11:46:26 +01:00
parent 4d998545eb
commit 44c8b6086b
4 changed files with 46 additions and 50 deletions

View File

@ -296,7 +296,7 @@ template<class Scalar> class WellContributions;
data::WellBlockAveragePressures wellBlockAveragePressures() const
{
return this->computeWellBlockAveragePressures();
return this->computeWellBlockAveragePressures(this->gravity_);
}
// subtract B*inv(D)*C * x from A*x
@ -500,9 +500,6 @@ template<class Scalar> class WellContributions;
// setting the well_solutions_ based on well_state.
void updatePrimaryVariables(DeferredLogger& deferred_logger);
data::WellBlockAveragePressures
computeWellBlockAveragePressures() const;
void updateAverageFormationFactor();
void computePotentials(const std::size_t widx,

View File

@ -2175,6 +2175,48 @@ initializeWBPCalculationService()
this->wbpCalculationService_.defineCommunication();
}
template<class Scalar>
data::WellBlockAveragePressures
BlackoilWellModelGeneric<Scalar>::
computeWellBlockAveragePressures(const Scalar gravity) const
{
auto wbpResult = data::WellBlockAveragePressures{};
using Calculated = typename PAvgCalculatorResult<Scalar>::WBPMode;
using Output = data::WellBlockAvgPress::Quantity;
this->wbpCalculationService_.collectDynamicValues();
const auto numWells = this->wells_ecl_.size();
for (auto wellID = 0*numWells; wellID < numWells; ++wellID) {
const auto calcIdx = this->wbpCalcMap_[wellID].wbpCalcIdx_;
const auto& well = this->wells_ecl_[wellID];
if (! well.hasRefDepth()) {
// Can't perform depth correction without at least a
// fall-back datum depth.
continue;
}
this->wbpCalculationService_
.inferBlockAveragePressures(calcIdx, well.pavg(),
gravity,
well.getWPaveRefDepth());
const auto& result = this->wbpCalculationService_
.averagePressures(calcIdx);
auto& reported = wbpResult.values[well.name()];
reported[Output::WBP] = result.value(Calculated::WBP);
reported[Output::WBP4] = result.value(Calculated::WBP4);
reported[Output::WBP5] = result.value(Calculated::WBP5);
reported[Output::WBP9] = result.value(Calculated::WBP9);
}
return wbpResult;
}
template class BlackoilWellModelGeneric<double>;
#if FLOW_INSTANTIATE_FLOAT

View File

@ -465,6 +465,9 @@ protected:
void initializeWBPCalculationService();
data::WellBlockAveragePressures
computeWellBlockAveragePressures(const Scalar gravity) const;
Schedule& schedule_;
const SummaryState& summaryState_;
const EclipseState& eclState_;

View File

@ -2357,52 +2357,6 @@ namespace Opm {
template <typename TypeTag>
data::WellBlockAveragePressures
BlackoilWellModel<TypeTag>::
computeWellBlockAveragePressures() const
{
auto wbpResult = data::WellBlockAveragePressures{};
using Calculated = typename PAvgCalculatorResult<Scalar>::WBPMode;
using Output = data::WellBlockAvgPress::Quantity;
this->wbpCalculationService_.collectDynamicValues();
const auto numWells = this->wells_ecl_.size();
for (auto wellID = 0*numWells; wellID < numWells; ++wellID) {
const auto calcIdx = this->wbpCalcMap_[wellID].wbpCalcIdx_;
const auto& well = this->wells_ecl_[wellID];
if (! well.hasRefDepth()) {
// Can't perform depth correction without at least a
// fall-back datum depth.
continue;
}
this->wbpCalculationService_
.inferBlockAveragePressures(calcIdx, well.pavg(),
this->gravity_,
well.getWPaveRefDepth());
const auto& result = this->wbpCalculationService_
.averagePressures(calcIdx);
auto& reported = wbpResult.values[well.name()];
reported[Output::WBP] = result.value(Calculated::WBP);
reported[Output::WBP4] = result.value(Calculated::WBP4);
reported[Output::WBP5] = result.value(Calculated::WBP5);
reported[Output::WBP9] = result.value(Calculated::WBP9);
}
return wbpResult;
}
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::