mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-26 01:01:00 -06:00
Refactor addToSource to add interface not using element context.
This commit is contained in:
parent
66a1c46413
commit
b1bcab31b9
@ -143,24 +143,31 @@ public:
|
||||
const unsigned timeIdx)
|
||||
{
|
||||
const unsigned cellIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
|
||||
addToSource(rates, cellIdx, timeIdx);
|
||||
}
|
||||
|
||||
void addToSource(RateVector& rates,
|
||||
const unsigned cellIdx,
|
||||
const unsigned timeIdx)
|
||||
{
|
||||
const auto& model = ebos_simulator_.model();
|
||||
|
||||
const int idx = this->cellToConnectionIdx_[cellIdx];
|
||||
if (idx < 0)
|
||||
return;
|
||||
|
||||
// We are dereferencing the value of IntensiveQuantities because
|
||||
// cachedIntensiveQuantities return a const pointer to
|
||||
// IntensiveQuantities of that particular cell_id
|
||||
const auto& intQuants = context.intensiveQuantities(spaceIdx, timeIdx);
|
||||
const auto* intQuantsPtr = model.cachedIntensiveQuantities(cellIdx, timeIdx);
|
||||
if (intQuantsPtr == nullptr) {
|
||||
throw std::logic_error("Invalid intensive quantities cache detected in AquiferInterface::addToSource()");
|
||||
}
|
||||
|
||||
// This is the pressure at td + dt
|
||||
this->updateCellPressure(this->pressure_current_, idx, intQuants);
|
||||
this->calculateInflowRate(idx, context.simulator());
|
||||
this->updateCellPressure(this->pressure_current_, idx, *intQuantsPtr);
|
||||
this->calculateInflowRate(idx, ebos_simulator_);
|
||||
|
||||
rates[BlackoilIndices::conti0EqIdx + compIdx_()]
|
||||
+= this->Qai_[idx] / context.dofVolume(spaceIdx, timeIdx);
|
||||
+= this->Qai_[idx] / model.dofTotalVolume(cellIdx);
|
||||
}
|
||||
|
||||
std::size_t size() const {
|
||||
return this->connections_.size();
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ public:
|
||||
// add the water rate due to aquifers to the source term.
|
||||
template <class Context>
|
||||
void addToSource(RateVector& rates, const Context& context, unsigned spaceIdx, unsigned timeIdx) const;
|
||||
void addToSource(RateVector& rates, unsigned globalSpaceIdx, unsigned timeIdx) const;
|
||||
void endIteration();
|
||||
void endTimeStep();
|
||||
void endEpisode();
|
||||
|
@ -126,6 +126,24 @@ BlackoilAquiferModel<TypeTag>::addToSource(RateVector& rates,
|
||||
}
|
||||
}
|
||||
|
||||
template <typename TypeTag>
|
||||
void
|
||||
BlackoilAquiferModel<TypeTag>::addToSource(RateVector& rates,
|
||||
unsigned globalSpaceIdx,
|
||||
unsigned timeIdx) const
|
||||
{
|
||||
if (aquiferCarterTracyActive()) {
|
||||
for (auto& aquifer : aquifers_CarterTracy) {
|
||||
aquifer.addToSource(rates, globalSpaceIdx, timeIdx);
|
||||
}
|
||||
}
|
||||
if (aquiferFetkovichActive()) {
|
||||
for (auto& aquifer : aquifers_Fetkovich) {
|
||||
aquifer.addToSource(rates, globalSpaceIdx, timeIdx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename TypeTag>
|
||||
void
|
||||
BlackoilAquiferModel<TypeTag>::endIteration()
|
||||
|
Loading…
Reference in New Issue
Block a user