Set correct episode before initial call to invalidateAndUpdateIntensiveQuantities

This commit is contained in:
Vegard Kippe 2024-08-27 15:51:56 +02:00
parent 8f45cbe4c4
commit 0485bfb47f
2 changed files with 8 additions and 7 deletions

View File

@ -601,9 +601,7 @@ public:
// update maximum water saturation and minimum pressure // update maximum water saturation and minimum pressure
// used when ROCKCOMP is activated // used when ROCKCOMP is activated
// Do not update max RS first step after a restart asImp_().updateExplicitQuantities_(episodeIdx, timeStepSize);
asImp_().updateExplicitQuantities_(episodeIdx, timeStepSize, first_step_ && (episodeIdx > 0));
first_step_ = false;
if (nonTrivialBoundaryConditions()) { if (nonTrivialBoundaryConditions()) {
this->model().linearizer().updateBoundaryConditionData(); this->model().linearizer().updateBoundaryConditionData();
@ -1873,7 +1871,7 @@ private:
Implementation& asImp_() Implementation& asImp_()
{ return *static_cast<Implementation *>(this); } { return *static_cast<Implementation *>(this); }
protected: protected:
void updateExplicitQuantities_(int episodeIdx, int timeStepSize, const bool first_step_after_restart = false) void updateExplicitQuantities_(int episodeIdx, int timeStepSize)
{ {
OPM_TIMEBLOCK(updateExplicitQuantities); OPM_TIMEBLOCK(updateExplicitQuantities);
const bool invalidateFromMaxWaterSat = updateMaxWaterSaturation_(); const bool invalidateFromMaxWaterSat = updateMaxWaterSaturation_();
@ -1884,8 +1882,8 @@ protected:
const bool invalidateFromMaxOilSat = updateMaxOilSaturation_(); const bool invalidateFromMaxOilSat = updateMaxOilSaturation_();
// deal with DRSDT and DRVDT (do not update first step after a restart) // deal with DRSDT and DRVDT
const bool invalidateDRDT = !first_step_after_restart && this->asImp_().updateCompositionChangeLimits_(); const bool invalidateDRDT = this->asImp_().updateCompositionChangeLimits_();
// the derivatives may have change // the derivatives may have change
bool invalidateIntensiveQuantities bool invalidateIntensiveQuantities
@ -2890,9 +2888,10 @@ private:
BCData<int> bcindex_; BCData<int> bcindex_;
bool nonTrivialBoundaryConditions_ = false; bool nonTrivialBoundaryConditions_ = false;
bool explicitRockCompaction_ = false; bool explicitRockCompaction_ = false;
bool first_step_ = true;
ModuleParams moduleParams_; ModuleParams moduleParams_;
}; };
} // namespace Opm } // namespace Opm

View File

@ -195,6 +195,8 @@ public:
{ {
init(timer); init(timer);
// Make cache up to date. No need for updating it in elementCtx. // Make cache up to date. No need for updating it in elementCtx.
// NB! Need to be at the correct step in case of restart
simulator_.setEpisodeIndex(timer.currentStepNum());
simulator_.model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0); simulator_.model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0);
// Main simulation loop. // Main simulation loop.
while (!timer.done()) { while (!timer.done()) {