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 timeIdx)
|
||||||
{
|
{
|
||||||
const unsigned cellIdx = context.globalSpaceIndex(spaceIdx, 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];
|
const int idx = this->cellToConnectionIdx_[cellIdx];
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// We are dereferencing the value of IntensiveQuantities because
|
const auto* intQuantsPtr = model.cachedIntensiveQuantities(cellIdx, timeIdx);
|
||||||
// cachedIntensiveQuantities return a const pointer to
|
if (intQuantsPtr == nullptr) {
|
||||||
// IntensiveQuantities of that particular cell_id
|
throw std::logic_error("Invalid intensive quantities cache detected in AquiferInterface::addToSource()");
|
||||||
const auto& intQuants = context.intensiveQuantities(spaceIdx, timeIdx);
|
}
|
||||||
|
|
||||||
// This is the pressure at td + dt
|
// This is the pressure at td + dt
|
||||||
this->updateCellPressure(this->pressure_current_, idx, intQuants);
|
this->updateCellPressure(this->pressure_current_, idx, *intQuantsPtr);
|
||||||
this->calculateInflowRate(idx, context.simulator());
|
this->calculateInflowRate(idx, ebos_simulator_);
|
||||||
|
|
||||||
rates[BlackoilIndices::conti0EqIdx + compIdx_()]
|
rates[BlackoilIndices::conti0EqIdx + compIdx_()]
|
||||||
+= this->Qai_[idx] / context.dofVolume(spaceIdx, timeIdx);
|
+= this->Qai_[idx] / model.dofTotalVolume(cellIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t size() const {
|
std::size_t size() const {
|
||||||
return this->connections_.size();
|
return this->connections_.size();
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,7 @@ public:
|
|||||||
// add the water rate due to aquifers to the source term.
|
// add the water rate due to aquifers to the source term.
|
||||||
template <class Context>
|
template <class Context>
|
||||||
void addToSource(RateVector& rates, const Context& context, unsigned spaceIdx, unsigned timeIdx) const;
|
void addToSource(RateVector& rates, const Context& context, unsigned spaceIdx, unsigned timeIdx) const;
|
||||||
|
void addToSource(RateVector& rates, unsigned globalSpaceIdx, unsigned timeIdx) const;
|
||||||
void endIteration();
|
void endIteration();
|
||||||
void endTimeStep();
|
void endTimeStep();
|
||||||
void endEpisode();
|
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>
|
template <typename TypeTag>
|
||||||
void
|
void
|
||||||
BlackoilAquiferModel<TypeTag>::endIteration()
|
BlackoilAquiferModel<TypeTag>::endIteration()
|
||||||
|
Loading…
Reference in New Issue
Block a user