added: write out RPTSOL configured FIPs to PRT file on simulation start

add a method in EclWriter to enable this.
this is called the first time a call is made to WriteOutput,
as that happens after initial conditions have been applied which
is required to get the proper output.

this also fixes a long-standing issue where the initial FIP state was
taken after the first time step.
This commit is contained in:
Arne Morten Kvarving 2023-11-09 12:38:25 +01:00
parent 1e41df3bca
commit db85303a3e
3 changed files with 42 additions and 6 deletions

View File

@ -1335,10 +1335,7 @@ accumulateRegionSums(const Parallel::Communication& comm)
}
// The first time the outputFipLog function is run we store the inplace values in
// the initialInplace_ member. This has at least two problems:
//
// o We really want the *initial* value - now we get the value after
// the first timestep.
// the initialInplace_ member. This has a problem:
//
// o For restarted runs this is obviously wrong.
//

View File

@ -754,8 +754,6 @@ public:
if (enableEclOutput_){
eclWriter_->writeOutput(std::move(localCellData), isSubStep);
}
}
void finalizeOutput() {
@ -1346,6 +1344,10 @@ public:
if (enableAquifers_)
aquiferModel_.initialSolutionApplied();
if (this->simulator().episodeIndex() == 0) {
eclWriter_->writeInitialFIPReport();
}
}
/*!

View File

@ -319,6 +319,43 @@ public:
}
}
//! \brief Writes the initial FIP report as configured in RPTSOL.
void writeInitialFIPReport()
{
const auto& fip = simulator_.vanguard().eclState().getEclipseConfig().fip();
if (!fip.output(FIPConfig::OutputField::FIELD) &&
!fip.output(FIPConfig::OutputField::RESV)) {
return;
}
const auto& gridView = simulator_.vanguard().gridView();
const int numElements = gridView.size(/*codim=*/0);
this->eclOutputModule_->
allocBuffers(numElements, 0, false, false, /*isRestart*/ false);
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int dofIdx = 0; dofIdx < numElements; ++dofIdx) {
const auto& intQuants = *simulator_.model().cachedIntensiveQuantities(dofIdx, /*timeIdx=*/0);
const auto totVolume = simulator_.model().dofTotalVolume(dofIdx);
this->eclOutputModule_->updateFluidInPlace(dofIdx, intQuants, totVolume);
}
std::map<std::string, double> miscSummaryData;
std::map<std::string, std::vector<double>> regionData;
Inplace inplace;
{
OPM_TIMEBLOCK(outputFipLogAndFipresvLog);
inplace = eclOutputModule_->outputFipLog(miscSummaryData, regionData, 0,
false, simulator_.gridView().comm());
eclOutputModule_->outputFipresvLog(miscSummaryData, regionData, 0,
false, simulator_.gridView().comm());
}
}
void writeOutput(data::Solution&& localCellData, bool isSubStep)
{
OPM_TIMEBLOCK(writeOutput);