mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #4982 from akva2/implement_rptsol_rptsched
Implement support for RPTSOL and RPTSCHED configuration of FIP output
This commit is contained in:
commit
f7067897b3
@ -265,6 +265,7 @@ template<class FluidSystem,class Scalar>
|
||||
Inplace EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
|
||||
outputFipLog(std::map<std::string, double>& miscSummaryData,
|
||||
std::map<std::string, std::vector<double>>& regionData,
|
||||
const std::size_t reportStepNum,
|
||||
const bool substep,
|
||||
const Parallel::Communication& comm)
|
||||
{
|
||||
@ -276,9 +277,27 @@ outputFipLog(std::map<std::string, double>& miscSummaryData,
|
||||
miscSummaryData,
|
||||
regionData);
|
||||
|
||||
if (!substep && !forceDisableFipOutput_) {
|
||||
// For report step 0 we use the RPTSOL config, else derive from RPTSCHED
|
||||
std::unique_ptr<FIPConfig> fipSched;
|
||||
if (reportStepNum != 0) {
|
||||
const auto& rpt = this->schedule_[reportStepNum].rpt_config.get();
|
||||
fipSched = std::make_unique<FIPConfig>(rpt);
|
||||
}
|
||||
const FIPConfig& fipc = reportStepNum == 0 ? this->eclState_.getEclipseConfig().fip()
|
||||
: *fipSched;
|
||||
|
||||
if (!substep && !forceDisableFipOutput_ && fipc.output(FIPConfig::OutputField::FIELD)) {
|
||||
logOutput_.fip(inplace, this->initialInplace(), "");
|
||||
logOutput_.fip(inplace, this->initialInplace(), "FIPNUM");
|
||||
if (fipc.output(FIPConfig::OutputField::FIPNUM)) {
|
||||
logOutput_.fip(inplace, this->initialInplace(), "FIPNUM");
|
||||
}
|
||||
if (fipc.output(FIPConfig::OutputField::FIP)) {
|
||||
for (const auto& reg : this->regions_) {
|
||||
if (reg.first != "FIPNUM") {
|
||||
logOutput_.fip(inplace, this->initialInplace(), reg.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return inplace;
|
||||
@ -287,9 +306,10 @@ outputFipLog(std::map<std::string, double>& miscSummaryData,
|
||||
template<class FluidSystem,class Scalar>
|
||||
Inplace EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
|
||||
outputFipresvLog(std::map<std::string, double>& miscSummaryData,
|
||||
std::map<std::string, std::vector<double>>& regionData,
|
||||
const bool substep,
|
||||
const Parallel::Communication& comm)
|
||||
std::map<std::string, std::vector<double>>& regionData,
|
||||
const std::size_t reportStepNum,
|
||||
const bool substep,
|
||||
const Parallel::Communication& comm)
|
||||
{
|
||||
auto inplace = this->accumulateRegionSums(comm);
|
||||
if (comm.rank() != 0)
|
||||
@ -299,7 +319,16 @@ outputFipresvLog(std::map<std::string, double>& miscSummaryData,
|
||||
miscSummaryData,
|
||||
regionData);
|
||||
|
||||
if (!substep && !forceDisableFipresvOutput_) {
|
||||
// For report step 0 we use the RPTSOL config, else derive from RPTSCHED
|
||||
std::unique_ptr<FIPConfig> fipSched;
|
||||
if (reportStepNum != 0) {
|
||||
const auto& rpt = this->schedule_[reportStepNum].rpt_config.get();
|
||||
fipSched = std::make_unique<FIPConfig>(rpt);
|
||||
}
|
||||
const FIPConfig& fipc = reportStepNum == 0 ? this->eclState_.getEclipseConfig().fip()
|
||||
: *fipSched;
|
||||
|
||||
if (!substep && !forceDisableFipresvOutput_ && fipc.output(FIPConfig::OutputField::RESV)) {
|
||||
logOutput_.fipResv(inplace);
|
||||
}
|
||||
|
||||
@ -1306,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.
|
||||
//
|
||||
|
@ -79,17 +79,17 @@ public:
|
||||
// write Fluid In Place to output log
|
||||
Inplace outputFipLog(std::map<std::string, double>& miscSummaryData,
|
||||
std::map<std::string, std::vector<double>>& regionData,
|
||||
const std::size_t reportStepNum,
|
||||
const bool substep,
|
||||
const Parallel::Communication& comm);
|
||||
|
||||
// write Reservoir Volumes to output log
|
||||
Inplace outputFipresvLog(std::map<std::string, double>& miscSummaryData,
|
||||
std::map<std::string, std::vector<double>>& regionData,
|
||||
const std::size_t reportStepNum,
|
||||
const bool substep,
|
||||
const Parallel::Communication& comm);
|
||||
|
||||
|
||||
|
||||
void outputErrorLog(const Parallel::Communication& comm) const;
|
||||
|
||||
void addRftDataToWells(data::Wells& wellDatas,
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -248,9 +248,11 @@ public:
|
||||
std::map<std::string, std::vector<double>> regionData;
|
||||
Inplace inplace;
|
||||
{
|
||||
OPM_TIMEBLOCK(outputFipLogAndFipresvLog);
|
||||
inplace = eclOutputModule_->outputFipLog(miscSummaryData, regionData, isSubStep, simulator_.gridView().comm());
|
||||
eclOutputModule_->outputFipresvLog(miscSummaryData, regionData, isSubStep, simulator_.gridView().comm());
|
||||
OPM_TIMEBLOCK(outputFipLogAndFipresvLog);
|
||||
inplace = eclOutputModule_->outputFipLog(miscSummaryData, regionData, reportStepNum,
|
||||
isSubStep, simulator_.gridView().comm());
|
||||
eclOutputModule_->outputFipresvLog(miscSummaryData, regionData, reportStepNum,
|
||||
isSubStep, simulator_.gridView().comm());
|
||||
}
|
||||
bool forceDisableProdOutput = false;
|
||||
bool forceDisableInjOutput = false;
|
||||
@ -317,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);
|
||||
|
Loading…
Reference in New Issue
Block a user