mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-24 16:30:02 -06:00
changed: use updateProperty_ in updateMaxOilSaturation_
This commit is contained in:
parent
e4fe00413b
commit
32995d34a1
@ -2209,33 +2209,18 @@ private:
|
||||
|
||||
bool updateMaxOilSaturation_()
|
||||
{
|
||||
const auto& simulator = this->simulator();
|
||||
int episodeIdx = this->episodeIndex();
|
||||
|
||||
// we use VAPPARS
|
||||
if (this->vapparsActive(episodeIdx)) {
|
||||
ElementContext elemCtx(simulator);
|
||||
const auto& vanguard = simulator.vanguard();
|
||||
auto elemIt = vanguard.gridView().template begin</*codim=*/0>();
|
||||
const auto& elemEndIt = vanguard.gridView().template end</*codim=*/0>();
|
||||
OPM_BEGIN_PARALLEL_TRY_CATCH();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const Element& elem = *elemIt;
|
||||
|
||||
elemCtx.updatePrimaryStencil(elem);
|
||||
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
||||
|
||||
unsigned compressedDofIdx = elemCtx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0);
|
||||
const auto& iq = elemCtx.intensiveQuantities(/*spaceIdx=*/0, /*timeIdx=*/0);
|
||||
const auto& fs = iq.fluidState();
|
||||
|
||||
Scalar So = decay<Scalar>(fs.saturation(oilPhaseIdx));
|
||||
|
||||
this->maxOilSaturation_[compressedDofIdx] = std::max(this->maxOilSaturation_[compressedDofIdx], So);
|
||||
}
|
||||
OPM_END_PARALLEL_TRY_CATCH("EclProblem::updateMayOilSaturation() failed:", vanguard.grid().comm());
|
||||
// we need to invalidate the intensive quantities cache here because the
|
||||
// derivatives of Rs and Rv will most likely have changed
|
||||
this->updateProperty_("EclProblem::updateMaxOilSaturation_() failed:",
|
||||
[this](unsigned compressedDofIdx, const IntensiveQuantities& iq)
|
||||
{
|
||||
const auto& fs = iq.fluidState();
|
||||
const Scalar So = decay<Scalar>(fs.saturation(oilPhaseIdx));
|
||||
auto& mos = this->maxOilSaturation_;
|
||||
mos[compressedDofIdx] = std::max(mos[compressedDofIdx], So);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user