mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Account for the recycleFirstIteration() false possibility.
This commit is contained in:
parent
2628472f7a
commit
65739e15d6
@ -723,14 +723,18 @@ public:
|
|||||||
*/
|
*/
|
||||||
const IntensiveQuantities* cachedIntensiveQuantities(unsigned globalIdx, unsigned timeIdx) const
|
const IntensiveQuantities* cachedIntensiveQuantities(unsigned globalIdx, unsigned timeIdx) const
|
||||||
{
|
{
|
||||||
if (!enableIntensiveQuantityCache_ ||
|
if (!enableIntensiveQuantityCache_ || !intensiveQuantityCacheUpToDate_[timeIdx][globalIdx]) {
|
||||||
!intensiveQuantityCacheUpToDate_[timeIdx][globalIdx])
|
return nullptr;
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
if (timeIdx > 0 && enableStorageCache_)
|
// With the storage cache enabled, usually only the
|
||||||
// with the storage cache enabled, only the intensive quantities for the most
|
// intensive quantities for the most recent time step are
|
||||||
// recent time step are cached!
|
// cached. However, this may be false for some Problem
|
||||||
return 0;
|
// variants, so we should check if the cache exists for
|
||||||
|
// the timeIdx in question.
|
||||||
|
if (timeIdx > 0 && enableStorageCache_ && intensiveQuantityCache_[timeIdx].empty()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return &intensiveQuantityCache_[timeIdx][globalIdx];
|
return &intensiveQuantityCache_[timeIdx][globalIdx];
|
||||||
}
|
}
|
||||||
@ -818,10 +822,13 @@ public:
|
|||||||
if (!storeIntensiveQuantities())
|
if (!storeIntensiveQuantities())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (enableStorageCache()) {
|
if (enableStorageCache() && simulator_.problem().recycleFirstIterationStorage()) {
|
||||||
// if the storage term is cached, the intensive quantities of the previous
|
// If the storage term is cached, the intensive quantities of the previous
|
||||||
// time steps do not need to be accessed, and we can thus spare ourselves to
|
// time steps do not need to be accessed, and we can thus spare ourselves to
|
||||||
// copy the objects for the intensive quantities.
|
// copy the objects for the intensive quantities.
|
||||||
|
// However, if the storage term at the start of the timestep cannot be deduced
|
||||||
|
// from the primary variables, we must calculate it from the old intensive
|
||||||
|
// quantities, and need to shift them.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user