Initialise Fluid-in-Place Balance Sheets at Restart

Commit 6ba9dc086 (PR #5626) moved the balance sheet report output
logic ahead of the timestep.  As a consequence, the output module's
'inplace_' and 'initialInplace_' data members must be fully
initialised the first time we call 'writeReports()' if the run
requests balance sheet output.

This commit initialises those objects by calling calc_inplace() from
EclWriter<>::endRestart().  Doing so restores the behaviour from
before PR #5626.  Note, however, that using this value for
'initialInplace_' is incorrect as the simulator then, in a restarted
run, will calculate recovery factors based on the fluid distribution
at the restart time instead of at the start of the base run.
Nevertheless this is, as alluded to earlier, how the simulator has
always performed.  The behaviour is just a little more explicit now.
This commit is contained in:
Bård Skaflestad 2024-10-09 13:37:41 +02:00
parent 1475e47901
commit 71079ce737

View File

@ -637,7 +637,29 @@ public:
}
void endRestart()
{}
{
// We need these objects to satisfy the interface requirements of
// member function calc_inplace(), but the objects are otherwise
// unused and intentionally so.
auto miscSummaryData = std::map<std::string, double>{};
auto regionData = std::map<std::string, std::vector<double>>{};
// Note: calc_inplace() *also* assigns the output module's
// "initialInplace_" data member. This is, semantically speaking,
// very wrong, as the run's intial volumes then correspond to the
// volumes at the restart time instead of the start of the base run.
// Nevertheless, this is how Flow has "always" done it.
//
// See GenericOutputBlackoilModule::accumulateRegionSums() for
// additional comments.
auto inplace = this->outputModule_
->calc_inplace(miscSummaryData, regionData,
this->simulator_.gridView().comm());
if (this->collectOnIORank_.isIORank()) {
this->inplace_ = std::move(inplace);
}
}
const OutputBlackOilModule<TypeTag>& outputModule() const
{ return *outputModule_; }