Merge pull request #4560 from hnil/flexible_iq_in_aq

- changed pointer to refernace for IQ for possibility of using rvalues
This commit is contained in:
Bård Skaflestad 2023-03-28 11:27:45 +02:00 committed by GitHub
commit 82fc5a6b46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,26 +150,23 @@ public:
if (idx < 0)
return;
const auto* intQuantsPtr = &model.intensiveQuantities(cellIdx, timeIdx);
if (intQuantsPtr == nullptr) {
throw std::logic_error("Invalid intensive quantities cache detected in AquiferAnalytical::addToSource()");
}
const auto& intQuants = model.intensiveQuantities(cellIdx, timeIdx);
// This is the pressure at td + dt
this->updateCellPressure(this->pressure_current_, idx, *intQuantsPtr);
this->updateCellPressure(this->pressure_current_, idx, intQuants);
this->calculateInflowRate(idx, this->ebos_simulator_);
rates[BlackoilIndices::conti0EqIdx + compIdx_()]
+= this->Qai_[idx] / model.dofTotalVolume(cellIdx);
if constexpr (enableEnergy) {
auto fs = intQuantsPtr->fluidState();
auto fs = intQuants.fluidState();
if (this->Ta0_.has_value() && this->Qai_[idx] > 0)
{
fs.setTemperature(this->Ta0_.value());
typedef typename std::decay<decltype(fs)>::type::Scalar FsScalar;
typename FluidSystem::template ParameterCache<FsScalar> paramCache;
const unsigned pvtRegionIdx = intQuantsPtr->pvtRegionIndex();
const unsigned pvtRegionIdx = intQuants.pvtRegionIndex();
paramCache.setRegionIndex(pvtRegionIdx);
paramCache.setMaxOilSat(this->ebos_simulator_.problem().maxOilSaturation(cellIdx));
paramCache.updatePhase(fs, this->phaseIdx_());
@ -177,7 +174,7 @@ public:
fs.setEnthalpy(this->phaseIdx_(), h);
}
rates[BlackoilIndices::contiEnergyEqIdx]
+= this->Qai_[idx] *fs.enthalpy(this->phaseIdx_()) * FluidSystem::referenceDensity( this->phaseIdx_(), intQuantsPtr->pvtRegionIndex()) / model.dofTotalVolume(cellIdx);
+= this->Qai_[idx] *fs.enthalpy(this->phaseIdx_()) * FluidSystem::referenceDensity( this->phaseIdx_(), intQuants.pvtRegionIndex()) / model.dofTotalVolume(cellIdx);
}
}